package l6; import b6.h; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; /* loaded from: classes2.dex */ public class o { /* renamed from: a, reason: collision with root package name */ private final p f11677a; /* renamed from: b, reason: collision with root package name */ private final a f11678b; private static class a { /* renamed from: a, reason: collision with root package name */ private final Map f11679a = new HashMap(); /* renamed from: l6.o$a$a, reason: collision with other inner class name */ private static class C0181a { /* renamed from: a, reason: collision with root package name */ final List f11680a; public C0181a(List list) { this.f11680a = list; } } a() { } public List a(Class cls) { C0181a c0181a = (C0181a) this.f11679a.get(cls); if (c0181a == null) { return null; } return c0181a.f11680a; } public void b() { this.f11679a.clear(); } public void c(Class cls, List list) { if (((C0181a) this.f11679a.put(cls, new C0181a(list))) == null) { return; } throw new IllegalStateException("Already cached loaders for model: " + cls); } } private o(p pVar) { this.f11678b = new a(); this.f11677a = pVar; } private static Class a(Object obj) { return obj.getClass(); } private synchronized List b(Class cls) { List a10; a10 = this.f11678b.a(cls); if (a10 == null) { a10 = Collections.unmodifiableList(this.f11677a.a(cls)); this.f11678b.c(cls, a10); } return a10; } public synchronized void c(Class cls, Class cls2, n nVar) { this.f11677a.d(cls, cls2, nVar); this.f11678b.b(); } public synchronized List d(Class cls) { return this.f11677a.f(cls); } public List e(Object obj) { List b10 = b(a(obj)); if (b10.isEmpty()) { throw new h.c(obj); } int size = b10.size(); List emptyList = Collections.emptyList(); boolean z10 = true; for (int i10 = 0; i10 < size; i10++) { m mVar = (m) b10.get(i10); if (mVar.a(obj)) { if (z10) { emptyList = new ArrayList(size - i10); z10 = false; } emptyList.add(mVar); } } if (emptyList.isEmpty()) { throw new h.c(obj, b10); } return emptyList; } public o(y.e eVar) { this(new p(eVar)); } }