package defpackage;

import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Region;
import android.graphics.drawable.Drawable;
import android.os.Build;
import j$.util.Objects;
import java.util.BitSet;

/* renamed from: ᵗːːᵝ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C2445 extends Drawable implements InterfaceC0546 {

    /* renamed from: ˀˁᵨ, reason: contains not printable characters */
    public static final C4990[] f9529;

    /* renamed from: ᵽʛ, reason: contains not printable characters */
    public static final Paint f9530;

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

    /* renamed from: ˀᵗᵩ, reason: contains not printable characters */
    public final RectF f9532;

    /* renamed from: ˁˑᵰ, reason: contains not printable characters */
    public final Paint f9533;

    /* renamed from: ˆᵼᵷˊ, reason: contains not printable characters */
    public final boolean f9534;

    /* renamed from: ˊʽˎ, reason: contains not printable characters */
    public float[] f9535;

    /* renamed from: ˊᵸˊ, reason: contains not printable characters */
    public PorterDuffColorFilter f9536;

    /* renamed from: ˌᵪ, reason: contains not printable characters */
    public C4879 f9537;

    /* renamed from: ˎˑː, reason: contains not printable characters */
    public final Path f9538;

    /* renamed from: ˎᵬˀ, reason: contains not printable characters */
    public float[] f9539;

    /* renamed from: ˑᵝﹳᵜ, reason: contains not printable characters */
    public PorterDuffColorFilter f9540;

    /* renamed from: ˑᵥˁ, reason: contains not printable characters */
    public final Path f9541;

    /* renamed from: ᐧﾞ, reason: contains not printable characters */
    public final Region f9542;

    /* renamed from: ᵙᵢᵨᵳ, reason: contains not printable characters */
    public final ˊʘ f9543;

    /* renamed from: ᵛˈᵤ, reason: contains not printable characters */
    public boolean f9544;

    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public final Matrix f9545;

    /* renamed from: ᵡᵘˎʽ, reason: contains not printable characters */
    public final C0360 f9546;

    /* renamed from: ᵡᵶᵡ, reason: contains not printable characters */
    public final C4671[] f9547;

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

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

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public final BitSet f9550;

    /* renamed from: ᵧـˌᵎ, reason: contains not printable characters */
    public final RectF f9551;

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public final ᵿʤˑᵦ f9552;

    /* renamed from: ᵫᵮʾ, reason: contains not printable characters */
    public ᵶﾞᴵ f9553;

    /* renamed from: ᵮᵠـˌ, reason: contains not printable characters */
    public final RectF f9554;

    /* renamed from: ᵳᵹᵺˋ, reason: contains not printable characters */
    public C1107 f9555;

    /* renamed from: ᵶʔᵢˊ, reason: contains not printable characters */
    public final Paint f9556;

    /* renamed from: ᵺʙ, reason: contains not printable characters */
    public final Region f9557;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public final AbstractC5566[] f9558;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public final AbstractC5566[] f9559;

    /* renamed from: ﾞⁱ, reason: contains not printable characters */
    public final C2321 f9560;

    static {
        Paint paint = new Paint(1);
        f9530 = paint;
        paint.setColor(-1);
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
        f9529 = new C4990[4];
        int i = 0;
        while (true) {
            C4990[] c4990Arr = f9529;
            if (i >= c4990Arr.length) {
                return;
            }
            c4990Arr[i] = new C4990(i);
            i++;
        }
    }

    public C2445(InterfaceC2895 interfaceC2895) {
        this(new C5355(interfaceC2895));
    }

    public C2445(C4879 c4879) {
        this(new C5355(c4879));
    }

    public C2445(C5355 c5355) {
        this.f9552 = new ᵿʤˑᵦ(6, this);
        this.f9559 = new AbstractC5566[4];
        this.f9558 = new AbstractC5566[4];
        this.f9550 = new BitSet(8);
        this.f9545 = new Matrix();
        this.f9541 = new Path();
        this.f9538 = new Path();
        this.f9554 = new RectF();
        this.f9551 = new RectF();
        this.f9557 = new Region();
        this.f9542 = new Region();
        Paint paint = new Paint(1);
        this.f9556 = paint;
        Paint paint2 = new Paint(1);
        this.f9533 = paint2;
        this.f9560 = new C2321();
        this.f9546 = C0360.m1788();
        this.f9532 = new RectF();
        this.f9534 = true;
        this.f9544 = true;
        this.f9547 = new C4671[4];
        this.f9549 = c5355;
        paint2.setStyle(Paint.Style.STROKE);
        paint.setStyle(Paint.Style.FILL);
        m6250();
        m6244(getState());
        this.f9543 = new ˊʘ(3, this);
    }

    /* JADX WARN: Removed duplicated region for block: B:32:0x0129  */
    /* JADX WARN: Removed duplicated region for block: B:33:0x0132  */
    @Override // android.graphics.drawable.Drawable
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void draw(android.graphics.Canvas r26) {
        /*
            Method dump skipped, instructions count: 537
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C2445.draw(android.graphics.Canvas):void");
    }

    @Override // android.graphics.drawable.Drawable
    public final int getAlpha() {
        return this.f9549.f20068;
    }

    @Override // android.graphics.drawable.Drawable
    public final Drawable.ConstantState getConstantState() {
        return this.f9549;
    }

    @Override // android.graphics.drawable.Drawable
    public final int getOpacity() {
        return -3;
    }

    @Override // android.graphics.drawable.Drawable
    public final void getOutline(Outline outline) {
        this.f9549.getClass();
        RectF rectFM6243 = m6243();
        if (rectFM6243.isEmpty()) {
            return;
        }
        float fM6253 = m6253(rectFM6243, this.f9549.f20062.mo7064(), this.f9535);
        if (fM6253 >= 0.0f) {
            outline.setRoundRect(getBounds(), fM6253 * this.f9549.f20061);
            return;
        }
        boolean z = this.f9548;
        Path path = this.f9541;
        if (z) {
            m6249(rectFM6243, path);
            this.f9548 = false;
        }
        int i = Build.VERSION.SDK_INT;
        if (i >= 30) {
            AbstractC4046.m8914(outline, path);
            return;
        }
        if (i >= 29) {
            try {
                AbstractC4130.m9045(outline, path);
            } catch (IllegalArgumentException unused) {
            }
        } else if (path.isConvex()) {
            AbstractC4130.m9045(outline, path);
        }
    }

    @Override // android.graphics.drawable.Drawable
    public final boolean getPadding(Rect rect) {
        Rect rect2 = this.f9549.f20058;
        if (rect2 == null) {
            return super.getPadding(rect);
        }
        rect.set(rect2);
        return true;
    }

    @Override // android.graphics.drawable.Drawable
    public final Region getTransparentRegion() {
        Rect bounds = getBounds();
        Region region = this.f9557;
        region.set(bounds);
        RectF rectFM6243 = m6243();
        Path path = this.f9541;
        m6249(rectFM6243, path);
        Region region2 = this.f9542;
        region2.setPath(path, region);
        region.op(region2, Region.Op.DIFFERENCE);
        return region;
    }

    @Override // android.graphics.drawable.Drawable
    public final void invalidateSelf() {
        this.f9548 = true;
        this.f9531 = true;
        super.invalidateSelf();
    }

    @Override // android.graphics.drawable.Drawable
    public final boolean isStateful() {
        if (super.isStateful()) {
            return true;
        }
        ColorStateList colorStateList = this.f9549.f20055;
        if (colorStateList != null && colorStateList.isStateful()) {
            return true;
        }
        this.f9549.getClass();
        ColorStateList colorStateList2 = this.f9549.f20070;
        if (colorStateList2 != null && colorStateList2.isStateful()) {
            return true;
        }
        ColorStateList colorStateList3 = this.f9549.f20060;
        return (colorStateList3 != null && colorStateList3.isStateful()) || this.f9549.f20062.mo7067();
    }

    @Override // android.graphics.drawable.Drawable
    public final Drawable mutate() {
        C5355 c5355 = this.f9549;
        C5355 c53552 = new C5355();
        c53552.f20060 = null;
        c53552.f20070 = null;
        c53552.f20055 = null;
        c53552.f20059 = PorterDuff.Mode.SRC_IN;
        c53552.f20058 = null;
        c53552.f20069 = 1.0f;
        c53552.f20061 = 1.0f;
        c53552.f20068 = 255;
        c53552.f20057 = 0.0f;
        c53552.f20064 = 0.0f;
        c53552.f20063 = 0;
        c53552.f20065 = 0;
        c53552.f20056 = Paint.Style.FILL_AND_STROKE;
        c53552.f20062 = c5355.f20062;
        c53552.f20066 = c5355.f20066;
        c53552.f20067 = c5355.f20067;
        c53552.f20060 = c5355.f20060;
        c53552.f20070 = c5355.f20070;
        c53552.f20059 = c5355.f20059;
        c53552.f20055 = c5355.f20055;
        c53552.f20068 = c5355.f20068;
        c53552.f20069 = c5355.f20069;
        c53552.f20065 = c5355.f20065;
        c53552.f20061 = c5355.f20061;
        c53552.f20057 = c5355.f20057;
        c53552.f20064 = c5355.f20064;
        c53552.f20063 = c5355.f20063;
        c53552.f20056 = c5355.f20056;
        Rect rect = c5355.f20058;
        if (rect != null) {
            c53552.f20058 = new Rect(rect);
        }
        this.f9549 = c53552;
        return this;
    }

    @Override // android.graphics.drawable.Drawable
    public final void onBoundsChange(Rect rect) {
        this.f9548 = true;
        this.f9531 = true;
        super.onBoundsChange(rect);
        if (!this.f9549.f20062.mo7067() || rect.isEmpty()) {
            return;
        }
        int[] state = getState();
        C4671[] c4671Arr = this.f9547;
        int length = c4671Arr.length;
        boolean z = false;
        int i = 0;
        while (true) {
            if (i < length) {
                C4671 c4671 = c4671Arr[i];
                if (c4671 != null && c4671.f17285) {
                    z = true;
                    break;
                }
                i++;
            } else {
                break;
            }
        }
        m6251(state, true ^ z);
    }

    @Override // android.graphics.drawable.Drawable
    public final boolean onStateChange(int[] iArr) {
        if (this.f9549.f20062.mo7067()) {
            m6251(iArr, false);
        }
        boolean z = m6244(iArr) || m6250();
        if (z) {
            invalidateSelf();
        }
        return z;
    }

    @Override // android.graphics.drawable.Drawable
    public final void setAlpha(int i) {
        C5355 c5355 = this.f9549;
        if (c5355.f20068 != i) {
            c5355.f20068 = i;
            super.invalidateSelf();
        }
    }

    @Override // android.graphics.drawable.Drawable
    public final void setColorFilter(ColorFilter colorFilter) {
        this.f9549.getClass();
        super.invalidateSelf();
    }

    @Override // defpackage.InterfaceC0546
    public final void setShapeAppearanceModel(C4879 c4879) {
        this.f9549.f20062 = c4879;
        this.f9535 = null;
        this.f9539 = null;
        invalidateSelf();
    }

    @Override // android.graphics.drawable.Drawable
    public final void setTint(int i) {
        setTintList(ColorStateList.valueOf(i));
    }

    @Override // android.graphics.drawable.Drawable
    public final void setTintList(ColorStateList colorStateList) {
        this.f9549.f20055 = colorStateList;
        m6250();
        super.invalidateSelf();
    }

    @Override // android.graphics.drawable.Drawable
    public final void setTintMode(PorterDuff.Mode mode) {
        C5355 c5355 = this.f9549;
        if (c5355.f20059 != mode) {
            c5355.f20059 = mode;
            m6250();
            super.invalidateSelf();
        }
    }

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final RectF m6243() {
        Rect bounds = getBounds();
        RectF rectF = this.f9554;
        rectF.set(bounds);
        return rectF;
    }

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public final boolean m6244(int[] iArr) {
        boolean z;
        Paint paint;
        int color;
        int colorForState;
        Paint paint2;
        int color2;
        int colorForState2;
        if (this.f9549.f20060 == null || color2 == (colorForState2 = this.f9549.f20060.getColorForState(iArr, (color2 = (paint2 = this.f9556).getColor())))) {
            z = false;
        } else {
            paint2.setColor(colorForState2);
            z = true;
        }
        if (this.f9549.f20070 == null || color == (colorForState = this.f9549.f20070.getColorForState(iArr, (color = (paint = this.f9533).getColor())))) {
            return z;
        }
        paint.setColor(colorForState);
        return true;
    }

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final boolean m6245() {
        C5355 c5355 = this.f9549;
        c5355.getClass();
        return c5355.f20063 > 0 && !m6248() && !this.f9541.isConvex() && Build.VERSION.SDK_INT < 29;
    }

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final float m6246() {
        if (m6256()) {
            return this.f9533.getStrokeWidth() / 2.0f;
        }
        return 0.0f;
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final int m6247(int i) {
        int i2;
        C5355 c5355 = this.f9549;
        float f = c5355.f20064 + 0.0f + c5355.f20057;
        C0871 c0871 = c5355.f20066;
        if (c0871 == null || !c0871.f3964 || AbstractC1814.m5137(i, 255) != c0871.f3966) {
            return i;
        }
        float fMin = (c0871.f3962 <= 0.0f || f <= 0.0f) ? 0.0f : Math.min(((((float) Math.log1p(f / r3)) * 4.5f) + 2.0f) / 100.0f, 1.0f);
        int iAlpha = Color.alpha(i);
        int iM5136 = ᵙᵛᵯ.ᵿʗᵝʽ(fMin, AbstractC1814.m5137(i, 255), c0871.f3965);
        if (fMin > 0.0f && (i2 = c0871.f3963) != 0) {
            iM5136 = AbstractC1814.m5136(AbstractC1814.m5137(i2, C0871.f3961), iM5136);
        }
        return AbstractC1814.m5137(iM5136, iAlpha);
    }

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public final boolean m6248() {
        if (this.f9549.f20062.mo7066(getState()).m10324(m6243())) {
            return this.f9535 == null || this.f9544;
        }
        return false;
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final void m6249(RectF rectF, Path path) {
        this.f9546.m1794(this.f9549.f20062.mo7064(), this.f9535, this.f9549.f20061, rectF, this.f9543, path);
        if (this.f9549.f20069 != 1.0f) {
            Matrix matrix = this.f9545;
            matrix.reset();
            float f = this.f9549.f20069;
            matrix.setScale(f, f, rectF.width() / 2.0f, rectF.height() / 2.0f);
            path.transform(matrix);
        }
        path.computeBounds(this.f9532, true);
    }

    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public final boolean m6250() {
        PorterDuffColorFilter porterDuffColorFilter;
        PorterDuffColorFilter porterDuffColorFilter2 = this.f9540;
        PorterDuffColorFilter porterDuffColorFilter3 = this.f9536;
        C5355 c5355 = this.f9549;
        ColorStateList colorStateList = c5355.f20055;
        PorterDuff.Mode mode = c5355.f20059;
        if (colorStateList == null || mode == null) {
            int color = this.f9556.getColor();
            int iM6247 = m6247(color);
            porterDuffColorFilter = iM6247 != color ? new PorterDuffColorFilter(iM6247, PorterDuff.Mode.SRC_IN) : null;
        } else {
            porterDuffColorFilter = new PorterDuffColorFilter(m6247(colorStateList.getColorForState(getState(), 0)), mode);
        }
        this.f9540 = porterDuffColorFilter;
        this.f9549.getClass();
        this.f9536 = null;
        this.f9549.getClass();
        return (Objects.equals(porterDuffColorFilter2, this.f9540) && Objects.equals(porterDuffColorFilter3, this.f9536)) ? false : true;
    }

    /* JADX WARN: Removed duplicated region for block: B:26:0x0051  */
    /* JADX WARN: Removed duplicated region for block: B:27:0x0053 A[EDGE_INSN: B:65:0x0053->B:27:0x0053 BREAK  A[LOOP:0: B:18:0x003a->B:23:0x0044]] */
    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void m6251(int[] r10, boolean r11) {
        /*
            Method dump skipped, instructions count: 204
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C2445.m6251(int[], boolean):void");
    }

    /* renamed from: ᵳٴᵶ, reason: contains not printable characters */
    public final void m6252() {
        C5355 c5355 = this.f9549;
        float f = c5355.f20064 + 0.0f;
        c5355.f20063 = (int) Math.ceil(0.75f * f);
        this.f9549.f20065 = (int) Math.ceil(f * 0.25f);
        m6250();
        if (m6245() || !m6248()) {
            invalidateSelf();
        } else {
            super.invalidateSelf();
        }
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final float m6253(RectF rectF, C4879 c4879, float[] fArr) {
        if (fArr == null) {
            if (c4879.m10324(rectF)) {
                return c4879.f18171.mo3779(rectF);
            }
            return -1.0f;
        }
        if (this.f9544) {
            return fArr[0];
        }
        return -1.0f;
    }

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public final void m6254(C1107 c1107) {
        if (this.f9555 == c1107) {
            return;
        }
        this.f9555 = c1107;
        int i = 0;
        while (true) {
            C4671[] c4671Arr = this.f9547;
            if (i >= c4671Arr.length) {
                m6251(getState(), true);
                invalidateSelf();
                return;
            }
            if (c4671Arr[i] == null) {
                c4671Arr[i] = new C4671(this, f9529[i]);
            }
            C4671 c4671 = c4671Arr[i];
            C1107 c11072 = new C1107();
            c11072.m3525((float) c1107.f4777);
            double d = c1107.f4776;
            c11072.m3526((float) (d * d));
            c4671.f17290 = c11072;
            i++;
        }
    }

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public final void m6255(InterfaceC2895 interfaceC2895) {
        if (interfaceC2895 instanceof C4879) {
            setShapeAppearanceModel((C4879) interfaceC2895);
            return;
        }
        C3410 c3410 = (C3410) interfaceC2895;
        C5355 c5355 = this.f9549;
        if (c5355.f20062 != c3410) {
            c5355.f20062 = c3410;
            m6251(getState(), true);
            invalidateSelf();
        }
    }

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public final boolean m6256() {
        Paint.Style style = this.f9549.f20056;
        return (style == Paint.Style.FILL_AND_STROKE || style == Paint.Style.STROKE) && this.f9533.getStrokeWidth() > 0.0f;
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final void m6257(Canvas canvas) {
        this.f9550.cardinality();
        int i = this.f9549.f20065;
        Path path = this.f9541;
        C2321 c2321 = this.f9560;
        if (i != 0) {
            canvas.drawPath(path, (Paint) c2321.f9106);
        }
        for (int i2 = 0; i2 < 4; i2++) {
            AbstractC5566 abstractC5566 = this.f9559[i2];
            int i3 = this.f9549.f20063;
            Matrix matrix = AbstractC5566.f20876;
            abstractC5566.mo5277(matrix, c2321, i3, canvas);
            this.f9558[i2].mo5277(matrix, c2321, this.f9549.f20063, canvas);
        }
        if (this.f9534) {
            int iSin = (int) (Math.sin(Math.toRadians(0.0d)) * this.f9549.f20065);
            int iCos = (int) (Math.cos(Math.toRadians(0.0d)) * this.f9549.f20065);
            canvas.translate(-iSin, -iCos);
            canvas.drawPath(path, f9530);
            canvas.translate(iSin, iCos);
        }
    }
}
