package d.f.a.j;

import d.f.a.j.l.n;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;

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

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public boolean f2305c;

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

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

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

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public d.f.a.h f2311i;
    public HashSet<c> a = null;

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

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public int f2310h = Integer.MIN_VALUE;

    public enum a {
        NONE,
        LEFT,
        TOP,
        RIGHT,
        BOTTOM,
        BASELINE,
        CENTER,
        CENTER_X,
        CENTER_Y
    }

    public c(d dVar, a aVar) {
        this.f2306d = dVar;
        this.f2307e = aVar;
    }

    /* JADX WARN: Removed duplicated region for block: B:22:0x0042  */
    /* JADX WARN: Removed duplicated region for block: B:51:0x0079 A[RETURN] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public boolean a(d.f.a.j.c r9, int r10, int r11, boolean r12) {
        /*
            r8 = this;
            r0 = 1
            if (r9 != 0) goto L7
            r8.h()
            return r0
        L7:
            if (r12 != 0) goto L7a
            d.f.a.j.c$a r12 = d.f.a.j.c.a.CENTER_Y
            d.f.a.j.c$a r1 = d.f.a.j.c.a.RIGHT
            d.f.a.j.c$a r2 = d.f.a.j.c.a.CENTER_X
            d.f.a.j.c$a r3 = d.f.a.j.c.a.LEFT
            d.f.a.j.c$a r4 = d.f.a.j.c.a.BASELINE
            d.f.a.j.c$a r5 = r9.f2307e
            d.f.a.j.c$a r6 = r8.f2307e
            r7 = 0
            if (r5 != r6) goto L29
            if (r6 != r4) goto L42
            d.f.a.j.d r12 = r9.f2306d
            boolean r12 = r12.D
            if (r12 == 0) goto L44
            d.f.a.j.d r12 = r8.f2306d
            boolean r12 = r12.D
            if (r12 != 0) goto L42
            goto L44
        L29:
            int r6 = r6.ordinal()
            switch(r6) {
                case 0: goto L44;
                case 1: goto L64;
                case 2: goto L4b;
                case 3: goto L64;
                case 4: goto L4b;
                case 5: goto L46;
                case 6: goto L3c;
                case 7: goto L44;
                case 8: goto L44;
                default: goto L30;
            }
        L30:
            java.lang.AssertionError r9 = new java.lang.AssertionError
            d.f.a.j.c$a r10 = r8.f2307e
            java.lang.String r10 = r10.name()
            r9.<init>(r10)
            throw r9
        L3c:
            if (r5 == r4) goto L44
            if (r5 == r2) goto L44
            if (r5 == r12) goto L44
        L42:
            r12 = r0
            goto L77
        L44:
            r12 = r7
            goto L77
        L46:
            if (r5 == r3) goto L44
            if (r5 != r1) goto L42
            goto L44
        L4b:
            d.f.a.j.c$a r1 = d.f.a.j.c.a.TOP
            if (r5 == r1) goto L56
            d.f.a.j.c$a r1 = d.f.a.j.c.a.BOTTOM
            if (r5 != r1) goto L54
            goto L56
        L54:
            r1 = r7
            goto L57
        L56:
            r1 = r0
        L57:
            d.f.a.j.d r2 = r9.f2306d
            boolean r2 = r2 instanceof d.f.a.j.f
            if (r2 == 0) goto L62
            if (r1 != 0) goto L42
            if (r5 != r12) goto L44
            goto L42
        L62:
            r12 = r1
            goto L77
        L64:
            if (r5 == r3) goto L6b
            if (r5 != r1) goto L69
            goto L6b
        L69:
            r12 = r7
            goto L6c
        L6b:
            r12 = r0
        L6c:
            d.f.a.j.d r1 = r9.f2306d
            boolean r1 = r1 instanceof d.f.a.j.f
            if (r1 == 0) goto L77
            if (r12 != 0) goto L42
            if (r5 != r2) goto L44
            goto L42
        L77:
            if (r12 != 0) goto L7a
            return r7
        L7a:
            r8.f2308f = r9
            java.util.HashSet<d.f.a.j.c> r12 = r9.a
            if (r12 != 0) goto L87
            java.util.HashSet r12 = new java.util.HashSet
            r12.<init>()
            r9.a = r12
        L87:
            d.f.a.j.c r9 = r8.f2308f
            java.util.HashSet<d.f.a.j.c> r9 = r9.a
            if (r9 == 0) goto L90
            r9.add(r8)
        L90:
            r8.f2309g = r10
            r8.f2310h = r11
            return r0
        */
        throw new UnsupportedOperationException("Method not decompiled: d.f.a.j.c.a(d.f.a.j.c, int, int, boolean):boolean");
    }

    public void b(int i2, ArrayList<n> arrayList, n nVar) {
        HashSet<c> hashSet = this.a;
        if (hashSet != null) {
            Iterator<c> it = hashSet.iterator();
            while (it.hasNext()) {
                d.b.a.b(it.next().f2306d, i2, arrayList, nVar);
            }
        }
    }

    public int c() {
        if (this.f2305c) {
            return this.f2304b;
        }
        return 0;
    }

    public int d() {
        c cVar;
        if (this.f2306d.h0 == 8) {
            return 0;
        }
        int i2 = this.f2310h;
        return (i2 == Integer.MIN_VALUE || (cVar = this.f2308f) == null || cVar.f2306d.h0 != 8) ? this.f2309g : i2;
    }

    public boolean e() {
        c cVar;
        HashSet<c> hashSet = this.a;
        if (hashSet == null) {
            return false;
        }
        for (c cVar2 : hashSet) {
            switch (cVar2.f2307e) {
                case NONE:
                case BASELINE:
                case CENTER:
                case CENTER_X:
                case CENTER_Y:
                    cVar = null;
                    break;
                case LEFT:
                    cVar = cVar2.f2306d.K;
                    break;
                case TOP:
                    cVar = cVar2.f2306d.L;
                    break;
                case RIGHT:
                    cVar = cVar2.f2306d.I;
                    break;
                case BOTTOM:
                    cVar = cVar2.f2306d.J;
                    break;
                default:
                    throw new AssertionError(cVar2.f2307e.name());
            }
            if (cVar.g()) {
                return true;
            }
        }
        return false;
    }

    public boolean f() {
        HashSet<c> hashSet = this.a;
        return hashSet != null && hashSet.size() > 0;
    }

    public boolean g() {
        return this.f2308f != null;
    }

    public void h() {
        HashSet<c> hashSet;
        c cVar = this.f2308f;
        if (cVar != null && (hashSet = cVar.a) != null) {
            hashSet.remove(this);
            if (this.f2308f.a.size() == 0) {
                this.f2308f.a = null;
            }
        }
        this.a = null;
        this.f2308f = null;
        this.f2309g = 0;
        this.f2310h = Integer.MIN_VALUE;
        this.f2305c = false;
        this.f2304b = 0;
    }

    public void i() {
        d.f.a.h hVar = this.f2311i;
        if (hVar == null) {
            this.f2311i = new d.f.a.h(1);
        } else {
            hVar.g();
        }
    }

    public void j(int i2) {
        this.f2304b = i2;
        this.f2305c = true;
    }

    public String toString() {
        return this.f2306d.i0 + ":" + this.f2307e.toString();
    }
}
