package defpackage;

import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.os.Build;
import android.util.TypedValue;
import ar.tvplayer.tv.R;
import java.lang.ref.WeakReference;
import java.util.WeakHashMap;

/* renamed from: ːᵬᵘ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C1985 {

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public static C1985 f7979;

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

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public C3460 f7983;

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

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public C0525 f7985;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public WeakHashMap f7986;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public C2771 f7987;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final WeakHashMap f7988 = new WeakHashMap(0);

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public static final PorterDuff.Mode f7981 = PorterDuff.Mode.SRC_IN;

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public static final C3785 f7980 = new C3785(6, 1);

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public static void m5493(C1985 c1985) {
        if (Build.VERSION.SDK_INT < 24) {
            c1985.m5502("vector", new C1858(3));
            c1985.m5502("animated-vector", new C1858(2));
            c1985.m5502("animated-selector", new C1858(1));
            c1985.m5502("drawable", new C1858(0));
        }
    }

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public static synchronized PorterDuffColorFilter m5494(int i, PorterDuff.Mode mode) {
        PorterDuffColorFilter porterDuffColorFilter;
        C3785 c3785 = f7980;
        c3785.getClass();
        int i2 = (31 + i) * 31;
        porterDuffColorFilter = (PorterDuffColorFilter) c3785.m7853(Integer.valueOf(mode.hashCode() + i2));
        if (porterDuffColorFilter == null) {
            porterDuffColorFilter = new PorterDuffColorFilter(i, mode);
        }
        return porterDuffColorFilter;
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public static synchronized C1985 m5495() {
        try {
            if (f7979 == null) {
                C1985 c1985 = new C1985();
                f7979 = c1985;
                m5493(c1985);
            }
        } catch (Throwable th) {
            throw th;
        }
        return f7979;
    }

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final synchronized Drawable m5496(Context context, long j) {
        C1196 c1196 = (C1196) this.f7988.get(context);
        if (c1196 == null) {
            return null;
        }
        WeakReference weakReference = (WeakReference) c1196.m3727(j);
        if (weakReference != null) {
            Drawable.ConstantState constantState = (Drawable.ConstantState) weakReference.get();
            if (constantState != null) {
                return constantState.newDrawable(context.getResources());
            }
            int i = ᵛᵾˏ.ˇʼʤˎ(c1196.f5098, c1196.f5100, j);
            if (i >= 0) {
                Object[] objArr = c1196.f5101;
                Object obj = objArr[i];
                Object obj2 = ˆᴵ.ᵧᵾˀˈ;
                if (obj != obj2) {
                    objArr[i] = obj2;
                    c1196.f5099 = true;
                }
            }
        }
        return null;
    }

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public final synchronized void m5497(Context context) {
        C1196 c1196 = (C1196) this.f7988.get(context);
        if (c1196 != null) {
            c1196.m3733();
        }
    }

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final synchronized Drawable m5498(Context context, int i, boolean z) {
        Drawable drawableM5506;
        try {
            if (!this.f7984) {
                this.f7984 = true;
                Drawable drawableM5499 = m5499(context, R.drawable._11_res_0x7f08007f);
                if (drawableM5499 == null || (!(drawableM5499 instanceof C2217) && !"android.graphics.drawable.VectorDrawable".equals(drawableM5499.getClass().getName()))) {
                    this.f7984 = false;
                    throw new IllegalStateException("This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat.");
                }
            }
            drawableM5506 = m5506(context, i);
            if (drawableM5506 == null) {
                drawableM5506 = m5500(context, i);
            }
            if (drawableM5506 == null) {
                drawableM5506 = context.getDrawable(i);
            }
            if (drawableM5506 != null) {
                drawableM5506 = m5503(context, i, z, drawableM5506);
            }
            if (drawableM5506 != null) {
                AbstractC1991.m5513(drawableM5506);
            }
        } catch (Throwable th) {
            throw th;
        }
        return drawableM5506;
    }

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final synchronized Drawable m5499(Context context, int i) {
        return m5498(context, i, false);
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final Drawable m5500(Context context, int i) throws Resources.NotFoundException {
        if (this.f7982 == null) {
            this.f7982 = new TypedValue();
        }
        TypedValue typedValue = this.f7982;
        context.getResources().getValue(i, typedValue, true);
        long j = (typedValue.assetCookie << 32) | typedValue.data;
        Drawable drawableM5496 = m5496(context, j);
        if (drawableM5496 != null) {
            return drawableM5496;
        }
        LayerDrawable layerDrawableM7873 = null;
        if (this.f7983 != null) {
            if (i == R.drawable._11_res_0x7f080041) {
                layerDrawableM7873 = new LayerDrawable(new Drawable[]{m5499(context, R.drawable._11_res_0x7f080040), m5499(context, R.drawable._11_res_0x7f080042)});
            } else if (i == R.drawable._11_res_0x7f080064) {
                layerDrawableM7873 = C3460.m7873(this, context, R.dimen._11_res_0x7f07003b);
            } else if (i == R.drawable._11_res_0x7f080063) {
                layerDrawableM7873 = C3460.m7873(this, context, R.dimen._11_res_0x7f07003c);
            } else if (i == R.drawable._11_res_0x7f080065) {
                layerDrawableM7873 = C3460.m7873(this, context, R.dimen._11_res_0x7f07003d);
            }
        }
        if (layerDrawableM7873 != null) {
            layerDrawableM7873.setChangingConfigurations(typedValue.changingConfigurations);
            m5505(context, j, layerDrawableM7873);
        }
        return layerDrawableM7873;
    }

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public final synchronized ColorStateList m5501(Context context, int i) {
        ColorStateList colorStateList;
        C0525 c0525;
        Object obj;
        WeakHashMap weakHashMap = this.f7986;
        ColorStateList colorStateListM7887 = null;
        if (weakHashMap == null || (c0525 = (C0525) weakHashMap.get(context)) == null) {
            colorStateList = null;
        } else {
            int i2 = ᵛᵾˏ.ᵻᵢﹳᵰ(c0525.f2741, c0525.f2742, i);
            if (i2 < 0 || (obj = c0525.f2740[i2]) == ᵲᵝᵪ.ᵴᵳ) {
                obj = null;
            }
            colorStateList = (ColorStateList) obj;
        }
        if (colorStateList == null) {
            C3460 c3460 = this.f7983;
            if (c3460 != null) {
                colorStateListM7887 = c3460.m7887(context, i);
            }
            if (colorStateListM7887 != null) {
                if (this.f7986 == null) {
                    this.f7986 = new WeakHashMap();
                }
                C0525 c05252 = (C0525) this.f7986.get(context);
                if (c05252 == null) {
                    c05252 = new C0525();
                    this.f7986.put(context, c05252);
                }
                c05252.m2318(i, colorStateListM7887);
            }
            colorStateList = colorStateListM7887;
        }
        return colorStateList;
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final void m5502(String str, C1858 c1858) {
        if (this.f7987 == null) {
            this.f7987 = new C2771(0);
        }
        this.f7987.put(str, c1858);
    }

    /* JADX WARN: Removed duplicated region for block: B:45:0x00dd  */
    /* JADX WARN: Removed duplicated region for block: B:56:0x00f9  */
    /* 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 android.graphics.drawable.Drawable m5503(android.content.Context r8, int r9, boolean r10, android.graphics.drawable.Drawable r11) {
        /*
            Method dump skipped, instructions count: 253
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C1985.m5503(android.content.Context, int, boolean, android.graphics.drawable.Drawable):android.graphics.drawable.Drawable");
    }

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public final synchronized void m5504(C3460 c3460) {
        this.f7983 = c3460;
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final synchronized void m5505(Context context, long j, Drawable drawable) {
        try {
            Drawable.ConstantState constantState = drawable.getConstantState();
            if (constantState != null) {
                C1196 c1196 = (C1196) this.f7988.get(context);
                if (c1196 == null) {
                    c1196 = new C1196();
                    this.f7988.put(context, c1196);
                }
                c1196.m3728(j, new WeakReference(constantState));
            }
        } catch (Throwable th) {
            throw th;
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:17:0x0034, code lost:
    
        if (r10.f7987.get(r0) != null) goto L20;
     */
    /* 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 android.graphics.drawable.Drawable m5506(android.content.Context r11, int r12) throws org.xmlpull.v1.XmlPullParserException, android.content.res.Resources.NotFoundException, java.io.IOException {
        /*
            r10 = this;
            ᵛᵹ r0 = r10.f7987
            r1 = 0
            if (r0 == 0) goto Lbf
            boolean r0 = r0.isEmpty()
            if (r0 != 0) goto Lbf
            ˀˈ r0 = r10.f7985
            java.lang.String r2 = "appcompat_skip_skip"
            if (r0 == 0) goto L38
            int[] r3 = r0.f2741
            int r4 = r0.f2742
            int r3 = ᵛᵾˏ.ᵻᵢﹳᵰ(r3, r4, r12)
            if (r3 < 0) goto L23
            java.lang.Object[] r0 = r0.f2740
            r0 = r0[r3]
            java.lang.Object r3 = ᵲᵝᵪ.ᵴᵳ
            if (r0 != r3) goto L24
        L23:
            r0 = r1
        L24:
            java.lang.String r0 = (java.lang.String) r0
            boolean r3 = r2.equals(r0)
            if (r3 != 0) goto Lbf
            if (r0 == 0) goto L3f
            ᵛᵹ r3 = r10.f7987
            java.lang.Object r0 = r3.get(r0)
            if (r0 != 0) goto L3f
            goto Lbf
        L38:
            ˀˈ r0 = new ˀˈ
            r0.<init>()
            r10.f7985 = r0
        L3f:
            android.util.TypedValue r0 = r10.f7982
            if (r0 != 0) goto L4a
            android.util.TypedValue r0 = new android.util.TypedValue
            r0.<init>()
            r10.f7982 = r0
        L4a:
            android.util.TypedValue r0 = r10.f7982
            android.content.res.Resources r1 = r11.getResources()
            r3 = 1
            r1.getValue(r12, r0, r3)
            int r4 = r0.assetCookie
            long r4 = (long) r4
            r6 = 32
            long r4 = r4 << r6
            int r6 = r0.data
            long r6 = (long) r6
            long r4 = r4 | r6
            android.graphics.drawable.Drawable r6 = r10.m5496(r11, r4)
            if (r6 == 0) goto L65
            return r6
        L65:
            java.lang.CharSequence r7 = r0.string
            if (r7 == 0) goto Lb7
            java.lang.String r7 = r7.toString()
            java.lang.String r8 = ".xml"
            boolean r7 = r7.endsWith(r8)
            if (r7 == 0) goto Lb7
            android.content.res.XmlResourceParser r1 = r1.getXml(r12)     // Catch: java.lang.Exception -> Lb7
            android.util.AttributeSet r7 = android.util.Xml.asAttributeSet(r1)     // Catch: java.lang.Exception -> Lb7
        L7d:
            int r8 = r1.next()     // Catch: java.lang.Exception -> Lb7
            r9 = 2
            if (r8 == r9) goto L87
            if (r8 == r3) goto L87
            goto L7d
        L87:
            if (r8 != r9) goto Laf
            java.lang.String r3 = r1.getName()     // Catch: java.lang.Exception -> Lb7
            ˀˈ r8 = r10.f7985     // Catch: java.lang.Exception -> Lb7
            r8.m2318(r12, r3)     // Catch: java.lang.Exception -> Lb7
            ᵛᵹ r8 = r10.f7987     // Catch: java.lang.Exception -> Lb7
            java.lang.Object r3 = r8.get(r3)     // Catch: java.lang.Exception -> Lb7
            ˏᵔˆ r3 = (defpackage.C1858) r3     // Catch: java.lang.Exception -> Lb7
            if (r3 == 0) goto La4
            android.content.res.Resources$Theme r8 = r11.getTheme()     // Catch: java.lang.Exception -> Lb7
            android.graphics.drawable.Drawable r6 = r3.m5255(r11, r1, r7, r8)     // Catch: java.lang.Exception -> Lb7
        La4:
            if (r6 == 0) goto Lb7
            int r0 = r0.changingConfigurations     // Catch: java.lang.Exception -> Lb7
            r6.setChangingConfigurations(r0)     // Catch: java.lang.Exception -> Lb7
            r10.m5505(r11, r4, r6)     // Catch: java.lang.Exception -> Lb7
            goto Lb7
        Laf:
            org.xmlpull.v1.XmlPullParserException r11 = new org.xmlpull.v1.XmlPullParserException     // Catch: java.lang.Exception -> Lb7
            java.lang.String r0 = "No start tag found"
            r11.<init>(r0)     // Catch: java.lang.Exception -> Lb7
            throw r11     // Catch: java.lang.Exception -> Lb7
        Lb7:
            if (r6 != 0) goto Lbe
            ˀˈ r10 = r10.f7985
            r10.m2318(r12, r2)
        Lbe:
            return r6
        Lbf:
            return r1
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C1985.m5506(android.content.Context, int):android.graphics.drawable.Drawable");
    }
}
