package fo;

import bo.b0;
import bo.s;
import dp.r;
import hp.d1;
import hp.e0;
import hp.f0;
import hp.j1;
import hp.o1;
import hp.t1;
import hp.z0;
import io.x;
import io.y;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;
import rm.o;
import rm.q;
import sm.c0;
import sm.k0;
import tn.c1;
import tn.d0;
import tn.e1;
import tn.f1;
import tn.g1;
import tn.j0;
import tn.m1;
import tn.x0;
import vo.u;

/* loaded from: classes3.dex */
public final class f extends vn.g implements p002do.c {
    public static final a N = new a(null);
    private static final Set O;
    private final eo.g A;
    private final o B;
    private final tn.f C;
    private final d0 D;
    private final m1 E;
    private final boolean F;
    private final b G;
    private final g H;
    private final x0 I;
    private final ap.f J;
    private final l K;
    private final kotlin.reflect.jvm.internal.impl.descriptors.annotations.g L;
    private final gp.i M;

    /* renamed from: x, reason: collision with root package name */
    private final eo.g f18643x;

    /* renamed from: y, reason: collision with root package name */
    private final io.g f18644y;

    /* renamed from: z, reason: collision with root package name */
    private final tn.e f18645z;

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

        public /* synthetic */ a(kotlin.jvm.internal.k kVar) {
            this();
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes3.dex */
    public final class b extends hp.b {

        /* renamed from: d, reason: collision with root package name */
        private final gp.i f18646d;

        /* loaded from: classes3.dex */
        static final class a extends v implements dn.a {

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

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            a(f fVar) {
                super(0);
                this.f18648p = fVar;
            }

            @Override // dn.a
            /* renamed from: a, reason: merged with bridge method [inline-methods] */
            public final List invoke() {
                return f1.d(this.f18648p);
            }
        }

        public b() {
            super(f.this.A.e());
            this.f18646d = f.this.A.e().b(new a(f.this));
        }

        /* JADX WARN: Code restructure failed: missing block: B:8:0x0019, code lost:
        
            if ((!r0.d() && r0.i(qn.j.f33983x)) != false) goto L13;
         */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        private final e0 v() {
            ro.c cVar;
            Object D0;
            int v10;
            ArrayList arrayList;
            int v11;
            ro.c w10 = w();
            if (w10 != null) {
            }
            w10 = null;
            if (w10 == null) {
                cVar = bo.m.f7149a.b(xo.c.l(f.this));
                if (cVar == null) {
                    return null;
                }
            } else {
                cVar = w10;
            }
            tn.e w11 = xo.c.w(f.this.A.d(), cVar, ao.d.FROM_JAVA_LOADER);
            if (w11 == null) {
                return null;
            }
            int size = w11.j().getParameters().size();
            List parameters = f.this.j().getParameters();
            t.f(parameters, "getParameters(...)");
            int size2 = parameters.size();
            if (size2 == size) {
                List list = parameters;
                v11 = sm.v.v(list, 10);
                arrayList = new ArrayList(v11);
                Iterator it = list.iterator();
                while (it.hasNext()) {
                    arrayList.add(new j1(t1.INVARIANT, ((e1) it.next()).q()));
                }
            } else {
                if (size2 != 1 || size <= 1 || w10 != null) {
                    return null;
                }
                t1 t1Var = t1.INVARIANT;
                D0 = c0.D0(parameters);
                j1 j1Var = new j1(t1Var, ((e1) D0).q());
                jn.i iVar = new jn.i(1, size);
                v10 = sm.v.v(iVar, 10);
                ArrayList arrayList2 = new ArrayList(v10);
                Iterator it2 = iVar.iterator();
                while (it2.hasNext()) {
                    ((k0) it2).a();
                    arrayList2.add(j1Var);
                }
                arrayList = arrayList2;
            }
            return f0.g(z0.f22028q.i(), w11, arrayList);
        }

        private final ro.c w() {
            Object E0;
            String str;
            kotlin.reflect.jvm.internal.impl.descriptors.annotations.g annotations = f.this.getAnnotations();
            ro.c PURELY_IMPLEMENTS_ANNOTATION = b0.f7072r;
            t.f(PURELY_IMPLEMENTS_ANNOTATION, "PURELY_IMPLEMENTS_ANNOTATION");
            kotlin.reflect.jvm.internal.impl.descriptors.annotations.c j10 = annotations.j(PURELY_IMPLEMENTS_ANNOTATION);
            if (j10 == null) {
                return null;
            }
            E0 = c0.E0(j10.a().values());
            u uVar = E0 instanceof u ? (u) E0 : null;
            if (uVar == null || (str = (String) uVar.b()) == null || !ro.e.e(str)) {
                return null;
            }
            return new ro.c(str);
        }

        @Override // hp.f
        protected Collection f() {
            int v10;
            Collection n10 = f.this.M0().n();
            ArrayList arrayList = new ArrayList(n10.size());
            ArrayList<x> arrayList2 = new ArrayList(0);
            e0 v11 = v();
            Iterator it = n10.iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                io.j jVar = (io.j) it.next();
                e0 h10 = f.this.A.a().r().h(f.this.A.g().o(jVar, go.b.b(o1.SUPERTYPE, false, false, null, 7, null)), f.this.A);
                if (h10.K0().p() instanceof j0.b) {
                    arrayList2.add(jVar);
                }
                if (!t.b(h10.K0(), v11 != null ? v11.K0() : null) && !qn.g.b0(h10)) {
                    arrayList.add(h10);
                }
            }
            tn.e eVar = f.this.f18645z;
            pp.a.a(arrayList, eVar != null ? sn.m.a(eVar, f.this).c().p(eVar.q(), t1.INVARIANT) : null);
            pp.a.a(arrayList, v11);
            if (!arrayList2.isEmpty()) {
                r c10 = f.this.A.a().c();
                tn.e p10 = p();
                v10 = sm.v.v(arrayList2, 10);
                ArrayList arrayList3 = new ArrayList(v10);
                for (x xVar : arrayList2) {
                    t.e(xVar, "null cannot be cast to non-null type org.jetbrains.kotlin.load.java.structure.JavaClassifierType");
                    arrayList3.add(((io.j) xVar).o());
                }
                c10.b(p10, arrayList3);
            }
            return arrayList.isEmpty() ^ true ? c0.S0(arrayList) : sm.t.e(f.this.A.d().m().i());
        }

        @Override // hp.d1
        public List getParameters() {
            return (List) this.f18646d.invoke();
        }

        @Override // hp.f
        protected c1 j() {
            return f.this.A.a().v();
        }

        @Override // hp.d1
        public boolean q() {
            return true;
        }

        public String toString() {
            String e10 = f.this.getName().e();
            t.f(e10, "asString(...)");
            return e10;
        }

        @Override // hp.l, hp.d1
        /* renamed from: u */
        public tn.e p() {
            return f.this;
        }
    }

    /* loaded from: classes3.dex */
    static final class c extends v implements dn.a {
        c() {
            super(0);
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final List invoke() {
            int v10;
            List<y> typeParameters = f.this.M0().getTypeParameters();
            f fVar = f.this;
            v10 = sm.v.v(typeParameters, 10);
            ArrayList arrayList = new ArrayList(v10);
            for (y yVar : typeParameters) {
                e1 a10 = fVar.A.f().a(yVar);
                if (a10 == null) {
                    throw new AssertionError("Parameter " + yVar + " surely belongs to class " + fVar.M0() + ", so it must be resolved");
                }
                arrayList.add(a10);
            }
            return arrayList;
        }
    }

    /* loaded from: classes3.dex */
    public static final class d implements Comparator {
        @Override // java.util.Comparator
        public final int compare(Object obj, Object obj2) {
            int d10;
            d10 = um.c.d(xo.c.l((tn.e) obj).b(), xo.c.l((tn.e) obj2).b());
            return d10;
        }
    }

    /* loaded from: classes3.dex */
    static final class e extends v implements dn.a {
        e() {
            super(0);
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final List invoke() {
            ro.b k10 = xo.c.k(f.this);
            if (k10 != null) {
                return f.this.O0().a().f().a(k10);
            }
            return null;
        }
    }

    /* renamed from: fo.f$f, reason: collision with other inner class name */
    /* loaded from: classes3.dex */
    static final class C0404f extends v implements dn.l {
        C0404f() {
            super(1);
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final g invoke(kotlin.reflect.jvm.internal.impl.types.checker.g it) {
            t.g(it, "it");
            eo.g gVar = f.this.A;
            f fVar = f.this;
            return new g(gVar, fVar, fVar.M0(), f.this.f18645z != null, f.this.H);
        }
    }

    static {
        Set h10;
        h10 = sm.x0.h("equals", "hashCode", "getClass", "wait", "notify", "notifyAll", "toString");
        O = h10;
    }

    public /* synthetic */ f(eo.g gVar, tn.m mVar, io.g gVar2, tn.e eVar, int i10, kotlin.jvm.internal.k kVar) {
        this(gVar, mVar, gVar2, (i10 & 8) != 0 ? null : eVar);
    }

    @Override // tn.c0
    public boolean C0() {
        return false;
    }

    @Override // tn.e
    public Collection F() {
        List k10;
        List J0;
        if (this.D != d0.SEALED) {
            k10 = sm.u.k();
            return k10;
        }
        go.a b10 = go.b.b(o1.COMMON, false, false, null, 7, null);
        Collection N2 = this.f18644y.N();
        ArrayList arrayList = new ArrayList();
        Iterator it = N2.iterator();
        while (it.hasNext()) {
            tn.h p10 = this.A.g().o((io.j) it.next(), b10).K0().p();
            tn.e eVar = p10 instanceof tn.e ? (tn.e) p10 : null;
            if (eVar != null) {
                arrayList.add(eVar);
            }
        }
        J0 = c0.J0(arrayList, new d());
        return J0;
    }

    @Override // tn.e
    public boolean F0() {
        return false;
    }

    @Override // tn.e
    public boolean G() {
        return false;
    }

    @Override // tn.c0
    public boolean H() {
        return false;
    }

    @Override // tn.i
    public boolean I() {
        return this.F;
    }

    public final f K0(co.g javaResolverCache, tn.e eVar) {
        t.g(javaResolverCache, "javaResolverCache");
        eo.g gVar = this.A;
        eo.g i10 = eo.a.i(gVar, gVar.a().x(javaResolverCache));
        tn.m b10 = b();
        t.f(b10, "getContainingDeclaration(...)");
        return new f(i10, b10, this.f18644y, eVar);
    }

    @Override // tn.e
    /* renamed from: L0, reason: merged with bridge method [inline-methods] */
    public List h() {
        return (List) this.H.x0().invoke();
    }

    public final io.g M0() {
        return this.f18644y;
    }

    @Override // tn.e
    public tn.d N() {
        return null;
    }

    public final List N0() {
        return (List) this.B.getValue();
    }

    @Override // tn.e
    public ap.h O() {
        return this.K;
    }

    public final eo.g O0() {
        return this.f18643x;
    }

    @Override // vn.a, tn.e
    /* renamed from: P0, reason: merged with bridge method [inline-methods] */
    public g B0() {
        ap.h B0 = super.B0();
        t.e(B0, "null cannot be cast to non-null type org.jetbrains.kotlin.load.java.lazy.descriptors.LazyJavaClassMemberScope");
        return (g) B0;
    }

    @Override // tn.e
    public tn.e Q() {
        return null;
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // vn.t
    /* renamed from: Q0, reason: merged with bridge method [inline-methods] */
    public g q0(kotlin.reflect.jvm.internal.impl.types.checker.g kotlinTypeRefiner) {
        t.g(kotlinTypeRefiner, "kotlinTypeRefiner");
        return (g) this.I.c(kotlinTypeRefiner);
    }

    @Override // tn.e
    public tn.f g() {
        return this.C;
    }

    @Override // kotlin.reflect.jvm.internal.impl.descriptors.annotations.a
    public kotlin.reflect.jvm.internal.impl.descriptors.annotations.g getAnnotations() {
        return this.L;
    }

    @Override // tn.e, tn.q, tn.c0
    public tn.u getVisibility() {
        if (!t.b(this.E, tn.t.f36410a) || this.f18644y.k() != null) {
            return bo.j0.d(this.E);
        }
        tn.u uVar = s.f7159a;
        t.d(uVar);
        return uVar;
    }

    @Override // tn.e
    public boolean isInline() {
        return false;
    }

    @Override // tn.h
    public d1 j() {
        return this.G;
    }

    @Override // tn.e, tn.c0
    public d0 k() {
        return this.D;
    }

    @Override // tn.e, tn.i
    public List s() {
        return (List) this.M.invoke();
    }

    public String toString() {
        return "Lazy Java class " + xo.c.m(this);
    }

    @Override // tn.e
    public boolean v() {
        return false;
    }

    @Override // vn.a, tn.e
    public ap.h v0() {
        return this.J;
    }

    @Override // tn.e
    public g1 w0() {
        return null;
    }

    @Override // tn.e
    public boolean y() {
        return false;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public f(eo.g outerContext, tn.m containingDeclaration, io.g jClass, tn.e eVar) {
        super(outerContext.e(), containingDeclaration, jClass.getName(), outerContext.a().t().a(jClass), false);
        o a10;
        tn.f fVar;
        d0 d0Var;
        t.g(outerContext, "outerContext");
        t.g(containingDeclaration, "containingDeclaration");
        t.g(jClass, "jClass");
        this.f18643x = outerContext;
        this.f18644y = jClass;
        this.f18645z = eVar;
        eo.g d10 = eo.a.d(outerContext, this, jClass, 0, 4, null);
        this.A = d10;
        d10.a().h().e(jClass, this);
        jClass.I();
        a10 = q.a(new e());
        this.B = a10;
        if (jClass.p()) {
            fVar = tn.f.ANNOTATION_CLASS;
        } else if (jClass.H()) {
            fVar = tn.f.INTERFACE;
        } else {
            fVar = jClass.z() ? tn.f.ENUM_CLASS : tn.f.CLASS;
        }
        this.C = fVar;
        if (!jClass.p() && !jClass.z()) {
            d0Var = d0.Companion.a(jClass.E(), jClass.E() || jClass.isAbstract() || jClass.H(), !jClass.isFinal());
        } else {
            d0Var = d0.FINAL;
        }
        this.D = d0Var;
        this.E = jClass.getVisibility();
        this.F = (jClass.k() == null || jClass.Q()) ? false : true;
        this.G = new b();
        g gVar = new g(d10, this, jClass, eVar != null, null, 16, null);
        this.H = gVar;
        this.I = x0.f36430e.a(this, d10.e(), d10.a().k().c(), new C0404f());
        this.J = new ap.f(gVar);
        this.K = new l(d10, jClass, this);
        this.L = eo.e.a(d10, jClass);
        this.M = d10.e().b(new c());
    }
}
