导航菜单

页面标题

页面副标题

Biko v2.0.23 - DefaultFlowController.java 源代码

正在查看: Biko v2.0.23 应用的 DefaultFlowController.java JAVA 源代码文件

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


package com.stripe.android.paymentsheet.flowcontroller;

import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.ActivityResultRegistryOwner;
import androidx.activity.result.contract.ActivityResultContract;
import androidx.core.app.ActivityOptionsCompat;
import androidx.lifecycle.DefaultLifecycleObserver;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner;
import com.stripe.android.PaymentConfiguration;
import com.stripe.android.googlepaylauncher.GooglePayEnvironment;
import com.stripe.android.googlepaylauncher.GooglePayPaymentMethodLauncher;
import com.stripe.android.googlepaylauncher.GooglePayPaymentMethodLauncherContractV2;
import com.stripe.android.googlepaylauncher.injection.GooglePayPaymentMethodLauncherFactory;
import com.stripe.android.link.LinkActivityResult;
import com.stripe.android.link.LinkConfiguration;
import com.stripe.android.link.LinkPaymentLauncher;
import com.stripe.android.model.ConfirmPaymentIntentParams;
import com.stripe.android.model.ConfirmSetupIntentParams;
import com.stripe.android.model.ConfirmStripeIntentParams;
import com.stripe.android.model.PaymentIntent;
import com.stripe.android.model.PaymentMethod;
import com.stripe.android.model.SetupIntent;
import com.stripe.android.model.StripeIntent;
import com.stripe.android.payments.core.injection.NamedConstantsKt;
import com.stripe.android.payments.paymentlauncher.InternalPaymentResult;
import com.stripe.android.payments.paymentlauncher.PaymentLauncherContract;
import com.stripe.android.payments.paymentlauncher.PaymentResult;
import com.stripe.android.payments.paymentlauncher.StripePaymentLauncher;
import com.stripe.android.payments.paymentlauncher.StripePaymentLauncherAssistedFactory;
import com.stripe.android.paymentsheet.IntentConfirmationInterceptor;
import com.stripe.android.paymentsheet.PaymentOptionCallback;
import com.stripe.android.paymentsheet.PaymentOptionContract;
import com.stripe.android.paymentsheet.PaymentOptionResult;
import com.stripe.android.paymentsheet.PaymentSheet;
import com.stripe.android.paymentsheet.PaymentSheetResult;
import com.stripe.android.paymentsheet.PaymentSheetResultCallback;
import com.stripe.android.paymentsheet.PrefsRepository;
import com.stripe.android.paymentsheet.addresselement.AddressDetails;
import com.stripe.android.paymentsheet.analytics.EventReporter;
import com.stripe.android.paymentsheet.analytics.PaymentSheetConfirmationError;
import com.stripe.android.paymentsheet.flowcontroller.FlowControllerConfigurationHandler;
import com.stripe.android.paymentsheet.model.PaymentOption;
import com.stripe.android.paymentsheet.model.PaymentOptionFactory;
import com.stripe.android.paymentsheet.model.PaymentSelection;
import com.stripe.android.paymentsheet.paymentdatacollection.bacs.BacsMandateConfirmationContract;
import com.stripe.android.paymentsheet.paymentdatacollection.bacs.BacsMandateConfirmationLauncher;
import com.stripe.android.paymentsheet.paymentdatacollection.bacs.BacsMandateConfirmationLauncherFactory;
import com.stripe.android.paymentsheet.paymentdatacollection.bacs.BacsMandateConfirmationResult;
import com.stripe.android.paymentsheet.paymentdatacollection.bacs.BacsMandateData;
import com.stripe.android.paymentsheet.state.LinkState;
import com.stripe.android.paymentsheet.state.PaymentSheetState;
import com.stripe.android.paymentsheet.ui.SepaMandateContract;
import com.stripe.android.paymentsheet.ui.SepaMandateResult;
import com.stripe.android.paymentsheet.utils.SelectionUtilsKt;
import com.stripe.android.utils.AnimationConstants;
import com.tiktok.appevents.contents.TTContentsEventConstants;
import com.truecaller.android.sdk.TruecallerSdkScope;
import com.truecaller.android.sdk.network.RestAdapter;
import com.twilio.audioswitch.wired.WiredHeadsetReceiverKt;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
import kotlin.Function;
import kotlin.Metadata;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Result;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.collections.SetsKt;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.FunctionAdapter;
import kotlin.jvm.internal.FunctionReferenceImpl;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.CoroutineStart;

@FlowControllerScope
@Metadata(d1 = {"\u0000ê\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\"\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\b\u0001\u0018\u0000 \u0094\u00012\u00020\u0001:\b\u0092\u0001\u0093\u0001\u0094\u0001\u0095\u0001BÒ\u0001\b\u0001\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u000e\u0010\u0006\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\b0\u0007\u0012\u0006\u0010\t\u001a\u00020\n\u0012\u0006\u0010\u000b\u001a\u00020\f\u0012\u0006\u0010\r\u001a\u00020\u000e\u0012\u0019\u0010\u000f\u001a\u0015\u0012\u0006\u0012\u0004\u0018\u00010\u0011\u0012\u0004\u0012\u00020\u00120\u0010¢\u0006\u0002\b\u0013\u0012\u0006\u0010\u0014\u001a\u00020\u0015\u0012\u0006\u0010\u0016\u001a\u00020\u0017\u0012\u0006\u0010\u0018\u001a\u00020\u0019\u0012\u0006\u0010\u001a\u001a\u00020\u001b\u0012\u0006\u0010\u001c\u001a\u00020\u001d\u0012\f\u0010\u001e\u001a\b\u0012\u0004\u0012\u00020 0\u001f\u0012\b\b\u0001\u0010!\u001a\u00020\"\u0012\u000e\b\u0001\u0010#\u001a\b\u0012\u0004\u0012\u00020%0$\u0012\u0006\u0010&\u001a\u00020'\u0012\u0006\u0010(\u001a\u00020)\u0012\u0006\u0010*\u001a\u00020+\u0012\u0006\u0010,\u001a\u00020-\u0012\u0006\u0010.\u001a\u00020/¢\u0006\u0002\u00100J \u0010M\u001a\u00020N2\u0006\u0010O\u001a\u00020=2\u0006\u0010P\u001a\u00020Q2\u0006\u0010R\u001a\u00020SH\u0002J\"\u0010T\u001a\u00020N2\u0006\u0010U\u001a\u00020V2\b\u0010P\u001a\u0004\u0018\u00010Q2\u0006\u0010R\u001a\u00020SH\u0016J\"\u0010W\u001a\u00020N2\u0006\u0010X\u001a\u00020%2\b\u0010P\u001a\u0004\u0018\u00010Q2\u0006\u0010R\u001a\u00020SH\u0016J\"\u0010Y\u001a\u00020N2\u0006\u0010Z\u001a\u00020%2\b\u0010P\u001a\u0004\u0018\u00010Q2\u0006\u0010R\u001a\u00020SH\u0016J\b\u0010[\u001a\u00020NH\u0016J\u0018\u0010\\\u001a\u00020N2\u0006\u0010]\u001a\u00020^2\u0006\u0010_\u001a\u00020`H\u0002J\u001a\u0010a\u001a\u00020N2\b\u0010]\u001a\u0004\u0018\u00010^2\u0006\u0010_\u001a\u00020`H\u0007J\u0010\u0010b\u001a\u00020N2\u0006\u0010c\u001a\u00020dH\u0002J\b\u0010e\u001a\u00020fH\u0002J\n\u0010g\u001a\u0004\u0018\u00010hH\u0016J\u0018\u0010i\u001a\u00020N2\u0006\u0010j\u001a\u00020%2\u0006\u0010k\u001a\u00020lH\u0002J\u0010\u0010m\u001a\u00020N2\u0006\u0010_\u001a\u00020`H\u0002J\u0012\u0010n\u001a\u00020N2\b\u0010o\u001a\u0004\u0018\u00010pH\u0002J\u0015\u0010q\u001a\u00020N2\u0006\u0010r\u001a\u00020sH\u0000¢\u0006\u0002\btJ\u0015\u0010u\u001a\u00020N2\u0006\u0010v\u001a\u00020wH\u0000¢\u0006\u0002\bxJ\u0015\u0010y\u001a\u00020N2\u0006\u0010z\u001a\u00020{H\u0000¢\u0006\u0002\b|J\u000e\u0010}\u001a\u00020N2\u0006\u0010r\u001a\u00020~J\u001a\u0010\u007f\u001a\u00020N2\n\u0010\u0080\u0001\u001a\u0005\u0018\u00010\u0081\u0001H\u0000¢\u0006\u0003\b\u0082\u0001J\u0017\u0010\u0083\u0001\u001a\u00020N2\u0006\u0010o\u001a\u00020pH\u0000¢\u0006\u0003\b\u0084\u0001J\u0019\u0010\u0085\u0001\u001a\u00020N2\b\u0010\u0086\u0001\u001a\u00030\u0087\u0001H\u0000¢\u0006\u0003\b\u0088\u0001J\t\u0010\u0089\u0001\u001a\u00020NH\u0016J\u000e\u0010\u008a\u0001\u001a\u00030\u008b\u0001*\u00020pH\u0002JJ\u0010\u008c\u0001\u001a\t\u0012\u0005\u0012\u0003H\u008d\u00010:\"\u0005\b\u0000\u0010\u008d\u0001\"\u0005\b\u0001\u0010\u008e\u0001*\u00020\u00152\u0016\u0010\u008f\u0001\u001a\u0011\u0012\u0005\u0012\u0003H\u008d\u0001\u0012\u0005\u0012\u0003H\u008e\u00010\u0090\u00012\u000e\u0010R\u001a\n\u0012\u0005\u0012\u0003H\u008e\u00010\u0091\u0001H\u0002R\u000e\u00101\u001a\u000202X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010,\u001a\u00020-X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0016\u001a\u00020\u0017X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010!\u001a\u00020\"X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0018\u001a\u00020\u0019X\u0082\u0004¢\u0006\u0002\n\u0000R\u001a\u00103\u001a\u000204X\u0086.¢\u0006\u000e\n\u0000\u001a\u0004\b5\u00106\"\u0004\b7\u00108R\u0014\u00109\u001a\b\u0012\u0004\u0012\u00020;0:X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010&\u001a\u00020'X\u0082\u0004¢\u0006\u0002\n\u0000R\u0016\u0010<\u001a\u0004\u0018\u00010=8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b>\u0010?R\u000e\u0010.\u001a\u00020/X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u001e\u001a\b\u0012\u0004\u0012\u00020 0\u001fX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010*\u001a\u00020+X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010@\u001a\u0004\u0018\u00010AX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u001c\u001a\u00020\u001dX\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010B\u001a\b\u0012\u0004\u0012\u00020C0:X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\fX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\nX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u000eX\u0082\u0004¢\u0006\u0002\n\u0000R!\u0010\u000f\u001a\u0015\u0012\u0006\u0012\u0004\u0018\u00010\u0011\u0012\u0004\u0012\u00020\u00120\u0010¢\u0006\u0002\b\u0013X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010#\u001a\b\u0012\u0004\u0012\u00020%0$X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010D\u001a\b\u0012\u0004\u0012\u00020E0:X\u0082\u0004¢\u0006\u0002\n\u0000R(\u0010H\u001a\u0004\u0018\u00010G2\b\u0010F\u001a\u0004\u0018\u00010G8V@VX\u0096\u000e¢\u0006\f\u001a\u0004\bI\u0010J\"\u0004\bK\u0010LR\u0016\u0010\u0006\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\b0\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u001a\u001a\u00020\u001bX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0096\u0001"}, d2 = {"Lcom/stripe/android/paymentsheet/flowcontroller/DefaultFlowController;", "Lcom/stripe/android/paymentsheet/PaymentSheet$FlowController;", "viewModelScope", "Lkotlinx/coroutines/CoroutineScope;", "lifecycleOwner", "Landroidx/lifecycle/LifecycleOwner;", "statusBarColor", "Lkotlin/Function0;", "", "paymentOptionFactory", "Lcom/stripe/android/paymentsheet/model/PaymentOptionFactory;", "paymentOptionCallback", "Lcom/stripe/android/paymentsheet/PaymentOptionCallback;", "paymentResultCallback", "Lcom/stripe/android/paymentsheet/PaymentSheetResultCallback;", "prefsRepositoryFactory", "Lkotlin/Function1;", "Lcom/stripe/android/paymentsheet/PaymentSheet$CustomerConfiguration;", "Lcom/stripe/android/paymentsheet/PrefsRepository;", "Lkotlin/jvm/JvmSuppressWildcards;", "activityResultRegistryOwner", "Landroidx/activity/result/ActivityResultRegistryOwner;", "context", "Landroid/content/Context;", "eventReporter", "Lcom/stripe/android/paymentsheet/analytics/EventReporter;", "viewModel", "Lcom/stripe/android/paymentsheet/flowcontroller/FlowControllerViewModel;", "paymentLauncherFactory", "Lcom/stripe/android/payments/paymentlauncher/StripePaymentLauncherAssistedFactory;", "lazyPaymentConfiguration", "Ljavax/inject/Provider;", "Lcom/stripe/android/PaymentConfiguration;", "enableLogging", "", NamedConstantsKt.PRODUCT_USAGE, "", "", "googlePayPaymentMethodLauncherFactory", "Lcom/stripe/android/googlepaylauncher/injection/GooglePayPaymentMethodLauncherFactory;", "bacsMandateConfirmationLauncherFactory", "Lcom/stripe/android/paymentsheet/paymentdatacollection/bacs/BacsMandateConfirmationLauncherFactory;", "linkLauncher", "Lcom/stripe/android/link/LinkPaymentLauncher;", "configurationHandler", "Lcom/stripe/android/paymentsheet/flowcontroller/FlowControllerConfigurationHandler;", "intentConfirmationInterceptor", "Lcom/stripe/android/paymentsheet/IntentConfirmationInterceptor;", "(Lkotlinx/coroutines/CoroutineScope;Landroidx/lifecycle/LifecycleOwner;Lkotlin/jvm/functions/Function0;Lcom/stripe/android/paymentsheet/model/PaymentOptionFactory;Lcom/stripe/android/paymentsheet/PaymentOptionCallback;Lcom/stripe/android/paymentsheet/PaymentSheetResultCallback;Lkotlin/jvm/functions/Function1;Landroidx/activity/result/ActivityResultRegistryOwner;Landroid/content/Context;Lcom/stripe/android/paymentsheet/analytics/EventReporter;Lcom/stripe/android/paymentsheet/flowcontroller/FlowControllerViewModel;Lcom/stripe/android/payments/paymentlauncher/StripePaymentLauncherAssistedFactory;Ljavax/inject/Provider;ZLjava/util/Set;Lcom/stripe/android/googlepaylauncher/injection/GooglePayPaymentMethodLauncherFactory;Lcom/stripe/android/paymentsheet/paymentdatacollection/bacs/BacsMandateConfirmationLauncherFactory;Lcom/stripe/android/link/LinkPaymentLauncher;Lcom/stripe/android/paymentsheet/flowcontroller/FlowControllerConfigurationHandler;Lcom/stripe/android/paymentsheet/IntentConfirmationInterceptor;)V", "bacsMandateConfirmationLauncher", "Lcom/stripe/android/paymentsheet/paymentdatacollection/bacs/BacsMandateConfirmationLauncher;", "flowControllerComponent", "Lcom/stripe/android/paymentsheet/flowcontroller/FlowControllerComponent;", "getFlowControllerComponent", "()Lcom/stripe/android/paymentsheet/flowcontroller/FlowControllerComponent;", "setFlowControllerComponent", "(Lcom/stripe/android/paymentsheet/flowcontroller/FlowControllerComponent;)V", "googlePayActivityLauncher", "Landroidx/activity/result/ActivityResultLauncher;", "Lcom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncherContractV2$Args;", "initializationMode", "Lcom/stripe/android/paymentsheet/PaymentSheet$InitializationMode;", "getInitializationMode", "()Lcom/stripe/android/paymentsheet/PaymentSheet$InitializationMode;", "paymentLauncher", "Lcom/stripe/android/payments/paymentlauncher/StripePaymentLauncher;", "paymentOptionActivityLauncher", "Lcom/stripe/android/paymentsheet/PaymentOptionContract$Args;", "sepaMandateActivityLauncher", "Lcom/stripe/android/paymentsheet/ui/SepaMandateContract$Args;", TTContentsEventConstants.Params.EVENT_PROPERTY_VALUE, "Lcom/stripe/android/paymentsheet/addresselement/AddressDetails;", "shippingDetails", "getShippingDetails", "()Lcom/stripe/android/paymentsheet/addresselement/AddressDetails;", "setShippingDetails", "(Lcom/stripe/android/paymentsheet/addresselement/AddressDetails;)V", "configure", "", "mode", "configuration", "Lcom/stripe/android/paymentsheet/PaymentSheet$Configuration;", "callback", "Lcom/stripe/android/paymentsheet/PaymentSheet$FlowController$ConfigCallback;", "configureWithIntentConfiguration", "intentConfiguration", "Lcom/stripe/android/paymentsheet/PaymentSheet$IntentConfiguration;", "configureWithPaymentIntent", "paymentIntentClientSecret", "configureWithSetupIntent", "setupIntentClientSecret", "confirm", "confirmLink", "paymentSelection", "Lcom/stripe/android/paymentsheet/model/PaymentSelection;", WiredHeadsetReceiverKt.INTENT_STATE, "Lcom/stripe/android/paymentsheet/state/PaymentSheetState$Full;", "confirmPaymentSelection", "confirmStripeIntent", "confirmStripeIntentParams", "Lcom/stripe/android/model/ConfirmStripeIntentParams;", "getPaymentAppearance", "Lcom/stripe/android/paymentsheet/PaymentSheet$Appearance;", "getPaymentOption", "Lcom/stripe/android/paymentsheet/model/PaymentOption;", "handleNextAction", "clientSecret", "stripeIntent", "Lcom/stripe/android/model/StripeIntent;", "launchGooglePay", "logPaymentResult", "paymentResult", "Lcom/stripe/android/payments/paymentlauncher/PaymentResult;", "onBacsMandateResult", "result", "Lcom/stripe/android/paymentsheet/paymentdatacollection/bacs/BacsMandateConfirmationResult;", "onBacsMandateResult$paymentsheet_release", "onGooglePayResult", "googlePayResult", "Lcom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncher$Result;", "onGooglePayResult$paymentsheet_release", "onInternalPaymentResult", "internalPaymentResult", "Lcom/stripe/android/payments/paymentlauncher/InternalPaymentResult;", "onInternalPaymentResult$paymentsheet_release", "onLinkActivityResult", "Lcom/stripe/android/link/LinkActivityResult;", "onPaymentOptionResult", "paymentOptionResult", "Lcom/stripe/android/paymentsheet/PaymentOptionResult;", "onPaymentOptionResult$paymentsheet_release", "onPaymentResult", "onPaymentResult$paymentsheet_release", "onSepaMandateResult", "sepaMandateResult", "Lcom/stripe/android/paymentsheet/ui/SepaMandateResult;", "onSepaMandateResult$paymentsheet_release", "presentPaymentOptions", "convertToPaymentSheetResult", "Lcom/stripe/android/paymentsheet/PaymentSheetResult;", "register", "I", "O", "contract", "Landroidx/activity/result/contract/ActivityResultContract;", "Landroidx/activity/result/ActivityResultCallback;", "Args", "BacsMandateException", "Companion", "GooglePayException", "paymentsheet_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class DefaultFlowController implements PaymentSheet.FlowController {

    public static final Companion INSTANCE = new Companion(null);
    private final BacsMandateConfirmationLauncher bacsMandateConfirmationLauncher;
    private final FlowControllerConfigurationHandler configurationHandler;
    private final Context context;
    private final boolean enableLogging;
    private final EventReporter eventReporter;
    public FlowControllerComponent flowControllerComponent;
    private final ActivityResultLauncher<GooglePayPaymentMethodLauncherContractV2.Args> googlePayActivityLauncher;
    private final GooglePayPaymentMethodLauncherFactory googlePayPaymentMethodLauncherFactory;
    private final IntentConfirmationInterceptor intentConfirmationInterceptor;
    private final Provider<PaymentConfiguration> lazyPaymentConfiguration;
    private final LinkPaymentLauncher linkLauncher;
    private StripePaymentLauncher paymentLauncher;
    private final StripePaymentLauncherAssistedFactory paymentLauncherFactory;
    private final ActivityResultLauncher<PaymentOptionContract.Args> paymentOptionActivityLauncher;
    private final PaymentOptionCallback paymentOptionCallback;
    private final PaymentOptionFactory paymentOptionFactory;
    private final PaymentSheetResultCallback paymentResultCallback;
    private final Function1<PaymentSheet.CustomerConfiguration, PrefsRepository> prefsRepositoryFactory;
    private final Set<String> productUsage;
    private final ActivityResultLauncher<SepaMandateContract.Args> sepaMandateActivityLauncher;
    private final Function0<Integer> statusBarColor;
    private final FlowControllerViewModel viewModel;
    private final CoroutineScope viewModelScope;

    @Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
    public class WhenMappings {
        public static final int[] $EnumSwitchMapping$0;

        static {
            int[] iArr = new int[PaymentSheet.GooglePayConfiguration.Environment.values().length];
            try {
                iArr[PaymentSheet.GooglePayConfiguration.Environment.Production.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            $EnumSwitchMapping$0 = iArr;
        }
    }

    @Inject
    public DefaultFlowController(CoroutineScope coroutineScope, LifecycleOwner lifecycleOwner, Function0<Integer> function0, PaymentOptionFactory paymentOptionFactory, PaymentOptionCallback paymentOptionCallback, PaymentSheetResultCallback paymentSheetResultCallback, Function1<PaymentSheet.CustomerConfiguration, PrefsRepository> function1, ActivityResultRegistryOwner activityResultRegistryOwner, Context context, EventReporter eventReporter, FlowControllerViewModel flowControllerViewModel, StripePaymentLauncherAssistedFactory stripePaymentLauncherAssistedFactory, Provider<PaymentConfiguration> provider, @Named("enableLogging") boolean z, @Named("productUsage") Set<String> set, GooglePayPaymentMethodLauncherFactory googlePayPaymentMethodLauncherFactory, BacsMandateConfirmationLauncherFactory bacsMandateConfirmationLauncherFactory, LinkPaymentLauncher linkPaymentLauncher, FlowControllerConfigurationHandler flowControllerConfigurationHandler, IntentConfirmationInterceptor intentConfirmationInterceptor) {
        Intrinsics.checkNotNullParameter(coroutineScope, "viewModelScope");
        Intrinsics.checkNotNullParameter(lifecycleOwner, "lifecycleOwner");
        Intrinsics.checkNotNullParameter(function0, "statusBarColor");
        Intrinsics.checkNotNullParameter(paymentOptionFactory, "paymentOptionFactory");
        Intrinsics.checkNotNullParameter(paymentOptionCallback, "paymentOptionCallback");
        Intrinsics.checkNotNullParameter(paymentSheetResultCallback, "paymentResultCallback");
        Intrinsics.checkNotNullParameter(function1, "prefsRepositoryFactory");
        Intrinsics.checkNotNullParameter(activityResultRegistryOwner, "activityResultRegistryOwner");
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(eventReporter, "eventReporter");
        Intrinsics.checkNotNullParameter(flowControllerViewModel, "viewModel");
        Intrinsics.checkNotNullParameter(stripePaymentLauncherAssistedFactory, "paymentLauncherFactory");
        Intrinsics.checkNotNullParameter(provider, "lazyPaymentConfiguration");
        Intrinsics.checkNotNullParameter(set, NamedConstantsKt.PRODUCT_USAGE);
        Intrinsics.checkNotNullParameter(googlePayPaymentMethodLauncherFactory, "googlePayPaymentMethodLauncherFactory");
        Intrinsics.checkNotNullParameter(bacsMandateConfirmationLauncherFactory, "bacsMandateConfirmationLauncherFactory");
        Intrinsics.checkNotNullParameter(linkPaymentLauncher, "linkLauncher");
        Intrinsics.checkNotNullParameter(flowControllerConfigurationHandler, "configurationHandler");
        Intrinsics.checkNotNullParameter(intentConfirmationInterceptor, "intentConfirmationInterceptor");
        this.viewModelScope = coroutineScope;
        this.statusBarColor = function0;
        this.paymentOptionFactory = paymentOptionFactory;
        this.paymentOptionCallback = paymentOptionCallback;
        this.paymentResultCallback = paymentSheetResultCallback;
        this.prefsRepositoryFactory = function1;
        this.context = context;
        this.eventReporter = eventReporter;
        this.viewModel = flowControllerViewModel;
        this.paymentLauncherFactory = stripePaymentLauncherAssistedFactory;
        this.lazyPaymentConfiguration = provider;
        this.enableLogging = z;
        this.productUsage = set;
        this.googlePayPaymentMethodLauncherFactory = googlePayPaymentMethodLauncherFactory;
        this.linkLauncher = linkPaymentLauncher;
        this.configurationHandler = flowControllerConfigurationHandler;
        this.intentConfirmationInterceptor = intentConfirmationInterceptor;
        final ActivityResultLauncher register = register(activityResultRegistryOwner, new PaymentLauncherContract(), new DefaultFlowController$paymentLauncherActivityResultLauncher$1(this));
        ActivityResultLauncher<PaymentOptionContract.Args> register2 = register(activityResultRegistryOwner, new PaymentOptionContract(), new AnonymousClass1());
        this.paymentOptionActivityLauncher = register2;
        ActivityResultLauncher<GooglePayPaymentMethodLauncherContractV2.Args> register3 = register(activityResultRegistryOwner, new GooglePayPaymentMethodLauncherContractV2(), new AnonymousClass2());
        this.googlePayActivityLauncher = register3;
        ActivityResultLauncher<SepaMandateContract.Args> register4 = register(activityResultRegistryOwner, new SepaMandateContract(), new AnonymousClass3());
        this.sepaMandateActivityLauncher = register4;
        ActivityResultLauncher<BacsMandateConfirmationContract.Args> register5 = register(activityResultRegistryOwner, new BacsMandateConfirmationContract(), new DefaultFlowController$bacsMandateConfirmationActivityLauncher$1(this));
        this.bacsMandateConfirmationLauncher = bacsMandateConfirmationLauncherFactory.create(register5);
        final Set of = SetsKt.setOf(new ActivityResultLauncher[]{register, register2, register3, register4, register5});
        linkPaymentLauncher.register(activityResultRegistryOwner.getActivityResultRegistry(), new AnonymousClass4(this));
        lifecycleOwner.getLifecycle().addObserver(new DefaultLifecycleObserver() {
            public void onCreate(LifecycleOwner owner) {
                Intrinsics.checkNotNullParameter(owner, "owner");
                DefaultFlowController defaultFlowController = DefaultFlowController.this;
                StripePaymentLauncherAssistedFactory stripePaymentLauncherAssistedFactory2 = defaultFlowController.paymentLauncherFactory;
                Integer num = (Integer) DefaultFlowController.this.statusBarColor.invoke();
                final DefaultFlowController defaultFlowController2 = DefaultFlowController.this;
                Function0<String> function02 = new Function0<String>() {
                    {
                        super(0);
                    }

                    public final String invoke() {
                        Provider provider2;
                        provider2 = DefaultFlowController.this.lazyPaymentConfiguration;
                        return ((PaymentConfiguration) provider2.get()).getPublishableKey();
                    }
                };
                final DefaultFlowController defaultFlowController3 = DefaultFlowController.this;
                defaultFlowController.paymentLauncher = stripePaymentLauncherAssistedFactory2.create(function02, new Function0<String>() {
                    {
                        super(0);
                    }

                    public final String invoke() {
                        Provider provider2;
                        provider2 = DefaultFlowController.this.lazyPaymentConfiguration;
                        return ((PaymentConfiguration) provider2.get()).getStripeAccountId();
                    }
                }, num, true, register);
            }

            public void onDestroy(LifecycleOwner owner) {
                Intrinsics.checkNotNullParameter(owner, "owner");
                Iterator<T> it2 = of.iterator();
                while (it2.hasNext()) {
                    ((ActivityResultLauncher) it2.next()).unregister();
                }
                DefaultFlowController.this.paymentLauncher = null;
                DefaultFlowController.this.linkLauncher.unregister();
            }
        });
    }

    public final FlowControllerComponent getFlowControllerComponent() {
        FlowControllerComponent flowControllerComponent = this.flowControllerComponent;
        if (flowControllerComponent != null) {
            return flowControllerComponent;
        }
        Intrinsics.throwUninitializedPropertyAccessException("flowControllerComponent");
        return null;
    }

    public final void setFlowControllerComponent(FlowControllerComponent flowControllerComponent) {
        Intrinsics.checkNotNullParameter(flowControllerComponent, "<set-?>");
        this.flowControllerComponent = flowControllerComponent;
    }

    public final PaymentSheet.InitializationMode getInitializationMode() {
        FlowControllerConfigurationHandler.ConfigureRequest previousConfigureRequest = this.viewModel.getPreviousConfigureRequest();
        if (previousConfigureRequest != null) {
            return previousConfigureRequest.getInitializationMode();
        }
        return null;
    }

    @Override
    public AddressDetails getShippingDetails() {
        PaymentSheet.Configuration config;
        PaymentSheetState.Full state = this.viewModel.getState();
        if (state == null || (config = state.getConfig()) == null) {
            return null;
        }
        return config.getShippingDetails();
    }

    @Override
    public void setShippingDetails(AddressDetails addressDetails) {
        PaymentSheet.Configuration copy;
        PaymentSheetState.Full state = this.viewModel.getState();
        if (state != null) {
            FlowControllerViewModel flowControllerViewModel = this.viewModel;
            copy = r3.copy((r26 & 1) != 0 ? r3.merchantDisplayName : null, (r26 & 2) != 0 ? r3.customer : null, (r26 & 4) != 0 ? r3.googlePay : null, (r26 & 8) != 0 ? r3.primaryButtonColor : null, (r26 & 16) != 0 ? r3.defaultBillingDetails : null, (r26 & 32) != 0 ? r3.shippingDetails : addressDetails, (r26 & 64) != 0 ? r3.allowsDelayedPaymentMethods : false, (r26 & 128) != 0 ? r3.allowsPaymentMethodsRequiringShippingAddress : false, (r26 & 256) != 0 ? r3.appearance : null, (r26 & TruecallerSdkScope.FOOTER_TYPE_MANUALLY) != 0 ? r3.primaryButtonLabel : null, (r26 & TruecallerSdkScope.BUTTON_SHAPE_ROUNDED) != 0 ? r3.billingDetailsCollectionConfiguration : null, (r26 & TruecallerSdkScope.BUTTON_SHAPE_RECTANGLE) != 0 ? state.getConfig().preferredNetworks : null);
            flowControllerViewModel.setState(PaymentSheetState.Full.copy$default(state, copy, null, null, false, null, false, null, 126, null));
        }
    }

    @Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
    class AnonymousClass1 implements ActivityResultCallback, FunctionAdapter {
        AnonymousClass1() {
        }

        public final boolean equals(Object obj) {
            if ((obj instanceof ActivityResultCallback) && (obj instanceof FunctionAdapter)) {
                return Intrinsics.areEqual(getFunctionDelegate(), ((FunctionAdapter) obj).getFunctionDelegate());
            }
            return false;
        }

        public final Function<?> getFunctionDelegate() {
            return new FunctionReferenceImpl<>(1, DefaultFlowController.this, DefaultFlowController.class, "onPaymentOptionResult", "onPaymentOptionResult$paymentsheet_release(Lcom/stripe/android/paymentsheet/PaymentOptionResult;)V", 0);
        }

        public final int hashCode() {
            return getFunctionDelegate().hashCode();
        }

        public final void onActivityResult(PaymentOptionResult paymentOptionResult) {
            DefaultFlowController.this.onPaymentOptionResult$paymentsheet_release(paymentOptionResult);
        }
    }

    @Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
    class AnonymousClass2 implements ActivityResultCallback, FunctionAdapter {
        AnonymousClass2() {
        }

        public final boolean equals(Object obj) {
            if ((obj instanceof ActivityResultCallback) && (obj instanceof FunctionAdapter)) {
                return Intrinsics.areEqual(getFunctionDelegate(), ((FunctionAdapter) obj).getFunctionDelegate());
            }
            return false;
        }

        public final Function<?> getFunctionDelegate() {
            return new FunctionReferenceImpl<>(1, DefaultFlowController.this, DefaultFlowController.class, "onGooglePayResult", "onGooglePayResult$paymentsheet_release(Lcom/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncher$Result;)V", 0);
        }

        public final int hashCode() {
            return getFunctionDelegate().hashCode();
        }

        public final void onActivityResult(GooglePayPaymentMethodLauncher.Result result) {
            Intrinsics.checkNotNullParameter(result, "p0");
            DefaultFlowController.this.onGooglePayResult$paymentsheet_release(result);
        }
    }

    @Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
    class AnonymousClass3 implements ActivityResultCallback, FunctionAdapter {
        AnonymousClass3() {
        }

        public final boolean equals(Object obj) {
            if ((obj instanceof ActivityResultCallback) && (obj instanceof FunctionAdapter)) {
                return Intrinsics.areEqual(getFunctionDelegate(), ((FunctionAdapter) obj).getFunctionDelegate());
            }
            return false;
        }

        public final Function<?> getFunctionDelegate() {
            return new FunctionReferenceImpl<>(1, DefaultFlowController.this, DefaultFlowController.class, "onSepaMandateResult", "onSepaMandateResult$paymentsheet_release(Lcom/stripe/android/paymentsheet/ui/SepaMandateResult;)V", 0);
        }

        public final int hashCode() {
            return getFunctionDelegate().hashCode();
        }

        public final void onActivityResult(SepaMandateResult sepaMandateResult) {
            Intrinsics.checkNotNullParameter(sepaMandateResult, "p0");
            DefaultFlowController.this.onSepaMandateResult$paymentsheet_release(sepaMandateResult);
        }
    }

    @Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
    class AnonymousClass4 extends FunctionReferenceImpl implements Function1<LinkActivityResult, Unit> {
        AnonymousClass4(Object obj) {
            super(1, obj, DefaultFlowController.class, "onLinkActivityResult", "onLinkActivityResult(Lcom/stripe/android/link/LinkActivityResult;)V", 0);
        }

        public Object invoke(Object obj) {
            invoke((LinkActivityResult) obj);
            return Unit.INSTANCE;
        }

        public final void invoke(LinkActivityResult linkActivityResult) {
            Intrinsics.checkNotNullParameter(linkActivityResult, "p0");
            ((DefaultFlowController) this.receiver).onLinkActivityResult(linkActivityResult);
        }
    }

    @Override
    public void configureWithPaymentIntent(String paymentIntentClientSecret, PaymentSheet.Configuration configuration, PaymentSheet.FlowController.ConfigCallback callback) {
        Intrinsics.checkNotNullParameter(paymentIntentClientSecret, "paymentIntentClientSecret");
        Intrinsics.checkNotNullParameter(callback, "callback");
        PaymentSheet.InitializationMode.PaymentIntent paymentIntent = new PaymentSheet.InitializationMode.PaymentIntent(paymentIntentClientSecret);
        if (configuration == null) {
            configuration = PaymentSheet.Configuration.INSTANCE.m301default(this.context);
        }
        configure(paymentIntent, configuration, callback);
    }

    @Override
    public void configureWithSetupIntent(String setupIntentClientSecret, PaymentSheet.Configuration configuration, PaymentSheet.FlowController.ConfigCallback callback) {
        Intrinsics.checkNotNullParameter(setupIntentClientSecret, "setupIntentClientSecret");
        Intrinsics.checkNotNullParameter(callback, "callback");
        PaymentSheet.InitializationMode.SetupIntent setupIntent = new PaymentSheet.InitializationMode.SetupIntent(setupIntentClientSecret);
        if (configuration == null) {
            configuration = PaymentSheet.Configuration.INSTANCE.m301default(this.context);
        }
        configure(setupIntent, configuration, callback);
    }

    @Override
    public void configureWithIntentConfiguration(PaymentSheet.IntentConfiguration intentConfiguration, PaymentSheet.Configuration configuration, PaymentSheet.FlowController.ConfigCallback callback) {
        Intrinsics.checkNotNullParameter(intentConfiguration, "intentConfiguration");
        Intrinsics.checkNotNullParameter(callback, "callback");
        PaymentSheet.InitializationMode.DeferredIntent deferredIntent = new PaymentSheet.InitializationMode.DeferredIntent(intentConfiguration);
        if (configuration == null) {
            configuration = PaymentSheet.Configuration.INSTANCE.m301default(this.context);
        }
        configure(deferredIntent, configuration, callback);
    }

    private final void configure(PaymentSheet.InitializationMode mode, PaymentSheet.Configuration configuration, PaymentSheet.FlowController.ConfigCallback callback) {
        this.configurationHandler.configure(this.viewModelScope, mode, configuration, callback);
    }

    @Override
    public PaymentOption getPaymentOption() {
        PaymentSelection paymentSelection = this.viewModel.getPaymentSelection();
        if (paymentSelection != null) {
            return this.paymentOptionFactory.create(paymentSelection);
        }
        return null;
    }

    @Override
    public void presentPaymentOptions() {
        PaymentSheetState.Full state = this.viewModel.getState();
        if (state == null) {
            throw new IllegalStateException("FlowController must be successfully initialized using configureWithPaymentIntent(), configureWithSetupIntent() or configureWithIntentConfiguration() before calling presentPaymentOptions().".toString());
        }
        if (this.configurationHandler.isConfigured()) {
            PaymentOptionContract.Args args = new PaymentOptionContract.Args(PaymentSheetState.Full.copy$default(state, null, null, null, false, null, false, this.viewModel.getPaymentSelection(), 63, null), (Integer) this.statusBarColor.invoke(), this.enableLogging, this.productUsage);
            ActivityOptionsCompat makeCustomAnimation = ActivityOptionsCompat.makeCustomAnimation(this.viewModel.getApplication(), AnimationConstants.INSTANCE.getFADE_IN(), AnimationConstants.INSTANCE.getFADE_OUT());
            Intrinsics.checkNotNullExpressionValue(makeCustomAnimation, "makeCustomAnimation(\n   …tants.FADE_OUT,\n        )");
            this.paymentOptionActivityLauncher.launch(args, makeCustomAnimation);
        }
    }

    @Override
    public void confirm() {
        Unit unit;
        PaymentSheetState.Full state = this.viewModel.getState();
        if (state == null) {
            throw new IllegalStateException("FlowController must be successfully initialized using configureWithPaymentIntent(), configureWithSetupIntent() or configureWithIntentConfiguration() before calling confirm().".toString());
        }
        if (!this.configurationHandler.isConfigured()) {
            onPaymentResult$paymentsheet_release(new PaymentResult.Failed(new IllegalStateException("FlowController.confirm() can only be called if the most recent call to configureWithPaymentIntent(), configureWithSetupIntent() or configureWithIntentConfiguration() has completed successfully.")));
            return;
        }
        PaymentSelection paymentSelection = this.viewModel.getPaymentSelection();
        if (paymentSelection instanceof PaymentSelection.GooglePay) {
            launchGooglePay(state);
            return;
        }
        if (paymentSelection instanceof PaymentSelection.Link ? true : paymentSelection instanceof PaymentSelection.New.LinkInline) {
            confirmLink(paymentSelection, state);
            return;
        }
        if (paymentSelection instanceof PaymentSelection.New.GenericPaymentMethod) {
            PaymentSelection.New.GenericPaymentMethod genericPaymentMethod = (PaymentSelection.New.GenericPaymentMethod) paymentSelection;
            if (Intrinsics.areEqual(genericPaymentMethod.getPaymentMethodCreateParams().getTypeCode(), PaymentMethod.Type.BacsDebit.code)) {
                BacsMandateData fromPaymentSelection = BacsMandateData.INSTANCE.fromPaymentSelection(genericPaymentMethod);
                if (fromPaymentSelection != null) {
                    this.bacsMandateConfirmationLauncher.launch(fromPaymentSelection, getPaymentAppearance());
                    unit = Unit.INSTANCE;
                } else {
                    unit = null;
                }
                if (unit == null) {
                    this.paymentResultCallback.onPaymentSheetResult(new PaymentSheetResult.Failed(new BacsMandateException(BacsMandateException.Type.MissingInformation)));
                    return;
                }
                return;
            }
            confirmPaymentSelection(paymentSelection, state);
            return;
        }
        if ((paymentSelection instanceof PaymentSelection.New) || paymentSelection == null) {
            confirmPaymentSelection(paymentSelection, state);
            return;
        }
        if (paymentSelection instanceof PaymentSelection.Saved) {
            if (((PaymentSelection.Saved) paymentSelection).getPaymentMethod().type == PaymentMethod.Type.SepaDebit) {
                PaymentSelection paymentSelection2 = this.viewModel.getPaymentSelection();
                if ((paymentSelection2 == null || paymentSelection2.getHasAcknowledgedSepaMandate()) ? false : true) {
                    this.sepaMandateActivityLauncher.launch(new SepaMandateContract.Args(state.getConfig().getMerchantDisplayName()));
                    return;
                }
            }
            confirmPaymentSelection(paymentSelection, state);
        }
    }

    public final void confirmPaymentSelection(PaymentSelection paymentSelection, PaymentSheetState.Full state) {
        Intrinsics.checkNotNullParameter(state, WiredHeadsetReceiverKt.INTENT_STATE);
        BuildersKt.launch$default(this.viewModelScope, (CoroutineContext) null, (CoroutineStart) null, new DefaultFlowController$confirmPaymentSelection$1(state, this, paymentSelection, null), 3, (Object) null);
    }

    public final void confirmStripeIntent(ConfirmStripeIntentParams confirmStripeIntentParams) {
        Object m1547constructorimpl;
        StripePaymentLauncher stripePaymentLauncher;
        try {
            Result.Companion companion = Result.INSTANCE;
            DefaultFlowController defaultFlowController = this;
            stripePaymentLauncher = this.paymentLauncher;
        } catch (Throwable th) {
            Result.Companion companion2 = Result.INSTANCE;
            m1547constructorimpl = Result.m1547constructorimpl(ResultKt.createFailure(th));
        }
        if (stripePaymentLauncher != null) {
            m1547constructorimpl = Result.m1547constructorimpl(stripePaymentLauncher);
            Throwable m1550exceptionOrNullimpl = Result.m1550exceptionOrNullimpl(m1547constructorimpl);
            if (m1550exceptionOrNullimpl == null) {
                StripePaymentLauncher stripePaymentLauncher2 = (StripePaymentLauncher) m1547constructorimpl;
                if (confirmStripeIntentParams instanceof ConfirmPaymentIntentParams) {
                    stripePaymentLauncher2.confirm((ConfirmPaymentIntentParams) confirmStripeIntentParams);
                    return;
                } else {
                    if (confirmStripeIntentParams instanceof ConfirmSetupIntentParams) {
                        stripePaymentLauncher2.confirm((ConfirmSetupIntentParams) confirmStripeIntentParams);
                        return;
                    }
                    return;
                }
            }
            throw new IllegalStateException(m1550exceptionOrNullimpl.toString());
        }
        throw new IllegalArgumentException("Required value was null.".toString());
    }

    public final void handleNextAction(String clientSecret, StripeIntent stripeIntent) {
        Object m1547constructorimpl;
        StripePaymentLauncher stripePaymentLauncher;
        try {
            Result.Companion companion = Result.INSTANCE;
            DefaultFlowController defaultFlowController = this;
            stripePaymentLauncher = this.paymentLauncher;
        } catch (Throwable th) {
            Result.Companion companion2 = Result.INSTANCE;
            m1547constructorimpl = Result.m1547constructorimpl(ResultKt.createFailure(th));
        }
        if (stripePaymentLauncher != null) {
            m1547constructorimpl = Result.m1547constructorimpl(stripePaymentLauncher);
            Throwable m1550exceptionOrNullimpl = Result.m1550exceptionOrNullimpl(m1547constructorimpl);
            if (m1550exceptionOrNullimpl == null) {
                StripePaymentLauncher stripePaymentLauncher2 = (StripePaymentLauncher) m1547constructorimpl;
                if (stripeIntent instanceof PaymentIntent) {
                    stripePaymentLauncher2.handleNextActionForPaymentIntent(clientSecret);
                    return;
                } else {
                    if (stripeIntent instanceof SetupIntent) {
                        stripePaymentLauncher2.handleNextActionForSetupIntent(clientSecret);
                        return;
                    }
                    return;
                }
            }
            throw new IllegalStateException(m1550exceptionOrNullimpl.toString());
        }
        throw new IllegalArgumentException("Required value was null.".toString());
    }

    public final void onGooglePayResult$paymentsheet_release(GooglePayPaymentMethodLauncher.Result googlePayResult) {
        Object m1547constructorimpl;
        PaymentSheetState.Full state;
        Intrinsics.checkNotNullParameter(googlePayResult, "googlePayResult");
        if (googlePayResult instanceof GooglePayPaymentMethodLauncher.Result.Completed) {
            try {
                Result.Companion companion = Result.INSTANCE;
                DefaultFlowController defaultFlowController = this;
                state = this.viewModel.getState();
            } catch (Throwable th) {
                Result.Companion companion2 = Result.INSTANCE;
                m1547constructorimpl = Result.m1547constructorimpl(ResultKt.createFailure(th));
            }
            if (state != null) {
                m1547constructorimpl = Result.m1547constructorimpl(state);
                Throwable m1550exceptionOrNullimpl = Result.m1550exceptionOrNullimpl(m1547constructorimpl);
                if (m1550exceptionOrNullimpl == null) {
                    PaymentSelection.Saved saved = new PaymentSelection.Saved(((GooglePayPaymentMethodLauncher.Result.Completed) googlePayResult).getPaymentMethod(), PaymentSelection.Saved.WalletType.GooglePay);
                    this.viewModel.setPaymentSelection(saved);
                    confirmPaymentSelection(saved, (PaymentSheetState.Full) m1547constructorimpl);
                    return;
                }
                this.eventReporter.onPaymentFailure(PaymentSelection.GooglePay.INSTANCE, PaymentSheetConfirmationError.InvalidState.INSTANCE);
                this.paymentResultCallback.onPaymentSheetResult(new PaymentSheetResult.Failed(m1550exceptionOrNullimpl));
                return;
            }
            throw new IllegalArgumentException("Required value was null.".toString());
        }
        if (googlePayResult instanceof GooglePayPaymentMethodLauncher.Result.Failed) {
            GooglePayPaymentMethodLauncher.Result.Failed failed = (GooglePayPaymentMethodLauncher.Result.Failed) googlePayResult;
            this.eventReporter.onPaymentFailure(PaymentSelection.GooglePay.INSTANCE, new PaymentSheetConfirmationError.GooglePay(failed.getErrorCode()));
            this.paymentResultCallback.onPaymentSheetResult(new PaymentSheetResult.Failed(new GooglePayException(failed.getError())));
        } else if (googlePayResult instanceof GooglePayPaymentMethodLauncher.Result.Canceled) {
            this.paymentResultCallback.onPaymentSheetResult(PaymentSheetResult.Canceled.INSTANCE);
        }
    }

    public final void onBacsMandateResult$paymentsheet_release(BacsMandateConfirmationResult result) {
        Object m1547constructorimpl;
        PaymentSheetState.Full state;
        Intrinsics.checkNotNullParameter(result, "result");
        if (result instanceof BacsMandateConfirmationResult.Confirmed) {
            try {
                Result.Companion companion = Result.INSTANCE;
                DefaultFlowController defaultFlowController = this;
                state = this.viewModel.getState();
            } catch (Throwable th) {
                Result.Companion companion2 = Result.INSTANCE;
                m1547constructorimpl = Result.m1547constructorimpl(ResultKt.createFailure(th));
            }
            if (state != null) {
                m1547constructorimpl = Result.m1547constructorimpl(state);
                Throwable m1550exceptionOrNullimpl = Result.m1550exceptionOrNullimpl(m1547constructorimpl);
                if (m1550exceptionOrNullimpl == null) {
                    PaymentSheetState.Full full = (PaymentSheetState.Full) m1547constructorimpl;
                    PaymentSelection paymentSelection = this.viewModel.getPaymentSelection();
                    if ((paymentSelection instanceof PaymentSelection.New.GenericPaymentMethod) && Intrinsics.areEqual(((PaymentSelection.New.GenericPaymentMethod) paymentSelection).getPaymentMethodCreateParams().getTypeCode(), PaymentMethod.Type.BacsDebit.code)) {
                        confirmPaymentSelection(paymentSelection, full);
                        return;
                    } else {
                        this.paymentResultCallback.onPaymentSheetResult(new PaymentSheetResult.Failed(new BacsMandateException(BacsMandateException.Type.IncorrectSelection)));
                        return;
                    }
                }
                this.paymentResultCallback.onPaymentSheetResult(new PaymentSheetResult.Failed(m1550exceptionOrNullimpl));
                return;
            }
            throw new IllegalArgumentException("Required value was null.".toString());
        }
        if (result instanceof BacsMandateConfirmationResult.ModifyDetails) {
            presentPaymentOptions();
        } else {
            boolean z = result instanceof BacsMandateConfirmationResult.Cancelled;
        }
    }

    public final void onLinkActivityResult(LinkActivityResult result) {
        Object m1547constructorimpl;
        PaymentSheetState.Full state;
        Intrinsics.checkNotNullParameter(result, "result");
        if (result instanceof LinkActivityResult.Canceled) {
            onPaymentResult$paymentsheet_release(PaymentResult.Canceled.INSTANCE);
            return;
        }
        if (result instanceof LinkActivityResult.Failed) {
            onPaymentResult$paymentsheet_release(new PaymentResult.Failed(((LinkActivityResult.Failed) result).getError()));
            return;
        }
        if (result instanceof LinkActivityResult.Completed) {
            try {
                Result.Companion companion = Result.INSTANCE;
                DefaultFlowController defaultFlowController = this;
                state = this.viewModel.getState();
            } catch (Throwable th) {
                Result.Companion companion2 = Result.INSTANCE;
                m1547constructorimpl = Result.m1547constructorimpl(ResultKt.createFailure(th));
            }
            if (state != null) {
                m1547constructorimpl = Result.m1547constructorimpl(state);
                Throwable m1550exceptionOrNullimpl = Result.m1550exceptionOrNullimpl(m1547constructorimpl);
                if (m1550exceptionOrNullimpl == null) {
                    PaymentSelection.Saved saved = new PaymentSelection.Saved(((LinkActivityResult.Completed) result).getPaymentMethod(), PaymentSelection.Saved.WalletType.Link);
                    this.viewModel.setPaymentSelection(saved);
                    confirmPaymentSelection(saved, (PaymentSheetState.Full) m1547constructorimpl);
                    return;
                }
                this.eventReporter.onPaymentFailure(PaymentSelection.Link.INSTANCE, PaymentSheetConfirmationError.InvalidState.INSTANCE);
                this.paymentResultCallback.onPaymentSheetResult(new PaymentSheetResult.Failed(m1550exceptionOrNullimpl));
                return;
            }
            throw new IllegalArgumentException("Required value was null.".toString());
        }
        throw new NoWhenBranchMatchedException();
    }

    public final void onPaymentOptionResult$paymentsheet_release(PaymentOptionResult paymentOptionResult) {
        List<PaymentMethod> paymentMethods;
        if (paymentOptionResult != null && (paymentMethods = paymentOptionResult.getPaymentMethods()) != null) {
            FlowControllerViewModel flowControllerViewModel = this.viewModel;
            PaymentSheetState.Full state = flowControllerViewModel.getState();
            flowControllerViewModel.setState(state != null ? PaymentSheetState.Full.copy$default(state, null, null, paymentMethods, false, null, false, null, 123, null) : null);
        }
        if (paymentOptionResult instanceof PaymentOptionResult.Succeeded) {
            PaymentSelection paymentSelection = ((PaymentOptionResult.Succeeded) paymentOptionResult).getPaymentSelection();
            paymentSelection.setHasAcknowledgedSepaMandate(true);
            this.viewModel.setPaymentSelection(paymentSelection);
            this.paymentOptionCallback.onPaymentOption(this.paymentOptionFactory.create(paymentSelection));
            return;
        }
        if (paymentOptionResult instanceof PaymentOptionResult.Failed) {
            PaymentOptionCallback paymentOptionCallback = this.paymentOptionCallback;
            PaymentSelection paymentSelection2 = this.viewModel.getPaymentSelection();
            paymentOptionCallback.onPaymentOption(paymentSelection2 != null ? this.paymentOptionFactory.create(paymentSelection2) : null);
        } else if (paymentOptionResult instanceof PaymentOptionResult.Canceled) {
            PaymentSelection paymentSelection3 = ((PaymentOptionResult.Canceled) paymentOptionResult).getPaymentSelection();
            this.viewModel.setPaymentSelection(paymentSelection3);
            this.paymentOptionCallback.onPaymentOption(paymentSelection3 != null ? this.paymentOptionFactory.create(paymentSelection3) : null);
        } else if (paymentOptionResult == null) {
            this.viewModel.setPaymentSelection(null);
            this.paymentOptionCallback.onPaymentOption(null);
        }
    }

    public final void onInternalPaymentResult$paymentsheet_release(InternalPaymentResult internalPaymentResult) {
        PaymentResult.Canceled canceled;
        PaymentSheet.Configuration config;
        Intrinsics.checkNotNullParameter(internalPaymentResult, "internalPaymentResult");
        if (internalPaymentResult instanceof InternalPaymentResult.Completed) {
            StripeIntent intent = ((InternalPaymentResult.Completed) internalPaymentResult).getIntent();
            PaymentSelection.Saved paymentSelection = this.viewModel.getPaymentSelection();
            PaymentSheet.InitializationMode initializationMode = getInitializationMode();
            PaymentSheet.CustomerConfiguration customerConfiguration = null;
            if (paymentSelection instanceof PaymentSelection.New) {
                PaymentMethod paymentMethod = intent.getPaymentMethod();
                if (!(initializationMode != null && SelectionUtilsKt.canSave((PaymentSelection.New) paymentSelection, initializationMode))) {
                    paymentMethod = null;
                }
                paymentSelection = paymentMethod != null ? new PaymentSelection.Saved(paymentMethod, null, 2, null) : null;
            }
            if (paymentSelection != null) {
                Function1<PaymentSheet.CustomerConfiguration, PrefsRepository> function1 = this.prefsRepositoryFactory;
                PaymentSheetState.Full state = this.viewModel.getState();
                if (state != null && (config = state.getConfig()) != null) {
                    customerConfiguration = config.getCustomer();
                }
                ((PrefsRepository) function1.invoke(customerConfiguration)).savePaymentSelection(paymentSelection);
            }
            canceled = PaymentResult.Completed.INSTANCE;
        } else if (internalPaymentResult instanceof InternalPaymentResult.Failed) {
            canceled = new PaymentResult.Failed(((InternalPaymentResult.Failed) internalPaymentResult).getThrowable());
        } else {
            if (!(internalPaymentResult instanceof InternalPaymentResult.Canceled)) {
                throw new NoWhenBranchMatchedException();
            }
            canceled = PaymentResult.Canceled.INSTANCE;
        }
        onPaymentResult$paymentsheet_release(canceled);
    }

    public final void onPaymentResult$paymentsheet_release(PaymentResult paymentResult) {
        Intrinsics.checkNotNullParameter(paymentResult, "paymentResult");
        logPaymentResult(paymentResult);
        BuildersKt.launch$default(this.viewModelScope, (CoroutineContext) null, (CoroutineStart) null, new DefaultFlowController$onPaymentResult$1(this, paymentResult, null), 3, (Object) null);
    }

    public final void onSepaMandateResult$paymentsheet_release(SepaMandateResult sepaMandateResult) {
        Intrinsics.checkNotNullParameter(sepaMandateResult, "sepaMandateResult");
        if (Intrinsics.areEqual(sepaMandateResult, SepaMandateResult.Acknowledged.INSTANCE)) {
            PaymentSelection paymentSelection = this.viewModel.getPaymentSelection();
            if (paymentSelection != null) {
                paymentSelection.setHasAcknowledgedSepaMandate(true);
            }
            confirm();
            return;
        }
        if (Intrinsics.areEqual(sepaMandateResult, SepaMandateResult.Canceled.INSTANCE)) {
            this.paymentResultCallback.onPaymentSheetResult(PaymentSheetResult.Canceled.INSTANCE);
        }
    }

    private final void logPaymentResult(PaymentResult paymentResult) {
        if (paymentResult instanceof PaymentResult.Completed) {
            this.eventReporter.onPaymentSuccess(this.viewModel.getPaymentSelection(), this.viewModel.getDeferredIntentConfirmationType());
            this.viewModel.setDeferredIntentConfirmationType(null);
        } else if (paymentResult instanceof PaymentResult.Failed) {
            this.eventReporter.onPaymentFailure(this.viewModel.getPaymentSelection(), new PaymentSheetConfirmationError.Stripe(((PaymentResult.Failed) paymentResult).getThrowable()));
        }
    }

    private final void confirmLink(PaymentSelection paymentSelection, PaymentSheetState.Full state) {
        LinkState linkState = state.getLinkState();
        if (linkState == null) {
            throw new IllegalArgumentException("Required value was null.".toString());
        }
        LinkConfiguration configuration = linkState.getConfiguration();
        if (paymentSelection instanceof PaymentSelection.Link) {
            this.linkLauncher.present(configuration);
        } else {
            confirmPaymentSelection(paymentSelection, state);
        }
    }

    private final void launchGooglePay(PaymentSheetState.Full state) {
        GooglePayEnvironment googlePayEnvironment;
        String currencyCode;
        Long amount;
        PaymentSheet.GooglePayConfiguration googlePay = state.getConfig().getGooglePay();
        if (googlePay == null) {
            throw new IllegalArgumentException("Required value was null.".toString());
        }
        if (WhenMappings.$EnumSwitchMapping$0[googlePay.getEnvironment().ordinal()] == 1) {
            googlePayEnvironment = GooglePayEnvironment.Production;
        } else {
            googlePayEnvironment = GooglePayEnvironment.Test;
        }
        GooglePayPaymentMethodLauncher create = this.googlePayPaymentMethodLauncherFactory.create(this.viewModelScope, new GooglePayPaymentMethodLauncher.Config(googlePayEnvironment, googlePay.getCountryCode(), state.getConfig().getMerchantDisplayName(), state.getConfig().getBillingDetailsCollectionConfiguration().getCollectsEmail$paymentsheet_release(), state.getConfig().getBillingDetailsCollectionConfiguration().toBillingAddressConfig$paymentsheet_release(), false, false, 96, (DefaultConstructorMarker) null), new GooglePayPaymentMethodLauncher.ReadyCallback() {
            public final void onReady(boolean z) {
            }
        }, this.googlePayActivityLauncher, true);
        StripeIntent stripeIntent = state.getStripeIntent();
        PaymentIntent paymentIntent = stripeIntent instanceof PaymentIntent ? (PaymentIntent) stripeIntent : null;
        if ((paymentIntent == null || (currencyCode = paymentIntent.getCurrency()) == null) && (currencyCode = googlePay.getCurrencyCode()) == null) {
            currencyCode = "";
        }
        String str = currencyCode;
        StripeIntent stripeIntent2 = state.getStripeIntent();
        PaymentIntent paymentIntent2 = stripeIntent2 instanceof PaymentIntent ? (PaymentIntent) stripeIntent2 : null;
        create.present(str, (paymentIntent2 == null || (amount = paymentIntent2.getAmount()) == null) ? 0L : amount.longValue(), state.getStripeIntent().getId(), googlePay.getLabel());
    }

    public final PaymentSheetResult convertToPaymentSheetResult(PaymentResult paymentResult) {
        if (paymentResult instanceof PaymentResult.Completed) {
            return PaymentSheetResult.Completed.INSTANCE;
        }
        if (paymentResult instanceof PaymentResult.Canceled) {
            return PaymentSheetResult.Canceled.INSTANCE;
        }
        if (paymentResult instanceof PaymentResult.Failed) {
            return new PaymentSheetResult.Failed(((PaymentResult.Failed) paymentResult).getThrowable());
        }
        throw new NoWhenBranchMatchedException();
    }

    private final PaymentSheet.Appearance getPaymentAppearance() {
        PaymentSheet.Configuration config;
        PaymentSheet.Appearance appearance;
        PaymentSheetState.Full state = this.viewModel.getState();
        return (state == null || (config = state.getConfig()) == null || (appearance = config.getAppearance()) == null) ? new PaymentSheet.Appearance(null, null, null, null, null, 31, null) : appearance;
    }

    @Metadata(d1 = {"\u0000\u001e\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0006\b\u0007\u0018\u00002\u00060\u0001j\u0002`\u0002:\u0001\fB\r\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0005R\u0014\u0010\u0006\u001a\u00020\u0007X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010\tR\u0011\u0010\u0003\u001a\u00020\u0004¢\u0006\b\n\u0000\u001a\u0004\b\n\u0010\u000b¨\u0006\r"}, d2 = {"Lcom/stripe/android/paymentsheet/flowcontroller/DefaultFlowController$BacsMandateException;", "Ljava/lang/Exception;", "Lkotlin/Exception;", "type", "Lcom/stripe/android/paymentsheet/flowcontroller/DefaultFlowController$BacsMandateException$Type;", "(Lcom/stripe/android/paymentsheet/flowcontroller/DefaultFlowController$BacsMandateException$Type;)V", RestAdapter.JSON_KEY_ERROR_MESSAGE, "", "getMessage", "()Ljava/lang/String;", "getType", "()Lcom/stripe/android/paymentsheet/flowcontroller/DefaultFlowController$BacsMandateException$Type;", "Type", "paymentsheet_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
    public static final class BacsMandateException extends Exception {
        public static final int $stable = 0;
        private final String message;
        private final Type type;

        @Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0004\b\u0086\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002j\u0002\b\u0003j\u0002\b\u0004¨\u0006\u0005"}, d2 = {"Lcom/stripe/android/paymentsheet/flowcontroller/DefaultFlowController$BacsMandateException$Type;", "", "(Ljava/lang/String;I)V", "MissingInformation", "IncorrectSelection", "paymentsheet_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
        public enum Type {
            MissingInformation,
            IncorrectSelection
        }

        @Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
        public class WhenMappings {
            public static final int[] $EnumSwitchMapping$0;

            static {
                int[] iArr = new int[Type.values().length];
                try {
                    iArr[Type.MissingInformation.ordinal()] = 1;
                } catch (NoSuchFieldError unused) {
                }
                try {
                    iArr[Type.IncorrectSelection.ordinal()] = 2;
                } catch (NoSuchFieldError unused2) {
                }
                $EnumSwitchMapping$0 = iArr;
            }
        }

        public final Type getType() {
            return this.type;
        }

        public BacsMandateException(Type type) {
            String str;
            Intrinsics.checkNotNullParameter(type, "type");
            this.type = type;
            int i2 = WhenMappings.$EnumSwitchMapping$0[type.ordinal()];
            if (i2 == 1) {
                str = "Bacs requires the account's name, email, sort code, and account number be provided!";
            } else {
                if (i2 != 2) {
                    throw new NoWhenBranchMatchedException();
                }
                str = "Cannot confirm non-Bacs payment method with Bacs mandate";
            }
            this.message = str;
        }

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

    @Metadata(d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0003\n\u0002\b\u0004\b\u0007\u0018\u00002\u00060\u0001j\u0002`\u0002B\r\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0005R\u0011\u0010\u0003\u001a\u00020\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u0007¨\u0006\b"}, d2 = {"Lcom/stripe/android/paymentsheet/flowcontroller/DefaultFlowController$GooglePayException;", "Ljava/lang/Exception;", "Lkotlin/Exception;", "throwable", "", "(Ljava/lang/Throwable;)V", "getThrowable", "()Ljava/lang/Throwable;", "paymentsheet_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
    public static final class GooglePayException extends Exception {
        public static final int $stable = 8;
        private final Throwable throwable;

        public final Throwable getThrowable() {
            return this.throwable;
        }

        public GooglePayException(Throwable th) {
            super(th);
            Intrinsics.checkNotNullParameter(th, "throwable");
            this.throwable = th;
        }
    }

    @Metadata(d1 = {"\u0000:\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0087\b\u0018\u00002\u00020\u0001B\u0017\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\b\u0010\u0004\u001a\u0004\u0018\u00010\u0005¢\u0006\u0002\u0010\u0006J\t\u0010\u000b\u001a\u00020\u0003HÆ\u0003J\u000b\u0010\f\u001a\u0004\u0018\u00010\u0005HÆ\u0003J\u001f\u0010\r\u001a\u00020\u00002\b\b\u0002\u0010\u0002\u001a\u00020\u00032\n\b\u0002\u0010\u0004\u001a\u0004\u0018\u00010\u0005HÆ\u0001J\t\u0010\u000e\u001a\u00020\u000fHÖ\u0001J\u0013\u0010\u0010\u001a\u00020\u00112\b\u0010\u0012\u001a\u0004\u0018\u00010\u0013HÖ\u0003J\t\u0010\u0014\u001a\u00020\u000fHÖ\u0001J\t\u0010\u0015\u001a\u00020\u0003HÖ\u0001J\u0019\u0010\u0016\u001a\u00020\u00172\u0006\u0010\u0018\u001a\u00020\u00192\u0006\u0010\u001a\u001a\u00020\u000fHÖ\u0001R\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\bR\u0013\u0010\u0004\u001a\u0004\u0018\u00010\u0005¢\u0006\b\n\u0000\u001a\u0004\b\t\u0010\n¨\u0006\u001b"}, d2 = {"Lcom/stripe/android/paymentsheet/flowcontroller/DefaultFlowController$Args;", "Landroid/os/Parcelable;", "clientSecret", "", "config", "Lcom/stripe/android/paymentsheet/PaymentSheet$Configuration;", "(Ljava/lang/String;Lcom/stripe/android/paymentsheet/PaymentSheet$Configuration;)V", "getClientSecret", "()Ljava/lang/String;", "getConfig", "()Lcom/stripe/android/paymentsheet/PaymentSheet$Configuration;", "component1", "component2", "copy", "describeContents", "", "equals", "", "other", "", "hashCode", "toString", "writeToParcel", "", "parcel", "Landroid/os/Parcel;", "flags", "paymentsheet_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
    public static final class Args implements Parcelable {
        public static final int $stable = PaymentSheet.Configuration.$stable;
        public static final Parcelable.Creator<Args> CREATOR = new Creator();
        private final String clientSecret;
        private final PaymentSheet.Configuration config;

        @Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
        public static final class Creator implements Parcelable.Creator<Args> {
            @Override
            public final Args createFromParcel(Parcel parcel) {
                Intrinsics.checkNotNullParameter(parcel, "parcel");
                return new Args(parcel.readString(), (PaymentSheet.Configuration) parcel.readParcelable(Args.class.getClassLoader()));
            }

            @Override
            public final Args[] newArray(int i2) {
                return new Args[i2];
            }
        }

        public static Args copy$default(Args args, String str, PaymentSheet.Configuration configuration, int i2, Object obj) {
            if ((i2 & 1) != 0) {
                str = args.clientSecret;
            }
            if ((i2 & 2) != 0) {
                configuration = args.config;
            }
            return args.copy(str, configuration);
        }

        public final String getClientSecret() {
            return this.clientSecret;
        }

        public final PaymentSheet.Configuration getConfig() {
            return this.config;
        }

        public final Args copy(String clientSecret, PaymentSheet.Configuration config) {
            Intrinsics.checkNotNullParameter(clientSecret, "clientSecret");
            return new Args(clientSecret, config);
        }

        @Override
        public int describeContents() {
            return 0;
        }

        public boolean equals(Object other) {
            if (this == other) {
                return true;
            }
            if (!(other instanceof Args)) {
                return false;
            }
            Args args = (Args) other;
            return Intrinsics.areEqual(this.clientSecret, args.clientSecret) && Intrinsics.areEqual(this.config, args.config);
        }

        public int hashCode() {
            int hashCode = this.clientSecret.hashCode() * 31;
            PaymentSheet.Configuration configuration = this.config;
            return hashCode + (configuration == null ? 0 : configuration.hashCode());
        }

        public String toString() {
            return "Args(clientSecret=" + this.clientSecret + ", config=" + this.config + ")";
        }

        @Override
        public void writeToParcel(Parcel parcel, int flags) {
            Intrinsics.checkNotNullParameter(parcel, "out");
            parcel.writeString(this.clientSecret);
            parcel.writeParcelable(this.config, flags);
        }

        public Args(String str, PaymentSheet.Configuration configuration) {
            Intrinsics.checkNotNullParameter(str, "clientSecret");
            this.clientSecret = str;
            this.config = configuration;
        }

        public final String getClientSecret() {
            return this.clientSecret;
        }

        public final PaymentSheet.Configuration getConfig() {
            return this.config;
        }
    }

    private final <I, O> ActivityResultLauncher<I> register(ActivityResultRegistryOwner activityResultRegistryOwner, ActivityResultContract<I, O> activityResultContract, ActivityResultCallback<O> activityResultCallback) {
        ActivityResultLauncher<I> register = activityResultRegistryOwner.getActivityResultRegistry().register("FlowController_" + activityResultContract.getClass().getName(), activityResultContract, activityResultCallback);
        Intrinsics.checkNotNullExpressionValue(register, "activityResultRegistry.r…(key, contract, callback)");
        return register;
    }

    @Metadata(d1 = {"\u0000:\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J>\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\n2\u000e\u0010\u000b\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\r0\f2\u0006\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u0011¨\u0006\u0012"}, d2 = {"Lcom/stripe/android/paymentsheet/flowcontroller/DefaultFlowController$Companion;", "", "()V", "getInstance", "Lcom/stripe/android/paymentsheet/PaymentSheet$FlowController;", "viewModelStoreOwner", "Landroidx/lifecycle/ViewModelStoreOwner;", "lifecycleOwner", "Landroidx/lifecycle/LifecycleOwner;", "activityResultRegistryOwner", "Landroidx/activity/result/ActivityResultRegistryOwner;", "statusBarColor", "Lkotlin/Function0;", "", "paymentOptionCallback", "Lcom/stripe/android/paymentsheet/PaymentOptionCallback;", "paymentResultCallback", "Lcom/stripe/android/paymentsheet/PaymentSheetResultCallback;", "paymentsheet_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
    public static final class Companion {
        public Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        private Companion() {
        }

        public final PaymentSheet.FlowController getInstance(ViewModelStoreOwner viewModelStoreOwner, LifecycleOwner lifecycleOwner, ActivityResultRegistryOwner activityResultRegistryOwner, Function0<Integer> statusBarColor, PaymentOptionCallback paymentOptionCallback, PaymentSheetResultCallback paymentResultCallback) {
            Intrinsics.checkNotNullParameter(viewModelStoreOwner, "viewModelStoreOwner");
            Intrinsics.checkNotNullParameter(lifecycleOwner, "lifecycleOwner");
            Intrinsics.checkNotNullParameter(activityResultRegistryOwner, "activityResultRegistryOwner");
            Intrinsics.checkNotNullParameter(statusBarColor, "statusBarColor");
            Intrinsics.checkNotNullParameter(paymentOptionCallback, "paymentOptionCallback");
            Intrinsics.checkNotNullParameter(paymentResultCallback, "paymentResultCallback");
            FlowControllerComponent build = new ViewModelProvider(viewModelStoreOwner).get(FlowControllerViewModel.class).getFlowControllerStateComponent().getFlowControllerComponentBuilder().lifeCycleOwner(lifecycleOwner).activityResultRegistryOwner(activityResultRegistryOwner).statusBarColor(statusBarColor).paymentOptionCallback(paymentOptionCallback).paymentResultCallback(paymentResultCallback).build();
            DefaultFlowController flowController = build.getFlowController();
            flowController.setFlowControllerComponent(build);
            return flowController;
        }
    }
}