package o; import android.content.res.ColorStateList; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Color; import android.util.AttributeSet; import android.util.TypedValue; import android.util.Xml; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.common.base.Ascii; import java.io.IOException; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; /* loaded from: classes.dex */ public final class kFD { private static final ThreadLocal c = new ThreadLocal<>(); public static ColorStateList nB_(Resources resources, int i, Resources.Theme theme) { try { return ny_(resources, resources.getXml(i), theme); } catch (Exception unused) { return null; } } public static ColorStateList ny_(Resources resources, XmlPullParser xmlPullParser, Resources.Theme theme) throws XmlPullParserException, IOException { int next; AttributeSet asAttributeSet = Xml.asAttributeSet(xmlPullParser); do { next = xmlPullParser.next(); if (next == 2) { break; } } while (next != 1); if (next != 2) { throw new XmlPullParserException("No start tag found"); } return nz_(resources, xmlPullParser, asAttributeSet, theme); } public static ColorStateList nz_(Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException { String name = xmlPullParser.getName(); if (!name.equals("selector")) { StringBuilder sb = new StringBuilder(); sb.append(xmlPullParser.getPositionDescription()); sb.append(": invalid color state list tag "); sb.append(name); throw new XmlPullParserException(sb.toString()); } return nC_(resources, xmlPullParser, attributeSet, theme); } /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Removed duplicated region for block: B:25:0x006a */ /* JADX WARN: Removed duplicated region for block: B:33:0x00a9 */ /* JADX WARN: Removed duplicated region for block: B:54:0x00e0 */ /* JADX WARN: Removed duplicated region for block: B:60:0x00f2 */ /* JADX WARN: Removed duplicated region for block: B:68:0x0071 */ /* JADX WARN: Type inference failed for: r7v5, types: [java.lang.Object[], java.lang.Object] */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private static android.content.res.ColorStateList nC_(android.content.res.Resources r17, org.xmlpull.v1.XmlPullParser r18, android.util.AttributeSet r19, android.content.res.Resources.Theme r20) throws org.xmlpull.v1.XmlPullParserException, java.io.IOException { /* Method dump skipped, instructions count: 291 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: o.kFD.nC_(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources$Theme):android.content.res.ColorStateList"); } private static boolean nD_(Resources resources, int i) { TypedValue nA_ = nA_(); resources.getValue(i, nA_, true); return nA_.type >= 28 && nA_.type <= 31; } private static TypedValue nA_() { ThreadLocal threadLocal = c; TypedValue typedValue = threadLocal.get(); if (typedValue != null) { return typedValue; } TypedValue typedValue2 = new TypedValue(); threadLocal.set(typedValue2); return typedValue2; } private static TypedArray nE_(Resources resources, Resources.Theme theme, AttributeSet attributeSet, int[] iArr) { if (theme == null) { return resources.obtainAttributes(attributeSet, iArr); } return theme.obtainStyledAttributes(attributeSet, iArr, 0, 0); } private static int d(int i, float f, float f2) { float f3; float f4; char c2; float f5; int i2 = i; float f6 = BitmapDescriptorFactory.HUE_RED; float f7 = 100.0f; boolean z = f2 >= BitmapDescriptorFactory.HUE_RED && f2 <= 100.0f; char c3 = Ascii.MIN; if (f == 1.0f && !z) { return i2; } int alpha = (int) ((Color.alpha(i) * f) + 0.5f); if (alpha < 0) { alpha = 0; } else if (alpha > 255) { alpha = 255; } if (z) { FEM a = FEM.a(i2, Eal.b); float f8 = a.b; float f9 = a.e; Eal eal = Eal.b; if (f9 >= 1.0d && Math.round(f2) > 0.0d && Math.round(f2) < 100.0d) { float min = f8 < BitmapDescriptorFactory.HUE_RED ? 0.0f : Math.min(360.0f, f8); float f10 = 0.0f; boolean z2 = true; FEM fem = null; float f11 = f9; while (true) { if (Math.abs(f10 - f9) >= 0.4f) { float f12 = 1000.0f; float f13 = f6; float f14 = f7; float f15 = 1000.0f; FEM fem2 = null; while (true) { if (Math.abs(f13 - f14) <= 0.01f) { f3 = min; f4 = f11; c2 = c3; break; } float f16 = ((f14 - f13) / 2.0f) + f13; int c4 = FEM.c(f16, f11, min, Eal.b).c(Eal.b); float c5 = C16404nyu.c(c4); float abs = Math.abs(f2 - c5); if (abs < 0.2f) { FEM a2 = FEM.a(c4, Eal.b); f4 = f11; FEM c6 = FEM.c(a2.d, a2.e, min, Eal.b); float f17 = a2.j - c6.j; f3 = min; float f18 = a2.a - c6.a; float f19 = a2.c - c6.c; float pow = (float) (Math.pow(Math.sqrt((f17 * f17) + (f18 * f18) + (f19 * f19)), 0.63d) * 1.41d); c2 = Ascii.MIN; if (pow <= 1.0f) { fem2 = a2; f15 = pow; f12 = abs; } } else { f3 = min; f4 = f11; c2 = c3; } f6 = BitmapDescriptorFactory.HUE_RED; if (f12 == BitmapDescriptorFactory.HUE_RED && f15 == BitmapDescriptorFactory.HUE_RED) { break; } c3 = c2; if (c5 < f2) { f13 = f16; } else { f14 = f16; } min = f3; f11 = f4; } if (!z2) { if (fem2 == null) { f9 = f4; } else { f10 = f4; fem = fem2; } f5 = ((f9 - f10) / 2.0f) + f10; c3 = c2; f7 = 100.0f; } else { if (fem2 != null) { i2 = fem2.c(eal); break; } f5 = ((f9 - f10) / 2.0f) + f10; c3 = c2; f7 = 100.0f; z2 = false; } f11 = f5; min = f3; } else if (fem != null) { i2 = fem.c(eal); } } } i2 = C16404nyu.c(f2); } return (i2 & 16777215) | (alpha << 24); } }