Chromium.apk(点击下载) / RK0.java


package defpackage;

import J.N;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.a.b;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.chromium.base.ThreadUtils;
import org.chromium.chrome.browser.app.ChromeActivity;
import org.chromium.chrome.browser.autofill.PersonalDataManager;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.tabmodel.TabModel;
import org.chromium.chrome.stable.R;
import org.chromium.components.payments.PayerData;
import org.chromium.components.payments.PaymentApp;
import org.chromium.components.payments.PaymentRequestSpec;
import org.chromium.components.payments.PaymentRequestUpdateEventListener;
import org.chromium.components.payments.PaymentRequestUpdateEventListener$$CC;
import org.chromium.content_public.browser.RenderFrameHost;
import org.chromium.content_public.browser.WebContents;
import org.chromium.ui.base.WindowAndroid;
import org.chromium.url.Origin;

/* renamed from: RK0  reason: default package */
/* compiled from: chromium-ChromePublic.apk-stable-447210115 */
public class RK0 extends AbstractC3996nJ0 implements AbstractC3648lJ0, PaymentRequestUpdateEventListener, AbstractC2953hJ0, AbstractC3127iJ0, AbstractC5393vL0 {

    /* renamed from: J  reason: collision with root package name */
    public static RK0 f8033J;
    public AbstractC0872Nm A;
    public AbstractC5567wL0 B;
    public HashMap C;
    public boolean D;
    public boolean E;
    public boolean F;
    public boolean G;
    public boolean H;
    public PaymentApp I;
    public final Runnable a;
    public final RenderFrameHost b;
    public final QK0 c;
    public final List d = new ArrayList();
    public WebContents e;
    public C4735rc0 f;
    public String g;
    public String h;
    public Origin i;
    public String j;
    public byte[][] k;
    public boolean l;
    public C3651lK0 m;
    public boolean n;
    public boolean o;
    public boolean p;
    public boolean q;
    public int r;
    public PaymentRequestSpec s;
    public boolean t;
    public boolean u;
    public boolean v;
    public boolean w;
    public String x;
    public boolean y;
    public AbstractC4173oK0 z;

    public RK0(RenderFrameHost renderFrameHost, AbstractC4173oK0 ok0, Runnable runnable, QK0 qk0) {
        this.b = renderFrameHost;
        this.z = ok0;
        this.a = runnable;
        this.c = qk0;
        this.t = false;
    }

    public void A(String str) {
        this.I = null;
        AbstractC0872Nm nm = this.A;
        if (nm != null) {
            C1016Pu pu = (C1016Pu) nm;
            ML0 ml0 = pu.f;
            if (ml0.f0 != null) {
                pu.e.a(0);
                ML0 ml02 = pu.f;
                RunnableC0888Nu nu = new RunnableC0888Nu(pu);
                ml02.f0.a.g(new C5915yL0(nu), null, Integer.valueOf((int) R.string.f61610_resource_name_obfuscated_RES_2131953306));
            } else if (pu.n) {
                pu.e.a(0);
                pu.d(str);
            } else {
                View$OnClickListenerC2785gL0 gl0 = ml0.S;
                if (gl0 != null) {
                    gl0.b0 = false;
                    gl0.a(false);
                    gl0.C.a();
                    gl0.t();
                }
                AJ0.a().d();
            }
        }
    }

    public void B(String str, String str2, PayerData payerData) {
        AbstractC0872Nm nm;
        View$OnClickListenerC2785gL0 gl0;
        if (this.B != null && (nm = this.A) != null) {
            C1016Pu pu = (C1016Pu) nm;
            PaymentApp q2 = pu.f.q();
            if (q2 != null && q2.q() == 1 && !q2.E.isEmpty()) {
                PersonalDataManager e2 = PersonalDataManager.e();
                String str3 = q2.E;
                Objects.requireNonNull(e2);
                Object obj = ThreadUtils.a;
                N.M4tBhXBK(e2.a, e2, str3);
            }
            if (pu.n && (gl0 = pu.f.S) != null) {
                gl0.b0 = true;
                gl0.a(true);
                gl0.C.a();
            }
            C4735rc0 rc0 = this.f;
            N.MsVk_59O(rc0.a, rc0);
            C1080Qu qu = (C1080Qu) this.B;
            qu.E = this;
            C5219uL0 ul0 = qu.C;
            ul0.b = str;
            ul0.c = str2;
            qu.H = payerData;
            qu.G = false;
            if (!qu.F) {
                qu.a();
            }
        }
    }

    public void C(C2431eJ0 ej0) {
        if (this.z != null) {
            if (BJ0.a("WebPaymentsRedactShippingAddress")) {
                ej0.i = "";
                ej0.k = "";
                ej0.j = "";
                ej0.c = new String[0];
            }
            ((BK0) this.z).l0(ej0);
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:150:0x0348  */
    /* JADX WARNING: Removed duplicated region for block: B:153:0x0360  */
    /* JADX WARNING: Removed duplicated region for block: B:174:0x03d8  */
    /* JADX WARNING: Removed duplicated region for block: B:176:0x03e0  */
    /* JADX WARNING: Removed duplicated region for block: B:193:0x0378 A[SYNTHETIC] */
    /* JADX WARNING: Removed duplicated region for block: B:43:0x011b A[RETURN] */
    /* JADX WARNING: Removed duplicated region for block: B:44:0x011c  */
    /* JADX WARNING: Removed duplicated region for block: B:89:0x01c6  */
    /* JADX WARNING: Removed duplicated region for block: B:90:0x01ca  */
    public final C3477kK0 D() {
        C3477kK0 kk0;
        boolean z2;
        ChromeActivity J0;
        String str;
        String E2;
        AbstractC0674Kj1 kj1;
        TabModel tabModel;
        boolean z3;
        String str2;
        C2206d2 d2Var;
        boolean z4;
        int i2;
        String str3;
        String str4;
        if (this.E) {
            ML0 ml0 = ((C1016Pu) this.A).f;
            I11 i11 = ml0.V;
            if ((i11 != null && !i11.f()) || ml0.U) {
                if (this.y) {
                    if ((((C5871y61) this.s.a()).e("basic-card") >= 0) && !this.D && !this.F && BJ0.a("StrictHasEnrolledAutofillInstrument")) {
                        this.x = "User does not have valid information on file.";
                        StringBuilder sb = new StringBuilder();
                        C0195Da da = (C0195Da) ((b) this.s.a()).keySet();
                        sb.append(N.M48LriN_((String[]) da.toArray(new String[da.size()])));
                        sb.append(" ");
                        sb.append(this.x);
                        kk0 = new C3477kK0(3, sb.toString(), 2);
                        if (kk0 != null) {
                            return kk0;
                        }
                        PaymentApp q2 = ((C1016Pu) this.A).f.q();
                        List b2 = this.A.b();
                        if (N.M1X7xdZV("WebPaymentsSingleAppUiSkip")) {
                            ArrayList arrayList = (ArrayList) b2;
                            if (arrayList.size() >= 1) {
                                C3651lK0 d2 = this.s.d();
                                if (AbstractC3825mK0.a(d2)) {
                                    int i3 = 0;
                                    boolean z5 = false;
                                    while (true) {
                                        if (i3 >= arrayList.size()) {
                                            z4 = z5;
                                            break;
                                        }
                                        PaymentApp paymentApp = (PaymentApp) arrayList.get(i3);
                                        if ((!d2.e || paymentApp.v()) && ((!d2.b || paymentApp.t()) && ((!d2.d || paymentApp.u()) && (!d2.c || paymentApp.s())))) {
                                            if (z5) {
                                                break;
                                            }
                                            z5 = true;
                                        }
                                        i3++;
                                    }
                                    z2 = true;
                                    AbstractC0872Nm nm = this.A;
                                    boolean z6 = this.w;
                                    this.s.f();
                                    C1016Pu pu = (C1016Pu) nm;
                                    AbstractC0952Ou ou = pu.c;
                                    WebContents webContents = pu.d;
                                    Objects.requireNonNull(ou);
                                    J0 = ChromeActivity.J0(webContents);
                                    str = "Unable to find Chrome tab.";
                                    if (J0 != null) {
                                    }
                                    if (str == null) {
                                    }
                                } else if (arrayList.size() == 1 && ((PaymentApp) arrayList.get(0)).q() != 1) {
                                    z4 = true;
                                    if (z4 && q2 != null && (this.y || !q2.A())) {
                                        z2 = true;
                                        AbstractC0872Nm nm2 = this.A;
                                        boolean z62 = this.w;
                                        this.s.f();
                                        C1016Pu pu2 = (C1016Pu) nm2;
                                        AbstractC0952Ou ou2 = pu2.c;
                                        WebContents webContents2 = pu2.d;
                                        Objects.requireNonNull(ou2);
                                        J0 = ChromeActivity.J0(webContents2);
                                        str = "Unable to find Chrome tab.";
                                        if (J0 != null) {
                                            str = "Unable to find Chrome activity.";
                                        } else {
                                            AbstractC0952Ou ou3 = pu2.c;
                                            WebContents webContents3 = pu2.d;
                                            Objects.requireNonNull(ou3);
                                            ChromeActivity J02 = ChromeActivity.J0(webContents3);
                                            if (J02 == null) {
                                                kj1 = null;
                                            } else {
                                                kj1 = J02.b1();
                                            }
                                            if (kj1 != null) {
                                                AbstractC0952Ou ou4 = pu2.c;
                                                WebContents webContents4 = pu2.d;
                                                Objects.requireNonNull(ou4);
                                                ChromeActivity J03 = ChromeActivity.J0(webContents4);
                                                if (J03 == null) {
                                                    tabModel = null;
                                                } else {
                                                    tabModel = J03.T0();
                                                }
                                                if (tabModel != null) {
                                                    ML0 ml02 = pu2.f;
                                                    AbstractC0952Ou ou5 = pu2.c;
                                                    RenderFrameHost renderFrameHost = pu2.b;
                                                    Objects.requireNonNull(ou5);
                                                    WebContents a2 = SK0.a(renderFrameHost);
                                                    boolean z7 = a2 != null && a2.r() == 2;
                                                    Objects.requireNonNull(ml02);
                                                    if (!z7) {
                                                        str2 = "Cannot show PaymentRequest UI in a background tab.";
                                                    } else if (ml02.Q.e()) {
                                                        str2 = "Payment request is aborting.";
                                                    } else {
                                                        AbstractC0674Kj1 kj12 = ml02.c0;
                                                        if (kj12 != null) {
                                                            ((AbstractC0801Mj1) kj12).f.c(ml02.C);
                                                        }
                                                        ml02.c0 = kj1;
                                                        ((AbstractC0801Mj1) kj1).c(ml02.C);
                                                        TabModel tabModel2 = ml02.d0;
                                                        if (tabModel2 != null) {
                                                            tabModel2.P(ml02.D);
                                                        }
                                                        ml02.d0 = tabModel;
                                                        tabModel.A(ml02.D);
                                                        AbstractC2311df0 df0 = (AbstractC2311df0) AbstractC0146Cf0.a.e(ml02.f8017J.J().L);
                                                        if (df0 != null) {
                                                            AbstractC2311df0 df02 = ml02.e0;
                                                            if (df02 != null) {
                                                                ((C0016Af0) df02).f7992J.c(ml02);
                                                            }
                                                            C0016Af0 af0 = (C0016Af0) df0;
                                                            AbstractC1963bf0 bf0 = af0.L;
                                                            if (bf0 != null && bf0.m() == 1) {
                                                                str2 = "Tab overview mode dismissed Payment Request UI.";
                                                            } else {
                                                                ml02.e0 = df0;
                                                                af0.f7992J.b(ml02);
                                                            }
                                                        }
                                                        if (ml02.w()) {
                                                            ml02.X = new TA(J0, ml02.a0, ml02.E, ml02.R);
                                                        }
                                                        ml02.S = new View$OnClickListenerC2785gL0(J0, ml02, ml02.U, !K51.a.e("payment_complete_once", false), ml02.L, ml02.K, AbstractC1677a21.a(ml02.f8017J), new R51(ml02.Q.b().f), ml02.P, Profile.a(ml02.f8017J));
                                                        C1016Pu pu3 = (C1016Pu) ml02.I;
                                                        AbstractC0952Ou ou6 = pu3.c;
                                                        WebContents webContents5 = pu3.d;
                                                        Objects.requireNonNull(ou6);
                                                        ChromeActivity J04 = ChromeActivity.J0(webContents5);
                                                        if (J04 == null) {
                                                            d2Var = null;
                                                        } else {
                                                            d2Var = J04.P;
                                                        }
                                                        if (d2Var != null) {
                                                            d2Var.b(ml02.S);
                                                        }
                                                        PV pv = new PV();
                                                        pv.c(Profile.a(ml02.f8017J), ml02.f8017J.d().h(), J0.getResources().getDimensionPixelSize(R.dimen.f24670_resource_name_obfuscated_RES_2131166068), new CL0(ml02, pv));
                                                        if (ml02.Q.b().e) {
                                                            ml02.S.U.f0 = ml02;
                                                        }
                                                        ml02.N.b(ml02.S.F);
                                                        ml02.O.b(ml02.S.G);
                                                        XA xa = ml02.E;
                                                        if (xa != null) {
                                                            xa.b(ml02.S.F);
                                                        }
                                                        str = null;
                                                        if (str == null) {
                                                            Iterator it = ((C0195Da) ((b) pu2.i.a()).keySet()).iterator();
                                                            while (true) {
                                                                if (!it.hasNext()) {
                                                                    String str5 = (String) it.next();
                                                                    if (str5.startsWith("https://") || str5.startsWith("http://")) {
                                                                        z3 = true;
                                                                    }
                                                                    if (!it.hasNext()) {
                                                                        z3 = false;
                                                                        break;
                                                                    }
                                                                }
                                                            }
                                                            if (!z3) {
                                                                Objects.requireNonNull(pu2.c);
                                                                z2 = false;
                                                            }
                                                            if (pu2.l != null) {
                                                                z2 = true;
                                                            }
                                                            if (z2) {
                                                                pu2.n = true;
                                                            } else {
                                                                View$OnClickListenerC2785gL0 gl0 = pu2.f.S;
                                                                if (gl0 != null) {
                                                                    C3659lN lNVar = gl0.E;
                                                                    ViewGroup viewGroup = gl0.H;
                                                                    Objects.requireNonNull(lNVar);
                                                                    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -2);
                                                                    layoutParams.gravity = 81;
                                                                    lNVar.b.addView(viewGroup, layoutParams);
                                                                    viewGroup.addOnLayoutChangeListener(new View$OnLayoutChangeListenerC3311jN(lNVar, null));
                                                                    gl0.C.a();
                                                                    ML0 ml03 = (ML0) gl0.A;
                                                                    ml03.G = new WK0(gl0);
                                                                    if (!z62) {
                                                                        ml03.A.post(new DL0(ml03));
                                                                    }
                                                                }
                                                                C4735rc0 rc0 = pu2.e;
                                                                N.MaXgMPsk(rc0.a, rc0);
                                                            }
                                                            str = null;
                                                        }
                                                    }
                                                    str = str2;
                                                    if (str == null) {
                                                    }
                                                }
                                            }
                                        }
                                        if (str == null) {
                                            return new C3477kK0(3, str, 2);
                                        }
                                        if (!this.w && (E2 = E()) != null) {
                                            return new C3477kK0(3, E2, 2);
                                        }
                                        return null;
                                    }
                                }
                                z4 = false;
                                z2 = true;
                                AbstractC0872Nm nm22 = this.A;
                                boolean z622 = this.w;
                                this.s.f();
                                C1016Pu pu22 = (C1016Pu) nm22;
                                AbstractC0952Ou ou22 = pu22.c;
                                WebContents webContents22 = pu22.d;
                                Objects.requireNonNull(ou22);
                                J0 = ChromeActivity.J0(webContents22);
                                str = "Unable to find Chrome tab.";
                                if (J0 != null) {
                                }
                                if (str == null) {
                                }
                            }
                        }
                        z2 = false;
                        AbstractC0872Nm nm222 = this.A;
                        boolean z6222 = this.w;
                        this.s.f();
                        C1016Pu pu222 = (C1016Pu) nm222;
                        AbstractC0952Ou ou222 = pu222.c;
                        WebContents webContents222 = pu222.d;
                        Objects.requireNonNull(ou222);
                        J0 = ChromeActivity.J0(webContents222);
                        str = "Unable to find Chrome tab.";
                        if (J0 != null) {
                        }
                        if (str == null) {
                        }
                    }
                }
                kk0 = null;
                if (kk0 != null) {
                }
            }
        }
        int i4 = !this.E ? 1 : 0;
        if (((C0505Hu) this.c).c()) {
            str3 = "User closed the Payment Request UI.";
            i2 = 1;
        } else {
            if (TextUtils.isEmpty(this.x) && !(!TextUtils.isEmpty(((C0505Hu) this.c).b())) && ((C5871y61) this.s.a()).getOrDefault("https://play.9oo91e.qjz9zk/billing", null) != null) {
                this.x = "Payment method https://play.9oo91e.qjz9zk/billing is only supported in Trusted Web Activity.";
            }
            StringBuilder sb2 = new StringBuilder();
            C0195Da da2 = (C0195Da) ((b) this.s.a()).keySet();
            sb2.append(N.M48LriN_((String[]) da2.toArray(new String[da2.size()])));
            if (TextUtils.isEmpty(this.x)) {
                str4 = "";
            } else {
                StringBuilder a3 = AbstractC5933yT0.a(" ");
                a3.append(this.x);
                str4 = a3.toString();
            }
            sb2.append(str4);
            str3 = sb2.toString();
            i2 = 2;
        }
        kk0 = new C3477kK0(i4, str3, i2);
        if (kk0 != null) {
        }
    }

    public final String E() {
        WindowAndroid windowAndroid;
        View$OnClickListenerC2785gL0 gl0;
        boolean z2;
        PaymentApp q2;
        C4735rc0 rc0 = this.f;
        N.M7kt1TFI(rc0.a, rc0, this.s.f().c.b, this.s.f().c.c, false);
        AbstractC0872Nm nm = this.A;
        boolean z3 = this.y;
        C1016Pu pu = (C1016Pu) nm;
        AbstractC0952Ou ou = pu.c;
        RenderFrameHost renderFrameHost = pu.b;
        Objects.requireNonNull(ou);
        WebContents a2 = SK0.a(renderFrameHost);
        String str = null;
        if (a2 == null) {
            windowAndroid = null;
        } else {
            windowAndroid = a2.J();
        }
        if (windowAndroid == null) {
            return "Unable to find Chrome window.";
        }
        Context a3 = pu.c.a(pu.b);
        if (a3 == null) {
            return "Unable to find Chrome context.";
        }
        if (pu.n) {
            if ((!z3 || ((ArrayList) pu.f.o()).size() != 1 || (q2 = pu.f.q()) == null || !q2.y() || TextUtils.isEmpty(q2.h())) ? false : N.M1X7xdZV("WebPaymentsMinimalUI")) {
                ML0 ml0 = pu.f;
                C2261dK0 f2 = pu.i.f();
                C0633Ju ju = new C0633Ju(pu);
                C0697Ku ku = new C0697Ku(pu);
                C0760Lu lu = new C0760Lu(pu);
                Objects.requireNonNull(ml0);
                Context context = (Context) windowAndroid.B.get();
                if (context == null) {
                    z2 = false;
                } else {
                    LL0 ll0 = ml0.P;
                    ll0.a = true;
                    ll0.b();
                    ml0.f0 = new C0759Lt0();
                    PaymentApp q3 = ml0.q();
                    C0759Lt0 lt0 = ml0.f0;
                    C0084Bg0 bg0 = ml0.T.a;
                    Objects.requireNonNull(lt0);
                    Map c2 = UR0.c(AbstractC1463Wt0.p);
                    TR0 tr0 = AbstractC1463Wt0.n;
                    String a4 = ((C5200uF) ml0.M.get(f2.c.b)).a(q3.h());
                    LR0 lr0 = new LR0(null);
                    lr0.a = a4;
                    HashMap hashMap = (HashMap) c2;
                    hashMap.put(tr0, lr0);
                    OR0 or0 = AbstractC1463Wt0.b;
                    String str2 = bg0.c;
                    LR0 lr02 = new LR0(null);
                    lr02.a = str2;
                    hashMap.put(or0, lr02);
                    OR0 or02 = AbstractC1463Wt0.c;
                    String str3 = bg0.b;
                    LR0 lr03 = new LR0(null);
                    lr03.a = str3;
                    hashMap.put(or02, lr03);
                    QR0 qr0 = AbstractC1463Wt0.e;
                    GR0 gr0 = new GR0(null);
                    gr0.a = true;
                    hashMap.put(qr0, gr0);
                    QR0 qr02 = AbstractC1463Wt0.i;
                    GR0 gr02 = new GR0(null);
                    gr02.a = true;
                    hashMap.put(qr02, gr02);
                    QR0 qr03 = AbstractC1463Wt0.f;
                    GR0 gr03 = new GR0(null);
                    gr03.a = false;
                    hashMap.put(qr03, gr03);
                    OR0 or03 = AbstractC1463Wt0.a;
                    Drawable drawable = q3.F;
                    LR0 lr04 = new LR0(null);
                    lr04.a = drawable;
                    hashMap.put(or03, lr04);
                    OR0 or04 = AbstractC1463Wt0.d;
                    String a5 = q3.a();
                    LR0 lr05 = new LR0(null);
                    lr05.a = a5;
                    UR0 a6 = AbstractC2175cs.a(hashMap, or04, lr05, c2, null);
                    View$OnClickListenerC1399Vt0 vt0 = new View$OnClickListenerC1399Vt0(context, q3, a6, ju, ku, lu, new RunnableC0504Ht0(lt0));
                    lt0.a = vt0;
                    C1381Vl vl = (C1381Vl) ((AbstractC0933Ol) AbstractC1509Xl.a.e(windowAndroid.L));
                    vl.E(vt0);
                    C1527Xt0 xt0 = new C1527Xt0(context);
                    xt0.e.setOnClickListener(lt0.a);
                    xt0.d.setOnClickListener(lt0.a);
                    lt0.b = new RunnableC0632Jt0(lt0, ZR0.a(a6, xt0, new C0568It0()), vl, xt0);
                    z2 = vl.U(xt0, true);
                }
                if (!z2) {
                    return "Payment minimal UI suppressed.";
                }
                C4735rc0 rc02 = pu.e;
                N.MaXgMPsk(rc02.a, rc02);
                return null;
            }
            PaymentApp q4 = pu.f.q();
            if ((q4 == null || q4.q() != 3) && (gl0 = pu.f.S) != null) {
                gl0.C.a();
            }
            C4735rc0 rc03 = pu.e;
            N.M8$wRelg(rc03.a, rc03);
            str = null;
            pu.f(null, null, q4);
        } else {
            ML0 ml02 = pu.f;
            if (ml02.x()) {
                ml02.f(a3);
            }
        }
        return str;
    }

    public final void F(int i2, String str, int i3) {
        C4735rc0 rc0 = this.f;
        if (!rc0.b) {
            rc0.b = true;
            N.MPhEgSJd(rc0.a, rc0, i2);
        }
        AbstractC4173oK0 ok0 = this.z;
        if (ok0 != null) {
            ((BK0) ok0).g0(i3, str);
        }
        w();
    }

    public void G() {
        if (this.z != null) {
            boolean z2 = false;
            this.G = false;
            int i2 = (!this.E || !((C0505Hu) this.c).d()) ? 0 : 1;
            ((BK0) this.z).e0(i2 ^ 1);
            C4735rc0 rc0 = this.f;
            if (i2 != 0 || this.l) {
                z2 = true;
            }
            N.MzcQanKX(rc0.a, rc0, z2);
        }
    }

    public void H() {
        int i2;
        if (this.z != null) {
            boolean z2 = this.D;
            boolean z3 = false;
            this.H = false;
            if (N.MNXjZ6_e(this.e, this.g, this.h, this.C)) {
                i2 = !z2 ? 1 : 0;
            } else {
                i2 = this.e.h() || !N.MSVZEfSr(this.e.d()) ? 2 : z2 ? 3 : 4;
            }
            ((BK0) this.z).h0(i2);
            C4735rc0 rc0 = this.f;
            if (z2 || this.l) {
                z3 = true;
            }
            N.Ma1hMajT(rc0.a, rc0, z3);
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:37:0x00e6  */
    /* JADX WARNING: Removed duplicated region for block: B:45:0x0126  */
    /* JADX WARNING: Removed duplicated region for block: B:51:0x013a  */
    /* JADX WARNING: Removed duplicated region for block: B:54:0x0141  */
    /* JADX WARNING: Removed duplicated region for block: B:63:? A[RETURN, SYNTHETIC] */
    @Override // defpackage.AbstractC3648lJ0
    public void a(AbstractC3822mJ0 mj0) {
        int i2;
        C3477kK0 D2;
        if (this.A != null) {
            this.u = true;
            this.D &= ((C0505Hu) this.c).d();
            AbstractC0872Nm nm = this.A;
            List list = this.d;
            C1016Pu pu = (C1016Pu) nm;
            boolean z2 = false;
            if (pu.j) {
                ArrayList arrayList = new ArrayList();
                int size = list.size();
                for (int i3 = 0; i3 < size; i3++) {
                    if (!((PaymentApp) list.get(i3)).z()) {
                        arrayList.add((PaymentApp) list.get(i3));
                    }
                }
                list = arrayList;
            }
            HashSet hashSet = new HashSet();
            for (int i4 = 0; i4 < list.size(); i4++) {
                String o2 = ((PaymentApp) list.get(i4)).o();
                if (o2 != null && !hashSet.contains(o2)) {
                    hashSet.add(o2);
                    PersonalDataManager e2 = PersonalDataManager.e();
                    Objects.requireNonNull(e2);
                    Object obj = ThreadUtils.a;
                    N.Mj65Bkg_(e2.a, e2, o2);
                }
            }
            ML0 ml0 = pu.f;
            Collections.sort(list, ml0.y);
            ml0.V = new I11(4, (list.isEmpty() || !((PaymentApp) list.get(0)).j()) ? -1 : 0, new ArrayList(list));
            ml0.A();
            Objects.requireNonNull(F31.a());
            ((ArrayList) F31.a).add(ml0);
            if (!((ArrayList) pu.f.o()).isEmpty()) {
                PaymentApp paymentApp = (PaymentApp) ((ArrayList) pu.f.o()).get(0);
                if (paymentApp.q() == 1) {
                    i2 = ((C1619Zf) paymentApp).I();
                    if (i2 != 0) {
                    }
                    this.d.clear();
                    C4735rc0 rc0 = this.f;
                    int size2 = ((ArrayList) this.A.b()).size();
                    ArrayList arrayList2 = (ArrayList) ((C1016Pu) this.A).f.o();
                    z2 = true;
                    rc0.b(1, size2, z2);
                    if (this.v) {
                    }
                    if (this.G) {
                    }
                    if (this.H) {
                    }
                }
            } else if (pu.f.U) {
                i2 = 15;
                if (i2 != 0) {
                    AbstractC3274jA1.a.d("PaymentRequest.MissingPaymentFields", i2);
                }
                this.d.clear();
                C4735rc0 rc02 = this.f;
                int size22 = ((ArrayList) this.A.b()).size();
                ArrayList arrayList22 = (ArrayList) ((C1016Pu) this.A).f.o();
                if (!arrayList22.isEmpty() && ((PaymentApp) arrayList22.get(0)).d()) {
                    z2 = true;
                }
                rc02.b(1, size22, z2);
                if (this.v || (D2 = D()) == null) {
                    if (this.G) {
                        G();
                    }
                    if (this.H) {
                        H();
                        return;
                    }
                    return;
                }
                F(D2.a, D2.b, D2.c);
                return;
            }
            i2 = 0;
            if (i2 != 0) {
            }
            this.d.clear();
            C4735rc0 rc022 = this.f;
            int size222 = ((ArrayList) this.A.b()).size();
            ArrayList arrayList222 = (ArrayList) ((C1016Pu) this.A).f.o();
            z2 = true;
            rc022.b(1, size222, z2);
            if (this.v) {
            }
            if (this.G) {
            }
            if (this.H) {
            }
        }
    }

    @Override // defpackage.FK0
    public C3651lK0 b() {
        return this.m;
    }

    @Override // org.chromium.components.payments.PaymentRequestUpdateEventListener
    public boolean c(C2431eJ0 ej0) {
        PaymentApp paymentApp;
        if (ej0 == null || (paymentApp = this.I) == null || paymentApp.C() || !this.n || this.z == null) {
            return false;
        }
        C(ej0);
        return true;
    }

    @Override // org.chromium.components.payments.PaymentRequestUpdateEventListener
    public boolean changePaymentMethodFromInvokedApp(String str, String str2) {
        PaymentApp paymentApp;
        AbstractC4173oK0 ok0;
        if (TextUtils.isEmpty(str) || str2 == null || (paymentApp = this.I) == null || paymentApp.C() || (ok0 = this.z) == null) {
            return false;
        }
        ((BK0) ok0).j0(str, str2);
        return true;
    }

    @Override // org.chromium.components.payments.PaymentRequestUpdateEventListener
    public boolean changeShippingAddress(ByteBuffer byteBuffer) {
        return PaymentRequestUpdateEventListener$$CC.changeShippingAddress$$dflt$$(this, byteBuffer);
    }

    @Override // org.chromium.components.payments.PaymentRequestUpdateEventListener
    public boolean changeShippingOptionFromInvokedApp(String str) {
        PaymentApp paymentApp;
        boolean z2;
        if (TextUtils.isEmpty(str) || (paymentApp = this.I) == null || paymentApp.C() || !this.n || this.s.e() == null || this.z == null) {
            return false;
        }
        Iterator it = this.s.e().iterator();
        while (true) {
            if (it.hasNext()) {
                if (str.equals(((C5741xL0) it.next()).b)) {
                    z2 = true;
                    break;
                }
            } else {
                z2 = false;
                break;
            }
        }
        if (!z2) {
            return false;
        }
        ((BK0) this.z).m0(str);
        return true;
    }

    @Override // defpackage.AbstractC3648lJ0
    public AbstractC3996nJ0 d() {
        return this;
    }

    @Override // defpackage.FK0
    public boolean e() {
        return this.t;
    }

    @Override // defpackage.FK0
    public C2261dK0 f() {
        return this.s.f();
    }

    @Override // defpackage.FK0
    public Map g() {
        return Collections.unmodifiableMap(this.s.b());
    }

    @Override // defpackage.FK0
    public Map h() {
        return this.s.a();
    }

    @Override // defpackage.AbstractC3648lJ0
    public void i(boolean z2) {
        this.E = z2;
        if (this.G) {
            G();
        }
    }

    @Override // defpackage.AbstractC3648lJ0
    public void j(PaymentApp paymentApp) {
        AbstractC0872Nm nm = this.A;
        if (nm != null) {
            C1016Pu pu = (C1016Pu) nm;
            boolean z2 = pu.j;
            Objects.requireNonNull(paymentApp);
            pu.j = z2 | false;
            paymentApp.I = pu.f.Z;
            this.D |= paymentApp.i();
            this.F |= paymentApp.q() != 1;
            if (paymentApp.q() == 1) {
                C4735rc0 rc0 = this.f;
                N.MH8h6Eyr(rc0.a, rc0, 0);
            } else if (paymentApp.p().contains("https://9oo91e.qjz9zk/pay") || paymentApp.p().contains("https://8n6r01d.qjz9zk/pay")) {
                C4735rc0 rc02 = this.f;
                N.MH8h6Eyr(rc02.a, rc02, 1);
            } else {
                C4735rc0 rc03 = this.f;
                N.MH8h6Eyr(rc03.a, rc03, 4);
            }
            this.d.add(paymentApp);
        }
    }

    @Override // defpackage.AbstractC3648lJ0
    public void k(String str) {
        if (TextUtils.isEmpty(this.x)) {
            this.x = str;
        }
    }

    @Override // defpackage.AbstractC3996nJ0
    public byte[][] l() {
        return this.k;
    }

    @Override // defpackage.AbstractC3996nJ0
    public boolean m() {
        return !((C1016Pu) this.A).f.b0 || BJ0.a("AlwaysAllowJustInTimePaymentApp");
    }

    @Override // defpackage.AbstractC3996nJ0
    public String n() {
        return this.h;
    }

    @Override // defpackage.AbstractC3996nJ0
    public Origin o() {
        return this.i;
    }

    @Override // defpackage.AbstractC3996nJ0
    public RenderFrameHost p() {
        return this.b;
    }

    @Override // defpackage.AbstractC3996nJ0
    public PaymentRequestSpec q() {
        return this.s;
    }

    @Override // defpackage.AbstractC3996nJ0
    public String r() {
        return this.g;
    }

    @Override // defpackage.AbstractC3996nJ0
    public String s() {
        return ((C0505Hu) this.c).b();
    }

    @Override // defpackage.AbstractC3996nJ0
    public WebContents t() {
        return this.e;
    }

    @Override // defpackage.AbstractC3996nJ0
    public boolean u() {
        return this.l;
    }

    public void v(String str) {
        C4735rc0 rc0 = this.f;
        if (rc0 != null) {
            rc0.a(2);
        }
        AbstractC4173oK0 ok0 = this.z;
        if (ok0 != null) {
            ((BK0) ok0).g0(5, str);
        }
        w();
    }

    public void w() {
        if (!this.t) {
            this.t = true;
            f8033J = null;
            AbstractC0872Nm nm = this.A;
            if (nm != null) {
                nm.a();
                this.A = null;
            }
            AbstractC4173oK0 ok0 = this.z;
            if (ok0 != null) {
                ((AbstractC0965Pa0) ok0).close();
                this.z = null;
            }
            this.a.run();
            C4735rc0 rc0 = this.f;
            if (rc0 != null) {
                long j2 = rc0.a;
                if (j2 != 0) {
                    N.MK$_cVJA(j2, rc0);
                    rc0.a = 0;
                }
            }
            PaymentRequestSpec paymentRequestSpec = this.s;
            if (paymentRequestSpec != null) {
                long j3 = paymentRequestSpec.a;
                if (j3 != 0) {
                    N.MiX2Cegu(j3);
                    paymentRequestSpec.a = 0;
                }
            }
        }
    }

    public void x(String str, int i2) {
        AbstractC4173oK0 ok0 = this.z;
        if (ok0 != null) {
            ((BK0) ok0).g0(i2, str);
        }
        w();
    }

    public final boolean y(C5213uJ0 uj0) {
        if (uj0.h == null) {
            Objects.requireNonNull((AbstractC0952Ou) this.c);
            return N.MFiPq6M_(uj0.b()) && this.A.c(uj0);
        }
    }

    public void z(boolean z2) {
        AbstractC4173oK0 ok0 = this.z;
        if (ok0 != null) {
            ((BK0) ok0).d0(z2);
        }
        if (z2) {
            this.f.a(1);
            w();
        }
    }
}