package com.bytedance.ies.sdk.widgets;

import X.05h;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewPropertyAnimator;
import com.bytedance.covode.number.Covode;

public class ConstraintProperty {
    public float mAlpha;
    public LayeredConstraintLayout$LayoutParams mParams;
    public PropertyResolver mPropertyResolver;
    public float mRotation;
    public float mScaleX;
    public float mScaleY;
    public float mTranslationX;
    public float mTranslationY;
    public View mView;
    public int mVisibility;

    static {
        Covode.recordClassIndex(30470);
    }

    private String sideToString(int i) {
        switch (i) {
            case 1:
                return "left";
            case 2:
                return "right";
            case 3:
                return "top";
            case 4:
                return "bottom";
            case 5:
                return "baseline";
            case 6:
                return "start";
            case 7:
                return "end";
            default:
                return "undefined";
        }
    }

    public float alpha() {
        return this.mAlpha;
    }

    public View getView() {
        return this.mView;
    }

    public float translationX() {
        return this.mTranslationX;
    }

    public float translationY() {
        return this.mTranslationY;
    }

    public int visibility() {
        return this.mVisibility;
    }

    public ViewPropertyAnimator animate() {
        return this.mView.animate();
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [android.view.ViewGroup$LayoutParams, com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams] */
    public void apply() {
        this.mView.setLayoutParams(this.mParams);
    }

    public int id() {
        return this.mView.getId();
    }

    public int layer() {
        return this.mParams.getLayer();
    }

    public int order() {
        return this.mParams.getOrder();
    }

    /* JADX WARNING: Code restructure failed: missing block: B:10:0x0045, code lost:
        if (r7 != -1) goto L_0x0047;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:12:0x004b, code lost:
        if (r9.mParams.bottomToBottom == -1) goto L_0x0055;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:13:0x004d, code lost:
        r5.connect(4, r9.mParams.bottomToBottom, 4, 0);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:15:0x0059, code lost:
        if (r9.mParams.topToTop == -1) goto L_0x003c;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:16:0x005b, code lost:
        r2.connect(3, r9.mParams.topToTop, 3, 0);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:9:0x0043, code lost:
        if (r8 == -1) goto L_0x0045;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public com.bytedance.ies.sdk.widgets.ConstraintProperty removeFromVerticalChain() {
        /*
            r9 = this;
            com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams r0 = r9.mParams
            int r8 = r0.topToBottom
            com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams r0 = r9.mParams
            int r7 = r0.bottomToTop
            r4 = 4
            r3 = 3
            r6 = -1
            if (r8 != r6) goto L_0x000f
            if (r7 == r6) goto L_0x003c
        L_0x000f:
            android.view.View r0 = r9.mView
            android.view.ViewParent r0 = r0.getParent()
            android.view.ViewGroup r0 = (android.view.ViewGroup) r0
            android.view.View r0 = r0.findViewById(r8)
            com.bytedance.ies.sdk.widgets.ConstraintProperty r5 = new com.bytedance.ies.sdk.widgets.ConstraintProperty
            r5.<init>(r0)
            android.view.View r0 = r9.mView
            android.view.ViewParent r0 = r0.getParent()
            android.view.ViewGroup r0 = (android.view.ViewGroup) r0
            android.view.View r0 = r0.findViewById(r7)
            com.bytedance.ies.sdk.widgets.ConstraintProperty r2 = new com.bytedance.ies.sdk.widgets.ConstraintProperty
            r2.<init>(r0)
            r1 = 0
            if (r8 == r6) goto L_0x0045
            if (r7 == r6) goto L_0x0043
            r5.connect(r4, r7, r3, r1)
            r2.connect(r3, r8, r4, r1)
        L_0x003c:
            r9.removeConstraints(r3)
            r9.removeConstraints(r4)
            return r9
        L_0x0043:
            if (r8 != r6) goto L_0x0047
        L_0x0045:
            if (r7 == r6) goto L_0x003c
        L_0x0047:
            com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams r0 = r9.mParams
            int r0 = r0.bottomToBottom
            if (r0 == r6) goto L_0x0055
            com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams r0 = r9.mParams
            int r0 = r0.bottomToBottom
            r5.connect(r4, r0, r4, r1)
            goto L_0x003c
        L_0x0055:
            com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams r0 = r9.mParams
            int r0 = r0.topToTop
            if (r0 == r6) goto L_0x003c
            com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams r0 = r9.mParams
            int r0 = r0.topToTop
            r2.connect(r3, r0, r3, r1)
            goto L_0x003c
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.ies.sdk.widgets.ConstraintProperty.removeFromVerticalChain():com.bytedance.ies.sdk.widgets.ConstraintProperty");
    }

    /* JADX WARNING: Code restructure failed: missing block: B:10:0x0045, code lost:
        if (r7 != -1) goto L_0x0047;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:12:0x004b, code lost:
        if (r10.mParams.rightToRight == -1) goto L_0x0055;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:13:0x004d, code lost:
        r5.connect(2, r10.mParams.rightToRight, 2, 0);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:15:0x0059, code lost:
        if (r10.mParams.leftToLeft == -1) goto L_0x003c;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:16:0x005b, code lost:
        r3.connect(1, r10.mParams.leftToLeft, 1, 0);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:9:0x0043, code lost:
        if (r9 == -1) goto L_0x0045;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public com.bytedance.ies.sdk.widgets.ConstraintProperty removeFromHorizontalChain() {
        /*
            r10 = this;
            com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams r0 = r10.mParams
            int r9 = r0.leftToRight
            com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams r0 = r10.mParams
            int r7 = r0.rightToLeft
            r4 = 0
            r6 = -1
            if (r9 != r6) goto L_0x000e
            if (r7 == r6) goto L_0x0063
        L_0x000e:
            android.view.View r0 = r10.mView
            android.view.ViewParent r0 = r0.getParent()
            android.view.ViewGroup r0 = (android.view.ViewGroup) r0
            android.view.View r0 = r0.findViewById(r9)
            com.bytedance.ies.sdk.widgets.ConstraintProperty r5 = new com.bytedance.ies.sdk.widgets.ConstraintProperty
            r5.<init>(r0)
            android.view.View r0 = r10.mView
            android.view.ViewParent r0 = r0.getParent()
            android.view.ViewGroup r0 = (android.view.ViewGroup) r0
            android.view.View r0 = r0.findViewById(r7)
            com.bytedance.ies.sdk.widgets.ConstraintProperty r3 = new com.bytedance.ies.sdk.widgets.ConstraintProperty
            r3.<init>(r0)
            r2 = 1
            r1 = 2
            if (r9 == r6) goto L_0x0045
            if (r7 == r6) goto L_0x0043
            r5.connect(r1, r7, r2, r4)
            r3.connect(r2, r9, r1, r4)
        L_0x003c:
            r10.removeConstraints(r2)
            r10.removeConstraints(r1)
        L_0x0042:
            return r10
        L_0x0043:
            if (r9 != r6) goto L_0x0047
        L_0x0045:
            if (r7 == r6) goto L_0x003c
        L_0x0047:
            com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams r0 = r10.mParams
            int r0 = r0.rightToRight
            if (r0 == r6) goto L_0x0055
            com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams r0 = r10.mParams
            int r0 = r0.rightToRight
            r5.connect(r1, r0, r1, r4)
            goto L_0x003c
        L_0x0055:
            com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams r0 = r10.mParams
            int r0 = r0.leftToLeft
            if (r0 == r6) goto L_0x003c
            com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams r0 = r10.mParams
            int r0 = r0.leftToLeft
            r3.connect(r2, r0, r2, r4)
            goto L_0x003c
        L_0x0063:
            com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams r0 = r10.mParams
            int r8 = r0.startToEnd
            com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams r0 = r10.mParams
            int r7 = r0.endToStart
            r3 = 7
            r2 = 6
            if (r8 != r6) goto L_0x0071
            if (r7 == r6) goto L_0x009d
        L_0x0071:
            android.view.View r0 = r10.mView
            android.view.ViewParent r0 = r0.getParent()
            android.view.ViewGroup r0 = (android.view.ViewGroup) r0
            android.view.View r0 = r0.findViewById(r8)
            com.bytedance.ies.sdk.widgets.ConstraintProperty r5 = new com.bytedance.ies.sdk.widgets.ConstraintProperty
            r5.<init>(r0)
            android.view.View r0 = r10.mView
            android.view.ViewParent r0 = r0.getParent()
            android.view.ViewGroup r0 = (android.view.ViewGroup) r0
            android.view.View r0 = r0.findViewById(r7)
            com.bytedance.ies.sdk.widgets.ConstraintProperty r1 = new com.bytedance.ies.sdk.widgets.ConstraintProperty
            r1.<init>(r0)
            if (r8 == r6) goto L_0x00a4
            if (r7 == r6) goto L_0x009d
            r5.connect(r3, r7, r2, r4)
            r1.connect(r2, r9, r3, r4)
        L_0x009d:
            r10.removeConstraints(r2)
            r10.removeConstraints(r3)
            goto L_0x0042
        L_0x00a4:
            if (r7 == r6) goto L_0x009d
            com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams r0 = r10.mParams
            int r0 = r0.rightToRight
            if (r0 == r6) goto L_0x00b4
            com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams r0 = r10.mParams
            int r0 = r0.rightToRight
            r5.connect(r3, r0, r3, r4)
            goto L_0x009d
        L_0x00b4:
            com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams r0 = r10.mParams
            int r0 = r0.leftToLeft
            if (r0 == r6) goto L_0x009d
            com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams r0 = r10.mParams
            int r0 = r0.leftToLeft
            r1.connect(r2, r0, r2, r4)
            goto L_0x009d
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.ies.sdk.widgets.ConstraintProperty.removeFromHorizontalChain():com.bytedance.ies.sdk.widgets.ConstraintProperty");
    }

    public ConstraintProperty constrainDefaultHeight(int i) {
        this.mParams.matchConstraintDefaultHeight = i;
        return this;
    }

    public ConstraintProperty constrainDefaultWidth(int i) {
        this.mParams.matchConstraintDefaultWidth = i;
        return this;
    }

    public ConstraintProperty constrainHeight(int i) {
        this.mParams.height = i;
        return this;
    }

    public ConstraintProperty constrainMaxHeight(int i) {
        this.mParams.matchConstraintMaxHeight = i;
        return this;
    }

    public ConstraintProperty constrainMaxWidth(int i) {
        this.mParams.matchConstraintMaxWidth = i;
        return this;
    }

    public ConstraintProperty constrainMinHeight(int i) {
        this.mParams.matchConstraintMinHeight = i;
        return this;
    }

    public ConstraintProperty constrainMinWidth(int i) {
        this.mParams.matchConstraintMinWidth = i;
        return this;
    }

    public ConstraintProperty constrainWidth(int i) {
        this.mParams.width = i;
        return this;
    }

    public ConstraintProperty dimensionRatio(String str) {
        this.mParams.dimensionRatio = str;
        return this;
    }

    public ConstraintProperty elevation(float f) {
        this.mView.setElevation(f);
        return this;
    }

    public ConstraintProperty horizontalBias(float f) {
        this.mParams.horizontalBias = f;
        return this;
    }

    public ConstraintProperty horizontalChainStyle(int i) {
        this.mParams.horizontalChainStyle = i;
        return this;
    }

    public ConstraintProperty horizontalWeight(float f) {
        this.mParams.horizontalWeight = f;
        return this;
    }

    public ConstraintProperty rotation(float f) {
        this.mRotation = f;
        this.mView.setRotation(f);
        return this;
    }

    public ConstraintProperty rotationX(float f) {
        this.mView.setRotationX(f);
        return this;
    }

    public ConstraintProperty rotationY(float f) {
        this.mView.setRotationY(f);
        return this;
    }

    public ConstraintProperty scaleX(float f) {
        this.mScaleX = f;
        this.mView.setScaleX(f);
        return this;
    }

    public ConstraintProperty scaleY(float f) {
        this.mScaleY = f;
        this.mView.setScaleY(f);
        return this;
    }

    public ConstraintProperty transformPivotX(float f) {
        this.mView.setPivotX(f);
        return this;
    }

    public ConstraintProperty transformPivotY(float f) {
        this.mView.setPivotY(f);
        return this;
    }

    public ConstraintProperty translationZ(float f) {
        this.mView.setTranslationZ(f);
        return this;
    }

    public ConstraintProperty verticalBias(float f) {
        this.mParams.verticalBias = f;
        return this;
    }

    public ConstraintProperty verticalChainStyle(int i) {
        this.mParams.verticalChainStyle = i;
        return this;
    }

    public ConstraintProperty verticalWeight(float f) {
        this.mParams.verticalWeight = f;
        return this;
    }

    public ConstraintProperty addToHorizontalChainHeadRtl(int i) {
        int i2;
        if (i == 0) {
            i2 = 6;
        } else {
            i2 = 7;
        }
        connect(6, i, i2, 0);
        return this;
    }

    public ConstraintProperty addToHorizontalChainTailRtl(int i) {
        int i2;
        if (i == 0) {
            i2 = 7;
        } else {
            i2 = 6;
        }
        connect(7, i, i2, 0);
        return this;
    }

    public ConstraintProperty layer(int i) {
        this.mParams.setLayer(i);
        return this;
    }

    public ConstraintProperty order(int i) {
        this.mParams.setOrder(i);
        return this;
    }

    public ConstraintProperty alpha(float f) {
        this.mAlpha = f;
        View view = this.mView;
        PropertyResolver propertyResolver = this.mPropertyResolver;
        if (propertyResolver != null) {
            f = propertyResolver.getResolvedAlpha(view.getId());
        }
        view.setAlpha(f);
        return this;
    }

    public ConstraintProperty centerHorizontally(int i) {
        int i2 = i;
        if (i2 == 0) {
            center(0, 1, 0, 0, 2, 0, 0.5f);
        } else {
            center(i2, 2, 0, i2, 1, 0, 0.5f);
        }
        return this;
    }

    public ConstraintProperty centerHorizontallyRtl(int i) {
        int i2 = i;
        if (i2 == 0) {
            center(0, 6, 0, 0, 7, 0, 0.5f);
        } else {
            center(i2, 7, 0, i2, 6, 0, 0.5f);
        }
        return this;
    }

    public ConstraintProperty centerVertically(int i) {
        int i2 = i;
        if (i2 == 0) {
            center(0, 3, 0, 0, 4, 0, 0.5f);
        } else {
            center(i2, 4, 0, i2, 3, 0, 0.5f);
        }
        return this;
    }

    public ConstraintProperty translationX(float f) {
        this.mTranslationX = f;
        View view = this.mView;
        PropertyResolver propertyResolver = this.mPropertyResolver;
        if (propertyResolver != null) {
            f = propertyResolver.getResolvedTranslationX(view.getId());
        }
        view.setTranslationX(f);
        return this;
    }

    public ConstraintProperty translationY(float f) {
        this.mTranslationY = f;
        View view = this.mView;
        PropertyResolver propertyResolver = this.mPropertyResolver;
        if (propertyResolver != null) {
            f = propertyResolver.getResolvedTranslationY(view.getId());
        }
        view.setTranslationY(f);
        return this;
    }

    public ConstraintProperty visibility(int i) {
        boolean z;
        this.mVisibility = i;
        PropertyResolver propertyResolver = this.mPropertyResolver;
        if (propertyResolver != null) {
            i = propertyResolver.getResolvedVisibility(this.mView.getId());
        }
        this.mView.setVisibility(i);
        if (i != this.mVisibility) {
            PropertyResolver propertyResolver2 = this.mPropertyResolver;
            int id = id();
            if (i == 8) {
                z = true;
            } else {
                z = false;
            }
            propertyResolver2.onHiddenChanged(id, z);
        }
        return this;
    }

    public ConstraintProperty(View view) {
        ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
        if (layoutParams instanceof 05h) {
            this.mParams = (LayeredConstraintLayout$LayoutParams) layoutParams;
            this.mView = view;
            this.mAlpha = view.getAlpha();
            this.mScaleX = this.mView.getScaleX();
            this.mScaleY = this.mView.getScaleY();
            this.mRotation = this.mView.getRotation();
            this.mTranslationX = this.mView.getTranslationX();
            this.mTranslationY = this.mView.getTranslationY();
            this.mVisibility = this.mView.getVisibility();
            return;
        }
        throw new RuntimeException("Only children of ConstraintLayout.LayoutParams supported");
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [android.view.ViewGroup$MarginLayoutParams, com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams] */
    /* JADX WARNING: type inference failed for: r0v2, types: [android.view.ViewGroup$MarginLayoutParams, com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams] */
    public int margin(int i) {
        switch (i) {
            case 1:
                return this.mParams.leftMargin;
            case 2:
                return this.mParams.rightMargin;
            case 3:
                return this.mParams.topMargin;
            case 4:
                return this.mParams.bottomMargin;
            case 5:
                throw new IllegalArgumentException("baseline does not support margins");
            case 6:
                return this.mParams.getMarginStart();
            case 7:
                return this.mParams.getMarginEnd();
            default:
                throw new IllegalArgumentException("unknown constraint");
        }
    }

    /* JADX WARNING: type inference failed for: r0v2, types: [android.view.ViewGroup$MarginLayoutParams, com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams] */
    /* JADX WARNING: type inference failed for: r0v6, types: [android.view.ViewGroup$MarginLayoutParams, com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams] */
    public ConstraintProperty removeConstraints(int i) {
        switch (i) {
            case 1:
                this.mParams.leftToRight = -1;
                this.mParams.leftToLeft = -1;
                this.mParams.leftMargin = -1;
                this.mParams.goneLeftMargin = -1;
                break;
            case 2:
                this.mParams.rightToRight = -1;
                this.mParams.rightToLeft = -1;
                this.mParams.rightMargin = -1;
                this.mParams.goneRightMargin = -1;
                break;
            case 3:
                this.mParams.topToBottom = -1;
                this.mParams.topToTop = -1;
                this.mParams.topMargin = -1;
                this.mParams.goneTopMargin = -1;
                break;
            case 4:
                this.mParams.bottomToTop = -1;
                this.mParams.bottomToBottom = -1;
                this.mParams.bottomMargin = -1;
                this.mParams.goneBottomMargin = -1;
                break;
            case 5:
                this.mParams.baselineToBaseline = -1;
                break;
            case 6:
                this.mParams.startToEnd = -1;
                this.mParams.startToStart = -1;
                this.mParams.setMarginStart(-1);
                this.mParams.goneStartMargin = -1;
                break;
            case 7:
                this.mParams.endToStart = -1;
                this.mParams.endToEnd = -1;
                this.mParams.setMarginEnd(-1);
                this.mParams.goneEndMargin = -1;
                break;
            default:
                throw new IllegalArgumentException("unknown constraint");
        }
        return this;
    }

    public ConstraintProperty translation(float f, float f2) {
        translationX(f);
        translationY(f2);
        return this;
    }

    public ConstraintProperty transformPivot(float f, float f2) {
        this.mView.setPivotX(f);
        this.mView.setPivotY(f2);
        return this;
    }

    public ConstraintProperty(View view, ConstraintProperty constraintProperty) {
        ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
        if (layoutParams instanceof 05h) {
            this.mParams = (LayeredConstraintLayout$LayoutParams) layoutParams;
            this.mView = view;
            this.mAlpha = constraintProperty.mAlpha;
            this.mScaleX = constraintProperty.mScaleX;
            this.mScaleY = constraintProperty.mScaleY;
            this.mRotation = constraintProperty.mRotation;
            this.mTranslationX = constraintProperty.mTranslationX;
            this.mTranslationY = constraintProperty.mTranslationY;
            this.mVisibility = constraintProperty.mVisibility;
            return;
        }
        throw new RuntimeException("Only children of ConstraintLayout.LayoutParams supported");
    }

    public ConstraintProperty addToHorizontalChain(int i, int i2) {
        int i3;
        int i4;
        if (i == 0) {
            i3 = 1;
        } else {
            i3 = 2;
        }
        connect(1, i, i3, 0);
        if (i2 == 0) {
            i4 = 2;
        } else {
            i4 = 1;
        }
        connect(2, i2, i4, 0);
        if (i != 0) {
            new ConstraintProperty(((ViewGroup) this.mView.getParent()).findViewById(i)).connect(2, this.mView.getId(), 1, 0);
        }
        if (i2 != 0) {
            new ConstraintProperty(((ViewGroup) this.mView.getParent()).findViewById(i2)).connect(1, this.mView.getId(), 2, 0);
        }
        return this;
    }

    public ConstraintProperty addToHorizontalChainRtl(int i, int i2) {
        int i3;
        int i4;
        if (i == 0) {
            i3 = 6;
        } else {
            i3 = 7;
        }
        connect(6, i, i3, 0);
        if (i2 == 0) {
            i4 = 7;
        } else {
            i4 = 6;
        }
        connect(7, i2, i4, 0);
        if (i != 0) {
            new ConstraintProperty(((ViewGroup) this.mView.getParent()).findViewById(i)).connect(7, this.mView.getId(), 6, 0);
        }
        if (i2 != 0) {
            new ConstraintProperty(((ViewGroup) this.mView.getParent()).findViewById(i2)).connect(6, this.mView.getId(), 7, 0);
        }
        return this;
    }

    public ConstraintProperty addToVerticalChain(int i, int i2) {
        int i3;
        int i4;
        if (i == 0) {
            i3 = 3;
        } else {
            i3 = 4;
        }
        connect(3, i, i3, 0);
        if (i2 == 0) {
            i4 = 4;
        } else {
            i4 = 3;
        }
        connect(4, i2, i4, 0);
        if (i != 0) {
            new ConstraintProperty(((ViewGroup) this.mView.getParent()).findViewById(i)).connect(4, this.mView.getId(), 3, 0);
        }
        if (i2 != 0) {
            new ConstraintProperty(((ViewGroup) this.mView.getParent()).findViewById(i2)).connect(3, this.mView.getId(), 4, 0);
        }
        return this;
    }

    public ConstraintProperty goneMargin(int i, int i2) {
        switch (i) {
            case 1:
                this.mParams.goneLeftMargin = i2;
                break;
            case 2:
                this.mParams.goneRightMargin = i2;
                break;
            case 3:
                this.mParams.goneTopMargin = i2;
                break;
            case 4:
                this.mParams.goneBottomMargin = i2;
                break;
            case 5:
                throw new IllegalArgumentException("baseline does not support margins");
            case 6:
                this.mParams.goneStartMargin = i2;
                break;
            case 7:
                this.mParams.goneEndMargin = i2;
                break;
            default:
                throw new IllegalArgumentException("unknown constraint");
        }
        return this;
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [android.view.ViewGroup$MarginLayoutParams, com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams] */
    /* JADX WARNING: type inference failed for: r0v1, types: [android.view.ViewGroup$MarginLayoutParams, com.bytedance.ies.sdk.widgets.LayeredConstraintLayout$LayoutParams] */
    public ConstraintProperty margin(int i, int i2) {
        switch (i) {
            case 1:
                this.mParams.leftMargin = i2;
                break;
            case 2:
                this.mParams.rightMargin = i2;
                break;
            case 3:
                this.mParams.topMargin = i2;
                break;
            case 4:
                this.mParams.bottomMargin = i2;
                break;
            case 5:
                throw new IllegalArgumentException("baseline does not support margins");
            case 6:
                this.mParams.setMarginStart(i2);
                break;
            case 7:
                this.mParams.setMarginEnd(i2);
                break;
            default:
                throw new IllegalArgumentException("unknown constraint");
        }
        return this;
    }

    public ConstraintProperty connect(int i, int i2, int i3, int i4) {
        switch (i) {
            case 1:
                if (i3 == 1) {
                    this.mParams.leftToLeft = i2;
                    this.mParams.leftToRight = -1;
                } else if (i3 == 2) {
                    this.mParams.leftToRight = i2;
                    this.mParams.leftToLeft = -1;
                } else {
                    throw new IllegalArgumentException("Left to " + sideToString(i3) + " undefined");
                }
                this.mParams.leftMargin = i4;
                break;
            case 2:
                if (i3 == 1) {
                    this.mParams.rightToLeft = i2;
                    this.mParams.rightToRight = -1;
                } else if (i3 == 2) {
                    this.mParams.rightToRight = i2;
                    this.mParams.rightToLeft = -1;
                } else {
                    throw new IllegalArgumentException("right to " + sideToString(i3) + " undefined");
                }
                this.mParams.rightMargin = i4;
                break;
            case 3:
                if (i3 == 3) {
                    this.mParams.topToTop = i2;
                    this.mParams.topToBottom = -1;
                    this.mParams.baselineToBaseline = -1;
                } else if (i3 == 4) {
                    this.mParams.topToBottom = i2;
                    this.mParams.topToTop = -1;
                    this.mParams.baselineToBaseline = -1;
                } else {
                    throw new IllegalArgumentException("right to " + sideToString(i3) + " undefined");
                }
                this.mParams.topMargin = i4;
                break;
            case 4:
                if (i3 == 4) {
                    this.mParams.bottomToBottom = i2;
                    this.mParams.bottomToTop = -1;
                    this.mParams.baselineToBaseline = -1;
                } else if (i3 == 3) {
                    this.mParams.bottomToTop = i2;
                    this.mParams.bottomToBottom = -1;
                    this.mParams.baselineToBaseline = -1;
                } else {
                    throw new IllegalArgumentException("right to " + sideToString(i3) + " undefined");
                }
                this.mParams.bottomMargin = i4;
                break;
            case 5:
                if (i3 != 5) {
                    if (i3 != 3) {
                        if (i3 == 4) {
                            this.mParams.bottomToBottom = -1;
                            this.mParams.bottomToTop = -1;
                            this.mParams.topToTop = -1;
                            this.mParams.topToBottom = -1;
                            break;
                        }
                    } else {
                        this.mParams.bottomToBottom = -1;
                        this.mParams.bottomToTop = -1;
                        this.mParams.topToTop = -1;
                        this.mParams.topToBottom = -1;
                        break;
                    }
                } else {
                    this.mParams.baselineToBaseline = i2;
                    this.mParams.bottomToBottom = -1;
                    this.mParams.bottomToTop = -1;
                    this.mParams.topToTop = -1;
                    this.mParams.topToBottom = -1;
                }
                throw new IllegalArgumentException("right to " + sideToString(i3) + " undefined");
            case 6:
                if (i3 == 6) {
                    this.mParams.startToStart = i2;
                    this.mParams.startToEnd = -1;
                } else if (i3 == 7) {
                    this.mParams.startToEnd = i2;
                    this.mParams.startToStart = -1;
                } else {
                    throw new IllegalArgumentException("right to " + sideToString(i3) + " undefined");
                }
                this.mParams.setMarginStart(i4);
                break;
            case 7:
                if (i3 == 7) {
                    this.mParams.endToEnd = i2;
                    this.mParams.endToStart = -1;
                } else if (i3 == 6) {
                    this.mParams.endToStart = i2;
                    this.mParams.endToEnd = -1;
                } else {
                    throw new IllegalArgumentException("right to " + sideToString(i3) + " undefined");
                }
                this.mParams.setMarginEnd(i4);
                break;
            default:
                throw new IllegalArgumentException(sideToString(i) + " to " + sideToString(i3) + " unknown");
        }
        return this;
    }

    public ConstraintProperty centerHorizontally(int i, int i2, int i3, int i4, int i5, int i6, float f) {
        connect(1, i, i2, i3);
        connect(2, i4, i5, i6);
        this.mParams.horizontalBias = f;
        return this;
    }

    public ConstraintProperty centerHorizontallyRtl(int i, int i2, int i3, int i4, int i5, int i6, float f) {
        connect(6, i, i2, i3);
        connect(7, i4, i5, i6);
        this.mParams.horizontalBias = f;
        return this;
    }

    public ConstraintProperty centerVertically(int i, int i2, int i3, int i4, int i5, int i6, float f) {
        connect(3, i, i2, i3);
        connect(4, i4, i5, i6);
        this.mParams.verticalBias = f;
        return this;
    }

    public ConstraintProperty center(int i, int i2, int i3, int i4, int i5, int i6, float f) {
        if (i3 < 0) {
            throw new IllegalArgumentException("margin must be > 0");
        } else if (i6 < 0) {
            throw new IllegalArgumentException("margin must be > 0");
        } else if (f <= 0.0f || f > 1.0f) {
            throw new IllegalArgumentException("bias must be between 0 and 1 inclusive");
        } else {
            if (i2 == 1 || i2 == 2) {
                connect(1, i, i2, i3);
                connect(2, i4, i5, i6);
                this.mParams.horizontalBias = f;
            } else if (i2 == 6 || i2 == 7) {
                connect(6, i, i2, i3);
                connect(7, i4, i5, i6);
                this.mParams.horizontalBias = f;
            } else {
                connect(3, i, i2, i3);
                connect(4, i4, i5, i6);
                this.mParams.verticalBias = f;
            }
            return this;
        }
    }
}
