package d3;

import I0.AbstractC0303l;
import androidx.compose.runtime.MutableFloatState;
import androidx.compose.runtime.MutableState;
import androidx.media3.exoplayer.ExoPlayer;
import androidx.navigation.C1134i;
import com.debridstream.tv.screens.CloudManagerViewModel;
import com.debridstream.tv.screens.SearchRecommendationsViewModel;
import e1.C1962b;
import h3.C2078a2;
import h3.C2105e2;
import h3.p5;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.math.BigInteger;
import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
import n2.AbstractC2613d;
import n2.C2611b;
import n2.InterfaceC2618i;
import p5.AbstractC2732b;
import p5.AbstractC2747q;
import p5.AbstractC2749t;
import q.AbstractC2771e;
import q.C2784k0;
import v.AbstractC2981H0;
import v.C3003T;
import v.C3004T0;
import v.C3051u;
import v.C3053v;
import w4.C3137A;
import x.C3186o0;
import x4.AbstractC3251q;
import y2.C3263a;

/* JADX INFO: renamed from: d3.v0, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final /* synthetic */ class C1931v0 implements J4.a {

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

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

    public /* synthetic */ C1931v0(Object obj, int i6) {
        this.f16035a = i6;
        this.f16036b = obj;
    }

    /* JADX WARN: Can't wrap try/catch for region: R(8:63|213|64|(3:66|(3:244|98|99)(4:69|224|70|(2:72|(3:248|81|82)(6:76|210|77|78|80|(1:94)(2:249|95)))(3:245|84|85))|(2:250|111))|220|100|101|(0)) */
    /* JADX WARN: Code restructure failed: missing block: B:102:0x02b4, code lost:
    
        r0 = th;
     */
    /* JADX WARN: Finally extract failed */
    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:143:0x0329 A[Catch: all -> 0x02c5, TRY_LEAVE, TryCatch #2 {all -> 0x02c5, blocks: (B:48:0x017e, B:50:0x018c, B:51:0x0195, B:61:0x01f4, B:63:0x01ff, B:111:0x02c4, B:107:0x02bb, B:114:0x02c9, B:143:0x0329, B:150:0x0349, B:140:0x0323, B:156:0x0354, B:159:0x0364, B:160:0x036b, B:161:0x036c, B:162:0x036f, B:163:0x0370, B:164:0x0385, B:137:0x031e, B:64:0x0207, B:66:0x0210, B:69:0x0221, B:95:0x02a5, B:91:0x029e, B:98:0x02a9, B:99:0x02ae, B:52:0x019d, B:54:0x01a8, B:60:0x01d0, B:153:0x034c, B:154:0x0351, B:104:0x02b6), top: B:212:0x017e, inners: #0, #3, #4, #10 }] */
    /* JADX WARN: Removed duplicated region for block: B:250:0x02c4 A[SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:252:0x0349 A[SYNTHETIC] */
    @Override // J4.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invoke() {
        int iS0;
        ArrayList arrayList;
        long j4;
        p5.J j6;
        Throwable th;
        w4.k kVar;
        Throwable th2;
        Throwable th3;
        int iF;
        w4.k kVar2;
        long j7 = 0;
        boolean z6 = false;
        C3137A c3137a = C3137A.f25453a;
        Object obj = this.f16036b;
        switch (this.f16035a) {
            case 0:
                ((ExoPlayer) obj).setPlayWhenReady(!r7.getPlayWhenReady());
                return c3137a;
            case 1:
                return Float.valueOf(((MutableFloatState) obj).getFloatValue());
            case 2:
                C1962b c1962b = (C1962b) obj;
                if (((o0.e) c1962b.f16266c.getValue()).f21799a != 9205357640488583168L) {
                    MutableState mutableState = c1962b.f16266c;
                    if (!o0.e.e(((o0.e) mutableState.getValue()).f21799a)) {
                        return c1962b.f16264a.mo746createShaderuvyYCjk(((o0.e) mutableState.getValue()).f21799a);
                    }
                }
                return null;
            case 3:
                g5.c cVar = (g5.c) obj;
                i5.h hVarS = W.a.S("kotlinx.serialization.Polymorphic", i5.c.f19077j, new i5.g[0], new androidx.compose.runtime.snapshots.e(cVar, 5));
                Q4.c context = cVar.f16602a;
                kotlin.jvm.internal.o.h(context, "context");
                return new i5.b(hVarS, context);
            case 4:
                ((CloudManagerViewModel) obj).goBackFolder();
                return c3137a;
            case 5:
                return ((C2078a2) obj).f17715a.getSharedPreferences("debridstream_search_history", 0);
            case 6:
                SearchRecommendationsViewModel searchRecommendationsViewModel = (SearchRecommendationsViewModel) obj;
                return new w4.k(((C2105e2) searchRecommendationsViewModel.getUiState().getValue()).f17893c, Boolean.valueOf(((C2105e2) searchRecommendationsViewModel.getUiState().getValue()).f17894d));
            case 7:
                ((p5) obj).f18394a.invoke();
                return c3137a;
            case 8:
                i5.h hVar = (i5.h) obj;
                return Integer.valueOf(k5.P.f(hVar, hVar.f19097k));
            case 9:
                InterfaceC2618i interfaceC2618i = (InterfaceC2618i) obj;
                interfaceC2618i.getLifecycle().addObserver(new C2611b(interfaceC2618i, 0));
                return c3137a;
            case 10:
                return Float.valueOf(AbstractC2771e.l(((V4.C) obj).getCoroutineContext()));
            case 11:
                C2784k0 c2784k0 = (C2784k0) obj;
                q.A0 a02 = c2784k0.f23365e;
                c2784k0.f23366f = a02 != null ? ((Number) a02.l.getValue()).longValue() : 0L;
                return c3137a;
            case 12:
                q5.i iVar = (q5.i) obj;
                ClassLoader classLoader = iVar.f23765a;
                Enumeration<URL> resources = classLoader.getResources("");
                kotlin.jvm.internal.o.g(resources, "getResources(...)");
                ArrayList list = Collections.list(resources);
                kotlin.jvm.internal.o.g(list, "list(...)");
                ArrayList arrayList2 = new ArrayList();
                Iterator it = list.iterator();
                while (true) {
                    boolean zHasNext = it.hasNext();
                    AbstractC2749t abstractC2749t = iVar.f23766b;
                    if (!zHasNext) {
                        Enumeration<URL> resources2 = classLoader.getResources("META-INF/MANIFEST.MF");
                        kotlin.jvm.internal.o.g(resources2, "getResources(...)");
                        ArrayList<URL> list2 = Collections.list(resources2);
                        kotlin.jvm.internal.o.g(list2, "list(...)");
                        ArrayList arrayList3 = new ArrayList();
                        for (URL url : list2) {
                            kotlin.jvm.internal.o.e(url);
                            String string = url.toString();
                            kotlin.jvm.internal.o.g(string, "toString(...)");
                            if (S4.w.A0(string, "jar:file:", z6) && (iS0 = S4.p.S0(6, string, "!")) != -1) {
                                String str = p5.G.f23047b;
                                String strSubstring = string.substring(4, iS0);
                                kotlin.jvm.internal.o.g(strSubstring, "substring(...)");
                                p5.G gP = C1134i.p(new File(URI.create(strSubstring)));
                                AbstractC2747q abstractC2747qOpenReadOnly = abstractC2749t.openReadOnly(gP);
                                try {
                                    arrayList = arrayList3;
                                    long jI = abstractC2747qOpenReadOnly.i() - ((long) 22);
                                    if (jI < j7) {
                                        throw new IOException("not a zip: size=" + abstractC2747qOpenReadOnly.i());
                                    }
                                    long jMax = Math.max(jI - 65536, j7);
                                    while (true) {
                                        p5.J jC = AbstractC2732b.c(abstractC2747qOpenReadOnly.t(jI));
                                        try {
                                            j4 = j7;
                                            if (jC.f() == 101010256) {
                                                int iT = jC.t() & 65535;
                                                int iT2 = jC.t() & 65535;
                                                long jT = jC.t() & 65535;
                                                if (jT != (jC.t() & 65535) || iT != 0 || iT2 != 0) {
                                                    throw new IOException("unsupported zip: spanned");
                                                }
                                                jC.B(4L);
                                                long jF = ((long) jC.f()) & 4294967295L;
                                                int iT3 = jC.t() & 65535;
                                                q5.g gVar = new q5.g(jT, jF, iT3);
                                                jC.y(iT3);
                                                jC.close();
                                                long j8 = jI - ((long) 20);
                                                if (j8 > j4) {
                                                    jC = AbstractC2732b.c(abstractC2747qOpenReadOnly.t(j8));
                                                    try {
                                                    } catch (Throwable th4) {
                                                        try {
                                                        } catch (Throwable th5) {
                                                            AbstractC2613d.b(th4, th5);
                                                        }
                                                        th2 = th4;
                                                        break;
                                                    }
                                                    if (jC.f() == 117853008) {
                                                        int iF2 = jC.f();
                                                        long jG = jC.g();
                                                        if (jC.f() != 1 || iF2 != 0) {
                                                            throw new IOException("unsupported zip: spanned");
                                                        }
                                                        jC = AbstractC2732b.c(abstractC2747qOpenReadOnly.t(jG));
                                                        try {
                                                            iF = jC.f();
                                                        } catch (Throwable th6) {
                                                            try {
                                                            } catch (Throwable th7) {
                                                                AbstractC2613d.b(th6, th7);
                                                            }
                                                            th3 = th6;
                                                        }
                                                        if (iF != 101075792) {
                                                            throw new IOException("bad zip: expected " + q5.b.d(101075792) + " but was " + q5.b.d(iF));
                                                        }
                                                        jC.B(12L);
                                                        int iF3 = jC.f();
                                                        int iF4 = jC.f();
                                                        long jG2 = jC.g();
                                                        if (jG2 != jC.g() || iF3 != 0 || iF4 != 0) {
                                                            throw new IOException("unsupported zip: spanned");
                                                        }
                                                        jC.B(8L);
                                                        try {
                                                            th3 = null;
                                                        } catch (Throwable th8) {
                                                            th3 = th8;
                                                        }
                                                        gVar = new q5.g(jG2, jC.g(), iT3);
                                                        if (th3 != null) {
                                                            throw th3;
                                                        }
                                                        break;
                                                        if (th2 != null) {
                                                            throw th2;
                                                        }
                                                    }
                                                    th2 = null;
                                                    if (th2 != null) {
                                                    }
                                                }
                                                q5.g gVar2 = gVar;
                                                ArrayList arrayList4 = new ArrayList();
                                                p5.J jC2 = AbstractC2732b.c(abstractC2747qOpenReadOnly.t(gVar2.f23760b));
                                                try {
                                                    long j9 = gVar2.f23759a;
                                                    long j10 = j4;
                                                    while (j10 < j9) {
                                                        q5.j jVarE = q5.b.e(jC2);
                                                        j6 = jC2;
                                                        long j11 = j9;
                                                        try {
                                                            if (jVarE.f23775h >= gVar2.f23760b) {
                                                                throw new IOException("bad zip: local file header offset >= central directory offset");
                                                            }
                                                            p5.G g6 = q5.i.f23764d;
                                                            if (C1134i.f(jVarE.f23768a)) {
                                                                arrayList4.add(jVarE);
                                                            }
                                                            j10++;
                                                            jC2 = j6;
                                                            j9 = j11;
                                                        } catch (Throwable th9) {
                                                            th = th9;
                                                            Throwable th10 = th;
                                                            try {
                                                                j6.close();
                                                            } catch (Throwable th11) {
                                                                AbstractC2613d.b(th10, th11);
                                                            }
                                                            th = th10;
                                                            if (th == null) {
                                                            }
                                                        }
                                                        break;
                                                    }
                                                    try {
                                                        jC2.close();
                                                        th = null;
                                                    } catch (Throwable th12) {
                                                        th = th12;
                                                    }
                                                } catch (Throwable th13) {
                                                    th = th13;
                                                    j6 = jC2;
                                                }
                                                if (th == null) {
                                                    throw th;
                                                }
                                                p5.T t6 = new p5.T(gP, abstractC2749t, q5.b.b(arrayList4));
                                                try {
                                                    abstractC2747qOpenReadOnly.close();
                                                    break;
                                                } catch (Throwable unused) {
                                                }
                                                kVar = new w4.k(t6, q5.i.f23764d);
                                            } else {
                                                ArrayList arrayList5 = arrayList;
                                                jC.close();
                                                jI--;
                                                if (jI < jMax) {
                                                    throw new IOException("not a zip: end of central directory signature not found");
                                                }
                                                arrayList = arrayList5;
                                                j7 = j4;
                                            }
                                        } finally {
                                            jC.close();
                                        }
                                    }
                                } catch (Throwable th14) {
                                    if (abstractC2747qOpenReadOnly == null) {
                                        throw th14;
                                    }
                                    try {
                                        abstractC2747qOpenReadOnly.close();
                                        throw th14;
                                    } catch (Throwable th15) {
                                        AbstractC2613d.b(th14, th15);
                                        throw th14;
                                    }
                                }
                            } else {
                                j4 = j7;
                                arrayList = arrayList3;
                                kVar = null;
                            }
                            ArrayList arrayList6 = arrayList;
                            if (kVar != null) {
                                arrayList6.add(kVar);
                            }
                            arrayList3 = arrayList6;
                            j7 = j4;
                            z6 = false;
                        }
                        return AbstractC3251q.s0(arrayList3, arrayList2);
                    }
                    URL url2 = (URL) it.next();
                    kotlin.jvm.internal.o.e(url2);
                    if (kotlin.jvm.internal.o.c(url2.getProtocol(), "file")) {
                        String str2 = p5.G.f23047b;
                        kVar2 = new w4.k(abstractC2749t, C1134i.p(new File(url2.toURI())));
                    } else {
                        kVar2 = null;
                    }
                    if (kVar2 != null) {
                        arrayList2.add(kVar2);
                    }
                }
                break;
            case 13:
                J4.a aVar = ((C3003T) obj).f24786B;
                if (aVar != null) {
                    aVar.invoke();
                }
                return Boolean.TRUE;
            case 14:
                C3004T0 c3004t0 = (C3004T0) obj;
                C3053v c3053v = (C3053v) AbstractC0303l.h(c3004t0, AbstractC2981H0.f24734a);
                c3004t0.f24799p = c3053v;
                c3004t0.f24800q = c3053v != null ? new C3051u(c3053v.f24962a, c3053v.f24963b, c3053v.f24964c, c3053v.f24965d) : null;
                return c3137a;
            case 15:
                return (C3186o0) X4.l.a(((X4.e) obj).c());
            case 16:
                return kotlin.jvm.internal.o.k((Object[]) obj);
            case 17:
                C3263a c3263a = (C3263a) obj;
                Class<?> clsLoadClass = c3263a.f26178a.loadClass("androidx.window.extensions.WindowExtensionsProvider");
                kotlin.jvm.internal.o.g(clsLoadClass, "loadClass(...)");
                Method declaredMethod = clsLoadClass.getDeclaredMethod("getWindowExtensions", new Class[0]);
                Class<?> clsLoadClass2 = c3263a.f26178a.loadClass("androidx.window.extensions.WindowExtensions");
                kotlin.jvm.internal.o.g(clsLoadClass2, "loadClass(...)");
                kotlin.jvm.internal.o.e(declaredMethod);
                return Boolean.valueOf(declaredMethod.getReturnType().equals(clsLoadClass2) && Modifier.isPublic(declaredMethod.getModifiers()));
            default:
                z2.j jVar = (z2.j) obj;
                return BigInteger.valueOf(jVar.f26317a).shiftLeft(32).or(BigInteger.valueOf(jVar.f26318b)).shiftLeft(32).or(BigInteger.valueOf(jVar.f26319c));
        }
    }
}
