package c.i.a.f.h.l; import c.i.a.f.e.o.f; import c.i.a.f.h.l.u4; import com.google.android.gms.internal.measurement.zzij; import java.io.IOException; import java.util.Iterator; import java.util.Map; /* compiled from: com.google.android.gms:play-services-measurement-base@@18.0.0 */ public final class g6 implements q6 { public final c6 a; public final d7 b; /* renamed from: c reason: collision with root package name */ public final boolean f1134c; public final j4 d; public g6(d7 d7Var, j4 j4Var, c6 c6Var) { this.b = d7Var; this.f1134c = j4Var.e(c6Var); this.d = j4Var; this.a = c6Var; } @Override // c.i.a.f.h.l.q6 public final T a() { return (T) ((u4.b) this.a.h()).o(); } @Override // c.i.a.f.h.l.q6 public final int b(T t) { int hashCode = this.b.e(t).hashCode(); return this.f1134c ? (hashCode * 53) + this.d.b(t).hashCode() : hashCode; } @Override // c.i.a.f.h.l.q6 public final boolean c(T t) { return this.d.b(t).m(); } @Override // c.i.a.f.h.l.q6 public final void d(T t) { this.b.h(t); this.d.g(t); } @Override // c.i.a.f.h.l.q6 public final int e(T t) { d7 d7Var = this.b; int i = d7Var.i(d7Var.e(t)) + 0; if (!this.f1134c) { return i; } n4 b = this.d.b(t); int i2 = 0; for (int i3 = 0; i3 < b.b.e(); i3++) { i2 += n4.k(b.b.d(i3)); } for (Map.Entry entry : b.b.g()) { i2 += n4.k(entry); } return i + i2; } @Override // c.i.a.f.h.l.q6 public final boolean f(T t, T t2) { if (!this.b.e(t).equals(this.b.e(t2))) { return false; } if (this.f1134c) { return this.d.b(t).equals(this.d.b(t2)); } return true; } @Override // c.i.a.f.h.l.q6 public final void g(T t, v7 v7Var) throws IOException { Iterator> l = this.d.b(t).l(); while (l.hasNext()) { Map.Entry next = l.next(); p4 p4Var = (p4) next.getKey(); if (p4Var.c() != w7.MESSAGE || p4Var.d() || p4Var.e()) { throw new IllegalStateException("Found invalid MessageSet item."); } else if (next instanceof f5) { ((g4) v7Var).c(p4Var.a(), ((f5) next).i.getValue().c()); } else { ((g4) v7Var).c(p4Var.a(), next.getValue()); } } d7 d7Var = this.b; d7Var.f(d7Var.e(t), v7Var); } @Override // c.i.a.f.h.l.q6 public final void h(T t, byte[] bArr, int i, int i2, s3 s3Var) throws IOException { T t2 = t; c7 c7Var = t2.zzb; if (c7Var == c7.a) { c7Var = c7.c(); t2.zzb = c7Var; } t.u(); u4.f fVar = null; while (i < i2) { int w1 = f.w1(bArr, i, s3Var); int i3 = s3Var.a; if (i3 == 11) { int i4 = 0; t3 t3Var = null; while (w1 < i2) { w1 = f.w1(bArr, w1, s3Var); int i5 = s3Var.a; int i6 = i5 >>> 3; int i7 = i5 & 7; if (i6 != 2) { if (i6 == 3) { if (fVar != null) { n6 n6Var = n6.a; throw new NoSuchMethodError(); } else if (i7 == 2) { w1 = f.c2(bArr, w1, s3Var); t3Var = (t3) s3Var.f1168c; } } } else if (i7 == 0) { w1 = f.w1(bArr, w1, s3Var); i4 = s3Var.a; fVar = (u4.f) this.d.c(s3Var.d, this.a, i4); } if (i5 == 12) { break; } w1 = f.o1(i5, bArr, w1, i2, s3Var); } if (t3Var != null) { c7Var.a((i4 << 3) | 2, t3Var); } i = w1; } else if ((i3 & 7) == 2) { fVar = (u4.f) this.d.c(s3Var.d, this.a, i3 >>> 3); if (fVar == null) { i = f.q1(i3, bArr, w1, i2, c7Var, s3Var); } else { n6 n6Var2 = n6.a; throw new NoSuchMethodError(); } } else { i = f.o1(i3, bArr, w1, i2, s3Var); } } if (i != i2) { throw zzij.d(); } } @Override // c.i.a.f.h.l.q6 public final void i(T t, T t2) { d7 d7Var = this.b; Class cls = s6.a; d7Var.d(t, d7Var.g(d7Var.e(t), d7Var.e(t2))); if (this.f1134c) { s6.i(this.d, t, t2); } } }