package com.strmr.ps.data.service;

import com.strmr.ps.data.model.EpisodeFilter;
import com.strmr.ps.data.model.StreamInfo;
import com.strmr.ps.data.model.addon.InstalledAddon;
import com.strmr.ps.data.remote.AddonStreamClient;
import com.strmr.ps.data.repository.AddonRepository;
import defpackage.ak1;
import defpackage.ck1;
import defpackage.e6a;
import defpackage.fi7;
import defpackage.gr3;
import defpackage.ik2;
import defpackage.kc8;
import defpackage.kq;
import defpackage.mg6;
import defpackage.oz2;
import defpackage.q07;
import defpackage.s38;
import defpackage.uc;
import defpackage.vx8;
import defpackage.y41;
import defpackage.yi7;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutorService;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.Boxing;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0002\u001a\u00020\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0002\u0010\u0003"}, d2 = {"Lak1;", "Le6a;", "<anonymous>", "(Lak1;)V"}, k = 3, mv = {2, 0, 0})
@DebugMetadata(c = "com.strmr.ps.data.service.AddonResolutionService$scrapeEpisodeProgressive$1$jobs$1$1$1", f = "AddonResolutionService.kt", i = {0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5}, l = {431, 1181, 460, 470, 1200, 478}, m = "invokeSuspend", n = {"label", "episodeFiltered", "$this$withLock_u24default$iv", "episodeMatched", "episodeFiltered", "episodeFiltered", "filterResult", "episodeFiltered", "filterResult", "$this$withLock_u24default$iv", "$this$withLock_u24default$iv"}, s = {"L$0", "L$0", "L$1", "L$0", "L$1", "L$0", "L$1", "L$0", "L$1", "L$2", "L$0"})
@vx8
final class j extends SuspendLambda implements gr3<ak1, Continuation<? super e6a>, Object> {
    public Object a;
    public final /* synthetic */ Set aa;
    public final /* synthetic */ yi7 ab;
    public final /* synthetic */ Map ac;
    public Object b;
    public Object c;
    public List d;
    public List e;
    public Set f;
    public InstalledAddon i;
    public yi7 j;
    public AddonResolutionService k;
    public Set l;
    public Map m;
    public int n;
    public final /* synthetic */ q07 o;
    public final /* synthetic */ InstalledAddon p;
    public final /* synthetic */ String q;
    public final /* synthetic */ int r;
    public final /* synthetic */ int s;
    public final /* synthetic */ AddonResolutionService t;
    public final /* synthetic */ String u;
    public final /* synthetic */ mg6 v;
    public final /* synthetic */ Integer w;
    public final /* synthetic */ Set x;
    public final /* synthetic */ List y;
    public final /* synthetic */ List z;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public j(q07 q07Var, InstalledAddon installedAddon, String str, int i, int i2, AddonResolutionService addonResolutionService, String str2, mg6 mg6Var, Integer num, Set set, List list, List list2, Set set2, yi7 yi7Var, Map map, Continuation continuation) {
        super(2, continuation);
        this.o = q07Var;
        this.p = installedAddon;
        this.q = str;
        this.r = i;
        this.s = i2;
        this.t = addonResolutionService;
        this.u = str2;
        this.v = mg6Var;
        this.w = num;
        this.x = set;
        this.y = list;
        this.z = list2;
        this.aa = set2;
        this.ab = yi7Var;
        this.ac = map;
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Continuation create(Object obj, Continuation continuation) {
        return new j(this.o, this.p, this.q, this.r, this.s, this.t, this.u, this.v, this.w, this.x, this.y, this.z, this.aa, this.ab, this.ac, continuation);
    }

    @Override // defpackage.gr3
    public final Object invoke(Object obj, Object obj2) {
        return ((j) create((ak1) obj, (Continuation) obj2)).invokeSuspend(e6a.a);
    }

    /* JADX WARN: Removed duplicated region for block: B:110:0x0282 A[Catch: Exception -> 0x0061, CancellationException -> 0x0064, TryCatch #13 {CancellationException -> 0x0064, Exception -> 0x0061, blocks: (B:162:0x03f0, B:165:0x03f8, B:166:0x03fb, B:12:0x005a, B:19:0x006f, B:154:0x0365, B:22:0x0080, B:105:0x026e, B:107:0x0277, B:120:0x02a3, B:122:0x02b4, B:135:0x02e0, B:137:0x02e6, B:150:0x0312, B:140:0x02f1, B:141:0x02f6, B:143:0x02fc, B:145:0x0308, B:148:0x030d, B:149:0x0311, B:125:0x02bf, B:126:0x02c4, B:128:0x02ca, B:130:0x02d6, B:133:0x02db, B:134:0x02df, B:110:0x0282, B:111:0x0287, B:113:0x028d, B:115:0x0299, B:118:0x029e, B:119:0x02a2, B:25:0x0099, B:98:0x0252, B:100:0x0258, B:101:0x025c, B:85:0x01e7, B:88:0x01ef, B:90:0x0202, B:92:0x021e, B:102:0x025d, B:84:0x01b8, B:167:0x03fc), top: B:176:0x001e }] */
    /* JADX WARN: Removed duplicated region for block: B:113:0x028d A[Catch: Exception -> 0x0061, CancellationException -> 0x0064, TryCatch #13 {CancellationException -> 0x0064, Exception -> 0x0061, blocks: (B:162:0x03f0, B:165:0x03f8, B:166:0x03fb, B:12:0x005a, B:19:0x006f, B:154:0x0365, B:22:0x0080, B:105:0x026e, B:107:0x0277, B:120:0x02a3, B:122:0x02b4, B:135:0x02e0, B:137:0x02e6, B:150:0x0312, B:140:0x02f1, B:141:0x02f6, B:143:0x02fc, B:145:0x0308, B:148:0x030d, B:149:0x0311, B:125:0x02bf, B:126:0x02c4, B:128:0x02ca, B:130:0x02d6, B:133:0x02db, B:134:0x02df, B:110:0x0282, B:111:0x0287, B:113:0x028d, B:115:0x0299, B:118:0x029e, B:119:0x02a2, B:25:0x0099, B:98:0x0252, B:100:0x0258, B:101:0x025c, B:85:0x01e7, B:88:0x01ef, B:90:0x0202, B:92:0x021e, B:102:0x025d, B:84:0x01b8, B:167:0x03fc), top: B:176:0x001e }] */
    /* JADX WARN: Removed duplicated region for block: B:125:0x02bf A[Catch: Exception -> 0x0061, CancellationException -> 0x0064, TryCatch #13 {CancellationException -> 0x0064, Exception -> 0x0061, blocks: (B:162:0x03f0, B:165:0x03f8, B:166:0x03fb, B:12:0x005a, B:19:0x006f, B:154:0x0365, B:22:0x0080, B:105:0x026e, B:107:0x0277, B:120:0x02a3, B:122:0x02b4, B:135:0x02e0, B:137:0x02e6, B:150:0x0312, B:140:0x02f1, B:141:0x02f6, B:143:0x02fc, B:145:0x0308, B:148:0x030d, B:149:0x0311, B:125:0x02bf, B:126:0x02c4, B:128:0x02ca, B:130:0x02d6, B:133:0x02db, B:134:0x02df, B:110:0x0282, B:111:0x0287, B:113:0x028d, B:115:0x0299, B:118:0x029e, B:119:0x02a2, B:25:0x0099, B:98:0x0252, B:100:0x0258, B:101:0x025c, B:85:0x01e7, B:88:0x01ef, B:90:0x0202, B:92:0x021e, B:102:0x025d, B:84:0x01b8, B:167:0x03fc), top: B:176:0x001e }] */
    /* JADX WARN: Removed duplicated region for block: B:128:0x02ca A[Catch: Exception -> 0x0061, CancellationException -> 0x0064, TryCatch #13 {CancellationException -> 0x0064, Exception -> 0x0061, blocks: (B:162:0x03f0, B:165:0x03f8, B:166:0x03fb, B:12:0x005a, B:19:0x006f, B:154:0x0365, B:22:0x0080, B:105:0x026e, B:107:0x0277, B:120:0x02a3, B:122:0x02b4, B:135:0x02e0, B:137:0x02e6, B:150:0x0312, B:140:0x02f1, B:141:0x02f6, B:143:0x02fc, B:145:0x0308, B:148:0x030d, B:149:0x0311, B:125:0x02bf, B:126:0x02c4, B:128:0x02ca, B:130:0x02d6, B:133:0x02db, B:134:0x02df, B:110:0x0282, B:111:0x0287, B:113:0x028d, B:115:0x0299, B:118:0x029e, B:119:0x02a2, B:25:0x0099, B:98:0x0252, B:100:0x0258, B:101:0x025c, B:85:0x01e7, B:88:0x01ef, B:90:0x0202, B:92:0x021e, B:102:0x025d, B:84:0x01b8, B:167:0x03fc), top: B:176:0x001e }] */
    /* JADX WARN: Removed duplicated region for block: B:140:0x02f1 A[Catch: Exception -> 0x0061, CancellationException -> 0x0064, TryCatch #13 {CancellationException -> 0x0064, Exception -> 0x0061, blocks: (B:162:0x03f0, B:165:0x03f8, B:166:0x03fb, B:12:0x005a, B:19:0x006f, B:154:0x0365, B:22:0x0080, B:105:0x026e, B:107:0x0277, B:120:0x02a3, B:122:0x02b4, B:135:0x02e0, B:137:0x02e6, B:150:0x0312, B:140:0x02f1, B:141:0x02f6, B:143:0x02fc, B:145:0x0308, B:148:0x030d, B:149:0x0311, B:125:0x02bf, B:126:0x02c4, B:128:0x02ca, B:130:0x02d6, B:133:0x02db, B:134:0x02df, B:110:0x0282, B:111:0x0287, B:113:0x028d, B:115:0x0299, B:118:0x029e, B:119:0x02a2, B:25:0x0099, B:98:0x0252, B:100:0x0258, B:101:0x025c, B:85:0x01e7, B:88:0x01ef, B:90:0x0202, B:92:0x021e, B:102:0x025d, B:84:0x01b8, B:167:0x03fc), top: B:176:0x001e }] */
    /* JADX WARN: Removed duplicated region for block: B:143:0x02fc A[Catch: Exception -> 0x0061, CancellationException -> 0x0064, TryCatch #13 {CancellationException -> 0x0064, Exception -> 0x0061, blocks: (B:162:0x03f0, B:165:0x03f8, B:166:0x03fb, B:12:0x005a, B:19:0x006f, B:154:0x0365, B:22:0x0080, B:105:0x026e, B:107:0x0277, B:120:0x02a3, B:122:0x02b4, B:135:0x02e0, B:137:0x02e6, B:150:0x0312, B:140:0x02f1, B:141:0x02f6, B:143:0x02fc, B:145:0x0308, B:148:0x030d, B:149:0x0311, B:125:0x02bf, B:126:0x02c4, B:128:0x02ca, B:130:0x02d6, B:133:0x02db, B:134:0x02df, B:110:0x0282, B:111:0x0287, B:113:0x028d, B:115:0x0299, B:118:0x029e, B:119:0x02a2, B:25:0x0099, B:98:0x0252, B:100:0x0258, B:101:0x025c, B:85:0x01e7, B:88:0x01ef, B:90:0x0202, B:92:0x021e, B:102:0x025d, B:84:0x01b8, B:167:0x03fc), top: B:176:0x001e }] */
    /* JADX WARN: Removed duplicated region for block: B:152:0x0361  */
    /* JADX WARN: Removed duplicated region for block: B:153:0x0363  */
    /* JADX WARN: Removed duplicated region for block: B:157:0x0396  */
    /* JADX WARN: Removed duplicated region for block: B:161:0x03ef  */
    /* JADX WARN: Removed duplicated region for block: B:87:0x01ed  */
    /* JADX WARN: Removed duplicated region for block: B:88:0x01ef A[Catch: Exception -> 0x0061, CancellationException -> 0x0064, TryCatch #13 {CancellationException -> 0x0064, Exception -> 0x0061, blocks: (B:162:0x03f0, B:165:0x03f8, B:166:0x03fb, B:12:0x005a, B:19:0x006f, B:154:0x0365, B:22:0x0080, B:105:0x026e, B:107:0x0277, B:120:0x02a3, B:122:0x02b4, B:135:0x02e0, B:137:0x02e6, B:150:0x0312, B:140:0x02f1, B:141:0x02f6, B:143:0x02fc, B:145:0x0308, B:148:0x030d, B:149:0x0311, B:125:0x02bf, B:126:0x02c4, B:128:0x02ca, B:130:0x02d6, B:133:0x02db, B:134:0x02df, B:110:0x0282, B:111:0x0287, B:113:0x028d, B:115:0x0299, B:118:0x029e, B:119:0x02a2, B:25:0x0099, B:98:0x0252, B:100:0x0258, B:101:0x025c, B:85:0x01e7, B:88:0x01ef, B:90:0x0202, B:92:0x021e, B:102:0x025d, B:84:0x01b8, B:167:0x03fc), top: B:176:0x001e }] */
    /* JADX WARN: Unreachable blocks removed: 2, instructions: 3 */
    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) throws Throwable {
        Set set;
        List list;
        List list2;
        List list3;
        List list4;
        List list5;
        Object objA;
        List list6;
        List list7;
        Iterator it;
        int i;
        List list8;
        Iterator it2;
        int i2;
        List list9;
        Iterator it3;
        int i3;
        Set set2;
        AddonRepository addonRepository;
        String instanceId;
        List list10;
        oz2 oz2Var;
        Set set3;
        mg6 mg6Var;
        InstalledAddon installedAddon;
        List list11;
        Map map;
        Set set4;
        List list12;
        yi7 yi7Var;
        mg6 mg6Var2;
        kc8 kc8Var;
        Object obj2;
        String strBuildEpisodeUrl;
        String name;
        Object objA2;
        ck1 ck1Var = ck1.a;
        int i4 = this.n;
        Set set5 = this.x;
        List list13 = this.y;
        mg6 mg6Var3 = this.v;
        int i5 = this.s;
        int i6 = this.r;
        AddonResolutionService addonResolutionService = this.t;
        InstalledAddon installedAddon2 = this.p;
        try {
            try {
                try {
                } catch (CancellationException e) {
                    throw e;
                }
            } catch (Exception e2) {
                e = e2;
            }
        } catch (CancellationException e3) {
            throw e3;
        } catch (Exception e4) {
            ExecutorService executorService = kq.a;
            String name2 = installedAddon2.getName();
            String simpleName = e4.getClass().getSimpleName();
            String message = e4.getMessage();
            StringBuilder sbM = fi7.m("Error processing streams from ", name2, ": ", simpleName, ": ");
            sbM.append(message);
            kq.a("AddonResolutionService", sbM.toString(), e4);
        }
        switch (i4) {
            case 0:
                s38.b(obj);
                q07 q07Var = this.o;
                try {
                    if (q07Var != null) {
                        try {
                            installedAddon2 = installedAddon2;
                            try {
                                try {
                                } catch (Exception e5) {
                                    e = e5;
                                }
                            } catch (Exception e6) {
                                e = e6;
                                set = set5;
                            }
                            try {
                                set = set5;
                                installedAddon2 = installedAddon2;
                                strBuildEpisodeUrl = installedAddon2.buildUrlWithDebrid("series", this.q, Boxing.boxInt(i6), Boxing.boxInt(i5), (String) q07Var.a, (String) q07Var.b);
                            } catch (CancellationException e7) {
                                throw e7;
                            } catch (Exception e8) {
                                e = e8;
                                installedAddon2 = installedAddon2;
                                set = set5;
                                list = list13;
                                ExecutorService executorService2 = kq.a;
                                kq.a("AddonResolutionService", "Error fetching from " + installedAddon2.getName() + ": " + e.getClass().getSimpleName() + ": " + e.getMessage(), e);
                                list2 = ik2.a;
                            }
                        } catch (CancellationException e9) {
                            throw e9;
                        } catch (Exception e10) {
                            e = e10;
                            set = set5;
                            installedAddon2 = installedAddon2;
                        }
                    } else {
                        set = set5;
                        strBuildEpisodeUrl = (!installedAddon2.isQuickAdd() || installedAddon2.getDebridInjectionType() == null) ? installedAddon2.buildEpisodeUrl(this.q, i6, i5) : installedAddon2.buildUrlWithDebrid("series", this.q, Boxing.boxInt(i6), Boxing.boxInt(i5), null, null);
                    }
                    if (q07Var != null) {
                        list = list13;
                        name = installedAddon2.getName() + "[" + q07Var.a + "]";
                    } else {
                        list = list13;
                        name = installedAddon2.getName();
                    }
                    ExecutorService executorService3 = kq.a;
                    kq.h("AddonResolutionService", "Fetching from " + name + ": " + strBuildEpisodeUrl);
                    AddonStreamClient addonStreamClient = addonResolutionService.b;
                    this.a = name;
                    this.n = 1;
                    objA2 = addonStreamClient.a(strBuildEpisodeUrl, this);
                } catch (Exception e11) {
                    e = e11;
                }
                if (objA2 == ck1Var) {
                    return ck1Var;
                }
                list2 = (List) objA2;
                ExecutorService executorService4 = kq.a;
                kq.h("AddonResolutionService", name + ": " + list2.size() + " raw streams");
                if (list2.isEmpty()) {
                    ArrayList arrayListB = AddonResolutionService.b(addonResolutionService, list2, installedAddon2);
                    list2.size();
                    installedAddon2.getName();
                    arrayListB.size();
                    if (!arrayListB.isEmpty()) {
                        q07<List<StreamInfo>, List<StreamInfo>> q07VarFilterStreams = EpisodeFilter.INSTANCE.filterStreams(arrayListB, i6, i5, this.u);
                        list3 = (List) q07VarFilterStreams.a;
                        list4 = (List) q07VarFilterStreams.b;
                        list3.size();
                        list4.size();
                        if (list3.isEmpty()) {
                            ExecutorService executorService5 = kq.a;
                            kq.h("AddonResolutionService", "All streams from " + installedAddon2.getName() + " were filtered out (wrong episode)");
                            this.a = list4;
                            this.b = mg6Var3;
                            List list14 = list;
                            this.c = list14;
                            this.n = 2;
                            if (mg6Var3.a(this) != ck1Var) {
                                list6 = list14;
                                try {
                                    list6.addAll(list4);
                                    mg6Var3.c(null);
                                } catch (Throwable th) {
                                    mg6Var3.c(null);
                                    throw th;
                                }
                            }
                        } else {
                            list5 = list;
                            this.a = list3;
                            this.b = list4;
                            this.n = 3;
                            objA = AddonResolutionService.a(addonResolutionService, list3, this);
                            if (objA != ck1Var) {
                                List list15 = (List) objA;
                                list7 = list15;
                                if ((list7 instanceof Collection) || !list7.isEmpty()) {
                                    it = list7.iterator();
                                    i = 0;
                                    while (it.hasNext()) {
                                        if (((StreamInfo) it.next()).isCached() && (i = i + 1) < 0) {
                                            y41.bl();
                                            throw null;
                                        }
                                    }
                                } else {
                                    i = 0;
                                }
                                ExecutorService executorService6 = kq.a;
                                String name3 = installedAddon2.getName();
                                int size = list3.size();
                                list8 = list3;
                                if ((list8 instanceof Collection) || !list8.isEmpty()) {
                                    it2 = list8.iterator();
                                    i2 = 0;
                                    while (it2.hasNext()) {
                                        if (((StreamInfo) it2.next()).isDirectUrl() && (i2 = i2 + 1) < 0) {
                                            y41.bl();
                                            throw null;
                                        }
                                    }
                                } else {
                                    i2 = 0;
                                }
                                list9 = list3;
                                if ((list9 instanceof Collection) || !list9.isEmpty()) {
                                    it3 = list9.iterator();
                                    i3 = 0;
                                    while (it3.hasNext()) {
                                        if (!((StreamInfo) it3.next()).isDirectUrl() && (i3 = i3 + 1) < 0) {
                                            y41.bl();
                                            throw null;
                                        }
                                    }
                                } else {
                                    i3 = 0;
                                }
                                kq.h("AddonResolutionService", name3 + ": " + size + " episode-matched streams (" + i2 + " direct, " + i3 + " torrent), " + i + " cached");
                                set2 = set;
                                oz2 oz2VarB = addonResolutionService.c.b(list15, this.w, set2);
                                addonRepository = addonResolutionService.a;
                                instanceId = installedAddon2.getInstanceId();
                                this.a = list4;
                                this.b = oz2VarB;
                                this.n = 4;
                                if (addonRepository.updateLastUsed(instanceId, this) == ck1Var) {
                                    list10 = list4;
                                    oz2Var = oz2VarB;
                                    List list16 = this.z;
                                    set3 = this.aa;
                                    yi7 yi7Var2 = this.ab;
                                    Map map2 = this.ac;
                                    this.a = list10;
                                    this.b = oz2Var;
                                    this.c = mg6Var3;
                                    this.d = list16;
                                    this.e = list5;
                                    this.f = set3;
                                    this.i = installedAddon2;
                                    this.j = yi7Var2;
                                    this.k = addonResolutionService;
                                    this.l = set2;
                                    this.m = map2;
                                    this.n = 5;
                                    if (mg6Var3.a(this) != ck1Var) {
                                        mg6Var = mg6Var3;
                                        installedAddon = installedAddon2;
                                        list11 = list16;
                                        map = map2;
                                        set4 = set2;
                                        list12 = list5;
                                        yi7Var = yi7Var2;
                                        try {
                                            list11.addAll(oz2Var.a);
                                            list12.addAll(list10);
                                            list12.addAll(oz2Var.b);
                                            set3.add(installedAddon.getName());
                                            List listE = AddonResolutionService.e(addonResolutionService, list11, set4);
                                            List listBo = y41.bo(list12);
                                            List listBj = y41.bj(new uc(map), set3);
                                            obj2 = null;
                                            kc8Var = new kc8(null, listE, listBo, listBj);
                                            this.a = mg6Var;
                                            this.b = null;
                                            this.c = null;
                                            this.d = null;
                                            this.e = null;
                                            this.f = null;
                                            this.i = null;
                                            this.j = null;
                                            this.k = null;
                                            this.l = null;
                                            this.m = null;
                                            this.n = 6;
                                            if (yi7Var.s(kc8Var, this) != ck1Var) {
                                                mg6Var2 = mg6Var;
                                                mg6Var2.c(obj2);
                                            }
                                        } catch (Throwable th2) {
                                            th = th2;
                                            mg6Var2 = mg6Var;
                                            mg6Var2.c(null);
                                            throw th;
                                        }
                                    }
                                }
                            }
                        }
                        return ck1Var;
                    }
                }
                return e6a.a;
            case 1:
                String str = (String) this.a;
                try {
                    s38.b(obj);
                    name = str;
                    set = set5;
                    list = list13;
                    objA2 = obj;
                    list2 = (List) objA2;
                    ExecutorService executorService42 = kq.a;
                    kq.h("AddonResolutionService", name + ": " + list2.size() + " raw streams");
                    break;
                } catch (Exception e12) {
                    e = e12;
                    set = set5;
                    list = list13;
                    ExecutorService executorService22 = kq.a;
                    kq.a("AddonResolutionService", "Error fetching from " + installedAddon2.getName() + ": " + e.getClass().getSimpleName() + ": " + e.getMessage(), e);
                    list2 = ik2.a;
                }
                if (list2.isEmpty()) {
                }
                return e6a.a;
            case 2:
                list6 = (List) this.c;
                mg6Var3 = (mg6) this.b;
                list4 = (List) this.a;
                s38.b(obj);
                list6.addAll(list4);
                mg6Var3.c(null);
                return e6a.a;
            case 3:
                list4 = (List) this.b;
                List list17 = (List) this.a;
                s38.b(obj);
                objA = obj;
                list3 = list17;
                set = set5;
                list5 = list13;
                List list152 = (List) objA;
                list7 = list152;
                if (list7 instanceof Collection) {
                    it = list7.iterator();
                    i = 0;
                    while (it.hasNext()) {
                    }
                    ExecutorService executorService62 = kq.a;
                    String name32 = installedAddon2.getName();
                    int size2 = list3.size();
                    list8 = list3;
                    if (list8 instanceof Collection) {
                        it2 = list8.iterator();
                        i2 = 0;
                        while (it2.hasNext()) {
                        }
                        list9 = list3;
                        if (list9 instanceof Collection) {
                            it3 = list9.iterator();
                            i3 = 0;
                            while (it3.hasNext()) {
                            }
                            kq.h("AddonResolutionService", name32 + ": " + size2 + " episode-matched streams (" + i2 + " direct, " + i3 + " torrent), " + i + " cached");
                            set2 = set;
                            oz2 oz2VarB2 = addonResolutionService.c.b(list152, this.w, set2);
                            addonRepository = addonResolutionService.a;
                            instanceId = installedAddon2.getInstanceId();
                            this.a = list4;
                            this.b = oz2VarB2;
                            this.n = 4;
                            if (addonRepository.updateLastUsed(instanceId, this) == ck1Var) {
                            }
                        }
                    }
                }
                return e6a.a;
            case 4:
                oz2 oz2Var2 = (oz2) this.b;
                List list18 = (List) this.a;
                s38.b(obj);
                oz2Var = oz2Var2;
                list10 = list18;
                list5 = list13;
                set2 = set5;
                List list162 = this.z;
                set3 = this.aa;
                yi7 yi7Var22 = this.ab;
                Map map22 = this.ac;
                this.a = list10;
                this.b = oz2Var;
                this.c = mg6Var3;
                this.d = list162;
                this.e = list5;
                this.f = set3;
                this.i = installedAddon2;
                this.j = yi7Var22;
                this.k = addonResolutionService;
                this.l = set2;
                this.m = map22;
                this.n = 5;
                if (mg6Var3.a(this) != ck1Var) {
                }
                return ck1Var;
            case 5:
                map = this.m;
                set4 = this.l;
                addonResolutionService = this.k;
                yi7Var = this.j;
                InstalledAddon installedAddon3 = this.i;
                set3 = this.f;
                list12 = this.e;
                list11 = this.d;
                mg6Var = (mg6) this.c;
                oz2Var = (oz2) this.b;
                list10 = (List) this.a;
                s38.b(obj);
                installedAddon = installedAddon3;
                list11.addAll(oz2Var.a);
                list12.addAll(list10);
                list12.addAll(oz2Var.b);
                set3.add(installedAddon.getName());
                List listE2 = AddonResolutionService.e(addonResolutionService, list11, set4);
                List listBo2 = y41.bo(list12);
                List listBj2 = y41.bj(new uc(map), set3);
                obj2 = null;
                kc8Var = new kc8(null, listE2, listBo2, listBj2);
                this.a = mg6Var;
                this.b = null;
                this.c = null;
                this.d = null;
                this.e = null;
                this.f = null;
                this.i = null;
                this.j = null;
                this.k = null;
                this.l = null;
                this.m = null;
                this.n = 6;
                if (yi7Var.s(kc8Var, this) != ck1Var) {
                }
                return ck1Var;
            case 6:
                mg6Var2 = (mg6) this.a;
                try {
                    s38.b(obj);
                    obj2 = null;
                    mg6Var2.c(obj2);
                    return e6a.a;
                } catch (Throwable th3) {
                    th = th3;
                    mg6Var2.c(null);
                    throw th;
                }
            default:
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
        }
    }
}
