package h3;

import android.content.Context;
import androidx.compose.runtime.State;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
import m3.AbstractC2467b;
import w4.C3137A;
import x4.AbstractC3226C;
import x4.AbstractC3251q;
import x4.AbstractC3253s;

/* JADX INFO: renamed from: h3.g1, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C2116g1 extends C4.j implements J4.e {

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public int f17942b;

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

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

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

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

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

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C2116g1(int i6, int i7, boolean z6, int i8, Set set, Context context, State state, A4.d dVar) {
        super(2, dVar);
        this.f17943c = i6;
        this.f17944d = i7;
        this.f17945e = z6;
        this.f17946f = i8;
        this.f17947j = set;
        this.f17948k = context;
        this.l = state;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        return new C2116g1(this.f17943c, this.f17944d, this.f17945e, this.f17946f, this.f17947j, this.f17948k, this.l, dVar);
    }

    @Override // J4.e
    public final Object invoke(Object obj, Object obj2) {
        return ((C2116g1) create((V4.C) obj, (A4.d) obj2)).invokeSuspend(C3137A.f25453a);
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:25:0x0095 A[RETURN] */
    /* JADX WARN: Removed duplicated region for block: B:26:0x0096  */
    @Override // C4.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) {
        int i6;
        C2116g1 c2116g1;
        Object objM;
        int i7;
        B4.a aVar = B4.a.f492a;
        int i8 = this.f17942b;
        if (i8 == 0) {
            AbstractC2467b.l(obj);
            P4.g gVar = new P4.g(1, this.f17943c, 1);
            ArrayList arrayList = new ArrayList(AbstractC3253s.G(gVar, 10));
            Iterator it = gVar.iterator();
            while (((P4.f) it).f5681c) {
                int iA = ((AbstractC3226C) it).a();
                Context context = i3.M.f18897a;
                arrayList.add(i3.M.g(this.f17946f, this.f17944d, iA));
            }
            Set setH0 = AbstractC3251q.H0(arrayList);
            if ((setH0 instanceof Collection) && setH0.isEmpty()) {
                i6 = 1;
                this.f17941a = i6;
                this.f17942b = 1;
                c2116g1 = this;
                objM = AbstractC2211w1.m(this.f17945e, this.f17946f, this.f17948k, this.l, this.f17944d, this.f17943c, i6 ^ 1, c2116g1);
                if (objM != aVar) {
                }
            } else {
                Iterator it2 = setH0.iterator();
                while (it2.hasNext()) {
                    if (!this.f17947j.contains((String) it2.next())) {
                        i6 = 0;
                        break;
                    }
                }
                i6 = 1;
                this.f17941a = i6;
                this.f17942b = 1;
                c2116g1 = this;
                objM = AbstractC2211w1.m(this.f17945e, this.f17946f, this.f17948k, this.l, this.f17944d, this.f17943c, i6 ^ 1, c2116g1);
                if (objM != aVar) {
                    return aVar;
                }
                i7 = i6;
                obj = objM;
            }
        } else {
            if (i8 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            i7 = this.f17941a;
            AbstractC2467b.l(obj);
            c2116g1 = this;
        }
        boolean zBooleanValue = ((Boolean) obj).booleanValue();
        a5.c cVar = K2.p.f4116a;
        K2.p.a(zBooleanValue ? i7 != 0 ? "Season marked as unwatched" : "Season marked as watched" : c2116g1.f17945e ? "Failed to update Trakt history" : "Failed to update season watched state", (10 & 2) != 0 ? "" : "Could not resolve a playable download URL for this link.", zBooleanValue ? K2.r.f4126a : K2.r.f4127b, (10 & 8) != 0 ? androidx.media3.common.C.DEFAULT_MAX_SEEK_TO_PREVIOUS_POSITION_MS : 4000L);
        return C3137A.f25453a;
    }
}
