package V2;

import com.debridstream.tv.HomeViewModel;
import java.util.List;
import java.util.Set;
import m3.AbstractC2467b;
import w4.C3137A;

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

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

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

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

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

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

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

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C0635a2(AbstractC0742y1 abstractC0742y1, HomeViewModel homeViewModel, A4.d dVar) {
        super(2, dVar);
        this.f7680f = abstractC0742y1;
        this.f7681j = homeViewModel;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        return new C0635a2(this.f7680f, this.f7681j, dVar);
    }

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

    /* JADX WARN: Code restructure failed: missing block: B:113:0x02d1, code lost:
    
        if (r14 == r1) goto L114;
     */
    /* JADX WARN: Code restructure failed: missing block: B:93:0x0261, code lost:
    
        if (r14 == r1) goto L114;
     */
    /* JADX WARN: Removed duplicated region for block: B:105:0x029d  */
    /* JADX WARN: Removed duplicated region for block: B:52:0x0155  */
    /* JADX WARN: Removed duplicated region for block: B:70:0x01bd  */
    /* JADX WARN: Removed duplicated region for block: B:84:0x021c  */
    @Override // C4.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) throws Throwable {
        Throwable th;
        C0635a2 c0635a2;
        e5.c cVar;
        Throwable th2;
        e5.a aVar;
        e5.a aVar2;
        e5.a aVar3;
        C0635a2 c0635a22;
        U1 u1ContinueWatchingSnapshotFromStore;
        AbstractC0742y1 abstractC0742y1;
        HomeViewModel homeViewModel;
        e5.a aVar4;
        List list;
        e5.c cVar2;
        AbstractC0742y1 abstractC0742y12;
        HomeViewModel homeViewModel2;
        e5.a aVar5;
        List list2;
        e5.c cVar3;
        AbstractC0742y1 abstractC0742y13;
        HomeViewModel homeViewModel3;
        e5.a aVar6;
        List list3;
        e5.c cVar4;
        AbstractC0742y1 abstractC0742y14;
        HomeViewModel homeViewModel4;
        e5.a aVar7;
        e5.a aVar8;
        B4.a aVar9 = B4.a.f492a;
        int i6 = this.f7679e;
        AbstractC0742y1 abstractC0742y15 = this.f7680f;
        HomeViewModel homeViewModel5 = this.f7681j;
        try {
            try {
                try {
                } catch (Exception unused) {
                    e5.a aVar10 = homeViewModel5.sectionLoadMutex;
                    this.f7675a = aVar10;
                    this.f7676b = homeViewModel5;
                    this.f7677c = abstractC0742y15;
                    this.f7678d = null;
                    this.f7679e = 9;
                    e5.c cVar5 = (e5.c) aVar10;
                    Object objE = cVar5.e(this);
                    aVar2 = cVar5;
                }
            } catch (Throwable th3) {
                th = th3;
                c0635a2 = this;
                e5.a aVar11 = homeViewModel5.sectionLoadMutex;
                c0635a2.f7675a = th;
                c0635a2.f7676b = aVar11;
                c0635a2.f7677c = homeViewModel5;
                c0635a2.f7678d = abstractC0742y15;
                c0635a2.f7679e = 10;
                cVar = (e5.c) aVar11;
                if (cVar.e(this) != aVar9) {
                }
                return aVar9;
            }
        } catch (Exception unused2) {
            e5.a aVar102 = homeViewModel5.sectionLoadMutex;
            this.f7675a = aVar102;
            this.f7676b = homeViewModel5;
            this.f7677c = abstractC0742y15;
            this.f7678d = null;
            this.f7679e = 9;
            e5.c cVar52 = (e5.c) aVar102;
            Object objE2 = cVar52.e(this);
            aVar2 = cVar52;
        } catch (Throwable th4) {
            th = th4;
        }
        switch (i6) {
            case 0:
                AbstractC2467b.l(obj);
                try {
                    if (abstractC0742y15 instanceof C0726u1) {
                        u1ContinueWatchingSnapshotFromStore = homeViewModel5.continueWatchingSnapshotFromStore();
                        e5.a aVar12 = homeViewModel5.sectionLoadMutex;
                        this.f7675a = u1ContinueWatchingSnapshotFromStore;
                        this.f7676b = aVar12;
                        this.f7677c = homeViewModel5;
                        this.f7678d = abstractC0742y15;
                        this.f7679e = 1;
                        e5.c cVar6 = (e5.c) aVar12;
                        if (cVar6.e(this) != aVar9) {
                            abstractC0742y1 = abstractC0742y15;
                            homeViewModel = homeViewModel5;
                            aVar4 = cVar6;
                            try {
                                Set set = homeViewModel.loadedKidsMain;
                                ((C0726u1) abstractC0742y1).getClass();
                                set.add("continue_watching");
                                ((e5.c) aVar4).g(null);
                                homeViewModel5.updateKidsSections("continue_watching", u1ContinueWatchingSnapshotFromStore.f7563a, u1ContinueWatchingSnapshotFromStore.f7564b);
                                c0635a22 = this;
                                e5.a aVar13 = homeViewModel5.sectionLoadMutex;
                                c0635a22.f7675a = aVar13;
                                c0635a22.f7676b = homeViewModel5;
                                c0635a22.f7677c = abstractC0742y15;
                                c0635a22.f7678d = null;
                                c0635a22.f7679e = 8;
                                e5.c cVar7 = (e5.c) aVar13;
                                Object objE3 = cVar7.e(this);
                                aVar8 = cVar7;
                            } finally {
                            }
                            break;
                        }
                    } else if (!(abstractC0742y15 instanceof C0738x1)) {
                        c0635a22 = this;
                        if (abstractC0742y15 instanceof C0734w1) {
                            Y2.o oVar = homeViewModel5.repository;
                            String str = ((C0734w1) abstractC0742y15).f8139c;
                            c0635a22.f7679e = 4;
                            obj = oVar.m(str, 1, (6 & 4) == 0, this);
                            if (obj != aVar9) {
                                list2 = (List) obj;
                                e5.a aVar14 = homeViewModel5.sectionLoadMutex;
                                c0635a22.f7675a = list2;
                                c0635a22.f7676b = aVar14;
                                c0635a22.f7677c = homeViewModel5;
                                c0635a22.f7678d = abstractC0742y15;
                                c0635a22.f7679e = 5;
                                cVar3 = (e5.c) aVar14;
                                if (cVar3.e(this) != aVar9) {
                                    abstractC0742y13 = abstractC0742y15;
                                    homeViewModel3 = homeViewModel5;
                                    aVar6 = cVar3;
                                    try {
                                        homeViewModel3.loadedKidsMain.add(((C0734w1) abstractC0742y13).f8137a);
                                        ((e5.c) aVar6).g(null);
                                        homeViewModel5.updateKidsSections(((C0734w1) abstractC0742y15).f8137a, ((C0734w1) abstractC0742y15).f8138b, list2);
                                        e5.a aVar132 = homeViewModel5.sectionLoadMutex;
                                        c0635a22.f7675a = aVar132;
                                        c0635a22.f7676b = homeViewModel5;
                                        c0635a22.f7677c = abstractC0742y15;
                                        c0635a22.f7678d = null;
                                        c0635a22.f7679e = 8;
                                        e5.c cVar72 = (e5.c) aVar132;
                                        Object objE32 = cVar72.e(this);
                                        aVar8 = cVar72;
                                    } finally {
                                    }
                                }
                                break;
                            }
                        } else if (!(abstractC0742y15 instanceof C0730v1)) {
                            if (!(abstractC0742y15 instanceof C0718s1)) {
                                throw new E3.v();
                            }
                            e5.a aVar1322 = homeViewModel5.sectionLoadMutex;
                            c0635a22.f7675a = aVar1322;
                            c0635a22.f7676b = homeViewModel5;
                            c0635a22.f7677c = abstractC0742y15;
                            c0635a22.f7678d = null;
                            c0635a22.f7679e = 8;
                            e5.c cVar722 = (e5.c) aVar1322;
                            Object objE322 = cVar722.e(this);
                            aVar8 = cVar722;
                            break;
                        } else {
                            Y2.o oVar2 = homeViewModel5.repository;
                            String str2 = ((C0730v1) abstractC0742y15).f8125c;
                            c0635a22.f7679e = 6;
                            obj = oVar2.k(str2, 1, (6 & 4) == 0, this);
                            if (obj != aVar9) {
                                list3 = (List) obj;
                                e5.a aVar15 = homeViewModel5.sectionLoadMutex;
                                c0635a22.f7675a = list3;
                                c0635a22.f7676b = aVar15;
                                c0635a22.f7677c = homeViewModel5;
                                c0635a22.f7678d = abstractC0742y15;
                                c0635a22.f7679e = 7;
                                cVar4 = (e5.c) aVar15;
                                if (cVar4.e(this) != aVar9) {
                                    abstractC0742y14 = abstractC0742y15;
                                    homeViewModel4 = homeViewModel5;
                                    aVar7 = cVar4;
                                    try {
                                        homeViewModel4.loadedKidsMain.add(((C0730v1) abstractC0742y14).f8123a);
                                        ((e5.c) aVar7).g(null);
                                        homeViewModel5.updateKidsSections(((C0730v1) abstractC0742y15).f8123a, ((C0730v1) abstractC0742y15).f8124b, list3);
                                        e5.a aVar13222 = homeViewModel5.sectionLoadMutex;
                                        c0635a22.f7675a = aVar13222;
                                        c0635a22.f7676b = homeViewModel5;
                                        c0635a22.f7677c = abstractC0742y15;
                                        c0635a22.f7678d = null;
                                        c0635a22.f7679e = 8;
                                        e5.c cVar7222 = (e5.c) aVar13222;
                                        Object objE3222 = cVar7222.e(this);
                                        aVar8 = cVar7222;
                                    } finally {
                                    }
                                }
                                break;
                            }
                        }
                    } else {
                        Y2.o oVar3 = homeViewModel5.repository;
                        String str3 = ((C0738x1) abstractC0742y15).f8157c;
                        String str4 = ((C0738x1) abstractC0742y15).f8158d;
                        Integer num = ((C0738x1) abstractC0742y15).f8159e;
                        Integer num2 = ((C0738x1) abstractC0742y15).f8160f;
                        this.f7679e = 2;
                        c0635a22 = this;
                        obj = oVar3.o(str3, str4, 1, (28 & 8) != 0 ? 100 : 10, (28 & 16) == 0, (28 & 32) != 0 ? null : num, (28 & 64) != 0 ? null : num2, c0635a22);
                        if (obj != aVar9) {
                            list = (List) obj;
                            e5.a aVar16 = homeViewModel5.sectionLoadMutex;
                            c0635a22.f7675a = list;
                            c0635a22.f7676b = aVar16;
                            c0635a22.f7677c = homeViewModel5;
                            c0635a22.f7678d = abstractC0742y15;
                            c0635a22.f7679e = 3;
                            cVar2 = (e5.c) aVar16;
                            if (cVar2.e(this) != aVar9) {
                                abstractC0742y12 = abstractC0742y15;
                                homeViewModel2 = homeViewModel5;
                                aVar5 = cVar2;
                                try {
                                    homeViewModel2.loadedKidsMain.add(((C0738x1) abstractC0742y12).f8155a);
                                    ((e5.c) aVar5).g(null);
                                    homeViewModel5.updateKidsSections(((C0738x1) abstractC0742y15).f8155a, ((C0738x1) abstractC0742y15).f8156b, list);
                                    e5.a aVar132222 = homeViewModel5.sectionLoadMutex;
                                    c0635a22.f7675a = aVar132222;
                                    c0635a22.f7676b = homeViewModel5;
                                    c0635a22.f7677c = abstractC0742y15;
                                    c0635a22.f7678d = null;
                                    c0635a22.f7679e = 8;
                                    e5.c cVar72222 = (e5.c) aVar132222;
                                    Object objE32222 = cVar72222.e(this);
                                    aVar8 = cVar72222;
                                } finally {
                                }
                            }
                            break;
                        }
                    }
                } catch (Throwable th5) {
                    th = th5;
                    c0635a2 = this;
                    th = th;
                    e5.a aVar112 = homeViewModel5.sectionLoadMutex;
                    c0635a2.f7675a = th;
                    c0635a2.f7676b = aVar112;
                    c0635a2.f7677c = homeViewModel5;
                    c0635a2.f7678d = abstractC0742y15;
                    c0635a2.f7679e = 10;
                    cVar = (e5.c) aVar112;
                    if (cVar.e(this) != aVar9) {
                        th2 = th;
                        aVar3 = cVar;
                        e5.a aVar17 = aVar3;
                        try {
                            homeViewModel5.loadingKidsMain.remove(abstractC0742y15.a());
                            throw th2;
                        } finally {
                        }
                    }
                }
                return aVar9;
            case 1:
                abstractC0742y1 = this.f7678d;
                homeViewModel = (HomeViewModel) this.f7677c;
                e5.a aVar18 = (e5.a) this.f7676b;
                u1ContinueWatchingSnapshotFromStore = (U1) this.f7675a;
                AbstractC2467b.l(obj);
                aVar4 = aVar18;
                Set set2 = homeViewModel.loadedKidsMain;
                ((C0726u1) abstractC0742y1).getClass();
                set2.add("continue_watching");
                ((e5.c) aVar4).g(null);
                homeViewModel5.updateKidsSections("continue_watching", u1ContinueWatchingSnapshotFromStore.f7563a, u1ContinueWatchingSnapshotFromStore.f7564b);
                c0635a22 = this;
                e5.a aVar1322222 = homeViewModel5.sectionLoadMutex;
                c0635a22.f7675a = aVar1322222;
                c0635a22.f7676b = homeViewModel5;
                c0635a22.f7677c = abstractC0742y15;
                c0635a22.f7678d = null;
                c0635a22.f7679e = 8;
                e5.c cVar722222 = (e5.c) aVar1322222;
                Object objE322222 = cVar722222.e(this);
                aVar8 = cVar722222;
                break;
            case 2:
                AbstractC2467b.l(obj);
                c0635a22 = this;
                list = (List) obj;
                e5.a aVar162 = homeViewModel5.sectionLoadMutex;
                c0635a22.f7675a = list;
                c0635a22.f7676b = aVar162;
                c0635a22.f7677c = homeViewModel5;
                c0635a22.f7678d = abstractC0742y15;
                c0635a22.f7679e = 3;
                cVar2 = (e5.c) aVar162;
                if (cVar2.e(this) != aVar9) {
                }
                return aVar9;
            case 3:
                abstractC0742y12 = this.f7678d;
                homeViewModel2 = (HomeViewModel) this.f7677c;
                e5.a aVar19 = (e5.a) this.f7676b;
                list = (List) this.f7675a;
                AbstractC2467b.l(obj);
                c0635a22 = this;
                aVar5 = aVar19;
                homeViewModel2.loadedKidsMain.add(((C0738x1) abstractC0742y12).f8155a);
                ((e5.c) aVar5).g(null);
                homeViewModel5.updateKidsSections(((C0738x1) abstractC0742y15).f8155a, ((C0738x1) abstractC0742y15).f8156b, list);
                e5.a aVar13222222 = homeViewModel5.sectionLoadMutex;
                c0635a22.f7675a = aVar13222222;
                c0635a22.f7676b = homeViewModel5;
                c0635a22.f7677c = abstractC0742y15;
                c0635a22.f7678d = null;
                c0635a22.f7679e = 8;
                e5.c cVar7222222 = (e5.c) aVar13222222;
                Object objE3222222 = cVar7222222.e(this);
                aVar8 = cVar7222222;
                break;
            case 4:
                AbstractC2467b.l(obj);
                c0635a22 = this;
                list2 = (List) obj;
                e5.a aVar142 = homeViewModel5.sectionLoadMutex;
                c0635a22.f7675a = list2;
                c0635a22.f7676b = aVar142;
                c0635a22.f7677c = homeViewModel5;
                c0635a22.f7678d = abstractC0742y15;
                c0635a22.f7679e = 5;
                cVar3 = (e5.c) aVar142;
                if (cVar3.e(this) != aVar9) {
                }
                return aVar9;
            case 5:
                abstractC0742y13 = this.f7678d;
                homeViewModel3 = (HomeViewModel) this.f7677c;
                e5.a aVar20 = (e5.a) this.f7676b;
                list2 = (List) this.f7675a;
                AbstractC2467b.l(obj);
                c0635a22 = this;
                aVar6 = aVar20;
                homeViewModel3.loadedKidsMain.add(((C0734w1) abstractC0742y13).f8137a);
                ((e5.c) aVar6).g(null);
                homeViewModel5.updateKidsSections(((C0734w1) abstractC0742y15).f8137a, ((C0734w1) abstractC0742y15).f8138b, list2);
                e5.a aVar132222222 = homeViewModel5.sectionLoadMutex;
                c0635a22.f7675a = aVar132222222;
                c0635a22.f7676b = homeViewModel5;
                c0635a22.f7677c = abstractC0742y15;
                c0635a22.f7678d = null;
                c0635a22.f7679e = 8;
                e5.c cVar72222222 = (e5.c) aVar132222222;
                Object objE32222222 = cVar72222222.e(this);
                aVar8 = cVar72222222;
                break;
            case 6:
                AbstractC2467b.l(obj);
                c0635a22 = this;
                list3 = (List) obj;
                e5.a aVar152 = homeViewModel5.sectionLoadMutex;
                c0635a22.f7675a = list3;
                c0635a22.f7676b = aVar152;
                c0635a22.f7677c = homeViewModel5;
                c0635a22.f7678d = abstractC0742y15;
                c0635a22.f7679e = 7;
                cVar4 = (e5.c) aVar152;
                if (cVar4.e(this) != aVar9) {
                }
                return aVar9;
            case 7:
                abstractC0742y14 = this.f7678d;
                homeViewModel4 = (HomeViewModel) this.f7677c;
                e5.a aVar21 = (e5.a) this.f7676b;
                list3 = (List) this.f7675a;
                AbstractC2467b.l(obj);
                c0635a22 = this;
                aVar7 = aVar21;
                homeViewModel4.loadedKidsMain.add(((C0730v1) abstractC0742y14).f8123a);
                ((e5.c) aVar7).g(null);
                homeViewModel5.updateKidsSections(((C0730v1) abstractC0742y15).f8123a, ((C0730v1) abstractC0742y15).f8124b, list3);
                e5.a aVar1322222222 = homeViewModel5.sectionLoadMutex;
                c0635a22.f7675a = aVar1322222222;
                c0635a22.f7676b = homeViewModel5;
                c0635a22.f7677c = abstractC0742y15;
                c0635a22.f7678d = null;
                c0635a22.f7679e = 8;
                e5.c cVar722222222 = (e5.c) aVar1322222222;
                Object objE322222222 = cVar722222222.e(this);
                aVar8 = cVar722222222;
                break;
            case 8:
                abstractC0742y15 = (AbstractC0742y1) this.f7677c;
                homeViewModel5 = (HomeViewModel) this.f7676b;
                e5.a aVar22 = (e5.a) this.f7675a;
                AbstractC2467b.l(obj);
                aVar8 = aVar22;
                e5.a aVar23 = aVar8;
                try {
                    homeViewModel5.loadingKidsMain.remove(abstractC0742y15.a());
                    aVar = aVar23;
                    return C3137A.f25453a;
                } finally {
                }
            case 9:
                abstractC0742y15 = (AbstractC0742y1) this.f7677c;
                homeViewModel5 = (HomeViewModel) this.f7676b;
                e5.a aVar24 = (e5.a) this.f7675a;
                AbstractC2467b.l(obj);
                aVar2 = aVar24;
                e5.a aVar25 = aVar2;
                try {
                    homeViewModel5.loadingKidsMain.remove(abstractC0742y15.a());
                    aVar = aVar25;
                    return C3137A.f25453a;
                } finally {
                }
            case 10:
                abstractC0742y15 = this.f7678d;
                homeViewModel5 = (HomeViewModel) this.f7677c;
                e5.a aVar26 = (e5.a) this.f7676b;
                th2 = (Throwable) this.f7675a;
                AbstractC2467b.l(obj);
                aVar3 = aVar26;
                e5.a aVar172 = aVar3;
                homeViewModel5.loadingKidsMain.remove(abstractC0742y15.a());
                throw th2;
            default:
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
        }
    }
}
