package c.e.b.h;

import c.e.b.g;
import c.e.b.h.l.n;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;

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

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

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

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

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

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

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public c.e.b.g f1126i;
    public HashSet<c> a = null;

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

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

    /* JADX INFO: compiled from: ConstraintAnchor.java */
    public enum a {
        NONE,
        LEFT,
        TOP,
        RIGHT,
        BOTTOM,
        BASELINE,
        CENTER,
        CENTER_X,
        CENTER_Y
    }

    public c(d dVar, a aVar) {
        this.f1121d = dVar;
        this.f1122e = aVar;
    }

    /* JADX WARN: Removed duplicated region for block: B:27:0x0040  */
    /* JADX WARN: Removed duplicated region for block: B:42:0x005d A[PHI: r2
      0x005d: PHI (r2v8 boolean) = (r2v4 boolean), (r2v11 boolean) binds: [B:51:0x006f, B:37:0x0054] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:57:0x007a A[RETURN] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public boolean a(c.e.b.h.c r5, int r6, int r7, boolean r8) {
        /*
            r4 = this;
            r0 = 1
            if (r5 != 0) goto L7
            r4.h()
            return r0
        L7:
            r1 = 0
            if (r8 != 0) goto L7b
            c.e.b.h.c$a r8 = r5.f1122e
            c.e.b.h.c$a r2 = r4.f1122e
            if (r8 != r2) goto L21
            c.e.b.h.c$a r8 = c.e.b.h.c.a.BASELINE
            if (r2 != r8) goto L40
            c.e.b.h.d r8 = r5.f1121d
            boolean r8 = r8.y
            if (r8 == 0) goto L42
            c.e.b.h.d r8 = r4.f1121d
            boolean r8 = r8.y
            if (r8 != 0) goto L40
            goto L42
        L21:
            int r2 = r2.ordinal()
            switch(r2) {
                case 0: goto L42;
                case 1: goto L5f;
                case 2: goto L44;
                case 3: goto L5f;
                case 4: goto L44;
                case 5: goto L42;
                case 6: goto L34;
                case 7: goto L42;
                case 8: goto L42;
                default: goto L28;
            }
        L28:
            java.lang.AssertionError r5 = new java.lang.AssertionError
            c.e.b.h.c$a r6 = r4.f1122e
            java.lang.String r6 = r6.name()
            r5.<init>(r6)
            throw r5
        L34:
            c.e.b.h.c$a r2 = c.e.b.h.c.a.BASELINE
            if (r8 == r2) goto L42
            c.e.b.h.c$a r2 = c.e.b.h.c.a.CENTER_X
            if (r8 == r2) goto L42
            c.e.b.h.c$a r2 = c.e.b.h.c.a.CENTER_Y
            if (r8 == r2) goto L42
        L40:
            r8 = r0
            goto L78
        L42:
            r8 = r1
            goto L78
        L44:
            c.e.b.h.c$a r2 = c.e.b.h.c.a.TOP
            if (r8 == r2) goto L4f
            c.e.b.h.c$a r2 = c.e.b.h.c.a.BOTTOM
            if (r8 != r2) goto L4d
            goto L4f
        L4d:
            r2 = r1
            goto L50
        L4f:
            r2 = r0
        L50:
            c.e.b.h.d r3 = r5.f1121d
            boolean r3 = r3 instanceof c.e.b.h.f
            if (r3 == 0) goto L5d
            if (r2 != 0) goto L40
            c.e.b.h.c$a r2 = c.e.b.h.c.a.CENTER_Y
            if (r8 != r2) goto L42
            goto L40
        L5d:
            r8 = r2
            goto L78
        L5f:
            c.e.b.h.c$a r2 = c.e.b.h.c.a.LEFT
            if (r8 == r2) goto L6a
            c.e.b.h.c$a r2 = c.e.b.h.c.a.RIGHT
            if (r8 != r2) goto L68
            goto L6a
        L68:
            r2 = r1
            goto L6b
        L6a:
            r2 = r0
        L6b:
            c.e.b.h.d r3 = r5.f1121d
            boolean r3 = r3 instanceof c.e.b.h.f
            if (r3 == 0) goto L5d
            if (r2 != 0) goto L40
            c.e.b.h.c$a r2 = c.e.b.h.c.a.CENTER_X
            if (r8 != r2) goto L42
            goto L40
        L78:
            if (r8 != 0) goto L7b
            return r1
        L7b:
            r4.f1123f = r5
            java.util.HashSet<c.e.b.h.c> r8 = r5.a
            if (r8 != 0) goto L88
            java.util.HashSet r8 = new java.util.HashSet
            r8.<init>()
            r5.a = r8
        L88:
            c.e.b.h.c r5 = r4.f1123f
            java.util.HashSet<c.e.b.h.c> r5 = r5.a
            if (r5 == 0) goto L91
            r5.add(r4)
        L91:
            if (r6 <= 0) goto L96
            r4.f1124g = r6
            goto L98
        L96:
            r4.f1124g = r1
        L98:
            r4.f1125h = r7
            return r0
        */
        throw new UnsupportedOperationException("Method not decompiled: c.e.b.h.c.a(c.e.b.h.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()) {
                c.b.a.b(it.next().f1121d, i2, arrayList, nVar);
            }
        }
    }

    public int c() {
        if (this.f1120c) {
            return this.f1119b;
        }
        return 0;
    }

    public int d() {
        c cVar;
        if (this.f1121d.c0 == 8) {
            return 0;
        }
        int i2 = this.f1125h;
        return (i2 <= -1 || (cVar = this.f1123f) == null || cVar.f1121d.c0 != 8) ? this.f1124g : i2;
    }

    public boolean e() {
        c cVar;
        HashSet<c> hashSet = this.a;
        if (hashSet == null) {
            return false;
        }
        for (c cVar2 : hashSet) {
            switch (cVar2.f1122e) {
                case NONE:
                case BASELINE:
                case CENTER:
                case CENTER_X:
                case CENTER_Y:
                    cVar = null;
                    break;
                case LEFT:
                    cVar = cVar2.f1121d.F;
                    break;
                case TOP:
                    cVar = cVar2.f1121d.G;
                    break;
                case RIGHT:
                    cVar = cVar2.f1121d.D;
                    break;
                case BOTTOM:
                    cVar = cVar2.f1121d.E;
                    break;
                default:
                    throw new AssertionError(cVar2.f1122e.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.f1123f != null;
    }

    public void h() {
        HashSet<c> hashSet;
        c cVar = this.f1123f;
        if (cVar != null && (hashSet = cVar.a) != null) {
            hashSet.remove(this);
            if (this.f1123f.a.size() == 0) {
                this.f1123f.a = null;
            }
        }
        this.a = null;
        this.f1123f = null;
        this.f1124g = 0;
        this.f1125h = -1;
        this.f1120c = false;
        this.f1119b = 0;
    }

    public void i() {
        c.e.b.g gVar = this.f1126i;
        if (gVar == null) {
            this.f1126i = new c.e.b.g(g.a.UNRESTRICTED);
        } else {
            gVar.c();
        }
    }

    public void j(int i2) {
        this.f1119b = i2;
        this.f1120c = true;
    }

    public String toString() {
        return this.f1121d.d0 + ":" + this.f1122e.toString();
    }
}
