package a3;

import V4.InterfaceC0765i0;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CancellationException;
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 H extends C4.j implements J4.e {

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

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

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ N2.f f10536c;

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

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

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

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

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final /* synthetic */ Map f10541k;
    public final /* synthetic */ N2.r l;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public H(N2.f fVar, String str, Integer num, Integer num2, boolean z6, Map map, N2.r rVar, OkHttpClient okHttpClient, e5.e eVar, boolean z7, kotlin.jvm.internal.C c6, int i6, int i7, J4.a aVar, List list, C0963b c0963b, AtomicReference atomicReference, Set set, AtomicInteger atomicInteger, int i8, AtomicReference atomicReference2, kotlin.jvm.internal.C c7, A4.d dVar) {
        super(2, dVar);
        this.f10536c = fVar;
        this.f10537d = str;
        this.f10538e = num;
        this.f10539f = num2;
        this.f10540j = z6;
        this.f10541k = map;
        this.l = rVar;
        this.f10542m = okHttpClient;
        this.f10543n = eVar;
        this.f10544o = z7;
        this.f10545p = c6;
        this.f10546q = i6;
        this.f10547r = i7;
        this.f10548s = aVar;
        this.f10549t = list;
        this.f10550u = c0963b;
        this.f10551v = atomicReference;
        this.f10552w = set;
        this.f10553x = atomicInteger;
        this.f10554y = i8;
        this.f10555z = atomicReference2;
        this.f10533A = c7;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        H h5 = new H(this.f10536c, this.f10537d, this.f10538e, this.f10539f, this.f10540j, this.f10541k, this.l, this.f10542m, this.f10543n, this.f10544o, this.f10545p, this.f10546q, this.f10547r, this.f10548s, this.f10549t, this.f10550u, this.f10551v, this.f10552w, this.f10553x, this.f10554y, this.f10555z, this.f10533A, dVar);
        h5.f10535b = obj;
        return h5;
    }

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

    /* JADX WARN: Multi-variable type inference failed */
    @Override // C4.a
    public final Object invokeSuspend(Object obj) throws Exception {
        N2.f fVar;
        AtomicReference atomicReference;
        final e5.e eVar;
        Integer num;
        Integer num2;
        boolean z6;
        final N2.r rVar;
        final OkHttpClient okHttpClient;
        kotlin.jvm.internal.C c6;
        AtomicReference atomicReference2;
        String str;
        Map map;
        E e6;
        boolean z7;
        Object objQ;
        B4.a aVar = B4.a.f492a;
        int i6 = this.f10534a;
        final AtomicReference atomicReference3 = this.f10555z;
        final AtomicReference atomicReference4 = this.f10551v;
        final kotlin.jvm.internal.C c7 = this.f10545p;
        try {
            if (i6 == 0) {
                AbstractC2467b.l(obj);
                final V4.C c8 = (V4.C) this.f10535b;
                N2.f fVar2 = this.f10536c;
                final String str2 = this.f10537d;
                final Integer num3 = this.f10538e;
                final Integer num4 = this.f10539f;
                final boolean z8 = this.f10540j;
                final Map map2 = this.f10541k;
                N2.r rVar2 = this.l;
                OkHttpClient okHttpClient2 = this.f10542m;
                e5.e eVar2 = this.f10543n;
                if (this.f10544o) {
                    okHttpClient = okHttpClient2;
                    final int i7 = this.f10546q;
                    final int i8 = this.f10547r;
                    fVar = fVar2;
                    final J4.a aVar2 = this.f10548s;
                    final List list = this.f10549t;
                    final C0963b c0963b = this.f10550u;
                    final Set set = this.f10552w;
                    final AtomicInteger atomicInteger = this.f10553x;
                    final int i9 = this.f10554y;
                    final kotlin.jvm.internal.C c9 = this.f10533A;
                    rVar = rVar2;
                    eVar = eVar2;
                    J4.a aVar3 = new J4.a() { // from class: a3.E
                        @Override // J4.a
                        public final Object invoke() {
                            kotlin.jvm.internal.C c10 = c7;
                            if (c10.f20115a == null) {
                                c10.f20115a = V4.E.y(c8, null, null, new G(i7, i8, aVar2, list, c0963b, atomicReference4, set, atomicInteger, i9, str2, num3, num4, z8, map2, rVar, okHttpClient, eVar, atomicReference3, c9, null), 3);
                            }
                            return C3137A.f25453a;
                        }
                    };
                    c6 = c7;
                    atomicReference = atomicReference4;
                    str = str2;
                    num = num3;
                    num2 = num4;
                    z6 = z8;
                    map = map2;
                    atomicReference2 = atomicReference3;
                    e6 = aVar3;
                } else {
                    fVar = fVar2;
                    atomicReference = atomicReference4;
                    eVar = eVar2;
                    num = num3;
                    num2 = num4;
                    z6 = z8;
                    rVar = rVar2;
                    okHttpClient = okHttpClient2;
                    c6 = c7;
                    atomicReference2 = atomicReference3;
                    str = str2;
                    map = map2;
                    e6 = 0;
                }
                this.f10534a = 1;
                z7 = false;
                objQ = W.a.Q(fVar, str, num, num2, z6, map, rVar, okHttpClient, eVar, e6, this);
                if (objQ == aVar) {
                    return aVar;
                }
            } else {
                if (i6 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                AbstractC2467b.l(obj);
                objQ = obj;
                atomicReference = atomicReference4;
                c6 = c7;
                z7 = false;
                atomicReference2 = atomicReference3;
            }
            P p6 = (P) objQ;
            if (p6 != null) {
                if (p6.f10579f) {
                    while (!atomicReference2.compareAndSet(z7, p6) && atomicReference2.get() == null) {
                    }
                } else {
                    String str3 = p6.f10574a;
                    if (str3 != null && !S4.p.Q0(str3)) {
                        while (true) {
                            if (atomicReference.compareAndSet(z7, p6)) {
                                InterfaceC0765i0 interfaceC0765i0 = (InterfaceC0765i0) c6.f20115a;
                                if (interfaceC0765i0 != null) {
                                    interfaceC0765i0.cancel(new CancellationException("primary won"));
                                }
                            } else if (atomicReference.get() != null) {
                                break;
                            }
                        }
                    }
                }
            }
        } catch (CancellationException unused) {
        }
        return C3137A.f25453a;
    }
}
