package o; import java.security.MessageDigest; /* loaded from: classes.dex */ public final class giA extends C15155gij { public final transient int[] a; public final transient byte[][] h; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ public giA(byte[][] bArr, int[] iArr) { super(C15155gij.e.b); C14957gcv.e(bArr, ""); C14957gcv.e(iArr, ""); this.h = bArr; this.a = iArr; } @Override // o.C15155gij public final C15155gij b(String str) { C14957gcv.e(str, ""); MessageDigest messageDigest = MessageDigest.getInstance(str); int length = this.h.length; int i = 0; int i2 = 0; while (i < length) { int[] iArr = this.a; int i3 = iArr[length + i]; int i4 = iArr[i]; messageDigest.update(this.h[i], i3, i4 - i2); i++; i2 = i4; } byte[] digest = messageDigest.digest(); C14957gcv.c(digest, ""); return new C15155gij(digest); } @Override // o.C15155gij public final byte[] b() { return j(); } @Override // o.C15155gij public final void a(C15111ghZ c15111ghZ, int i) { C14957gcv.e(c15111ghZ, ""); int d = giH.d(this, 0); int i2 = 0; while (i2 < i) { int i3 = d == 0 ? 0 : this.a[d - 1]; int[] iArr = this.a; int i4 = iArr[d]; int i5 = iArr[this.h.length + d]; int min = Math.min(i, (i4 - i3) + i3) - i2; int i6 = i5 + (i2 - i3); C15170giy c15170giy = new C15170giy(this.h[d], i6, i6 + min, true, false); if (c15111ghZ.d == null) { c15170giy.h = c15170giy; c15170giy.a = c15170giy.h; c15111ghZ.d = c15170giy.a; } else { C15170giy c15170giy2 = c15111ghZ.d; C14957gcv.e(c15170giy2); C15170giy c15170giy3 = c15170giy2.h; C14957gcv.e(c15170giy3); c15170giy3.b(c15170giy); } i2 += min; d++; } c15111ghZ.c += i; } @Override // o.C15155gij public final boolean equals(Object obj) { if (obj != this) { if (!(obj instanceof C15155gij)) { return false; } C15155gij c15155gij = (C15155gij) obj; if (c15155gij.a() != a() || !d(c15155gij, 0, a())) { return false; } } return true; } @Override // o.C15155gij public final int hashCode() { int d = d(); if (d != 0) { return d; } int length = this.h.length; int i = 0; int i2 = 1; int i3 = 0; while (i < length) { int[] iArr = this.a; int i4 = iArr[length + i]; int i5 = iArr[i]; byte[] bArr = this.h[i]; for (int i6 = i4; i6 < (i5 - i3) + i4; i6++) { i2 = (i2 * 31) + bArr[i6]; } i++; i3 = i5; } b(i2); return i2; } private final Object writeReplace() { return new C15155gij(j()); } @Override // o.C15155gij public final String e() { return new C15155gij(j()).e(); } @Override // o.C15155gij public final int a() { return this.a[this.h.length - 1]; } @Override // o.C15155gij public final String c() { return new C15155gij(j()).c(); } @Override // o.C15155gij public final byte c(int i) { giE.d(this.a[this.h.length - 1], i, 1L); int d = giH.d(this, i); int i2 = d == 0 ? 0 : this.a[d - 1]; int[] iArr = this.a; byte[][] bArr = this.h; return bArr[d][(i - i2) + iArr[bArr.length + d]]; } @Override // o.C15155gij public final boolean d(C15155gij c15155gij, int i, int i2) { C14957gcv.e(c15155gij, ""); if (a() - i2 < 0) { return false; } int d = giH.d(this, 0); int i3 = 0; while (i3 < i2) { int i4 = d == 0 ? 0 : this.a[d - 1]; int[] iArr = this.a; int i5 = iArr[d]; int i6 = iArr[this.h.length + d]; int min = Math.min(i2, (i5 - i4) + i4) - i3; if (!c15155gij.e(i, this.h[d], i6 + (i3 - i4), min)) { return false; } i += min; i3 += min; d++; } return true; } @Override // o.C15155gij public final boolean e(int i, byte[] bArr, int i2, int i3) { C14957gcv.e(bArr, ""); if (i < 0 || i > a() - i3 || i2 < 0 || i2 > bArr.length - i3) { return false; } int i4 = i3 + i; int d = giH.d(this, i); while (i < i4) { int i5 = d == 0 ? 0 : this.a[d - 1]; int[] iArr = this.a; int i6 = iArr[d]; int i7 = iArr[this.h.length + d]; int min = Math.min(i4, (i6 - i5) + i5) - i; if (!giE.c(this.h[d], i7 + (i - i5), bArr, i2, min)) { return false; } i2 += min; i += min; d++; } return true; } @Override // o.C15155gij public final C15155gij g() { return new C15155gij(j()).g(); } @Override // o.C15155gij public final byte[] j() { byte[] bArr = new byte[a()]; int length = this.h.length; int i = 0; int i2 = 0; int i3 = 0; while (i < length) { int[] iArr = this.a; int i4 = iArr[length + i]; int i5 = iArr[i]; byte[] bArr2 = this.h[i]; int i6 = i5 - i2; C14957gcv.e(bArr2, ""); C14957gcv.e(bArr, ""); System.arraycopy(bArr2, i4, bArr, i3, (i4 + i6) - i4); i3 += i6; i++; i2 = i5; } return bArr; } @Override // o.C15155gij public final String toString() { return new C15155gij(j()).toString(); } }