package j6;

import P6.g;
import java.util.Arrays;

/* JADX INFO: loaded from: classes.dex */
public final class b {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final int f13728a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public int f13729b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public int f13730c = -1;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public int f13731d = -1;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public int f13732e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public int f13733f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public int f13734g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final int[] f13735h;
    public final int[] i;

    public b(int i, int i5) {
        this.f13728a = i;
        this.f13729b = i5;
        int[] iArr = new int[i];
        for (int i8 = 0; i8 < i; i8++) {
            iArr[i8] = -1;
        }
        this.f13735h = iArr;
        int i9 = this.f13728a + 1;
        int[] iArr2 = new int[i9];
        for (int i10 = 0; i10 < i9; i10++) {
            iArr2[i10] = 0;
        }
        this.i = iArr2;
        c(this.f13729b);
    }

    public final void a(b bVar) {
        g.e(bVar, "row");
        this.f13730c = bVar.f13730c;
        this.f13731d = bVar.f13731d;
        this.f13732e = bVar.f13732e;
        this.f13733f = bVar.f13733f;
        this.f13734g = bVar.f13734g;
        int i = 0;
        while (true) {
            int[] iArr = this.i;
            int[] iArr2 = bVar.i;
            int i5 = this.f13728a;
            if (i >= i5) {
                iArr[i5] = iArr2[i5];
                return;
            }
            this.f13735h[i] = bVar.f13735h[i];
            iArr[i] = iArr2[i];
            i++;
        }
    }

    public final void b(int i) {
        this.f13733f = i;
        this.f13734g = i;
        for (int i5 = 0; i5 < this.f13728a; i5++) {
            this.f13735h[i5] = -1;
        }
        this.f13732e = 0;
        this.f13730c = -1;
        this.f13731d = -1;
    }

    public final void c(int i) {
        int i5;
        this.f13729b = i;
        int[] iArr = this.i;
        int i8 = 0;
        iArr[0] = 0;
        int i9 = this.f13728a;
        int i10 = i / i9;
        int i11 = i % i9;
        if (1 > i9) {
            return;
        }
        int i12 = 1;
        int i13 = 0;
        while (true) {
            i8 += i11;
            if (i8 <= 0 || i9 - i8 >= i11) {
                i5 = i10;
            } else {
                i5 = i10 + 1;
                i8 -= i9;
            }
            i13 += i5;
            iArr[i12] = i13;
            if (i12 == i9) {
                return;
            } else {
                i12++;
            }
        }
    }

    public final boolean equals(Object obj) {
        if (!(obj instanceof b)) {
            return false;
        }
        b bVar = (b) obj;
        int i = bVar.f13728a;
        int i5 = this.f13728a;
        if (i5 == i && this.f13729b == bVar.f13729b) {
            for (int i8 = 0; i8 < i5; i8++) {
                if (this.f13735h[i8] != bVar.f13735h[i8]) {
                    return false;
                }
            }
            if (this.f13730c == bVar.f13730c && this.f13731d == bVar.f13731d && this.f13733f == bVar.f13733f && this.f13732e == bVar.f13732e) {
                return true;
            }
        }
        return false;
    }

    public final int hashCode() {
        return Arrays.hashCode(this.f13735h) + (((((((((((this.f13728a * 31) + this.f13729b) * 31) + this.f13730c) * 31) + this.f13731d) * 31) + this.f13732e) * 31) + this.f13733f) * 31);
    }

    public final String toString() {
        int i = this.f13730c;
        int i5 = this.f13731d;
        int i8 = this.f13732e;
        int i9 = this.f13733f;
        int i10 = this.f13734g;
        String string = Arrays.toString(this.f13735h);
        g.d(string, "toString(...)");
        StringBuilder sb = new StringBuilder("GridRow(startIndex=");
        sb.append(i);
        sb.append(", endIndex=");
        sb.append(i5);
        sb.append(", height=");
        sb.append(i8);
        sb.append(", startOffset=");
        sb.append(i9);
        sb.append(", endOffset=");
        sb.append(i10);
        sb.append(", positions=");
        return I1.a.r(sb, string, ")");
    }
}
