package go;

import com.fasterxml.jackson.core.JsonFactory;
import dn.l;
import hp.b0;
import hp.d1;
import hp.e0;
import hp.f0;
import hp.g0;
import hp.g1;
import hp.h1;
import hp.j1;
import hp.k1;
import hp.m0;
import hp.o1;
import hp.t1;
import hp.z0;
import java.util.ArrayList;
import java.util.List;
import kotlin.jvm.internal.k;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;
import kotlin.reflect.jvm.internal.impl.types.error.j;
import rm.c0;
import tn.e1;

/* loaded from: classes3.dex */
public final class g extends k1 {

    /* renamed from: e, reason: collision with root package name */
    public static final a f20098e = new a(null);

    /* renamed from: f, reason: collision with root package name */
    private static final go.a f20099f;

    /* renamed from: g, reason: collision with root package name */
    private static final go.a f20100g;

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

    /* renamed from: d, reason: collision with root package name */
    private final g1 f20102d;

    /* loaded from: classes3.dex */
    public static final class a {
        private a() {
        }

        public /* synthetic */ a(k kVar) {
            this();
        }
    }

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

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ tn.e f20103p;

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

        /* renamed from: r, reason: collision with root package name */
        final /* synthetic */ m0 f20105r;

        /* renamed from: s, reason: collision with root package name */
        final /* synthetic */ go.a f20106s;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        b(tn.e eVar, g gVar, m0 m0Var, go.a aVar) {
            super(1);
            this.f20103p = eVar;
            this.f20104q = gVar;
            this.f20105r = m0Var;
            this.f20106s = aVar;
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final m0 invoke(kotlin.reflect.jvm.internal.impl.types.checker.g kotlinTypeRefiner) {
            ro.b k10;
            tn.e b10;
            t.g(kotlinTypeRefiner, "kotlinTypeRefiner");
            tn.e eVar = this.f20103p;
            if (!(eVar instanceof tn.e)) {
                eVar = null;
            }
            if (eVar == null || (k10 = xo.c.k(eVar)) == null || (b10 = kotlinTypeRefiner.b(k10)) == null || t.b(b10, this.f20103p)) {
                return null;
            }
            return (m0) this.f20104q.j(this.f20105r, b10, this.f20106s).c();
        }
    }

    static {
        o1 o1Var = o1.COMMON;
        f20099f = go.b.b(o1Var, false, true, null, 5, null).l(c.FLEXIBLE_LOWER_BOUND);
        f20100g = go.b.b(o1Var, false, true, null, 5, null).l(c.FLEXIBLE_UPPER_BOUND);
    }

    public g(g1 g1Var) {
        f fVar = new f();
        this.f20101c = fVar;
        this.f20102d = g1Var == null ? new g1(fVar, null, 2, null) : g1Var;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final rm.v j(m0 m0Var, tn.e eVar, go.a aVar) {
        int v10;
        List e10;
        if (m0Var.K0().getParameters().isEmpty()) {
            return c0.a(m0Var, Boolean.FALSE);
        }
        if (qn.g.c0(m0Var)) {
            h1 h1Var = (h1) m0Var.I0().get(0);
            t1 a10 = h1Var.a();
            e0 type = h1Var.getType();
            t.f(type, "getType(...)");
            e10 = sm.t.e(new j1(a10, k(type, aVar)));
            return c0.a(f0.j(m0Var.J0(), m0Var.K0(), e10, m0Var.L0(), null, 16, null), Boolean.FALSE);
        }
        if (g0.a(m0Var)) {
            return c0.a(kotlin.reflect.jvm.internal.impl.types.error.k.d(j.ERROR_RAW_TYPE, m0Var.K0().toString()), Boolean.FALSE);
        }
        ap.h k02 = eVar.k0(this);
        t.f(k02, "getMemberScope(...)");
        z0 J0 = m0Var.J0();
        d1 j10 = eVar.j();
        t.f(j10, "getTypeConstructor(...)");
        List parameters = eVar.j().getParameters();
        t.f(parameters, "getParameters(...)");
        List<e1> list = parameters;
        v10 = sm.v.v(list, 10);
        ArrayList arrayList = new ArrayList(v10);
        for (e1 e1Var : list) {
            f fVar = this.f20101c;
            t.d(e1Var);
            arrayList.add(hp.v.b(fVar, e1Var, aVar, this.f20102d, null, 8, null));
        }
        return c0.a(f0.l(J0, j10, arrayList, m0Var.L0(), k02, new b(eVar, this, m0Var, aVar)), Boolean.TRUE);
    }

    private final e0 k(e0 e0Var, go.a aVar) {
        tn.h p10 = e0Var.K0().p();
        if (p10 instanceof e1) {
            return k(this.f20102d.c((e1) p10, aVar.j(true)), aVar);
        }
        if (!(p10 instanceof tn.e)) {
            throw new IllegalStateException(("Unexpected declaration kind: " + p10).toString());
        }
        tn.h p11 = b0.d(e0Var).K0().p();
        if (p11 instanceof tn.e) {
            rm.v j10 = j(b0.c(e0Var), (tn.e) p10, f20099f);
            m0 m0Var = (m0) j10.a();
            boolean booleanValue = ((Boolean) j10.b()).booleanValue();
            rm.v j11 = j(b0.d(e0Var), (tn.e) p11, f20100g);
            m0 m0Var2 = (m0) j11.a();
            return (booleanValue || ((Boolean) j11.b()).booleanValue()) ? new h(m0Var, m0Var2) : f0.d(m0Var, m0Var2);
        }
        throw new IllegalStateException(("For some reason declaration for upper bound is not a class but \"" + p11 + "\" while for lower it's \"" + p10 + JsonFactory.DEFAULT_QUOTE_CHAR).toString());
    }

    static /* synthetic */ e0 l(g gVar, e0 e0Var, go.a aVar, int i10, Object obj) {
        if ((i10 & 2) != 0) {
            aVar = new go.a(o1.COMMON, null, false, false, null, null, 62, null);
        }
        return gVar.k(e0Var, aVar);
    }

    @Override // hp.k1
    public boolean f() {
        return false;
    }

    @Override // hp.k1
    /* renamed from: m, reason: merged with bridge method [inline-methods] */
    public j1 e(e0 key) {
        t.g(key, "key");
        return new j1(l(this, key, null, 2, null));
    }

    public /* synthetic */ g(g1 g1Var, int i10, k kVar) {
        this((i10 & 1) != 0 ? null : g1Var);
    }
}
