package defpackage;

import com.strmr.ps.data.local.entity.InstalledAddonEntity;
import com.strmr.ps.data.repository.AddonRepository;
import com.strmr.ps.ui.mobile.settings.MobileAddonsFragment;
import java.util.Iterator;
import java.util.List;
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\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.ui.mobile.settings.MobileAddonsFragment$persistAddonOrder$1", f = "MobileAddonsFragment.kt", i = {0}, l = {223}, m = "invokeSuspend", n = {"index$iv"}, s = {"I$0"})
@vx8
final class e16 extends SuspendLambda implements gr3<ak1, Continuation<? super e6a>, Object> {
    public MobileAddonsFragment a;
    public Iterator b;
    public int c;
    public int d;
    public final /* synthetic */ List e;
    public final /* synthetic */ MobileAddonsFragment f;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public e16(List list, MobileAddonsFragment mobileAddonsFragment, Continuation continuation) {
        super(2, continuation);
        this.e = list;
        this.f = mobileAddonsFragment;
    }

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

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

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Object invokeSuspend(Object obj) {
        Iterator it;
        int i;
        MobileAddonsFragment mobileAddonsFragment;
        ck1 ck1Var = ck1.a;
        int i2 = this.d;
        if (i2 == 0) {
            s38.b(obj);
            it = this.e.iterator();
            i = 0;
            mobileAddonsFragment = this.f;
        } else {
            if (i2 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            int i3 = this.c;
            it = this.b;
            mobileAddonsFragment = this.a;
            s38.b(obj);
            i = i3;
        }
        while (it.hasNext()) {
            Object next = it.next();
            int i4 = i + 1;
            if (i < 0) {
                y41.bm();
                throw null;
            }
            AddonRepository addonRepositoryL = mobileAddonsFragment.l();
            String instanceId = ((InstalledAddonEntity) next).getInstanceId();
            this.a = mobileAddonsFragment;
            this.b = it;
            this.c = i4;
            this.d = 1;
            if (addonRepositoryL.setAddonPriority(instanceId, i, this) == ck1Var) {
                return ck1Var;
            }
            i = i4;
        }
        return e6a.a;
    }
}
