导航菜单

页面标题

页面副标题

BodyTech v7.6.4 - PaymentPollingViewModel.java 源代码

正在查看: BodyTech v7.6.4 应用的 PaymentPollingViewModel.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.fitnessmobileapps.fma.views.stripe;

import a2.b;
import androidx.compose.runtime.internal.StabilityInferred;
import androidx.core.app.NotificationCompat;
import androidx.exifinterface.media.ExifInterface;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelKt;
import com.fitnessmobileapps.fma.core.flags.FlagsUtilsClassKt;
import com.fitnessmobileapps.fma.model.BaseMindBodyResponse;
import com.fitnessmobileapps.fma.views.stripe.PaymentStatus;
import com.stripe.android.Stripe;
import com.stripe.android.model.PaymentIntent;
import com.stripe.android.model.StripeIntent;
import java.util.Map;
import java.util.concurrent.CancellationException;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.Result;
import kotlin.Unit;
import kotlin.collections.g0;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.r;
import kotlinx.coroutines.BuildersKt__Builders_commonKt;
import kotlinx.coroutines.DelayKt;
import kotlinx.coroutines.Dispatchers;
import kotlinx.coroutines.Job;
import kotlinx.coroutines.flow.FlowKt;
import kotlinx.coroutines.flow.MutableStateFlow;
import kotlinx.coroutines.flow.StateFlow;
import kotlinx.coroutines.flow.StateFlowKt;
import vf.o;
import vf.s;

@StabilityInferred(parameters = 0)
@Metadata(d1 = {"\u0000\u0094\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\b\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0010%\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0005\b\u0007\u0018\u0000 02\u00020\u0001:\u000379=B\u0007¢\u0006\u0004\bQ\u0010RJ\u0016\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004J\u0010\u0010\n\u001a\u00020\u00062\b\b\u0002\u0010\t\u001a\u00020\bJ\u0006\u0010\u000b\u001a\u00020\u0006J\u000e\u0010\u000e\u001a\u00020\u00062\u0006\u0010\r\u001a\u00020\fJ\u000e\u0010\u0010\u001a\u00020\u00062\u0006\u0010\u000f\u001a\u00020\fJ\b\u0010\u0011\u001a\u00020\u0006H\u0014J#\u0010\u0013\u001a\u00020\u00062\u0006\u0010\u0012\u001a\u00020\f2\u0006\u0010\t\u001a\u00020\bH\u0082@ø\u0001\u0000¢\u0006\u0004\b\u0013\u0010\u0014J#\u0010\u0018\u001a\u00020\u00172\u0006\u0010\u0012\u001a\u00020\f2\u0006\u0010\u0016\u001a\u00020\u0015H\u0082@ø\u0001\u0000¢\u0006\u0004\b\u0018\u0010\u0019J\u0018\u0010\u001c\u001a\u00020\u00172\u0006\u0010\u001b\u001a\u00020\u001a2\u0006\u0010\u0016\u001a\u00020\u0015H\u0002J\u001b\u0010\u001d\u001a\u00020\u001a2\u0006\u0010\u0012\u001a\u00020\fH\u0082@ø\u0001\u0000¢\u0006\u0004\b\u001d\u0010\u001eJ\b\u0010 \u001a\u00020\u001fH\u0002J\u0010\u0010!\u001a\u00020\u00062\u0006\u0010\u0016\u001a\u00020\u0015H\u0002J\u001c\u0010%\u001a\u00020\u00062\n\u0010$\u001a\u00060\"j\u0002`#2\u0006\u0010\u0016\u001a\u00020\u0015H\u0002J\u0014\u0010)\u001a\u00020\u00062\n\u0010(\u001a\u00060&j\u0002`'H\u0002J\u0014\u0010*\u001a\u00020\u00062\n\u0010(\u001a\u00060\"j\u0002`#H\u0002J\"\u0010.\u001a\u00020\u00062\u0006\u0010+\u001a\u00020\f2\u0006\u0010,\u001a\u00020\u00152\b\u0010-\u001a\u0004\u0018\u00010\fH\u0002J\u001c\u0010/\u001a\u00020\u00062\n\u0010$\u001a\u00060\"j\u0002`#2\u0006\u0010,\u001a\u00020\u0015H\u0002J\b\u00100\u001a\u00020\bH\u0002J$\u00105\u001a\u00020\u00062\u0012\u00104\u001a\u000e\u0012\u0004\u0012\u000202\u0012\u0004\u0012\u000203012\u0006\u0010+\u001a\u00020\fH\u0002J$\u00106\u001a\u00020\u00062\u0012\u00104\u001a\u000e\u0012\u0004\u0012\u000202\u0012\u0004\u0012\u000203012\u0006\u0010+\u001a\u00020\fH\u0002R\u0016\u0010\u0005\u001a\u00020\u00048\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b7\u00108R\u0016\u0010\u0003\u001a\u00020\u00028\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b9\u0010:R\u001a\u0010?\u001a\b\u0012\u0004\u0012\u00020<0;8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b=\u0010>R\u001d\u0010E\u001a\b\u0012\u0004\u0012\u00020<0@8\u0006¢\u0006\f\n\u0004\bA\u0010B\u001a\u0004\bC\u0010DR\u001c\u0010G\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010F0;8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b(\u0010>R\u001f\u0010J\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010F0@8\u0006¢\u0006\f\n\u0004\bH\u0010B\u001a\u0004\bI\u0010DR\u0018\u0010M\u001a\u0004\u0018\u00010\u001f8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bK\u0010LR\u0018\u0010P\u001a\u0004\u0018\u00010N8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bI\u0010O\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006S"}, d2 = {"Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel;", "Landroidx/lifecycle/ViewModel;", "Lcom/stripe/android/Stripe;", "stripe", "Lcom/fitnessmobileapps/fma/views/stripe/a;", "stripePaymentData", "", "s", "Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$b;", "pollingConfig", ExifInterface.GPS_MEASUREMENT_IN_PROGRESS, "C", "", "intentStatus", "n", "message", "l", "onCleared", "clientSecret", "o", "(Ljava/lang/String;Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$b;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "", "attemptCount", "", "x", "(Ljava/lang/String;ILkotlin/coroutines/Continuation;)Ljava/lang/Object;", "Lcom/stripe/android/model/PaymentIntent;", "paymentIntent", "m", "y", "(Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "Lkotlinx/coroutines/Job;", "z", "r", "Ljava/lang/Exception;", "Lkotlin/Exception;", "error", "q", "Ljava/util/concurrent/CancellationException;", "Lkotlin/coroutines/cancellation/CancellationException;", "e", "p", "k", NotificationCompat.CATEGORY_STATUS, "attempt", "paymentId", "v", "u", "i", "", "Lvf/o;", "", "attributes", "t", "w", gf.a.A, "Lcom/fitnessmobileapps/fma/views/stripe/a;", "b", "Lcom/stripe/android/Stripe;", "Lkotlinx/coroutines/flow/MutableStateFlow;", "Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$c;", "c", "Lkotlinx/coroutines/flow/MutableStateFlow;", "_pollingUiState", "Lkotlinx/coroutines/flow/StateFlow;", "d", "Lkotlinx/coroutines/flow/StateFlow;", "j", "()Lkotlinx/coroutines/flow/StateFlow;", "pollingUiState", "Lcom/fitnessmobileapps/fma/views/stripe/PaymentStatus;", "_paymentStatus", "f", "h", "paymentStatus", "g", "Lkotlinx/coroutines/Job;", "pollingJob", "Lcom/stripe/android/model/StripeIntent$Status;", "Lcom/stripe/android/model/StripeIntent$Status;", "previousStatus", "<init>", "()V", "FMA_release"}, k = 1, mv = {1, 8, 0})
public final class PaymentPollingViewModel extends ViewModel {

    public static final int f11255j = 8;

    private StripePaymentData stripePaymentData;

    private Stripe stripe;

    private final MutableStateFlow<c> _pollingUiState;

    private final StateFlow<c> pollingUiState;

    private final MutableStateFlow<PaymentStatus> _paymentStatus;

    private final StateFlow<PaymentStatus> paymentStatus;

    private Job pollingJob;

    private StripeIntent.Status previousStatus;

    @StabilityInferred(parameters = 0)
    @Metadata(d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\t\n\u0002\b\r\b\u0087\b\u0018\u00002\u00020\u0001B%\u0012\b\b\u0002\u0010\r\u001a\u00020\t\u0012\b\b\u0002\u0010\u0010\u001a\u00020\t\u0012\b\b\u0002\u0010\u0013\u001a\u00020\u0004¢\u0006\u0004\b\u0014\u0010\u0015J\t\u0010\u0003\u001a\u00020\u0002HÖ\u0001J\t\u0010\u0005\u001a\u00020\u0004HÖ\u0001J\u0013\u0010\b\u001a\u00020\u00072\b\u0010\u0006\u001a\u0004\u0018\u00010\u0001HÖ\u0003R\u0017\u0010\r\u001a\u00020\t8\u0006¢\u0006\f\n\u0004\b\n\u0010\u000b\u001a\u0004\b\n\u0010\fR\u0017\u0010\u0010\u001a\u00020\t8\u0006¢\u0006\f\n\u0004\b\u000e\u0010\u000b\u001a\u0004\b\u000f\u0010\fR\u0017\u0010\u0013\u001a\u00020\u00048\u0006¢\u0006\f\n\u0004\b\u000f\u0010\u0011\u001a\u0004\b\u000e\u0010\u0012¨\u0006\u0016"}, d2 = {"Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$b;", "", "", "toString", "", "hashCode", "other", "", "equals", "", gf.a.A, "J", "()J", "initialDelay", "b", "c", "pollingInterval", "I", "()I", "maxAttempts", "<init>", "(JJI)V", "FMA_release"}, k = 1, mv = {1, 8, 0})
    public static final class PollingConfig {

        private final long initialDelay;

        private final long pollingInterval;

        private final int maxAttempts;

        public PollingConfig() {
            this(0L, 0L, 0, 7, null);
        }

        public final long getInitialDelay() {
            return this.initialDelay;
        }

        public final int getMaxAttempts() {
            return this.maxAttempts;
        }

        public final long getPollingInterval() {
            return this.pollingInterval;
        }

        public boolean equals(Object other) {
            if (this == other) {
                return true;
            }
            if (!(other instanceof PollingConfig)) {
                return false;
            }
            PollingConfig pollingConfig = (PollingConfig) other;
            return this.initialDelay == pollingConfig.initialDelay && this.pollingInterval == pollingConfig.pollingInterval && this.maxAttempts == pollingConfig.maxAttempts;
        }

        public int hashCode() {
            return (((androidx.collection.a.a(this.initialDelay) * 31) + androidx.collection.a.a(this.pollingInterval)) * 31) + this.maxAttempts;
        }

        public String toString() {
            return "PollingConfig(initialDelay=" + this.initialDelay + ", pollingInterval=" + this.pollingInterval + ", maxAttempts=" + this.maxAttempts + ")";
        }

        public PollingConfig(long j10, long j11, int i10) {
            this.initialDelay = j10;
            this.pollingInterval = j11;
            this.maxAttempts = i10;
        }

        public PollingConfig(long j10, long j11, int i10, int i11, DefaultConstructorMarker defaultConstructorMarker) {
            this((i11 & 1) != 0 ? 15000L : j10, (i11 & 2) != 0 ? 10000L : j11, (i11 & 4) != 0 ? 24 : i10);
        }
    }

    @Metadata(d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\bv\u0018\u00002\u00020\u0001:\u0005\u0002\u0003\u0004\u0005\u0006\u0082\u0001\u0005\u0007\b\t\n\u000b¨\u0006\f"}, d2 = {"Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$c;", "", gf.a.A, "b", "c", "d", "e", "Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$c$a;", "Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$c$b;", "Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$c$c;", "Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$c$d;", "Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$c$e;", "FMA_release"}, k = 1, mv = {1, 8, 0})
    public interface c {

        @StabilityInferred(parameters = 0)
        @Metadata(d1 = {"\u0000.\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\b\b\u0087\b\u0018\u00002\u00020\u0001B!\u0012\u0006\u0010\r\u001a\u00020\u0002\u0012\u0010\b\u0002\u0010\u0014\u001a\n\u0018\u00010\u000ej\u0004\u0018\u0001`\u000f¢\u0006\u0004\b\u0015\u0010\u0016J\t\u0010\u0003\u001a\u00020\u0002HÖ\u0001J\t\u0010\u0005\u001a\u00020\u0004HÖ\u0001J\u0013\u0010\t\u001a\u00020\b2\b\u0010\u0007\u001a\u0004\u0018\u00010\u0006HÖ\u0003R\u0017\u0010\r\u001a\u00020\u00028\u0006¢\u0006\f\n\u0004\b\n\u0010\u000b\u001a\u0004\b\n\u0010\fR\u001f\u0010\u0014\u001a\n\u0018\u00010\u000ej\u0004\u0018\u0001`\u000f8\u0006¢\u0006\f\n\u0004\b\u0010\u0010\u0011\u001a\u0004\b\u0012\u0010\u0013¨\u0006\u0017"}, d2 = {"Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$c$a;", "Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$c;", "", "toString", "", "hashCode", "", "other", "", "equals", gf.a.A, "Ljava/lang/String;", "()Ljava/lang/String;", "message", "Ljava/lang/Exception;", "Lkotlin/Exception;", "b", "Ljava/lang/Exception;", "getException", "()Ljava/lang/Exception;", "exception", "<init>", "(Ljava/lang/String;Ljava/lang/Exception;)V", "FMA_release"}, k = 1, mv = {1, 8, 0})
        public static final class Error implements c {

            private final String message;

            private final Exception exception;

            public Error(String message, Exception exc) {
                r.i(message, "message");
                this.message = message;
                this.exception = exc;
            }

            public final String getMessage() {
                return this.message;
            }

            public boolean equals(Object other) {
                if (this == other) {
                    return true;
                }
                if (!(other instanceof Error)) {
                    return false;
                }
                Error error = (Error) other;
                return r.d(this.message, error.message) && r.d(this.exception, error.exception);
            }

            public int hashCode() {
                int hashCode = this.message.hashCode() * 31;
                Exception exc = this.exception;
                return hashCode + (exc == null ? 0 : exc.hashCode());
            }

            public String toString() {
                return "Error(message=" + this.message + ", exception=" + this.exception + ")";
            }

            public Error(String str, Exception exc, int i10, DefaultConstructorMarker defaultConstructorMarker) {
                this(str, (i10 & 2) != 0 ? null : exc);
            }
        }

        @StabilityInferred(parameters = 0)
        @Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\bÇ\u0002\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0002\u0010\u0003¨\u0006\u0004"}, d2 = {"Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$c$b;", "Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$c;", "<init>", "()V", "FMA_release"}, k = 1, mv = {1, 8, 0})
        public static final class b implements c {

            public static final b f11269a = new b();

            private b() {
            }
        }

        @StabilityInferred(parameters = 0)
        @Metadata(d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000b\n\u0002\b\t\b\u0087\b\u0018\u00002\u00020\u0001B\u000f\u0012\u0006\u0010\u000e\u001a\u00020\u0004¢\u0006\u0004\b\u000f\u0010\u0010J\t\u0010\u0003\u001a\u00020\u0002HÖ\u0001J\t\u0010\u0005\u001a\u00020\u0004HÖ\u0001J\u0013\u0010\t\u001a\u00020\b2\b\u0010\u0007\u001a\u0004\u0018\u00010\u0006HÖ\u0003R\u0017\u0010\u000e\u001a\u00020\u00048\u0006¢\u0006\f\n\u0004\b\n\u0010\u000b\u001a\u0004\b\f\u0010\r¨\u0006\u0011"}, d2 = {"Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$c$c;", "Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$c;", "", "toString", "", "hashCode", "", "other", "", "equals", gf.a.A, "I", "getAttempt", "()I", "attempt", "<init>", "(I)V", "FMA_release"}, k = 1, mv = {1, 8, 0})
        public static final class Processing implements c {

            private final int attempt;

            public Processing(int i10) {
                this.attempt = i10;
            }

            public boolean equals(Object other) {
                if (this == other) {
                    return true;
                }
                return (other instanceof Processing) && this.attempt == ((Processing) other).attempt;
            }

            public int getAttempt() {
                return this.attempt;
            }

            public String toString() {
                return "Processing(attempt=" + this.attempt + ")";
            }
        }

        @StabilityInferred(parameters = 0)
        @Metadata(d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000b\n\u0002\b\t\b\u0087\b\u0018\u00002\u00020\u0001B\u0011\u0012\b\u0010\u000e\u001a\u0004\u0018\u00010\u0002¢\u0006\u0004\b\u000f\u0010\u0010J\t\u0010\u0003\u001a\u00020\u0002HÖ\u0001J\t\u0010\u0005\u001a\u00020\u0004HÖ\u0001J\u0013\u0010\t\u001a\u00020\b2\b\u0010\u0007\u001a\u0004\u0018\u00010\u0006HÖ\u0003R\u0019\u0010\u000e\u001a\u0004\u0018\u00010\u00028\u0006¢\u0006\f\n\u0004\b\n\u0010\u000b\u001a\u0004\b\f\u0010\r¨\u0006\u0011"}, d2 = {"Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$c$d;", "Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$c;", "", "toString", "", "hashCode", "", "other", "", "equals", gf.a.A, "Ljava/lang/String;", "getPaymentIntentId", "()Ljava/lang/String;", "paymentIntentId", "<init>", "(Ljava/lang/String;)V", "FMA_release"}, k = 1, mv = {1, 8, 0})
        public static final class Success implements c {

            private final String paymentIntentId;

            public Success(String str) {
                this.paymentIntentId = str;
            }

            public boolean equals(Object other) {
                if (this == other) {
                    return true;
                }
                return (other instanceof Success) && r.d(this.paymentIntentId, ((Success) other).paymentIntentId);
            }

            public int hashCode() {
                String str = this.paymentIntentId;
                if (str == null) {
                    return 0;
                }
                return str.hashCode();
            }

            public String toString() {
                return "Success(paymentIntentId=" + this.paymentIntentId + ")";
            }
        }

        @StabilityInferred(parameters = 0)
        @Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\bÇ\u0002\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0002\u0010\u0003¨\u0006\u0004"}, d2 = {"Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$c$e;", "Lcom/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$c;", "<init>", "()V", "FMA_release"}, k = 1, mv = {1, 8, 0})
        public static final class e implements c {

            public static final e f11272a = new e();

            private e() {
            }
        }
    }

    @Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
    public class d {

        public static final int[] f11273a;

        static {
            int[] iArr = new int[StripeIntent.Status.values().length];
            try {
                iArr[StripeIntent.Status.f24252q.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                iArr[StripeIntent.Status.f24247d.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            f11273a = iArr;
        }
    }

    @Metadata(d1 = {"\u0000!\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003*\u0001\u0000\b\n\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001J\u0010\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H\u0016J\u0014\u0010\t\u001a\u00020\u00042\n\u0010\b\u001a\u00060\u0006j\u0002`\u0007H\u0016¨\u0006\n"}, d2 = {"com/fitnessmobileapps/fma/views/stripe/PaymentPollingViewModel$e", "Lcom/stripe/android/a;", "Lcom/stripe/android/model/PaymentIntent;", "result", "", "c", "Ljava/lang/Exception;", "Lkotlin/Exception;", "e", gf.a.A, "FMA_release"}, k = 1, mv = {1, 8, 0})
    public static final class e implements com.stripe.android.a<PaymentIntent> {

        final Continuation<PaymentIntent> f11274a;

        e(Continuation<? super PaymentIntent> continuation) {
            this.f11274a = continuation;
        }

        @Override
        public void a(Exception e10) {
            r.i(e10, "e");
            Continuation<PaymentIntent> continuation = this.f11274a;
            Result.Companion companion = Result.INSTANCE;
            continuation.resumeWith(Result.b(kotlin.f.a(e10)));
        }

        @Override
        public void b(PaymentIntent result) {
            r.i(result, "result");
            this.f11274a.resumeWith(Result.b(result));
        }
    }

    public PaymentPollingViewModel() {
        MutableStateFlow<c> MutableStateFlow = StateFlowKt.MutableStateFlow(c.b.f11269a);
        this._pollingUiState = MutableStateFlow;
        this.pollingUiState = FlowKt.asStateFlow(MutableStateFlow);
        MutableStateFlow<PaymentStatus> MutableStateFlow2 = StateFlowKt.MutableStateFlow(null);
        this._paymentStatus = MutableStateFlow2;
        this.paymentStatus = FlowKt.asStateFlow(MutableStateFlow2);
    }

    public static void B(PaymentPollingViewModel paymentPollingViewModel, PollingConfig pollingConfig, int i10, Object obj) {
        if ((i10 & 1) != 0) {
            pollingConfig = paymentPollingViewModel.i();
        }
        paymentPollingViewModel.A(pollingConfig);
    }

    private final PollingConfig i() {
        StripePollingConfig c10 = FlagsUtilsClassKt.c();
        return new PollingConfig(((long) c10.getInitialDelay()) * 1000, ((long) c10.getRetryDelay()) * 1000, c10.getMaxRetries());
    }

    public final void k(Exception e10) {
        this._pollingUiState.setValue(new c.Error("Critical polling error", e10));
        mo.a.INSTANCE.t("Stripe_Polling_Logs").f(e10, "Critical polling error", new Object[0]);
    }

    private final boolean m(PaymentIntent paymentIntent, int attemptCount) {
        String str;
        Map<o, Object> p10;
        Map<o, Object> p11;
        Pair[] pairArr = new Pair[3];
        b.C0002b c0002b = b.C0002b.f139a;
        pairArr[0] = new Pair(c0002b.E(), "polling");
        o.d i10 = c0002b.i();
        StripeIntent.Status status = paymentIntent.getStatus();
        if (status == null || (str = status.name()) == null) {
            str = "";
        }
        pairArr[1] = new Pair(i10, str);
        int i11 = 2;
        pairArr[2] = new Pair(c0002b.D(), Integer.valueOf(attemptCount));
        p10 = g0.p(pairArr);
        t(p10, "polling");
        this.previousStatus = paymentIntent.getStatus();
        StripeIntent.Status status2 = paymentIntent.getStatus();
        int i12 = status2 == null ? -1 : d.f11273a[status2.ordinal()];
        if (i12 != 1) {
            Exception exc = null;
            Object[] objArr = 0;
            Object[] objArr2 = 0;
            Object[] objArr3 = 0;
            if (i12 != 2) {
                this._pollingUiState.setValue(new c.Error("Payment status: " + paymentIntent.getStatus(), exc, i11, objArr3 == true ? 1 : 0));
                v("Status - " + paymentIntent.getStatus() + ", continuing polling", attemptCount, paymentIntent.getId());
                return false;
            }
            this._pollingUiState.setValue(new c.Error("Payment canceled", objArr2 == true ? 1 : 0, i11, objArr == true ? 1 : 0));
        } else {
            this._pollingUiState.setValue(new c.Success(paymentIntent.getId()));
            p11 = g0.p(new Pair(c0002b.E(), "PollingTask.completion"), new Pair(c0002b.C(), BaseMindBodyResponse.STATUS_SUCCESS));
            t(p11, BaseMindBodyResponse.STATUS_SUCCESS);
            v("Status - " + paymentIntent.getStatus() + ", Stopping polling", attemptCount, paymentIntent.getId());
        }
        return true;
    }

    public final Object o(String str, PollingConfig pollingConfig, Continuation<? super Unit> continuation) {
        PaymentPollingViewModel$handlePolling$1 paymentPollingViewModel$handlePolling$1;
        Object obj;
        Object f10;
        int i10;
        Map<o, Object> p10;
        String str2;
        int i11;
        PaymentPollingViewModel paymentPollingViewModel;
        if (continuation instanceof PaymentPollingViewModel$handlePolling$1) {
            paymentPollingViewModel$handlePolling$1 = (PaymentPollingViewModel$handlePolling$1) continuation;
            int i12 = paymentPollingViewModel$handlePolling$1.label;
            if ((i12 & Integer.MIN_VALUE) != 0) {
                paymentPollingViewModel$handlePolling$1.label = i12 - Integer.MIN_VALUE;
                obj = paymentPollingViewModel$handlePolling$1.result;
                f10 = kotlin.coroutines.intrinsics.b.f();
                i10 = paymentPollingViewModel$handlePolling$1.label;
                if (i10 == 0) {
                    if (i10 != 1) {
                        if (i10 == 2) {
                            i11 = paymentPollingViewModel$handlePolling$1.I$0;
                            pollingConfig = (PollingConfig) paymentPollingViewModel$handlePolling$1.L$2;
                            str2 = (String) paymentPollingViewModel$handlePolling$1.L$1;
                            paymentPollingViewModel = (PaymentPollingViewModel) paymentPollingViewModel$handlePolling$1.L$0;
                            kotlin.f.b(obj);
                            if (((Boolean) obj).booleanValue()) {
                                return Unit.f33247a;
                            }
                            if (i11 >= pollingConfig.getMaxAttempts()) {
                                paymentPollingViewModel.r(i11);
                                return Unit.f33247a;
                            }
                            long pollingInterval = pollingConfig.getPollingInterval();
                            paymentPollingViewModel$handlePolling$1.L$0 = paymentPollingViewModel;
                            paymentPollingViewModel$handlePolling$1.L$1 = str2;
                            paymentPollingViewModel$handlePolling$1.L$2 = pollingConfig;
                            paymentPollingViewModel$handlePolling$1.I$0 = i11;
                            paymentPollingViewModel$handlePolling$1.label = 3;
                            if (DelayKt.delay(pollingInterval, paymentPollingViewModel$handlePolling$1) == f10) {
                                return f10;
                            }
                        } else if (i10 != 3) {
                            throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                        }
                    }
                    i11 = paymentPollingViewModel$handlePolling$1.I$0;
                    pollingConfig = (PollingConfig) paymentPollingViewModel$handlePolling$1.L$2;
                    str2 = (String) paymentPollingViewModel$handlePolling$1.L$1;
                    paymentPollingViewModel = (PaymentPollingViewModel) paymentPollingViewModel$handlePolling$1.L$0;
                    kotlin.f.b(obj);
                } else {
                    kotlin.f.b(obj);
                    p10 = g0.p(new Pair(b.C0002b.f139a.E(), "start_polling"));
                    t(p10, "start_polling");
                    v("Initial delay", 0, "N/A");
                    long initialDelay = pollingConfig.getInitialDelay();
                    paymentPollingViewModel$handlePolling$1.L$0 = this;
                    paymentPollingViewModel$handlePolling$1.L$1 = str;
                    paymentPollingViewModel$handlePolling$1.L$2 = pollingConfig;
                    paymentPollingViewModel$handlePolling$1.I$0 = 0;
                    paymentPollingViewModel$handlePolling$1.label = 1;
                    if (DelayKt.delay(initialDelay, paymentPollingViewModel$handlePolling$1) == f10) {
                        return f10;
                    }
                    str2 = str;
                    i11 = 0;
                    paymentPollingViewModel = this;
                }
                i11++;
                paymentPollingViewModel._pollingUiState.setValue(new c.Processing(i11));
                paymentPollingViewModel$handlePolling$1.L$0 = paymentPollingViewModel;
                paymentPollingViewModel$handlePolling$1.L$1 = str2;
                paymentPollingViewModel$handlePolling$1.L$2 = pollingConfig;
                paymentPollingViewModel$handlePolling$1.I$0 = i11;
                paymentPollingViewModel$handlePolling$1.label = 2;
                obj = paymentPollingViewModel.x(str2, i11, paymentPollingViewModel$handlePolling$1);
                if (obj == f10) {
                    return f10;
                }
                if (((Boolean) obj).booleanValue()) {
                }
            }
        }
        paymentPollingViewModel$handlePolling$1 = new PaymentPollingViewModel$handlePolling$1(this, continuation);
        obj = paymentPollingViewModel$handlePolling$1.result;
        f10 = kotlin.coroutines.intrinsics.b.f();
        i10 = paymentPollingViewModel$handlePolling$1.label;
        if (i10 == 0) {
        }
        i11++;
        paymentPollingViewModel._pollingUiState.setValue(new c.Processing(i11));
        paymentPollingViewModel$handlePolling$1.L$0 = paymentPollingViewModel;
        paymentPollingViewModel$handlePolling$1.L$1 = str2;
        paymentPollingViewModel$handlePolling$1.L$2 = pollingConfig;
        paymentPollingViewModel$handlePolling$1.I$0 = i11;
        paymentPollingViewModel$handlePolling$1.label = 2;
        obj = paymentPollingViewModel.x(str2, i11, paymentPollingViewModel$handlePolling$1);
        if (obj == f10) {
        }
        if (((Boolean) obj).booleanValue()) {
        }
    }

    public final void p(CancellationException e10) {
        this._pollingUiState.setValue(new c.Error("Polling cancelled", e10));
    }

    private final void q(Exception error, int attemptCount) {
        String str;
        Map<o, Object> p10;
        Pair[] pairArr = new Pair[4];
        b.C0002b c0002b = b.C0002b.f139a;
        pairArr[0] = new Pair(c0002b.E(), "polling");
        o.d i10 = c0002b.i();
        StripeIntent.Status status = this.previousStatus;
        if (status == null || (str = status.name()) == null) {
            str = "";
        }
        pairArr[1] = new Pair(i10, str);
        pairArr[2] = new Pair(c0002b.D(), Integer.valueOf(attemptCount));
        o.d f10 = c0002b.f();
        String message = error.getMessage();
        pairArr[3] = new Pair(f10, message != null ? message : "");
        p10 = g0.p(pairArr);
        t(p10, "polling");
        this._pollingUiState.setValue(new c.Error("Error during polling: " + error.getMessage(), error));
        u(error, attemptCount);
    }

    private final void r(int attemptCount) {
        String str;
        Map<o, Object> p10;
        Map<o, Object> p11;
        Pair[] pairArr = new Pair[3];
        b.C0002b c0002b = b.C0002b.f139a;
        pairArr[0] = new Pair(c0002b.E(), "polling_timed_out");
        o.d i10 = c0002b.i();
        StripeIntent.Status status = this.previousStatus;
        if (status == null || (str = status.name()) == null) {
            str = "";
        }
        pairArr[1] = new Pair(i10, str);
        pairArr[2] = new Pair(c0002b.D(), Integer.valueOf(attemptCount));
        p10 = g0.p(pairArr);
        t(p10, "polling_timed_out");
        p11 = g0.p(new Pair(c0002b.E(), "PollingTask.completion"), new Pair(c0002b.C(), "Timeout"));
        t(p11, "Timeout");
        this._pollingUiState.setValue(c.e.f11272a);
    }

    private final void t(Map<o, Object> attributes, String status) {
        b.C0002b c0002b = b.C0002b.f139a;
        o.d A = c0002b.A();
        StripePaymentData stripePaymentData = this.stripePaymentData;
        StripePaymentData stripePaymentData2 = null;
        if (stripePaymentData == null) {
            r.A("stripePaymentData");
            stripePaymentData = null;
        }
        attributes.put(A, stripePaymentData.getPaymentMethodName());
        o.d z10 = c0002b.z();
        StripePaymentData stripePaymentData3 = this.stripePaymentData;
        if (stripePaymentData3 == null) {
            r.A("stripePaymentData");
            stripePaymentData3 = null;
        }
        attributes.put(z10, stripePaymentData3.getPaymentIntentId());
        attributes.put(c0002b.M(), Boolean.TRUE);
        o.d J = c0002b.J();
        StripePaymentData stripePaymentData4 = this.stripePaymentData;
        if (stripePaymentData4 == null) {
            r.A("stripePaymentData");
        } else {
            stripePaymentData2 = stripePaymentData4;
        }
        attributes.put(J, Boolean.valueOf(stripePaymentData2.getIsForContract()));
        a2.a.v(b.d.f191a.v(), b.c.f165a.e(), b.e.f217a.r(), b.g.f246a.Z().getScreen(), b.a.f121a.c(), s.a(status), attributes);
    }

    private final void u(Exception error, int attempt) {
        mo.a.INSTANCE.t("Stripe_Polling_Logs").f(error, "%s%s", "Error on attempt " + attempt + " : ", error.getMessage());
    }

    private final void v(String status, int attempt, String paymentId) {
        mo.a.INSTANCE.t("Stripe_Polling_Logs").a("Status:" + status + "  , Attempt: " + attempt + " , PaymentId: " + paymentId, new Object[0]);
    }

    private final void w(Map<o, Object> attributes, String status) {
        b.C0002b c0002b = b.C0002b.f139a;
        o.d A = c0002b.A();
        StripePaymentData stripePaymentData = this.stripePaymentData;
        StripePaymentData stripePaymentData2 = null;
        if (stripePaymentData == null) {
            r.A("stripePaymentData");
            stripePaymentData = null;
        }
        attributes.put(A, stripePaymentData.getPaymentMethodName());
        o.d z10 = c0002b.z();
        StripePaymentData stripePaymentData3 = this.stripePaymentData;
        if (stripePaymentData3 == null) {
            r.A("stripePaymentData");
            stripePaymentData3 = null;
        }
        attributes.put(z10, stripePaymentData3.getPaymentIntentId());
        attributes.put(c0002b.M(), Boolean.TRUE);
        o.d J = c0002b.J();
        StripePaymentData stripePaymentData4 = this.stripePaymentData;
        if (stripePaymentData4 == null) {
            r.A("stripePaymentData");
        } else {
            stripePaymentData2 = stripePaymentData4;
        }
        attributes.put(J, Boolean.valueOf(stripePaymentData2.getIsForContract()));
        a2.a.v(b.d.f191a.w(), b.c.f165a.e(), b.e.f217a.r(), b.g.f246a.Z().getScreen(), b.a.f121a.c(), s.a(status), attributes);
    }

    public final Object x(String str, int i10, Continuation<? super Boolean> continuation) {
        PaymentPollingViewModel$performSinglePoll$1 paymentPollingViewModel$performSinglePoll$1;
        Object f10;
        int i11;
        PaymentPollingViewModel paymentPollingViewModel;
        boolean z10;
        if (continuation instanceof PaymentPollingViewModel$performSinglePoll$1) {
            paymentPollingViewModel$performSinglePoll$1 = (PaymentPollingViewModel$performSinglePoll$1) continuation;
            int i12 = paymentPollingViewModel$performSinglePoll$1.label;
            if ((i12 & Integer.MIN_VALUE) != 0) {
                paymentPollingViewModel$performSinglePoll$1.label = i12 - Integer.MIN_VALUE;
                Object obj = paymentPollingViewModel$performSinglePoll$1.result;
                f10 = kotlin.coroutines.intrinsics.b.f();
                i11 = paymentPollingViewModel$performSinglePoll$1.label;
                if (i11 != 0) {
                    kotlin.f.b(obj);
                    try {
                        paymentPollingViewModel$performSinglePoll$1.L$0 = this;
                        paymentPollingViewModel$performSinglePoll$1.I$0 = i10;
                        paymentPollingViewModel$performSinglePoll$1.label = 1;
                        obj = y(str, paymentPollingViewModel$performSinglePoll$1);
                        if (obj == f10) {
                            return f10;
                        }
                        paymentPollingViewModel = this;
                    } catch (Exception e10) {
                        e = e10;
                        paymentPollingViewModel = this;
                        if (!(e instanceof CancellationException)) {
                        }
                    }
                } else {
                    if (i11 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    i10 = paymentPollingViewModel$performSinglePoll$1.I$0;
                    paymentPollingViewModel = (PaymentPollingViewModel) paymentPollingViewModel$performSinglePoll$1.L$0;
                    try {
                        kotlin.f.b(obj);
                    } catch (Exception e11) {
                        e = e11;
                        if (!(e instanceof CancellationException)) {
                            throw e;
                        }
                        paymentPollingViewModel.q(e, i10);
                        z10 = false;
                        return kotlin.coroutines.jvm.internal.a.a(z10);
                    }
                }
                z10 = paymentPollingViewModel.m((PaymentIntent) obj, i10);
                return kotlin.coroutines.jvm.internal.a.a(z10);
            }
        }
        paymentPollingViewModel$performSinglePoll$1 = new PaymentPollingViewModel$performSinglePoll$1(this, continuation);
        Object obj2 = paymentPollingViewModel$performSinglePoll$1.result;
        f10 = kotlin.coroutines.intrinsics.b.f();
        i11 = paymentPollingViewModel$performSinglePoll$1.label;
        if (i11 != 0) {
        }
        z10 = paymentPollingViewModel.m((PaymentIntent) obj2, i10);
        return kotlin.coroutines.jvm.internal.a.a(z10);
    }

    private final Object y(String str, Continuation<? super PaymentIntent> continuation) {
        Continuation d10;
        Object f10;
        d10 = IntrinsicsKt__IntrinsicsJvmKt.d(continuation);
        kotlin.coroutines.d dVar = new kotlin.coroutines.d(d10);
        Stripe stripe = this.stripe;
        if (stripe == null) {
            r.A("stripe");
            stripe = null;
        }
        Stripe.k(stripe, str, null, null, new e(dVar), 6, null);
        Object a10 = dVar.a();
        f10 = kotlin.coroutines.intrinsics.b.f();
        if (a10 == f10) {
            kotlin.coroutines.jvm.internal.e.c(continuation);
        }
        return a10;
    }

    private final Job z() {
        return BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), Dispatchers.getIO(), null, new PaymentPollingViewModel$retrievePaymentIntentAndContinue$1(this, null), 2, null);
    }

    public final void A(PollingConfig pollingConfig) {
        r.i(pollingConfig, "pollingConfig");
        Job job = this.pollingJob;
        if (job == null || !job.isActive()) {
            this.pollingJob = BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), Dispatchers.getIO(), null, new PaymentPollingViewModel$startPolling$1(this, pollingConfig, null), 2, null);
        }
    }

    public final void C() {
        Map<o, Object> p10;
        p10 = g0.p(new Pair(b.C0002b.f139a.E(), "invalidate_polling"));
        t(p10, "invalidate_polling");
        Job job = this.pollingJob;
        if (job != null) {
            Job.DefaultImpls.cancel$default(job, (CancellationException) null, 1, (Object) null);
        }
        this.pollingJob = null;
        this._pollingUiState.setValue(c.b.f11269a);
    }

    public final StateFlow<PaymentStatus> h() {
        return this.paymentStatus;
    }

    public final StateFlow<c> j() {
        return this.pollingUiState;
    }

    public final void l(String message) {
        Map<o, Object> p10;
        r.i(message, "message");
        b.C0002b c0002b = b.C0002b.f139a;
        p10 = g0.p(new Pair(c0002b.E(), "onPaymentFailure"), new Pair(c0002b.f(), message));
        w(p10, "Failed");
        this._paymentStatus.setValue(new PaymentStatus(PaymentStatus.Status.FAILED));
    }

    public final void n(String intentStatus) {
        Map<o, Object> p10;
        r.i(intentStatus, "intentStatus");
        b.C0002b c0002b = b.C0002b.f139a;
        p10 = g0.p(new Pair(c0002b.E(), "onPaymentProcessed"), new Pair(c0002b.i(), intentStatus));
        w(p10, intentStatus);
        if (r.d(intentStatus, StripeIntent.Status.f24252q.getCode())) {
            this._paymentStatus.setValue(new PaymentStatus(PaymentStatus.Status.SUCCESS));
        } else if (r.d(intentStatus, StripeIntent.Status.f24251p.getCode()) || r.d(intentStatus, "requires_source")) {
            this._paymentStatus.setValue(new PaymentStatus(PaymentStatus.Status.FAILED));
        } else {
            mo.a.INSTANCE.t("Stripe_Polling_Logs").a("onPaymentProcessed - Cancelled flow started", new Object[0]);
            z();
        }
    }

    @Override
    protected void onCleared() {
        super.onCleared();
        C();
    }

    public final void s(Stripe stripe, StripePaymentData stripePaymentData) {
        r.i(stripe, "stripe");
        r.i(stripePaymentData, "stripePaymentData");
        this.stripe = stripe;
        this.stripePaymentData = stripePaymentData;
    }
}