package androidx.constraintlayout.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import java.util.HashMap;

/* JADX INFO: loaded from: classes.dex */
public class Constraints extends ViewGroup {

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

    public Constraints(Context context) {
        super(context);
        super.setVisibility(8);
    }

    @Override // android.view.ViewGroup
    public final ViewGroup.LayoutParams generateDefaultLayoutParams() {
        return new p();
    }

    @Override // android.view.ViewGroup
    public final ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
        Context context = getContext();
        p pVar = new p(context, attributeSet);
        pVar.f1482r0 = 1.0f;
        pVar.f1483s0 = false;
        pVar.f1484t0 = 0.0f;
        pVar.f1485u0 = 0.0f;
        pVar.f1486v0 = 0.0f;
        pVar.f1487w0 = 0.0f;
        pVar.f1488x0 = 1.0f;
        pVar.f1489y0 = 1.0f;
        pVar.z0 = 0.0f;
        pVar.A0 = 0.0f;
        pVar.B0 = 0.0f;
        pVar.C0 = 0.0f;
        pVar.D0 = 0.0f;
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, s.ConstraintSet);
        int indexCount = typedArrayObtainStyledAttributes.getIndexCount();
        for (int i10 = 0; i10 < indexCount; i10++) {
            int index = typedArrayObtainStyledAttributes.getIndex(i10);
            if (index == s.ConstraintSet_android_alpha) {
                pVar.f1482r0 = typedArrayObtainStyledAttributes.getFloat(index, pVar.f1482r0);
            } else if (index == s.ConstraintSet_android_elevation) {
                pVar.f1484t0 = typedArrayObtainStyledAttributes.getFloat(index, pVar.f1484t0);
                pVar.f1483s0 = true;
            } else if (index == s.ConstraintSet_android_rotationX) {
                pVar.f1486v0 = typedArrayObtainStyledAttributes.getFloat(index, pVar.f1486v0);
            } else if (index == s.ConstraintSet_android_rotationY) {
                pVar.f1487w0 = typedArrayObtainStyledAttributes.getFloat(index, pVar.f1487w0);
            } else if (index == s.ConstraintSet_android_rotation) {
                pVar.f1485u0 = typedArrayObtainStyledAttributes.getFloat(index, pVar.f1485u0);
            } else if (index == s.ConstraintSet_android_scaleX) {
                pVar.f1488x0 = typedArrayObtainStyledAttributes.getFloat(index, pVar.f1488x0);
            } else if (index == s.ConstraintSet_android_scaleY) {
                pVar.f1489y0 = typedArrayObtainStyledAttributes.getFloat(index, pVar.f1489y0);
            } else if (index == s.ConstraintSet_android_transformPivotX) {
                pVar.z0 = typedArrayObtainStyledAttributes.getFloat(index, pVar.z0);
            } else if (index == s.ConstraintSet_android_transformPivotY) {
                pVar.A0 = typedArrayObtainStyledAttributes.getFloat(index, pVar.A0);
            } else if (index == s.ConstraintSet_android_translationX) {
                pVar.B0 = typedArrayObtainStyledAttributes.getFloat(index, pVar.B0);
            } else if (index == s.ConstraintSet_android_translationY) {
                pVar.C0 = typedArrayObtainStyledAttributes.getFloat(index, pVar.C0);
            } else if (index == s.ConstraintSet_android_translationZ) {
                pVar.D0 = typedArrayObtainStyledAttributes.getFloat(index, pVar.D0);
            }
        }
        typedArrayObtainStyledAttributes.recycle();
        return pVar;
    }

    public o getConstraintSet() {
        if (this.f1289a == null) {
            this.f1289a = new o();
        }
        o oVar = this.f1289a;
        oVar.getClass();
        int childCount = getChildCount();
        HashMap map = oVar.f1481g;
        map.clear();
        for (int i10 = 0; i10 < childCount; i10++) {
            View childAt = getChildAt(i10);
            p pVar = (p) childAt.getLayoutParams();
            int id2 = childAt.getId();
            if (oVar.f1480f && id2 == -1) {
                throw new RuntimeException("All children of ConstraintLayout must have ids to use ConstraintSet");
            }
            if (!map.containsKey(Integer.valueOf(id2))) {
                map.put(Integer.valueOf(id2), new j());
            }
            j jVar = (j) map.get(Integer.valueOf(id2));
            if (jVar != null) {
                if (childAt instanceof ConstraintHelper) {
                    ConstraintHelper constraintHelper = (ConstraintHelper) childAt;
                    jVar.d(id2, pVar);
                    if (constraintHelper instanceof Barrier) {
                        k kVar = jVar.f1391e;
                        kVar.f1413i0 = 1;
                        Barrier barrier = (Barrier) constraintHelper;
                        kVar.f1409g0 = barrier.getType();
                        kVar.f1415j0 = barrier.getReferencedIds();
                        kVar.f1411h0 = barrier.getMargin();
                    }
                }
                jVar.d(id2, pVar);
            }
        }
        return this.f1289a;
    }

    @Override // android.view.ViewGroup, android.view.View
    public final void onLayout(boolean z10, int i10, int i11, int i12, int i13) {
    }

    public Constraints(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        super.setVisibility(8);
    }

    public Constraints(Context context, AttributeSet attributeSet, int i10) {
        super(context, attributeSet, i10);
        super.setVisibility(8);
    }

    @Override // android.view.ViewGroup
    public final ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
        return new c(layoutParams);
    }
}
