package B2;

import B.V;
import E.D;
import F.K;
import F.d0;
import F.f0;
import G.C0227b;
import G.u;
import G.v;
import G0.InterfaceC0279y;
import K.C0464l0;
import K.C0483v0;
import K.S0;
import K.V0;
import K.X;
import M2.B1;
import S4.w;
import T0.C0596g;
import T0.C0604o;
import T0.L;
import T0.N;
import V.i0;
import V.k0;
import V.q0;
import V2.AbstractC0693m0;
import V2.C0691l3;
import V2.n3;
import V2.t3;
import V2.u3;
import V4.B0;
import V4.E;
import V4.InterfaceC0765i0;
import Y4.c0;
import Z0.y;
import a0.C0903h0;
import a0.I1;
import a3.T;
import a3.b0;
import android.app.ActivityOptions;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.SystemClock;
import android.util.Log;
import android.view.textclassifier.TextClassification;
import androidx.compose.runtime.ComposerImpl;
import androidx.compose.runtime.ControlledComposition;
import androidx.compose.runtime.MovableContentStateReference;
import androidx.compose.runtime.MutableLongState;
import androidx.compose.runtime.MutableState;
import androidx.compose.runtime.NextFrameEndCallbackQueue;
import androidx.compose.runtime.RecomposeScope;
import androidx.compose.runtime.Recomposer;
import androidx.compose.runtime.State;
import androidx.compose.runtime.retain.RetainKt;
import androidx.compose.runtime.retain.RetainedValueHolder;
import androidx.compose.runtime.retain.RetainedValuesStore;
import androidx.compose.runtime.saveable.SaveableStateHolder;
import androidx.compose.runtime.saveable.SaveableStateRegistry;
import androidx.compose.runtime.snapshots.SnapshotStateList;
import androidx.compose.runtime.tooling.CompositionErrorContextImpl;
import androidx.navigation.B;
import androidx.navigation.H;
import com.debridstream.tv.AuthViewModel;
import com.debridstream.tv.data.home.HomeMetaItem;
import com.debridstream.tv.screens.VideoDetailsViewModel;
import e.C1956j;
import h3.z5;
import java.util.Iterator;
import java.util.concurrent.CopyOnWriteArrayList;
import kotlin.jvm.internal.C;
import n.O;
import o0.C2631b;
import q.AbstractC2761L;
import q.F0;
import w4.C3137A;
import x4.AbstractC3257w;
import x4.z;

/* JADX INFO: loaded from: classes.dex */
public final /* synthetic */ class j implements J4.a {

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

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

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

    public /* synthetic */ j(int i6, Object obj, Object obj2) {
        this.f476a = i6;
        this.f477b = obj;
        this.f478c = obj2;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:109:0x0214  */
    /* JADX WARN: Removed duplicated region for block: B:166:0x03a8  */
    /* JADX WARN: Type inference failed for: r7v16, types: [C4.j, J4.c] */
    @Override // J4.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invoke() throws PendingIntent.CanceledException {
        C0596g c0596g;
        long jFloatToRawIntBits;
        C0596g c0596gO;
        long j4;
        S0 s0D;
        C0464l0 c0464l0;
        C0596g c0596g2;
        String str;
        C3137A c3137a = C3137A.f25453a;
        Object obj = this.f478c;
        Object obj2 = this.f477b;
        switch (this.f476a) {
            case 0:
                ((C2.a) ((b) obj2).f461c).b((i) obj);
                return c3137a;
            case 1:
                E.j jVar = (E.j) ((State) obj2).getValue();
                D d6 = (D) obj;
                return new E.k(d6, jVar, new f0((P4.g) d6.f967d.f751f.getValue(), jVar));
            case 2:
                return new d0((SaveableStateRegistry) obj2, z.f26066a, (SaveableStateHolder) obj);
            case 3:
                u uVar = (u) ((State) obj2).getValue();
                C0227b c0227b = (C0227b) obj;
                return new v(c0227b, uVar, new f0((P4.g) ((K) c0227b.f1691d.f1649f).getValue(), uVar));
            case 4:
                y yVar = (y) obj2;
                MutableState mutableState = (MutableState) obj;
                if (N.b(yVar.f9137b, ((y) mutableState.getValue()).f9137b)) {
                    if (!kotlin.jvm.internal.o.c(yVar.f9138c, ((y) mutableState.getValue()).f9138c)) {
                        mutableState.setValue(yVar);
                    }
                }
                return c3137a;
            case 5:
                V0 v02 = (V0) obj2;
                if (v02 != null) {
                    SnapshotStateList snapshotStateList = v02.f3755c;
                    if (snapshotStateList.isEmpty()) {
                        c0596g = v02.f3754b;
                    } else {
                        C0483v0 c0483v0 = new C0483v0(v02.f3754b);
                        int size = snapshotStateList.size();
                        while (i < size) {
                            ((J4.c) snapshotStateList.get(i)).invoke(c0483v0);
                            i++;
                        }
                        c0596g = c0483v0.f4004b;
                    }
                    v02.f3754b = c0596g;
                    if (c0596g != null) {
                        return c0596g;
                    }
                }
                return (C0596g) obj;
            case 6:
                HomeMetaItem homeMetaItem = (HomeMetaItem) obj2;
                if (homeMetaItem != null) {
                    ((J4.c) obj).invoke(homeMetaItem);
                }
                return c3137a;
            case 7:
                ((VideoDetailsViewModel) obj2).requestRestorePlayFocus();
                ((J4.a) obj).invoke();
                return c3137a;
            case 8:
                ((J4.c) obj2).invoke((String) obj);
                return c3137a;
            case 9:
                a5.c cVar = u3.f8110a;
                V v3 = new V((b0) obj2, 15);
                c0 c0Var = u3.f8111b;
                n3 current = (n3) c0Var.getValue();
                kotlin.jvm.internal.o.h(current, "current");
                n3 n3VarA = n3.a(current, (C0691l3) v3.invoke(current.f7971a), null, null, null, null, null, null, null, 0, 510);
                c0Var.getClass();
                c0Var.k(null, n3VarA);
                E.y(u3.f8110a, null, null, new t3(n3VarA, null), 3);
                J.f fVar = B1.f4224a;
                ((MutableState) obj).setValue(Boolean.FALSE);
                return c3137a;
            case 10:
                ((J4.a) obj2).invoke();
                Iterator it = ((CopyOnWriteArrayList) obj).iterator();
                while (it.hasNext()) {
                    ((InterfaceC0765i0) it.next()).cancel(null);
                }
                return c3137a;
            case 11:
                ((C) obj2).f20115a = ((J4.a) obj).invoke();
                return c3137a;
            case 12:
                return new h1.j(W.c.T(((R.e) obj2).s0((InterfaceC0279y) ((J4.a) obj).invoke())));
            case 13:
                ((N.d) obj2).f5117d.invoke((N.g) obj);
                return c3137a;
            case 14:
                TextClassification textClassification = (TextClassification) obj;
                String text = textClassification.getText();
                PendingIntent activity = PendingIntent.getActivity((Context) obj2, text != null ? text.hashCode() : 0, textClassification.getIntent(), 201326592);
                if (Build.VERSION.SDK_INT >= 34) {
                    try {
                        activity.send(ActivityOptions.makeBasic().setPendingIntentBackgroundActivityStartMode(1).toBundle());
                    } catch (PendingIntent.CanceledException e6) {
                        Log.e("TextClassification", "error sending pendingIntent: " + activity + " error: " + e6);
                    }
                    break;
                } else {
                    activity.send();
                }
                return c3137a;
            case 15:
                return ((S4.m) obj2).b((String) obj);
            case 16:
                E.y((V4.C) obj2, null, V4.D.f8228d, new q0((C4.j) obj, null), 1);
                return c3137a;
            case 17:
                long j6 = ((h1.l) ((MutableState) obj).getValue()).f16627a;
                i0 i0Var = (i0) obj2;
                C2631b c2631bK = i0Var.k();
                if (c2631bK == null || (c0596gO = i0Var.o()) == null || c0596gO.f6510b.length() == 0) {
                    jFloatToRawIntBits = 9205357640488583168L;
                } else {
                    X x6 = (X) i0Var.f7097r.getValue();
                    int i6 = x6 == null ? -1 : k0.f7117a[x6.ordinal()];
                    if (i6 != -1) {
                        if (i6 == 1 || i6 == 2) {
                            long j7 = i0Var.p().f9137b;
                            int i7 = N.f6482c;
                            j4 = j7 >> 32;
                        } else {
                            if (i6 != 3) {
                                throw new E3.v();
                            }
                            long j8 = i0Var.p().f9137b;
                            int i8 = N.f6482c;
                            j4 = j8 & 4294967295L;
                        }
                        int i9 = (int) j4;
                        C0464l0 c0464l02 = i0Var.f7084d;
                        if (c0464l02 != null && (s0D = c0464l02.d()) != null && (c0464l0 = i0Var.f7084d) != null && (c0596g2 = c0464l0.f3889a.f4018a) != null) {
                            int iV = L4.a.v(i0Var.f7082b.b(i9), 0, c0596g2.f6510b.length());
                            float fIntBitsToFloat = Float.intBitsToFloat((int) (s0D.d(c2631bK.f21785a) >> 32));
                            L l = s0D.f3742a;
                            C0604o c0604o = l.f6472b;
                            int iD = c0604o.d(iV);
                            float fD = l.d(iD);
                            float fE = l.e(iD);
                            float fU = L4.a.u(fIntBitsToFloat, Math.min(fD, fE), Math.max(fD, fE));
                            if (h1.l.a(j6, 0L) || Math.abs(fIntBitsToFloat - fU) <= ((int) (j6 >> 32)) / 2) {
                                float f6 = c0604o.f(iD);
                                jFloatToRawIntBits = (((long) Float.floatToRawIntBits(fU)) << 32) | (((long) Float.floatToRawIntBits(((c0604o.b(iD) - f6) / 2) + f6)) & 4294967295L);
                            }
                        }
                    }
                }
                return new C2631b(jFloatToRawIntBits);
            case 18:
                Intent intentBuildGoogleSignInIntent = ((AuthViewModel) obj2).buildGoogleSignInIntent();
                if (intentBuildGoogleSignInIntent != null) {
                    ((C1956j) obj).a(intentBuildGoogleSignInIntent);
                }
                return c3137a;
            case 19:
                long jUptimeMillis = SystemClock.uptimeMillis();
                MutableLongState mutableLongState = (MutableLongState) obj;
                if (jUptimeMillis - mutableLongState.getLongValue() >= 500) {
                    mutableLongState.setLongValue(jUptimeMillis);
                    F0 f0 = AbstractC0693m0.f7892a;
                    H h5 = (H) obj2;
                    B bG = h5.g();
                    String str2 = bG != null ? bG.f12645j : null;
                    if (w.A0(str2 != null ? str2 : "", "collection_hub", false)) {
                        h5.o();
                    }
                }
                return c3137a;
            case 20:
                F0 f02 = AbstractC0693m0.f7892a;
                State state = (State) obj;
                HomeMetaItem homeMetaItem2 = ((z5) state.getValue()).f18777a;
                if (homeMetaItem2 != null) {
                    X2.g gVar = ((z5) state.getValue()).f18778b;
                    String string = (gVar == null || (str = gVar.f8587n) == null) ? null : S4.p.o1(str).toString();
                    String str3 = string != null ? string : "";
                    if (!S4.p.Q0(str3)) {
                        String str4 = kotlin.jvm.internal.o.c(homeMetaItem2.getType(), "tv") ? "tv" : "movies";
                        String strEncode = Uri.encode("More Like " + homeMetaItem2.getTitle());
                        String strEncode2 = Uri.encode(str3);
                        int tmdbId = homeMetaItem2.getTmdbId();
                        i = tmdbId >= 0 ? tmdbId : 0;
                        StringBuilder sbI = AbstractC2761L.i("catalog_browse/related/", strEncode2, "?title=", strEncode, "&media=");
                        sbI.append(str4);
                        sbI.append("&tmdb=");
                        sbI.append(i);
                        H.n((H) obj2, sbI.toString(), null, 6);
                    }
                }
                return c3137a;
            case 21:
                C0903h0 c0903h0 = (C0903h0) obj;
                I1 i12 = (I1) obj2;
                if (!kotlin.jvm.internal.o.c(i12, c0903h0.f9919a)) {
                    AbstractC3257w.P(new V(i12, 26), c0903h0.f9920b);
                    RecomposeScope recomposeScope = c0903h0.f9921c;
                    if (recomposeScope != null) {
                        recomposeScope.invalidate();
                    }
                }
                return c3137a;
            case 22:
                a3.K k6 = (a3.K) obj2;
                k6.f10565b++;
                B0 b02 = k6.f10564a;
                if (b02 != null) {
                    b02.cancel(null);
                }
                ((J4.c) obj).invoke(Boolean.FALSE);
                return c3137a;
            case 23:
                J4.a aVar = (J4.a) obj2;
                if (aVar != null) {
                    aVar.invoke();
                }
                ((J4.a) obj).invoke();
                return c3137a;
            case 24:
                ((J4.c) obj2).invoke(((T) obj).f10589a);
                return c3137a;
            case 25:
                return ComposerImpl.insertMovableContentGuarded$lambda$0$0$1$0$0$0$0((ComposerImpl) obj2, (MovableContentStateReference) obj);
            case 26:
                return NextFrameEndCallbackQueue.onNewAwaiters$lambda$0((NextFrameEndCallbackQueue) obj2, (J4.a) obj);
            case 27:
                return Recomposer.performRecompose$lambda$0$0((O) obj2, (ControlledComposition) obj);
            case 28:
                return RetainKt.retainImpl$lambda$1$0((RetainedValueHolder) obj2, (RetainedValuesStore) obj);
            default:
                return CompositionErrorContextImpl.attachComposeStackTrace$lambda$0((CompositionErrorContextImpl) obj2, obj);
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    public /* synthetic */ j(V4.C c6, J4.c cVar) {
        this.f476a = 16;
        this.f477b = c6;
        this.f478c = (C4.j) cVar;
    }
}
