package w;

/* JADX INFO: renamed from: w.f, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1085f {

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public C1082c f10554d;

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

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

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

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public int f10558h;
    public int i;

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

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public int f10560k;
    public int q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public final /* synthetic */ C1086g f10565r;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public C1083d f10552b = null;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public int f10553c = 0;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public int f10561l = 0;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public int f10562m = 0;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public int f10563n = 0;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public int f10564o = 0;
    public int p = 0;

    public C1085f(C1086g c1086g, int i, C1082c c1082c, C1082c c1082c2, C1082c c1082c3, C1082c c1082c4, int i5) {
        this.f10565r = c1086g;
        this.f10551a = i;
        this.f10554d = c1082c;
        this.f10555e = c1082c2;
        this.f10556f = c1082c3;
        this.f10557g = c1082c4;
        this.f10558h = c1086g.f10595w0;
        this.i = c1086g.f10591s0;
        this.f10559j = c1086g.f10596x0;
        this.f10560k = c1086g.f10592t0;
        this.q = i5;
    }

    public final void a(C1083d c1083d) {
        int i = this.f10551a;
        C1086g c1086g = this.f10565r;
        if (i == 0) {
            int iU = c1086g.U(c1083d, this.q);
            if (c1083d.f10519p0[0] == 3) {
                this.p++;
                iU = 0;
            }
            this.f10561l = iU + (c1083d.f10504g0 != 8 ? c1086g.f10580P0 : 0) + this.f10561l;
            int iT = c1086g.T(c1083d, this.q);
            if (this.f10552b == null || this.f10553c < iT) {
                this.f10552b = c1083d;
                this.f10553c = iT;
                this.f10562m = iT;
            }
        } else {
            int iU2 = c1086g.U(c1083d, this.q);
            int iT2 = c1086g.T(c1083d, this.q);
            if (c1083d.f10519p0[1] == 3) {
                this.p++;
                iT2 = 0;
            }
            this.f10562m = iT2 + (c1083d.f10504g0 != 8 ? c1086g.Q0 : 0) + this.f10562m;
            if (this.f10552b == null || this.f10553c < iU2) {
                this.f10552b = c1083d;
                this.f10553c = iU2;
                this.f10561l = iU2;
            }
        }
        this.f10564o++;
    }

    public final void b(int i, boolean z5, boolean z6) {
        C1086g c1086g;
        int i5;
        C1083d c1083d;
        boolean z7;
        char c6;
        float f6;
        float f7;
        int i6;
        float f8;
        float f9;
        int i7;
        int i8 = this.f10564o;
        int i9 = 0;
        while (true) {
            c1086g = this.f10565r;
            if (i9 >= i8 || (i7 = this.f10563n + i9) >= c1086g.f10590b1) {
                break;
            }
            C1083d c1083d2 = c1086g.f10589a1[i7];
            if (c1083d2 != null) {
                c1083d2.D();
            }
            i9++;
        }
        if (i8 == 0 || this.f10552b == null) {
            return;
        }
        boolean z8 = z6 && i == 0;
        int i10 = -1;
        int i11 = -1;
        for (int i12 = 0; i12 < i8; i12++) {
            int i13 = this.f10563n + (z5 ? (i8 - 1) - i12 : i12);
            if (i13 >= c1086g.f10590b1) {
                break;
            }
            C1083d c1083d3 = c1086g.f10589a1[i13];
            if (c1083d3 != null && c1083d3.f10504g0 == 0) {
                if (i10 == -1) {
                    i10 = i12;
                }
                i11 = i12;
            }
        }
        if (this.f10551a != 0) {
            boolean z9 = z8;
            C1083d c1083d4 = this.f10552b;
            c1083d4.f10507i0 = c1086g.f10569D0;
            int i14 = this.f10558h;
            if (i > 0) {
                i14 += c1086g.f10580P0;
            }
            C1082c c1082c = c1083d4.I;
            C1082c c1082c2 = c1083d4.K;
            if (z5) {
                c1082c2.a(this.f10556f, i14);
                if (z6) {
                    c1082c.a(this.f10554d, this.f10559j);
                }
                if (i > 0) {
                    this.f10556f.f10464d.I.a(c1082c2, 0);
                }
            } else {
                c1082c.a(this.f10554d, i14);
                if (z6) {
                    c1082c2.a(this.f10556f, this.f10559j);
                }
                if (i > 0) {
                    this.f10554d.f10464d.K.a(c1082c, 0);
                }
            }
            C1083d c1083d5 = null;
            for (int i15 = 0; i15 < i8; i15++) {
                int i16 = this.f10563n + i15;
                if (i16 >= c1086g.f10590b1) {
                    return;
                }
                C1083d c1083d6 = c1086g.f10589a1[i16];
                if (c1083d6 != null) {
                    C1082c c1082c3 = c1083d6.J;
                    if (i15 == 0) {
                        c1083d6.f(c1082c3, this.f10555e, this.i);
                        int i17 = c1086g.f10570E0;
                        float f10 = c1086g.f10576K0;
                        if (this.f10563n == 0) {
                            int i18 = c1086g.f10572G0;
                            i5 = -1;
                            if (i18 != -1) {
                                f10 = c1086g.f10578M0;
                            }
                            i17 = i18;
                            c1083d6.f10509j0 = i17;
                            c1083d6.f10500e0 = f10;
                        } else {
                            i5 = -1;
                        }
                        if (z6 && (i18 = c1086g.f10574I0) != i5) {
                            f10 = c1086g.f10579O0;
                            i17 = i18;
                        }
                        c1083d6.f10509j0 = i17;
                        c1083d6.f10500e0 = f10;
                    }
                    if (i15 == i8 - 1) {
                        c1083d6.f(c1083d6.f10477L, this.f10557g, this.f10560k);
                    }
                    if (c1083d5 != null) {
                        int i19 = c1086g.Q0;
                        C1082c c1082c4 = c1083d5.f10477L;
                        c1082c3.a(c1082c4, i19);
                        if (i15 == i10) {
                            int i20 = this.i;
                            if (c1082c3.h()) {
                                c1082c3.f10468h = i20;
                            }
                        }
                        c1082c4.a(c1082c3, 0);
                        if (i15 == i11 + 1) {
                            int i21 = this.f10560k;
                            if (c1082c4.h()) {
                                c1082c4.f10468h = i21;
                            }
                        }
                    }
                    if (c1083d6 != c1083d4) {
                        C1082c c1082c5 = c1083d6.K;
                        C1082c c1082c6 = c1083d6.I;
                        if (z5) {
                            int i22 = c1086g.f10581R0;
                            if (i22 == 0) {
                                c1082c5.a(c1082c2, 0);
                            } else if (i22 == 1) {
                                c1082c6.a(c1082c, 0);
                            } else if (i22 == 2) {
                                c1082c6.a(c1082c, 0);
                                c1082c5.a(c1082c2, 0);
                            }
                            c1083d5 = c1083d6;
                        } else {
                            int i23 = c1086g.f10581R0;
                            if (i23 == 0) {
                                c1082c6.a(c1082c, 0);
                            } else if (i23 == 1) {
                                c1082c5.a(c1082c2, 0);
                            } else if (i23 == 2) {
                                if (z9) {
                                    c1082c6.a(this.f10554d, this.f10558h);
                                    c1082c5.a(this.f10556f, this.f10559j);
                                } else {
                                    c1082c6.a(c1082c, 0);
                                    c1082c5.a(c1082c2, 0);
                                }
                            }
                            c1083d5 = c1083d6;
                        }
                    } else {
                        c1083d5 = c1083d6;
                    }
                }
            }
            return;
        }
        C1083d c1083d7 = this.f10552b;
        c1083d7.f10509j0 = c1086g.f10570E0;
        int i24 = this.i;
        if (i > 0) {
            i24 += c1086g.Q0;
        }
        C1082c c1082c7 = this.f10555e;
        C1082c c1082c8 = c1083d7.J;
        c1082c8.a(c1082c7, i24);
        C1082c c1082c9 = c1083d7.f10477L;
        if (z6) {
            c1082c9.a(this.f10557g, this.f10560k);
        }
        if (i > 0) {
            this.f10555e.f10464d.f10477L.a(c1082c8, 0);
        }
        if (c1086g.S0 != 3 || c1083d7.f10473E) {
            c1083d = c1083d7;
        } else {
            for (int i25 = 0; i25 < i8; i25++) {
                int i26 = this.f10563n + (z5 ? (i8 - 1) - i25 : i25);
                if (i26 >= c1086g.f10590b1) {
                    break;
                }
                c1083d = c1086g.f10589a1[i26];
                if (c1083d.f10473E) {
                    break;
                }
            }
            c1083d = c1083d7;
        }
        int i27 = 0;
        C1083d c1083d8 = null;
        while (i27 < i8) {
            int i28 = z5 ? (i8 - 1) - i27 : i27;
            int i29 = this.f10563n + i28;
            if (i29 >= c1086g.f10590b1) {
                return;
            }
            C1083d c1083d9 = c1086g.f10589a1[i29];
            if (c1083d9 == null) {
                z7 = z8;
                c6 = 3;
            } else {
                C1082c c1082c10 = c1083d9.I;
                if (i27 == 0) {
                    c1083d9.f(c1082c10, this.f10554d, this.f10558h);
                }
                if (i28 == 0) {
                    int i30 = c1086g.f10569D0;
                    if (z5) {
                        f6 = 1.0f;
                        f7 = 1.0f - c1086g.f10575J0;
                    } else {
                        f6 = 1.0f;
                        f7 = c1086g.f10575J0;
                    }
                    if (this.f10563n == 0) {
                        i6 = c1086g.f10571F0;
                        z7 = z8;
                        if (i6 != -1) {
                            if (z5) {
                                f9 = c1086g.f10577L0;
                                f7 = f6 - f9;
                            } else {
                                f8 = c1086g.f10577L0;
                                f7 = f8;
                            }
                        }
                        c1083d9.f10507i0 = i6;
                        c1083d9.f10498d0 = f7;
                    } else {
                        z7 = z8;
                    }
                    if (!z6 || (i6 = c1086g.f10573H0) == -1) {
                        i6 = i30;
                        c1083d9.f10507i0 = i6;
                        c1083d9.f10498d0 = f7;
                    } else if (z5) {
                        f9 = c1086g.N0;
                        f7 = f6 - f9;
                        c1083d9.f10507i0 = i6;
                        c1083d9.f10498d0 = f7;
                    } else {
                        f8 = c1086g.N0;
                        f7 = f8;
                        c1083d9.f10507i0 = i6;
                        c1083d9.f10498d0 = f7;
                    }
                } else {
                    z7 = z8;
                }
                if (i27 == i8 - 1) {
                    c1083d9.f(c1083d9.K, this.f10556f, this.f10559j);
                }
                if (c1083d8 != null) {
                    int i31 = c1086g.f10580P0;
                    C1082c c1082c11 = c1083d8.K;
                    c1082c10.a(c1082c11, i31);
                    if (i27 == i10) {
                        int i32 = this.f10558h;
                        if (c1082c10.h()) {
                            c1082c10.f10468h = i32;
                        }
                    }
                    c1082c11.a(c1082c10, 0);
                    if (i27 == i11 + 1) {
                        int i33 = this.f10559j;
                        if (c1082c11.h()) {
                            c1082c11.f10468h = i33;
                        }
                    }
                }
                if (c1083d9 != c1083d7) {
                    int i34 = c1086g.S0;
                    c6 = 3;
                    if (i34 == 3 && c1083d.f10473E && c1083d9 != c1083d && c1083d9.f10473E) {
                        c1083d9.f10478M.a(c1083d.f10478M, 0);
                    } else {
                        C1082c c1082c12 = c1083d9.J;
                        if (i34 != 0) {
                            C1082c c1082c13 = c1083d9.f10477L;
                            if (i34 == 1) {
                                c1082c13.a(c1082c9, 0);
                            } else if (z7) {
                                c1082c12.a(this.f10555e, this.i);
                                c1082c13.a(this.f10557g, this.f10560k);
                            } else {
                                c1082c12.a(c1082c8, 0);
                                c1082c13.a(c1082c9, 0);
                            }
                        } else {
                            c1082c12.a(c1082c8, 0);
                        }
                    }
                } else {
                    c6 = 3;
                }
                c1083d8 = c1083d9;
            }
            i27++;
            z8 = z7;
        }
    }

    public final int c() {
        return this.f10551a == 1 ? this.f10562m - this.f10565r.Q0 : this.f10562m;
    }

    public final int d() {
        return this.f10551a == 0 ? this.f10561l - this.f10565r.f10580P0 : this.f10561l;
    }

    public final void e(int i) {
        C1086g c1086g;
        int i5;
        int i6 = this.p;
        if (i6 == 0) {
            return;
        }
        int i7 = this.f10564o;
        int i8 = i / i6;
        int i9 = 0;
        while (true) {
            c1086g = this.f10565r;
            if (i9 >= i7 || (i5 = this.f10563n + i9) >= c1086g.f10590b1) {
                break;
            }
            C1083d c1083d = c1086g.f10589a1[i5];
            if (this.f10551a == 0) {
                if (c1083d != null) {
                    int[] iArr = c1083d.f10519p0;
                    if (iArr[0] == 3 && c1083d.f10520r == 0) {
                        c1086g.V(1, i8, iArr[1], c1083d.k(), c1083d);
                    }
                }
            } else if (c1083d != null) {
                int[] iArr2 = c1083d.f10519p0;
                if (iArr2[1] == 3 && c1083d.f10521s == 0) {
                    int i10 = iArr2[0];
                    int i11 = i8;
                    c1086g.V(i10, c1083d.q(), 1, i11, c1083d);
                    i8 = i11;
                }
            }
            i9++;
        }
        this.f10561l = 0;
        this.f10562m = 0;
        this.f10552b = null;
        this.f10553c = 0;
        int i12 = this.f10564o;
        for (int i13 = 0; i13 < i12; i13++) {
            int i14 = this.f10563n + i13;
            if (i14 >= c1086g.f10590b1) {
                return;
            }
            C1083d c1083d2 = c1086g.f10589a1[i14];
            if (this.f10551a == 0) {
                int iQ = c1083d2.q();
                int i15 = c1086g.f10580P0;
                if (c1083d2.f10504g0 == 8) {
                    i15 = 0;
                }
                this.f10561l = iQ + i15 + this.f10561l;
                int iT = c1086g.T(c1083d2, this.q);
                if (this.f10552b == null || this.f10553c < iT) {
                    this.f10552b = c1083d2;
                    this.f10553c = iT;
                    this.f10562m = iT;
                }
            } else {
                int iU = c1086g.U(c1083d2, this.q);
                int iT2 = c1086g.T(c1083d2, this.q);
                int i16 = c1086g.Q0;
                if (c1083d2.f10504g0 == 8) {
                    i16 = 0;
                }
                this.f10562m = iT2 + i16 + this.f10562m;
                if (this.f10552b == null || this.f10553c < iU) {
                    this.f10552b = c1083d2;
                    this.f10553c = iU;
                    this.f10561l = iU;
                }
            }
        }
    }

    public final void f(int i, C1082c c1082c, C1082c c1082c2, C1082c c1082c3, C1082c c1082c4, int i5, int i6, int i7, int i8, int i9) {
        this.f10551a = i;
        this.f10554d = c1082c;
        this.f10555e = c1082c2;
        this.f10556f = c1082c3;
        this.f10557g = c1082c4;
        this.f10558h = i5;
        this.i = i6;
        this.f10559j = i7;
        this.f10560k = i8;
        this.q = i9;
    }
}
