package fo;

import hp.e0;
import io.q;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;
import pp.b;
import rm.n0;
import rp.p;
import sm.c0;
import sm.u;
import sm.x0;
import sm.z;
import tn.t0;
import tn.y0;

/* loaded from: classes3.dex */
public final class l extends m {

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

    /* renamed from: o, reason: collision with root package name */
    private final p002do.c f18734o;

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

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

        a() {
            super(1);
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final Boolean invoke(q it) {
            t.g(it, "it");
            return Boolean.valueOf(it.Q());
        }
    }

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

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

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

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final Collection invoke(ap.h it) {
            t.g(it, "it");
            return it.c(this.f18736p, ao.d.WHEN_GET_SUPER_MEMBERS);
        }
    }

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

        /* renamed from: p, reason: collision with root package name */
        public static final c f18737p = new c();

        c() {
            super(1);
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final Collection invoke(ap.h it) {
            t.g(it, "it");
            return it.d();
        }
    }

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

        /* renamed from: p, reason: collision with root package name */
        public static final d f18738p = new d();

        d() {
            super(1);
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final tn.e invoke(e0 e0Var) {
            tn.h p10 = e0Var.K0().p();
            if (p10 instanceof tn.e) {
                return (tn.e) p10;
            }
            return null;
        }
    }

    /* loaded from: classes3.dex */
    public static final class e extends b.AbstractC0759b {

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

        /* renamed from: b, reason: collision with root package name */
        final /* synthetic */ Set f18740b;

        /* renamed from: c, reason: collision with root package name */
        final /* synthetic */ dn.l f18741c;

        e(tn.e eVar, Set set, dn.l lVar) {
            this.f18739a = eVar;
            this.f18740b = set;
            this.f18741c = lVar;
        }

        @Override // pp.b.d
        public /* bridge */ /* synthetic */ Object a() {
            e();
            return n0.f34904a;
        }

        @Override // pp.b.d
        /* renamed from: d, reason: merged with bridge method [inline-methods] */
        public boolean c(tn.e current) {
            t.g(current, "current");
            if (current == this.f18739a) {
                return true;
            }
            ap.h O = current.O();
            t.f(O, "getStaticScope(...)");
            if (!(O instanceof m)) {
                return true;
            }
            this.f18740b.addAll((Collection) this.f18741c.invoke(O));
            return false;
        }

        public void e() {
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public l(eo.g c10, io.g jClass, p002do.c ownerDescriptor) {
        super(c10);
        t.g(c10, "c");
        t.g(jClass, "jClass");
        t.g(ownerDescriptor, "ownerDescriptor");
        this.f18733n = jClass;
        this.f18734o = ownerDescriptor;
    }

    private final Set O(tn.e eVar, Set set, dn.l lVar) {
        List e10;
        e10 = sm.t.e(eVar);
        pp.b.b(e10, k.f18732a, new e(eVar, set, lVar));
        return set;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final Iterable P(tn.e eVar) {
        rp.h S;
        rp.h y10;
        Iterable l10;
        Collection n10 = eVar.j().n();
        t.f(n10, "getSupertypes(...)");
        S = c0.S(n10);
        y10 = p.y(S, d.f18738p);
        l10 = p.l(y10);
        return l10;
    }

    private final t0 R(t0 t0Var) {
        int v10;
        List V;
        Object D0;
        if (t0Var.g().isReal()) {
            return t0Var;
        }
        Collection e10 = t0Var.e();
        t.f(e10, "getOverriddenDescriptors(...)");
        Collection<t0> collection = e10;
        v10 = sm.v.v(collection, 10);
        ArrayList arrayList = new ArrayList(v10);
        for (t0 t0Var2 : collection) {
            t.d(t0Var2);
            arrayList.add(R(t0Var2));
        }
        V = c0.V(arrayList);
        D0 = c0.D0(V);
        return (t0) D0;
    }

    private final Set S(ro.f fVar, tn.e eVar) {
        Set X0;
        Set d10;
        l b10 = p002do.h.b(eVar);
        if (b10 == null) {
            d10 = x0.d();
            return d10;
        }
        X0 = c0.X0(b10.b(fVar, ao.d.WHEN_GET_SUPER_MEMBERS));
        return X0;
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // fo.j
    /* renamed from: N, reason: merged with bridge method [inline-methods] */
    public fo.a p() {
        return new fo.a(this.f18733n, a.f18735p);
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // fo.j
    /* renamed from: Q, reason: merged with bridge method [inline-methods] */
    public p002do.c C() {
        return this.f18734o;
    }

    @Override // ap.i, ap.k
    public tn.h e(ro.f name, ao.b location) {
        t.g(name, "name");
        t.g(location, "location");
        return null;
    }

    @Override // fo.j
    protected Set l(ap.d kindFilter, dn.l lVar) {
        Set d10;
        t.g(kindFilter, "kindFilter");
        d10 = x0.d();
        return d10;
    }

    @Override // fo.j
    protected Set n(ap.d kindFilter, dn.l lVar) {
        Set W0;
        List n10;
        t.g(kindFilter, "kindFilter");
        W0 = c0.W0(((fo.b) y().invoke()).a());
        l b10 = p002do.h.b(C());
        Set a10 = b10 != null ? b10.a() : null;
        if (a10 == null) {
            a10 = x0.d();
        }
        W0.addAll(a10);
        if (this.f18733n.z()) {
            n10 = u.n(qn.j.f33965f, qn.j.f33963d);
            W0.addAll(n10);
        }
        W0.addAll(w().a().w().h(w(), C()));
        return W0;
    }

    @Override // fo.j
    protected void o(Collection result, ro.f name) {
        t.g(result, "result");
        t.g(name, "name");
        w().a().w().c(w(), C(), name, result);
    }

    @Override // fo.j
    protected void r(Collection result, ro.f name) {
        t.g(result, "result");
        t.g(name, "name");
        Collection e10 = co.a.e(name, S(name, C()), result, C(), w().a().c(), w().a().k().a());
        t.f(e10, "resolveOverridesForStaticMembers(...)");
        result.addAll(e10);
        if (this.f18733n.z()) {
            if (t.b(name, qn.j.f33965f)) {
                y0 g10 = to.e.g(C());
                t.f(g10, "createEnumValueOfMethod(...)");
                result.add(g10);
            } else if (t.b(name, qn.j.f33963d)) {
                y0 h10 = to.e.h(C());
                t.f(h10, "createEnumValuesMethod(...)");
                result.add(h10);
            }
        }
    }

    @Override // fo.m, fo.j
    protected void s(ro.f name, Collection result) {
        t.g(name, "name");
        t.g(result, "result");
        Set O = O(C(), new LinkedHashSet(), new b(name));
        if (!result.isEmpty()) {
            Collection e10 = co.a.e(name, O, result, C(), w().a().c(), w().a().k().a());
            t.f(e10, "resolveOverridesForStaticMembers(...)");
            result.addAll(e10);
        } else {
            LinkedHashMap linkedHashMap = new LinkedHashMap();
            for (Object obj : O) {
                t0 R = R((t0) obj);
                Object obj2 = linkedHashMap.get(R);
                if (obj2 == null) {
                    obj2 = new ArrayList();
                    linkedHashMap.put(R, obj2);
                }
                ((List) obj2).add(obj);
            }
            ArrayList arrayList = new ArrayList();
            Iterator it = linkedHashMap.entrySet().iterator();
            while (it.hasNext()) {
                Collection e11 = co.a.e(name, (Collection) ((Map.Entry) it.next()).getValue(), result, C(), w().a().c(), w().a().k().a());
                t.f(e11, "resolveOverridesForStaticMembers(...)");
                z.A(arrayList, e11);
            }
            result.addAll(arrayList);
        }
        if (this.f18733n.z() && t.b(name, qn.j.f33964e)) {
            pp.a.a(result, to.e.f(C()));
        }
    }

    @Override // fo.j
    protected Set t(ap.d kindFilter, dn.l lVar) {
        Set W0;
        t.g(kindFilter, "kindFilter");
        W0 = c0.W0(((fo.b) y().invoke()).f());
        O(C(), W0, c.f18737p);
        if (this.f18733n.z()) {
            W0.add(qn.j.f33964e);
        }
        return W0;
    }
}
