package a3;

import V4.InterfaceC0765i0;
import com.revenuecat.purchases.common.Constants;
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.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import m3.AbstractC2467b;
import okhttp3.OkHttpClient;
import w4.C3137A;

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

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

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

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

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

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final /* synthetic */ J4.a f10517e;

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

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

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final /* synthetic */ AtomicReference f10520k;
    public final /* synthetic */ Set l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public final /* synthetic */ AtomicInteger f10521m;

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

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public final /* synthetic */ String f10523o;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public final /* synthetic */ Integer f10524p;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public final /* synthetic */ Integer f10525q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public final /* synthetic */ boolean f10526r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final /* synthetic */ Map f10527s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public final /* synthetic */ N2.r f10528t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public final /* synthetic */ OkHttpClient f10529u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public final /* synthetic */ e5.e f10530v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public final /* synthetic */ AtomicReference f10531w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public final /* synthetic */ kotlin.jvm.internal.C f10532x;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public G(int i6, int i7, J4.a aVar, List list, C0963b c0963b, AtomicReference atomicReference, Set set, AtomicInteger atomicInteger, int i8, String str, Integer num, Integer num2, boolean z6, Map map, N2.r rVar, OkHttpClient okHttpClient, e5.e eVar, AtomicReference atomicReference2, kotlin.jvm.internal.C c6, A4.d dVar) {
        super(2, dVar);
        this.f10515c = i6;
        this.f10516d = i7;
        this.f10517e = aVar;
        this.f10518f = list;
        this.f10519j = c0963b;
        this.f10520k = atomicReference;
        this.l = set;
        this.f10521m = atomicInteger;
        this.f10522n = i8;
        this.f10523o = str;
        this.f10524p = num;
        this.f10525q = num2;
        this.f10526r = z6;
        this.f10527s = map;
        this.f10528t = rVar;
        this.f10529u = okHttpClient;
        this.f10530v = eVar;
        this.f10531w = atomicReference2;
        this.f10532x = c6;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        G g6 = new G(this.f10515c, this.f10516d, this.f10517e, this.f10518f, this.f10519j, this.f10520k, this.l, this.f10521m, this.f10522n, this.f10523o, this.f10524p, this.f10525q, this.f10526r, this.f10527s, this.f10528t, this.f10529u, this.f10530v, this.f10531w, this.f10532x, dVar);
        g6.f10514b = obj;
        return g6;
    }

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

    @Override // C4.a
    public final Object invokeSuspend(Object obj) {
        Iterator it;
        int i6;
        CopyOnWriteArrayList copyOnWriteArrayList;
        B4.a aVar = B4.a.f492a;
        int i7 = this.f10513a;
        try {
            if (i7 == 0) {
                AbstractC2467b.l(obj);
                V4.C c6 = (V4.C) this.f10514b;
                CopyOnWriteArrayList copyOnWriteArrayList2 = new CopyOnWriteArrayList();
                int i8 = this.f10515c + 1;
                while (i8 < this.f10516d && ((Boolean) this.f10517e.invoke()).booleanValue()) {
                    N2.f fVarI0 = W.a.i0(this.f10518f, i8, this.f10519j);
                    if (fVarI0 == null) {
                        i6 = i8;
                        copyOnWriteArrayList = copyOnWriteArrayList2;
                    } else {
                        i6 = i8;
                        copyOnWriteArrayList = copyOnWriteArrayList2;
                        copyOnWriteArrayList.add(V4.E.y(c6, null, null, new F(this.f10520k, this.f10517e, this.l, this.f10521m, this.f10522n, fVarI0, this.f10523o, this.f10524p, this.f10525q, this.f10526r, this.f10527s, this.f10528t, this.f10529u, this.f10530v, fVarI0.f5143a + Constants.SUBS_ID_BASE_PLAN_ID_SEPARATOR + fVarI0.f5144b, this.f10531w, this.f10532x, copyOnWriteArrayList2, null), 3));
                    }
                    copyOnWriteArrayList2 = copyOnWriteArrayList;
                    i8 = i6 + 1;
                }
                it = copyOnWriteArrayList2.iterator();
                kotlin.jvm.internal.o.g(it, "iterator(...)");
            } else {
                if (i7 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                it = (Iterator) this.f10514b;
                AbstractC2467b.l(obj);
            }
            while (it.hasNext()) {
                InterfaceC0765i0 interfaceC0765i0 = (InterfaceC0765i0) it.next();
                this.f10514b = it;
                this.f10513a = 1;
                if (interfaceC0765i0.join(this) == aVar) {
                    return aVar;
                }
            }
        } catch (CancellationException unused) {
        }
        return C3137A.f25453a;
    }
}
