package d.f.a.j;

import d.f.a.j.c;

/* JADX INFO: loaded from: classes.dex */
public class f extends d {
    public float q0 = -1.0f;
    public int r0 = -1;
    public int s0 = -1;
    public c t0 = this.J;
    public int u0 = 0;
    public boolean v0;

    public f() {
        this.R.clear();
        this.R.add(this.t0);
        int length = this.Q.length;
        for (int i2 = 0; i2 < length; i2++) {
            this.Q[i2] = this.t0;
        }
    }

    @Override // d.f.a.j.d
    public boolean A() {
        return this.v0;
    }

    @Override // d.f.a.j.d
    public boolean B() {
        return this.v0;
    }

    @Override // d.f.a.j.d
    public void P(d.f.a.d dVar, boolean z2) {
        if (this.U == null) {
            return;
        }
        int iO = dVar.o(this.t0);
        if (this.u0 == 1) {
            this.Z = iO;
            this.f2322a0 = 0;
            I(this.U.l());
            N(0);
            return;
        }
        this.Z = 0;
        this.f2322a0 = iO;
        N(this.U.r());
        I(0);
    }

    public void Q(int i2) {
        c cVar = this.t0;
        cVar.f2304b = i2;
        cVar.f2305c = true;
        this.v0 = true;
    }

    public void R(int i2) {
        if (this.u0 == i2) {
            return;
        }
        this.u0 = i2;
        this.R.clear();
        this.t0 = this.u0 == 1 ? this.I : this.J;
        this.R.add(this.t0);
        int length = this.Q.length;
        for (int i3 = 0; i3 < length; i3++) {
            this.Q[i3] = this.t0;
        }
    }

    @Override // d.f.a.j.d
    public void d(d.f.a.d dVar, boolean z2) {
        d.f.a.h hVarL;
        d.f.a.h hVarL2;
        d.f.a.h hVarL3;
        e eVar = (e) this.U;
        if (eVar == null) {
            return;
        }
        Object objI = eVar.i(c.a.LEFT);
        Object objI2 = eVar.i(c.a.RIGHT);
        d dVar2 = this.U;
        boolean z3 = dVar2 != null && dVar2.T[0] == 2;
        if (this.u0 == 0) {
            objI = eVar.i(c.a.TOP);
            objI2 = eVar.i(c.a.BOTTOM);
            d dVar3 = this.U;
            z3 = dVar3 != null && dVar3.T[1] == 2;
        }
        if (this.v0) {
            c cVar = this.t0;
            if (cVar.f2305c) {
                d.f.a.h hVarL4 = dVar.l(cVar);
                dVar.e(hVarL4, this.t0.c());
                if (this.r0 != -1) {
                    if (z3) {
                        hVarL3 = dVar.l(objI2);
                        dVar.f(hVarL3, hVarL4, 0, 5);
                    }
                } else if (this.s0 != -1 && z3) {
                    d.f.a.h hVarL5 = dVar.l(objI2);
                    dVar.f(hVarL4, dVar.l(objI), 0, 5);
                    hVarL3 = hVarL5;
                    dVar.f(hVarL3, hVarL4, 0, 5);
                }
                this.v0 = false;
                return;
            }
        }
        if (this.r0 != -1) {
            hVarL = dVar.l(this.t0);
            dVar.d(hVarL, dVar.l(objI), this.r0, 8);
            if (!z3) {
                return;
            } else {
                hVarL2 = dVar.l(objI2);
            }
        } else {
            if (this.s0 == -1) {
                if (this.q0 != -1.0f) {
                    d.f.a.h hVarL6 = dVar.l(this.t0);
                    d.f.a.h hVarL7 = dVar.l(objI2);
                    float f2 = this.q0;
                    d.f.a.b bVarM = dVar.m();
                    bVarM.f2230d.d(hVarL6, -1.0f);
                    bVarM.f2230d.d(hVarL7, f2);
                    dVar.c(bVarM);
                    return;
                }
                return;
            }
            hVarL = dVar.l(this.t0);
            d.f.a.h hVarL8 = dVar.l(objI2);
            dVar.d(hVarL, hVarL8, -this.s0, 8);
            if (!z3) {
                return;
            }
            dVar.f(hVarL, dVar.l(objI), 0, 5);
            hVarL2 = hVarL8;
        }
        dVar.f(hVarL2, hVarL, 0, 5);
    }

    @Override // d.f.a.j.d
    public boolean e() {
        return true;
    }

    @Override // d.f.a.j.d
    public c i(c.a aVar) {
        int iOrdinal = aVar.ordinal();
        if (iOrdinal != 1) {
            if (iOrdinal != 2) {
                if (iOrdinal != 3) {
                    if (iOrdinal != 4) {
                        return null;
                    }
                }
            }
            if (this.u0 == 0) {
                return this.t0;
            }
            return null;
        }
        if (this.u0 == 1) {
            return this.t0;
        }
        return null;
    }
}
