package h.b.p.a0;

import java.util.ArrayList;
import java.util.LinkedHashMap;

/* JADX INFO: compiled from: JsonTreeReader.kt */
/* JADX INFO: loaded from: classes.dex */
@g.i
public final class w {
    public final a a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final boolean f4544b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public int f4545c;

    public w(h.b.p.f fVar, a aVar) {
        g.h0.c.l.f(fVar, "configuration");
        g.h0.c.l.f(aVar, "lexer");
        this.a = aVar;
        this.f4544b = fVar.f4563c;
    }

    /* JADX WARN: Removed duplicated region for block: B:19:0x0074  */
    /* JADX WARN: Removed duplicated region for block: B:29:0x00b6  */
    /* JADX WARN: Removed duplicated region for block: B:33:0x00cd  */
    /* JADX WARN: Removed duplicated region for block: B:35:0x00d7  */
    /* JADX WARN: Removed duplicated region for block: B:36:0x00dd  */
    /* JADX WARN: Removed duplicated region for block: B:7:0x001a  */
    /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:26:0x009e -> B:27:0x00a9). Please report as a decompilation issue!!! */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static final java.lang.Object a(h.b.p.a0.w r20, g.b r21, g.e0.d r22) {
        /*
            Method dump skipped, instruction units count: 253
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: h.b.p.a0.w.a(h.b.p.a0.w, g.b, g.e0.d):java.lang.Object");
    }

    public final h.b.p.h b() throws Throwable {
        h.b.p.h wVar;
        Object obj;
        byte bU = this.a.u();
        if (bU == 1) {
            return d(true);
        }
        if (bU == 0) {
            return d(false);
        }
        if (bU != 6) {
            if (bU == 8) {
                return c();
            }
            a.q(this.a, d.b.a.a.a.j("Cannot begin reading element, unexpected token: ", bU), 0, null, 6, null);
            throw null;
        }
        int i2 = this.f4545c + 1;
        this.f4545c = i2;
        if (i2 == 200) {
            u uVar = new u(this, null);
            g.h0.c.l.f(uVar, "block");
            g.a0 a0Var = g.a0.a;
            Object obj2 = g.a.a;
            g.c cVar = new g.c(uVar, a0Var);
            while (true) {
                obj = cVar.f4051g;
                g.e0.d<Object> dVar = cVar.f4050f;
                if (dVar == null) {
                    break;
                }
                Object obj3 = g.a.a;
                if (g.h0.c.l.a(obj3, obj)) {
                    try {
                        g.h0.b.q<? super g.b<?, ?>, Object, ? super g.e0.d<Object>, ? extends Object> qVar = cVar.f4048b;
                        Object obj4 = cVar.f4049e;
                        g.h0.c.l.d(qVar, "null cannot be cast to non-null type kotlin.Function3<R of kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.startCoroutineUninterceptedOrReturn, P of kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.startCoroutineUninterceptedOrReturn, kotlin.coroutines.Continuation<T of kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.startCoroutineUninterceptedOrReturn>, kotlin.Any?>");
                        g.h0.c.f0.c(qVar, 3);
                        Object objInvoke = qVar.invoke(cVar, obj4, dVar);
                        if (objInvoke != g.e0.i.a.COROUTINE_SUSPENDED) {
                            dVar.f(objInvoke);
                        }
                    } catch (Throwable th) {
                        dVar.f(f.a.y.a.L(th));
                    }
                } else {
                    cVar.f4051g = obj3;
                    dVar.f(obj);
                }
            }
            f.a.y.a.e1(obj);
            wVar = (h.b.p.h) obj;
        } else {
            byte bI = this.a.i((byte) 6);
            if (this.a.u() == 4) {
                a.q(this.a, "Unexpected leading comma", 0, null, 6, null);
                throw null;
            }
            LinkedHashMap linkedHashMap = new LinkedHashMap();
            while (true) {
                if (!this.a.c()) {
                    break;
                }
                String strM = this.f4544b ? this.a.m() : this.a.l();
                this.a.i((byte) 5);
                linkedHashMap.put(strM, b());
                bI = this.a.h();
                if (bI != 4) {
                    if (bI != 7) {
                        a.q(this.a, "Expected end of the object or comma", 0, null, 6, null);
                        throw null;
                    }
                }
            }
            if (bI == 6) {
                this.a.i((byte) 7);
            } else if (bI == 4) {
                a.q(this.a, "Unexpected trailing comma", 0, null, 6, null);
                throw null;
            }
            wVar = new h.b.p.w(linkedHashMap);
        }
        this.f4545c--;
        return wVar;
    }

    public final h.b.p.h c() {
        byte bH = this.a.h();
        if (this.a.u() == 4) {
            a.q(this.a, "Unexpected leading comma", 0, null, 6, null);
            throw null;
        }
        ArrayList arrayList = new ArrayList();
        while (this.a.c()) {
            arrayList.add(b());
            bH = this.a.h();
            if (bH != 4) {
                a aVar = this.a;
                boolean z = bH == 9;
                int i2 = aVar.a;
                if (!z) {
                    a.q(aVar, "Expected end of the array or comma", i2, null, 4, null);
                    throw null;
                }
            }
        }
        if (bH == 8) {
            this.a.i((byte) 9);
        } else if (bH == 4) {
            a.q(this.a, "Unexpected trailing comma", 0, null, 6, null);
            throw null;
        }
        return new h.b.p.b(arrayList);
    }

    public final h.b.p.y d(boolean z) {
        String strM = (this.f4544b || !z) ? this.a.m() : this.a.l();
        return (z || !g.h0.c.l.a(strM, "null")) ? new h.b.p.r(strM, z) : h.b.p.u.INSTANCE;
    }
}
