package com.strmr.ps.data.service;

import com.strmr.ps.data.repository.IDebridProvider;
import defpackage.ak1;
import defpackage.ck1;
import defpackage.e6a;
import defpackage.gr3;
import defpackage.i50;
import defpackage.s38;
import defpackage.vx8;
import defpackage.wj0;
import defpackage.y41;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010 \n\u0002\u0010\u0000\n\u0002\b\u0002\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00020\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0003\u0010\u0004"}, d2 = {"Lak1;", "", "", "<anonymous>", "(Lak1;)Ljava/util/List;"}, k = 3, mv = {2, 0, 0})
@DebugMetadata(c = "com.strmr.ps.data.service.AddonResolutionService$checkCacheStatus$2", f = "AddonResolutionService.kt", i = {0, 0, 0}, l = {809, 827}, m = "invokeSuspend", n = {"$this$coroutineScope", "destination$iv$iv", "element$iv$iv"}, s = {"L$0", "L$1", "L$3"})
@vx8
final class c extends SuspendLambda implements gr3<ak1, Continuation<? super List<? extends Object>>, Object> {
    public Collection a;
    public Iterator b;
    public Object c;
    public int d;
    public /* synthetic */ Object e;
    public final /* synthetic */ AddonResolutionService f;
    public final /* synthetic */ List i;
    public final /* synthetic */ ConcurrentHashMap j;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public c(AddonResolutionService addonResolutionService, List list, ConcurrentHashMap concurrentHashMap, Continuation continuation) {
        super(2, continuation);
        this.f = addonResolutionService;
        this.i = list;
        this.j = concurrentHashMap;
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Continuation create(Object obj, Continuation continuation) {
        c cVar = new c(this.f, this.i, this.j, continuation);
        cVar.e = obj;
        return cVar;
    }

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

    /* JADX WARN: Code restructure failed: missing block: B:15:0x005f, code lost:
    
        if (r10 == r0) goto L26;
     */
    /* JADX WARN: Removed duplicated region for block: B:14:0x0047  */
    /* JADX WARN: Removed duplicated region for block: B:20:0x006e  */
    /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:15:0x005f -> B:17:0x0062). Please report as a decompilation issue!!! */
    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) {
        ak1 ak1Var;
        Collection arrayList;
        Iterator it;
        ck1 ck1Var = ck1.a;
        int i = this.d;
        if (i == 0) {
            s38.b(obj);
            ak1 ak1Var2 = (ak1) this.e;
            List list = this.f.e;
            ak1Var = ak1Var2;
            arrayList = new ArrayList();
            it = list.iterator();
            if (it.hasNext()) {
            }
            return ck1Var;
        }
        if (i != 1) {
            if (i != 2) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            s38.b(obj);
            return obj;
        }
        Object next = this.c;
        it = this.b;
        arrayList = this.a;
        ak1Var = (ak1) this.e;
        s38.b(obj);
        if (((Boolean) obj).booleanValue()) {
            arrayList.add(next);
        }
        if (it.hasNext()) {
            List list2 = (List) arrayList;
            ArrayList arrayList2 = new ArrayList(y41.p(list2, 10));
            Iterator it2 = list2.iterator();
            while (it2.hasNext()) {
                arrayList2.add(wj0.a(ak1Var, null, new b((IDebridProvider) it2.next(), this.i, this.j, null), 3));
            }
            this.e = null;
            this.a = null;
            this.b = null;
            this.c = null;
            this.d = 2;
            Object objA = i50.a(arrayList2, this);
            if (objA != ck1Var) {
                return objA;
            }
        } else {
            next = it.next();
            this.e = ak1Var;
            this.a = arrayList;
            this.b = it;
            this.c = next;
            this.d = 1;
            obj = ((IDebridProvider) next).hasAccount(this);
        }
        return ck1Var;
    }
}
