package com.tapjoy.internal; import java.io.EOFException; import java.io.IOException; import java.io.StringReader; import java.util.ArrayList; /* loaded from: classes4.dex */ public final class e0 extends c0 { public static final d0 n = new d0(); public final StringReader b; public final ArrayList h; public int i; public String j; public String k; public int l; public int m; public final k1 a = new k1(); public final char[] c = new char[1024]; public int d = 0; public int e = 0; public int f = 1; public int g = 1; public e0(StringReader stringReader) { ArrayList arrayList = new ArrayList(); this.h = arrayList; arrayList.add(f0.f); this.b = stringReader; } public final void a(int i) { e(); if (this.i == i) { e(); this.i = 0; this.k = null; this.j = null; return; } throw new IllegalStateException("Expected " + g0.a(i) + " but was " + g0.a(e())); } public final int b(boolean z) { if (!z) { int c = c(); if (c != 44 && c != 59) { if (c != 125) { a("Unterminated object"); throw null; } this.i = 4; return 4; } } else { if (c() == 125) { this.i = 4; return 4; } this.d--; } int c2 = c(); if (c2 != 34) { if (c2 != 39) { a("Use JsonReader.setLenient(true) to accept malformed JSON"); throw null; } a("Use JsonReader.setLenient(true) to accept malformed JSON"); throw null; } this.j = a((char) c2); f0 f0Var = f0.d; this.h.set(r0.size() - 1, f0Var); this.i = 5; return 5; } public final int c() { while (true) { if (this.d >= this.e && !b(1)) { throw new EOFException("End of input"); } char[] cArr = this.c; int i = this.d; int i2 = i + 1; this.d = i2; char c = cArr[i]; if (c != '\t' && c != '\n' && c != '\r' && c != ' ') { if (c == '#') { a("Use JsonReader.setLenient(true) to accept malformed JSON"); throw null; } if (c != '/') { return c; } if (i2 == this.e && !b(1)) { return c; } a("Use JsonReader.setLenient(true) to accept malformed JSON"); throw null; } } } /* JADX WARN: Code restructure failed: missing block: B:172:0x006b, code lost: a("Use JsonReader.setLenient(true) to accept malformed JSON"); */ /* JADX WARN: Code restructure failed: missing block: B:173:0x006e, code lost: throw null; */ /* JADX WARN: Removed duplicated region for block: B:130:0x01f1 */ /* JADX WARN: Removed duplicated region for block: B:132:0x00ab */ /* JADX WARN: Removed duplicated region for block: B:22:0x00a5 */ /* JADX WARN: Removed duplicated region for block: B:25:0x00c4 */ /* JADX WARN: Removed duplicated region for block: B:45:0x01ec A[RETURN] */ /* JADX WARN: Removed duplicated region for block: B:47:0x01ed */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final int d() { /* Method dump skipped, instructions count: 548 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.tapjoy.internal.e0.d():int"); } public final String toString() { StringBuilder sb = new StringBuilder(); sb.append(e0.class.getSimpleName()); sb.append(" near "); StringBuilder sb2 = new StringBuilder(); int min = Math.min(this.d, 20); sb2.append(this.c, this.d - min, min); sb2.append(this.c, this.d, Math.min(this.e - this.d, 20)); sb.append((Object) sb2); return sb.toString(); } public final int e() { int i = this.i; if (i != 0) { return i; } ArrayList arrayList = this.h; switch ((f0) arrayList.get(arrayList.size() - 1)) { case a: return a(true); case b: return a(false); case c: return b(true); case d: int c = c(); if (c == 58) { f0 f0Var = f0.e; ArrayList arrayList2 = this.h; arrayList2.set(arrayList2.size() - 1, f0Var); return d(); } if (c != 61) { a("Expected ':'"); throw null; } a("Use JsonReader.setLenient(true) to accept malformed JSON"); throw null; case e: return b(false); case f: f0 f0Var2 = f0.g; ArrayList arrayList3 = this.h; arrayList3.set(arrayList3.size() - 1, f0Var2); int d = d(); int i2 = this.i; if (i2 == 1 || i2 == 3) { return d; } throw new IOException("Expected JSON document to start with '[' or '{' but was ".concat(g0.a(this.i))); case g: try { d(); a("Expected EOF"); throw null; } catch (EOFException unused) { this.i = 10; return 10; } case h: throw new IllegalStateException("JsonReader is closed"); default: throw new AssertionError(); } } @Override // java.io.Closeable, java.lang.AutoCloseable public final void close() { this.k = null; this.i = 0; this.h.clear(); this.h.add(f0.h); this.b.close(); } public final int a(boolean z) { if (z) { f0 f0Var = f0.b; this.h.set(r7.size() - 1, f0Var); } else { int c = c(); if (c != 44) { if (c == 59) { a("Use JsonReader.setLenient(true) to accept malformed JSON"); throw null; } if (c == 93) { this.i = 2; return 2; } a("Unterminated array"); throw null; } } int c2 = c(); if (c2 != 44 && c2 != 59) { if (c2 != 93) { this.d--; return d(); } if (z) { this.i = 2; return 2; } } a("Use JsonReader.setLenient(true) to accept malformed JSON"); throw null; } public final boolean b(int i) { int i2; int i3; int i4; int i5 = 0; while (true) { i2 = this.d; if (i5 >= i2) { break; } if (this.c[i5] == '\n') { this.f++; this.g = 1; } else { this.g++; } i5++; } int i6 = this.e; if (i6 != i2) { int i7 = i6 - i2; this.e = i7; char[] cArr = this.c; System.arraycopy(cArr, i2, cArr, 0, i7); } else { this.e = 0; } this.d = 0; do { StringReader stringReader = this.b; char[] cArr2 = this.c; int i8 = this.e; int read = stringReader.read(cArr2, i8, cArr2.length - i8); if (read == -1) { return false; } i3 = this.e + read; this.e = i3; if (this.f == 1 && (i4 = this.g) == 1 && i3 > 0 && this.c[0] == 65279) { this.d++; this.g = i4 - 1; } } while (i3 < i); return true; } /* JADX WARN: Code restructure failed: missing block: B:56:0x00b2, code lost: if (r1 != null) goto L53; */ /* JADX WARN: Code restructure failed: missing block: B:57:0x00b4, code lost: r1 = new java.lang.StringBuilder(); */ /* JADX WARN: Code restructure failed: missing block: B:58:0x00b9, code lost: r1.append(r7.c, r2, r7.d - r2); */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final java.lang.String a(char r8) { /* Method dump skipped, instructions count: 207 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.tapjoy.internal.e0.a(char):java.lang.String"); } public final void a(String str) { StringBuilder sb = new StringBuilder(); sb.append(str); sb.append(" at line "); int i = this.f; for (int i2 = 0; i2 < this.d; i2++) { if (this.c[i2] == '\n') { i++; } } sb.append(i); sb.append(" column "); int i3 = this.g; for (int i4 = 0; i4 < this.d; i4++) { i3 = this.c[i4] == '\n' ? 1 : i3 + 1; } sb.append(i3); throw new k0(sb.toString()); } }