package o6;

import a7.h;
import kotlin.jvm.internal.p0;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;
import rm.y;

/* loaded from: classes.dex */
public final class j implements o6.c {

    /* renamed from: a, reason: collision with root package name */
    private final h f30710a;

    /* renamed from: b, reason: collision with root package name */
    private final q f30711b;

    /* renamed from: c, reason: collision with root package name */
    private final p f30712c;

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class a extends kotlin.coroutines.jvm.internal.d {

        /* renamed from: p, reason: collision with root package name */
        Object f30713p;

        /* renamed from: q, reason: collision with root package name */
        Object f30714q;

        /* renamed from: r, reason: collision with root package name */
        Object f30715r;

        /* renamed from: s, reason: collision with root package name */
        /* synthetic */ Object f30716s;

        /* renamed from: u, reason: collision with root package name */
        int f30718u;

        a(vm.d dVar) {
            super(dVar);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            this.f30716s = obj;
            this.f30718u |= Integer.MIN_VALUE;
            return j.this.a(null, null, this);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class b extends v implements dn.a {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ g f30719p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        b(g gVar) {
            super(0);
            this.f30719p = gVar;
        }

        @Override // dn.a
        public final String invoke() {
            return "Canonical request:\n" + this.f30719p.b();
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class c extends v implements dn.a {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ String f30720p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        c(String str) {
            super(0);
            this.f30720p = str;
        }

        @Override // dn.a
        public final String invoke() {
            return "String to sign:\n" + this.f30720p;
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class d extends v implements dn.a {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ String f30721p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        d(String str) {
            super(0);
            this.f30721p = str;
        }

        @Override // dn.a
        public final String invoke() {
            return "Calculated signature: " + this.f30721p;
        }
    }

    public j(h canonicalizer, q signatureCalculator, p requestMutator) {
        t.g(canonicalizer, "canonicalizer");
        t.g(signatureCalculator, "signatureCalculator");
        t.g(requestMutator, "requestMutator");
        this.f30710a = canonicalizer;
        this.f30711b = signatureCalculator;
        this.f30712c = requestMutator;
    }

    /* JADX WARN: Removed duplicated region for block: B:12:0x007b  */
    /* JADX WARN: Removed duplicated region for block: B:18:0x003e  */
    /* JADX WARN: Removed duplicated region for block: B:8:0x0023  */
    @Override // o6.c
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public Object a(u6.a aVar, e eVar, vm.d dVar) {
        a aVar2;
        Object f10;
        int i10;
        j jVar;
        a7.h hVar;
        byte[] w10;
        if (dVar instanceof a) {
            aVar2 = (a) dVar;
            int i11 = aVar2.f30718u;
            if ((i11 & Integer.MIN_VALUE) != 0) {
                aVar2.f30718u = i11 - Integer.MIN_VALUE;
                Object obj = aVar2.f30716s;
                f10 = wm.d.f();
                i10 = aVar2.f30718u;
                if (i10 != 0) {
                    y.b(obj);
                    vm.g context = aVar2.getContext();
                    String d10 = p0.b(j.class).d();
                    if (d10 == null) {
                        throw new IllegalArgumentException("logger<T> cannot be used on an anonymous object".toString());
                    }
                    a7.h d11 = a7.e.d(context, d10);
                    if (eVar.a() != o6.d.SIGV4) {
                        throw new r(eVar.a() + " support is not yet implemented for the default signer.", eVar.a());
                    }
                    h hVar2 = this.f30710a;
                    aVar2.f30713p = this;
                    aVar2.f30714q = eVar;
                    aVar2.f30715r = d11;
                    aVar2.f30718u = 1;
                    Object a10 = hVar2.a(aVar, eVar, aVar2);
                    if (a10 == f10) {
                        return f10;
                    }
                    jVar = this;
                    hVar = d11;
                    obj = a10;
                } else {
                    if (i10 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    hVar = (a7.h) aVar2.f30715r;
                    eVar = (e) aVar2.f30714q;
                    jVar = (j) aVar2.f30713p;
                    y.b(obj);
                }
                g gVar = (g) obj;
                if (eVar.e()) {
                    h.b.b(hVar, null, new b(gVar), 1, null);
                }
                String c10 = jVar.f30711b.c(gVar.b(), eVar);
                h.b.b(hVar, null, new c(c10), 1, null);
                String a11 = jVar.f30711b.a(jVar.f30711b.b(eVar), c10);
                h.b.a(hVar, null, new d(a11), 1, null);
                u6.a a12 = jVar.f30712c.a(eVar, gVar, a11);
                w10 = kotlin.text.y.w(a11);
                return new f(a12, w10);
            }
        }
        aVar2 = new a(dVar);
        Object obj2 = aVar2.f30716s;
        f10 = wm.d.f();
        i10 = aVar2.f30718u;
        if (i10 != 0) {
        }
        g gVar2 = (g) obj2;
        if (eVar.e()) {
        }
        String c102 = jVar.f30711b.c(gVar2.b(), eVar);
        h.b.b(hVar, null, new c(c102), 1, null);
        String a112 = jVar.f30711b.a(jVar.f30711b.b(eVar), c102);
        h.b.a(hVar, null, new d(a112), 1, null);
        u6.a a122 = jVar.f30712c.a(eVar, gVar2, a112);
        w10 = kotlin.text.y.w(a112);
        return new f(a122, w10);
    }

    public /* synthetic */ j(h hVar, q qVar, p pVar, int i10, kotlin.jvm.internal.k kVar) {
        this((i10 & 1) != 0 ? h.f30702a.a() : hVar, (i10 & 2) != 0 ? q.f30747a.a() : qVar, (i10 & 4) != 0 ? p.f30744a.a() : pVar);
    }
}
