package w9;

import ca.canadapost.core.data.flex.api.IOutletApi;
import ca.canadapost.core.data.flex.api.IOutletDetailApi;
import ca.canadapost.core.data.model.CommonErrorResponseException;
import ca.canadapost.core.data.model.ResultWrapper;
import dn.l;
import ha.f;
import ha.g;
import java.util.concurrent.TimeUnit;
import km.t;
import kotlin.jvm.internal.p0;
import kotlin.jvm.internal.v;
import or.u;
import uq.z;

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

    /* loaded from: classes.dex */
    static final class a extends v implements l {

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

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        a(t tVar) {
            super(1);
            this.f41036p = tVar;
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final ResultWrapper.Error invoke(or.t response) {
            kotlin.jvm.internal.t.g(response, "response");
            return g.a(response, this.f41036p, p0.b(CommonErrorResponseException.class));
        }
    }

    public final IOutletApi a(ha.c httpClientBuilderFactory, jr.a loggingInterceptor, f9.a fireBaseAppCheckInterceptor, t moshi) {
        kotlin.jvm.internal.t.g(httpClientBuilderFactory, "httpClientBuilderFactory");
        kotlin.jvm.internal.t.g(loggingInterceptor, "loggingInterceptor");
        kotlin.jvm.internal.t.g(fireBaseAppCheckInterceptor, "fireBaseAppCheckInterceptor");
        kotlin.jvm.internal.t.g(moshi, "moshi");
        u.b b10 = new u.b().c("https://www.canadapost-postescanada.ca/mgw/").b(qr.a.g(moshi));
        z.a a10 = httpClientBuilderFactory.a();
        TimeUnit timeUnit = TimeUnit.SECONDS;
        Object b11 = b10.g(a10.e(20L, timeUnit).N(20L, timeUnit).a(fireBaseAppCheckInterceptor).a(loggingInterceptor).d()).e().b(IOutletApi.class);
        kotlin.jvm.internal.t.f(b11, "create(...)");
        return (IOutletApi) b11;
    }

    public final IOutletDetailApi b(ha.c httpClientBuilderFactory, jr.a loggingInterceptor, f9.a fireBaseAppCheckInterceptor, t moshi) {
        kotlin.jvm.internal.t.g(httpClientBuilderFactory, "httpClientBuilderFactory");
        kotlin.jvm.internal.t.g(loggingInterceptor, "loggingInterceptor");
        kotlin.jvm.internal.t.g(fireBaseAppCheckInterceptor, "fireBaseAppCheckInterceptor");
        kotlin.jvm.internal.t.g(moshi, "moshi");
        Object b10 = new u.b().c("https://www.canadapost-postescanada.ca/mgw/").b(qr.a.g(moshi)).g(httpClientBuilderFactory.a().a(fireBaseAppCheckInterceptor).a(loggingInterceptor).d()).a(new f(new a(moshi))).e().b(IOutletDetailApi.class);
        kotlin.jvm.internal.t.f(b10, "create(...)");
        return (IOutletDetailApi) b10;
    }
}
