package kotlin.reflect.w.internal.y0.n;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import kotlin.Lazy;
import kotlin.LazyThreadSafetyMode;
import kotlin.Unit;
import kotlin.collections.EmptyList;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Lambda;
import kotlin.jvm.internal.o;
import kotlin.reflect.w.internal.y0.c.f;
import kotlin.reflect.w.internal.y0.d.b1;
import kotlin.reflect.w.internal.y0.d.d0;
import kotlin.reflect.w.internal.y0.d.h;
import kotlin.reflect.w.internal.y0.d.z0;
import kotlin.reflect.w.internal.y0.n.a2.j;
import kotlin.reflect.w.internal.y0.n.z1.m;

/* JADX INFO: loaded from: classes2.dex */
public abstract class i extends q {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final kotlin.reflect.w.internal.y0.m.i<b> f8932b;

    public final class a implements e1 {
        public final kotlin.reflect.w.internal.y0.n.z1.d a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public final Lazy f8933b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        public final /* synthetic */ i f8934c;

        /* JADX INFO: renamed from: r.i0.w.b.y0.n.i$a$a, reason: collision with other inner class name */
        public static final class C0176a extends Lambda implements Function0<List<? extends h0>> {

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

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            public C0176a(i iVar) {
                super(0);
                this.f8936m = iVar;
            }

            @Override // kotlin.jvm.functions.Function0
            public List<? extends h0> invoke() {
                kotlin.reflect.w.internal.y0.n.z1.d dVar = a.this.a;
                List<h0> listB = this.f8936m.b();
                d0<m<?>> d0Var = kotlin.reflect.w.internal.y0.n.z1.e.a;
                o.f(dVar, "<this>");
                o.f(listB, "types");
                ArrayList arrayList = new ArrayList(g.h.a.i.H(listB, 10));
                Iterator<T> it = listB.iterator();
                while (it.hasNext()) {
                    arrayList.add(dVar.a((h0) it.next()));
                }
                return arrayList;
            }
        }

        public a(i iVar, kotlin.reflect.w.internal.y0.n.z1.d dVar) {
            o.f(dVar, "kotlinTypeRefiner");
            this.f8934c = iVar;
            this.a = dVar;
            this.f8933b = g.h.a.i.C2(LazyThreadSafetyMode.PUBLICATION, new C0176a(iVar));
        }

        @Override // kotlin.reflect.w.internal.y0.n.e1
        public e1 a(kotlin.reflect.w.internal.y0.n.z1.d dVar) {
            o.f(dVar, "kotlinTypeRefiner");
            return this.f8934c.a(dVar);
        }

        @Override // kotlin.reflect.w.internal.y0.n.e1
        public Collection b() {
            return (List) this.f8933b.getValue();
        }

        @Override // kotlin.reflect.w.internal.y0.n.e1
        public h c() {
            return this.f8934c.c();
        }

        @Override // kotlin.reflect.w.internal.y0.n.e1
        public boolean e() {
            return this.f8934c.e();
        }

        public boolean equals(Object obj) {
            return this.f8934c.equals(obj);
        }

        @Override // kotlin.reflect.w.internal.y0.n.e1
        public List<b1> getParameters() {
            List<b1> parameters = this.f8934c.getParameters();
            o.e(parameters, "this@AbstractTypeConstructor.parameters");
            return parameters;
        }

        public int hashCode() {
            return this.f8934c.hashCode();
        }

        @Override // kotlin.reflect.w.internal.y0.n.e1
        public f o() {
            f fVarO = this.f8934c.o();
            o.e(fVarO, "this@AbstractTypeConstructor.builtIns");
            return fVarO;
        }

        public String toString() {
            return this.f8934c.toString();
        }
    }

    public static final class b {
        public final Collection<h0> a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public List<? extends h0> f8937b;

        /* JADX WARN: Multi-variable type inference failed */
        public b(Collection<? extends h0> collection) {
            o.f(collection, "allSupertypes");
            this.a = collection;
            j jVar = j.a;
            this.f8937b = g.h.a.i.H2(j.f8874d);
        }
    }

    public static final class c extends Lambda implements Function0<b> {
        public c() {
            super(0);
        }

        @Override // kotlin.jvm.functions.Function0
        public b invoke() {
            return new b(i.this.j());
        }
    }

    public static final class d extends Lambda implements Function1<Boolean, b> {

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        public static final d f8939f = new d();

        public d() {
            super(1);
        }

        @Override // kotlin.jvm.functions.Function1
        public b invoke(Boolean bool) {
            bool.booleanValue();
            j jVar = j.a;
            return new b(g.h.a.i.H2(j.f8874d));
        }
    }

    public static final class e extends Lambda implements Function1<b, Unit> {
        public e() {
            super(1);
        }

        @Override // kotlin.jvm.functions.Function1
        public Unit invoke(b bVar) {
            b bVar2 = bVar;
            o.f(bVar2, "supertypes");
            z0 z0VarM = i.this.m();
            i iVar = i.this;
            Collection<h0> collectionA = z0VarM.a(iVar, bVar2.a, new j(iVar), new k(i.this));
            if (collectionA.isEmpty()) {
                h0 h0VarK = i.this.k();
                collectionA = h0VarK != null ? g.h.a.i.H2(h0VarK) : null;
                if (collectionA == null) {
                    collectionA = EmptyList.f9307f;
                }
            }
            Objects.requireNonNull(i.this);
            i iVar2 = i.this;
            List<h0> listI0 = collectionA instanceof List ? (List) collectionA : null;
            if (listI0 == null) {
                listI0 = kotlin.collections.j.i0(collectionA);
            }
            List<h0> listP = iVar2.p(listI0);
            o.f(listP, "<set-?>");
            bVar2.f8937b = listP;
            return Unit.a;
        }
    }

    public i(kotlin.reflect.w.internal.y0.m.m mVar) {
        o.f(mVar, "storageManager");
        this.f8932b = mVar.f(new c(), d.f8939f, new e());
    }

    public static final Collection i(i iVar, e1 e1Var, boolean z2) {
        Objects.requireNonNull(iVar);
        i iVar2 = e1Var instanceof i ? (i) e1Var : null;
        if (iVar2 != null) {
            return kotlin.collections.j.P(iVar2.f8932b.invoke().a, iVar2.l(z2));
        }
        Collection<h0> collectionB = e1Var.b();
        o.e(collectionB, "supertypes");
        return collectionB;
    }

    @Override // kotlin.reflect.w.internal.y0.n.e1
    public e1 a(kotlin.reflect.w.internal.y0.n.z1.d dVar) {
        o.f(dVar, "kotlinTypeRefiner");
        return new a(this, dVar);
    }

    public abstract Collection<h0> j();

    public h0 k() {
        return null;
    }

    public Collection<h0> l(boolean z2) {
        return EmptyList.f9307f;
    }

    public abstract z0 m();

    @Override // kotlin.reflect.w.internal.y0.n.e1
    /* JADX INFO: renamed from: n, reason: merged with bridge method [inline-methods] */
    public List<h0> b() {
        return this.f8932b.invoke().f8937b;
    }

    public List<h0> p(List<h0> list) {
        o.f(list, "supertypes");
        return list;
    }

    public void q(h0 h0Var) {
        o.f(h0Var, "type");
    }
}
