package defpackage;

import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.ColorFilter;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.SparseArray;

/* renamed from: ˏـ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C1852 extends Drawable.ConstantState {

    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    public ColorFilter f7497;

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public int f7498;

    /* renamed from: ˌʾˀ, reason: contains not printable characters */
    public int f7499;

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public boolean f7500;

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public Drawable[] f7501;

    /* renamed from: ˎˑː, reason: contains not printable characters */
    public PorterDuff.Mode f7502;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public SparseArray f7503;

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public int f7504;

    /* renamed from: ˑᵥˁ, reason: contains not printable characters */
    public ColorStateList f7505;

    /* renamed from: ˑᵱ, reason: contains not printable characters */
    public boolean f7506;

    /* renamed from: ᐧﾞ, reason: contains not printable characters */
    public C1196 f7507;

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public boolean f7508;

    /* renamed from: ᵞʡ, reason: contains not printable characters */
    public int f7509;

    /* renamed from: ᵡʠ, reason: contains not printable characters */
    public int f7510;

    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public boolean f7511;

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public boolean f7512;

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public boolean f7513;

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public int f7514;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final C1799 f7515;

    /* renamed from: ᵧـˌᵎ, reason: contains not printable characters */
    public boolean f7516;

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public boolean f7517;

    /* renamed from: ᵨᵳʝ, reason: contains not printable characters */
    public boolean f7518;

    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public int f7519;

    /* renamed from: ᵮᵠـˌ, reason: contains not printable characters */
    public boolean f7520;

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public boolean f7521;

    /* renamed from: ᵳٴᵶ, reason: contains not printable characters */
    public int f7522;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public Resources f7523;

    /* renamed from: ᵶʔᵢˊ, reason: contains not printable characters */
    public C0525 f7524;

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public boolean f7525;

    /* renamed from: ᵸʓᵠ, reason: contains not printable characters */
    public boolean f7526;

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public Rect f7527;

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public int f7528;

    /* renamed from: ᵺʙ, reason: contains not printable characters */
    public int[][] f7529;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public int f7530;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public int f7531;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public int f7532;

    public C1852(C1852 c1852, C1799 c1799, Resources resources) {
        this.f7508 = false;
        this.f7500 = false;
        this.f7513 = true;
        this.f7531 = 0;
        this.f7514 = 0;
        this.f7515 = c1799;
        this.f7523 = resources != null ? resources : c1852 != null ? c1852.f7523 : null;
        int i = c1852 != null ? c1852.f7504 : 0;
        int i2 = C1799.f7236;
        i = resources != null ? resources.getDisplayMetrics().densityDpi : i;
        i = i == 0 ? 160 : i;
        this.f7504 = i;
        if (c1852 != null) {
            this.f7530 = c1852.f7530;
            this.f7498 = c1852.f7498;
            this.f7506 = true;
            this.f7517 = true;
            this.f7508 = c1852.f7508;
            this.f7500 = c1852.f7500;
            this.f7513 = c1852.f7513;
            this.f7532 = c1852.f7532;
            this.f7531 = c1852.f7531;
            this.f7514 = c1852.f7514;
            this.f7512 = c1852.f7512;
            this.f7497 = c1852.f7497;
            this.f7511 = c1852.f7511;
            this.f7505 = c1852.f7505;
            this.f7502 = c1852.f7502;
            this.f7520 = c1852.f7520;
            this.f7516 = c1852.f7516;
            if (c1852.f7504 == i) {
                if (c1852.f7525) {
                    this.f7527 = c1852.f7527 != null ? new Rect(c1852.f7527) : null;
                    this.f7525 = true;
                }
                if (c1852.f7521) {
                    this.f7519 = c1852.f7519;
                    this.f7522 = c1852.f7522;
                    this.f7499 = c1852.f7499;
                    this.f7510 = c1852.f7510;
                    this.f7521 = true;
                }
            }
            if (c1852.f7526) {
                this.f7509 = c1852.f7509;
                this.f7526 = true;
            }
            if (c1852.f7518) {
                this.f7518 = true;
            }
            Drawable[] drawableArr = c1852.f7501;
            this.f7501 = new Drawable[drawableArr.length];
            this.f7528 = c1852.f7528;
            SparseArray sparseArray = c1852.f7503;
            if (sparseArray != null) {
                this.f7503 = sparseArray.clone();
            } else {
                this.f7503 = new SparseArray(this.f7528);
            }
            int i3 = this.f7528;
            for (int i4 = 0; i4 < i3; i4++) {
                Drawable drawable = drawableArr[i4];
                if (drawable != null) {
                    Drawable.ConstantState constantState = drawable.getConstantState();
                    if (constantState != null) {
                        this.f7503.put(i4, constantState);
                    } else {
                        this.f7501[i4] = drawableArr[i4];
                    }
                }
            }
        } else {
            this.f7501 = new Drawable[10];
            this.f7528 = 0;
        }
        if (c1852 != null) {
            this.f7529 = c1852.f7529;
        } else {
            this.f7529 = new int[this.f7501.length][];
        }
        if (c1852 != null) {
            this.f7507 = c1852.f7507;
            this.f7524 = c1852.f7524;
        } else {
            this.f7507 = new C1196();
            this.f7524 = new C0525();
        }
    }

    @Override // android.graphics.drawable.Drawable.ConstantState
    public final boolean canApplyTheme() {
        int i = this.f7528;
        Drawable[] drawableArr = this.f7501;
        for (int i2 = 0; i2 < i; i2++) {
            Drawable drawable = drawableArr[i2];
            if (drawable == null) {
                Drawable.ConstantState constantState = (Drawable.ConstantState) this.f7503.get(i2);
                if (constantState != null && constantState.canApplyTheme()) {
                    return true;
                }
            } else if (drawable.canApplyTheme()) {
                return true;
            }
        }
        return false;
    }

    @Override // android.graphics.drawable.Drawable.ConstantState
    public final int getChangingConfigurations() {
        return this.f7498 | this.f7530;
    }

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

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

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r3v3, types: [java.lang.Object[]] */
    /* JADX WARN: Type inference failed for: r3v4 */
    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final int m5246(int i) {
        ?? r3;
        if (i < 0) {
            return 0;
        }
        C0525 c0525 = this.f7524;
        int i2 = 0;
        int i3 = ᵛᵾˏ.ᵻᵢﹳᵰ(c0525.f2741, c0525.f2742, i);
        if (i3 >= 0 && (r3 = c0525.f2740[i3]) != ᵲᵝᵪ.ᵴᵳ) {
            i2 = r3;
        }
        return i2.intValue();
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final void m5247() {
        SparseArray sparseArray = this.f7503;
        if (sparseArray != null) {
            int size = sparseArray.size();
            for (int i = 0; i < size; i++) {
                int iKeyAt = this.f7503.keyAt(i);
                Drawable.ConstantState constantState = (Drawable.ConstantState) this.f7503.valueAt(i);
                Drawable[] drawableArr = this.f7501;
                Drawable drawableNewDrawable = constantState.newDrawable(this.f7523);
                drawableNewDrawable.setLayoutDirection(this.f7532);
                Drawable drawableMutate = drawableNewDrawable.mutate();
                drawableMutate.setCallback(this.f7515);
                drawableArr[iKeyAt] = drawableMutate;
            }
            this.f7503 = null;
        }
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final int m5248(Drawable drawable) {
        int i = this.f7528;
        Drawable[] drawableArr = this.f7501;
        if (i >= drawableArr.length) {
            int i2 = i + 10;
            Drawable[] drawableArr2 = new Drawable[i2];
            System.arraycopy(drawableArr, 0, drawableArr2, 0, i);
            this.f7501 = drawableArr2;
            int[][] iArr = new int[i2][];
            System.arraycopy(this.f7529, 0, iArr, 0, i);
            this.f7529 = iArr;
        }
        drawable.mutate();
        drawable.setVisible(false, true);
        drawable.setCallback(this.f7515);
        this.f7501[i] = drawable;
        this.f7528++;
        this.f7498 = drawable.getChangingConfigurations() | this.f7498;
        this.f7526 = false;
        this.f7518 = false;
        this.f7527 = null;
        this.f7525 = false;
        this.f7521 = false;
        this.f7506 = false;
        return i;
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final void m5249() {
        this.f7521 = true;
        m5247();
        int i = this.f7528;
        Drawable[] drawableArr = this.f7501;
        this.f7522 = -1;
        this.f7519 = -1;
        this.f7510 = 0;
        this.f7499 = 0;
        for (int i2 = 0; i2 < i; i2++) {
            Drawable drawable = drawableArr[i2];
            int intrinsicWidth = drawable.getIntrinsicWidth();
            if (intrinsicWidth > this.f7519) {
                this.f7519 = intrinsicWidth;
            }
            int intrinsicHeight = drawable.getIntrinsicHeight();
            if (intrinsicHeight > this.f7522) {
                this.f7522 = intrinsicHeight;
            }
            int minimumWidth = drawable.getMinimumWidth();
            if (minimumWidth > this.f7499) {
                this.f7499 = minimumWidth;
            }
            int minimumHeight = drawable.getMinimumHeight();
            if (minimumHeight > this.f7510) {
                this.f7510 = minimumHeight;
            }
        }
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final Drawable m5250(int i) {
        int iIndexOfKey;
        Drawable drawable = this.f7501[i];
        if (drawable != null) {
            return drawable;
        }
        SparseArray sparseArray = this.f7503;
        if (sparseArray == null || (iIndexOfKey = sparseArray.indexOfKey(i)) < 0) {
            return null;
        }
        Drawable drawableNewDrawable = ((Drawable.ConstantState) this.f7503.valueAt(iIndexOfKey)).newDrawable(this.f7523);
        drawableNewDrawable.setLayoutDirection(this.f7532);
        Drawable drawableMutate = drawableNewDrawable.mutate();
        drawableMutate.setCallback(this.f7515);
        this.f7501[i] = drawableMutate;
        this.f7503.removeAt(iIndexOfKey);
        if (this.f7503.size() == 0) {
            this.f7503 = null;
        }
        return drawableMutate;
    }
}
