package o; import com.airbnb.deeplinkdispatch.UrlTreeKt; import java.io.IOException; import java.util.Vector; import org.xmlpull.repackaged.v1.XmlPullParserException; /* renamed from: o.gnj, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ public class C15334gnj { public Vector a; private StringBuffer d; public void a(int i, int i2, Object obj) { if (this.a == null) { this.a = new Vector(); this.d = new StringBuffer(); } if (i2 == 2) { if (!(obj instanceof C15332gnh)) { throw new RuntimeException("Element obj expected)"); } ((C15332gnh) obj).b = this; } else if (!(obj instanceof String)) { throw new RuntimeException("String expected"); } this.a.insertElementAt(obj, i); this.d.insert(i, (char) i2); } public final void b(int i, Object obj) { Vector vector = this.a; a(vector == null ? 0 : vector.size(), i, obj); } public C15332gnh b(String str, String str2) { C15332gnh c15332gnh = new C15332gnh(); if (str == null) { str = ""; } c15332gnh.c = str; c15332gnh.d = str2; return c15332gnh; } public final C15332gnh e(String str, String str2) { int c = c(str, str2, 0); int c2 = c(str, str2, c + 1); if (c == -1 || c2 != -1) { StringBuilder sb = new StringBuilder("Element {"); sb.append(str); sb.append(UrlTreeKt.componentParamSuffix); sb.append(str2); sb.append(c == -1 ? " not found in " : " more than once in "); sb.append(this); throw new RuntimeException(sb.toString()); } Object elementAt = this.a.elementAt(c); if (elementAt instanceof C15332gnh) { return (C15332gnh) elementAt; } return null; } private int c(String str, String str2, int i) { Vector vector = this.a; int size = vector == null ? 0 : vector.size(); while (i < size) { Object elementAt = this.a.elementAt(i); C15332gnh c15332gnh = elementAt instanceof C15332gnh ? (C15332gnh) elementAt : null; if (c15332gnh != null && str2.equals(c15332gnh.d()) && (str == null || str.equals(c15332gnh.e()))) { return i; } i++; } return -1; } public final boolean c() { char charAt = this.d.charAt(0); return charAt == 4 || charAt == 7 || charAt == 5; } public void a(InterfaceC15578gue interfaceC15578gue) throws IOException, XmlPullParserException { boolean z = false; do { int b = interfaceC15578gue.b(); if (b != 1) { if (b == 2) { C15332gnh b2 = b(interfaceC15578gue.i(), interfaceC15578gue.h()); Vector vector = this.a; a(vector == null ? 0 : vector.size(), 2, b2); b2.a(interfaceC15578gue); } else if (b != 3) { if (interfaceC15578gue.g() != null) { if (b == 6) { b = 4; } String g = interfaceC15578gue.g(); Vector vector2 = this.a; a(vector2 == null ? 0 : vector2.size(), b, g); } else if (b == 6 && interfaceC15578gue.h() != null) { String h = interfaceC15578gue.h(); Vector vector3 = this.a; a(vector3 == null ? 0 : vector3.size(), 6, h); } interfaceC15578gue.k(); } } z = true; } while (!z); } public void b(InterfaceC15580gug interfaceC15580gug) throws IOException { c(interfaceC15580gug); interfaceC15580gug.d(); } public final void c(InterfaceC15580gug interfaceC15580gug) throws IOException { Vector vector = this.a; if (vector == null) { return; } int size = vector.size(); for (int i = 0; i < size; i++) { char charAt = this.d.charAt(i); Object elementAt = this.a.elementAt(i); switch (charAt) { case 2: ((C15332gnh) elementAt).b(interfaceC15580gug); break; case 3: default: throw new RuntimeException("Illegal type: ".concat(String.valueOf((int) charAt))); case 4: interfaceC15580gug.i((String) elementAt); break; case 5: interfaceC15580gug.a((String) elementAt); break; case 6: interfaceC15580gug.d((String) elementAt); break; case 7: interfaceC15580gug.e((String) elementAt); break; case '\b': interfaceC15580gug.g((String) elementAt); break; case '\t': interfaceC15580gug.c((String) elementAt); break; case '\n': interfaceC15580gug.b((String) elementAt); break; } } } }