package tn;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

/* loaded from: classes3.dex */
public final class m0 implements o0 {

    /* renamed from: a, reason: collision with root package name */
    private final Collection f36401a;

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

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

        a() {
            super(1);
        }

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

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

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

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

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final Boolean invoke(ro.c it) {
            kotlin.jvm.internal.t.g(it, "it");
            return Boolean.valueOf(!it.d() && kotlin.jvm.internal.t.b(it.e(), this.f36403p));
        }
    }

    public m0(Collection packageFragments) {
        kotlin.jvm.internal.t.g(packageFragments, "packageFragments");
        this.f36401a = packageFragments;
    }

    @Override // tn.l0
    public List a(ro.c fqName) {
        kotlin.jvm.internal.t.g(fqName, "fqName");
        Collection collection = this.f36401a;
        ArrayList arrayList = new ArrayList();
        for (Object obj : collection) {
            if (kotlin.jvm.internal.t.b(((k0) obj).d(), fqName)) {
                arrayList.add(obj);
            }
        }
        return arrayList;
    }

    @Override // tn.o0
    public boolean b(ro.c fqName) {
        kotlin.jvm.internal.t.g(fqName, "fqName");
        Collection collection = this.f36401a;
        if ((collection instanceof Collection) && collection.isEmpty()) {
            return true;
        }
        Iterator it = collection.iterator();
        while (it.hasNext()) {
            if (kotlin.jvm.internal.t.b(((k0) it.next()).d(), fqName)) {
                return false;
            }
        }
        return true;
    }

    @Override // tn.o0
    public void c(ro.c fqName, Collection packageFragments) {
        kotlin.jvm.internal.t.g(fqName, "fqName");
        kotlin.jvm.internal.t.g(packageFragments, "packageFragments");
        for (Object obj : this.f36401a) {
            if (kotlin.jvm.internal.t.b(((k0) obj).d(), fqName)) {
                packageFragments.add(obj);
            }
        }
    }

    @Override // tn.l0
    public Collection n(ro.c fqName, dn.l nameFilter) {
        rp.h S;
        rp.h x10;
        rp.h o10;
        List E;
        kotlin.jvm.internal.t.g(fqName, "fqName");
        kotlin.jvm.internal.t.g(nameFilter, "nameFilter");
        S = sm.c0.S(this.f36401a);
        x10 = rp.p.x(S, a.f36402p);
        o10 = rp.p.o(x10, new b(fqName));
        E = rp.p.E(o10);
        return E;
    }
}
