package X6FRs_4.KQgRr5e_0.EuDEkJe_12.KQgRr5e_0;

import X6FRs_4.KQgRr5e_0.EuDEkJe_12.KQgRr5e_0.QxJ9d_1;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.StateSet;
/* compiled from: StateListDrawable.java */
/* loaded from: classes.dex */
public class Mqv2r_3 extends QxJ9d_1 {
    public KQgRr5e_0 KQgRr5e_0;

    /* renamed from: Mqv2r_3  reason: collision with root package name */
    public boolean f3141Mqv2r_3;

    /* compiled from: StateListDrawable.java */
    /* loaded from: classes.dex */
    public static class KQgRr5e_0 extends QxJ9d_1.PGPF6hQ_2 {
        public int[][] KQgRr5e_0;

        public KQgRr5e_0(KQgRr5e_0 kQgRr5e_0, Mqv2r_3 mqv2r_3, Resources resources) {
            super(kQgRr5e_0, mqv2r_3, resources);
            if (kQgRr5e_0 != null) {
                this.KQgRr5e_0 = kQgRr5e_0.KQgRr5e_0;
            } else {
                this.KQgRr5e_0 = new int[KQgRr5e_0()];
            }
        }

        public int KQgRr5e_0(int[] iArr, Drawable drawable) {
            int KQgRr5e_0 = KQgRr5e_0(drawable);
            this.KQgRr5e_0[KQgRr5e_0] = iArr;
            return KQgRr5e_0;
        }

        @Override // X6FRs_4.KQgRr5e_0.EuDEkJe_12.KQgRr5e_0.QxJ9d_1.PGPF6hQ_2
        public void Mqv2r_3() {
            int[][] iArr = this.KQgRr5e_0;
            int[][] iArr2 = new int[iArr.length];
            for (int length = iArr.length - 1; length >= 0; length--) {
                int[][] iArr3 = this.KQgRr5e_0;
                iArr2[length] = iArr3[length] != null ? (int[]) iArr3[length].clone() : null;
            }
            this.KQgRr5e_0 = iArr2;
        }

        @Override // android.graphics.drawable.Drawable.ConstantState
        public Drawable newDrawable() {
            return new Mqv2r_3(this, null);
        }

        @Override // android.graphics.drawable.Drawable.ConstantState
        public Drawable newDrawable(Resources resources) {
            return new Mqv2r_3(this, resources);
        }

        public int KQgRr5e_0(int[] iArr) {
            int[][] iArr2 = this.KQgRr5e_0;
            int QxJ9d_1 = QxJ9d_1();
            for (int i = 0; i < QxJ9d_1; i++) {
                if (StateSet.stateSetMatches(iArr2[i], iArr)) {
                    return i;
                }
            }
            return -1;
        }

        @Override // X6FRs_4.KQgRr5e_0.EuDEkJe_12.KQgRr5e_0.QxJ9d_1.PGPF6hQ_2
        /* renamed from: KQgRr5e_0 */
        public void mo368KQgRr5e_0(int i, int i2) {
            super.mo368KQgRr5e_0(i, i2);
            int[][] iArr = new int[i2];
            System.arraycopy(this.KQgRr5e_0, 0, iArr, 0, i);
            this.KQgRr5e_0 = iArr;
        }
    }

    public Mqv2r_3(KQgRr5e_0 kQgRr5e_0, Resources resources) {
        KQgRr5e_0(new KQgRr5e_0(kQgRr5e_0, this, resources));
        onStateChange(getState());
    }

    @Override // X6FRs_4.KQgRr5e_0.EuDEkJe_12.KQgRr5e_0.QxJ9d_1, android.graphics.drawable.Drawable
    public void applyTheme(Resources.Theme theme) {
        super.applyTheme(theme);
        onStateChange(getState());
    }

    @Override // android.graphics.drawable.Drawable
    public boolean isStateful() {
        return true;
    }

    @Override // X6FRs_4.KQgRr5e_0.EuDEkJe_12.KQgRr5e_0.QxJ9d_1, android.graphics.drawable.Drawable
    public Drawable mutate() {
        if (!this.f3141Mqv2r_3) {
            super.mutate();
            if (this == this) {
                this.KQgRr5e_0.Mqv2r_3();
                this.f3141Mqv2r_3 = true;
            }
        }
        return this;
    }

    @Override // X6FRs_4.KQgRr5e_0.EuDEkJe_12.KQgRr5e_0.QxJ9d_1, android.graphics.drawable.Drawable
    public boolean onStateChange(int[] iArr) {
        boolean onStateChange = super.onStateChange(iArr);
        int KQgRr5e_02 = this.KQgRr5e_0.KQgRr5e_0(iArr);
        if (KQgRr5e_02 < 0) {
            KQgRr5e_02 = this.KQgRr5e_0.KQgRr5e_0(StateSet.WILD_CARD);
        }
        return KQgRr5e_0(KQgRr5e_02) || onStateChange;
    }

    public int[] KQgRr5e_0(AttributeSet attributeSet) {
        int attributeCount = attributeSet.getAttributeCount();
        int[] iArr = new int[attributeCount];
        int i = 0;
        for (int i2 = 0; i2 < attributeCount; i2++) {
            int attributeNameResource = attributeSet.getAttributeNameResource(i2);
            if (attributeNameResource != 0 && attributeNameResource != 16842960 && attributeNameResource != 16843161) {
                int i3 = i + 1;
                if (!attributeSet.getAttributeBooleanValue(i2, false)) {
                    attributeNameResource = -attributeNameResource;
                }
                iArr[i] = attributeNameResource;
                i = i3;
            }
        }
        return StateSet.trimStateSet(iArr, i);
    }

    public Mqv2r_3(KQgRr5e_0 kQgRr5e_0) {
        if (kQgRr5e_0 != null) {
            KQgRr5e_0(kQgRr5e_0);
        }
    }

    @Override // X6FRs_4.KQgRr5e_0.EuDEkJe_12.KQgRr5e_0.QxJ9d_1
    public KQgRr5e_0 KQgRr5e_0() {
        return new KQgRr5e_0(this.KQgRr5e_0, this, null);
    }

    @Override // X6FRs_4.KQgRr5e_0.EuDEkJe_12.KQgRr5e_0.QxJ9d_1
    public void KQgRr5e_0(QxJ9d_1.PGPF6hQ_2 pGPF6hQ_2) {
        super.KQgRr5e_0(pGPF6hQ_2);
        if (pGPF6hQ_2 instanceof KQgRr5e_0) {
            this.KQgRr5e_0 = (KQgRr5e_0) pGPF6hQ_2;
        }
    }
}
