package V2;

import com.debridstream.tv.CollectionHubViewModel;
import java.util.ArrayList;
import m3.AbstractC2467b;
import w4.C3137A;

/* JADX INFO: loaded from: classes.dex */
public final class W0 extends C4.j implements J4.e {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public e5.a f7598a;

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

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

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

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

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

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

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public W0(CollectionHubViewModel collectionHubViewModel, int i6, int i7, A4.d dVar) {
        super(2, dVar);
        this.f7603f = collectionHubViewModel;
        this.f7604j = i6;
        this.f7605k = i7;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        return new W0(this.f7603f, this.f7604j, this.f7605k, dVar);
    }

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

    /* JADX WARN: Code restructure failed: missing block: B:28:0x00a4, code lost:
    
        if (V4.E.k(r1, r11) == r0) goto L29;
     */
    @Override // C4.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) {
        int i6;
        int i7;
        CollectionHubViewModel collectionHubViewModel;
        e5.a aVar;
        B4.a aVar2 = B4.a.f492a;
        int i8 = this.f7602e;
        CollectionHubViewModel collectionHubViewModel2 = this.f7603f;
        try {
            if (i8 == 0) {
                AbstractC2467b.l(obj);
                e5.a aVar3 = collectionHubViewModel2.sectionLoadMutex;
                this.f7598a = aVar3;
                this.f7599b = collectionHubViewModel2;
                i6 = this.f7604j;
                this.f7600c = i6;
                i7 = this.f7605k;
                this.f7601d = i7;
                this.f7602e = 1;
                e5.c cVar = (e5.c) aVar3;
                if (cVar.e(this) != aVar2) {
                    collectionHubViewModel = collectionHubViewModel2;
                    aVar = cVar;
                }
                return aVar2;
            }
            if (i8 != 1) {
                if (i8 != 2) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                AbstractC2467b.l(obj);
                return C3137A.f25453a;
            }
            i7 = this.f7601d;
            i6 = this.f7600c;
            collectionHubViewModel = this.f7599b;
            e5.a aVar4 = this.f7598a;
            AbstractC2467b.l(obj);
            aVar = aVar4;
            ArrayList arrayList = new ArrayList((i6 - i7) + 1);
            if (i7 <= i6) {
                while (true) {
                    AbstractC0742y1 abstractC0742y1 = (AbstractC0742y1) collectionHubViewModel.configs.get(i7);
                    if (!collectionHubViewModel.loaded.contains(abstractC0742y1.a()) && !collectionHubViewModel.loading.contains(abstractC0742y1.a())) {
                        collectionHubViewModel.loading.add(abstractC0742y1.a());
                        arrayList.add(abstractC0742y1);
                    }
                    if (i7 == i6) {
                        break;
                    }
                    i7++;
                }
            }
            ((e5.c) aVar).g(null);
            V0 v02 = new V0(arrayList, collectionHubViewModel2, null);
            this.f7598a = null;
            this.f7599b = null;
            this.f7602e = 2;
        } catch (Throwable th) {
            ((e5.c) aVar).g(null);
            throw th;
        }
    }
}
