package M2;

import D.InterfaceC0133d;
import V2.AbstractC0696m3;
import V2.C0634a1;
import V2.C0654e1;
import androidx.compose.runtime.Composer;
import androidx.compose.runtime.ComposerKt;
import androidx.compose.runtime.MutableState;
import androidx.compose.runtime.State;
import com.debridstream.tv.data.home.HomeMetaItem;
import java.util.List;
import java.util.Set;
import org.json.JSONObject;
import w4.C3137A;

/* JADX INFO: loaded from: classes.dex */
public final class J0 implements J4.g {

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

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

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ C f4349d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final /* synthetic */ Set f4350e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final /* synthetic */ State f4351f;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final /* synthetic */ State f4352j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final /* synthetic */ State f4353k;
    public final /* synthetic */ State l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public final /* synthetic */ State f4354m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public final /* synthetic */ MutableState f4355n;

    public J0(List list, boolean z6, boolean z7, C c6, Set set, State state, State state2, State state3, State state4, State state5, MutableState mutableState) {
        this.f4346a = list;
        this.f4347b = z6;
        this.f4348c = z7;
        this.f4349d = c6;
        this.f4350e = set;
        this.f4351f = state;
        this.f4352j = state2;
        this.f4353k = state3;
        this.l = state4;
        this.f4354m = state5;
        this.f4355n = mutableState;
    }

    /* JADX WARN: Removed duplicated region for block: B:50:0x011d  */
    @Override // J4.g
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invoke(Object obj, Object obj2, Object obj3, Object obj4) {
        int i6;
        C0634a1 c0634a1;
        JSONObject jSONObjectG;
        C0654e1 c0654e1F;
        String str;
        Integer num;
        Integer num2;
        boolean z6 = true;
        int i7 = 2;
        InterfaceC0133d interfaceC0133d = (InterfaceC0133d) obj;
        int iIntValue = ((Number) obj2).intValue();
        Composer composer = (Composer) obj3;
        int iIntValue2 = ((Number) obj4).intValue();
        if ((iIntValue2 & 6) == 0) {
            i6 = (composer.changed(interfaceC0133d) ? 4 : 2) | iIntValue2;
        } else {
            i6 = iIntValue2;
        }
        if ((iIntValue2 & 48) == 0) {
            i6 |= composer.changed(iIntValue) ? 32 : 16;
        }
        boolean z7 = false;
        if (composer.shouldExecute((i6 & 147) != 146, i6 & 1)) {
            if (ComposerKt.isTraceInProgress()) {
                ComposerKt.traceEventStart(802480018, i6, -1, "androidx.compose.foundation.lazy.items.<anonymous> (LazyDsl.kt:178)");
            }
            HomeMetaItem item = (HomeMetaItem) this.f4346a.get(iIntValue);
            composer.startReplaceGroup(1468566984);
            boolean z8 = this.f4347b;
            J4.a aVar = null;
            if (z8) {
                C c6 = O0.f4463a;
                List app = (List) this.f4353k.getValue();
                List trakt = (List) this.l.getValue();
                String profileKey = (String) this.f4354m.getValue();
                kotlin.jvm.internal.o.h(item, "item");
                kotlin.jvm.internal.o.h(app, "app");
                kotlin.jvm.internal.o.h(trakt, "trakt");
                kotlin.jvm.internal.o.h(profileKey, "profileKey");
                if (item.getTmdbId() <= 0 || (!(kotlin.jvm.internal.o.c(item.getType(), "movie") || kotlin.jvm.internal.o.c(item.getType(), "tv")) || (jSONObjectG = AbstractC0696m3.g(item.getTmdbId(), item.getType(), app, trakt, this.f4348c, profileKey)) == null || (c0654e1F = AbstractC0696m3.f(jSONObjectG, item.getRunTimeMinutes())) == null)) {
                    c0634a1 = null;
                } else {
                    float fV = L4.a.v(c0654e1F.f7740a, 0, 100) / 100.0f;
                    if (!kotlin.jvm.internal.o.c(item.getType(), "tv") || (num = c0654e1F.f7742c) == null || (num2 = c0654e1F.f7743d) == null) {
                        str = null;
                    } else {
                        str = "S" + num + ":E" + num2;
                    }
                    c0634a1 = new C0634a1(str, fV);
                }
                Float fValueOf = c0634a1 != null ? Float.valueOf(c0634a1.f7673a) : null;
                String str2 = c0634a1 != null ? c0634a1.f7674b : null;
                if (this.f4350e.contains(Integer.valueOf(item.getTmdbId()))) {
                    String type = item.getType();
                    if (!S4.p.Q0(type) && !type.equalsIgnoreCase("movie") && !S4.w.t0(S4.p.o1(type).toString(), "movie", true)) {
                        z6 = false;
                    }
                    z7 = z6;
                }
                composer.startReplaceGroup(-1476613377);
                boolean zChanged = composer.changed(z8);
                State state = this.f4351f;
                boolean zChanged2 = zChanged | composer.changed(state) | composer.changedInstance(item);
                State state2 = this.f4352j;
                boolean zChanged3 = zChanged2 | composer.changed(state2);
                Object objRememberedValue = composer.rememberedValue();
                if (zChanged3 || objRememberedValue == Composer.Companion.getEmpty()) {
                    objRememberedValue = new G0(z8, item, state, state2);
                    composer.updateRememberedValue(objRememberedValue);
                }
                J4.a aVar2 = (J4.a) objRememberedValue;
                composer.endReplaceGroup();
                composer.startReplaceGroup(-1476603788);
                if (z8 && item.getTmdbId() > 0) {
                    composer.startReplaceGroup(-1476601386);
                    boolean zChangedInstance = composer.changedInstance(item);
                    Object objRememberedValue2 = composer.rememberedValue();
                    if (zChangedInstance || objRememberedValue2 == Composer.Companion.getEmpty()) {
                        objRememberedValue2 = new V(i7, item, this.f4355n);
                        composer.updateRememberedValue(objRememberedValue2);
                    }
                    aVar = (J4.a) objRememberedValue2;
                    composer.endReplaceGroup();
                }
                composer.endReplaceGroup();
                O0.m(this.f4349d, item, fValueOf, str2, z7, aVar2, aVar, composer, 0);
                composer.endReplaceGroup();
                if (ComposerKt.isTraceInProgress()) {
                    ComposerKt.traceEventEnd();
                }
            }
        } else {
            composer.skipToGroupEnd();
        }
        return C3137A.f25453a;
    }
}
