package o; import android.content.res.Resources; import android.content.res.TypedArray; import android.util.Base64; import android.util.Xml; import com.prolificinteractive.materialcalendarview.TitleChanger; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; import o.KtR; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; /* loaded from: classes.dex */ public class Szw { /* loaded from: classes.dex */ public interface HBt { } /* loaded from: classes.dex */ public static final class RVV implements HBt { private final String a; private final int b; private final WXG c; private final int e; public RVV(WXG wxg, int i, int i2, String str) { this.c = wxg; this.e = i; this.b = i2; this.a = str; } public final int c() { return this.b; } public final String a() { return this.a; } public final WXG e() { return this.c; } public final int b() { return this.e; } } /* loaded from: classes.dex */ public static final class LWm { private final int a; private final String b; private final int c; private final boolean d; private final String e; private final int f; public LWm(String str, int i, boolean z, String str2, int i2, int i3) { this.b = str; this.f = i; this.d = z; this.e = str2; this.c = i2; this.a = i3; } public final boolean i() { return this.d; } public final int c() { return this.f; } public final String b() { return this.e; } public final int e() { return this.c; } public final int a() { return this.a; } public final String d() { return this.b; } } /* loaded from: classes.dex */ public static final class IeS implements HBt { private final LWm[] a; public IeS(LWm[] lWmArr) { this.a = lWmArr; } public final LWm[] c() { return this.a; } } public static HBt nL_(XmlPullParser xmlPullParser, Resources resources) throws XmlPullParserException, IOException { int next; do { next = xmlPullParser.next(); if (next == 2) { break; } } while (next != 1); if (next != 2) { throw new XmlPullParserException("No start tag found"); } return nN_(xmlPullParser, resources); } private static HBt nN_(XmlPullParser xmlPullParser, Resources resources) throws XmlPullParserException, IOException { xmlPullParser.require(2, null, "font-family"); if (xmlPullParser.getName().equals("font-family")) { return nO_(xmlPullParser, resources); } b(xmlPullParser); return null; } private static HBt nO_(XmlPullParser xmlPullParser, Resources resources) throws XmlPullParserException, IOException { TypedArray obtainAttributes = resources.obtainAttributes(Xml.asAttributeSet(xmlPullParser), KtR.RVV.FontFamily); String string = obtainAttributes.getString(KtR.RVV.FontFamily_fontProviderAuthority); String string2 = obtainAttributes.getString(KtR.RVV.FontFamily_fontProviderPackage); String string3 = obtainAttributes.getString(KtR.RVV.FontFamily_fontProviderQuery); int resourceId = obtainAttributes.getResourceId(KtR.RVV.FontFamily_fontProviderCerts, 0); int integer = obtainAttributes.getInteger(KtR.RVV.FontFamily_fontProviderFetchStrategy, 1); int integer2 = obtainAttributes.getInteger(KtR.RVV.FontFamily_fontProviderFetchTimeout, 500); String string4 = obtainAttributes.getString(KtR.RVV.FontFamily_fontProviderSystemFontFamily); obtainAttributes.recycle(); if (string != null && string2 != null && string3 != null) { while (xmlPullParser.next() != 3) { b(xmlPullParser); } return new RVV(new WXG(string, string2, string3, nM_(resources, resourceId)), integer, integer2, string4); } ArrayList arrayList = new ArrayList(); while (xmlPullParser.next() != 3) { if (xmlPullParser.getEventType() == 2) { if (xmlPullParser.getName().equals("font")) { arrayList.add(nP_(xmlPullParser, resources)); } else { b(xmlPullParser); } } } if (arrayList.isEmpty()) { return null; } return new IeS((LWm[]) arrayList.toArray(new LWm[0])); } private static int nK_(TypedArray typedArray, int i) { return Sts.nQ_(typedArray, i); } public static List> nM_(Resources resources, int i) { if (i == 0) { return Collections.emptyList(); } TypedArray obtainTypedArray = resources.obtainTypedArray(i); try { if (obtainTypedArray.length() == 0) { return Collections.emptyList(); } ArrayList arrayList = new ArrayList(); if (nK_(obtainTypedArray, 0) == 1) { for (int i2 = 0; i2 < obtainTypedArray.length(); i2++) { int resourceId = obtainTypedArray.getResourceId(i2, 0); if (resourceId != 0) { arrayList.add(d(resources.getStringArray(resourceId))); } } } else { arrayList.add(d(resources.getStringArray(i))); } return arrayList; } finally { obtainTypedArray.recycle(); } } private static List d(String[] strArr) { ArrayList arrayList = new ArrayList(); for (String str : strArr) { arrayList.add(Base64.decode(str, 0)); } return arrayList; } private static LWm nP_(XmlPullParser xmlPullParser, Resources resources) throws XmlPullParserException, IOException { int i; int i2; int i3; int i4; int i5; TypedArray obtainAttributes = resources.obtainAttributes(Xml.asAttributeSet(xmlPullParser), KtR.RVV.FontFamilyFont); if (obtainAttributes.hasValue(KtR.RVV.FontFamilyFont_fontWeight)) { i = KtR.RVV.FontFamilyFont_fontWeight; } else { i = KtR.RVV.FontFamilyFont_android_fontWeight; } int i6 = obtainAttributes.getInt(i, TitleChanger.DEFAULT_ANIMATION_DELAY); if (obtainAttributes.hasValue(KtR.RVV.FontFamilyFont_fontStyle)) { i2 = KtR.RVV.FontFamilyFont_fontStyle; } else { i2 = KtR.RVV.FontFamilyFont_android_fontStyle; } boolean z = 1 == obtainAttributes.getInt(i2, 0); if (obtainAttributes.hasValue(KtR.RVV.FontFamilyFont_ttcIndex)) { i3 = KtR.RVV.FontFamilyFont_ttcIndex; } else { i3 = KtR.RVV.FontFamilyFont_android_ttcIndex; } if (obtainAttributes.hasValue(KtR.RVV.FontFamilyFont_fontVariationSettings)) { i4 = KtR.RVV.FontFamilyFont_fontVariationSettings; } else { i4 = KtR.RVV.FontFamilyFont_android_fontVariationSettings; } String string = obtainAttributes.getString(i4); int i7 = obtainAttributes.getInt(i3, 0); if (obtainAttributes.hasValue(KtR.RVV.FontFamilyFont_font)) { i5 = KtR.RVV.FontFamilyFont_font; } else { i5 = KtR.RVV.FontFamilyFont_android_font; } int resourceId = obtainAttributes.getResourceId(i5, 0); String string2 = obtainAttributes.getString(i5); obtainAttributes.recycle(); while (xmlPullParser.next() != 3) { b(xmlPullParser); } return new LWm(string2, i6, z, string, i7, resourceId); } private static void b(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException { int i = 1; while (i > 0) { int next = xmlPullParser.next(); if (next == 2) { i++; } else if (next == 3) { i--; } } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static class Sts { static int nQ_(TypedArray typedArray, int i) { return typedArray.getType(i); } } }