package defpackage;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Parcelable;
import android.text.Layout;
import android.text.SpannableString;
import android.text.Spanned;
import j$.util.Objects;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

/* JADX INFO: renamed from: ᵩᵖʾ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final /* synthetic */ class C3821 implements InterfaceC1793 {

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public final /* synthetic */ int f14595;

    public /* synthetic */ C3821(int i) {
        this.f14595 = i;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:148:0x0460  */
    /* JADX WARN: Removed duplicated region for block: B:151:0x0475  */
    /* JADX WARN: Removed duplicated region for block: B:154:0x0481  */
    /* JADX WARN: Removed duplicated region for block: B:155:0x0488  */
    /* JADX WARN: Removed duplicated region for block: B:158:0x0492  */
    /* JADX WARN: Removed duplicated region for block: B:159:0x0499  */
    /* JADX WARN: Removed duplicated region for block: B:162:0x04a3  */
    /* JADX WARN: Removed duplicated region for block: B:163:0x04aa  */
    /* JADX WARN: Removed duplicated region for block: B:166:0x04b4  */
    /* JADX WARN: Removed duplicated region for block: B:169:0x04c9  */
    /* JADX WARN: Removed duplicated region for block: B:172:0x04d5  */
    /* JADX WARN: Removed duplicated region for block: B:173:0x04dc  */
    /* JADX WARN: Removed duplicated region for block: B:176:0x04e6  */
    /* JADX WARN: Removed duplicated region for block: B:179:0x04f4  */
    /* JADX WARN: Removed duplicated region for block: B:181:0x04fb  */
    /* JADX WARN: Removed duplicated region for block: B:184:0x0507  */
    /* JADX WARN: Removed duplicated region for block: B:185:0x050a  */
    /* JADX WARN: Removed duplicated region for block: B:188:0x0514  */
    /* JADX WARN: Removed duplicated region for block: B:191:0x0522  */
    /* JADX WARN: Removed duplicated region for block: B:193:0x0529  */
    /* JADX WARN: Removed duplicated region for block: B:196:0x0533  */
    /* JADX WARN: Type inference failed for: r17v0 */
    /* JADX WARN: Type inference failed for: r17v1, types: [java.lang.CharSequence] */
    /* JADX WARN: Type inference failed for: r17v2 */
    /* JADX WARN: Type inference failed for: r1v1, types: [java.lang.CharSequence] */
    /* JADX WARN: Type inference failed for: r1v2 */
    /* JADX WARN: Type inference failed for: r1v3 */
    /* JADX WARN: Type inference failed for: r1v31, types: [android.text.Spannable, android.text.SpannableString] */
    @Override // defpackage.InterfaceC1793
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object apply(Object obj) {
        ?? r17;
        Bitmap bitmapDecodeByteArray;
        String str;
        float f;
        int i;
        String str2;
        float f2;
        int i2;
        String str3;
        int i3;
        int i4 = 2;
        int i5 = 17;
        int i6 = -1;
        boolean z = true;
        switch (this.f14595) {
            case 0:
                return ((InterfaceC4291) obj).mo1254().getClass().getSimpleName();
            case 1:
                Bundle bundle = (Bundle) obj;
                ?? charSequence = bundle.getCharSequence(C4847.f18468);
                if (charSequence != 0) {
                    ArrayList parcelableArrayList = bundle.getParcelableArrayList(C4847.f18475);
                    if (parcelableArrayList != null) {
                        charSequence = SpannableString.valueOf(charSequence);
                        int size = parcelableArrayList.size();
                        int i7 = 0;
                        while (i7 < size) {
                            Object obj2 = parcelableArrayList.get(i7);
                            i7++;
                            Bundle bundle2 = (Bundle) obj2;
                            int i8 = bundle2.getInt(AbstractC4019.f15468);
                            int i9 = bundle2.getInt(AbstractC4019.f15465);
                            int i10 = bundle2.getInt(AbstractC4019.f15466);
                            int i11 = bundle2.getInt(AbstractC4019.f15469, i6);
                            Bundle bundle3 = bundle2.getBundle(AbstractC4019.f15467);
                            if (i11 == 1) {
                                bundle3.getClass();
                                String string = bundle3.getString(C4192.f15990);
                                string.getClass();
                                charSequence.setSpan(new C4192(bundle3.getInt(C4192.f15991), string), i8, i9, i10);
                            } else if (i11 == i4) {
                                bundle3.getClass();
                                charSequence.setSpan(new C0480(bundle3.getInt(C0480.f2573), bundle3.getInt(C0480.f2572), bundle3.getInt(C0480.f2574)), i8, i9, i10);
                            } else if (i11 == 3) {
                                charSequence.setSpan(new C0176(), i8, i9, i10);
                            } else if (i11 == 4) {
                                bundle3.getClass();
                                String string2 = bundle3.getString(C5479.f20727);
                                string2.getClass();
                                charSequence.setSpan(new C5479(string2), i8, i9, i10);
                            }
                            i4 = 2;
                            i6 = -1;
                        }
                    }
                } else {
                    charSequence = 0;
                }
                Layout.Alignment alignment = (Layout.Alignment) bundle.getSerializable(C4847.f18471);
                Layout.Alignment alignment2 = alignment != null ? alignment : null;
                Layout.Alignment alignment3 = (Layout.Alignment) bundle.getSerializable(C4847.f18473);
                Layout.Alignment alignment4 = alignment3 != null ? alignment3 : null;
                Bitmap bitmap = (Bitmap) bundle.getParcelable(C4847.f18478);
                if (bitmap != null) {
                    bitmapDecodeByteArray = bitmap;
                } else {
                    byte[] byteArray = bundle.getByteArray(C4847.f18477);
                    if (byteArray == null) {
                        r17 = charSequence;
                        bitmapDecodeByteArray = null;
                        str = C4847.f18480;
                        if (!bundle.containsKey(str)) {
                            String str4 = C4847.f18481;
                            if (bundle.containsKey(str4)) {
                                f = bundle.getFloat(str);
                                i = bundle.getInt(str4);
                            } else {
                                f = -3.4028235E38f;
                                i = Integer.MIN_VALUE;
                            }
                        }
                        String str5 = C4847.f18482;
                        int i12 = !bundle.containsKey(str5) ? bundle.getInt(str5) : Integer.MIN_VALUE;
                        String str6 = C4847.f18467;
                        float f3 = !bundle.containsKey(str6) ? bundle.getFloat(str6) : -3.4028235E38f;
                        String str7 = C4847.f18474;
                        int i13 = !bundle.containsKey(str7) ? bundle.getInt(str7) : Integer.MIN_VALUE;
                        str2 = C4847.f18476;
                        if (!bundle.containsKey(str2)) {
                            String str8 = C4847.f18483;
                            if (bundle.containsKey(str8)) {
                                f2 = bundle.getFloat(str2);
                                i2 = bundle.getInt(str8);
                            } else {
                                f2 = -3.4028235E38f;
                                i2 = Integer.MIN_VALUE;
                            }
                        }
                        String str9 = C4847.f18464;
                        float f4 = !bundle.containsKey(str9) ? bundle.getFloat(str9) : -3.4028235E38f;
                        String str10 = C4847.f18479;
                        float f5 = bundle.containsKey(str10) ? bundle.getFloat(str10) : -3.4028235E38f;
                        str3 = C4847.f18469;
                        if (bundle.containsKey(str3)) {
                            i3 = -16777216;
                            z = false;
                        } else {
                            i3 = bundle.getInt(str3);
                        }
                        int i14 = i3;
                        boolean z2 = bundle.getBoolean(C4847.f18466, false) ? false : z;
                        String str11 = C4847.f18465;
                        int i15 = bundle.containsKey(str11) ? bundle.getInt(str11) : Integer.MIN_VALUE;
                        String str12 = C4847.f18472;
                        float f6 = !bundle.containsKey(str12) ? bundle.getFloat(str12) : 0.0f;
                        String str13 = C4847.f18470;
                        return new C4847(r17, alignment2, alignment4, bitmapDecodeByteArray, f, i, i12, f3, i13, i2, f2, f4, f5, z2, i14, i15, f6, bundle.containsKey(str13) ? bundle.getInt(str13) : 0);
                    }
                    bitmapDecodeByteArray = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
                }
                r17 = 0;
                str = C4847.f18480;
                if (!bundle.containsKey(str)) {
                }
                String str52 = C4847.f18482;
                if (!bundle.containsKey(str52)) {
                }
                String str62 = C4847.f18467;
                if (!bundle.containsKey(str62)) {
                }
                String str72 = C4847.f18474;
                if (!bundle.containsKey(str72)) {
                }
                str2 = C4847.f18476;
                if (!bundle.containsKey(str2)) {
                }
                String str92 = C4847.f18464;
                if (!bundle.containsKey(str92)) {
                }
                String str102 = C4847.f18479;
                float f52 = bundle.containsKey(str102) ? bundle.getFloat(str102) : -3.4028235E38f;
                str3 = C4847.f18469;
                if (bundle.containsKey(str3)) {
                }
                int i142 = i3;
                if (bundle.getBoolean(C4847.f18466, false)) {
                }
                String str112 = C4847.f18465;
                int i152 = bundle.containsKey(str112) ? bundle.getInt(str112) : Integer.MIN_VALUE;
                String str122 = C4847.f18472;
                float f62 = !bundle.containsKey(str122) ? bundle.getFloat(str122) : 0.0f;
                String str132 = C4847.f18470;
                return new C4847(r17, alignment2, alignment4, bitmapDecodeByteArray, f, i, i12, f3, i13, i2, f2, f4, f52, z2, i142, i152, f62, bundle.containsKey(str132) ? bundle.getInt(str132) : 0);
            case 2:
                C4847 c4847 = (C4847) obj;
                Bitmap bitmap2 = c4847.f18499;
                Bundle bundle4 = new Bundle();
                CharSequence charSequence2 = c4847.f18496;
                if (charSequence2 != null) {
                    bundle4.putCharSequence(C4847.f18468, charSequence2);
                    if (charSequence2 instanceof Spanned) {
                        Spanned spanned = (Spanned) charSequence2;
                        String str14 = AbstractC4019.f15468;
                        ArrayList<? extends Parcelable> arrayList = new ArrayList<>();
                        for (C4192 c4192 : (C4192[]) spanned.getSpans(0, spanned.length(), C4192.class)) {
                            c4192.getClass();
                            Bundle bundle5 = new Bundle();
                            bundle5.putString(C4192.f15990, c4192.f15993);
                            bundle5.putInt(C4192.f15991, c4192.f15992);
                            arrayList.add(AbstractC4019.m8830(spanned, c4192, 1, bundle5));
                        }
                        for (C0480 c0480 : (C0480[]) spanned.getSpans(0, spanned.length(), C0480.class)) {
                            c0480.getClass();
                            Bundle bundle6 = new Bundle();
                            bundle6.putInt(C0480.f2573, c0480.f2577);
                            bundle6.putInt(C0480.f2572, c0480.f2575);
                            bundle6.putInt(C0480.f2574, c0480.f2576);
                            arrayList.add(AbstractC4019.m8830(spanned, c0480, 2, bundle6));
                        }
                        for (C0176 c0176 : (C0176[]) spanned.getSpans(0, spanned.length(), C0176.class)) {
                            arrayList.add(AbstractC4019.m8830(spanned, c0176, 3, null));
                        }
                        for (C5479 c5479 : (C5479[]) spanned.getSpans(0, spanned.length(), C5479.class)) {
                            c5479.getClass();
                            Bundle bundle7 = new Bundle();
                            bundle7.putString(C5479.f20727, c5479.f20728);
                            arrayList.add(AbstractC4019.m8830(spanned, c5479, 4, bundle7));
                        }
                        if (!arrayList.isEmpty()) {
                            bundle4.putParcelableArrayList(C4847.f18475, arrayList);
                        }
                    }
                }
                bundle4.putSerializable(C4847.f18471, c4847.f18484);
                bundle4.putSerializable(C4847.f18473, c4847.f18488);
                bundle4.putFloat(C4847.f18480, c4847.f18491);
                bundle4.putInt(C4847.f18481, c4847.f18501);
                bundle4.putInt(C4847.f18482, c4847.f18497);
                bundle4.putFloat(C4847.f18467, c4847.f18486);
                bundle4.putInt(C4847.f18474, c4847.f18500);
                bundle4.putInt(C4847.f18483, c4847.f18487);
                bundle4.putFloat(C4847.f18476, c4847.f18492);
                bundle4.putFloat(C4847.f18464, c4847.f18495);
                bundle4.putFloat(C4847.f18479, c4847.f18498);
                bundle4.putBoolean(C4847.f18466, c4847.f18493);
                bundle4.putInt(C4847.f18469, c4847.f18489);
                bundle4.putInt(C4847.f18465, c4847.f18490);
                bundle4.putFloat(C4847.f18472, c4847.f18494);
                bundle4.putInt(C4847.f18470, c4847.f18485);
                if (bitmap2 != null) {
                    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                    ᵻᵪ.ˌᴵ(bitmap2.compress(Bitmap.CompressFormat.PNG, 0, byteArrayOutputStream));
                    bundle4.putByteArray(C4847.f18477, byteArrayOutputStream.toByteArray());
                }
                return bundle4;
            case 3:
                return Integer.valueOf(((C4847) obj).f18485);
            case 4:
                long j = ((C5508) obj).f20801;
                if (j == -9223372036854775807L) {
                    j = 0;
                }
                return Long.valueOf(j);
            case 5:
                return AbstractC4509.m9553(Integer.valueOf(((C4245) obj).f16186));
            case C5224.STRING_SET_FIELD_NUMBER /* 6 */:
                return new C5084((C2353) obj);
            case C5224.DOUBLE_FIELD_NUMBER /* 7 */:
                C2700 c2700 = (C2700) obj;
                return c2700.f10390 + ": " + c2700.f10389;
            case C5224.BYTES_FIELD_NUMBER /* 8 */:
                return (C2476) obj;
            case 9:
                C4818 c4818 = (C4818) obj;
                c4818.m10047();
                return AbstractC4509.m9559(ᵫﾞˌ.ᵨᵼⁱ(c4818.f18331.f20787, new C3821(i5)));
            case 10:
                String str15 = (String) obj;
                C1353 c1353 = C0947.f4114;
                c1353.getClass();
                int length = str15.length() - 1;
                while (true) {
                    if (length >= 0) {
                        if (c1353.mo3871(str15.charAt(length))) {
                            length--;
                        } else {
                            z = false;
                        }
                    }
                }
                if (z && !str15.isEmpty()) {
                    return str15;
                }
                StringBuilder sb = new StringBuilder(str15.length() + 16);
                sb.append('\"');
                while (i < str15.length()) {
                    char cCharAt = str15.charAt(i);
                    if (cCharAt == '\r' || cCharAt == '\\' || cCharAt == '\"') {
                        sb.append('\\');
                    }
                    sb.append(cCharAt);
                    i++;
                }
                sb.append('\"');
                return sb.toString();
            case 11:
                Collection collection = (Collection) obj;
                int i16 = AbstractC3508.f13470;
                if (collection instanceof AbstractC3508) {
                    return (AbstractC3508) collection;
                }
                boolean z3 = collection instanceof AbstractC3508;
                int size2 = z3 ? ((C2800) ((C3783) ((AbstractC3508) collection)).mo8010()).size() : 11;
                C0942 c0942 = new C0942();
                c0942.f4106 = false;
                C3479 c3479 = new C3479();
                c3479.m7915(size2);
                c0942.f4107 = c3479;
                if (z3) {
                    AbstractC3508 abstractC3508 = (AbstractC3508) collection;
                    C3479 c34792 = abstractC3508 instanceof C3783 ? ((C3783) abstractC3508).f14382 : null;
                    if (c34792 != null) {
                        c3479.m7913(Math.max(c3479.f13390, c34792.f13390));
                        i = c34792.f13390 == 0 ? -1 : 0;
                        while (i >= 0) {
                            ᵻᵪ.ˋˈ(i, c34792.f13390);
                            Object obj3 = c34792.f13392[i];
                            ᵻᵪ.ˋˈ(i, c34792.f13390);
                            c0942.m3188(c34792.f13389[i], obj3);
                            i++;
                            if (i >= c34792.f13390) {
                                i = -1;
                            }
                        }
                    } else {
                        AbstractC5291 abstractC5291M8009 = abstractC3508.m8009();
                        C3479 c34793 = c0942.f4107;
                        c34793.m7913(Math.max(c34793.f13390, abstractC5291M8009.size()));
                        for (C5092 c5092 : abstractC3508.m8009()) {
                            c0942.m3188(c5092.m10573(), c5092.f19188);
                        }
                    }
                } else {
                    Iterator it = collection.iterator();
                    while (it.hasNext()) {
                        c0942.mo1608(it.next());
                    }
                }
                Objects.requireNonNull(c0942.f4107);
                if (c0942.f4107.f13390 == 0) {
                    return C3783.f14380;
                }
                c0942.f4106 = true;
                return new C3783(c0942.f4107);
            case 12:
                return Long.valueOf(((C5508) obj).f20801);
            case 13:
                return Long.valueOf(((C5508) obj).f20802);
            case 14:
                return AbstractC4509.m9559(ᵫﾞˌ.ᵨᵼⁱ(((InterfaceC0472) obj).mo1936().f20787, new C3821(i5)));
            case 15:
                return (C2476) obj;
            case 16:
                return AbstractC4509.m9553(Integer.valueOf(((C4245) obj).f16186));
            default:
                return Integer.valueOf(((C1882) obj).f7460);
        }
    }
}
