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

import g.h.a.i;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
import kotlin.collections.EmptyList;
import kotlin.collections.j;
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.k.c0.n;
import kotlin.reflect.w.internal.y0.n.b2.h;
import kotlin.reflect.w.internal.y0.n.z1.d;

/* JADX INFO: loaded from: classes2.dex */
public final class f0 implements e1, h {
    public h0 a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final LinkedHashSet<h0> f8918b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final int f8919c;

    public static final class a extends Lambda implements Function1<d, o0> {
        public a() {
            super(1);
        }

        @Override // kotlin.jvm.functions.Function1
        public o0 invoke(d dVar) {
            d dVar2 = dVar;
            o.f(dVar2, "kotlinTypeRefiner");
            return f0.this.a(dVar2).g();
        }
    }

    public static final class b<T> implements Comparator {

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        public final /* synthetic */ Function1 f8921f;

        public b(Function1 function1) {
            this.f8921f = function1;
        }

        /* JADX WARN: Multi-variable type inference failed */
        @Override // java.util.Comparator
        public final int compare(T t2, T t3) {
            h0 h0Var = (h0) t2;
            Function1 function1 = this.f8921f;
            o.e(h0Var, "it");
            String string = function1.invoke(h0Var).toString();
            h0 h0Var2 = (h0) t3;
            Function1 function12 = this.f8921f;
            o.e(h0Var2, "it");
            return i.I(string, function12.invoke(h0Var2).toString());
        }
    }

    public static final class c extends Lambda implements Function1<h0, CharSequence> {

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        public final /* synthetic */ Function1<h0, Object> f8922f;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        /* JADX WARN: Multi-variable type inference failed */
        public c(Function1<? super h0, ? extends Object> function1) {
            super(1);
            this.f8922f = function1;
        }

        @Override // kotlin.jvm.functions.Function1
        public CharSequence invoke(h0 h0Var) {
            h0 h0Var2 = h0Var;
            Function1<h0, Object> function1 = this.f8922f;
            o.e(h0Var2, "it");
            return function1.invoke(h0Var2).toString();
        }
    }

    public f0(Collection<? extends h0> collection) {
        o.f(collection, "typesToIntersect");
        collection.isEmpty();
        LinkedHashSet<h0> linkedHashSet = new LinkedHashSet<>(collection);
        this.f8918b = linkedHashSet;
        this.f8919c = linkedHashSet.hashCode();
    }

    @Override // kotlin.reflect.w.internal.y0.n.e1
    public Collection<h0> b() {
        return this.f8918b;
    }

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

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

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj instanceof f0) {
            return o.a(this.f8918b, ((f0) obj).f8918b);
        }
        return false;
    }

    public final o0 g() {
        Objects.requireNonNull(c1.f8889m);
        return i0.i(c1.f8890n, this, EmptyList.f9307f, false, n.a.a("member scope for intersection type", this.f8918b), new a());
    }

    @Override // kotlin.reflect.w.internal.y0.n.e1
    public List<b1> getParameters() {
        return EmptyList.f9307f;
    }

    public final String h(Function1<? super h0, ? extends Object> function1) {
        o.f(function1, "getProperTypeRelatedToStringify");
        return j.C(j.c0(this.f8918b, new b(function1)), " & ", "{", "}", 0, null, new c(function1), 24);
    }

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

    @Override // kotlin.reflect.w.internal.y0.n.e1
    /* JADX INFO: renamed from: i, reason: merged with bridge method [inline-methods] */
    public f0 a(d dVar) {
        o.f(dVar, "kotlinTypeRefiner");
        LinkedHashSet<h0> linkedHashSet = this.f8918b;
        ArrayList arrayList = new ArrayList(i.H(linkedHashSet, 10));
        Iterator<T> it = linkedHashSet.iterator();
        boolean z2 = false;
        while (it.hasNext()) {
            arrayList.add(((h0) it.next()).N0(dVar));
            z2 = true;
        }
        f0 f0Var = null;
        if (z2) {
            h0 h0Var = this.a;
            h0 h0VarQ0 = h0Var != null ? h0Var.N0(dVar) : null;
            o.f(arrayList, "typesToIntersect");
            arrayList.isEmpty();
            LinkedHashSet linkedHashSet2 = new LinkedHashSet(arrayList);
            linkedHashSet2.hashCode();
            f0 f0Var2 = new f0(linkedHashSet2);
            f0Var2.a = h0VarQ0;
            f0Var = f0Var2;
        }
        return f0Var == null ? this : f0Var;
    }

    @Override // kotlin.reflect.w.internal.y0.n.e1
    public f o() {
        f fVarO = this.f8918b.iterator().next().L0().o();
        o.e(fVarO, "intersectedTypes.iterato…xt().constructor.builtIns");
        return fVarO;
    }

    public String toString() {
        return h(g0.f8929f);
    }
}
