package o;

import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.location.LocationManager;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import java.util.ArrayList;
import java.util.WeakHashMap;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.atomic.AtomicReference;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class C70 implements InterfaceC2956xx, InterfaceC3051yx, T8, HT, InterfaceC0761at0, Qq0 {
    public static C70 p;
    public final /* synthetic */ int l;
    public Object m;
    public Object n;

    /* renamed from: o, reason: collision with root package name */
    public Object f65o;

    public /* synthetic */ C70(Object obj, Object obj2, Object obj3, int i) {
        this.l = i;
        this.m = obj;
        this.n = obj2;
        this.f65o = obj3;
    }

    public static C70 r(Context context, AttributeSet attributeSet, int[] iArr, int i) {
        return new C70(context, context.obtainStyledAttributes(attributeSet, iArr, i, 0));
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:15:0x0032 A[Catch: all -> 0x0023, TryCatch #0 {all -> 0x0023, blocks: (B:6:0x0020, B:21:0x006b, B:24:0x008f, B:15:0x0032, B:17:0x0058, B:19:0x0063, B:20:0x0067), top: B:31:0x0020 }] */
    /* JADX WARN: Removed duplicated region for block: B:20:0x0067 A[Catch: all -> 0x0023, TryCatch #0 {all -> 0x0023, blocks: (B:6:0x0020, B:21:0x006b, B:24:0x008f, B:15:0x0032, B:17:0x0058, B:19:0x0063, B:20:0x0067), top: B:31:0x0020 }] */
    /* JADX WARN: Removed duplicated region for block: B:23:0x008e  */
    /* JADX WARN: Type inference failed for: r11v7, types: [java.lang.String] */
    @Override // o.Qq0
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public void a(java.lang.String r8, int r9, java.lang.Throwable r10, byte[] r11, java.util.Map r12) {
        /*
            r7 = this;
            int r8 = r7.l
            switch(r8) {
                case 12: goto Lad;
                default: goto L5;
            }
        L5:
            java.lang.Object r8 = r7.n
            o.iv0 r8 = (o.C1529iv0) r8
            long r0 = r8.a
            java.lang.Object r8 = r7.f65o
            o.dv0 r8 = (o.C1051dv0) r8
            java.lang.Object r12 = r7.m
            java.lang.String r12 = (java.lang.String) r12
            o.Fr0 r2 = r8.c()
            r2.r()
            r8.k0()
            r2 = 0
            if (r11 != 0) goto L27
            byte[] r11 = new byte[r2]     // Catch: java.lang.Throwable -> L23
            goto L27
        L23:
            r0 = move-exception
            r9 = r0
            goto La7
        L27:
            r3 = 200(0xc8, float:2.8E-43)
            if (r9 == r3) goto L30
            r3 = 204(0xcc, float:2.86E-43)
            if (r9 != r3) goto L6b
            r9 = r3
        L30:
            if (r10 != 0) goto L6b
            o.xo0 r10 = r8.c     // Catch: java.lang.Throwable -> L23
            o.C1051dv0.T(r10)     // Catch: java.lang.Throwable -> L23
            java.lang.Long r11 = java.lang.Long.valueOf(r0)     // Catch: java.lang.Throwable -> L23
            r10.z(r11)     // Catch: java.lang.Throwable -> L23
            o.Nq0 r10 = r8.b()     // Catch: java.lang.Throwable -> L23
            o.nl r10 = r10.n     // Catch: java.lang.Throwable -> L23
            java.lang.String r11 = "Successfully uploaded batch from upload queue. appId, status"
            java.lang.Integer r9 = java.lang.Integer.valueOf(r9)     // Catch: java.lang.Throwable -> L23
            r10.d(r11, r12, r9)     // Catch: java.lang.Throwable -> L23
            o.Uq0 r9 = r8.b     // Catch: java.lang.Throwable -> L23
            o.C1051dv0.T(r9)     // Catch: java.lang.Throwable -> L23
            boolean r9 = r9.w()     // Catch: java.lang.Throwable -> L23
            if (r9 == 0) goto L67
            o.xo0 r9 = r8.c     // Catch: java.lang.Throwable -> L23
            o.C1051dv0.T(r9)     // Catch: java.lang.Throwable -> L23
            boolean r9 = r9.y(r12)     // Catch: java.lang.Throwable -> L23
            if (r9 == 0) goto L67
            r8.t(r12)     // Catch: java.lang.Throwable -> L23
            goto La1
        L67:
            r8.N()     // Catch: java.lang.Throwable -> L23
            goto La1
        L6b:
            java.lang.String r3 = new java.lang.String     // Catch: java.lang.Throwable -> L23
            java.nio.charset.Charset r4 = java.nio.charset.StandardCharsets.UTF_8     // Catch: java.lang.Throwable -> L23
            r3.<init>(r11, r4)     // Catch: java.lang.Throwable -> L23
            int r11 = r3.length()     // Catch: java.lang.Throwable -> L23
            r4 = 32
            int r11 = java.lang.Math.min(r4, r11)     // Catch: java.lang.Throwable -> L23
            java.lang.String r11 = r3.substring(r2, r11)     // Catch: java.lang.Throwable -> L23
            o.Nq0 r3 = r8.b()     // Catch: java.lang.Throwable -> L23
            o.nl r3 = r3.k     // Catch: java.lang.Throwable -> L23
            java.lang.String r4 = "Network upload failed. Will retry later. appId, status, error"
            java.lang.Integer r9 = java.lang.Integer.valueOf(r9)     // Catch: java.lang.Throwable -> L23
            if (r10 != 0) goto L8f
            r10 = r11
        L8f:
            r3.e(r4, r12, r9, r10)     // Catch: java.lang.Throwable -> L23
            o.xo0 r9 = r8.c     // Catch: java.lang.Throwable -> L23
            o.C1051dv0.T(r9)     // Catch: java.lang.Throwable -> L23
            java.lang.Long r10 = java.lang.Long.valueOf(r0)     // Catch: java.lang.Throwable -> L23
            r9.E(r10)     // Catch: java.lang.Throwable -> L23
            r8.N()     // Catch: java.lang.Throwable -> L23
        La1:
            r8.u = r2
            r8.O()
            return
        La7:
            r8.u = r2
            r8.O()
            throw r9
        Lad:
            java.lang.Object r8 = r7.f65o
            r0 = r8
            o.dv0 r0 = (o.C1051dv0) r0
            java.lang.Object r8 = r7.m
            r5 = r8
            java.lang.String r5 = (java.lang.String) r5
            java.lang.Object r8 = r7.n
            r6 = r8
            java.util.ArrayList r6 = (java.util.ArrayList) r6
            r1 = 1
            r2 = r9
            r3 = r10
            r4 = r11
            r0.y(r1, r2, r3, r4, r5, r6)
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C70.a(java.lang.String, int, java.lang.Throwable, byte[], java.util.Map):void");
    }

    /* JADX WARN: Removed duplicated region for block: B:10:0x001a  */
    /* JADX WARN: Removed duplicated region for block: B:13:0x006a  */
    /* JADX WARN: Removed duplicated region for block: B:14:0x006d  */
    @Override // o.InterfaceC0761at0
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public void b(int r9, java.lang.Throwable r10, byte[] r11) {
        /*
            r8 = this;
            java.lang.Object r11 = r8.m
            o.Xs0 r11 = (o.Xs0) r11
            r11.r()
            java.lang.Object r0 = r8.f65o
            o.Au0 r0 = (o.Au0) r0
            r1 = 200(0xc8, float:2.8E-43)
            if (r9 == r1) goto L18
            r1 = 204(0xcc, float:2.86E-43)
            if (r9 == r1) goto L18
            r1 = 304(0x130, float:4.26E-43)
            if (r9 != r1) goto L33
            r9 = r1
        L18:
            if (r10 != 0) goto L33
            java.lang.Object r9 = r11.a
            o.Kr0 r9 = (o.Kr0) r9
            o.Nq0 r9 = r9.f
            o.Kr0.l(r9)
            o.nl r9 = r9.n
            long r1 = r0.l
            java.lang.Long r10 = java.lang.Long.valueOf(r1)
            java.lang.String r1 = "[sgtm] Upload succeeded for row_id"
            r9.c(r10, r1)
            o.et0 r9 = o.EnumC1143et0.n
            goto L6f
        L33:
            java.lang.Object r1 = r11.a
            o.Kr0 r1 = (o.Kr0) r1
            o.Nq0 r1 = r1.f
            o.Kr0.l(r1)
            o.nl r1 = r1.i
            long r2 = r0.l
            java.lang.Long r2 = java.lang.Long.valueOf(r2)
            java.lang.Integer r3 = java.lang.Integer.valueOf(r9)
            java.lang.String r4 = "[sgtm] Upload failed for row_id. response, exception"
            r1.e(r4, r2, r3, r10)
            o.lq0 r10 = o.AbstractC1900mq0.u
            r1 = 0
            java.lang.Object r10 = r10.a(r1)
            java.lang.String r10 = (java.lang.String) r10
            java.lang.String r1 = ","
            java.lang.String[] r10 = r10.split(r1)
            java.util.List r10 = java.util.Arrays.asList(r10)
            java.lang.String r9 = java.lang.String.valueOf(r9)
            boolean r9 = r10.contains(r9)
            if (r9 == 0) goto L6d
            o.et0 r9 = o.EnumC1143et0.p
            goto L6f
        L6d:
            o.et0 r9 = o.EnumC1143et0.f515o
        L6f:
            java.lang.Object r10 = r8.n
            java.util.concurrent.atomic.AtomicReference r10 = (java.util.concurrent.atomic.AtomicReference) r10
            java.lang.Object r1 = r11.a
            o.Kr0 r1 = (o.Kr0) r1
            o.Vt0 r1 = r1.o()
            o.Sn0 r2 = new o.Sn0
            long r4 = r0.l
            int r3 = r9.l
            long r6 = r0.q
            r2.<init>(r3, r4, r6)
            r1.r()
            r1.t()
            r0 = 1
            o.iw0 r0 = r1.I(r0)
            com.google.android.gms.common.internal.Preconditions.checkNotNull(r0)
            o.Jl r3 = new o.Jl
            r6 = 12
            r3.<init>(r1, r0, r2, r6)
            r1.G(r3)
            java.lang.Object r11 = r11.a
            o.Kr0 r11 = (o.Kr0) r11
            o.Nq0 r11 = r11.f
            o.Kr0.l(r11)
            o.nl r11 = r11.n
            java.lang.Long r0 = java.lang.Long.valueOf(r4)
            java.lang.String r1 = "[sgtm] Updated status for row_id"
            r11.d(r1, r0, r9)
            monitor-enter(r10)
            r10.set(r9)     // Catch: java.lang.Throwable -> Lbb
            r10.notifyAll()     // Catch: java.lang.Throwable -> Lbb
            monitor-exit(r10)     // Catch: java.lang.Throwable -> Lbb
            return
        Lbb:
            r0 = move-exception
            r9 = r0
            monitor-exit(r10)     // Catch: java.lang.Throwable -> Lbb
            throw r9
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C70.b(int, java.lang.Throwable, byte[]):void");
    }

    @Override // o.T8
    public void c(int i, Object obj) {
        ((C2420sK) this.f65o).y(i, (C2420sK) obj);
    }

    public /* bridge */ /* synthetic */ Object clone() {
        switch (this.l) {
            case 8:
                C70 c70 = new C70(((Kn0) this.m).clone());
                ArrayList arrayList = (ArrayList) this.f65o;
                int size = arrayList.size();
                int i = 0;
                while (i < size) {
                    Object obj = arrayList.get(i);
                    i++;
                    ((ArrayList) c70.f65o).add(((Kn0) obj).clone());
                }
                return c70;
            default:
                return super.clone();
        }
    }

    @Override // o.T8
    public void d(Object obj) {
        ((ArrayList) this.n).add(this.f65o);
        this.f65o = obj;
    }

    @Override // o.T8
    public void e() {
        R2 r2;
        C2420sK c2420sK = (C2420sK) this.f65o;
        C0312Mb c0312Mb = c2420sK.N;
        if (!c2420sK.G()) {
            AbstractC2133pH.a("onReuse is only expected on attached node");
        }
        Tj0 tj0 = c2420sK.y;
        if (tj0 != null) {
            View view = tj0.m;
            if (view.getParent() != tj0) {
                tj0.addView(view);
            } else {
                tj0.q.a();
            }
        }
        c2420sK.D = false;
        if (c2420sK.X) {
            c2420sK.X = false;
        } else {
            LP lp = (Bc0) c2420sK.N.f;
            for (LP lp2 = lp; lp2 != null; lp2 = lp2.p) {
                if (lp2.y) {
                    lp2.C0();
                }
            }
            for (LP lp3 = lp; lp3 != null; lp3 = lp3.p) {
                if (lp3.y) {
                    lp3.E0();
                }
            }
            while (lp != null) {
                if (lp.y) {
                    lp.y0();
                }
                lp = lp.p;
            }
        }
        int i = c2420sK.m;
        c2420sK.m = O50.a.addAndGet(1);
        InterfaceC1577jV interfaceC1577jV = c2420sK.x;
        if (interfaceC1577jV != null) {
            C2207q3 c2207q3 = (C2207q3) interfaceC1577jV;
            c2207q3.m6getLayoutNodes().g(i);
            c2207q3.m6getLayoutNodes().h(c2420sK.m, c2420sK);
        }
        for (LP lp4 = (LP) c0312Mb.g; lp4 != null; lp4 = lp4.q) {
            lp4.x0();
        }
        c0312Mb.l();
        if (c0312Mb.j(8)) {
            c2420sK.E();
        }
        C2420sK.R(c2420sK);
        InterfaceC1577jV interfaceC1577jV2 = c2420sK.x;
        if (interfaceC1577jV2 != null) {
            C2207q3 c2207q32 = (C2207q3) interfaceC1577jV2;
            if (C2207q3.i() && (r2 = c2207q32.Q) != null) {
                C2207q3 c2207q33 = r2.c;
                WT wt = r2.a;
                JQ jq = r2.h;
                if (jq.e(i)) {
                    wt.e(c2207q33, i, false);
                }
                N50 n50U = c2420sK.u();
                if (n50U != null && n50U.l.b(W50.q)) {
                    jq.a(c2420sK.m);
                    wt.e(c2207q33, c2420sK.m, true);
                }
            }
            c2207q32.getRectManager().g(c2420sK, true);
        }
    }

    @Override // o.T8
    public /* bridge */ /* synthetic */ void f(int i, Object obj) {
    }

    @Override // o.T8
    public void g(int i, int i2, int i3) {
        C2420sK c2420sK = (C2420sK) this.f65o;
        DH dh = c2420sK.t;
        if (i == i2) {
            return;
        }
        for (int i4 = 0; i4 < i3; i4++) {
            int i5 = i > i2 ? i + i4 : i;
            int i6 = i > i2 ? i2 + i4 : (i2 + i3) - 2;
            C1479iR c1479iR = (C1479iR) dh.l;
            U4 u4 = (U4) dh.m;
            Object objK = c1479iR.k(i5);
            u4.a();
            ((C1479iR) dh.l).a(i6, (C2420sK) objK);
            u4.a();
        }
        c2420sK.L();
        c2420sK.F();
        c2420sK.B();
    }

    @Override // o.CZ
    public Object get() {
        switch (this.l) {
            case 0:
                return new B70((InterfaceC2747vn) ((CZ) this.m).get(), (C3017yf0) ((CZ) this.n).get(), (InterfaceC1326gp) ((BZ) this.f65o).get());
            case 1:
                long jV = AbstractC2539te.v();
                if (jV == AbstractC2163pf0.a) {
                    return this.f65o;
                }
                C1783lf0 c1783lf0 = (C1783lf0) ((AtomicReference) this.m).get();
                int iA = c1783lf0.a(jV);
                if (iA >= 0) {
                    return c1783lf0.c[iA];
                }
                return null;
            default:
                return new Ug0(new C2616uQ(25), new C2616uQ(23), (C40) ((Q1) this.m).get(), (C0598Xb) ((C1533iy) this.n).get(), (C2062oc0) ((S60) this.f65o).get());
        }
    }

    @Override // o.T8
    public Object h() {
        return this.f65o;
    }

    @Override // o.T8
    public void i(int i, int i2) {
        C2420sK c2420sK = (C2420sK) this.f65o;
        DH dh = c2420sK.t;
        if (i2 < 0) {
            AbstractC2133pH.a("count (" + i2 + ") must be greater than 0");
        }
        int i3 = (i2 + i) - 1;
        if (i > i3) {
            return;
        }
        while (true) {
            c2420sK.J((C2420sK) ((C1479iR) dh.l).l[i3]);
            Object objK = ((C1479iR) dh.l).k(i3);
            ((U4) dh.m).a();
            if (i3 == i) {
                return;
            } else {
                i3--;
            }
        }
    }

    public void j() {
        ((ArrayList) this.n).clear();
        this.f65o = this.m;
        C2420sK c2420sK = (C2420sK) this.m;
        DH dh = c2420sK.t;
        C1479iR c1479iR = (C1479iR) dh.l;
        int i = c1479iR.n;
        while (true) {
            i--;
            if (-1 >= i) {
                c1479iR.h();
                ((U4) dh.m).a();
                return;
            }
            c2420sK.J((C2420sK) c1479iR.l[i]);
        }
    }

    public ColorStateList l(int i) {
        int resourceId;
        ColorStateList colorStateListZ;
        TypedArray typedArray = (TypedArray) this.n;
        return (!typedArray.hasValue(i) || (resourceId = typedArray.getResourceId(i, 0)) == 0 || (colorStateListZ = Co0.z((Context) this.m, resourceId)) == null) ? typedArray.getColorStateList(i) : colorStateListZ;
    }

    public Drawable m(int i) {
        int resourceId;
        TypedArray typedArray = (TypedArray) this.n;
        return (!typedArray.hasValue(i) || (resourceId = typedArray.getResourceId(i, 0)) == 0) ? typedArray.getDrawable(i) : C80.x((Context) this.m, resourceId);
    }

    public Drawable n(int i) {
        int resourceId;
        Drawable drawableD;
        if (!((TypedArray) this.n).hasValue(i) || (resourceId = ((TypedArray) this.n).getResourceId(i, 0)) == 0) {
            return null;
        }
        V7 v7A = V7.a();
        Context context = (Context) this.m;
        synchronized (v7A) {
            drawableD = v7A.a.d(context, resourceId, true);
        }
        return drawableD;
    }

    public Typeface o(int i, int i2, C2691v8 c2691v8) {
        int resourceId = ((TypedArray) this.n).getResourceId(i, 0);
        if (resourceId == 0) {
            return null;
        }
        if (((TypedValue) this.f65o) == null) {
            this.f65o = new TypedValue();
        }
        Context context = (Context) this.m;
        TypedValue typedValue = (TypedValue) this.f65o;
        ThreadLocal threadLocal = AbstractC3060z20.a;
        if (context.isRestricted()) {
            return null;
        }
        return AbstractC3060z20.b(context, resourceId, typedValue, i2, c2691v8, true, false);
    }

    @Override // o.HT
    public void onComplete(Pc0 pc0) {
        B30 b30 = (B30) this.m;
        String str = (String) this.n;
        ScheduledFuture scheduledFuture = (ScheduledFuture) this.f65o;
        synchronized (b30.a) {
            b30.a.remove(str);
        }
        scheduledFuture.cancel(false);
    }

    public boolean p() {
        if (((InterfaceC3007ya0) this.m).getValue() != this.f65o) {
            return true;
        }
        C70 c70 = (C70) this.n;
        return c70 != null && c70.p();
    }

    @Override // o.T8
    public void q() {
        this.f65o = ((ArrayList) this.n).remove(r0.size() - 1);
    }

    public void s() {
        InterfaceC1577jV interfaceC1577jV = ((C2420sK) this.m).x;
        if (interfaceC1577jV != null) {
            ((C2207q3) interfaceC1577jV).x();
        }
    }

    public void t() {
        ((TypedArray) this.n).recycle();
    }

    public void u(Object obj) {
        long jV = AbstractC2539te.v();
        if (jV == AbstractC2163pf0.a) {
            this.f65o = obj;
            return;
        }
        synchronized (this.n) {
            C1783lf0 c1783lf0 = (C1783lf0) ((AtomicReference) this.m).get();
            int iA = c1783lf0.a(jV);
            if (iA < 0) {
                ((AtomicReference) this.m).set(c1783lf0.b(jV, obj));
            } else {
                c1783lf0.c[iA] = obj;
            }
        }
    }

    public /* synthetic */ C70(C1051dv0 c1051dv0, String str, Object obj, int i) {
        this.l = i;
        this.m = str;
        this.n = obj;
        this.f65o = c1051dv0;
    }

    public C70(Kn0 kn0) {
        this.l = 8;
        this.m = kn0;
        this.n = kn0.clone();
        this.f65o = new ArrayList();
    }

    public C70(int i) {
        this.l = i;
        switch (i) {
            case 6:
                this.m = new WeakHashMap();
                this.n = new WeakHashMap();
                this.f65o = new WeakHashMap();
                break;
            case 7:
            default:
                this.m = new AtomicReference(AbstractC2539te.d);
                this.n = new Object();
                break;
            case 8:
                this.m = new Kn0("", 0L, null);
                this.n = new Kn0("", 0L, null);
                this.f65o = new ArrayList();
                break;
        }
    }

    public C70(Context context, TypedArray typedArray) {
        this.l = 2;
        this.m = context;
        this.n = typedArray;
    }

    public C70(Context context, LocationManager locationManager) {
        this.l = 4;
        this.f65o = new C1502ih0();
        this.m = context;
        this.n = locationManager;
    }

    public C70(C2926xh0 c2926xh0, C70 c70) {
        this.l = 5;
        this.m = c2926xh0;
        this.n = c70;
        this.f65o = c2926xh0.l;
    }

    public C70(C2420sK c2420sK) {
        this.l = 7;
        this.m = c2420sK;
        this.n = new ArrayList();
        this.f65o = c2420sK;
    }
}
