正在查看: BodyTech v7.6.4 应用的 CustomerSheetViewModel.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: BodyTech v7.6.4 应用的 CustomerSheetViewModel.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.stripe.android.customersheet;
import android.app.Application;
import android.content.res.Resources;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultCaller;
import androidx.activity.result.ActivityResultLauncher;
import androidx.compose.runtime.internal.StabilityInferred;
import androidx.compose.ui.input.pointer.AddPaymentMethodKt;
import androidx.compose.ui.input.pointer.PrimaryButton;
import androidx.compose.ui.input.pointer.b;
import androidx.compose.ui.input.pointer.e;
import androidx.lifecycle.DefaultLifecycleObserver;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelKt;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.viewmodel.CreationExtras;
import com.stripe.android.cards.DefaultCardAccountRangeRepositoryFactory;
import com.stripe.android.customersheet.analytics.CustomerSheetEventReporter;
import com.stripe.android.customersheet.g;
import com.stripe.android.customersheet.i;
import com.stripe.android.customersheet.injection.w;
import com.stripe.android.customersheet.n;
import com.stripe.android.model.ConfirmSetupIntentParams;
import com.stripe.android.model.PaymentMethod;
import com.stripe.android.model.PaymentMethodCreateParams;
import com.stripe.android.model.SetupIntent;
import com.stripe.android.model.StripeIntent;
import com.stripe.android.o;
import com.stripe.android.payments.paymentlauncher.PaymentLauncherUtilsKt;
import com.stripe.android.payments.paymentlauncher.c;
import com.stripe.android.payments.paymentlauncher.e;
import com.stripe.android.paymentsheet.forms.FormFieldValues;
import com.stripe.android.paymentsheet.i0;
import com.stripe.android.paymentsheet.model.PaymentSelection;
import com.stripe.android.paymentsheet.paymentdatacollection.ach.USBankAccountFormArguments;
import com.stripe.android.paymentsheet.v;
import com.stripe.android.uicore.utils.StateFlowsKt;
import di.e;
import hi.FormArguments;
import io.ktor.http.LinkHeader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import kotlin.Function;
import kotlin.Metadata;
import kotlin.Result;
import kotlin.Unit;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.collections.p;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.r;
import kotlin.reflect.KClass;
import kotlinx.coroutines.BuildersKt__Builders_commonKt;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.Deferred;
import kotlinx.coroutines.flow.MutableStateFlow;
import kotlinx.coroutines.flow.StateFlow;
import kotlinx.coroutines.flow.StateFlowKt;
import kotlinx.coroutines.internal.LockFreeTaskQueueCore;
import kotlinx.coroutines.scheduling.WorkQueueKt;
import qi.a;
import xh.SupportedPaymentMethod;
import yh.PaymentMethodMetadata;
import yh.d;
@StabilityInferred(parameters = 0)
@Metadata(d1 = {"\u0000¢\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000e\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0003\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\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\u0006\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010!\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\b\b\u0001\u0018\u00002\u00020\u0001:\u0001vB×\u0001\u0012\u0006\u0010x\u001a\u00020u\u0012\r\u0010è\u0001\u001a\b\u0012\u0004\u0012\u00020c0\b\u0012\b\u0010{\u001a\u0004\u0018\u00010\u000b\u0012\r\u0010\u0080\u0001\u001a\b\u0012\u0004\u0012\u00020}0|\u0012\u000e\u0010\u0084\u0001\u001a\t\u0012\u0004\u0012\u00020g0\u0081\u0001\u0012\b\u0010\u0088\u0001\u001a\u00030\u0085\u0001\u0012\b\u0010\u008c\u0001\u001a\u00030\u0089\u0001\u0012\b\u0010\u0090\u0001\u001a\u00030\u008d\u0001\u0012\b\u0010\u0094\u0001\u001a\u00030\u0091\u0001\u0012\n\u0010\u0098\u0001\u001a\u0005\u0018\u00010\u0095\u0001\u0012\b\u0010\u009c\u0001\u001a\u00030\u0099\u0001\u0012\n\b\u0002\u0010 \u0001\u001a\u00030\u009d\u0001\u0012\u0010\b\u0001\u0010¤\u0001\u001a\t\u0012\u0004\u0012\u00020/0¡\u0001\u0012\b\u0010¨\u0001\u001a\u00030¥\u0001\u0012\b\u0010¬\u0001\u001a\u00030©\u0001\u0012\b\u0010°\u0001\u001a\u00030\u00ad\u0001\u0012\b\u0010´\u0001\u001a\u00030±\u0001\u0012\b\u0010¸\u0001\u001a\u00030µ\u0001¢\u0006\u0006\bé\u0001\u0010ê\u0001BÉ\u0001\b\u0017\u0012\u0006\u0010x\u001a\u00020u\u0012\r\u0010è\u0001\u001a\b\u0012\u0004\u0012\u00020c0\b\u0012\b\u0010{\u001a\u0004\u0018\u00010\u000b\u0012\r\u0010\u0080\u0001\u001a\b\u0012\u0004\u0012\u00020}0|\u0012\b\u0010\u0088\u0001\u001a\u00030\u0085\u0001\u0012\b\u0010\u008c\u0001\u001a\u00030\u0089\u0001\u0012\b\u0010\u0090\u0001\u001a\u00030\u008d\u0001\u0012\b\u0010\u0094\u0001\u001a\u00030\u0091\u0001\u0012\n\u0010\u0098\u0001\u001a\u0005\u0018\u00010\u0095\u0001\u0012\b\u0010\u009c\u0001\u001a\u00030\u0099\u0001\u0012\n\b\u0002\u0010 \u0001\u001a\u00030\u009d\u0001\u0012\u0010\b\u0001\u0010¤\u0001\u001a\t\u0012\u0004\u0012\u00020/0¡\u0001\u0012\b\u0010¨\u0001\u001a\u00030¥\u0001\u0012\b\u0010¬\u0001\u001a\u00030©\u0001\u0012\b\u0010°\u0001\u001a\u00030\u00ad\u0001\u0012\b\u0010´\u0001\u001a\u00030±\u0001\u0012\b\u0010¸\u0001\u001a\u00030µ\u0001¢\u0006\u0006\bé\u0001\u0010ë\u0001J\u0010\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H\u0002J\u0010\u0010\u0006\u001a\u00020\u0004H\u0082@¢\u0006\u0004\b\u0006\u0010\u0007J(\u0010\u000f\u001a\u00020\u00042\f\u0010\n\u001a\b\u0012\u0004\u0012\u00020\t0\b2\b\u0010\f\u001a\u0004\u0018\u00010\u000b2\u0006\u0010\u000e\u001a\u00020\rH\u0002J\b\u0010\u0010\u001a\u00020\u0004H\u0002J\b\u0010\u0011\u001a\u00020\u0004H\u0002J\b\u0010\u0012\u001a\u00020\u0004H\u0002J\b\u0010\u0013\u001a\u00020\u0004H\u0002J\u0010\u0010\u0016\u001a\u00020\u00042\u0006\u0010\u0015\u001a\u00020\u0014H\u0002J\u0012\u0010\u0019\u001a\u00020\u00042\b\u0010\u0018\u001a\u0004\u0018\u00010\u0017H\u0002J\u0010\u0010\u001a\u001a\u00020\u00042\u0006\u0010\u0015\u001a\u00020\tH\u0002J\u001e\u0010\u001c\u001a\b\u0012\u0004\u0012\u00020\t0\u001b2\u0006\u0010\u0015\u001a\u00020\tH\u0082@¢\u0006\u0004\b\u001c\u0010\u001dJ&\u0010 \u001a\b\u0012\u0004\u0012\u00020\t0\u001b2\u0006\u0010\u0015\u001a\u00020\t2\u0006\u0010\u001f\u001a\u00020\u001eH\u0082@¢\u0006\u0004\b \u0010!J\u0010\u0010\"\u001a\u00020\u00042\u0006\u0010\u0015\u001a\u00020\tH\u0002J\u0012\u0010%\u001a\u00020\u00042\b\u0010$\u001a\u0004\u0018\u00010#H\u0002J\u0010\u0010&\u001a\u00020\u00042\u0006\u0010\u0015\u001a\u00020\tH\u0002J\u0010\u0010'\u001a\u00020\u00042\u0006\u0010\u0015\u001a\u00020\tH\u0002J\u0010\u0010)\u001a\u00020\u00042\u0006\u0010(\u001a\u00020\tH\u0002J\u0012\u0010*\u001a\u00020\u00042\b\u0010\f\u001a\u0004\u0018\u00010\u000bH\u0002J\b\u0010+\u001a\u00020\u0004H\u0002J\u0010\u0010.\u001a\u00020\u00042\u0006\u0010-\u001a\u00020,H\u0002J\u001a\u00101\u001a\u00020\u00042\u0006\u00100\u001a\u00020/2\b\b\u0002\u0010\u000e\u001a\u00020\rH\u0002J \u00105\u001a\u00020\u00042\u0016\u00104\u001a\u0012\u0012\u0006\u0012\u0004\u0018\u000103\u0012\u0006\u0012\u0004\u0018\u00010302H\u0002J\u001a\u00108\u001a\u00020\u00042\b\u00106\u001a\u0004\u0018\u00010#2\u0006\u00107\u001a\u00020/H\u0002J\u0010\u0010;\u001a\u00020\u00042\u0006\u0010:\u001a\u000209H\u0002J\u0010\u0010>\u001a\u00020\u00042\u0006\u0010=\u001a\u00020<H\u0002J\b\u0010?\u001a\u00020\u0004H\u0002J\u0012\u0010A\u001a\u00020\u00042\b\u0010@\u001a\u0004\u0018\u00010#H\u0002J\b\u0010B\u001a\u00020\u0004H\u0002J$\u0010E\u001a\b\u0012\u0004\u0012\u00020\t0D2\u0006\u0010C\u001a\u00020,H\u0082@ø\u0001\u0000ø\u0001\u0001¢\u0006\u0004\bE\u0010FJ\u0010\u0010G\u001a\u00020\u00042\u0006\u0010\u0015\u001a\u00020\tH\u0002J\u0018\u0010H\u001a\u00020\u00042\u0006\u0010\u0015\u001a\u00020\tH\u0082@¢\u0006\u0004\bH\u0010\u001dJ4\u0010L\u001a\b\u0012\u0004\u0012\u00020\u00040D2\u0006\u0010J\u001a\u00020I2\u0006\u0010K\u001a\u00020#2\u0006\u0010\u0015\u001a\u00020\tH\u0082@ø\u0001\u0000ø\u0001\u0001¢\u0006\u0004\bL\u0010MJ\u0010\u0010P\u001a\u00020\u00042\u0006\u0010O\u001a\u00020NH\u0002J\u0018\u0010Q\u001a\u00020\u00042\u0006\u0010K\u001a\u00020#2\u0006\u0010J\u001a\u00020IH\u0002J\u0018\u0010S\u001a\u00020\u00042\u0006\u0010R\u001a\u00020#H\u0082@¢\u0006\u0004\bS\u0010TJ\u0012\u0010W\u001a\u00020\u00042\b\u0010V\u001a\u0004\u0018\u00010UH\u0002J\b\u0010X\u001a\u00020\u0004H\u0002J\u001c\u0010Z\u001a\u00020\u00042\b\u0010\f\u001a\u0004\u0018\u00010\u000b2\b\u0010Y\u001a\u0004\u0018\u00010#H\u0002J.\u0010]\u001a\u00020\u00042\b\u0010\f\u001a\u0004\u0018\u00010\u000b2\b\u0010Y\u001a\u0004\u0018\u00010#2\u0006\u0010\\\u001a\u00020[2\b\u0010$\u001a\u0004\u0018\u00010#H\u0002J\u001c\u0010`\u001a\u00020\u00042\u0012\u0010_\u001a\u000e\u0012\u0004\u0012\u00020^\u0012\u0004\u0012\u00020^02H\u0002J\u001c\u0010b\u001a\u00020^2\u0012\u0010a\u001a\u000e\u0012\u0004\u0012\u00020^\u0012\u0004\u0012\u00020^02H\u0002J\u001a\u0010f\u001a\u00020\u00042\u0006\u0010d\u001a\u00020c2\b\b\u0002\u0010e\u001a\u00020/H\u0002J\u0010\u0010h\u001a\u00020gH\u0082@¢\u0006\u0004\bh\u0010\u0007J\u000e\u0010k\u001a\u00020\u00042\u0006\u0010j\u001a\u00020iJ\u0006\u0010l\u001a\u00020/J\u0016\u0010o\u001a\u00020#2\u000e\u0010n\u001a\n\u0018\u00010#j\u0004\u0018\u0001`mJ\u0016\u0010t\u001a\u00020\u00042\u0006\u0010q\u001a\u00020p2\u0006\u0010s\u001a\u00020rR\u0014\u0010x\u001a\u00020u8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bv\u0010wR\u0018\u0010{\u001a\u0004\u0018\u00010\u000b8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\by\u0010zR\u001b\u0010\u0080\u0001\u001a\b\u0012\u0004\u0012\u00020}0|8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b~\u0010\u007fR\u001e\u0010\u0084\u0001\u001a\t\u0012\u0004\u0012\u00020g0\u0081\u00018\u0002X\u0082\u0004¢\u0006\b\n\u0006\b\u0082\u0001\u0010\u0083\u0001R\u0018\u0010\u0088\u0001\u001a\u00030\u0085\u00018\u0002X\u0082\u0004¢\u0006\b\n\u0006\b\u0086\u0001\u0010\u0087\u0001R\u0018\u0010\u008c\u0001\u001a\u00030\u0089\u00018\u0002X\u0082\u0004¢\u0006\b\n\u0006\b\u008a\u0001\u0010\u008b\u0001R\u0018\u0010\u0090\u0001\u001a\u00030\u008d\u00018\u0002X\u0082\u0004¢\u0006\b\n\u0006\b\u008e\u0001\u0010\u008f\u0001R\u0018\u0010\u0094\u0001\u001a\u00030\u0091\u00018\u0002X\u0082\u0004¢\u0006\b\n\u0006\b\u0092\u0001\u0010\u0093\u0001R\u001a\u0010\u0098\u0001\u001a\u0005\u0018\u00010\u0095\u00018\u0002X\u0082\u0004¢\u0006\b\n\u0006\b\u0096\u0001\u0010\u0097\u0001R\u0018\u0010\u009c\u0001\u001a\u00030\u0099\u00018\u0002X\u0082\u0004¢\u0006\b\n\u0006\b\u009a\u0001\u0010\u009b\u0001R\u0018\u0010 \u0001\u001a\u00030\u009d\u00018\u0002X\u0082\u0004¢\u0006\b\n\u0006\b\u009e\u0001\u0010\u009f\u0001R\u001e\u0010¤\u0001\u001a\t\u0012\u0004\u0012\u00020/0¡\u00018\u0002X\u0082\u0004¢\u0006\b\n\u0006\b¢\u0001\u0010£\u0001R\u0018\u0010¨\u0001\u001a\u00030¥\u00018\u0002X\u0082\u0004¢\u0006\b\n\u0006\b¦\u0001\u0010§\u0001R\u0018\u0010¬\u0001\u001a\u00030©\u00018\u0002X\u0082\u0004¢\u0006\b\n\u0006\bª\u0001\u0010«\u0001R\u0018\u0010°\u0001\u001a\u00030\u00ad\u00018\u0002X\u0082\u0004¢\u0006\b\n\u0006\b®\u0001\u0010¯\u0001R\u0018\u0010´\u0001\u001a\u00030±\u00018\u0002X\u0082\u0004¢\u0006\b\n\u0006\b²\u0001\u0010³\u0001R\u0018\u0010¸\u0001\u001a\u00030µ\u00018\u0002X\u0082\u0004¢\u0006\b\n\u0006\b¶\u0001\u0010·\u0001R\u0018\u0010¼\u0001\u001a\u00030¹\u00018\u0002X\u0082\u0004¢\u0006\b\n\u0006\bº\u0001\u0010»\u0001R$\u0010À\u0001\u001a\u000f\u0012\n\u0012\b\u0012\u0004\u0012\u00020c0\b0½\u00018\u0002X\u0082\u0004¢\u0006\b\n\u0006\b¾\u0001\u0010¿\u0001R#\u0010Æ\u0001\u001a\t\u0012\u0004\u0012\u00020c0Á\u00018\u0006¢\u0006\u0010\n\u0006\bÂ\u0001\u0010Ã\u0001\u001a\u0006\bÄ\u0001\u0010Å\u0001R!\u0010É\u0001\u001a\f\u0012\u0007\u0012\u0005\u0018\u00010Ç\u00010½\u00018\u0002X\u0082\u0004¢\u0006\b\n\u0006\bÈ\u0001\u0010¿\u0001R%\u0010\u0003\u001a\f\u0012\u0007\u0012\u0005\u0018\u00010Ç\u00010Á\u00018\u0006¢\u0006\u0010\n\u0006\bÊ\u0001\u0010Ã\u0001\u001a\u0006\bË\u0001\u0010Å\u0001R\u0018\u0010Í\u0001\u001a\u00020/8\u0002@\u0002X\u0082\u000e¢\u0006\u0007\n\u0005\bÌ\u0001\u0010\u0016R\u001c\u0010Ñ\u0001\u001a\u0005\u0018\u00010Î\u00018\u0002@\u0002X\u0082\u000e¢\u0006\b\n\u0006\bÏ\u0001\u0010Ð\u0001R\u001b\u0010Ô\u0001\u001a\u0004\u0018\u00010\u00148\u0002@\u0002X\u0082\u000e¢\u0006\b\n\u0006\bÒ\u0001\u0010Ó\u0001R\u001b\u0010×\u0001\u001a\u0004\u0018\u00010\t8\u0002@\u0002X\u0082\u000e¢\u0006\b\n\u0006\bÕ\u0001\u0010Ö\u0001R,\u0010ß\u0001\u001a\u0005\u0018\u00010Ø\u00018\u0006@\u0006X\u0086\u000e¢\u0006\u0018\n\u0006\bÙ\u0001\u0010Ú\u0001\u001a\u0006\bÛ\u0001\u0010Ü\u0001\"\u0006\bÝ\u0001\u0010Þ\u0001R \u0010ã\u0001\u001a\t\u0012\u0004\u0012\u00020\u00140à\u00018\u0002@\u0002X\u0082\u000e¢\u0006\b\n\u0006\bá\u0001\u0010â\u0001R\u001e\u0010ç\u0001\u001a\u0005\u0018\u00010ä\u0001*\u00020c8BX\u0082\u0004¢\u0006\b\u001a\u0006\bå\u0001\u0010æ\u0001\u0082\u0002\u000b\n\u0002\b!\n\u0005\b¡\u001e0\u0001¨\u0006ì\u0001"}, d2 = {"Lcom/stripe/android/customersheet/CustomerSheetViewModel;", "Landroidx/lifecycle/ViewModel;", "Lcom/stripe/android/payments/paymentlauncher/e;", "result", "", "m0", "W", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "", "Lcom/stripe/android/model/PaymentMethod;", "paymentMethods", "Lcom/stripe/android/paymentsheet/model/PaymentSelection;", "paymentSelection", "Lqi/a;", "cbcEligibility", "z0", "Y", "f0", "a0", "g0", "Lxh/f;", "paymentMethod", "Z", "Lcom/stripe/android/paymentsheet/forms/b;", "formFieldValues", "i0", "j0", "Lcom/stripe/android/customersheet/a$b;", "q0", "(Lcom/stripe/android/model/PaymentMethod;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "Lcom/stripe/android/model/CardBrand;", "brand", "X", "(Lcom/stripe/android/model/PaymentMethod;Lcom/stripe/android/model/CardBrand;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "T", "", "displayMessage", "R", "l0", "r0", "updatedMethod", "C0", "k0", "n0", "Lcom/stripe/android/model/PaymentMethodCreateParams;", "paymentMethodCreateParams", "M", "", "isFirstPaymentMethod", "x0", "Lkotlin/Function1;", "Lcom/stripe/android/paymentsheet/ui/PrimaryButton$UIState;", "callback", "A0", "mandateText", "showAbove", "B0", "Ldi/e;", "bankAccountResult", "d0", "Lcom/stripe/android/paymentsheet/model/PaymentSelection$d$d;", "usBankAccount", "e0", "c0", "error", "h0", "b0", "createParams", "Lkotlin/Result;", "N", "(Lcom/stripe/android/model/PaymentMethodCreateParams;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "E", "F", "Lcom/stripe/android/model/StripeIntent;", "stripeIntent", "clientSecret", "U", "(Lcom/stripe/android/model/StripeIntent;Ljava/lang/String;Lcom/stripe/android/model/PaymentMethod;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "Lai/d;", "confirmStripeIntentParams", "L", "S", "id", "D", "(Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "Lcom/stripe/android/paymentsheet/model/PaymentSelection$Saved;", "savedPaymentSelection", "u0", "t0", LinkHeader.Parameters.Type, "J", "", "cause", "K", "Lcom/stripe/android/customersheet/i$d;", "update", "s0", "override", "I", "Lcom/stripe/android/customersheet/i;", "to", "reset", "v0", "Lcom/stripe/android/customersheet/a;", "G", "Lcom/stripe/android/customersheet/g;", "viewAction", "V", "H", "Lcom/stripe/android/model/PaymentMethodCode;", "code", "o0", "Landroidx/activity/result/ActivityResultCaller;", "activityResultCaller", "Landroidx/lifecycle/LifecycleOwner;", "lifecycleOwner", "p0", "Landroid/app/Application;", "a", "Landroid/app/Application;", "application", "b", "Lcom/stripe/android/paymentsheet/model/PaymentSelection;", "originalPaymentSelection", "Lfj/a;", "Lcom/stripe/android/o;", "c", "Lfj/a;", "paymentConfigurationProvider", "Lkotlinx/coroutines/Deferred;", "d", "Lkotlinx/coroutines/Deferred;", "customerAdapterProvider", "Landroid/content/res/Resources;", "e", "Landroid/content/res/Resources;", "resources", "Lcom/stripe/android/customersheet/c;", "f", "Lcom/stripe/android/customersheet/c;", "configuration", "Llh/d;", "g", "Llh/d;", "logger", "Lcom/stripe/android/networking/m;", "h", "Lcom/stripe/android/networking/m;", "stripeRepository", "", "i", "Ljava/lang/Integer;", "statusBarColor", "Lcom/stripe/android/customersheet/analytics/CustomerSheetEventReporter;", "j", "Lcom/stripe/android/customersheet/analytics/CustomerSheetEventReporter;", "eventReporter", "Lkotlin/coroutines/CoroutineContext;", "k", "Lkotlin/coroutines/CoroutineContext;", "workContext", "Lkotlin/Function0;", "l", "Lkotlin/jvm/functions/Function0;", "isLiveModeProvider", "Lcom/stripe/android/payments/paymentlauncher/g;", "m", "Lcom/stripe/android/payments/paymentlauncher/g;", "paymentLauncherFactory", "Lcom/stripe/android/paymentsheet/n;", "n", "Lcom/stripe/android/paymentsheet/n;", "intentConfirmationInterceptor", "Lcom/stripe/android/customersheet/e;", "o", "Lcom/stripe/android/customersheet/e;", "customerSheetLoader", "Lcom/stripe/android/payments/financialconnections/c;", "p", "Lcom/stripe/android/payments/financialconnections/c;", "isFinancialConnectionsAvailable", "Lcom/stripe/android/paymentsheet/ui/e$a;", "q", "Lcom/stripe/android/paymentsheet/ui/e$a;", "editInteractorFactory", "Lcom/stripe/android/cards/DefaultCardAccountRangeRepositoryFactory;", "r", "Lcom/stripe/android/cards/DefaultCardAccountRangeRepositoryFactory;", "cardAccountRangeRepositoryFactory", "Lkotlinx/coroutines/flow/MutableStateFlow;", "s", "Lkotlinx/coroutines/flow/MutableStateFlow;", "backStack", "Lkotlinx/coroutines/flow/StateFlow;", "t", "Lkotlinx/coroutines/flow/StateFlow;", "Q", "()Lkotlinx/coroutines/flow/StateFlow;", "viewState", "Lcom/stripe/android/customersheet/n;", "u", "_result", "v", "P", "w", "isGooglePayReadyAndEnabled", "Lcom/stripe/android/payments/paymentlauncher/b;", "x", "Lcom/stripe/android/payments/paymentlauncher/b;", "paymentLauncher", "y", "Lxh/f;", "previouslySelectedPaymentMethod", "z", "Lcom/stripe/android/model/PaymentMethod;", "unconfirmedPaymentMethod", "Lyh/c;", "A", "Lyh/c;", "getPaymentMethodMetadata", "()Lyh/c;", "setPaymentMethodMetadata", "(Lyh/c;)V", "paymentMethodMetadata", "", "B", "Ljava/util/List;", "supportedPaymentMethods", "Lcom/stripe/android/customersheet/analytics/CustomerSheetEventReporter$Screen;", "O", "(Lcom/stripe/android/customersheet/i;)Lcom/stripe/android/customersheet/analytics/CustomerSheetEventReporter$Screen;", "eventReporterScreen", "initialBackStack", "<init>", "(Landroid/app/Application;Ljava/util/List;Lcom/stripe/android/paymentsheet/model/PaymentSelection;Lfj/a;Lkotlinx/coroutines/Deferred;Landroid/content/res/Resources;Lcom/stripe/android/customersheet/c;Llh/d;Lcom/stripe/android/networking/m;Ljava/lang/Integer;Lcom/stripe/android/customersheet/analytics/CustomerSheetEventReporter;Lkotlin/coroutines/CoroutineContext;Lkotlin/jvm/functions/Function0;Lcom/stripe/android/payments/paymentlauncher/g;Lcom/stripe/android/paymentsheet/n;Lcom/stripe/android/customersheet/e;Lcom/stripe/android/payments/financialconnections/c;Lcom/stripe/android/paymentsheet/ui/e$a;)V", "(Landroid/app/Application;Ljava/util/List;Lcom/stripe/android/paymentsheet/model/PaymentSelection;Lfj/a;Landroid/content/res/Resources;Lcom/stripe/android/customersheet/c;Llh/d;Lcom/stripe/android/networking/m;Ljava/lang/Integer;Lcom/stripe/android/customersheet/analytics/CustomerSheetEventReporter;Lkotlin/coroutines/CoroutineContext;Lkotlin/jvm/functions/Function0;Lcom/stripe/android/payments/paymentlauncher/g;Lcom/stripe/android/paymentsheet/n;Lcom/stripe/android/customersheet/e;Lcom/stripe/android/payments/financialconnections/c;Lcom/stripe/android/paymentsheet/ui/e$a;)V", "paymentsheet_release"}, k = 1, mv = {1, 9, 0})
public final class CustomerSheetViewModel extends ViewModel {
private PaymentMethodMetadata paymentMethodMetadata;
private List<SupportedPaymentMethod> supportedPaymentMethods;
private final Application application;
private PaymentSelection originalPaymentSelection;
private final fj.a<o> paymentConfigurationProvider;
private final Deferred<com.stripe.android.customersheet.a> customerAdapterProvider;
private final Resources resources;
private final Configuration configuration;
private final lh.d logger;
private final com.stripe.android.networking.m stripeRepository;
private final Integer statusBarColor;
private final CustomerSheetEventReporter eventReporter;
private final CoroutineContext workContext;
private final Function0<Boolean> isLiveModeProvider;
private final com.stripe.android.payments.paymentlauncher.g paymentLauncherFactory;
private final com.stripe.android.paymentsheet.n intentConfirmationInterceptor;
private final e customerSheetLoader;
private final com.stripe.android.payments.financialconnections.c isFinancialConnectionsAvailable;
private final e.a editInteractorFactory;
private final DefaultCardAccountRangeRepositoryFactory cardAccountRangeRepositoryFactory;
private final MutableStateFlow<List<i>> backStack;
private final StateFlow<i> viewState;
private final MutableStateFlow<n> _result;
private final StateFlow<n> result;
private boolean isGooglePayReadyAndEnabled;
private com.stripe.android.payments.paymentlauncher.b paymentLauncher;
private SupportedPaymentMethod previouslySelectedPaymentMethod;
private PaymentMethod unconfirmedPaymentMethod;
@Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0000\u0010\u0002\u001a\u00020\u0001*\u00020\u0000H\u008a@"}, d2 = {"Lkotlinx/coroutines/CoroutineScope;", "", "<anonymous>"}, k = WorkQueueKt.STEAL_ANY, mv = {1, 9, 0})
@kotlin.coroutines.jvm.internal.c(c = "com.stripe.android.customersheet.CustomerSheetViewModel$1", f = "CustomerSheetViewModel.kt", l = {161}, m = "invokeSuspend")
static final class AnonymousClass1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
int label;
AnonymousClass1(Continuation<? super AnonymousClass1> continuation) {
super(2, continuation);
}
@Override
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
return CustomerSheetViewModel.this.new AnonymousClass1(continuation);
}
@Override
public final Object invokeSuspend(Object obj) {
Object f;
f = kotlin.coroutines.intrinsics.b.f();
int i = this.label;
if (i == 0) {
kotlin.f.b(obj);
CustomerSheetViewModel customerSheetViewModel = CustomerSheetViewModel.this;
this.label = 1;
if (customerSheetViewModel.W(this) == f) {
return f;
}
} else {
if (i != 1) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
kotlin.f.b(obj);
}
return Unit.a;
}
@Override
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
return ((AnonymousClass1) create(coroutineScope, continuation)).invokeSuspend(Unit.a);
}
}
@StabilityInferred(parameters = 0)
@Metadata(d1 = {"\u0000$\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\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0006\b\u0007\u0018\u00002\u00020\u0001B\u000f\u0012\u0006\u0010\r\u001a\u00020\n¢\u0006\u0004\b\u000e\u0010\u000fJ/\u0010\b\u001a\u00028\u0000\"\b\b\u0000\u0010\u0003*\u00020\u00022\f\u0010\u0005\u001a\b\u0012\u0004\u0012\u00028\u00000\u00042\u0006\u0010\u0007\u001a\u00020\u0006H\u0016¢\u0006\u0004\b\b\u0010\tR\u0014\u0010\r\u001a\u00020\n8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u000b\u0010\f¨\u0006\u0010"}, d2 = {"Lcom/stripe/android/customersheet/CustomerSheetViewModel$a;", "Landroidx/lifecycle/ViewModelProvider$Factory;", "Landroidx/lifecycle/ViewModel;", "T", "Ljava/lang/Class;", "modelClass", "Landroidx/lifecycle/viewmodel/CreationExtras;", "extras", "create", "(Ljava/lang/Class;Landroidx/lifecycle/viewmodel/CreationExtras;)Landroidx/lifecycle/ViewModel;", "Lcom/stripe/android/customersheet/d;", "a", "Lcom/stripe/android/customersheet/d;", "args", "<init>", "(Lcom/stripe/android/customersheet/d;)V", "paymentsheet_release"}, k = 1, mv = {1, 9, 0})
public static final class a implements ViewModelProvider.Factory {
public static final int b = Args.k;
private final Args args;
public a(Args args) {
r.i(args, "args");
this.args = args;
}
public ViewModel create(Class cls) {
return androidx.lifecycle.n.a(this, cls);
}
public ViewModel create(KClass kClass, CreationExtras creationExtras) {
return androidx.lifecycle.n.c(this, kClass, creationExtras);
}
public <T extends ViewModel> T create(Class<T> modelClass, CreationExtras extras) {
r.i(modelClass, "modelClass");
r.i(extras, "extras");
CustomerSheetViewModel a = w.a().b(sh.b.a(extras)).c(this.args.getConfiguration()).d(this.args.getStatusBarColor()).build().a();
r.g(a, "null cannot be cast to non-null type T of com.stripe.android.customersheet.CustomerSheetViewModel.Factory.create");
return a;
}
}
@Metadata(d1 = {"\u0000\u0017\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0010\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H\u0016¨\u0006\u0006"}, d2 = {"com/stripe/android/customersheet/CustomerSheetViewModel$b", "Landroidx/lifecycle/DefaultLifecycleObserver;", "Landroidx/lifecycle/LifecycleOwner;", "owner", "", "onDestroy", "paymentsheet_release"}, k = 1, mv = {1, 9, 0})
public static final class b implements DefaultLifecycleObserver {
final ActivityResultLauncher<c.a> c;
final CustomerSheetViewModel d;
b(ActivityResultLauncher<c.a> activityResultLauncher, CustomerSheetViewModel customerSheetViewModel) {
this.c = activityResultLauncher;
this.d = customerSheetViewModel;
}
public void onCreate(LifecycleOwner lifecycleOwner) {
androidx.lifecycle.c.a(this, lifecycleOwner);
}
public void onDestroy(LifecycleOwner owner) {
r.i(owner, "owner");
this.c.unregister();
this.d.paymentLauncher = null;
androidx.lifecycle.c.b(this, owner);
}
public void onPause(LifecycleOwner lifecycleOwner) {
androidx.lifecycle.c.c(this, lifecycleOwner);
}
public void onResume(LifecycleOwner lifecycleOwner) {
androidx.lifecycle.c.d(this, lifecycleOwner);
}
public void onStart(LifecycleOwner lifecycleOwner) {
androidx.lifecycle.c.e(this, lifecycleOwner);
}
public void onStop(LifecycleOwner lifecycleOwner) {
androidx.lifecycle.c.f(this, lifecycleOwner);
}
}
@Metadata(k = WorkQueueKt.STEAL_ANY, mv = {1, 9, 0}, xi = 48)
static final class c implements ActivityResultCallback, kotlin.jvm.internal.o {
private final Function1 c;
c(Function1 function) {
r.i(function, "function");
this.c = function;
}
public final boolean equals(Object obj) {
if ((obj instanceof ActivityResultCallback) && (obj instanceof kotlin.jvm.internal.o)) {
return r.d(getFunctionDelegate(), ((kotlin.jvm.internal.o) obj).getFunctionDelegate());
}
return false;
}
@Override
public final Function<?> getFunctionDelegate() {
return this.c;
}
public final int hashCode() {
return getFunctionDelegate().hashCode();
}
public final void onActivityResult(Object obj) {
this.c.invoke(obj);
}
}
public CustomerSheetViewModel(Application application, List<i> initialBackStack, PaymentSelection paymentSelection, fj.a<o> paymentConfigurationProvider, Deferred<? extends com.stripe.android.customersheet.a> customerAdapterProvider, Resources resources, Configuration configuration, lh.d logger, com.stripe.android.networking.m stripeRepository, Integer num, CustomerSheetEventReporter eventReporter, CoroutineContext workContext, Function0<Boolean> isLiveModeProvider, com.stripe.android.payments.paymentlauncher.g paymentLauncherFactory, com.stripe.android.paymentsheet.n intentConfirmationInterceptor, e customerSheetLoader, com.stripe.android.payments.financialconnections.c isFinancialConnectionsAvailable, e.a editInteractorFactory) {
r.i(application, "application");
r.i(initialBackStack, "initialBackStack");
r.i(paymentConfigurationProvider, "paymentConfigurationProvider");
r.i(customerAdapterProvider, "customerAdapterProvider");
r.i(resources, "resources");
r.i(configuration, "configuration");
r.i(logger, "logger");
r.i(stripeRepository, "stripeRepository");
r.i(eventReporter, "eventReporter");
r.i(workContext, "workContext");
r.i(isLiveModeProvider, "isLiveModeProvider");
r.i(paymentLauncherFactory, "paymentLauncherFactory");
r.i(intentConfirmationInterceptor, "intentConfirmationInterceptor");
r.i(customerSheetLoader, "customerSheetLoader");
r.i(isFinancialConnectionsAvailable, "isFinancialConnectionsAvailable");
r.i(editInteractorFactory, "editInteractorFactory");
this.application = application;
this.originalPaymentSelection = paymentSelection;
this.paymentConfigurationProvider = paymentConfigurationProvider;
this.customerAdapterProvider = customerAdapterProvider;
this.resources = resources;
this.configuration = configuration;
this.logger = logger;
this.stripeRepository = stripeRepository;
this.statusBarColor = num;
this.eventReporter = eventReporter;
this.workContext = workContext;
this.isLiveModeProvider = isLiveModeProvider;
this.paymentLauncherFactory = paymentLauncherFactory;
this.intentConfirmationInterceptor = intentConfirmationInterceptor;
this.customerSheetLoader = customerSheetLoader;
this.isFinancialConnectionsAvailable = isFinancialConnectionsAvailable;
this.editInteractorFactory = editInteractorFactory;
this.cardAccountRangeRepositoryFactory = new DefaultCardAccountRangeRepositoryFactory(application);
MutableStateFlow<List<i>> MutableStateFlow = StateFlowKt.MutableStateFlow(initialBackStack);
this.backStack = MutableStateFlow;
StateFlow<i> m = StateFlowsKt.m(MutableStateFlow, new Function1<List<i>, i>() {
@Override
public final i invoke(List<i> it) {
r.i(it, "it");
return (i) CollectionsKt___CollectionsKt.F0(it);
}
});
this.viewState = m;
MutableStateFlow<n> MutableStateFlow2 = StateFlowKt.MutableStateFlow(null);
this._result = MutableStateFlow2;
this.result = MutableStateFlow2;
this.supportedPaymentMethods = new ArrayList();
v.a(configuration.getAppearance());
eventReporter.l(configuration);
if (m.getValue() instanceof i.Loading) {
BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), workContext, null, new AnonymousClass1(null), 2, null);
}
}
private final void A0(Function1<? super PrimaryButton.UIState, PrimaryButton.UIState> callback) {
Object value;
ArrayList arrayList;
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<Object> list = (List) value;
arrayList = new ArrayList(p.y(list, 10));
for (Object obj : list) {
if (obj instanceof i.AddPaymentMethod) {
i.AddPaymentMethod addPaymentMethod = (i.AddPaymentMethod) obj;
PrimaryButton.UIState invoke = callback.invoke(addPaymentMethod.getCustomPrimaryButtonUiState());
obj = invoke != null ? addPaymentMethod.j((r38 & 1) != 0 ? addPaymentMethod.paymentMethodCode : null, (r38 & 2) != 0 ? addPaymentMethod.supportedPaymentMethods : null, (r38 & 4) != 0 ? addPaymentMethod.formFieldValues : null, (r38 & 8) != 0 ? addPaymentMethod.formElements : null, (r38 & 16) != 0 ? addPaymentMethod.formArguments : null, (r38 & 32) != 0 ? addPaymentMethod.usBankAccountFormArguments : null, (r38 & 64) != 0 ? addPaymentMethod.draftPaymentSelection : null, (r38 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? addPaymentMethod.enabled : false, (r38 & 256) != 0 ? addPaymentMethod.isLiveMode : false, (r38 & 512) != 0 ? addPaymentMethod.isProcessing : false, (r38 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? addPaymentMethod.errorMessage : null, (r38 & 2048) != 0 ? addPaymentMethod.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? addPaymentMethod.primaryButtonLabel : null, (r38 & 8192) != 0 ? addPaymentMethod.primaryButtonEnabled : invoke.getEnabled(), (r38 & 16384) != 0 ? addPaymentMethod.customPrimaryButtonUiState : invoke, (r38 & 32768) != 0 ? addPaymentMethod.mandateText : null, (r38 & 65536) != 0 ? addPaymentMethod.showMandateAbovePrimaryButton : false, (r38 & 131072) != 0 ? addPaymentMethod.displayDismissConfirmationModal : false, (r38 & 262144) != 0 ? addPaymentMethod.bankAccountResult : null, (r38 & 524288) != 0 ? addPaymentMethod.cbcEligibility : null) : addPaymentMethod.j((r38 & 1) != 0 ? addPaymentMethod.paymentMethodCode : null, (r38 & 2) != 0 ? addPaymentMethod.supportedPaymentMethods : null, (r38 & 4) != 0 ? addPaymentMethod.formFieldValues : null, (r38 & 8) != 0 ? addPaymentMethod.formElements : null, (r38 & 16) != 0 ? addPaymentMethod.formArguments : null, (r38 & 32) != 0 ? addPaymentMethod.usBankAccountFormArguments : null, (r38 & 64) != 0 ? addPaymentMethod.draftPaymentSelection : null, (r38 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? addPaymentMethod.enabled : false, (r38 & 256) != 0 ? addPaymentMethod.isLiveMode : false, (r38 & 512) != 0 ? addPaymentMethod.isProcessing : false, (r38 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? addPaymentMethod.errorMessage : null, (r38 & 2048) != 0 ? addPaymentMethod.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? addPaymentMethod.primaryButtonLabel : null, (r38 & 8192) != 0 ? addPaymentMethod.primaryButtonEnabled : (addPaymentMethod.getFormFieldValues() == null || addPaymentMethod.getIsProcessing()) ? false : true, (r38 & 16384) != 0 ? addPaymentMethod.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? addPaymentMethod.mandateText : null, (r38 & 65536) != 0 ? addPaymentMethod.showMandateAbovePrimaryButton : false, (r38 & 131072) != 0 ? addPaymentMethod.displayDismissConfirmationModal : false, (r38 & 262144) != 0 ? addPaymentMethod.bankAccountResult : null, (r38 & 524288) != 0 ? addPaymentMethod.cbcEligibility : null);
}
arrayList.add(obj);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
private final void B0(String mandateText, boolean showAbove) {
Object value;
ArrayList arrayList;
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<Object> list = (List) value;
arrayList = new ArrayList(p.y(list, 10));
for (Object obj : list) {
if (obj instanceof i.AddPaymentMethod) {
obj = r6.j((r38 & 1) != 0 ? r6.paymentMethodCode : null, (r38 & 2) != 0 ? r6.supportedPaymentMethods : null, (r38 & 4) != 0 ? r6.formFieldValues : null, (r38 & 8) != 0 ? r6.formElements : null, (r38 & 16) != 0 ? r6.formArguments : null, (r38 & 32) != 0 ? r6.usBankAccountFormArguments : null, (r38 & 64) != 0 ? r6.draftPaymentSelection : null, (r38 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? r6.enabled : false, (r38 & 256) != 0 ? r6.isLiveMode : false, (r38 & 512) != 0 ? r6.isProcessing : false, (r38 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? r6.errorMessage : null, (r38 & 2048) != 0 ? r6.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? r6.primaryButtonLabel : null, (r38 & 8192) != 0 ? r6.primaryButtonEnabled : false, (r38 & 16384) != 0 ? r6.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? r6.mandateText : mandateText, (r38 & 65536) != 0 ? r6.showMandateAbovePrimaryButton : showAbove, (r38 & 131072) != 0 ? r6.displayDismissConfirmationModal : false, (r38 & 262144) != 0 ? r6.bankAccountResult : null, (r38 & 524288) != 0 ? ((i.AddPaymentMethod) obj).cbcEligibility : null);
}
arrayList.add(obj);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
private final void C0(PaymentMethod updatedMethod) {
BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), null, null, new CustomerSheetViewModel$updatePaymentMethodInState$1(this, updatedMethod, null), 3, null);
}
public final java.lang.Object D(java.lang.String r32, kotlin.coroutines.Continuation<? super kotlin.Unit> r33) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.customersheet.CustomerSheetViewModel.D(java.lang.String, kotlin.coroutines.Continuation):java.lang.Object");
}
public final void E(PaymentMethod paymentMethod) {
BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), this.workContext, null, new CustomerSheetViewModel$attachPaymentMethodToCustomer$1(this, paymentMethod, null), 2, null);
}
public final java.lang.Object F(com.stripe.android.model.PaymentMethod r40, kotlin.coroutines.Continuation<? super kotlin.Unit> r41) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.customersheet.CustomerSheetViewModel.F(com.stripe.android.model.PaymentMethod, kotlin.coroutines.Continuation):java.lang.Object");
}
public final Object G(Continuation<? super com.stripe.android.customersheet.a> continuation) {
return this.customerAdapterProvider.await(continuation);
}
private final i.SelectPaymentMethod I(Function1<? super i.SelectPaymentMethod, i.SelectPaymentMethod> override) {
return override.invoke(new i.SelectPaymentMethod(this.configuration.getHeaderTextForSelectionScreen(), kotlin.collections.o.n(), null, this.isLiveModeProvider.invoke().booleanValue(), false, false, this.isGooglePayReadyAndEnabled, false, this.resources.getString(i0.C), this.configuration.getAllowsRemovalOfLastSavedPaymentMethod(), null, null, null, a.c.c, 6144, null));
}
public final void J(PaymentSelection paymentSelection, String type) {
if (type != null) {
this.eventReporter.g(type);
}
this._result.tryEmit(new n.Selected(paymentSelection));
}
public final void K(PaymentSelection paymentSelection, String type, Throwable cause, String displayMessage) {
Object value;
ArrayList arrayList;
if (type != null) {
this.eventReporter.m(type);
}
this.logger.error("Failed to persist payment selection: " + paymentSelection, cause);
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<Object> list = (List) value;
arrayList = new ArrayList(p.y(list, 10));
for (Object obj : list) {
if (obj instanceof i.SelectPaymentMethod) {
obj = r7.j((r30 & 1) != 0 ? r7.title : null, (r30 & 2) != 0 ? r7.savedPaymentMethods : null, (r30 & 4) != 0 ? r7.paymentSelection : null, (r30 & 8) != 0 ? r7.isLiveMode : false, (r30 & 16) != 0 ? r7.isProcessing : false, (r30 & 32) != 0 ? r7.isEditing : false, (r30 & 64) != 0 ? r7.isGooglePayEnabled : false, (r30 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? r7.primaryButtonVisible : false, (r30 & 256) != 0 ? r7.primaryButtonLabel : null, (r30 & 512) != 0 ? r7.allowsRemovalOfLastSavedPaymentMethod : false, (r30 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? r7.errorMessage : displayMessage, (r30 & 2048) != 0 ? r7.unconfirmedPaymentMethod : null, (r30 & 4096) != 0 ? r7.mandateText : null, (r30 & 8192) != 0 ? ((i.SelectPaymentMethod) obj).cbcEligibility : null);
}
arrayList.add(obj);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
private final void L(ai.d confirmStripeIntentParams) {
Object b2;
Object value;
ArrayList arrayList;
com.stripe.android.payments.paymentlauncher.b bVar;
try {
Result.Companion companion = Result.INSTANCE;
bVar = this.paymentLauncher;
} catch (Throwable th2) {
Result.Companion companion2 = Result.INSTANCE;
b2 = Result.b(kotlin.f.a(th2));
}
if (bVar == null) {
throw new IllegalArgumentException("Required value was null.".toString());
}
b2 = Result.b(bVar);
Throwable e = Result.e(b2);
if (e == null) {
com.stripe.android.payments.paymentlauncher.b bVar2 = (com.stripe.android.payments.paymentlauncher.b) b2;
if (!(confirmStripeIntentParams instanceof ConfirmSetupIntentParams)) {
throw new IllegalStateException("Only SetupIntents are supported at this time".toString());
}
bVar2.a((ConfirmSetupIntentParams) confirmStripeIntentParams);
return;
}
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<Object> list = (List) value;
arrayList = new ArrayList(p.y(list, 10));
for (Object obj : list) {
if (obj instanceof i.AddPaymentMethod) {
i.AddPaymentMethod addPaymentMethod = (i.AddPaymentMethod) obj;
obj = addPaymentMethod.j((r38 & 1) != 0 ? addPaymentMethod.paymentMethodCode : null, (r38 & 2) != 0 ? addPaymentMethod.supportedPaymentMethods : null, (r38 & 4) != 0 ? addPaymentMethod.formFieldValues : null, (r38 & 8) != 0 ? addPaymentMethod.formElements : null, (r38 & 16) != 0 ? addPaymentMethod.formArguments : null, (r38 & 32) != 0 ? addPaymentMethod.usBankAccountFormArguments : null, (r38 & 64) != 0 ? addPaymentMethod.draftPaymentSelection : null, (r38 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? addPaymentMethod.enabled : false, (r38 & 256) != 0 ? addPaymentMethod.isLiveMode : false, (r38 & 512) != 0 ? addPaymentMethod.isProcessing : false, (r38 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? addPaymentMethod.errorMessage : kh.a.a(e, this.application), (r38 & 2048) != 0 ? addPaymentMethod.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? addPaymentMethod.primaryButtonLabel : null, (r38 & 8192) != 0 ? addPaymentMethod.primaryButtonEnabled : addPaymentMethod.getFormFieldValues() != null, (r38 & 16384) != 0 ? addPaymentMethod.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? addPaymentMethod.mandateText : null, (r38 & 65536) != 0 ? addPaymentMethod.showMandateAbovePrimaryButton : false, (r38 & 131072) != 0 ? addPaymentMethod.displayDismissConfirmationModal : false, (r38 & 262144) != 0 ? addPaymentMethod.bankAccountResult : null, (r38 & 524288) != 0 ? addPaymentMethod.cbcEligibility : null);
}
arrayList.add(obj);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
private final void M(PaymentMethodCreateParams paymentMethodCreateParams) {
BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), this.workContext, null, new CustomerSheetViewModel$createAndAttach$1(this, paymentMethodCreateParams, null), 2, null);
}
public final java.lang.Object N(com.stripe.android.model.PaymentMethodCreateParams r11, kotlin.coroutines.Continuation<? super kotlin.Result<com.stripe.android.model.PaymentMethod>> r12) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.customersheet.CustomerSheetViewModel.N(com.stripe.android.model.PaymentMethodCreateParams, kotlin.coroutines.Continuation):java.lang.Object");
}
private final CustomerSheetEventReporter.Screen O(i iVar) {
if (iVar instanceof i.AddPaymentMethod) {
return CustomerSheetEventReporter.Screen.c;
}
if (iVar instanceof i.SelectPaymentMethod) {
return CustomerSheetEventReporter.Screen.d;
}
if (iVar instanceof i.EditPaymentMethod) {
return CustomerSheetEventReporter.Screen.e;
}
return null;
}
public final void R(String displayMessage) {
Object value;
ArrayList arrayList;
if (this.viewState.getValue() instanceof i.SelectPaymentMethod) {
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<Object> list = (List) value;
arrayList = new ArrayList(p.y(list, 10));
for (Object obj : list) {
if (obj instanceof i.SelectPaymentMethod) {
obj = r7.j((r30 & 1) != 0 ? r7.title : null, (r30 & 2) != 0 ? r7.savedPaymentMethods : null, (r30 & 4) != 0 ? r7.paymentSelection : null, (r30 & 8) != 0 ? r7.isLiveMode : false, (r30 & 16) != 0 ? r7.isProcessing : false, (r30 & 32) != 0 ? r7.isEditing : false, (r30 & 64) != 0 ? r7.isGooglePayEnabled : false, (r30 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? r7.primaryButtonVisible : false, (r30 & 256) != 0 ? r7.primaryButtonLabel : null, (r30 & 512) != 0 ? r7.allowsRemovalOfLastSavedPaymentMethod : false, (r30 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? r7.errorMessage : displayMessage, (r30 & 2048) != 0 ? r7.unconfirmedPaymentMethod : null, (r30 & 4096) != 0 ? r7.mandateText : null, (r30 & 8192) != 0 ? ((i.SelectPaymentMethod) obj).cbcEligibility : null);
}
arrayList.add(obj);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
}
private final void S(String clientSecret, StripeIntent stripeIntent) {
Object b2;
Object value;
ArrayList arrayList;
com.stripe.android.payments.paymentlauncher.b bVar;
try {
Result.Companion companion = Result.INSTANCE;
bVar = this.paymentLauncher;
} catch (Throwable th2) {
Result.Companion companion2 = Result.INSTANCE;
b2 = Result.b(kotlin.f.a(th2));
}
if (bVar == null) {
throw new IllegalArgumentException("Required value was null.".toString());
}
b2 = Result.b(bVar);
Throwable e = Result.e(b2);
if (e == null) {
com.stripe.android.payments.paymentlauncher.b bVar2 = (com.stripe.android.payments.paymentlauncher.b) b2;
if (!(stripeIntent instanceof SetupIntent)) {
throw new IllegalStateException("Only SetupIntents are supported at this time".toString());
}
bVar2.b(clientSecret);
return;
}
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<Object> list = (List) value;
arrayList = new ArrayList(p.y(list, 10));
for (Object obj : list) {
if (obj instanceof i.AddPaymentMethod) {
i.AddPaymentMethod addPaymentMethod = (i.AddPaymentMethod) obj;
obj = addPaymentMethod.j((r38 & 1) != 0 ? addPaymentMethod.paymentMethodCode : null, (r38 & 2) != 0 ? addPaymentMethod.supportedPaymentMethods : null, (r38 & 4) != 0 ? addPaymentMethod.formFieldValues : null, (r38 & 8) != 0 ? addPaymentMethod.formElements : null, (r38 & 16) != 0 ? addPaymentMethod.formArguments : null, (r38 & 32) != 0 ? addPaymentMethod.usBankAccountFormArguments : null, (r38 & 64) != 0 ? addPaymentMethod.draftPaymentSelection : null, (r38 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? addPaymentMethod.enabled : false, (r38 & 256) != 0 ? addPaymentMethod.isLiveMode : false, (r38 & 512) != 0 ? addPaymentMethod.isProcessing : false, (r38 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? addPaymentMethod.errorMessage : kh.a.a(e, this.application), (r38 & 2048) != 0 ? addPaymentMethod.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? addPaymentMethod.primaryButtonLabel : null, (r38 & 8192) != 0 ? addPaymentMethod.primaryButtonEnabled : addPaymentMethod.getFormFieldValues() != null, (r38 & 16384) != 0 ? addPaymentMethod.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? addPaymentMethod.mandateText : null, (r38 & 65536) != 0 ? addPaymentMethod.showMandateAbovePrimaryButton : false, (r38 & 131072) != 0 ? addPaymentMethod.displayDismissConfirmationModal : false, (r38 & 262144) != 0 ? addPaymentMethod.bankAccountResult : null, (r38 & 524288) != 0 ? addPaymentMethod.cbcEligibility : null);
}
arrayList.add(obj);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
public final void T(PaymentMethod paymentMethod) {
boolean z;
ArrayList arrayList;
ArrayList arrayList2;
Object obj;
ArrayList arrayList3;
i value = this.viewState.getValue();
List<PaymentMethod> c2 = value.c();
ArrayList arrayList4 = new ArrayList();
Iterator<T> it = c2.iterator();
while (true) {
z = true;
if (!it.hasNext()) {
break;
}
Object next = it.next();
String str = ((PaymentMethod) next).id;
r.f(paymentMethod.id);
if (!r.d(str, r6)) {
arrayList4.add(next);
}
}
PaymentSelection paymentSelection = null;
if (value instanceof i.SelectPaymentMethod) {
MutableStateFlow mutableStateFlow = this.backStack;
while (true) {
Object value2 = mutableStateFlow.getValue();
List<Object> list = (List) value2;
ArrayList arrayList5 = new ArrayList(p.y(list, 10));
for (Object obj2 : list) {
if (obj2 instanceof i.SelectPaymentMethod) {
i.SelectPaymentMethod selectPaymentMethod = (i.SelectPaymentMethod) obj2;
PaymentSelection paymentSelection2 = this.originalPaymentSelection;
boolean z2 = ((selectPaymentMethod.getPaymentSelection() instanceof PaymentSelection.Saved) && r.d(((PaymentSelection.Saved) selectPaymentMethod.getPaymentSelection()).getPaymentMethod().id, paymentMethod.id)) ? z : false;
if ((selectPaymentMethod.getPaymentSelection() instanceof PaymentSelection.Saved) && (paymentSelection2 instanceof PaymentSelection.Saved) && r.d(((PaymentSelection.Saved) selectPaymentMethod.getPaymentSelection()).getPaymentMethod().id, ((PaymentSelection.Saved) paymentSelection2).getPaymentMethod().id)) {
this.originalPaymentSelection = paymentSelection;
}
boolean a2 = j.a(selectPaymentMethod.getAllowsRemovalOfLastSavedPaymentMethod(), arrayList4, selectPaymentMethod.getCbcEligibility());
PaymentSelection paymentSelection3 = selectPaymentMethod.getPaymentSelection();
if (z2) {
paymentSelection3 = paymentSelection;
}
arrayList2 = arrayList5;
obj = value2;
arrayList3 = arrayList4;
obj2 = selectPaymentMethod.j((r30 & 1) != 0 ? selectPaymentMethod.title : null, (r30 & 2) != 0 ? selectPaymentMethod.savedPaymentMethods : arrayList4, (r30 & 4) != 0 ? selectPaymentMethod.paymentSelection : paymentSelection3 == null ? this.originalPaymentSelection : paymentSelection3, (r30 & 8) != 0 ? selectPaymentMethod.isLiveMode : false, (r30 & 16) != 0 ? selectPaymentMethod.isProcessing : false, (r30 & 32) != 0 ? selectPaymentMethod.isEditing : (selectPaymentMethod.getIsEditing() && a2) ? z : false, (r30 & 64) != 0 ? selectPaymentMethod.isGooglePayEnabled : false, (r30 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? selectPaymentMethod.primaryButtonVisible : false, (r30 & 256) != 0 ? selectPaymentMethod.primaryButtonLabel : null, (r30 & 512) != 0 ? selectPaymentMethod.allowsRemovalOfLastSavedPaymentMethod : false, (r30 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? selectPaymentMethod.errorMessage : null, (r30 & 2048) != 0 ? selectPaymentMethod.unconfirmedPaymentMethod : null, (r30 & 4096) != 0 ? selectPaymentMethod.mandateText : null, (r30 & 8192) != 0 ? selectPaymentMethod.cbcEligibility : null);
} else {
arrayList2 = arrayList5;
obj = value2;
arrayList3 = arrayList4;
}
arrayList2.add(obj2);
arrayList5 = arrayList2;
arrayList4 = arrayList3;
value2 = obj;
paymentSelection = null;
z = true;
}
arrayList = arrayList4;
if (mutableStateFlow.compareAndSet(value2, arrayList5)) {
break;
}
arrayList4 = arrayList;
paymentSelection = null;
z = true;
}
} else {
arrayList = arrayList4;
}
if (!arrayList.isEmpty() || this.isGooglePayReadyAndEnabled) {
return;
}
y0(this, true, null, 2, null);
}
public final java.lang.Object U(com.stripe.android.model.StripeIntent r38, java.lang.String r39, com.stripe.android.model.PaymentMethod r40, kotlin.coroutines.Continuation<? super kotlin.Result<kotlin.Unit>> r41) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.customersheet.CustomerSheetViewModel.U(com.stripe.android.model.StripeIntent, java.lang.String, com.stripe.android.model.PaymentMethod, kotlin.coroutines.Continuation):java.lang.Object");
}
public final java.lang.Object W(kotlin.coroutines.Continuation<? super kotlin.Unit> r6) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.customersheet.CustomerSheetViewModel.W(kotlin.coroutines.Continuation):java.lang.Object");
}
public final java.lang.Object X(com.stripe.android.model.PaymentMethod r19, com.stripe.android.model.CardBrand r20, kotlin.coroutines.Continuation<? super com.stripe.android.customersheet.a.b<com.stripe.android.model.PaymentMethod>> r21) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.customersheet.CustomerSheetViewModel.X(com.stripe.android.model.PaymentMethod, com.stripe.android.model.CardBrand, kotlin.coroutines.Continuation):java.lang.Object");
}
private final void Y() {
y0(this, false, null, 2, null);
}
private final void Z(SupportedPaymentMethod paymentMethod) {
Object value;
ArrayList arrayList;
List<com.stripe.android.uicore.elements.o> n;
i value2 = this.viewState.getValue();
i.AddPaymentMethod addPaymentMethod = value2 instanceof i.AddPaymentMethod ? (i.AddPaymentMethod) value2 : null;
if (addPaymentMethod == null || !r.d(addPaymentMethod.getPaymentMethodCode(), paymentMethod.getCode())) {
this.eventReporter.d(paymentMethod.getCode());
this.previouslySelectedPaymentMethod = paymentMethod;
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<Object> list = (List) value;
arrayList = new ArrayList(p.y(list, 10));
for (Object obj : list) {
if (obj instanceof i.AddPaymentMethod) {
i.AddPaymentMethod addPaymentMethod2 = (i.AddPaymentMethod) obj;
String code = paymentMethod.getCode();
com.stripe.android.paymentsheet.forms.a aVar = com.stripe.android.paymentsheet.forms.a.a;
String code2 = paymentMethod.getCode();
Configuration configuration = this.configuration;
FormArguments a2 = aVar.a(code2, configuration, configuration.getMerchantDisplayName(), addPaymentMethod2.getCbcEligibility());
PaymentMethodMetadata paymentMethodMetadata = this.paymentMethodMetadata;
if (paymentMethodMetadata == null || (n = paymentMethodMetadata.e(paymentMethod.getCode(), new d.a.InterfaceC0299a.C0300a(this.cardAccountRangeRepositoryFactory, null, null, 6, null))) == null) {
n = kotlin.collections.o.n();
}
List<com.stripe.android.uicore.elements.o> list2 = n;
qh.b c2 = (!r.d(paymentMethod.getCode(), PaymentMethod.Type.U.code) || (addPaymentMethod2.getBankAccountResult() instanceof e.Completed)) ? qh.c.c(i0.T, new Object[0], null, 4, null) : qh.c.c(com.stripe.android.ui.core.j.o, new Object[0], null, 4, null);
PaymentSelection draftPaymentSelection = addPaymentMethod2.getDraftPaymentSelection();
obj = addPaymentMethod2.j((r38 & 1) != 0 ? addPaymentMethod2.paymentMethodCode : code, (r38 & 2) != 0 ? addPaymentMethod2.supportedPaymentMethods : null, (r38 & 4) != 0 ? addPaymentMethod2.formFieldValues : null, (r38 & 8) != 0 ? addPaymentMethod2.formElements : list2, (r38 & 16) != 0 ? addPaymentMethod2.formArguments : a2, (r38 & 32) != 0 ? addPaymentMethod2.usBankAccountFormArguments : null, (r38 & 64) != 0 ? addPaymentMethod2.draftPaymentSelection : null, (r38 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? addPaymentMethod2.enabled : false, (r38 & 256) != 0 ? addPaymentMethod2.isLiveMode : false, (r38 & 512) != 0 ? addPaymentMethod2.isProcessing : false, (r38 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? addPaymentMethod2.errorMessage : null, (r38 & 2048) != 0 ? addPaymentMethod2.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? addPaymentMethod2.primaryButtonLabel : c2, (r38 & 8192) != 0 ? addPaymentMethod2.primaryButtonEnabled : (addPaymentMethod2.getFormFieldValues() == null || addPaymentMethod2.getIsProcessing()) ? false : true, (r38 & 16384) != 0 ? addPaymentMethod2.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? addPaymentMethod2.mandateText : draftPaymentSelection != null ? draftPaymentSelection.c(this.application, this.configuration.getMerchantDisplayName(), false, true) : null, (r38 & 65536) != 0 ? addPaymentMethod2.showMandateAbovePrimaryButton : false, (r38 & 131072) != 0 ? addPaymentMethod2.displayDismissConfirmationModal : false, (r38 & 262144) != 0 ? addPaymentMethod2.bankAccountResult : null, (r38 & 524288) != 0 ? addPaymentMethod2.cbcEligibility : null);
}
arrayList.add(obj);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
}
public final void a0() {
List<i> value;
List<i> n0;
if (this.backStack.getValue().size() == 1) {
this._result.tryEmit(new n.Canceled(this.originalPaymentSelection));
return;
}
MutableStateFlow<List<i>> mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<i> list = value;
CustomerSheetEventReporter.Screen O = O((i) CollectionsKt___CollectionsKt.F0(list));
if (O != null) {
this.eventReporter.n(O);
}
n0 = CollectionsKt___CollectionsKt.n0(list, 1);
} while (!mutableStateFlow.compareAndSet(value, n0));
}
private final void b0() {
Object value;
ArrayList arrayList;
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<Object> list = (List) value;
arrayList = new ArrayList(p.y(list, 10));
for (Object obj : list) {
if (obj instanceof i.AddPaymentMethod) {
obj = r6.j((r38 & 1) != 0 ? r6.paymentMethodCode : null, (r38 & 2) != 0 ? r6.supportedPaymentMethods : null, (r38 & 4) != 0 ? r6.formFieldValues : null, (r38 & 8) != 0 ? r6.formElements : null, (r38 & 16) != 0 ? r6.formArguments : null, (r38 & 32) != 0 ? r6.usBankAccountFormArguments : null, (r38 & 64) != 0 ? r6.draftPaymentSelection : null, (r38 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? r6.enabled : false, (r38 & 256) != 0 ? r6.isLiveMode : false, (r38 & 512) != 0 ? r6.isProcessing : false, (r38 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? r6.errorMessage : null, (r38 & 2048) != 0 ? r6.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? r6.primaryButtonLabel : null, (r38 & 8192) != 0 ? r6.primaryButtonEnabled : false, (r38 & 16384) != 0 ? r6.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? r6.mandateText : null, (r38 & 65536) != 0 ? r6.showMandateAbovePrimaryButton : false, (r38 & 131072) != 0 ? r6.displayDismissConfirmationModal : false, (r38 & 262144) != 0 ? r6.bankAccountResult : null, (r38 & 524288) != 0 ? ((i.AddPaymentMethod) obj).cbcEligibility : null);
}
arrayList.add(obj);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
private final void c0() {
this.eventReporter.a();
}
private final void d0(di.e bankAccountResult) {
Object value;
ArrayList arrayList;
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<Object> list = (List) value;
arrayList = new ArrayList(p.y(list, 10));
for (Object obj : list) {
if (obj instanceof i.AddPaymentMethod) {
obj = r6.j((r38 & 1) != 0 ? r6.paymentMethodCode : null, (r38 & 2) != 0 ? r6.supportedPaymentMethods : null, (r38 & 4) != 0 ? r6.formFieldValues : null, (r38 & 8) != 0 ? r6.formElements : null, (r38 & 16) != 0 ? r6.formArguments : null, (r38 & 32) != 0 ? r6.usBankAccountFormArguments : null, (r38 & 64) != 0 ? r6.draftPaymentSelection : null, (r38 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? r6.enabled : false, (r38 & 256) != 0 ? r6.isLiveMode : false, (r38 & 512) != 0 ? r6.isProcessing : false, (r38 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? r6.errorMessage : null, (r38 & 2048) != 0 ? r6.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? r6.primaryButtonLabel : bankAccountResult instanceof e.Completed ? qh.c.c(i0.T, new Object[0], null, 4, null) : qh.c.c(com.stripe.android.ui.core.j.o, new Object[0], null, 4, null), (r38 & 8192) != 0 ? r6.primaryButtonEnabled : false, (r38 & 16384) != 0 ? r6.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? r6.mandateText : null, (r38 & 65536) != 0 ? r6.showMandateAbovePrimaryButton : false, (r38 & 131072) != 0 ? r6.displayDismissConfirmationModal : false, (r38 & 262144) != 0 ? r6.bankAccountResult : bankAccountResult, (r38 & 524288) != 0 ? ((i.AddPaymentMethod) obj).cbcEligibility : null);
}
arrayList.add(obj);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
private final void e0(PaymentSelection.d.USBankAccount usBankAccount) {
M(usBankAccount.getPaymentMethodCreateParams());
}
private final void f0() {
MutableStateFlow<n> mutableStateFlow = this._result;
while (!mutableStateFlow.compareAndSet(mutableStateFlow.getValue(), new n.Canceled(this.originalPaymentSelection))) {
}
}
private final void g0() {
Object value;
ArrayList arrayList;
if (this.viewState.getValue().getIsEditing()) {
this.eventReporter.k();
} else {
this.eventReporter.i();
}
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<Object> list = (List) value;
arrayList = new ArrayList(p.y(list, 10));
for (Object obj : list) {
if (obj instanceof i.SelectPaymentMethod) {
i.SelectPaymentMethod selectPaymentMethod = (i.SelectPaymentMethod) obj;
boolean z = !selectPaymentMethod.getIsEditing();
obj = selectPaymentMethod.j((r30 & 1) != 0 ? selectPaymentMethod.title : null, (r30 & 2) != 0 ? selectPaymentMethod.savedPaymentMethods : null, (r30 & 4) != 0 ? selectPaymentMethod.paymentSelection : null, (r30 & 8) != 0 ? selectPaymentMethod.isLiveMode : false, (r30 & 16) != 0 ? selectPaymentMethod.isProcessing : false, (r30 & 32) != 0 ? selectPaymentMethod.isEditing : z, (r30 & 64) != 0 ? selectPaymentMethod.isGooglePayEnabled : false, (r30 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? selectPaymentMethod.primaryButtonVisible : (z || r.d(this.originalPaymentSelection, selectPaymentMethod.getPaymentSelection())) ? false : true, (r30 & 256) != 0 ? selectPaymentMethod.primaryButtonLabel : null, (r30 & 512) != 0 ? selectPaymentMethod.allowsRemovalOfLastSavedPaymentMethod : false, (r30 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? selectPaymentMethod.errorMessage : null, (r30 & 2048) != 0 ? selectPaymentMethod.unconfirmedPaymentMethod : null, (r30 & 4096) != 0 ? selectPaymentMethod.mandateText : null, (r30 & 8192) != 0 ? selectPaymentMethod.cbcEligibility : null);
}
arrayList.add(obj);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
private final void h0(String error) {
Object value;
ArrayList arrayList;
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<Object> list = (List) value;
arrayList = new ArrayList(p.y(list, 10));
for (Object obj : list) {
if (obj instanceof i.AddPaymentMethod) {
obj = r6.j((r38 & 1) != 0 ? r6.paymentMethodCode : null, (r38 & 2) != 0 ? r6.supportedPaymentMethods : null, (r38 & 4) != 0 ? r6.formFieldValues : null, (r38 & 8) != 0 ? r6.formElements : null, (r38 & 16) != 0 ? r6.formArguments : null, (r38 & 32) != 0 ? r6.usBankAccountFormArguments : null, (r38 & 64) != 0 ? r6.draftPaymentSelection : null, (r38 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? r6.enabled : false, (r38 & 256) != 0 ? r6.isLiveMode : false, (r38 & 512) != 0 ? r6.isProcessing : false, (r38 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? r6.errorMessage : error, (r38 & 2048) != 0 ? r6.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? r6.primaryButtonLabel : null, (r38 & 8192) != 0 ? r6.primaryButtonEnabled : false, (r38 & 16384) != 0 ? r6.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? r6.mandateText : null, (r38 & 65536) != 0 ? r6.showMandateAbovePrimaryButton : false, (r38 & 131072) != 0 ? r6.displayDismissConfirmationModal : false, (r38 & 262144) != 0 ? r6.bankAccountResult : null, (r38 & 524288) != 0 ? ((i.AddPaymentMethod) obj).cbcEligibility : null);
}
arrayList.add(obj);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
}
private final void i0(FormFieldValues formFieldValues) {
Object obj;
MutableStateFlow mutableStateFlow;
PaymentMethodMetadata paymentMethodMetadata;
ArrayList arrayList;
PaymentSelection paymentSelection;
FormFieldValues formFieldValues2 = formFieldValues;
PaymentMethodMetadata paymentMethodMetadata2 = this.paymentMethodMetadata;
if (paymentMethodMetadata2 == null) {
return;
}
MutableStateFlow mutableStateFlow2 = this.backStack;
while (true) {
Object value = mutableStateFlow2.getValue();
List<Object> list = (List) value;
ArrayList arrayList2 = new ArrayList(p.y(list, 10));
for (Object obj2 : list) {
if (obj2 instanceof i.AddPaymentMethod) {
i.AddPaymentMethod addPaymentMethod = (i.AddPaymentMethod) obj2;
boolean z = (formFieldValues2 == null || addPaymentMethod.getIsProcessing()) ? false : true;
if (formFieldValues2 != null) {
Application application = this.application;
for (SupportedPaymentMethod supportedPaymentMethod : addPaymentMethod.z()) {
if (r.d(supportedPaymentMethod.getCode(), addPaymentMethod.getPaymentMethodCode())) {
paymentSelection = AddPaymentMethodKt.l(formFieldValues2, application, supportedPaymentMethod, paymentMethodMetadata2);
}
}
throw new NoSuchElementException("Collection contains no element matching the predicate.");
}
paymentSelection = null;
obj = value;
mutableStateFlow = mutableStateFlow2;
paymentMethodMetadata = paymentMethodMetadata2;
obj2 = addPaymentMethod.j((r38 & 1) != 0 ? addPaymentMethod.paymentMethodCode : null, (r38 & 2) != 0 ? addPaymentMethod.supportedPaymentMethods : null, (r38 & 4) != 0 ? addPaymentMethod.formFieldValues : formFieldValues, (r38 & 8) != 0 ? addPaymentMethod.formElements : null, (r38 & 16) != 0 ? addPaymentMethod.formArguments : null, (r38 & 32) != 0 ? addPaymentMethod.usBankAccountFormArguments : null, (r38 & 64) != 0 ? addPaymentMethod.draftPaymentSelection : paymentSelection, (r38 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? addPaymentMethod.enabled : false, (r38 & 256) != 0 ? addPaymentMethod.isLiveMode : false, (r38 & 512) != 0 ? addPaymentMethod.isProcessing : false, (r38 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? addPaymentMethod.errorMessage : null, (r38 & 2048) != 0 ? addPaymentMethod.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? addPaymentMethod.primaryButtonLabel : null, (r38 & 8192) != 0 ? addPaymentMethod.primaryButtonEnabled : z, (r38 & 16384) != 0 ? addPaymentMethod.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? addPaymentMethod.mandateText : null, (r38 & 65536) != 0 ? addPaymentMethod.showMandateAbovePrimaryButton : false, (r38 & 131072) != 0 ? addPaymentMethod.displayDismissConfirmationModal : false, (r38 & 262144) != 0 ? addPaymentMethod.bankAccountResult : null, (r38 & 524288) != 0 ? addPaymentMethod.cbcEligibility : null);
arrayList = arrayList2;
} else {
obj = value;
mutableStateFlow = mutableStateFlow2;
paymentMethodMetadata = paymentMethodMetadata2;
arrayList = arrayList2;
}
arrayList.add(obj2);
formFieldValues2 = formFieldValues;
arrayList2 = arrayList;
paymentMethodMetadata2 = paymentMethodMetadata;
value = obj;
mutableStateFlow2 = mutableStateFlow;
}
MutableStateFlow mutableStateFlow3 = mutableStateFlow2;
PaymentMethodMetadata paymentMethodMetadata3 = paymentMethodMetadata2;
if (mutableStateFlow3.compareAndSet(value, arrayList2)) {
return;
}
formFieldValues2 = formFieldValues;
mutableStateFlow2 = mutableStateFlow3;
paymentMethodMetadata2 = paymentMethodMetadata3;
}
}
private final void j0(PaymentMethod paymentMethod) {
BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), this.workContext, null, new CustomerSheetViewModel$onItemRemoved$1(this, paymentMethod, null), 2, null);
}
private final void k0(PaymentSelection paymentSelection) {
Object obj;
MutableStateFlow mutableStateFlow;
PaymentSelection paymentSelection2;
ArrayList arrayList;
CustomerSheetViewModel customerSheetViewModel = this;
PaymentSelection paymentSelection3 = paymentSelection;
if (!(paymentSelection3 instanceof PaymentSelection.b) && !(paymentSelection3 instanceof PaymentSelection.Saved)) {
throw new IllegalStateException(("Unsupported payment selection " + paymentSelection3).toString());
}
if (customerSheetViewModel.viewState.getValue().getIsEditing()) {
return;
}
MutableStateFlow mutableStateFlow2 = this.backStack;
while (true) {
Object value = mutableStateFlow2.getValue();
List<Object> list = (List) value;
ArrayList arrayList2 = new ArrayList(p.y(list, 10));
for (Object obj2 : list) {
if (obj2 instanceof i.SelectPaymentMethod) {
i.SelectPaymentMethod selectPaymentMethod = (i.SelectPaymentMethod) obj2;
boolean z = !r.d(customerSheetViewModel.originalPaymentSelection, paymentSelection3);
String string = customerSheetViewModel.resources.getString(i0.C);
String c2 = paymentSelection3.c(customerSheetViewModel.application, customerSheetViewModel.configuration.getMerchantDisplayName(), false, false);
obj = value;
mutableStateFlow = mutableStateFlow2;
paymentSelection2 = paymentSelection3;
obj2 = selectPaymentMethod.j((r30 & 1) != 0 ? selectPaymentMethod.title : null, (r30 & 2) != 0 ? selectPaymentMethod.savedPaymentMethods : null, (r30 & 4) != 0 ? selectPaymentMethod.paymentSelection : paymentSelection, (r30 & 8) != 0 ? selectPaymentMethod.isLiveMode : false, (r30 & 16) != 0 ? selectPaymentMethod.isProcessing : false, (r30 & 32) != 0 ? selectPaymentMethod.isEditing : false, (r30 & 64) != 0 ? selectPaymentMethod.isGooglePayEnabled : false, (r30 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? selectPaymentMethod.primaryButtonVisible : z, (r30 & 256) != 0 ? selectPaymentMethod.primaryButtonLabel : string, (r30 & 512) != 0 ? selectPaymentMethod.allowsRemovalOfLastSavedPaymentMethod : false, (r30 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? selectPaymentMethod.errorMessage : null, (r30 & 2048) != 0 ? selectPaymentMethod.unconfirmedPaymentMethod : null, (r30 & 4096) != 0 ? selectPaymentMethod.mandateText : (c2 == null || !z) ? null : c2, (r30 & 8192) != 0 ? selectPaymentMethod.cbcEligibility : null);
arrayList = arrayList2;
} else {
obj = value;
mutableStateFlow = mutableStateFlow2;
paymentSelection2 = paymentSelection3;
arrayList = arrayList2;
}
arrayList.add(obj2);
paymentSelection3 = paymentSelection2;
arrayList2 = arrayList;
value = obj;
mutableStateFlow2 = mutableStateFlow;
customerSheetViewModel = this;
}
MutableStateFlow mutableStateFlow3 = mutableStateFlow2;
PaymentSelection paymentSelection4 = paymentSelection3;
if (mutableStateFlow3.compareAndSet(value, arrayList2)) {
return;
}
paymentSelection3 = paymentSelection4;
mutableStateFlow2 = mutableStateFlow3;
customerSheetViewModel = this;
}
}
private final void l0(PaymentMethod paymentMethod) {
i value = this.viewState.getValue();
boolean z = this.configuration.getAllowsRemovalOfLastSavedPaymentMethod() || value.c().size() > 1;
e.a aVar = this.editInteractorFactory;
PaymentMethod.Type type = paymentMethod.type;
w0(this, new i.EditPaymentMethod(aVar.a(paymentMethod, new Function1<b.a, Unit>() {
{
super(1);
}
public final void a(b.a event) {
CustomerSheetEventReporter customerSheetEventReporter;
CustomerSheetEventReporter customerSheetEventReporter2;
r.i(event, "event");
if (event instanceof b.a.ShowBrands) {
customerSheetEventReporter2 = CustomerSheetViewModel.this.eventReporter;
customerSheetEventReporter2.j(CustomerSheetEventReporter.CardBrandChoiceEventSource.d, ((b.a.ShowBrands) event).getBrand());
} else if (event instanceof b.a.HideBrands) {
customerSheetEventReporter = CustomerSheetViewModel.this.eventReporter;
customerSheetEventReporter.o(CustomerSheetEventReporter.CardBrandChoiceEventSource.d, ((b.a.HideBrands) event).getBrand());
}
}
@Override
public Unit invoke(b.a aVar2) {
a(aVar2);
return Unit.a;
}
}, new CustomerSheetViewModel$onModifyItem$2(this, null), new CustomerSheetViewModel$onModifyItem$3(this, null), o0(type != null ? type.code : null), z), value.getIsLiveMode(), value.getCbcEligibility(), value.c(), this.configuration.getAllowsRemovalOfLastSavedPaymentMethod()), false, 2, null);
}
public final void m0(com.stripe.android.payments.paymentlauncher.e result) {
Object value;
ArrayList arrayList;
Object value2;
ArrayList arrayList2;
if (result instanceof e.a) {
MutableStateFlow mutableStateFlow = this.backStack;
do {
value2 = mutableStateFlow.getValue();
List<Object> list = (List) value2;
arrayList2 = new ArrayList(p.y(list, 10));
for (Object obj : list) {
if (obj instanceof i.AddPaymentMethod) {
i.AddPaymentMethod addPaymentMethod = (i.AddPaymentMethod) obj;
obj = addPaymentMethod.j((r38 & 1) != 0 ? addPaymentMethod.paymentMethodCode : null, (r38 & 2) != 0 ? addPaymentMethod.supportedPaymentMethods : null, (r38 & 4) != 0 ? addPaymentMethod.formFieldValues : null, (r38 & 8) != 0 ? addPaymentMethod.formElements : null, (r38 & 16) != 0 ? addPaymentMethod.formArguments : null, (r38 & 32) != 0 ? addPaymentMethod.usBankAccountFormArguments : null, (r38 & 64) != 0 ? addPaymentMethod.draftPaymentSelection : null, (r38 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? addPaymentMethod.enabled : true, (r38 & 256) != 0 ? addPaymentMethod.isLiveMode : false, (r38 & 512) != 0 ? addPaymentMethod.isProcessing : false, (r38 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? addPaymentMethod.errorMessage : null, (r38 & 2048) != 0 ? addPaymentMethod.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? addPaymentMethod.primaryButtonLabel : null, (r38 & 8192) != 0 ? addPaymentMethod.primaryButtonEnabled : addPaymentMethod.getFormFieldValues() != null, (r38 & 16384) != 0 ? addPaymentMethod.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? addPaymentMethod.mandateText : null, (r38 & 65536) != 0 ? addPaymentMethod.showMandateAbovePrimaryButton : false, (r38 & 131072) != 0 ? addPaymentMethod.displayDismissConfirmationModal : false, (r38 & 262144) != 0 ? addPaymentMethod.bankAccountResult : null, (r38 & 524288) != 0 ? addPaymentMethod.cbcEligibility : null);
}
arrayList2.add(obj);
}
} while (!mutableStateFlow.compareAndSet(value2, arrayList2));
return;
}
if (result instanceof e.c) {
s0(new Function1<i.SelectPaymentMethod, i.SelectPaymentMethod>() {
{
super(1);
}
@Override
public final i.SelectPaymentMethod invoke(i.SelectPaymentMethod viewState) {
PaymentMethod paymentMethod;
Resources resources;
Application application;
Configuration configuration;
i.SelectPaymentMethod j;
r.i(viewState, "viewState");
paymentMethod = CustomerSheetViewModel.this.unconfirmedPaymentMethod;
if (paymentMethod != null) {
CustomerSheetViewModel customerSheetViewModel = CustomerSheetViewModel.this;
customerSheetViewModel.unconfirmedPaymentMethod = null;
PaymentSelection.Saved saved = new PaymentSelection.Saved(paymentMethod, null, false, null, 14, null);
List R0 = CollectionsKt___CollectionsKt.R0(kotlin.collections.n.e(paymentMethod), viewState.c());
resources = customerSheetViewModel.resources;
String string = resources.getString(i0.C);
application = customerSheetViewModel.application;
configuration = customerSheetViewModel.configuration;
j = viewState.j((r30 & 1) != 0 ? viewState.title : null, (r30 & 2) != 0 ? viewState.savedPaymentMethods : R0, (r30 & 4) != 0 ? viewState.paymentSelection : saved, (r30 & 8) != 0 ? viewState.isLiveMode : false, (r30 & 16) != 0 ? viewState.isProcessing : false, (r30 & 32) != 0 ? viewState.isEditing : false, (r30 & 64) != 0 ? viewState.isGooglePayEnabled : false, (r30 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? viewState.primaryButtonVisible : true, (r30 & 256) != 0 ? viewState.primaryButtonLabel : string, (r30 & 512) != 0 ? viewState.allowsRemovalOfLastSavedPaymentMethod : false, (r30 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? viewState.errorMessage : null, (r30 & 2048) != 0 ? viewState.unconfirmedPaymentMethod : null, (r30 & 4096) != 0 ? viewState.mandateText : saved.c(application, configuration.getMerchantDisplayName(), false, false), (r30 & 8192) != 0 ? viewState.cbcEligibility : null);
if (j != null) {
return j;
}
}
return viewState;
}
});
a0();
return;
}
if (result instanceof e.d) {
MutableStateFlow mutableStateFlow2 = this.backStack;
do {
value = mutableStateFlow2.getValue();
List<Object> list2 = (List) value;
arrayList = new ArrayList(p.y(list2, 10));
for (Object obj2 : list2) {
if (obj2 instanceof i.AddPaymentMethod) {
i.AddPaymentMethod addPaymentMethod2 = (i.AddPaymentMethod) obj2;
obj2 = addPaymentMethod2.j((r38 & 1) != 0 ? addPaymentMethod2.paymentMethodCode : null, (r38 & 2) != 0 ? addPaymentMethod2.supportedPaymentMethods : null, (r38 & 4) != 0 ? addPaymentMethod2.formFieldValues : null, (r38 & 8) != 0 ? addPaymentMethod2.formElements : null, (r38 & 16) != 0 ? addPaymentMethod2.formArguments : null, (r38 & 32) != 0 ? addPaymentMethod2.usBankAccountFormArguments : null, (r38 & 64) != 0 ? addPaymentMethod2.draftPaymentSelection : null, (r38 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? addPaymentMethod2.enabled : true, (r38 & 256) != 0 ? addPaymentMethod2.isLiveMode : false, (r38 & 512) != 0 ? addPaymentMethod2.isProcessing : false, (r38 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? addPaymentMethod2.errorMessage : kh.a.a(((e.d) result).getThrowable(), this.application), (r38 & 2048) != 0 ? addPaymentMethod2.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? addPaymentMethod2.primaryButtonLabel : null, (r38 & 8192) != 0 ? addPaymentMethod2.primaryButtonEnabled : addPaymentMethod2.getFormFieldValues() != null, (r38 & 16384) != 0 ? addPaymentMethod2.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? addPaymentMethod2.mandateText : null, (r38 & 65536) != 0 ? addPaymentMethod2.showMandateAbovePrimaryButton : false, (r38 & 131072) != 0 ? addPaymentMethod2.displayDismissConfirmationModal : false, (r38 & 262144) != 0 ? addPaymentMethod2.bankAccountResult : null, (r38 & 524288) != 0 ? addPaymentMethod2.cbcEligibility : null);
}
arrayList.add(obj2);
}
} while (!mutableStateFlow2.compareAndSet(value, arrayList));
}
}
private final void n0() {
Object value;
ArrayList arrayList;
Object value2;
ArrayList arrayList2;
i value3 = this.viewState.getValue();
if (value3 instanceof i.AddPaymentMethod) {
i.AddPaymentMethod addPaymentMethod = (i.AddPaymentMethod) value3;
if (addPaymentMethod.getCustomPrimaryButtonUiState() != null) {
addPaymentMethod.getCustomPrimaryButtonUiState().f().invoke();
return;
}
MutableStateFlow mutableStateFlow = this.backStack;
do {
value2 = mutableStateFlow.getValue();
List<Object> list = (List) value2;
arrayList2 = new ArrayList(p.y(list, 10));
for (Object obj : list) {
if (obj instanceof i.AddPaymentMethod) {
obj = r9.j((r38 & 1) != 0 ? r9.paymentMethodCode : null, (r38 & 2) != 0 ? r9.supportedPaymentMethods : null, (r38 & 4) != 0 ? r9.formFieldValues : null, (r38 & 8) != 0 ? r9.formElements : null, (r38 & 16) != 0 ? r9.formArguments : null, (r38 & 32) != 0 ? r9.usBankAccountFormArguments : null, (r38 & 64) != 0 ? r9.draftPaymentSelection : null, (r38 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? r9.enabled : false, (r38 & 256) != 0 ? r9.isLiveMode : false, (r38 & 512) != 0 ? r9.isProcessing : true, (r38 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? r9.errorMessage : null, (r38 & 2048) != 0 ? r9.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? r9.primaryButtonLabel : null, (r38 & 8192) != 0 ? r9.primaryButtonEnabled : false, (r38 & 16384) != 0 ? r9.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? r9.mandateText : null, (r38 & 65536) != 0 ? r9.showMandateAbovePrimaryButton : false, (r38 & 131072) != 0 ? r9.displayDismissConfirmationModal : false, (r38 & 262144) != 0 ? r9.bankAccountResult : null, (r38 & 524288) != 0 ? ((i.AddPaymentMethod) obj).cbcEligibility : null);
}
arrayList2.add(obj);
}
} while (!mutableStateFlow.compareAndSet(value2, arrayList2));
FormFieldValues formFieldValues = addPaymentMethod.getFormFieldValues();
if (formFieldValues == null) {
throw new IllegalStateException("completeFormValues cannot be null".toString());
}
String paymentMethodCode = addPaymentMethod.getPaymentMethodCode();
PaymentMethodMetadata paymentMethodMetadata = this.paymentMethodMetadata;
if (paymentMethodMetadata == null) {
throw new IllegalArgumentException("Required value was null.".toString());
}
M(AddPaymentMethodKt.j(formFieldValues, paymentMethodCode, paymentMethodMetadata));
return;
}
if (!(value3 instanceof i.SelectPaymentMethod)) {
throw new IllegalStateException((this.viewState.getValue() + " is not supported").toString());
}
MutableStateFlow mutableStateFlow2 = this.backStack;
do {
value = mutableStateFlow2.getValue();
List<Object> list2 = (List) value;
arrayList = new ArrayList(p.y(list2, 10));
for (Object obj2 : list2) {
if (obj2 instanceof i.SelectPaymentMethod) {
obj2 = r10.j((r30 & 1) != 0 ? r10.title : null, (r30 & 2) != 0 ? r10.savedPaymentMethods : null, (r30 & 4) != 0 ? r10.paymentSelection : null, (r30 & 8) != 0 ? r10.isLiveMode : false, (r30 & 16) != 0 ? r10.isProcessing : true, (r30 & 32) != 0 ? r10.isEditing : false, (r30 & 64) != 0 ? r10.isGooglePayEnabled : false, (r30 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? r10.primaryButtonVisible : false, (r30 & 256) != 0 ? r10.primaryButtonLabel : null, (r30 & 512) != 0 ? r10.allowsRemovalOfLastSavedPaymentMethod : false, (r30 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? r10.errorMessage : null, (r30 & 2048) != 0 ? r10.unconfirmedPaymentMethod : null, (r30 & 4096) != 0 ? r10.mandateText : null, (r30 & 8192) != 0 ? ((i.SelectPaymentMethod) obj2).cbcEligibility : null);
}
arrayList.add(obj2);
}
} while (!mutableStateFlow2.compareAndSet(value, arrayList));
PaymentSelection paymentSelection = ((i.SelectPaymentMethod) value3).getPaymentSelection();
if (paymentSelection instanceof PaymentSelection.b) {
t0();
return;
}
if (!(paymentSelection instanceof PaymentSelection.Saved)) {
if (paymentSelection == null) {
u0(null);
return;
}
throw new IllegalStateException((paymentSelection + " is not supported").toString());
}
u0((PaymentSelection.Saved) paymentSelection);
}
public final java.lang.Object q0(com.stripe.android.model.PaymentMethod r6, kotlin.coroutines.Continuation<? super com.stripe.android.customersheet.a.b<com.stripe.android.model.PaymentMethod>> r7) {
throw new UnsupportedOperationException("Method not decompiled: com.stripe.android.customersheet.CustomerSheetViewModel.q0(com.stripe.android.model.PaymentMethod, kotlin.coroutines.Continuation):java.lang.Object");
}
public final void r0(PaymentMethod paymentMethod) {
BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), this.workContext, null, new CustomerSheetViewModel$removePaymentMethodFromState$1(this, paymentMethod, null), 2, null);
}
private final void s0(Function1<? super i.SelectPaymentMethod, i.SelectPaymentMethod> update) {
Object value;
ArrayList arrayList;
List<i> value2;
List<i> value3 = this.backStack.getValue();
if (!(value3 instanceof Collection) || !value3.isEmpty()) {
Iterator<T> it = value3.iterator();
while (it.hasNext()) {
if (((i) it.next()) instanceof i.SelectPaymentMethod) {
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<Object> list = (List) value;
arrayList = new ArrayList(p.y(list, 10));
for (Object obj : list) {
if (obj instanceof i.SelectPaymentMethod) {
obj = (i.SelectPaymentMethod) update.invoke((i.SelectPaymentMethod) obj);
}
arrayList.add(obj);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
return;
}
}
}
MutableStateFlow<List<i>> mutableStateFlow2 = this.backStack;
do {
value2 = mutableStateFlow2.getValue();
} while (!mutableStateFlow2.compareAndSet(value2, CollectionsKt___CollectionsKt.R0(kotlin.collections.n.e(I(update)), value2)));
}
private final void t0() {
BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), this.workContext, null, new CustomerSheetViewModel$selectGooglePay$1(this, null), 2, null);
}
private final void u0(PaymentSelection.Saved savedPaymentSelection) {
BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), this.workContext, null, new CustomerSheetViewModel$selectSavedPaymentMethod$1(this, savedPaymentSelection, null), 2, null);
}
private final void v0(i to, boolean reset) {
List<i> value;
if (to instanceof i.AddPaymentMethod) {
this.eventReporter.e(CustomerSheetEventReporter.Screen.c);
} else if (to instanceof i.SelectPaymentMethod) {
this.eventReporter.e(CustomerSheetEventReporter.Screen.d);
} else if (to instanceof i.EditPaymentMethod) {
this.eventReporter.e(CustomerSheetEventReporter.Screen.e);
}
MutableStateFlow<List<i>> mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
} while (!mutableStateFlow.compareAndSet(value, reset ? kotlin.collections.n.e(to) : CollectionsKt___CollectionsKt.S0(value, to)));
}
static void w0(CustomerSheetViewModel customerSheetViewModel, i iVar, boolean z, int i, Object obj) {
if ((i & 2) != 0) {
z = false;
}
customerSheetViewModel.v0(iVar, z);
}
private final void x0(boolean isFirstPaymentMethod, qi.a cbcEligibility) {
String str;
List<com.stripe.android.uicore.elements.o> n;
SupportedPaymentMethod supportedPaymentMethod = this.previouslySelectedPaymentMethod;
if (supportedPaymentMethod == null || (str = supportedPaymentMethod.getCode()) == null) {
str = PaymentMethod.Type.e.code;
}
String str2 = str;
com.stripe.android.paymentsheet.forms.a aVar = com.stripe.android.paymentsheet.forms.a.a;
Configuration configuration = this.configuration;
FormArguments a2 = aVar.a(str2, configuration, configuration.getMerchantDisplayName(), cbcEligibility);
SupportedPaymentMethod supportedPaymentMethod2 = this.previouslySelectedPaymentMethod;
if (supportedPaymentMethod2 == null) {
PaymentMethodMetadata paymentMethodMetadata = this.paymentMethodMetadata;
supportedPaymentMethod2 = paymentMethodMetadata != null ? paymentMethodMetadata.T(str2) : null;
if (supportedPaymentMethod2 == null) {
throw new IllegalArgumentException("Required value was null.".toString());
}
}
PaymentMethodMetadata paymentMethodMetadata2 = this.paymentMethodMetadata;
StripeIntent stripeIntent = paymentMethodMetadata2 != null ? paymentMethodMetadata2.getStripeIntent() : null;
PaymentMethodMetadata paymentMethodMetadata3 = this.paymentMethodMetadata;
if (paymentMethodMetadata3 == null || (n = paymentMethodMetadata3.e(supportedPaymentMethod2.getCode(), new d.a.InterfaceC0299a.C0300a(this.cardAccountRangeRepositoryFactory, null, null, 6, null))) == null) {
n = kotlin.collections.o.n();
}
v0(new i.AddPaymentMethod(str2, this.supportedPaymentMethods, null, n, a2, new USBankAccountFormArguments(false, null, false, false, false, stripeIntent != null ? stripeIntent.getId() : null, stripeIntent != null ? stripeIntent.getClientSecret() : null, null, null, new Function2<String, Boolean, Unit>() {
{
super(2);
}
public final void a(String str3, boolean z) {
CustomerSheetViewModel.this.V(new g.q(str3, z));
}
@Override
public Unit invoke(String str3, Boolean bool) {
a(str3, bool.booleanValue());
return Unit.a;
}
}, new Function1<PaymentSelection.d.USBankAccount, Unit>() {
{
super(1);
}
public final void a(PaymentSelection.d.USBankAccount it) {
r.i(it, "it");
CustomerSheetViewModel.this.V(new g.C0029g(it));
}
@Override
public Unit invoke(PaymentSelection.d.USBankAccount uSBankAccount) {
a(uSBankAccount);
return Unit.a;
}
}, new Function1<di.e, Unit>() {
{
super(1);
}
public final void a(di.e it) {
r.i(it, "it");
CustomerSheetViewModel.this.V(new g.f(it));
}
@Override
public Unit invoke(di.e eVar) {
a(eVar);
return Unit.a;
}
}, new Function1<Function1<? super PrimaryButton.UIState, ? extends PrimaryButton.UIState>, Unit>() {
{
super(1);
}
public final void a(Function1<? super PrimaryButton.UIState, PrimaryButton.UIState> it) {
r.i(it, "it");
CustomerSheetViewModel.this.V(new g.p(it));
}
@Override
public Unit invoke(Function1<? super PrimaryButton.UIState, ? extends PrimaryButton.UIState> function1) {
a(function1);
return Unit.a;
}
}, new Function1<PrimaryButton.State, Unit>() {
public final void a(PrimaryButton.State it) {
r.i(it, "it");
}
@Override
public Unit invoke(PrimaryButton.State state) {
a(state);
return Unit.a;
}
}, new Function1<String, Unit>() {
{
super(1);
}
public final void a(String str3) {
CustomerSheetViewModel.this.V(new g.j(str3));
}
@Override
public Unit invoke(String str3) {
a(str3);
return Unit.a;
}
}), null, true, this.isLiveModeProvider.invoke().booleanValue(), false, null, isFirstPaymentMethod, qh.c.c(i0.T, new Object[0], null, 4, null), false, null, null, false, false, null, cbcEligibility, 230400, null), isFirstPaymentMethod);
}
static void y0(CustomerSheetViewModel customerSheetViewModel, boolean z, qi.a aVar, int i, Object obj) {
if ((i & 2) != 0) {
aVar = customerSheetViewModel.viewState.getValue().getCbcEligibility();
}
customerSheetViewModel.x0(z, aVar);
}
private final void z0(final List<PaymentMethod> paymentMethods, final PaymentSelection paymentSelection, final qi.a cbcEligibility) {
if (!paymentMethods.isEmpty() || this.isGooglePayReadyAndEnabled) {
v0(I(new Function1<i.SelectPaymentMethod, i.SelectPaymentMethod>() {
{
super(1);
}
@Override
public final i.SelectPaymentMethod invoke(i.SelectPaymentMethod it) {
i.SelectPaymentMethod j;
r.i(it, "it");
j = it.j((r30 & 1) != 0 ? it.title : null, (r30 & 2) != 0 ? it.savedPaymentMethods : paymentMethods, (r30 & 4) != 0 ? it.paymentSelection : paymentSelection, (r30 & 8) != 0 ? it.isLiveMode : false, (r30 & 16) != 0 ? it.isProcessing : false, (r30 & 32) != 0 ? it.isEditing : false, (r30 & 64) != 0 ? it.isGooglePayEnabled : false, (r30 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? it.primaryButtonVisible : false, (r30 & 256) != 0 ? it.primaryButtonLabel : null, (r30 & 512) != 0 ? it.allowsRemovalOfLastSavedPaymentMethod : false, (r30 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? it.errorMessage : null, (r30 & 2048) != 0 ? it.unconfirmedPaymentMethod : null, (r30 & 4096) != 0 ? it.mandateText : null, (r30 & 8192) != 0 ? it.cbcEligibility : cbcEligibility);
return j;
}
}), true);
} else {
x0(true, cbcEligibility);
}
}
public final boolean H() {
Object value;
ArrayList arrayList;
if (!this.viewState.getValue().i(this.isFinancialConnectionsAvailable)) {
return true;
}
MutableStateFlow mutableStateFlow = this.backStack;
do {
value = mutableStateFlow.getValue();
List<Object> list = (List) value;
arrayList = new ArrayList(p.y(list, 10));
for (Object obj : list) {
if (obj instanceof i.AddPaymentMethod) {
obj = r7.j((r38 & 1) != 0 ? r7.paymentMethodCode : null, (r38 & 2) != 0 ? r7.supportedPaymentMethods : null, (r38 & 4) != 0 ? r7.formFieldValues : null, (r38 & 8) != 0 ? r7.formElements : null, (r38 & 16) != 0 ? r7.formArguments : null, (r38 & 32) != 0 ? r7.usBankAccountFormArguments : null, (r38 & 64) != 0 ? r7.draftPaymentSelection : null, (r38 & WorkQueueKt.BUFFER_CAPACITY) != 0 ? r7.enabled : false, (r38 & 256) != 0 ? r7.isLiveMode : false, (r38 & 512) != 0 ? r7.isProcessing : false, (r38 & LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY) != 0 ? r7.errorMessage : null, (r38 & 2048) != 0 ? r7.isFirstPaymentMethod : false, (r38 & 4096) != 0 ? r7.primaryButtonLabel : null, (r38 & 8192) != 0 ? r7.primaryButtonEnabled : false, (r38 & 16384) != 0 ? r7.customPrimaryButtonUiState : null, (r38 & 32768) != 0 ? r7.mandateText : null, (r38 & 65536) != 0 ? r7.showMandateAbovePrimaryButton : false, (r38 & 131072) != 0 ? r7.displayDismissConfirmationModal : true, (r38 & 262144) != 0 ? r7.bankAccountResult : null, (r38 & 524288) != 0 ? ((i.AddPaymentMethod) obj).cbcEligibility : null);
}
arrayList.add(obj);
}
} while (!mutableStateFlow.compareAndSet(value, arrayList));
return false;
}
public final StateFlow<n> P() {
return this.result;
}
public final StateFlow<i> Q() {
return this.viewState;
}
public final void V(g viewAction) {
r.i(viewAction, "viewAction");
if (viewAction instanceof g.h) {
f0();
return;
}
if (viewAction instanceof g.a) {
Y();
return;
}
if (viewAction instanceof g.e) {
c0();
return;
}
if (viewAction instanceof g.c) {
a0();
return;
}
if (viewAction instanceof g.i) {
g0();
return;
}
if (viewAction instanceof g.l) {
j0(((g.l) viewAction).getPaymentMethod());
return;
}
if (viewAction instanceof g.n) {
l0(((g.n) viewAction).getPaymentMethod());
return;
}
if (viewAction instanceof g.m) {
k0(((g.m) viewAction).getSelection());
return;
}
if (viewAction instanceof g.o) {
n0();
return;
}
if (viewAction instanceof g.b) {
Z(((g.b) viewAction).getPaymentMethod());
return;
}
if (viewAction instanceof g.k) {
i0(((g.k) viewAction).getFormFieldValues());
return;
}
if (viewAction instanceof g.p) {
A0(((g.p) viewAction).a());
return;
}
if (viewAction instanceof g.q) {
g.q qVar = (g.q) viewAction;
B0(qVar.getMandateText(), qVar.getShowAbovePrimaryButton());
return;
}
if (viewAction instanceof g.f) {
d0(((g.f) viewAction).getBankAccountResult());
return;
}
if (viewAction instanceof g.C0029g) {
e0(((g.C0029g) viewAction).getUsBankAccount());
} else if (viewAction instanceof g.j) {
h0(((g.j) viewAction).getError());
} else if (viewAction instanceof g.d) {
b0();
}
}
public final String o0(String code) {
qh.b displayName;
String str = null;
if (code != null) {
PaymentMethodMetadata paymentMethodMetadata = this.paymentMethodMetadata;
SupportedPaymentMethod T = paymentMethodMetadata != null ? paymentMethodMetadata.T(code) : null;
if (T != null && (displayName = T.getDisplayName()) != null) {
str = displayName.a(this.application);
}
}
return str == null ? "" : str;
}
public final void p0(ActivityResultCaller activityResultCaller, LifecycleOwner lifecycleOwner) {
r.i(activityResultCaller, "activityResultCaller");
r.i(lifecycleOwner, "lifecycleOwner");
ActivityResultLauncher<c.a> registerForActivityResult = activityResultCaller.registerForActivityResult(new com.stripe.android.payments.paymentlauncher.c(), new c(PaymentLauncherUtilsKt.a(new CustomerSheetViewModel$registerFromActivity$launcher$1(this))));
r.h(registerForActivityResult, "registerForActivityResult(...)");
this.paymentLauncher = this.paymentLauncherFactory.a(new Function0<String>() {
{
super(0);
}
@Override
public final String invoke() {
fj.a aVar;
aVar = CustomerSheetViewModel.this.paymentConfigurationProvider;
return ((o) aVar.get()).e();
}
}, new Function0<String>() {
{
super(0);
}
@Override
public final String invoke() {
fj.a aVar;
aVar = CustomerSheetViewModel.this.paymentConfigurationProvider;
return ((o) aVar.get()).g();
}
}, this.statusBarColor, true, registerForActivityResult);
lifecycleOwner.getLifecycle().addObserver(new b(registerForActivityResult, this));
}
public CustomerSheetViewModel(Application application, List<i> initialBackStack, PaymentSelection paymentSelection, fj.a<o> paymentConfigurationProvider, Resources resources, Configuration configuration, lh.d logger, com.stripe.android.networking.m stripeRepository, Integer num, CustomerSheetEventReporter eventReporter, CoroutineContext workContext, Function0<Boolean> isLiveModeProvider, com.stripe.android.payments.paymentlauncher.g paymentLauncherFactory, com.stripe.android.paymentsheet.n intentConfirmationInterceptor, e customerSheetLoader, com.stripe.android.payments.financialconnections.c isFinancialConnectionsAvailable, e.a editInteractorFactory) {
this(application, initialBackStack, paymentSelection, paymentConfigurationProvider, th.a.a.a(), resources, configuration, logger, stripeRepository, num, eventReporter, workContext, isLiveModeProvider, paymentLauncherFactory, intentConfirmationInterceptor, customerSheetLoader, isFinancialConnectionsAvailable, editInteractorFactory);
r.i(application, "application");
r.i(initialBackStack, "initialBackStack");
r.i(paymentConfigurationProvider, "paymentConfigurationProvider");
r.i(resources, "resources");
r.i(configuration, "configuration");
r.i(logger, "logger");
r.i(stripeRepository, "stripeRepository");
r.i(eventReporter, "eventReporter");
r.i(workContext, "workContext");
r.i(isLiveModeProvider, "isLiveModeProvider");
r.i(paymentLauncherFactory, "paymentLauncherFactory");
r.i(intentConfirmationInterceptor, "intentConfirmationInterceptor");
r.i(customerSheetLoader, "customerSheetLoader");
r.i(isFinancialConnectionsAvailable, "isFinancialConnectionsAvailable");
r.i(editInteractorFactory, "editInteractorFactory");
}
}