package defpackage;

import android.app.ActivityManager;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.os.Build;
import android.os.Bundle;
import android.os.DeadObjectException;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;
import ar.tvplayer.core.data.network.parse.ʽˈˋ;
import ar.tvplayer.core.domain.ˉᵲ;
import ar.tvplayer.core.domain.ˏːˆ;
import com.android.billingclient.api.ProxyBillingActivity;
import j$.util.Objects;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.concurrent.Callable;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

/* JADX INFO: renamed from: ᵛˉʾ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public class C2780 extends ᵷᵸˁ {

    /* JADX INFO: renamed from: ʽᵡᵢᵾ, reason: contains not printable characters */
    public boolean f10672;

    /* JADX INFO: renamed from: ʿٴˇ, reason: contains not printable characters */
    public boolean f10673;

    /* JADX INFO: renamed from: ˀᵗ, reason: contains not printable characters */
    public final Long f10674;

    /* JADX INFO: renamed from: ˀᵭ, reason: contains not printable characters */
    public boolean f10675;

    /* JADX INFO: renamed from: ˁʢᵛ, reason: contains not printable characters */
    public ExecutorService f10676;

    /* JADX INFO: renamed from: ˁˌᵩ, reason: contains not printable characters */
    public boolean f10677;

    /* JADX INFO: renamed from: ˈᵲᵢ, reason: contains not printable characters */
    public volatile ServiceConnectionC4611 f10678;

    /* JADX INFO: renamed from: ˈⁱᵡ, reason: contains not printable characters */
    public final C5314 f10679;

    /* JADX INFO: renamed from: ˉᵵᵜ, reason: contains not printable characters */
    public boolean f10681;

    /* JADX INFO: renamed from: ˊˌˊ, reason: contains not printable characters */
    public volatile InterfaceC5118 f10682;

    /* JADX INFO: renamed from: ˊᵡᵗʨ, reason: contains not printable characters */
    public boolean f10683;

    /* JADX INFO: renamed from: ˊᵨᵧ, reason: contains not printable characters */
    public final String f10684;

    /* JADX INFO: renamed from: ˊᵾʽʼ, reason: contains not printable characters */
    public boolean f10685;

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public final String f10686;

    /* JADX INFO: renamed from: ˌᵨʠᵫ, reason: contains not printable characters */
    public boolean f10687;

    /* JADX INFO: renamed from: ˏᵩʨ, reason: contains not printable characters */
    public final ᵣˉ f10689;

    /* JADX INFO: renamed from: ˑʢ, reason: contains not printable characters */
    public boolean f10690;

    /* JADX INFO: renamed from: ˑˊᵲ, reason: contains not printable characters */
    public boolean f10691;

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public volatile ᵚʿᵴ f10692;

    /* JADX INFO: renamed from: ᵛˑﹳ, reason: contains not printable characters */
    public boolean f10693;

    /* JADX INFO: renamed from: ᵞᵛᵘ, reason: contains not printable characters */
    public AbstractC5437 f10695;

    /* JADX INFO: renamed from: ᵠˏˏ, reason: contains not printable characters */
    public boolean f10696;

    /* JADX INFO: renamed from: ᵨˈʼﹶ, reason: contains not printable characters */
    public final boolean f10697;

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public final Context f10698;

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public final ʽᵺᴵ f10699;

    /* JADX INFO: renamed from: ᵵᵬᵽ, reason: contains not printable characters */
    public boolean f10700;

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public volatile InterfaceC1506 f10701;

    /* JADX INFO: renamed from: ˉᵲ, reason: contains not printable characters */
    public final Object f10680 = new Object();

    /* JADX INFO: renamed from: ˏːˆ, reason: contains not printable characters */
    public volatile int f10688 = 0;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public final Handler f10694 = new Handler(Looper.getMainLooper());

    /* JADX INFO: renamed from: ᵸˆˁ, reason: contains not printable characters */
    public int f10702 = 0;

    public C2780(C5314 c5314, Context context, ˏːˆ r10, C0306 c0306) {
        int i = AbstractC5437.f20626;
        this.f10695 = C0100.f1357;
        long jNextLong = new Random().nextLong();
        this.f10674 = Long.valueOf(jNextLong);
        this.f10689 = AbstractC2547.f9848;
        this.f10684 = "9.1.0";
        String strM6709 = m6709();
        this.f10686 = strM6709;
        this.f10698 = context.getApplicationContext();
        C3547 c3547M9917 = C4745.m9917();
        c3547M9917.m8061();
        if (strM6709 != null) {
            c3547M9917.m11148();
            C4745.m9916((C4745) c3547M9917.f20839, strM6709);
        }
        c3547M9917.m8063(this.f10698.getPackageName());
        c3547M9917.m11148();
        C4745.m9920((C4745) c3547M9917.f20839, jNextLong);
        boolean z = c0306.f1984;
        c3547M9917.m11148();
        C4745.m9914((C4745) c3547M9917.f20839, z);
        c3547M9917.m8060(Build.VERSION.SDK_INT);
        c3547M9917.m8059();
        m6707(c3547M9917, context);
        try {
            c3547M9917.m8064(this.f10698.getPackageManager().getPackageInfo(this.f10698.getPackageName(), 0).versionCode);
        } catch (Throwable unused) {
            AbstractC2252.m5866("BillingClient");
        }
        this.f10699 = new ʽᵺᴵ(this.f10698, (C4745) c3547M9917.m11147());
        if (r10 == null) {
            int i2 = AbstractC2252.f8911;
            Log.isLoggable("BillingClient", 5);
        }
        this.f10692 = new ᵚʿᵴ(this.f10698, r10, this.f10699);
        this.f10679 = c5314;
        this.f10698.getPackageName();
        this.f10697 = c0306.f1984;
    }

    public C2780(C5314 c5314, Context context, C0306 c0306) {
        int i = AbstractC5437.f20626;
        this.f10695 = C0100.f1357;
        long jNextLong = new Random().nextLong();
        this.f10674 = Long.valueOf(jNextLong);
        this.f10689 = AbstractC2547.f9848;
        this.f10684 = "9.1.0";
        String strM6709 = m6709();
        this.f10686 = strM6709;
        this.f10698 = context.getApplicationContext();
        C3547 c3547M9917 = C4745.m9917();
        c3547M9917.m8061();
        if (strM6709 != null) {
            c3547M9917.m11148();
            C4745.m9916((C4745) c3547M9917.f20839, strM6709);
        }
        c3547M9917.m8063(this.f10698.getPackageName());
        c3547M9917.m11148();
        C4745.m9920((C4745) c3547M9917.f20839, jNextLong);
        boolean z = c0306.f1984;
        c3547M9917.m11148();
        C4745.m9914((C4745) c3547M9917.f20839, z);
        c3547M9917.m8060(Build.VERSION.SDK_INT);
        c3547M9917.m8059();
        m6707(c3547M9917, context);
        try {
            c3547M9917.m8064(this.f10698.getPackageManager().getPackageInfo(this.f10698.getPackageName(), 0).versionCode);
        } catch (Throwable unused) {
            AbstractC2252.m5866("BillingClient");
        }
        this.f10699 = new ʽᵺᴵ(this.f10698, (C4745) c3547M9917.m11147());
        int i2 = AbstractC2252.f8911;
        Log.isLoggable("BillingClient", 5);
        this.f10692 = new ᵚʿᵴ(this.f10698, (ˏːˆ) null, this.f10699);
        this.f10679 = c5314;
        this.f10698.getPackageName();
        this.f10697 = c0306.f1984;
    }

    /* JADX INFO: renamed from: ʿᵿʽᵞ, reason: contains not printable characters */
    public static final void m6707(C3547 c3547, Context context) {
        try {
            ActivityManager activityManager = (ActivityManager) context.getSystemService("activity");
            if (activityManager != null) {
                ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
                activityManager.getMemoryInfo(memoryInfo);
                int i = (int) (memoryInfo.totalMem / 1048576);
                c3547.m11148();
                C4745.m9909((C4745) c3547.f20839, i);
                String str = Build.BRAND;
                c3547.m11148();
                C4745.m9907((C4745) c3547.f20839);
                String str2 = Build.MODEL;
                c3547.m11148();
                C4745.m9908((C4745) c3547.f20839);
                String str3 = Build.MANUFACTURER;
                c3547.m11148();
                C4745.m9911((C4745) c3547.f20839);
                String str4 = Build.FINGERPRINT;
                c3547.m11148();
                C4745.m9906((C4745) c3547.f20839);
            }
        } catch (RuntimeException unused) {
            AbstractC2252.m5866("BillingClient");
        }
    }

    /* JADX INFO: renamed from: ˀᵗ, reason: contains not printable characters */
    public static /* bridge */ /* synthetic */ void m6708(C2780 c2780, int i) {
        c2780.f10702 = i;
        c2780.f10672 = i >= 28;
        c2780.f10690 = i >= 26;
        c2780.f10700 = i >= 24;
        c2780.f10693 = i >= 21;
        c2780.f10683 = i >= 20;
        c2780.f10685 = i >= 19;
        c2780.f10675 = i >= 17;
        c2780.f10677 = i >= 16;
        c2780.f10681 = i >= 15;
        c2780.f10696 = i >= 14;
        c2780.f10673 = i >= 9;
        c2780.f10691 = i >= 6;
    }

    /* JADX INFO: renamed from: ˊˌˊ, reason: contains not printable characters */
    public static String m6709() {
        try {
            return (String) Class.forName("com.android.billingclient.ktx.BuildConfig").getField("VERSION_NAME").get(null);
        } catch (Exception unused) {
            return null;
        }
    }

    /* JADX INFO: renamed from: ˏᵩʨ, reason: contains not printable characters */
    public static void m6710(C2780 c2780, int i) {
        if (i != 0) {
            c2780.m6736(0);
            return;
        }
        synchronized (c2780.f10680) {
            try {
                if (c2780.f10688 == 3) {
                    return;
                }
                c2780.m6736(2);
                ᵚʿᵴ r0 = c2780.f10692 != null ? c2780.f10692 : null;
                if (r0 != null) {
                    boolean z = c2780.f10693;
                    IntentFilter intentFilter = new IntentFilter("com.android.vending.billing.PURCHASES_UPDATED");
                    IntentFilter intentFilter2 = new IntentFilter("com.android.vending.billing.LOCAL_BROADCAST_PURCHASES_UPDATED");
                    intentFilter2.addAction("com.android.vending.billing.ALTERNATIVE_BILLING");
                    r0.ᵲᵶᵳˈ = z;
                    C4794 c4794 = (C4794) r0.ᵻˈᵦʼ;
                    Context context = (Context) r0.ʽˈˋ;
                    c4794.m10004(context, intentFilter2);
                    boolean z2 = r0.ᵲᵶᵳˈ;
                    C4794 c47942 = (C4794) r0.ᵨᵣ;
                    if (z2) {
                        c47942.m10002(context, intentFilter);
                    } else {
                        c47942.m10004(context, intentFilter);
                    }
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    /* JADX INFO: renamed from: ᵛˀˊ, reason: contains not printable characters */
    public static /* bridge */ /* synthetic */ boolean m6711(C2780 c2780) {
        boolean z;
        synchronized (c2780.f10680) {
            z = true;
            if (c2780.f10688 != 1) {
                z = false;
            }
        }
        return z;
    }

    /* JADX INFO: renamed from: ᵛˑﹳ, reason: contains not printable characters */
    public static Future m6712(Callable callable, long j, Runnable runnable, Handler handler, ExecutorService executorService) {
        try {
            Future futureSubmit = executorService.submit(callable);
            handler.postDelayed(new ᵟᵰᵕ(futureSubmit, 8, runnable), (long) (j * 0.95d));
            return futureSubmit;
        } catch (Exception unused) {
            AbstractC2252.m5866("BillingClient");
            return null;
        }
    }

    /* JADX INFO: renamed from: ʽᵡᵢᵾ, reason: contains not printable characters */
    public final C1591 m6713(int i) {
        AbstractC2252.m5870("BillingClient", "Service connection is valid. No need to re-initialize.");
        C2314 c2314M8971 = C4112.m8971();
        c2314M8971.m11148();
        C4112.m8970((C4112) c2314M8971.f20839, 6);
        C3522 c3522M4110 = C1436.m4110();
        c3522M4110.m11148();
        C1436.m4108((C1436) c3522M4110.f20839);
        c3522M4110.m8035(i > 0);
        c3522M4110.m8036(i);
        c2314M8971.m11148();
        C4112.m8968((C4112) c2314M8971.f20839, (C1436) c3522M4110.m11147());
        m6727((C4112) c2314M8971.m11147());
        return AbstractC4228.f16131;
    }

    /* JADX INFO: renamed from: ˀᵭ, reason: contains not printable characters */
    public void mo6714(ᵢʒʡᵟ r7, InterfaceC1621 interfaceC1621) {
        if (m6712(new CallableC2147(this, interfaceC1621, r7, 2), 30000L, new RunnableC0648(8, this, interfaceC1621, false), m6738(), m6722()) == null) {
            C1591 c1591M6719 = m6719();
            m6734(25, 7, c1591M6719);
            C0092 c0092 = AbstractC1707.f6825;
            interfaceC1621.m4473(c1591M6719, new C5401(C4767.f18145));
        }
    }

    /* JADX INFO: renamed from: ˁʢᵛ, reason: contains not printable characters */
    public final void m6715(ʽˈˋ r1, C1591 c1591, int i, Exception exc) {
        AbstractC2252.m5866("BillingClient");
        m6720(i, 3, c1591, AbstractC3817.m8522(exc));
        boolean z = ˏːˆ.ᵲᵶᵳˈ;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:140:0x0316  */
    /* JADX WARN: Removed duplicated region for block: B:143:0x031e  */
    /* JADX WARN: Removed duplicated region for block: B:145:0x032d  */
    /* JADX WARN: Removed duplicated region for block: B:312:0x0710  */
    /* JADX WARN: Removed duplicated region for block: B:346:0x071c A[EXC_TOP_SPLITTER, SYNTHETIC] */
    /* JADX WARN: Type inference failed for: r29v0, types: [ᵛˉʾ] */
    /* JADX WARN: Type inference failed for: r4v15 */
    /* JADX WARN: Type inference failed for: r4v17 */
    /* JADX WARN: Type inference failed for: r4v19 */
    /* JADX WARN: Type inference failed for: r4v20 */
    /* JADX WARN: Type inference failed for: r4v25 */
    /* JADX WARN: Type inference failed for: r4v26 */
    /* JADX WARN: Type inference failed for: r4v41 */
    /* JADX WARN: Type inference failed for: r4v42 */
    /* JADX WARN: Type inference failed for: r4v43 */
    /* JADX WARN: Type inference failed for: r5v20, types: [long] */
    /* JADX WARN: Type inference failed for: r5v21, types: [long] */
    /* JADX WARN: Type inference failed for: r5v5 */
    /* JADX WARN: Type inference failed for: r5v6, types: [ˀᵠʚ] */
    /* JADX WARN: Type inference failed for: r5v8, types: [ˀᵠʚ] */
    /* JADX WARN: Type inference failed for: r6v10 */
    /* JADX WARN: Type inference failed for: r6v11 */
    /* JADX WARN: Type inference failed for: r6v12 */
    /* JADX WARN: Type inference failed for: r6v13 */
    /* JADX WARN: Type inference failed for: r6v16 */
    /* JADX WARN: Type inference failed for: r6v17 */
    /* JADX WARN: Type inference failed for: r6v30 */
    /* JADX WARN: Type inference failed for: r6v31 */
    /* JADX WARN: Type inference failed for: r6v32 */
    /* JADX WARN: Type inference failed for: r6v33 */
    /* JADX WARN: Type inference failed for: r6v34 */
    /* JADX WARN: Type inference failed for: r6v9 */
    /* JADX WARN: Type inference failed for: r7v2, types: [boolean] */
    /* JADX WARN: Type inference failed for: r7v3, types: [boolean] */
    /* JADX INFO: renamed from: ˁˌᵩ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public C1591 mo6716(AbstractActivityC2057 abstractActivityC2057, final C0764 c0764) {
        boolean z;
        int i;
        String str;
        String str2;
        long j;
        boolean z2;
        String str3;
        C1591 c1591M9200;
        ?? r5;
        C1591 c1591M92002;
        long j2;
        boolean z3;
        Future futureM6712;
        ?? r6;
        String str4;
        ?? r62;
        ?? r4;
        ?? r63;
        ?? r42;
        Object obj;
        int iM2410;
        int i2;
        boolean z4;
        long j3;
        String str5;
        String str6;
        String str7;
        ArrayList arrayList;
        boolean z5;
        long jNextLong = new Random().nextLong();
        if (this.f10692 == null || ((ˏːˆ) this.f10692.ːˏᵟᵯ) == null) {
            C1591 c1591 = AbstractC4228.f16116;
            m6724(12, c1591, jNextLong);
            return c1591;
        }
        long j4 = ᵸᵺᵜ.ᵮᵣᵗˈ;
        try {
            if (Build.VERSION.SDK_INT < 29) {
                j4 = 0;
            }
            int i3 = ((C1591) m6735(1).get(j4, TimeUnit.MILLISECONDS)).f6394;
            if (i3 == 0) {
                AbstractC2252.m5870("BillingClient", "Reconnection succeeded with result: " + i3);
            } else {
                int i4 = AbstractC2252.f8911;
                Log.isLoggable("BillingClient", 5);
            }
        } catch (Exception e) {
            if (e instanceof InterruptedException) {
                Thread.currentThread().interrupt();
            }
            AbstractC2252.m5866("BillingClient");
        }
        if (!m6730()) {
            C1591 c15912 = AbstractC4228.f16126;
            m6724(2, c15912, jNextLong);
            m6718(c15912);
            return c15912;
        }
        synchronized (this.f10680) {
            try {
                z = false;
                if (this.f10678 != null) {
                    z = this.f10678.f17531 > 0;
                    i = 0;
                } else {
                    i = 0;
                }
            } finally {
            }
        }
        ArrayList arrayList2 = new ArrayList();
        arrayList2.addAll((ArrayList) c0764.f3429);
        AbstractC1707 abstractC1707 = (AbstractC1707) c0764.f3427;
        Iterator it = arrayList2.iterator();
        if ((it.hasNext() ? it.next() : null) != null) {
            C1685.m4560();
            return null;
        }
        C0092 c0092 = (C0092) abstractC1707.iterator();
        C1181 c1181 = (C1181) (c0092.hasNext() ? c0092.next() : null);
        C1434 c1434 = c1181.f5037;
        long j5 = jNextLong;
        String str8 = c1434.f5862;
        String str9 = c1434.f5866;
        if (str9.equals("subs") && !this.f10687) {
            Log.isLoggable("BillingClient", 5);
            C1591 c15913 = AbstractC4228.f16124;
            m6717(9, c15913, j5, z);
            m6718(c15913);
            return c15913;
        }
        ((ˉᵠﹳᵘ) c0764.f3428).getClass();
        if (c0764.f3426) {
            str = null;
            if (!this.f10691) {
                Log.isLoggable("BillingClient", 5);
                C1591 c15914 = AbstractC4228.f16132;
                m6717(18, c15914, j5, z);
                m6718(c15914);
                return c15914;
            }
        } else {
            AbstractC1707 abstractC17072 = (AbstractC1707) c0764.f3427;
            str = null;
            if (abstractC17072 != null) {
                int size = abstractC17072.size();
                while (i < size) {
                    ((C1181) abstractC17072.get(i)).getClass();
                    i++;
                }
            }
        }
        if (arrayList2.size() > 1 && !this.f10677) {
            int i5 = AbstractC2252.f8911;
            Log.isLoggable("BillingClient", 5);
            C1591 c15915 = AbstractC4228.f16120;
            m6717(19, c15915, j5, z);
            m6718(c15915);
            return c15915;
        }
        if (!abstractC1707.isEmpty() && !this.f10675) {
            int i6 = AbstractC2252.f8911;
            Log.isLoggable("BillingClient", 5);
            C1591 c15916 = AbstractC4228.f16121;
            m6717(20, c15916, j5, z);
            m6718(c15916);
            return c15916;
        }
        C0092 c0092ListIterator = abstractC1707.listIterator(0);
        while (c0092ListIterator.hasNext()) {
            String str10 = ((C1181) c0092ListIterator.next()).f5036;
            if (str10 != null && str10.contains(":") && !this.f10672) {
                int i7 = AbstractC2252.f8911;
                Log.isLoggable("BillingClient", 5);
                C1591 c15917 = AbstractC4228.f16123;
                m6717(143, c15917, j5, z);
                m6718(c15917);
                return c15917;
            }
        }
        if (((AbstractC1707) c0764.f3427).isEmpty()) {
            c1591M9200 = AbstractC4228.f16131;
            str2 = str8;
            j = j5;
            z2 = z;
            str3 = str9;
        } else {
            C1181 c11812 = (C1181) ((AbstractC1707) c0764.f3427).get(0);
            int i8 = 1;
            while (i8 < ((AbstractC1707) c0764.f3427).size()) {
                C1181 c11813 = (C1181) ((AbstractC1707) c0764.f3427).get(i8);
                str2 = str8;
                j = j5;
                if (!c11813.f5037.f5866.equals(c11812.f5037.f5866) && !c11813.f5037.f5866.equals("play_pass_subs")) {
                    c1591M92002 = AbstractC4228.m9200(5, "All products should have same ProductType.");
                    z2 = z;
                    str3 = str9;
                    break;
                }
                i8++;
                str8 = str2;
                j5 = j;
            }
            str2 = str8;
            j = j5;
            C1434 c14342 = c11812.f5037;
            String strOptString = c14342.f5860.optString("packageName");
            HashMap map = new HashMap();
            HashSet hashSet = new HashSet();
            AbstractC1707 abstractC17073 = (AbstractC1707) c0764.f3427;
            int size2 = abstractC17073.size();
            z2 = z;
            int i9 = 0;
            while (true) {
                if (i9 < size2) {
                    int i10 = size2;
                    C1181 c11814 = (C1181) abstractC17073.get(i9);
                    c11814.getClass();
                    int i11 = i9;
                    C1434 c14343 = c11814.f5037;
                    AbstractC1707 abstractC17074 = abstractC17073;
                    ArrayList arrayList3 = c14343.f5861;
                    String str11 = c14343.f5862;
                    if (arrayList3 != null) {
                        str3 = str9;
                        if (c11814.f5036 == null) {
                            c1591M9200 = AbstractC4228.m9200(5, "offerToken is required for constructing ProductDetailsParams for subscriptions. Missing value for product id: " + str11);
                            break;
                        }
                    } else {
                        str3 = str9;
                    }
                    if (!map.containsKey(str11)) {
                        map.put(str11, c11814);
                        if (!c14342.f5866.equals("play_pass_subs") && !c14343.f5866.equals("play_pass_subs") && !strOptString.equals(c14343.f5860.optString("packageName"))) {
                            c1591M9200 = AbstractC4228.m9200(5, "All products must have the same package name.");
                            break;
                        }
                        i9 = i11 + 1;
                        size2 = i10;
                        abstractC17073 = abstractC17074;
                        str9 = str3;
                    } else {
                        c1591M9200 = AbstractC4228.m9200(5, "ProductId can not be duplicated. Invalid product id: " + str11 + ".");
                        break;
                    }
                } else {
                    str3 = str9;
                    Iterator it2 = hashSet.iterator();
                    while (true) {
                        if (it2.hasNext()) {
                            String str12 = (String) it2.next();
                            if (map.containsKey(str12)) {
                                ((C1181) map.get(str12)).getClass();
                                c1591M9200 = AbstractC4228.m9200(5, "OldProductId must not be one of the products to be purchased. Invalid old product id: " + str12 + ".");
                                break;
                            }
                        } else {
                            ArrayList arrayList4 = c14342.f5867;
                            String str13 = c11812.f5036;
                            if (str13 == null || arrayList4 == null) {
                                c1591M9200 = AbstractC4228.f16131;
                            } else {
                                int size3 = arrayList4.size();
                                int i12 = 0;
                                while (true) {
                                    if (i12 >= size3) {
                                        r5 = str;
                                        break;
                                    }
                                    Object obj2 = arrayList4.get(i12);
                                    i12++;
                                    r5 = (C0587) obj2;
                                    if (str13.equals(r5.f2885)) {
                                        break;
                                    }
                                }
                                if (r5 != 0 && r5.f2887 != null) {
                                    c1591M9200 = AbstractC4228.m9200(5, "Both autoPayDetails and autoPayBalanceThreshold is required for constructing ProductDetailsParams for autopay.");
                                }
                            }
                            if (c1591M92002 == AbstractC4228.f16131) {
                                m6717(108, c1591M92002, j, z2);
                                m6718(c1591M92002);
                                return c1591M92002;
                            }
                            long j6 = j;
                            boolean z6 = z2;
                            if (this.f10691) {
                                boolean z7 = this.f10673;
                                this.f10679.getClass();
                                this.f10679.getClass();
                                String str14 = this.f10686;
                                long jLongValue = this.f10674.longValue();
                                this.f10698.getPackageName();
                                int i13 = AbstractC2252.f8911;
                                final Bundle bundle = new Bundle();
                                AbstractC2252.m5865(bundle, str14, jLongValue);
                                bundle.putLong("billingClientTransactionId", j6);
                                ((ˉᵠﹳᵘ) c0764.f3428).getClass();
                                if (TextUtils.isEmpty(str)) {
                                    str6 = str;
                                } else {
                                    str6 = str;
                                    bundle.putString("accountId", str6);
                                }
                                if (!TextUtils.isEmpty(str6)) {
                                    bundle.putString("obfuscatedProfileId", str6);
                                }
                                if (!TextUtils.isEmpty(str6)) {
                                    bundle.putStringArrayList("skusToReplace", new ArrayList<>(Arrays.asList(str6)));
                                }
                                ((ˉᵠﹳᵘ) c0764.f3428).getClass();
                                if (!TextUtils.isEmpty(str6)) {
                                    ((ˉᵠﹳᵘ) c0764.f3428).getClass();
                                    bundle.putString("oldSkuPurchaseToken", str6);
                                }
                                if (!TextUtils.isEmpty(str6)) {
                                    bundle.putString("oldSkuPurchaseId", str6);
                                }
                                ((ˉᵠﹳᵘ) c0764.f3428).getClass();
                                if (!TextUtils.isEmpty(str6)) {
                                    ((ˉᵠﹳᵘ) c0764.f3428).getClass();
                                    bundle.putString("originalExternalTransactionId", str6);
                                }
                                if (!TextUtils.isEmpty(str6)) {
                                    bundle.putString("paymentsPurchaseParams", str6);
                                }
                                if (z7) {
                                    bundle.putBoolean("enablePendingPurchases", true);
                                }
                                ArrayList arrayList5 = new ArrayList();
                                C0092 c0092ListIterator2 = ((AbstractC1707) c0764.f3427).listIterator(0);
                                while (c0092ListIterator2.hasNext()) {
                                    ((C1181) c0092ListIterator2.next()).getClass();
                                }
                                if (!arrayList5.isEmpty()) {
                                    C3571 c3571M3314 = C0988.m3314();
                                    c3571M3314.m11148();
                                    C0988.m3315((C0988) c3571M3314.f20839, arrayList5);
                                    bundle.putByteArray("subscriptionProductReplacementParamsList", ((C0988) c3571M3314.m11147()).m9523());
                                }
                                if (arrayList2.isEmpty()) {
                                    ArrayList<String> arrayList6 = new ArrayList<>(abstractC1707.size() - 1);
                                    ArrayList<String> arrayList7 = new ArrayList<>(abstractC1707.size() - 1);
                                    ArrayList<String> arrayList8 = new ArrayList<>();
                                    ArrayList<String> arrayList9 = new ArrayList<>();
                                    ArrayList<String> arrayList10 = new ArrayList<>();
                                    ArrayList<Integer> arrayList11 = new ArrayList<>();
                                    int i14 = 0;
                                    while (i14 < abstractC1707.size()) {
                                        C1181 c11815 = (C1181) abstractC1707.get(i14);
                                        C1434 c14344 = c11815.f5037;
                                        long j7 = j6;
                                        if (!c14344.f5868.isEmpty()) {
                                            arrayList8.add(c14344.f5868);
                                        }
                                        String str15 = c11815.f5036;
                                        arrayList9.add(str15);
                                        if (TextUtils.isEmpty(str15) || (arrayList = c14344.f5867) == null || arrayList.isEmpty()) {
                                            str7 = c14344.f5865;
                                        } else {
                                            int size4 = arrayList.size();
                                            int i15 = 0;
                                            while (i15 < size4) {
                                                Object obj3 = arrayList.get(i15);
                                                int i16 = i15 + 1;
                                                ArrayList arrayList12 = arrayList;
                                                C0587 c0587 = (C0587) obj3;
                                                if (!TextUtils.isEmpty(c0587.f2889) && Objects.equals(c0587.f2885, str15)) {
                                                    str7 = c0587.f2889;
                                                    break;
                                                }
                                                i15 = i16;
                                                arrayList = arrayList12;
                                            }
                                            str7 = c14344.f5865;
                                        }
                                        if (!TextUtils.isEmpty(str7)) {
                                            arrayList10.add(str7);
                                        }
                                        if (i14 > 0) {
                                            arrayList6.add(((C1181) abstractC1707.get(i14)).f5037.f5862);
                                            arrayList7.add(((C1181) abstractC1707.get(i14)).f5037.f5866);
                                        }
                                        i14++;
                                        j6 = j7;
                                    }
                                    j2 = j6;
                                    bundle.putStringArrayList("SKU_OFFER_ID_TOKEN_LIST", arrayList9);
                                    if (!arrayList11.isEmpty()) {
                                        bundle.putIntegerArrayList("autoPayBalanceThresholdList", arrayList11);
                                    }
                                    if (!arrayList8.isEmpty()) {
                                        bundle.putStringArrayList("skuDetailsTokens", arrayList8);
                                    }
                                    if (!arrayList10.isEmpty()) {
                                        bundle.putStringArrayList("SKU_SERIALIZED_DOCID_LIST", arrayList10);
                                    }
                                    if (!arrayList6.isEmpty()) {
                                        bundle.putStringArrayList("additionalSkus", arrayList6);
                                        bundle.putStringArrayList("additionalSkuTypes", arrayList7);
                                    }
                                } else {
                                    ArrayList<String> arrayList13 = new ArrayList<>();
                                    new ArrayList();
                                    new ArrayList();
                                    new ArrayList();
                                    new ArrayList();
                                    Iterator it3 = arrayList2.iterator();
                                    if (it3.hasNext()) {
                                        it3.next().getClass();
                                        C1685.m4560();
                                        return null;
                                    }
                                    if (!arrayList13.isEmpty()) {
                                        bundle.putStringArrayList("skuDetailsTokens", arrayList13);
                                    }
                                    if (arrayList2.size() > 1) {
                                        ArrayList<String> arrayList14 = new ArrayList<>(arrayList2.size() - 1);
                                        ArrayList<String> arrayList15 = new ArrayList<>(arrayList2.size() - 1);
                                        if (arrayList2.size() > 1) {
                                            arrayList2.get(1).getClass();
                                            C1685.m4560();
                                            return null;
                                        }
                                        bundle.putStringArrayList("additionalSkus", arrayList14);
                                        bundle.putStringArrayList("additionalSkuTypes", arrayList15);
                                    }
                                    j2 = j6;
                                }
                                if (bundle.containsKey("SKU_OFFER_ID_TOKEN_LIST") && !this.f10696) {
                                    C1591 c15918 = AbstractC4228.f16118;
                                    m6717(21, c15918, j2, z6);
                                    m6718(c15918);
                                    return c15918;
                                }
                                z3 = z6;
                                if (TextUtils.isEmpty(c1181.f5037.f5860.optString("packageName"))) {
                                    z5 = false;
                                } else {
                                    bundle.putString("skuPackageName", c1181.f5037.f5860.optString("packageName"));
                                    z5 = true;
                                }
                                if (!TextUtils.isEmpty(null)) {
                                    bundle.putString("accountName", null);
                                }
                                Intent intent = abstractActivityC2057.getIntent();
                                if (intent == null) {
                                    Log.isLoggable("BillingClient", 5);
                                } else if (!TextUtils.isEmpty(intent.getStringExtra("PROXY_PACKAGE"))) {
                                    String stringExtra = intent.getStringExtra("PROXY_PACKAGE");
                                    bundle.putString("proxyPackage", stringExtra);
                                    try {
                                        bundle.putString("proxyPackageVersion", this.f10698.getPackageManager().getPackageInfo(stringExtra, 0).versionName);
                                    } catch (PackageManager.NameNotFoundException unused) {
                                        bundle.putString("proxyPackageVersion", "package not found");
                                    }
                                }
                                final int i17 = this.f10672 ? 28 : (!this.f10675 || abstractC1707.isEmpty()) ? (this.f10681 && z5) ? 15 : this.f10673 ? 9 : 6 : 17;
                                final String str16 = str2;
                                final String str17 = str3;
                                futureM6712 = m6712(new Callable(i17, str16, str17, c0764, bundle) { // from class: ˊᵝʾᵻ

                                    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
                                    public final /* synthetic */ int f5701;

                                    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
                                    public final /* synthetic */ String f5702;

                                    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
                                    public final /* synthetic */ Bundle f5703;

                                    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
                                    public final /* synthetic */ String f5705;

                                    {
                                        this.f5703 = bundle;
                                    }

                                    @Override // java.util.concurrent.Callable
                                    public final Object call() {
                                        Bundle bundleM5867;
                                        InterfaceC1506 interfaceC1506;
                                        C2780 c2780 = this.f5704;
                                        int i18 = this.f5701;
                                        String str18 = this.f5702;
                                        String str19 = this.f5705;
                                        Bundle bundle2 = this.f5703;
                                        try {
                                            synchronized (c2780.f10680) {
                                                interfaceC1506 = c2780.f10701;
                                            }
                                            if (interfaceC1506 == null) {
                                                return AbstractC2252.m5867(AbstractC4228.f16126, 107);
                                            }
                                            return ((C4987) interfaceC1506).m10300(i18, c2780.f10698.getPackageName(), str18, str19, bundle2);
                                        } catch (DeadObjectException e2) {
                                            C1591 c15919 = AbstractC4228.f16126;
                                            String strM8522 = AbstractC3817.m8522(e2);
                                            bundleM5867 = AbstractC2252.m5867(c15919, 5);
                                            if (strM8522 != null) {
                                                bundleM5867.putString("ADDITIONAL_LOG_DETAILS", strM8522);
                                            }
                                            return bundleM5867;
                                        } catch (Exception e3) {
                                            C1591 c159110 = AbstractC4228.f16117;
                                            String strM85222 = AbstractC3817.m8522(e3);
                                            bundleM5867 = AbstractC2252.m5867(c159110, 5);
                                            if (strM85222 != null) {
                                                bundleM5867.putString("ADDITIONAL_LOG_DETAILS", strM85222);
                                            }
                                            return bundleM5867;
                                        }
                                    }
                                }, 5000L, null, this.f10694, m6722());
                                str4 = str17;
                                r6 = bundle;
                            } else {
                                j2 = j6;
                                z3 = z6;
                                String str18 = str3;
                                futureM6712 = m6712(new CallableC2147(this, str2, str18, 0), 5000L, null, this.f10694, m6722());
                                str4 = str18;
                                r6 = z6;
                            }
                            try {
                                if (futureM6712 == null) {
                                    try {
                                        C1591 c15919 = AbstractC4228.f16119;
                                        m6717(25, c15919, j2, z3);
                                        m6718(c15919);
                                        return c15919;
                                    } catch (CancellationException e2) {
                                        e = e2;
                                        r63 = z3;
                                        r42 = j2;
                                        AbstractC2252.m5866("BillingClient");
                                        C1591 c159110 = AbstractC4228.f16129;
                                        m6725(4, c159110, AbstractC3817.m8522(e), r42, r63);
                                        m6718(c159110);
                                        return c159110;
                                    } catch (TimeoutException e3) {
                                        e = e3;
                                        r63 = z3;
                                        r42 = j2;
                                        AbstractC2252.m5866("BillingClient");
                                        C1591 c1591102 = AbstractC4228.f16129;
                                        m6725(4, c1591102, AbstractC3817.m8522(e), r42, r63);
                                        m6718(c1591102);
                                        return c1591102;
                                    } catch (Exception e4) {
                                        e = e4;
                                        r62 = z3;
                                        r4 = j2;
                                        AbstractC2252.m5866("BillingClient");
                                        C1591 c159111 = AbstractC4228.f16126;
                                        m6725(5, c159111, AbstractC3817.m8522(e), r4, r62);
                                        m6718(c159111);
                                        return c159111;
                                    }
                                }
                                boolean z8 = z3;
                                long j8 = j2;
                                Bundle bundle2 = (Bundle) futureM6712.get(5000L, TimeUnit.MILLISECONDS);
                                int iM5869 = AbstractC2252.m5869("BillingClient", bundle2);
                                String strM5873 = AbstractC2252.m5873("BillingClient", bundle2);
                                if (iM5869 == 0) {
                                    Intent intent2 = new Intent(abstractActivityC2057, (Class<?>) ProxyBillingActivity.class);
                                    intent2.putExtra("BUY_INTENT", (PendingIntent) bundle2.getParcelable("BUY_INTENT"));
                                    intent2.putExtra("billingClientTransactionId", j8);
                                    intent2.putExtra("wasServiceAutoReconnected", z8);
                                    abstractActivityC2057.startActivity(intent2);
                                    return AbstractC4228.f16131;
                                }
                                ᵱˉˈ.ˁʢᵛ(iM5869, "Unable to buy item, Error response code: ");
                                Log.isLoggable("BillingClient", 5);
                                C1591 c1591M92003 = AbstractC4228.m9200(iM5869, strM5873);
                                try {
                                    if (bundle2 != null) {
                                        try {
                                            obj = bundle2.get("LOG_REASON");
                                        } catch (Throwable th) {
                                            "Failed to get log reason from bundle: ".concat(String.valueOf(th.getMessage()));
                                            Log.isLoggable("BillingClient", 5);
                                        }
                                        if (obj != null) {
                                            if (obj instanceof Integer) {
                                                iM2410 = AbstractC0659.m2410(((Integer) obj).intValue());
                                                if (iM2410 == 1) {
                                                    iM2410 = 23;
                                                }
                                                int i18 = iM2410;
                                                if (bundle2 != null) {
                                                    try {
                                                        String string = bundle2.getString("ADDITIONAL_LOG_DETAILS");
                                                        i2 = i18;
                                                        z4 = z8 ? 1 : 0;
                                                        j3 = j8;
                                                        str5 = string;
                                                    } catch (Throwable th2) {
                                                        "Failed to get additional log details from bundle: ".concat(String.valueOf(th2.getMessage()));
                                                        Log.isLoggable("BillingClient", 5);
                                                        i2 = i18;
                                                        z4 = z8 ? 1 : 0;
                                                        j3 = j8;
                                                        str5 = null;
                                                    }
                                                    m6725(i2, c1591M92003, str5, j3, z4);
                                                    m6718(c1591M92003);
                                                    return c1591M92003;
                                                }
                                                i2 = i18;
                                                z4 = z8 ? 1 : 0;
                                                j3 = j8;
                                                str5 = null;
                                                m6725(i2, c1591M92003, str5, j3, z4);
                                                m6718(c1591M92003);
                                                return c1591M92003;
                                            }
                                            Log.isLoggable("BillingClient", 5);
                                        }
                                    }
                                    m6725(i2, c1591M92003, str5, j3, z4);
                                    m6718(c1591M92003);
                                    return c1591M92003;
                                } catch (CancellationException e5) {
                                    e = e5;
                                    r42 = j3;
                                    r63 = z4;
                                    AbstractC2252.m5866("BillingClient");
                                    C1591 c15911022 = AbstractC4228.f16129;
                                    m6725(4, c15911022, AbstractC3817.m8522(e), r42, r63);
                                    m6718(c15911022);
                                    return c15911022;
                                } catch (TimeoutException e6) {
                                    e = e6;
                                    r42 = j3;
                                    r63 = z4;
                                    AbstractC2252.m5866("BillingClient");
                                    C1591 c159110222 = AbstractC4228.f16129;
                                    m6725(4, c159110222, AbstractC3817.m8522(e), r42, r63);
                                    m6718(c159110222);
                                    return c159110222;
                                } catch (Exception e7) {
                                    e = e7;
                                    r4 = j3;
                                    r62 = z4;
                                    AbstractC2252.m5866("BillingClient");
                                    C1591 c1591112 = AbstractC4228.f16126;
                                    m6725(5, c1591112, AbstractC3817.m8522(e), r4, r62);
                                    m6718(c1591112);
                                    return c1591112;
                                }
                                iM2410 = 1;
                                if (iM2410 == 1) {
                                }
                                int i182 = iM2410;
                                if (bundle2 != null) {
                                }
                                i2 = i182;
                                z4 = z8 ? 1 : 0;
                                j3 = j8;
                                str5 = null;
                            } catch (CancellationException e8) {
                                e = e8;
                            } catch (TimeoutException e9) {
                                e = e9;
                                r42 = str4;
                                r63 = r6;
                            } catch (Exception e10) {
                                e = e10;
                            }
                        }
                    }
                }
            }
        }
        c1591M92002 = c1591M9200;
        if (c1591M92002 == AbstractC4228.f16131) {
        }
    }

    /* JADX INFO: renamed from: ˁᵺˈ, reason: contains not printable characters */
    public final void m6717(int i, C1591 c1591, long j, boolean z) {
        try {
            int i2 = AbstractC3817.f14473;
            try {
                this.f10699.ᵔᵖᵹᵫ(AbstractC3817.m8520(i, 2, c1591, null, EnumC4161.f15879), this.f10702, j, z);
            } catch (Throwable unused) {
                AbstractC2252.m5866("BillingClient");
            }
        } catch (Throwable unused2) {
            AbstractC2252.m5866("BillingClient");
        }
    }

    /* JADX INFO: renamed from: ˆʤᵳ, reason: contains not printable characters */
    public final void m6718(C1591 c1591) {
        if (Thread.interrupted()) {
            return;
        }
        this.f10694.post(new ᵟᵰᵕ(this, 7, c1591));
    }

    /* JADX INFO: renamed from: ˈⁱᵡ, reason: contains not printable characters */
    public final C1591 m6719() {
        int[] iArr = {0, 3};
        synchronized (this.f10680) {
            for (int i = 0; i < 2; i++) {
                if (this.f10688 == iArr[i]) {
                    return AbstractC4228.f16126;
                }
            }
            return AbstractC4228.f16117;
        }
    }

    /* JADX INFO: renamed from: ˉˆᵗ, reason: contains not printable characters */
    public final void m6720(int i, int i2, C1591 c1591, String str) {
        try {
            int i3 = AbstractC3817.f14473;
            m6731(AbstractC3817.m8520(i, i2, c1591, str, EnumC4161.f15879));
        } catch (Throwable unused) {
            AbstractC2252.m5866("BillingClient");
        }
    }

    /* JADX INFO: renamed from: ˉᵵᵜ, reason: contains not printable characters */
    public void mo6721(C2571 c2571, ʽˈˋ r8) {
        int i = 1;
        if (m6712(new CallableC2147(this, r8, c2571, i), 30000L, new RunnableC1726(this, i, r8), m6738(), m6722()) == null) {
            m6734(25, 3, m6719());
            boolean z = ˏːˆ.ᵲᵶᵳˈ;
        }
    }

    /* JADX INFO: renamed from: ˊᵡᵗʨ, reason: contains not printable characters */
    public final synchronized ExecutorService m6722() {
        try {
            if (this.f10676 == null) {
                this.f10676 = Executors.newFixedThreadPool(AbstractC2252.f8911, new ThreadFactoryC2565(this));
            }
        } catch (Throwable th) {
            throw th;
        }
        return this.f10676;
    }

    /* JADX INFO: renamed from: ˊᵾʽʼ, reason: contains not printable characters */
    public void mo6723(ˉᵲ r2) {
        m6739(r2, 0);
    }

    /* JADX INFO: renamed from: ˋʿᐧ, reason: contains not printable characters */
    public final void m6724(int i, C1591 c1591, long j) {
        try {
            int i2 = AbstractC3817.f14473;
            try {
                this.f10699.ˌᴵ(AbstractC3817.m8520(i, 2, c1591, null, EnumC4161.f15879), this.f10702, j);
            } catch (Throwable unused) {
                AbstractC2252.m5866("BillingClient");
            }
        } catch (Throwable unused2) {
            AbstractC2252.m5866("BillingClient");
        }
    }

    /* JADX INFO: renamed from: ˋᵯᵩ, reason: contains not printable characters */
    public final void m6725(int i, C1591 c1591, String str, long j, boolean z) {
        try {
            int i2 = AbstractC3817.f14473;
            try {
                this.f10699.ᵔᵖᵹᵫ(AbstractC3817.m8520(i, 2, c1591, str, EnumC4161.f15879), this.f10702, j, z);
            } catch (Throwable unused) {
                AbstractC2252.m5866("BillingClient");
            }
        } catch (Throwable unused2) {
            AbstractC2252.m5866("BillingClient");
        }
    }

    /* JADX INFO: renamed from: ˏʜᵪ, reason: contains not printable characters */
    public final boolean m6726(long j) {
        long jMax;
        TimeUnit timeUnit = TimeUnit.MILLISECONDS;
        ᵣˉ r3 = this.f10689;
        if (r3 == null) {
            C4935.m10233("ticker");
            return false;
        }
        long j2 = r3.ᵛˑﹳ();
        int i = ᵸᵺᵜ.ˋˈ;
        long j3 = j;
        for (int i2 = 1; i2 <= i; i2++) {
            try {
                jMax = Math.max(0L, j3);
            } catch (Exception e) {
                if (e instanceof InterruptedException) {
                    Thread.currentThread().interrupt();
                }
                AbstractC2252.m5866("BillingClient");
            }
            if (jMax <= 0) {
                int i3 = AbstractC2252.f8911;
                Log.isLoggable("BillingClient", 5);
                return m6730();
            }
            int i4 = ((C1591) m6735(i2).get(jMax, timeUnit)).f6394;
            if (i4 == 0) {
                AbstractC2252.m5870("BillingClient", "Reconnection succeeded with result: " + i4);
                return m6730();
            }
            int i5 = AbstractC2252.f8911;
            Log.isLoggable("BillingClient", 5);
            j3 = j - (((r3.ᵛˑﹳ() - j2) + 0) / 1000000);
            long jPow = ((long) Math.pow(2.0d, i2 - 1)) * 1000;
            if (j3 < jPow) {
                Log.isLoggable("BillingClient", 5);
                return m6730();
            }
            if (i2 < i && jPow > 0) {
                try {
                    Thread.sleep(jPow);
                    j3 = j - (((r3.ᵛˑﹳ() - j2) + 0) / 1000000);
                } catch (InterruptedException unused) {
                    Thread.currentThread().interrupt();
                    AbstractC2252.m5866("BillingClient");
                }
            }
        }
        int i6 = AbstractC2252.f8911;
        Log.isLoggable("BillingClient", 5);
        return m6730();
    }

    /* JADX INFO: renamed from: ːᵝٴᵶ, reason: contains not printable characters */
    public final void m6727(C4112 c4112) {
        try {
            ʽᵺᴵ r1 = this.f10699;
            int i = this.f10702;
            r1.getClass();
            try {
                C3547 c3547 = (C3547) ((C4745) r1.ᵜᵪʾ).m10040();
                c3547.m11148();
                C4745.m9910((C4745) c3547.f20839, i);
                C4745 c4745 = (C4745) c3547.m11147();
                r1.ᵜᵪʾ = c4745;
                try {
                    r1.ˌᵨʠᵫ(c4112, c4745);
                } catch (Throwable unused) {
                    AbstractC2252.m5866("BillingLogger");
                }
            } catch (Throwable unused2) {
                AbstractC2252.m5866("BillingLogger");
            }
        } catch (Throwable unused3) {
            AbstractC2252.m5866("BillingClient");
        }
    }

    /* JADX INFO: renamed from: ˑʢ, reason: contains not printable characters */
    public final C1404 m6728(C1591 c1591, int i, Exception exc) {
        AbstractC2252.m5866("BillingClient");
        m6720(i, 7, c1591, AbstractC3817.m8522(exc));
        return new C1404(c1591.f6394, c1591.f6393, new ArrayList(), new ArrayList());
    }

    /* JADX INFO: renamed from: ᵗᵭ, reason: contains not printable characters */
    public final void m6729(int i, int i2, C1591 c1591) {
        try {
            int i3 = AbstractC3817.f14473;
            C2580 c2580 = (C2580) AbstractC3817.m8520(i, 6, c1591, null, EnumC4161.f15879).m10040();
            C3522 c3522M4110 = C1436.m4110();
            c3522M4110.m8035(i2 > 0);
            c3522M4110.m8036(i2);
            c2580.m6307(c3522M4110);
            m6731((C1887) c2580.m11147());
        } catch (Throwable unused) {
            AbstractC2252.m5866("BillingClient");
        }
    }

    /* JADX INFO: renamed from: ᵘᵝ, reason: contains not printable characters */
    public final boolean m6730() {
        boolean z;
        synchronized (this.f10680) {
            try {
                z = false;
                if (this.f10688 == 2 && this.f10701 != null && this.f10678 != null) {
                    z = true;
                }
            } finally {
            }
        }
        return z;
    }

    /* JADX INFO: renamed from: ᵜᵤ, reason: contains not printable characters */
    public final void m6731(C1887 c1887) {
        try {
            ʽᵺᴵ r0 = this.f10699;
            int i = this.f10702;
            r0.getClass();
            try {
                C3547 c3547 = (C3547) ((C4745) r0.ᵜᵪʾ).m10040();
                c3547.m11148();
                C4745.m9910((C4745) c3547.f20839, i);
                r0.ᵜᵪʾ = (C4745) c3547.m11147();
                r0.ˏːˆ(c1887);
            } catch (Throwable unused) {
                AbstractC2252.m5866("BillingLogger");
            }
        } catch (Throwable unused2) {
            AbstractC2252.m5866("BillingClient");
        }
    }

    /* JADX INFO: renamed from: ᵞᵛᵘ, reason: contains not printable characters */
    public final void m6732() {
        if (TextUtils.isEmpty(null)) {
            this.f10698.getPackageName();
        }
    }

    /* JADX INFO: renamed from: ᵡᵶ, reason: contains not printable characters */
    public final ʽᵺᴵ m6733(C1591 c1591, int i, Exception exc) {
        m6720(i, 9, c1591, AbstractC3817.m8522(exc));
        AbstractC2252.m5866("BillingClient");
        return new ʽᵺᴵ(c1591, 11, (Object) null);
    }

    /* JADX INFO: renamed from: ᵡᵶᵬʤ, reason: contains not printable characters */
    public final void m6734(int i, int i2, C1591 c1591) {
        try {
            int i3 = AbstractC3817.f14473;
            m6731(AbstractC3817.m8520(i, i2, c1591, null, EnumC4161.f15879));
        } catch (Throwable unused) {
            AbstractC2252.m5866("BillingClient");
        }
    }

    /* JADX INFO: renamed from: ᵨˈʼﹶ, reason: contains not printable characters */
    public final InterfaceFutureC1876 m6735(int i) {
        if (!this.f10697 || m6730()) {
            AbstractC2252.m5870("BillingClient", "Already connected or not opted into auto reconnection.");
            return new C1880(AbstractC4228.f16131);
        }
        C1131 c1131 = new C1131();
        c1131.f4833 = new C2125();
        C1326 c1326 = new C1326(c1131);
        c1131.f4832 = c1326;
        c1131.f4834 = ˀᵳˎᵹ.class;
        try {
            m6739(new C2991(this, c1131, false), i);
            c1131.f4834 = "reconnectIfNeeded";
            return c1326;
        } catch (Exception e) {
            c1326.m3845(e);
            return c1326;
        }
    }

    /* JADX INFO: renamed from: ᵫˈᵹ, reason: contains not printable characters */
    public final void m6736(int i) {
        synchronized (this.f10680) {
            try {
                if (this.f10688 == 3) {
                    return;
                }
                int i2 = this.f10688;
                AbstractC2252.m5870("BillingClient", "Setting clientState from " + (i2 != 0 ? i2 != 1 ? i2 != 2 ? "CLOSED" : "CONNECTED" : "CONNECTING" : "DISCONNECTED") + " to " + (i != 0 ? i != 1 ? i != 2 ? "CLOSED" : "CONNECTED" : "CONNECTING" : "DISCONNECTED"));
                this.f10688 = i;
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX INFO: renamed from: ᵬᵦˋ, reason: contains not printable characters */
    public final void m6737() {
        synchronized (this.f10680) {
            if (this.f10678 != null) {
                try {
                    try {
                        this.f10698.unbindService(this.f10678);
                    } finally {
                        this.f10701 = null;
                        this.f10678 = null;
                    }
                } catch (Throwable unused) {
                    AbstractC2252.m5866("BillingClient");
                    this.f10701 = null;
                    this.f10678 = null;
                }
            }
        }
    }

    /* JADX INFO: renamed from: ᵵᵬᵽ, reason: contains not printable characters */
    public final Handler m6738() {
        return Looper.myLooper() == null ? this.f10694 : new Handler(Looper.myLooper());
    }

    /* JADX INFO: renamed from: ᵵᵸᵕᵸ, reason: contains not printable characters */
    public final void m6739(InterfaceC5118 interfaceC5118, int i) {
        int i2;
        C1591 c1591M6713;
        C1591 c1591;
        synchronized (this.f10680) {
            try {
                if (m6730()) {
                    c1591M6713 = m6713(i);
                } else {
                    if (this.f10688 == 1) {
                        int i3 = AbstractC2252.f8911;
                        Log.isLoggable("BillingClient", 5);
                        c1591 = AbstractC4228.f16130;
                        m6729(37, i, c1591);
                    } else if (this.f10688 == 3) {
                        int i4 = AbstractC2252.f8911;
                        Log.isLoggable("BillingClient", 5);
                        c1591 = AbstractC4228.f16126;
                        m6729(38, i, c1591);
                    } else {
                        m6736(1);
                        if (i == 0) {
                            this.f10682 = interfaceC5118;
                            i = 0;
                        }
                        m6737();
                        AbstractC2252.m5870("BillingClient", "Starting in-app billing setup.");
                        this.f10678 = new ServiceConnectionC4611(this, interfaceC5118, i);
                        this.f10678.m9724();
                        Intent intent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
                        intent.setPackage("com.android.vending");
                        List<ResolveInfo> listQueryIntentServices = this.f10698.getPackageManager().queryIntentServices(intent, 0);
                        if (listQueryIntentServices == null || listQueryIntentServices.isEmpty()) {
                            i2 = 41;
                        } else {
                            ServiceInfo serviceInfo = listQueryIntentServices.get(0).serviceInfo;
                            i2 = 40;
                            if (serviceInfo != null) {
                                String str = serviceInfo.packageName;
                                String str2 = serviceInfo.name;
                                if (!Objects.equals(str, "com.android.vending") || str2 == null) {
                                    Log.isLoggable("BillingClient", 5);
                                } else {
                                    ComponentName componentName = new ComponentName(str, str2);
                                    Intent intent2 = new Intent(intent);
                                    intent2.setComponent(componentName);
                                    intent2.putExtra("playBillingLibraryVersion", this.f10684);
                                    synchronized (this.f10680) {
                                        try {
                                            if (this.f10688 == 2) {
                                                c1591M6713 = m6713(i);
                                            } else if (this.f10688 != 1) {
                                                Log.isLoggable("BillingClient", 5);
                                                c1591 = AbstractC4228.f16126;
                                                m6729(105, i, c1591);
                                            } else {
                                                ServiceConnectionC4611 serviceConnectionC4611 = this.f10678;
                                                if ((i <= 0 || Build.VERSION.SDK_INT < 29) ? this.f10698.bindService(intent2, serviceConnectionC4611, 1) : this.f10698.bindService(intent2, 1, m6722(), serviceConnectionC4611)) {
                                                    AbstractC2252.m5870("BillingClient", "Service was bonded successfully.");
                                                    c1591M6713 = null;
                                                } else {
                                                    Log.isLoggable("BillingClient", 5);
                                                    i2 = 39;
                                                }
                                            }
                                        } finally {
                                        }
                                    }
                                }
                            } else {
                                Log.isLoggable("BillingClient", 5);
                            }
                        }
                        m6736(0);
                        AbstractC2252.m5870("BillingClient", "Billing service unavailable on device.");
                        C1591 c15912 = AbstractC4228.f16114;
                        m6729(i2, i, c15912);
                        c1591M6713 = c15912;
                    }
                    c1591M6713 = c1591;
                }
            } finally {
            }
        }
        if (c1591M6713 != null) {
            interfaceC5118.mo7067(c1591M6713);
        }
    }
}
