package c.b.f;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.LocaleList;
import android.text.TextUtils;
import android.text.method.PasswordTransformationMethod;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.widget.TextView;
import c.f.c.b.k;
import c.f.j.a0;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.Locale;
import java.util.Objects;
import java.util.WeakHashMap;

/* JADX INFO: compiled from: AppCompatTextHelper.java */
/* JADX INFO: loaded from: classes.dex */
public class d0 {
    public final TextView a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public b1 f792b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public b1 f793c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public b1 f794d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public b1 f795e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public b1 f796f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public b1 f797g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public b1 f798h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public final g0 f799i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public int f800j = 0;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public int f801k = -1;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public Typeface f802l;
    public boolean m;

    /* JADX INFO: compiled from: AppCompatTextHelper.java */
    public class a extends k.e {
        public final /* synthetic */ int a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public final /* synthetic */ int f803b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        public final /* synthetic */ WeakReference f804c;

        public a(int i2, int i3, WeakReference weakReference) {
            this.a = i2;
            this.f803b = i3;
            this.f804c = weakReference;
        }

        @Override // c.f.c.b.k.e
        public void d(Typeface typeface) {
            int i2;
            if (Build.VERSION.SDK_INT >= 28 && (i2 = this.a) != -1) {
                typeface = e.a(typeface, i2, (this.f803b & 2) != 0);
            }
            d0 d0Var = d0.this;
            WeakReference weakReference = this.f804c;
            if (d0Var.m) {
                d0Var.f802l = typeface;
                TextView textView = (TextView) weakReference.get();
                if (textView != null) {
                    WeakHashMap<View, c.f.j.i0> weakHashMap = c.f.j.a0.a;
                    if (a0.f.b(textView)) {
                        textView.post(new e0(d0Var, textView, typeface, d0Var.f800j));
                    } else {
                        textView.setTypeface(typeface, d0Var.f800j);
                    }
                }
            }
        }
    }

    /* JADX INFO: compiled from: AppCompatTextHelper.java */
    public static class b {
        public static Drawable[] a(TextView textView) {
            return textView.getCompoundDrawablesRelative();
        }

        public static void b(TextView textView, Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
            textView.setCompoundDrawablesRelativeWithIntrinsicBounds(drawable, drawable2, drawable3, drawable4);
        }

        public static void c(TextView textView, Locale locale) {
            textView.setTextLocale(locale);
        }
    }

    /* JADX INFO: compiled from: AppCompatTextHelper.java */
    public static class c {
        public static LocaleList a(String str) {
            return LocaleList.forLanguageTags(str);
        }

        public static void b(TextView textView, LocaleList localeList) {
            textView.setTextLocales(localeList);
        }
    }

    /* JADX INFO: compiled from: AppCompatTextHelper.java */
    public static class d {
        public static int a(TextView textView) {
            return textView.getAutoSizeStepGranularity();
        }

        public static void b(TextView textView, int i2, int i3, int i4, int i5) {
            textView.setAutoSizeTextTypeUniformWithConfiguration(i2, i3, i4, i5);
        }

        public static void c(TextView textView, int[] iArr, int i2) {
            textView.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i2);
        }

        public static boolean d(TextView textView, String str) {
            return textView.setFontVariationSettings(str);
        }
    }

    /* JADX INFO: compiled from: AppCompatTextHelper.java */
    public static class e {
        public static Typeface a(Typeface typeface, int i2, boolean z) {
            return Typeface.create(typeface, i2, z);
        }
    }

    public d0(TextView textView) {
        this.a = textView;
        this.f799i = new g0(textView);
    }

    public static b1 c(Context context, m mVar, int i2) {
        ColorStateList colorStateListC = mVar.c(context, i2);
        if (colorStateListC == null) {
            return null;
        }
        b1 b1Var = new b1();
        b1Var.f779d = true;
        b1Var.a = colorStateListC;
        return b1Var;
    }

    public final void a(Drawable drawable, b1 b1Var) {
        if (drawable == null || b1Var == null) {
            return;
        }
        m.e(drawable, b1Var, this.a.getDrawableState());
    }

    public void b() {
        if (this.f792b != null || this.f793c != null || this.f794d != null || this.f795e != null) {
            Drawable[] compoundDrawables = this.a.getCompoundDrawables();
            a(compoundDrawables[0], this.f792b);
            a(compoundDrawables[1], this.f793c);
            a(compoundDrawables[2], this.f794d);
            a(compoundDrawables[3], this.f795e);
        }
        if (this.f796f == null && this.f797g == null) {
            return;
        }
        Drawable[] drawableArrA = b.a(this.a);
        a(drawableArrA[0], this.f796f);
        a(drawableArrA[2], this.f797g);
    }

    public ColorStateList d() {
        b1 b1Var = this.f798h;
        if (b1Var != null) {
            return b1Var.a;
        }
        return null;
    }

    public PorterDuff.Mode e() {
        b1 b1Var = this.f798h;
        if (b1Var != null) {
            return b1Var.f777b;
        }
        return null;
    }

    public boolean f() {
        g0 g0Var = this.f799i;
        return g0Var.i() && g0Var.f845d != 0;
    }

    @SuppressLint({"NewApi"})
    public void g(AttributeSet attributeSet, int i2) {
        boolean zA;
        boolean z;
        String strK;
        String strK2;
        int i3;
        Drawable drawableB;
        int i4;
        ColorStateList colorStateList;
        int resourceId;
        int i5;
        int resourceId2;
        int i6;
        Context context = this.a.getContext();
        m mVarA = m.a();
        int[] iArr = c.b.b.f539h;
        d1 d1VarO = d1.o(context, attributeSet, iArr, i2, 0);
        TextView textView = this.a;
        c.f.j.a0.k(textView, textView.getContext(), iArr, attributeSet, d1VarO.f806b, i2, 0);
        int iJ = d1VarO.j(0, -1);
        if (d1VarO.m(3)) {
            this.f792b = c(context, mVarA, d1VarO.j(3, 0));
        }
        if (d1VarO.m(1)) {
            this.f793c = c(context, mVarA, d1VarO.j(1, 0));
        }
        if (d1VarO.m(4)) {
            this.f794d = c(context, mVarA, d1VarO.j(4, 0));
        }
        if (d1VarO.m(2)) {
            this.f795e = c(context, mVarA, d1VarO.j(2, 0));
        }
        int i7 = Build.VERSION.SDK_INT;
        if (d1VarO.m(5)) {
            this.f796f = c(context, mVarA, d1VarO.j(5, 0));
        }
        if (d1VarO.m(6)) {
            this.f797g = c(context, mVarA, d1VarO.j(6, 0));
        }
        d1VarO.f806b.recycle();
        boolean z2 = this.a.getTransformationMethod() instanceof PasswordTransformationMethod;
        if (iJ != -1) {
            TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(iJ, c.b.b.w);
            d1 d1Var = new d1(context, typedArrayObtainStyledAttributes);
            if (z2 || !d1Var.m(14)) {
                zA = false;
                z = false;
            } else {
                zA = d1Var.a(14, false);
                z = true;
            }
            o(context, d1Var);
            if (d1Var.m(15)) {
                strK2 = d1Var.k(15);
                i6 = 13;
            } else {
                i6 = 13;
                strK2 = null;
            }
            strK = d1Var.m(i6) ? d1Var.k(i6) : null;
            typedArrayObtainStyledAttributes.recycle();
        } else {
            zA = false;
            z = false;
            strK = null;
            strK2 = null;
        }
        TypedArray typedArrayObtainStyledAttributes2 = context.obtainStyledAttributes(attributeSet, c.b.b.w, i2, 0);
        d1 d1Var2 = new d1(context, typedArrayObtainStyledAttributes2);
        if (!z2 && d1Var2.m(14)) {
            zA = d1Var2.a(14, false);
            z = true;
        }
        if (d1Var2.m(15)) {
            strK2 = d1Var2.k(15);
        }
        if (d1Var2.m(13)) {
            strK = d1Var2.k(13);
        }
        if (i7 >= 28 && d1Var2.m(0) && d1Var2.d(0, -1) == 0) {
            this.a.setTextSize(0, 0.0f);
        }
        o(context, d1Var2);
        typedArrayObtainStyledAttributes2.recycle();
        if (!z2 && z) {
            this.a.setAllCaps(zA);
        }
        Typeface typeface = this.f802l;
        if (typeface != null) {
            if (this.f801k == -1) {
                this.a.setTypeface(typeface, this.f800j);
            } else {
                this.a.setTypeface(typeface);
            }
        }
        if (strK != null) {
            d.d(this.a, strK);
        }
        if (strK2 != null) {
            c.b(this.a, c.a(strK2));
        }
        g0 g0Var = this.f799i;
        Context context2 = g0Var.m;
        int[] iArr2 = c.b.b.f540i;
        TypedArray typedArrayObtainStyledAttributes3 = context2.obtainStyledAttributes(attributeSet, iArr2, i2, 0);
        TextView textView2 = g0Var.f853l;
        c.f.j.a0.k(textView2, textView2.getContext(), iArr2, attributeSet, typedArrayObtainStyledAttributes3, i2, 0);
        if (typedArrayObtainStyledAttributes3.hasValue(5)) {
            g0Var.f845d = typedArrayObtainStyledAttributes3.getInt(5, 0);
        }
        float dimension = typedArrayObtainStyledAttributes3.hasValue(4) ? typedArrayObtainStyledAttributes3.getDimension(4, -1.0f) : -1.0f;
        float dimension2 = typedArrayObtainStyledAttributes3.hasValue(2) ? typedArrayObtainStyledAttributes3.getDimension(2, -1.0f) : -1.0f;
        float dimension3 = typedArrayObtainStyledAttributes3.hasValue(1) ? typedArrayObtainStyledAttributes3.getDimension(1, -1.0f) : -1.0f;
        if (typedArrayObtainStyledAttributes3.hasValue(3) && (resourceId2 = typedArrayObtainStyledAttributes3.getResourceId(3, 0)) > 0) {
            TypedArray typedArrayObtainTypedArray = typedArrayObtainStyledAttributes3.getResources().obtainTypedArray(resourceId2);
            int length = typedArrayObtainTypedArray.length();
            int[] iArr3 = new int[length];
            if (length > 0) {
                for (int i8 = 0; i8 < length; i8++) {
                    iArr3[i8] = typedArrayObtainTypedArray.getDimensionPixelSize(i8, -1);
                }
                g0Var.f850i = g0Var.b(iArr3);
                g0Var.h();
            }
            typedArrayObtainTypedArray.recycle();
        }
        typedArrayObtainStyledAttributes3.recycle();
        if (!g0Var.i()) {
            g0Var.f845d = 0;
        } else if (g0Var.f845d == 1) {
            if (!g0Var.f851j) {
                DisplayMetrics displayMetrics = g0Var.m.getResources().getDisplayMetrics();
                if (dimension2 == -1.0f) {
                    i5 = 2;
                    dimension2 = TypedValue.applyDimension(2, 12.0f, displayMetrics);
                } else {
                    i5 = 2;
                }
                if (dimension3 == -1.0f) {
                    dimension3 = TypedValue.applyDimension(i5, 112.0f, displayMetrics);
                }
                if (dimension == -1.0f) {
                    dimension = 1.0f;
                }
                g0Var.j(dimension2, dimension3, dimension);
            }
            g0Var.g();
        }
        if (i1.f864b) {
            g0 g0Var2 = this.f799i;
            if (g0Var2.f845d != 0) {
                int[] iArr4 = g0Var2.f850i;
                if (iArr4.length > 0) {
                    if (d.a(this.a) != -1.0f) {
                        d.b(this.a, Math.round(this.f799i.f848g), Math.round(this.f799i.f849h), Math.round(this.f799i.f847f), 0);
                    } else {
                        d.c(this.a, iArr4, 0);
                    }
                }
            }
        }
        TypedArray typedArrayObtainStyledAttributes4 = context.obtainStyledAttributes(attributeSet, c.b.b.f540i);
        int resourceId3 = typedArrayObtainStyledAttributes4.getResourceId(8, -1);
        if (resourceId3 != -1) {
            drawableB = mVarA.b(context, resourceId3);
            i3 = 13;
        } else {
            i3 = 13;
            drawableB = null;
        }
        int resourceId4 = typedArrayObtainStyledAttributes4.getResourceId(i3, -1);
        Drawable drawableB2 = resourceId4 != -1 ? mVarA.b(context, resourceId4) : null;
        int resourceId5 = typedArrayObtainStyledAttributes4.getResourceId(9, -1);
        Drawable drawableB3 = resourceId5 != -1 ? mVarA.b(context, resourceId5) : null;
        int resourceId6 = typedArrayObtainStyledAttributes4.getResourceId(6, -1);
        Drawable drawableB4 = resourceId6 != -1 ? mVarA.b(context, resourceId6) : null;
        int resourceId7 = typedArrayObtainStyledAttributes4.getResourceId(10, -1);
        Drawable drawableB5 = resourceId7 != -1 ? mVarA.b(context, resourceId7) : null;
        int resourceId8 = typedArrayObtainStyledAttributes4.getResourceId(7, -1);
        Drawable drawableB6 = resourceId8 != -1 ? mVarA.b(context, resourceId8) : null;
        if (drawableB5 != null || drawableB6 != null) {
            Drawable[] drawableArrA = b.a(this.a);
            TextView textView3 = this.a;
            if (drawableB5 == null) {
                drawableB5 = drawableArrA[0];
            }
            if (drawableB2 == null) {
                drawableB2 = drawableArrA[1];
            }
            if (drawableB6 == null) {
                drawableB6 = drawableArrA[2];
            }
            if (drawableB4 == null) {
                drawableB4 = drawableArrA[3];
            }
            b.b(textView3, drawableB5, drawableB2, drawableB6, drawableB4);
        } else if (drawableB != null || drawableB2 != null || drawableB3 != null || drawableB4 != null) {
            Drawable[] drawableArrA2 = b.a(this.a);
            if (drawableArrA2[0] == null && drawableArrA2[2] == null) {
                Drawable[] compoundDrawables = this.a.getCompoundDrawables();
                TextView textView4 = this.a;
                if (drawableB == null) {
                    drawableB = compoundDrawables[0];
                }
                if (drawableB2 == null) {
                    drawableB2 = compoundDrawables[1];
                }
                if (drawableB3 == null) {
                    drawableB3 = compoundDrawables[2];
                }
                if (drawableB4 == null) {
                    drawableB4 = compoundDrawables[3];
                }
                textView4.setCompoundDrawablesWithIntrinsicBounds(drawableB, drawableB2, drawableB3, drawableB4);
            } else {
                TextView textView5 = this.a;
                Drawable drawable = drawableArrA2[0];
                if (drawableB2 == null) {
                    drawableB2 = drawableArrA2[1];
                }
                Drawable drawable2 = drawableArrA2[2];
                if (drawableB4 == null) {
                    drawableB4 = drawableArrA2[3];
                }
                b.b(textView5, drawable, drawableB2, drawable2, drawableB4);
            }
        }
        if (typedArrayObtainStyledAttributes4.hasValue(11)) {
            if (!typedArrayObtainStyledAttributes4.hasValue(11) || (resourceId = typedArrayObtainStyledAttributes4.getResourceId(11, 0)) == 0 || (colorStateList = c.b.a.d(context, resourceId)) == null) {
                colorStateList = typedArrayObtainStyledAttributes4.getColorStateList(11);
            }
            TextView textView6 = this.a;
            Objects.requireNonNull(textView6);
            c.f.k.m.f(textView6, colorStateList);
        }
        if (typedArrayObtainStyledAttributes4.hasValue(12)) {
            i4 = -1;
            PorterDuff.Mode modeC = k0.c(typedArrayObtainStyledAttributes4.getInt(12, -1), null);
            TextView textView7 = this.a;
            Objects.requireNonNull(textView7);
            c.f.k.m.g(textView7, modeC);
        } else {
            i4 = -1;
        }
        int dimensionPixelSize = typedArrayObtainStyledAttributes4.getDimensionPixelSize(15, i4);
        int dimensionPixelSize2 = typedArrayObtainStyledAttributes4.getDimensionPixelSize(18, i4);
        int dimensionPixelSize3 = typedArrayObtainStyledAttributes4.getDimensionPixelSize(19, i4);
        typedArrayObtainStyledAttributes4.recycle();
        if (dimensionPixelSize != i4) {
            c.f.b.h.C(this.a, dimensionPixelSize);
        }
        if (dimensionPixelSize2 != i4) {
            c.f.b.h.D(this.a, dimensionPixelSize2);
        }
        if (dimensionPixelSize3 != i4) {
            c.f.b.h.E(this.a, dimensionPixelSize3);
        }
    }

    public void h(Context context, int i2) {
        String strK;
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(i2, c.b.b.w);
        d1 d1Var = new d1(context, typedArrayObtainStyledAttributes);
        if (d1Var.m(14)) {
            this.a.setAllCaps(d1Var.a(14, false));
        }
        if (d1Var.m(0) && d1Var.d(0, -1) == 0) {
            this.a.setTextSize(0, 0.0f);
        }
        o(context, d1Var);
        if (d1Var.m(13) && (strK = d1Var.k(13)) != null) {
            d.d(this.a, strK);
        }
        typedArrayObtainStyledAttributes.recycle();
        Typeface typeface = this.f802l;
        if (typeface != null) {
            this.a.setTypeface(typeface, this.f800j);
        }
    }

    public void i(TextView textView, InputConnection inputConnection, EditorInfo editorInfo) {
        int i2 = Build.VERSION.SDK_INT;
        if (i2 >= 30 || inputConnection == null) {
            return;
        }
        CharSequence text = textView.getText();
        if (i2 >= 30) {
            editorInfo.setInitialSurroundingSubText(text, 0);
            return;
        }
        Objects.requireNonNull(text);
        if (i2 >= 30) {
            editorInfo.setInitialSurroundingSubText(text, 0);
            return;
        }
        int i3 = editorInfo.initialSelStart;
        int i4 = editorInfo.initialSelEnd;
        int i5 = i3 > i4 ? i4 + 0 : i3 + 0;
        int i6 = i3 > i4 ? i3 - 0 : i4 + 0;
        int length = text.length();
        if (i5 < 0 || i6 > length) {
            c.f.j.o0.b.b(editorInfo, null, 0, 0);
            return;
        }
        int i7 = editorInfo.inputType & 4095;
        if (i7 == 129 || i7 == 225 || i7 == 18) {
            c.f.j.o0.b.b(editorInfo, null, 0, 0);
            return;
        }
        if (length <= 2048) {
            c.f.j.o0.b.b(editorInfo, text, i5, i6);
            return;
        }
        int i8 = i6 - i5;
        int i9 = i8 > 1024 ? 0 : i8;
        int i10 = 2048 - i9;
        int iMin = Math.min(text.length() - i6, i10 - Math.min(i5, (int) (((double) i10) * 0.8d)));
        int iMin2 = Math.min(i5, i10 - iMin);
        int i11 = i5 - iMin2;
        if (c.f.j.o0.b.a(text, i11, 0)) {
            i11++;
            iMin2--;
        }
        if (c.f.j.o0.b.a(text, (i6 + iMin) - 1, 1)) {
            iMin--;
        }
        CharSequence charSequenceConcat = i9 != i8 ? TextUtils.concat(text.subSequence(i11, i11 + iMin2), text.subSequence(i6, iMin + i6)) : text.subSequence(i11, iMin2 + i9 + iMin + i11);
        int i12 = iMin2 + 0;
        c.f.j.o0.b.b(editorInfo, charSequenceConcat, i12, i9 + i12);
    }

    public void j(int i2, int i3, int i4, int i5) throws IllegalArgumentException {
        g0 g0Var = this.f799i;
        if (g0Var.i()) {
            DisplayMetrics displayMetrics = g0Var.m.getResources().getDisplayMetrics();
            g0Var.j(TypedValue.applyDimension(i5, i2, displayMetrics), TypedValue.applyDimension(i5, i3, displayMetrics), TypedValue.applyDimension(i5, i4, displayMetrics));
            if (g0Var.g()) {
                g0Var.a();
            }
        }
    }

    public void k(int[] iArr, int i2) throws IllegalArgumentException {
        g0 g0Var = this.f799i;
        if (g0Var.i()) {
            int length = iArr.length;
            if (length > 0) {
                int[] iArrCopyOf = new int[length];
                if (i2 == 0) {
                    iArrCopyOf = Arrays.copyOf(iArr, length);
                } else {
                    DisplayMetrics displayMetrics = g0Var.m.getResources().getDisplayMetrics();
                    for (int i3 = 0; i3 < length; i3++) {
                        iArrCopyOf[i3] = Math.round(TypedValue.applyDimension(i2, iArr[i3], displayMetrics));
                    }
                }
                g0Var.f850i = g0Var.b(iArrCopyOf);
                if (!g0Var.h()) {
                    StringBuilder sbB = d.b.a.a.a.B("None of the preset sizes is valid: ");
                    sbB.append(Arrays.toString(iArr));
                    throw new IllegalArgumentException(sbB.toString());
                }
            } else {
                g0Var.f851j = false;
            }
            if (g0Var.g()) {
                g0Var.a();
            }
        }
    }

    public void l(int i2) {
        g0 g0Var = this.f799i;
        if (g0Var.i()) {
            if (i2 == 0) {
                g0Var.f845d = 0;
                g0Var.f848g = -1.0f;
                g0Var.f849h = -1.0f;
                g0Var.f847f = -1.0f;
                g0Var.f850i = new int[0];
                g0Var.f846e = false;
                return;
            }
            if (i2 != 1) {
                throw new IllegalArgumentException(d.b.a.a.a.j("Unknown auto-size text type: ", i2));
            }
            DisplayMetrics displayMetrics = g0Var.m.getResources().getDisplayMetrics();
            g0Var.j(TypedValue.applyDimension(2, 12.0f, displayMetrics), TypedValue.applyDimension(2, 112.0f, displayMetrics), 1.0f);
            if (g0Var.g()) {
                g0Var.a();
            }
        }
    }

    public void m(ColorStateList colorStateList) {
        if (this.f798h == null) {
            this.f798h = new b1();
        }
        b1 b1Var = this.f798h;
        b1Var.a = colorStateList;
        b1Var.f779d = colorStateList != null;
        this.f792b = b1Var;
        this.f793c = b1Var;
        this.f794d = b1Var;
        this.f795e = b1Var;
        this.f796f = b1Var;
        this.f797g = b1Var;
    }

    public void n(PorterDuff.Mode mode) {
        if (this.f798h == null) {
            this.f798h = new b1();
        }
        b1 b1Var = this.f798h;
        b1Var.f777b = mode;
        b1Var.f778c = mode != null;
        this.f792b = b1Var;
        this.f793c = b1Var;
        this.f794d = b1Var;
        this.f795e = b1Var;
        this.f796f = b1Var;
        this.f797g = b1Var;
    }

    public final void o(Context context, d1 d1Var) {
        String strK;
        this.f800j = d1Var.h(2, this.f800j);
        int i2 = Build.VERSION.SDK_INT;
        if (i2 >= 28) {
            int iH = d1Var.h(11, -1);
            this.f801k = iH;
            if (iH != -1) {
                this.f800j = (this.f800j & 2) | 0;
            }
        }
        if (!d1Var.m(10) && !d1Var.m(12)) {
            if (d1Var.m(1)) {
                this.m = false;
                int iH2 = d1Var.h(1, 1);
                if (iH2 == 1) {
                    this.f802l = Typeface.SANS_SERIF;
                    return;
                } else if (iH2 == 2) {
                    this.f802l = Typeface.SERIF;
                    return;
                } else {
                    if (iH2 != 3) {
                        return;
                    }
                    this.f802l = Typeface.MONOSPACE;
                    return;
                }
            }
            return;
        }
        this.f802l = null;
        int i3 = d1Var.m(12) ? 12 : 10;
        int i4 = this.f801k;
        int i5 = this.f800j;
        if (!context.isRestricted()) {
            try {
                Typeface typefaceG = d1Var.g(i3, this.f800j, new a(i4, i5, new WeakReference(this.a)));
                if (typefaceG != null) {
                    if (i2 < 28 || this.f801k == -1) {
                        this.f802l = typefaceG;
                    } else {
                        this.f802l = e.a(Typeface.create(typefaceG, 0), this.f801k, (this.f800j & 2) != 0);
                    }
                }
                this.m = this.f802l == null;
            } catch (Resources.NotFoundException | UnsupportedOperationException unused) {
            }
        }
        if (this.f802l != null || (strK = d1Var.k(i3)) == null) {
            return;
        }
        if (Build.VERSION.SDK_INT < 28 || this.f801k == -1) {
            this.f802l = Typeface.create(strK, this.f800j);
        } else {
            this.f802l = e.a(Typeface.create(strK, 0), this.f801k, (this.f800j & 2) != 0);
        }
    }
}
