package ep;

import ao.c;
import dn.l;
import dp.k;
import dp.l;
import dp.r;
import dp.s;
import dp.w;
import gp.n;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import kn.f;
import kotlin.jvm.internal.p;
import kotlin.jvm.internal.p0;
import kotlin.jvm.internal.t;
import kotlin.reflect.jvm.internal.impl.protobuf.g;
import qn.j;
import sm.u;
import sm.v;
import tn.g0;
import tn.j0;
import tn.l0;
import tn.m0;

/* loaded from: classes3.dex */
public final class b implements qn.a {

    /* renamed from: b, reason: collision with root package name */
    private final d f17278b = new d();

    /* loaded from: classes3.dex */
    /* synthetic */ class a extends p implements l {
        a(Object obj) {
            super(1, obj);
        }

        @Override // kotlin.jvm.internal.f, kn.c
        public final String getName() {
            return "loadResource";
        }

        @Override // kotlin.jvm.internal.f
        public final f getOwner() {
            return p0.b(d.class);
        }

        @Override // kotlin.jvm.internal.f
        public final String getSignature() {
            return "loadResource(Ljava/lang/String;)Ljava/io/InputStream;";
        }

        @Override // dn.l
        /* renamed from: l, reason: merged with bridge method [inline-methods] */
        public final InputStream invoke(String p02) {
            t.g(p02, "p0");
            return ((d) this.receiver).a(p02);
        }
    }

    @Override // qn.a
    public l0 a(n storageManager, g0 builtInsModule, Iterable classDescriptorFactories, un.c platformDependentDeclarationFilter, un.a additionalClassPartsProvider, boolean z10) {
        t.g(storageManager, "storageManager");
        t.g(builtInsModule, "builtInsModule");
        t.g(classDescriptorFactories, "classDescriptorFactories");
        t.g(platformDependentDeclarationFilter, "platformDependentDeclarationFilter");
        t.g(additionalClassPartsProvider, "additionalClassPartsProvider");
        return b(storageManager, builtInsModule, j.F, classDescriptorFactories, platformDependentDeclarationFilter, additionalClassPartsProvider, z10, new a(this.f17278b));
    }

    public final l0 b(n storageManager, g0 module, Set packageFqNames, Iterable classDescriptorFactories, un.c platformDependentDeclarationFilter, un.a additionalClassPartsProvider, boolean z10, l loadResource) {
        int v10;
        List k10;
        t.g(storageManager, "storageManager");
        t.g(module, "module");
        t.g(packageFqNames, "packageFqNames");
        t.g(classDescriptorFactories, "classDescriptorFactories");
        t.g(platformDependentDeclarationFilter, "platformDependentDeclarationFilter");
        t.g(additionalClassPartsProvider, "additionalClassPartsProvider");
        t.g(loadResource, "loadResource");
        Set<ro.c> set = packageFqNames;
        v10 = v.v(set, 10);
        ArrayList arrayList = new ArrayList(v10);
        for (ro.c cVar : set) {
            String r10 = ep.a.f17277r.r(cVar);
            InputStream inputStream = (InputStream) loadResource.invoke(r10);
            if (inputStream == null) {
                throw new IllegalStateException("Resource not found in classpath: " + r10);
            }
            arrayList.add(c.D.a(cVar, storageManager, module, inputStream, z10));
        }
        m0 m0Var = new m0(arrayList);
        j0 j0Var = new j0(storageManager, module);
        l.a aVar = l.a.f16475a;
        dp.n nVar = new dp.n(m0Var);
        ep.a aVar2 = ep.a.f17277r;
        dp.d dVar = new dp.d(module, j0Var, aVar2);
        w.a aVar3 = w.a.f16503a;
        r DO_NOTHING = r.f16494a;
        t.f(DO_NOTHING, "DO_NOTHING");
        c.a aVar4 = c.a.f6100a;
        s.a aVar5 = s.a.f16495a;
        dp.j a10 = dp.j.f16451a.a();
        g e10 = aVar2.e();
        k10 = u.k();
        k kVar = new k(storageManager, module, aVar, nVar, dVar, m0Var, aVar3, DO_NOTHING, aVar4, aVar5, classDescriptorFactories, j0Var, a10, additionalClassPartsProvider, platformDependentDeclarationFilter, e10, null, new zo.b(storageManager, k10), null, null, 851968, null);
        Iterator it = arrayList.iterator();
        while (it.hasNext()) {
            ((c) it.next()).I0(kVar);
        }
        return m0Var;
    }
}
