package o;

import java.util.Arrays;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.x50, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C2876x50 extends C0135Ff {
    public final transient byte[][] p;
    public final transient int[] q;

    public C2876x50(byte[][] bArr, int[] iArr) {
        super(C0135Ff.f122o.l);
        this.p = bArr;
        this.q = iArr;
    }

    private final Object writeReplace() {
        return q();
    }

    @Override // o.C0135Ff
    public final int b() {
        return this.q[this.p.length - 1];
    }

    @Override // o.C0135Ff
    public final String c() {
        return q().c();
    }

    @Override // o.C0135Ff
    public final int d(int i, byte[] bArr) {
        return q().d(i, bArr);
    }

    @Override // o.C0135Ff
    public final boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (obj instanceof C0135Ff) {
            C0135Ff c0135Ff = (C0135Ff) obj;
            if (c0135Ff.b() == b() && i(0, c0135Ff, b())) {
                return true;
            }
        }
        return false;
    }

    @Override // o.C0135Ff
    public final byte[] f() {
        return p();
    }

    @Override // o.C0135Ff
    public final byte g(int i) {
        byte[][] bArr = this.p;
        int length = bArr.length - 1;
        int[] iArr = this.q;
        F3.l(iArr[length], i, 1L);
        int iJ = C1884mi0.J(this, i);
        return bArr[iJ][(i - (iJ == 0 ? 0 : iArr[iJ - 1])) + iArr[bArr.length + iJ]];
    }

    @Override // o.C0135Ff
    public final int h(byte[] bArr) {
        return q().h(bArr);
    }

    @Override // o.C0135Ff
    public final int hashCode() {
        int i = this.m;
        if (i != 0) {
            return i;
        }
        byte[][] bArr = this.p;
        int length = bArr.length;
        int i2 = 0;
        int i3 = 1;
        int i4 = 0;
        while (i2 < length) {
            int[] iArr = this.q;
            int i5 = iArr[length + i2];
            int i6 = iArr[i2];
            byte[] bArr2 = bArr[i2];
            int i7 = (i6 - i4) + i5;
            while (i5 < i7) {
                i3 = (i3 * 31) + bArr2[i5];
                i5++;
            }
            i2++;
            i4 = i6;
        }
        this.m = i3;
        return i3;
    }

    @Override // o.C0135Ff
    public final boolean i(int i, C0135Ff c0135Ff, int i2) {
        if (i >= 0 && i <= b() - i2) {
            int i3 = i2 + i;
            int iJ = C1884mi0.J(this, i);
            int i4 = 0;
            while (i < i3) {
                int[] iArr = this.q;
                int i5 = iJ == 0 ? 0 : iArr[iJ - 1];
                int i6 = iArr[iJ] - i5;
                byte[][] bArr = this.p;
                int i7 = iArr[bArr.length + iJ];
                int iMin = Math.min(i3, i6 + i5) - i;
                if (c0135Ff.j(bArr[iJ], i4, (i - i5) + i7, iMin)) {
                    i4 += iMin;
                    i += iMin;
                    iJ++;
                }
            }
            return true;
        }
        return false;
    }

    @Override // o.C0135Ff
    public final boolean j(byte[] bArr, int i, int i2, int i3) {
        if (i < 0 || i > b() - i3 || i2 < 0 || i2 > bArr.length - i3) {
            return false;
        }
        int i4 = i3 + i;
        int iJ = C1884mi0.J(this, i);
        while (i < i4) {
            int[] iArr = this.q;
            int i5 = iJ == 0 ? 0 : iArr[iJ - 1];
            int i6 = iArr[iJ] - i5;
            byte[][] bArr2 = this.p;
            int i7 = iArr[bArr2.length + iJ];
            int iMin = Math.min(i4, i6 + i5) - i;
            if (!F3.d(bArr2[iJ], (i - i5) + i7, bArr, i2, iMin)) {
                return false;
            }
            i2 += iMin;
            i += iMin;
            iJ++;
        }
        return true;
    }

    @Override // o.C0135Ff
    public final C0135Ff k(int i, int i2) {
        if (i2 == -1234567890) {
            i2 = b();
        }
        if (i < 0) {
            throw new IllegalArgumentException(AbstractC0126Ew.k(i, "beginIndex=", " < 0").toString());
        }
        if (i2 > b()) {
            StringBuilder sbO = AbstractC0126Ew.o(i2, "endIndex=", " > length(");
            sbO.append(b());
            sbO.append(')');
            throw new IllegalArgumentException(sbO.toString().toString());
        }
        int i3 = i2 - i;
        if (i3 < 0) {
            throw new IllegalArgumentException(AbstractC0126Ew.i(i2, i, "endIndex=", " < beginIndex=").toString());
        }
        if (i == 0 && i2 == b()) {
            return this;
        }
        if (i == i2) {
            return C0135Ff.f122o;
        }
        int iJ = C1884mi0.J(this, i);
        int iJ2 = C1884mi0.J(this, i2 - 1);
        int i4 = iJ2 + 1;
        byte[][] bArr = this.p;
        AbstractC2461sm0.d(i4, bArr.length);
        byte[][] bArr2 = (byte[][]) Arrays.copyOfRange(bArr, iJ, i4);
        int[] iArr = new int[bArr2.length * 2];
        int[] iArr2 = this.q;
        if (iJ <= iJ2) {
            int i5 = iJ;
            int i6 = 0;
            while (true) {
                iArr[i6] = Math.min(iArr2[i5] - i, i3);
                int i7 = i6 + 1;
                iArr[i6 + bArr2.length] = iArr2[bArr.length + i5];
                if (i5 == iJ2) {
                    break;
                }
                i5++;
                i6 = i7;
            }
        }
        int i8 = iJ != 0 ? iArr2[iJ - 1] : 0;
        int length = bArr2.length;
        iArr[length] = (i - i8) + iArr[length];
        return new C2876x50(bArr2, iArr);
    }

    @Override // o.C0135Ff
    public final C0135Ff m() {
        return q().m();
    }

    @Override // o.C0135Ff
    public final void o(C0732af c0732af, int i) {
        int iJ = C1884mi0.J(this, 0);
        int i2 = 0;
        while (i2 < i) {
            int[] iArr = this.q;
            int i3 = iJ == 0 ? 0 : iArr[iJ - 1];
            int i4 = iArr[iJ] - i3;
            byte[][] bArr = this.p;
            int i5 = iArr[bArr.length + iJ];
            int iMin = Math.min(i, i4 + i3) - i2;
            int i6 = (i2 - i3) + i5;
            C2496t50 c2496t50 = new C2496t50(bArr[iJ], i6, i6 + iMin, true);
            C2496t50 c2496t502 = c0732af.l;
            if (c2496t502 == null) {
                c2496t50.g = c2496t50;
                c2496t50.f = c2496t50;
                c0732af.l = c2496t50;
            } else {
                c2496t502.g.b(c2496t50);
            }
            i2 += iMin;
            iJ++;
        }
        c0732af.m += i;
    }

    public final byte[] p() {
        byte[] bArr = new byte[b()];
        byte[][] bArr2 = this.p;
        int length = bArr2.length;
        int i = 0;
        int i2 = 0;
        int i3 = 0;
        while (i < length) {
            int[] iArr = this.q;
            int i4 = iArr[length + i];
            int i5 = iArr[i];
            int i6 = i5 - i2;
            System.arraycopy(bArr2[i], i4, bArr, i3, (i4 + i6) - i4);
            i3 += i6;
            i++;
            i2 = i5;
        }
        return bArr;
    }

    public final C0135Ff q() {
        return new C0135Ff(p());
    }

    @Override // o.C0135Ff
    public final String toString() {
        return q().toString();
    }
}
