package kotlin.reflect.json.internal;

/* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
/* JADX INFO: loaded from: E:\ios\vf_dex\classes3.dex */
@kotlin.Metadata(d1 = {"\u0000@\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u000b\n\u0002\u0010\b\n\u0002\b\u0004\b\u0000\u0018\u00002\u00020\u0001B\u0017\u0012\u0006\u0010\u0003\u001a\u00020\u0002\u0012\u0006\u0010\u0005\u001a\u00020\u0004¢\u0006\u0004\b\u0006\u0010\u0007J\u000f\u0010\t\u001a\u00020\bH\u0002¢\u0006\u0004\b\t\u0010\nJ \u0010\r\u001a\u00020\b*\u000e\u0012\u0004\u0012\u00020\f\u0012\u0004\u0012\u00020\b0\u000bH\u0082@¢\u0006\u0004\b\r\u0010\u000eJ\u000f\u0010\u000f\u001a\u00020\bH\u0002¢\u0006\u0004\b\u000f\u0010\nJ\u0017\u0010\u0013\u001a\u00020\u00122\u0006\u0010\u0011\u001a\u00020\u0010H\u0002¢\u0006\u0004\b\u0013\u0010\u0014J\u000f\u0010\u0015\u001a\u00020\bH\u0002¢\u0006\u0004\b\u0015\u0010\nJ\r\u0010\u0016\u001a\u00020\b¢\u0006\u0004\b\u0016\u0010\nR\u0014\u0010\u0005\u001a\u00020\u00048\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u0017\u0010\u0018R\u0014\u0010\u001b\u001a\u00020\u00108\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u0019\u0010\u001aR\u0014\u0010\u001d\u001a\u00020\u00108\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u001c\u0010\u001aR\u0016\u0010!\u001a\u00020\u001e8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u001f\u0010 ¨\u0006\""}, d2 = {"Lkotlinx/serialization/json/internal/JsonTreeReader;", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "Lkotlinx/serialization/json/JsonConfiguration;", "configuration", "Lkotlinx/serialization/json/internal/AbstractJsonLexer;", "lexer", "<init>", "(Lkotlinx/serialization/json/JsonConfiguration;Lkotlinx/serialization/json/internal/AbstractJsonLexer;)V", "Lkotlinx/serialization/json/JsonElement;", "i", "()Lkotlinx/serialization/json/JsonElement;", "Lkotlin/DeepRecursiveScope;", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "h", "(Lkotlin/DeepRecursiveScope;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "f", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "isString", "Lkotlinx/serialization/json/JsonPrimitive;", "j", "(Z)Lkotlinx/serialization/json/JsonPrimitive;", "g", "e", "a", "Lkotlinx/serialization/json/internal/AbstractJsonLexer;", "b", "Z", "isLenient", "c", "trailingCommaAllowed", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "d", "I", "stackDepth", "kotlinx-serialization-json"}, k = 1, mv = {2, 0, 0}, xi = 48)
@kotlin.jvm.internal.SourceDebugExtension
public final class JsonTreeReader {

    /* JADX INFO: renamed from: a, reason: from kotlin metadata */
    private final kotlin.reflect.json.internal.JsonReader lexer;

    /* JADX INFO: renamed from: b, reason: from kotlin metadata */
    private final boolean isLenient;

    /* JADX INFO: renamed from: c, reason: from kotlin metadata */
    private final boolean trailingCommaAllowed;

    /* JADX INFO: renamed from: d, reason: from kotlin metadata */
    private int stackDepth;

    public JsonTreeReader(kotlin.reflect.json.JsonConfiguration jsonConfiguration, kotlin.reflect.json.internal.JsonReader jsonReader) {
        kotlin.jvm.internal.Intrinsics.l(jsonConfiguration, "configuration");
        kotlin.jvm.internal.Intrinsics.l(jsonReader, "lexer");
        this.lexer = jsonReader;
        this.isLenient = jsonConfiguration.getIsLenient();
        this.trailingCommaAllowed = jsonConfiguration.getAllowTrailingComma();
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* JADX INFO: Thrown type has an unknown type hierarchy: kotlin.KotlinNothingValueException */
    public final kotlin.reflect.json.JsonElement f() throws kotlin.KotlinNothingValueException {
        byte bJ = this.lexer.j();
        if (this.lexer.H() == 4) {
            kotlin.reflect.json.internal.JsonReader.x(this.lexer, "Unexpected leading comma", 0, null, 6, null);
            throw new kotlin.KotlinNothingValueException();
        }
        java.util.ArrayList arrayList = new java.util.ArrayList();
        while (this.lexer.e()) {
            arrayList.add(e());
            bJ = this.lexer.j();
            if (bJ != 4) {
                kotlin.reflect.json.internal.JsonReader jsonReader = this.lexer;
                boolean z = bJ == 9;
                int i = jsonReader.currentPosition;
                if (!z) {
                    kotlin.reflect.json.internal.JsonReader.x(jsonReader, "Expected end of the array or comma", i, null, 4, null);
                    throw new kotlin.KotlinNothingValueException();
                }
            }
        }
        if (bJ == 8) {
            this.lexer.k((byte) 9);
        } else if (bJ == 4) {
            if (!this.trailingCommaAllowed) {
                kotlin.reflect.json.internal.JsonExceptionsKt.h(this.lexer, "array");
                throw new kotlin.KotlinNothingValueException();
            }
            this.lexer.k((byte) 9);
        }
        return new kotlin.reflect.json.JsonArray(arrayList);
    }

    private final kotlin.reflect.json.JsonElement g() {
        return (kotlin.reflect.json.JsonElement) kotlin.DeepRecursiveKt.b(new kotlin.DeepRecursiveFunction(new kotlin.reflect.json.internal.JsonTreeReader$readDeepRecursive$1(this, null)), kotlin.Unit.a);
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* JADX WARN: Code duplicated, block: B:19:0x0070  */
    /* JADX WARN: Code duplicated, block: B:21:0x0074  */
    /* JADX WARN: Code duplicated, block: B:22:0x007b  */
    /* JADX WARN: Code duplicated, block: B:25:0x0099 A[RETURN] */
    /* JADX WARN: Code duplicated, block: B:26:0x009a  */
    /* JADX WARN: Code duplicated, block: B:29:0x00b2 A[DONT_INVERT] */
    /* JADX WARN: Code duplicated, block: B:30:0x00b4  */
    /* JADX WARN: Code duplicated, block: B:31:0x00bb  */
    /* JADX WARN: Code duplicated, block: B:33:0x00cd  */
    /* JADX WARN: Code duplicated, block: B:7:0x0017  */
    /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:26:0x009a -> B:27:0x00a5). Please report as a decompilation issue!!! */
    /*  JADX ERROR: JadxOverflowException in pass: RegionMakerVisitor
        jadx.core.utils.exceptions.JadxOverflowException: Regions stack size limit reached
        	at jadx.core.utils.ErrorsCounter.addError(ErrorsCounter.java:59)
        	at jadx.core.utils.ErrorsCounter.error(ErrorsCounter.java:31)
        	at jadx.core.dex.attributes.nodes.NotificationAttrNode.addError(NotificationAttrNode.java:19)
        */
    public final java.lang.Object h(kotlin.DeepRecursiveScope r19, kotlin.coroutines.Continuation r20) {
        /*
            Method dump skipped, instruction units count: 266
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: kotlin.reflect.json.internal.JsonTreeReader.h(kotlin.DeepRecursiveScope, kotlin.coroutines.Continuation):java.lang.Object");
    }

    /* JADX INFO: Thrown type has an unknown type hierarchy: kotlin.KotlinNothingValueException */
    private final kotlin.reflect.json.JsonElement i() throws kotlin.KotlinNothingValueException {
        byte bK = this.lexer.k((byte) 6);
        if (this.lexer.H() == 4) {
            kotlin.reflect.json.internal.JsonReader.x(this.lexer, "Unexpected leading comma", 0, null, 6, null);
            throw new kotlin.KotlinNothingValueException();
        }
        java.util.LinkedHashMap linkedHashMap = new java.util.LinkedHashMap();
        while (this.lexer.e()) {
            java.lang.String strQ = this.isLenient ? this.lexer.q() : this.lexer.o();
            this.lexer.k((byte) 5);
            linkedHashMap.put(strQ, e());
            bK = this.lexer.j();
            if (bK != 4) {
                if (bK == 7) {
                    break;
                }
                kotlin.reflect.json.internal.JsonReader.x(this.lexer, "Expected end of the object or comma", 0, null, 6, null);
                throw new kotlin.KotlinNothingValueException();
            }
        }
        if (bK == 6) {
            this.lexer.k((byte) 7);
        } else if (bK == 4) {
            if (!this.trailingCommaAllowed) {
                kotlin.reflect.json.internal.JsonExceptionsKt.i(this.lexer, null, 1, null);
                throw new kotlin.KotlinNothingValueException();
            }
            this.lexer.k((byte) 7);
        }
        return new kotlin.reflect.json.JsonObject(linkedHashMap);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final kotlin.reflect.json.JsonPrimitive j(boolean isString) {
        java.lang.String strQ = (this.isLenient || !isString) ? this.lexer.q() : this.lexer.o();
        return (isString || !kotlin.jvm.internal.Intrinsics.g(strQ, "null")) ? new kotlin.reflect.json.JsonLiteral(strQ, isString, null, 4, null) : kotlin.reflect.json.JsonNull.INSTANCE;
    }

    /* JADX INFO: Thrown type has an unknown type hierarchy: kotlin.KotlinNothingValueException */
    public final kotlin.reflect.json.JsonElement e() throws kotlin.KotlinNothingValueException {
        byte bH = this.lexer.H();
        if (bH == 1) {
            return j(true);
        }
        if (bH == 0) {
            return j(false);
        }
        if (bH == 6) {
            int i = this.stackDepth + 1;
            this.stackDepth = i;
            kotlin.reflect.json.JsonElement jsonElementG = i == 200 ? g() : i();
            this.stackDepth--;
            return jsonElementG;
        }
        if (bH == 8) {
            return f();
        }
        kotlin.reflect.json.internal.JsonReader.x(this.lexer, "Cannot read Json element because of unexpected " + kotlin.reflect.json.internal.AbstractJsonLexerKt.c(bH), 0, null, 6, null);
        throw new kotlin.KotlinNothingValueException();
    }
}
