package o;

import android.content.res.AssetManager;
import android.os.Build;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.Api;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.util.Iterator;
import java.util.concurrent.Executor;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.Gr, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C0173Gr {
    public boolean a;
    public final Object b;
    public final Object c;
    public final Serializable d;
    public Object e;
    public final Object f;
    public Object g;
    public Object h;

    public C0173Gr(C2160pe c2160pe, C1565jJ c1565jJ, Vm0 vm0, C0173Gr[] c0173GrArr) {
        this.b = c2160pe;
        this.c = c1565jJ;
        this.d = vm0;
        this.e = c0173GrArr;
        this.f = c1565jJ.a;
        int iOrdinal = vm0.ordinal();
        if (c0173GrArr != null) {
            C0173Gr c0173Gr = c0173GrArr[iOrdinal];
            if (c0173Gr == null && c0173Gr == this) {
                return;
            }
            c0173GrArr[iOrdinal] = this;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:8:0x001f  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static final java.lang.Object a(o.C0173Gr r16, o.C2212q50 r17, o.C1382hQ r18, float r19, float r20, o.AbstractC0298Lm r21) {
        /*
            Method dump skipped, instructions count: 307
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C0173Gr.a(o.Gr, o.q50, o.hQ, float, float, o.Lm):java.lang.Object");
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x0017  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static final java.lang.Object b(o.C0173Gr r11, o.B10 r12, o.C2963y10 r13, o.C2212q50 r14, o.B10 r15, long r16, o.AbstractC0298Lm r18) throws java.lang.Throwable {
        /*
            r0 = r16
            r2 = r18
            boolean r3 = r2 instanceof o.C1667kQ
            if (r3 == 0) goto L17
            r3 = r2
            o.kQ r3 = (o.C1667kQ) r3
            int r4 = r3.u
            r5 = -2147483648(0xffffffff80000000, float:-0.0)
            r6 = r4 & r5
            if (r6 == 0) goto L17
            int r4 = r4 - r5
            r3.u = r4
            goto L1c
        L17:
            o.kQ r3 = new o.kQ
            r3.<init>(r2)
        L1c:
            java.lang.Object r2 = r3.t
            int r4 = r3.u
            r5 = 1
            if (r4 == 0) goto L3f
            if (r4 != r5) goto L37
            o.B10 r11 = r3.s
            o.q50 r12 = r3.r
            o.y10 r0 = r3.q
            o.B10 r1 = r3.p
            o.Gr r3 = r3.f613o
            o.IJ.H(r2)
            r7 = r11
            r6 = r12
            r12 = r1
            r11 = r3
            goto L6a
        L37:
            java.lang.IllegalStateException r11 = new java.lang.IllegalStateException
            java.lang.String r12 = "call to 'resume' before 'invoke' with coroutine"
            r11.<init>(r12)
            throw r11
        L3f:
            o.IJ.H(r2)
            r6 = 0
            int r2 = (r0 > r6 ? 1 : (r0 == r6 ? 0 : -1))
            if (r2 >= 0) goto L4b
            java.lang.Boolean r11 = java.lang.Boolean.FALSE
            return r11
        L4b:
            o.D9 r2 = new o.D9
            r4 = 0
            r6 = 6
            r2.<init>(r11, r4, r6)
            r3.f613o = r11
            r3.p = r12
            r3.q = r13
            r3.r = r14
            r3.s = r15
            r3.u = r5
            java.lang.Object r2 = o.AbstractC0662Zn.M(r0, r2, r3)
            o.Dn r0 = o.EnumC0091Dn.l
            if (r2 != r0) goto L67
            return r0
        L67:
            r0 = r13
            r6 = r14
            r7 = r15
        L6a:
            o.hQ r2 = (o.C1382hQ) r2
            if (r2 == 0) goto La4
            java.lang.Object r1 = r12.l
            o.hQ r1 = (o.C1382hQ) r1
            boolean r1 = r1.c
            long r3 = r2.a
            long r8 = r2.b
            o.hQ r10 = new o.hQ
            r18 = r1
            r14 = r3
            r16 = r8
            r13 = r10
            r13.<init>(r14, r16, r18)
            r1 = r13
            r12.l = r1
            long r3 = r6.e(r3)
            float r12 = r6.g(r3)
            r0.l = r12
            r12 = 0
            r1 = 30
            o.S6 r12 = o.C2887xC.a(r1, r12)
            r7.l = r12
            r11.r(r2)
            float r11 = r0.l
            boolean r11 = o.AbstractC1286gQ.a(r11)
            r11 = r11 ^ r5
            goto La5
        La4:
            r11 = 0
        La5:
            java.lang.Boolean r11 = java.lang.Boolean.valueOf(r11)
            return r11
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C0173Gr.b(o.Gr, o.B10, o.y10, o.q50, o.B10, long, o.Lm):java.lang.Object");
    }

    /* JADX WARN: Multi-variable type inference failed */
    public static C1382hQ q(C1210ff c1210ff) {
        C1382hQ c1382hQ = null;
        G60 g60C = AbstractC2461sm0.C(new SA((Object) new C1164f5(11, c1210ff), (InterfaceC0220Im) (0 == true ? 1 : 0), 2));
        while (g60C.hasNext()) {
            C1382hQ c1382hQA = (C1382hQ) g60C.next();
            if (c1382hQ != null) {
                c1382hQA = c1382hQ.a(c1382hQA);
            }
            c1382hQ = c1382hQA;
        }
        return c1382hQ;
    }

    public C0173Gr c(L60 l60) {
        C0173Gr c0173Gr;
        C0173Gr[] c0173GrArr = (C0173Gr[]) this.e;
        C1565jJ c1565jJ = (C1565jJ) this.c;
        Vm0 vm0F = AbstractC1155f00.F(c1565jJ, l60);
        char c = vm0F.l;
        C2160pe c2160pe = (C2160pe) this.b;
        c2160pe.f(c);
        c2160pe.l = true;
        String str = (String) this.g;
        if (str != null) {
            String strB = (String) this.h;
            if (strB == null) {
                strB = l60.b();
            }
            c2160pe.e();
            l(str);
            c2160pe.f(':');
            l(strB);
            this.g = null;
            this.h = null;
        }
        return ((Vm0) this.d) == vm0F ? this : (c0173GrArr == null || (c0173Gr = c0173GrArr[vm0F.ordinal()]) == null) ? new C0173Gr(c2160pe, c1565jJ, vm0F, c0173GrArr) : c0173Gr;
    }

    public float d(C2022o50 c2022o50, float f) {
        C2212q50 c2212q50 = (C2212q50) this.b;
        long jH = c2212q50.h(c2212q50.d(f));
        C2212q50 c2212q502 = c2022o50.a;
        return c2212q50.g(c2212q50.e(c2212q502.c(c2212q502.k, jH, 1)));
    }

    public void e(L60 l60, int i) {
        C2160pe c2160pe = (C2160pe) this.b;
        int iOrdinal = ((Vm0) this.d).ordinal();
        boolean z = true;
        if (iOrdinal == 1) {
            if (!c2160pe.l) {
                c2160pe.f(',');
            }
            c2160pe.e();
            return;
        }
        if (iOrdinal == 2) {
            if (c2160pe.l) {
                this.a = true;
                c2160pe.e();
                return;
            }
            if (i % 2 == 0) {
                c2160pe.f(',');
                c2160pe.e();
            } else {
                c2160pe.f(':');
                c2160pe.g();
                z = false;
            }
            this.a = z;
            return;
        }
        if (iOrdinal != 3) {
            if (!c2160pe.l) {
                c2160pe.f(',');
            }
            c2160pe.e();
            AbstractC0940cn0.E((C1565jJ) this.c, l60);
            l(l60.e(i));
            c2160pe.f(':');
            c2160pe.g();
            return;
        }
        if (i == 0) {
            this.a = true;
        }
        if (i == 1) {
            c2160pe.f(',');
            c2160pe.g();
            this.a = false;
        }
    }

    public void f(int i) {
        if (this.a) {
            l(String.valueOf(i));
        } else {
            ((C1254g2) ((C2160pe) this.b).m).j(String.valueOf(i));
        }
    }

    public void g(long j) {
        if (this.a) {
            l(String.valueOf(j));
        } else {
            ((C1254g2) ((C2160pe) this.b).m).j(String.valueOf(j));
        }
    }

    public void h() {
        ((C1254g2) ((C2160pe) this.b).m).j("null");
    }

    public void i(L60 l60, int i, EJ ej, Object obj) {
        if (obj == null) {
            ((C0688a6) this.f).getClass();
        }
        e(l60, i);
        if (ej.d().h()) {
            k(ej, obj);
        } else if (obj == null) {
            h();
        } else {
            k(ej, obj);
        }
    }

    public void j(L60 l60, int i, EJ ej, Object obj) {
        e(l60, i);
        k(ej, obj);
    }

    public void k(EJ ej, Object obj) {
        String strDiscriminator;
        C0688a6 c0688a6 = ((C1565jJ) this.c).a;
        c0688a6.getClass();
        int iW = AbstractC2462sn.w(3);
        if (iW == 0) {
            strDiscriminator = null;
        } else {
            if (iW == 1) {
                AbstractC2841wm0 abstractC2841wm0C = ej.d().c();
                if (F3.c(abstractC2841wm0C, C1585jb0.u) || F3.c(abstractC2841wm0C, C1585jb0.x)) {
                    Iterator it = ej.d().getAnnotations().iterator();
                    while (true) {
                        if (!it.hasNext()) {
                            c0688a6.getClass();
                            strDiscriminator = "type";
                            break;
                        } else {
                            Annotation annotation = (Annotation) it.next();
                            if (annotation instanceof InterfaceC1660kJ) {
                                strDiscriminator = ((InterfaceC1660kJ) annotation).discriminator();
                                break;
                            }
                        }
                    }
                }
            } else if (iW != 2) {
                throw new C2170pj();
            }
            strDiscriminator = null;
        }
        if (strDiscriminator != null) {
            String strB = ej.d().b();
            this.g = strDiscriminator;
            this.h = strB;
        }
        ej.c(this, obj);
    }

    public void l(String str) {
        byte b;
        C1254g2 c1254g2 = (C1254g2) ((C2160pe) this.b).m;
        c1254g2.f(c1254g2.m, str.length() + 2);
        char[] cArr = (char[]) c1254g2.n;
        int i = c1254g2.m;
        int i2 = i + 1;
        cArr[i] = '\"';
        int length = str.length();
        str.getChars(0, length, cArr, i2);
        int i3 = length + i2;
        int i4 = i2;
        while (i4 < i3) {
            char c = cArr[i4];
            byte[] bArr = Wa0.b;
            if (c < bArr.length && bArr[c] != 0) {
                int length2 = str.length();
                for (int i5 = i4 - i2; i5 < length2; i5++) {
                    c1254g2.f(i4, 2);
                    char cCharAt = str.charAt(i5);
                    byte[] bArr2 = Wa0.b;
                    if (cCharAt >= bArr2.length || (b = bArr2[cCharAt]) == 0) {
                        int i6 = i4 + 1;
                        ((char[]) c1254g2.n)[i4] = cCharAt;
                        i4 = i6;
                    } else {
                        if (b == 1) {
                            String str2 = Wa0.a[cCharAt];
                            c1254g2.f(i4, str2.length());
                            str2.getChars(0, str2.length(), (char[]) c1254g2.n, i4);
                            int length3 = str2.length() + i4;
                            c1254g2.m = length3;
                            i4 = length3;
                        } else {
                            char[] cArr2 = (char[]) c1254g2.n;
                            cArr2[i4] = '\\';
                            cArr2[i4 + 1] = (char) b;
                            i4 += 2;
                            c1254g2.m = i4;
                        }
                    }
                }
                c1254g2.f(i4, 1);
                ((char[]) c1254g2.n)[i4] = '\"';
                c1254g2.m = i4 + 1;
                return;
            }
            i4++;
        }
        cArr[i3] = '\"';
        c1254g2.m = i3 + 1;
    }

    public void m() {
        Vm0 vm0 = (Vm0) this.d;
        C2160pe c2160pe = (C2160pe) this.b;
        c2160pe.getClass();
        c2160pe.l = false;
        c2160pe.f(vm0.m);
    }

    public FileInputStream n(AssetManager assetManager, String str) {
        try {
            return assetManager.openFd(str).createInputStream();
        } catch (FileNotFoundException e) {
            String message = e.getMessage();
            if (message == null) {
                return null;
            }
            message.contains("compressed");
            return null;
        }
    }

    public void o(int i, Serializable serializable) {
        ((Executor) this.b).execute(new RunnableC0139Fj(i, 2, this, serializable));
    }

    public boolean p() {
        ((C0688a6) this.f).getClass();
        return false;
    }

    public void r(C1382hQ c1382hQ) {
        C3040yr c3040yr = (C3040yr) this.h;
        long j = c1382hQ.b;
        long j2 = c1382hQ.a;
        ((C1886mj0) c3040yr.m).a(Float.intBitsToFloat((int) (j2 >> 32)), j);
        ((C1886mj0) c3040yr.n).a(Float.intBitsToFloat((int) (j2 & 4294967295L)), j);
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x0013  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public java.lang.Object s(o.C2212q50 r5, o.C1572jQ r6, o.AbstractC0298Lm r7) {
        /*
            r4 = this;
            boolean r0 = r7 instanceof o.C1762lQ
            if (r0 == 0) goto L13
            r0 = r7
            o.lQ r0 = (o.C1762lQ) r0
            int r1 = r0.q
            r2 = -2147483648(0xffffffff80000000, float:-0.0)
            r3 = r1 & r2
            if (r3 == 0) goto L13
            int r1 = r1 - r2
            r0.q = r1
            goto L18
        L13:
            o.lQ r0 = new o.lQ
            r0.<init>(r4, r7)
        L18:
            java.lang.Object r7 = r0.f623o
            int r1 = r0.q
            r2 = 1
            if (r1 == 0) goto L2d
            if (r1 != r2) goto L25
            o.IJ.H(r7)
            goto L4e
        L25:
            java.lang.IllegalStateException r5 = new java.lang.IllegalStateException
            java.lang.String r6 = "call to 'resume' before 'invoke' with coroutine"
            r5.<init>(r6)
            throw r5
        L2d:
            o.IJ.H(r7)
            r4.a = r2
            o.mQ r7 = new o.mQ
            r1 = 0
            r3 = 0
            r7.<init>(r5, r6, r1, r3)
            r0.q = r2
            o.rz r5 = new o.rz
            o.vn r6 = r0.h()
            r1 = 1
            r5.<init>(r6, r0, r1)
            java.lang.Object r5 = o.Co0.O(r5, r5, r7)
            o.Dn r6 = o.EnumC0091Dn.l
            if (r5 != r6) goto L4e
            return r6
        L4e:
            r5 = 0
            r4.a = r5
            o.Oh0 r5 = o.Oh0.a
            return r5
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C0173Gr.s(o.q50, o.jQ, o.Lm):java.lang.Object");
    }

    public C0173Gr(C2212q50 c2212q50, OD od, C0528Uj c0528Uj, InterfaceC2281qr interfaceC2281qr) {
        this.b = c2212q50;
        this.c = od;
        this.d = c0528Uj;
        this.e = interfaceC2281qr;
        this.f = AbstractC2841wm0.a(Api.BaseClientBuilder.API_PRIORITY_OTHER, 0, 6);
        this.h = new C3040yr(8);
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r1v10 */
    /* JADX WARN: Type inference failed for: r1v11 */
    /* JADX WARN: Type inference failed for: r1v12 */
    /* JADX WARN: Type inference failed for: r1v13 */
    /* JADX WARN: Type inference failed for: r1v14 */
    /* JADX WARN: Type inference failed for: r1v7 */
    /* JADX WARN: Type inference failed for: r1v8, types: [java.io.Serializable] */
    public C0173Gr(AssetManager assetManager, Executor executor, InterfaceC0912cZ interfaceC0912cZ, String str, File file) {
        ?? r1;
        this.a = false;
        this.b = executor;
        this.c = interfaceC0912cZ;
        this.g = str;
        this.f = file;
        int i = Build.VERSION.SDK_INT;
        if (i >= 31) {
            r1 = AbstractC1692kh0.n;
        } else {
            switch (i) {
                case ConnectionResult.API_DISABLED_FOR_CONNECTION /* 24 */:
                case 25:
                    r1 = AbstractC1692kh0.r;
                    break;
                case 26:
                    r1 = AbstractC1692kh0.q;
                    break;
                case 27:
                    r1 = AbstractC1692kh0.p;
                    break;
                case 28:
                case 29:
                case 30:
                    r1 = AbstractC1692kh0.f616o;
                    break;
                default:
                    r1 = 0;
                    break;
            }
        }
        this.d = r1;
    }
}
