package u;

import E3.v;
import J4.e;
import P.p;
import Q2.i;
import a5.t;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.util.Xml;
import android.view.animation.AnticipateOvershootInterpolator;
import android.view.animation.PathInterpolator;
import java.io.IOException;
import java.util.ArrayList;
import kotlin.jvm.internal.o;
import m3.AbstractC2478m;
import org.xmlpull.v1.XmlPullParserException;
import p0.AbstractC2686D;
import p0.C2714u;
import q.AbstractC2751B;
import q.C2802u;
import q.InterfaceC2807y;
import q.X;
import s.AbstractC2894d;
import s.C2892b;
import t.AbstractC2931n;
import t.C2921d;
import t.C2925h;
import t.C2926i;
import t.C2932o;
import t.C2934q;
import t.C2935r;
import t.C2936s;
import t.C2937t;
import t.EnumC2927j;
import v0.M;
import x4.AbstractC3256v;

/* JADX INFO: renamed from: u.c, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractC2957c {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final EnumC2956b f24396a = EnumC2956b.f24391a;

    /* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
    public static final InterfaceC2807y a(TypedArray typedArray, Resources resources, Resources.Theme theme, int i6, InterfaceC2807y interfaceC2807y) throws XmlPullParserException, IOException {
        TypedArray typedArrayObtainAttributes;
        InterfaceC2807y interfaceC2807y2;
        InterfaceC2807y interfaceC2807y3;
        int resourceId = typedArray.getResourceId(i6, 0);
        if (resourceId == 0) {
            return interfaceC2807y;
        }
        InterfaceC2807y interfaceC2807y4 = (InterfaceC2807y) AbstractC2894d.f24016e.get(Integer.valueOf(resourceId));
        if (interfaceC2807y4 != null) {
            return interfaceC2807y4;
        }
        XmlResourceParser xml = resources.getXml(resourceId);
        AbstractC2955a.b(xml);
        AttributeSet attributeSetAsAttributeSet = Xml.asAttributeSet(xml);
        String name = xml.getName();
        if (name != null) {
            int iHashCode = name.hashCode();
            int[] iArr = AbstractC2955a.f24386h;
            switch (iHashCode) {
                case -2140409460:
                    if (name.equals("pathInterpolator")) {
                        int[] iArr2 = AbstractC2955a.f24390m;
                        if (theme == null || (typedArrayObtainAttributes = theme.obtainStyledAttributes(attributeSetAsAttributeSet, iArr2, 0, 0)) == null) {
                            TypedArray typedArrayObtainAttributes2 = resources.obtainAttributes(attributeSetAsAttributeSet, iArr2);
                        }
                        try {
                            String string = typedArrayObtainAttributes.getString(4);
                            return string != null ? new C2892b(new PathInterpolator(AbstractC2478m.f(string))) : (typedArrayObtainAttributes.hasValue(2) && typedArrayObtainAttributes.hasValue(3)) ? new C2802u(typedArrayObtainAttributes.getFloat(0, 0.0f), typedArrayObtainAttributes.getFloat(1, 0.0f), typedArrayObtainAttributes.getFloat(2, 1.0f), typedArrayObtainAttributes.getFloat(3, 1.0f)) : new C2892b(new PathInterpolator(typedArrayObtainAttributes.getFloat(0, 0.0f), typedArrayObtainAttributes.getFloat(1, 0.0f)));
                        } finally {
                        }
                    }
                    break;
                case -2120889007:
                    if (name.equals("anticipateInterpolator")) {
                        if (theme == null || (typedArrayObtainAttributes = theme.obtainStyledAttributes(attributeSetAsAttributeSet, iArr, 0, 0)) == null) {
                            TypedArray typedArrayObtainAttributes3 = resources.obtainAttributes(attributeSetAsAttributeSet, iArr);
                        }
                        try {
                            final float f6 = typedArrayObtainAttributes.getFloat(0, 2.0f);
                            final int i7 = 0;
                            return new InterfaceC2807y() { // from class: s.c
                                @Override // q.InterfaceC2807y
                                public final float a(float f7) {
                                    switch (i7) {
                                        case 0:
                                            float f8 = f6;
                                            return (((1 + f8) * f7) - f8) * f7 * f7;
                                        case 1:
                                            return (float) Math.pow(f7, f6 * 2);
                                        case 2:
                                            float f9 = f7 - 1.0f;
                                            float f10 = f6;
                                            return ((((f10 + 1.0f) * f9) + f10) * f9 * f9) + 1.0f;
                                        case 3:
                                            return (float) Math.sin(((double) (2 * f6)) * 3.141592653589793d * ((double) f7));
                                        default:
                                            return 1.0f - ((float) Math.pow(1.0f - f7, 2 * f6));
                                    }
                                }
                            };
                        } finally {
                        }
                    }
                    break;
                case -1248486260:
                    if (name.equals("linearInterpolator")) {
                        return AbstractC2751B.f23148d;
                    }
                    break;
                case -935873468:
                    if (name.equals("accelerateInterpolator")) {
                        int[] iArr3 = AbstractC2955a.f24387i;
                        if (theme == null || (typedArrayObtainAttributes = theme.obtainStyledAttributes(attributeSetAsAttributeSet, iArr3, 0, 0)) == null) {
                            TypedArray typedArrayObtainAttributes4 = resources.obtainAttributes(attributeSetAsAttributeSet, iArr3);
                        }
                        try {
                            final float f7 = typedArrayObtainAttributes.getFloat(0, 1.0f);
                            if (f7 == 1.0f) {
                                interfaceC2807y2 = AbstractC2894d.f24013b;
                            } else {
                                final int i8 = 1;
                                interfaceC2807y2 = new InterfaceC2807y() { // from class: s.c
                                    @Override // q.InterfaceC2807y
                                    public final float a(float f72) {
                                        switch (i8) {
                                            case 0:
                                                float f8 = f7;
                                                return (((1 + f8) * f72) - f8) * f72 * f72;
                                            case 1:
                                                return (float) Math.pow(f72, f7 * 2);
                                            case 2:
                                                float f9 = f72 - 1.0f;
                                                float f10 = f7;
                                                return ((((f10 + 1.0f) * f9) + f10) * f9 * f9) + 1.0f;
                                            case 3:
                                                return (float) Math.sin(((double) (2 * f7)) * 3.141592653589793d * ((double) f72));
                                            default:
                                                return 1.0f - ((float) Math.pow(1.0f - f72, 2 * f7));
                                        }
                                    }
                                };
                            }
                            return interfaceC2807y2;
                        } finally {
                        }
                    }
                    break;
                case -425326737:
                    if (name.equals("bounceInterpolator")) {
                        return AbstractC2894d.f24014c;
                    }
                    break;
                case 1192587314:
                    if (name.equals("overshootInterpolator")) {
                        int[] iArr4 = AbstractC2955a.l;
                        if (theme == null || (typedArrayObtainAttributes = theme.obtainStyledAttributes(attributeSetAsAttributeSet, iArr4, 0, 0)) == null) {
                            typedArrayObtainAttributes = resources.obtainAttributes(attributeSetAsAttributeSet, iArr4);
                        }
                        try {
                            final float f8 = typedArrayObtainAttributes.getFloat(0, 2.0f);
                            final int i9 = 2;
                            return new InterfaceC2807y() { // from class: s.c
                                @Override // q.InterfaceC2807y
                                public final float a(float f72) {
                                    switch (i9) {
                                        case 0:
                                            float f82 = f8;
                                            return (((1 + f82) * f72) - f82) * f72 * f72;
                                        case 1:
                                            return (float) Math.pow(f72, f8 * 2);
                                        case 2:
                                            float f9 = f72 - 1.0f;
                                            float f10 = f8;
                                            return ((((f10 + 1.0f) * f9) + f10) * f9 * f9) + 1.0f;
                                        case 3:
                                            return (float) Math.sin(((double) (2 * f8)) * 3.141592653589793d * ((double) f72));
                                        default:
                                            return 1.0f - ((float) Math.pow(1.0f - f72, 2 * f8));
                                    }
                                }
                            };
                        } finally {
                        }
                    }
                    break;
                case 1472030440:
                    if (name.equals("anticipateOvershootInterpolator")) {
                        if (theme == null || (typedArrayObtainAttributes = theme.obtainStyledAttributes(attributeSetAsAttributeSet, iArr, 0, 0)) == null) {
                            TypedArray typedArrayObtainAttributes5 = resources.obtainAttributes(attributeSetAsAttributeSet, iArr);
                        }
                        try {
                            return new C2892b(new AnticipateOvershootInterpolator(typedArrayObtainAttributes.getFloat(0, 2.0f), typedArrayObtainAttributes.getFloat(1, 1.5f)));
                        } finally {
                        }
                    }
                    break;
                case 1962594083:
                    if (name.equals("decelerateInterpolator")) {
                        int[] iArr5 = AbstractC2955a.f24388j;
                        if (theme == null || (typedArrayObtainAttributes = theme.obtainStyledAttributes(attributeSetAsAttributeSet, iArr5, 0, 0)) == null) {
                            TypedArray typedArrayObtainAttributes6 = resources.obtainAttributes(attributeSetAsAttributeSet, iArr5);
                        }
                        try {
                            final float f9 = typedArrayObtainAttributes.getFloat(0, 1.0f);
                            if (f9 == 1.0f) {
                                interfaceC2807y3 = AbstractC2894d.f24015d;
                            } else {
                                final int i10 = 4;
                                interfaceC2807y3 = new InterfaceC2807y() { // from class: s.c
                                    @Override // q.InterfaceC2807y
                                    public final float a(float f72) {
                                        switch (i10) {
                                            case 0:
                                                float f82 = f9;
                                                return (((1 + f82) * f72) - f82) * f72 * f72;
                                            case 1:
                                                return (float) Math.pow(f72, f9 * 2);
                                            case 2:
                                                float f92 = f72 - 1.0f;
                                                float f10 = f9;
                                                return ((((f10 + 1.0f) * f92) + f10) * f92 * f92) + 1.0f;
                                            case 3:
                                                return (float) Math.sin(((double) (2 * f9)) * 3.141592653589793d * ((double) f72));
                                            default:
                                                return 1.0f - ((float) Math.pow(1.0f - f72, 2 * f9));
                                        }
                                    }
                                };
                            }
                            return interfaceC2807y3;
                        } finally {
                        }
                    }
                    break;
                case 2019672672:
                    if (name.equals("accelerateDecelerateInterpolator")) {
                        return AbstractC2894d.f24012a;
                    }
                    break;
                case 2038238413:
                    if (name.equals("cycleInterpolator")) {
                        int[] iArr6 = AbstractC2955a.f24389k;
                        if (theme == null || (typedArrayObtainAttributes = theme.obtainStyledAttributes(attributeSetAsAttributeSet, iArr6, 0, 0)) == null) {
                            TypedArray typedArrayObtainAttributes7 = resources.obtainAttributes(attributeSetAsAttributeSet, iArr6);
                        }
                        try {
                            final float f10 = typedArrayObtainAttributes.getFloat(0, 1.0f);
                            final int i11 = 3;
                            return new InterfaceC2807y() { // from class: s.c
                                @Override // q.InterfaceC2807y
                                public final float a(float f72) {
                                    switch (i11) {
                                        case 0:
                                            float f82 = f10;
                                            return (((1 + f82) * f72) - f82) * f72 * f72;
                                        case 1:
                                            return (float) Math.pow(f72, f10 * 2);
                                        case 2:
                                            float f92 = f72 - 1.0f;
                                            float f102 = f10;
                                            return ((((f102 + 1.0f) * f92) + f102) * f92 * f92) + 1.0f;
                                        case 3:
                                            return (float) Math.sin(((double) (2 * f10)) * 3.141592653589793d * ((double) f72));
                                        default:
                                            return 1.0f - ((float) Math.pow(1.0f - f72, 2 * f10));
                                    }
                                }
                            };
                        } finally {
                        }
                    }
                    break;
            }
        }
        throw new RuntimeException("Unknown interpolator: " + xml.getName());
    }

    public static final C2925h b(TypedArray typedArray, float f6, InterfaceC2807y interfaceC2807y, EnumC2956b enumC2956b, int i6) {
        int iOrdinal = enumC2956b.ordinal();
        if (iOrdinal == 0) {
            return new C2925h(f6, Float.valueOf(typedArray.getFloat(i6, 0.0f)), interfaceC2807y);
        }
        if (iOrdinal == 1) {
            return new C2925h(f6, Integer.valueOf(typedArray.getInt(i6, 0)), interfaceC2807y);
        }
        if (iOrdinal == 2) {
            return new C2925h(f6, new C2714u(AbstractC2686D.c(typedArray.getColor(i6, 0))), interfaceC2807y);
        }
        if (iOrdinal == 3) {
            return new C2925h(f6, M.a(typedArray.getString(i6)), interfaceC2807y);
        }
        throw new v();
    }

    public static final AbstractC2931n c(TypedArray typedArray, String str, int i6, int i7, int i8, InterfaceC2807y interfaceC2807y, e eVar) {
        int i9 = typedArray.getInt(i6, 4);
        TypedValue typedValuePeekValue = typedArray.peekValue(i7);
        boolean z6 = typedValuePeekValue != null;
        int i10 = typedValuePeekValue != null ? typedValuePeekValue.type : 4;
        TypedValue typedValuePeekValue2 = typedArray.peekValue(i8);
        boolean z7 = typedValuePeekValue2 != null;
        EnumC2956b enumC2956bD = d(i9, i10, typedValuePeekValue2 != null ? typedValuePeekValue2.type : 4);
        ArrayList arrayList = new ArrayList();
        if (enumC2956bD == null && (z6 || z7)) {
            enumC2956bD = EnumC2956b.f24391a;
        }
        if (z6) {
            o.e(enumC2956bD);
            arrayList.add(b(typedArray, 0.0f, interfaceC2807y, enumC2956bD, i7));
        }
        if (z7) {
            o.e(enumC2956bD);
            arrayList.add(b(typedArray, 1.0f, interfaceC2807y, enumC2956bD, i8));
        }
        EnumC2956b enumC2956b = (EnumC2956b) eVar.invoke(enumC2956bD, arrayList);
        if (arrayList.size() > 1) {
            AbstractC3256v.J(arrayList, new i(14));
        }
        int iOrdinal = enumC2956b.ordinal();
        if (iOrdinal == 0) {
            return new C2935r(str, arrayList);
        }
        if (iOrdinal == 1) {
            return new C2936s(str);
        }
        if (iOrdinal == 2) {
            return new C2934q(str, arrayList);
        }
        if (iOrdinal == 3) {
            return new C2937t(str, arrayList);
        }
        throw new v();
    }

    public static final EnumC2956b d(int i6, int... iArr) {
        if (i6 == 0) {
            return EnumC2956b.f24391a;
        }
        if (i6 == 1) {
            return EnumC2956b.f24392b;
        }
        if (i6 == 2) {
            return EnumC2956b.f24394d;
        }
        if (i6 == 3) {
            return EnumC2956b.f24393c;
        }
        for (int i7 : iArr) {
            if (28 > i7 || i7 >= 32) {
                return null;
            }
        }
        return EnumC2956b.f24393c;
    }

    public static final C2921d e(Resources.Theme theme, Resources resources, XmlResourceParser xmlResourceParser, AttributeSet attributeSet) {
        TypedArray typedArrayObtainAttributes;
        int[] iArr = AbstractC2955a.f24382d;
        if (theme == null || (typedArrayObtainAttributes = theme.obtainStyledAttributes(attributeSet, iArr, 0, 0)) == null) {
            typedArrayObtainAttributes = resources.obtainAttributes(attributeSet, iArr);
        }
        try {
            int i6 = typedArrayObtainAttributes.getInt(0, 0);
            ArrayList arrayList = new ArrayList();
            xmlResourceParser.next();
            while (!AbstractC2955a.a(xmlResourceParser) && (xmlResourceParser.getEventType() != 3 || !o.c(xmlResourceParser.getName(), "set"))) {
                if (xmlResourceParser.getEventType() == 2) {
                    String name = xmlResourceParser.getName();
                    if (o.c(name, "set")) {
                        arrayList.add(e(theme, resources, xmlResourceParser, attributeSet));
                    } else if (o.c(name, "objectAnimator")) {
                        arrayList.add(f(theme, resources, xmlResourceParser, attributeSet));
                    }
                }
                xmlResourceParser.next();
            }
            C2921d c2921d = new C2921d(arrayList, i6 != 0 ? EnumC2927j.f24234b : EnumC2927j.f24233a);
            typedArrayObtainAttributes.recycle();
            return c2921d;
        } catch (Throwable th) {
            typedArrayObtainAttributes.recycle();
            throw th;
        }
    }

    public static final C2926i f(Resources.Theme theme, Resources resources, XmlResourceParser xmlResourceParser, AttributeSet attributeSet) {
        TypedArray typedArrayObtainAttributes;
        TypedArray typedArrayObtainAttributes2;
        ArrayList arrayList;
        int i6;
        int i7;
        int i8;
        ArrayList arrayList2;
        int i9;
        int i10;
        InterfaceC2807y interfaceC2807y;
        int i11;
        TypedArray typedArrayObtainAttributes3;
        TypedArray typedArray;
        Resources.Theme theme2 = theme;
        Resources resources2 = resources;
        AttributeSet attributeSet2 = attributeSet;
        int[] iArr = AbstractC2955a.f24381c;
        if (theme2 == null || (typedArrayObtainAttributes = theme2.obtainStyledAttributes(attributeSet2, iArr, 0, 0)) == null) {
            typedArrayObtainAttributes = resources2.obtainAttributes(attributeSet2, iArr);
        }
        TypedArray typedArray2 = typedArrayObtainAttributes;
        try {
            int[] iArr2 = AbstractC2955a.f24385g;
            if (theme2 == null || (typedArrayObtainAttributes2 = theme2.obtainStyledAttributes(attributeSet2, iArr2, 0, 0)) == null) {
                typedArrayObtainAttributes2 = resources2.obtainAttributes(attributeSet2, iArr2);
            }
            typedArray2 = typedArrayObtainAttributes2;
            try {
                InterfaceC2807y interfaceC2807yA = a(typedArray2, resources2, theme2, 0, AbstractC2894d.f24012a);
                ArrayList arrayList3 = new ArrayList();
                int i12 = 1;
                String string = typedArray2.getString(1);
                int i13 = 3;
                if (string != null) {
                    String string2 = typedArray2.getString(2);
                    o.e(string2);
                    String string3 = typedArray2.getString(3);
                    o.e(string3);
                    arrayList3.add(new C2932o(string2, string3, M.a(string), interfaceC2807yA));
                    arrayList = arrayList3;
                    i6 = 1;
                    i8 = 3;
                    i7 = 2;
                } else {
                    int i14 = 2;
                    String string4 = typedArray2.getString(0);
                    if (string4 != null) {
                        arrayList3.add(c(typedArray2, string4, 7, 5, 6, interfaceC2807yA, new t(18)));
                    }
                    xmlResourceParser.next();
                    while (!AbstractC2955a.a(xmlResourceParser) && (xmlResourceParser.getEventType() != i13 || !o.c(xmlResourceParser.getName(), "objectAnimator"))) {
                        if (xmlResourceParser.getEventType() == i14 && o.c(xmlResourceParser.getName(), "propertyValuesHolder")) {
                            int[] iArr3 = AbstractC2955a.f24383e;
                            if (theme2 == null || (typedArrayObtainAttributes3 = theme2.obtainStyledAttributes(attributeSet2, iArr3, 0, 0)) == null) {
                                typedArrayObtainAttributes3 = resources2.obtainAttributes(attributeSet2, iArr3);
                            }
                            try {
                                String string5 = typedArrayObtainAttributes3.getString(i13);
                                o.e(string5);
                                i9 = i12;
                                i10 = i14;
                                interfaceC2807y = interfaceC2807yA;
                                i11 = i13;
                                arrayList2 = arrayList3;
                                typedArray = typedArrayObtainAttributes3;
                                try {
                                    AbstractC2931n abstractC2931nC = c(typedArray, string5, 2, 0, 1, interfaceC2807y, new p(xmlResourceParser, resources2, theme2, attributeSet2, interfaceC2807y, 1));
                                    typedArray.recycle();
                                    arrayList2.add(abstractC2931nC);
                                } catch (Throwable th) {
                                    th = th;
                                    typedArray.recycle();
                                    throw th;
                                }
                            } catch (Throwable th2) {
                                th = th2;
                                typedArray = typedArrayObtainAttributes3;
                            }
                        } else {
                            arrayList2 = arrayList3;
                            i9 = i12;
                            i10 = i14;
                            interfaceC2807y = interfaceC2807yA;
                            i11 = i13;
                        }
                        xmlResourceParser.next();
                        theme2 = theme;
                        resources2 = resources;
                        attributeSet2 = attributeSet;
                        arrayList3 = arrayList2;
                        i12 = i9;
                        i13 = i11;
                        interfaceC2807yA = interfaceC2807y;
                        i14 = i10;
                    }
                    arrayList = arrayList3;
                    i6 = i12;
                    i7 = i14;
                    i8 = i13;
                }
                C2926i c2926i = new C2926i(typedArray2.getInt(i6, 300), typedArray2.getInt(i7, 0), typedArray2.getInt(i8, 0), typedArray2.getInt(4, 0) == i7 ? X.f23247b : X.f23246a, arrayList);
                typedArray2.recycle();
                typedArray2.recycle();
                return c2926i;
            } finally {
                typedArray2.recycle();
            }
        } catch (Throwable th3) {
            throw th3;
        }
    }
}
