package n;

import n.d;
import n.e;

/* JADX INFO: compiled from: Guideline.java */
/* JADX INFO: loaded from: classes.dex */
public class g extends e {
    private boolean B0;

    /* JADX INFO: renamed from: w0, reason: collision with root package name */
    protected float f5661w0 = -1.0f;

    /* JADX INFO: renamed from: x0, reason: collision with root package name */
    protected int f5662x0 = -1;

    /* JADX INFO: renamed from: y0, reason: collision with root package name */
    protected int f5663y0 = -1;

    /* JADX INFO: renamed from: z0, reason: collision with root package name */
    private d f5664z0 = this.M;
    private int A0 = 0;

    /* JADX INFO: compiled from: Guideline.java */
    static /* synthetic */ class a {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        static final /* synthetic */ int[] f5665a;

        static {
            int[] iArr = new int[d.b.values().length];
            f5665a = iArr;
            try {
                iArr[d.b.LEFT.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                f5665a[d.b.RIGHT.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                f5665a[d.b.TOP.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                f5665a[d.b.BOTTOM.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                f5665a[d.b.BASELINE.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                f5665a[d.b.CENTER.ordinal()] = 6;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                f5665a[d.b.CENTER_X.ordinal()] = 7;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                f5665a[d.b.CENTER_Y.ordinal()] = 8;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                f5665a[d.b.NONE.ordinal()] = 9;
            } catch (NoSuchFieldError unused9) {
            }
        }
    }

    public g() {
        this.U.clear();
        this.U.add(this.f5664z0);
        int length = this.T.length;
        for (int i3 = 0; i3 < length; i3++) {
            this.T[i3] = this.f5664z0;
        }
    }

    @Override // n.e
    public void g(k.d dVar, boolean z2) {
        f fVar = (f) I();
        if (fVar == null) {
            return;
        }
        d dVarM = fVar.m(d.b.LEFT);
        d dVarM2 = fVar.m(d.b.RIGHT);
        e eVar = this.X;
        boolean z3 = eVar != null && eVar.W[0] == e.b.WRAP_CONTENT;
        if (this.A0 == 0) {
            dVarM = fVar.m(d.b.TOP);
            dVarM2 = fVar.m(d.b.BOTTOM);
            e eVar2 = this.X;
            z3 = eVar2 != null && eVar2.W[1] == e.b.WRAP_CONTENT;
        }
        if (this.B0 && this.f5664z0.m()) {
            k.i iVarQ = dVar.q(this.f5664z0);
            dVar.f(iVarQ, this.f5664z0.d());
            if (this.f5662x0 != -1) {
                if (z3) {
                    dVar.h(dVar.q(dVarM2), iVarQ, 0, 5);
                }
            } else if (this.f5663y0 != -1 && z3) {
                k.i iVarQ2 = dVar.q(dVarM2);
                dVar.h(iVarQ, dVar.q(dVarM), 0, 5);
                dVar.h(iVarQ2, iVarQ, 0, 5);
            }
            this.B0 = false;
            return;
        }
        if (this.f5662x0 != -1) {
            k.i iVarQ3 = dVar.q(this.f5664z0);
            dVar.e(iVarQ3, dVar.q(dVarM), this.f5662x0, 8);
            if (z3) {
                dVar.h(dVar.q(dVarM2), iVarQ3, 0, 5);
                return;
            }
            return;
        }
        if (this.f5663y0 == -1) {
            if (this.f5661w0 != -1.0f) {
                dVar.d(k.d.s(dVar, dVar.q(this.f5664z0), dVar.q(dVarM2), this.f5661w0));
                return;
            }
            return;
        }
        k.i iVarQ4 = dVar.q(this.f5664z0);
        k.i iVarQ5 = dVar.q(dVarM2);
        dVar.e(iVarQ4, iVarQ5, -this.f5663y0, 8);
        if (z3) {
            dVar.h(iVarQ4, dVar.q(dVarM), 0, 5);
            dVar.h(iVarQ5, iVarQ4, 0, 5);
        }
    }

    @Override // n.e
    public boolean h() {
        return true;
    }

    @Override // n.e
    public boolean l0() {
        return this.B0;
    }

    @Override // n.e
    public d m(d.b bVar) {
        int i3 = a.f5665a[bVar.ordinal()];
        if (i3 == 1 || i3 == 2) {
            if (this.A0 == 1) {
                return this.f5664z0;
            }
            return null;
        }
        if ((i3 == 3 || i3 == 4) && this.A0 == 0) {
            return this.f5664z0;
        }
        return null;
    }

    @Override // n.e
    public boolean m0() {
        return this.B0;
    }

    @Override // n.e
    public void n1(k.d dVar, boolean z2) {
        if (I() == null) {
            return;
        }
        int iX = dVar.x(this.f5664z0);
        if (this.A0 == 1) {
            j1(iX);
            k1(0);
            I0(I().v());
            h1(0);
            return;
        }
        j1(0);
        k1(iX);
        h1(I().U());
        I0(0);
    }

    public d o1() {
        return this.f5664z0;
    }

    public int p1() {
        return this.A0;
    }

    public int q1() {
        return this.f5662x0;
    }

    public int r1() {
        return this.f5663y0;
    }

    public float s1() {
        return this.f5661w0;
    }

    public void t1(int i3) {
        this.f5664z0.s(i3);
        this.B0 = true;
    }

    public void u1(int i3) {
        if (i3 > -1) {
            this.f5661w0 = -1.0f;
            this.f5662x0 = i3;
            this.f5663y0 = -1;
        }
    }

    public void v1(int i3) {
        if (i3 > -1) {
            this.f5661w0 = -1.0f;
            this.f5662x0 = -1;
            this.f5663y0 = i3;
        }
    }

    public void w1(float f3) {
        if (f3 > -1.0f) {
            this.f5661w0 = f3;
            this.f5662x0 = -1;
            this.f5663y0 = -1;
        }
    }

    public void x1(int i3) {
        if (this.A0 == i3) {
            return;
        }
        this.A0 = i3;
        this.U.clear();
        if (this.A0 == 1) {
            this.f5664z0 = this.L;
        } else {
            this.f5664z0 = this.M;
        }
        this.U.add(this.f5664z0);
        int length = this.T.length;
        for (int i4 = 0; i4 < length; i4++) {
            this.T[i4] = this.f5664z0;
        }
    }
}
