package h6; import f6.d; import h6.a; import java.io.File; import java.util.List; import l6.m; /* loaded from: classes2.dex */ class w implements a, d.a { /* renamed from: a, reason: collision with root package name */ private final a.InterfaceC0152a f10528a; /* renamed from: b, reason: collision with root package name */ private final n f10529b; /* renamed from: c, reason: collision with root package name */ private int f10530c; /* renamed from: d, reason: collision with root package name */ private int f10531d = -1; /* renamed from: e, reason: collision with root package name */ private e6.h f10532e; /* renamed from: f, reason: collision with root package name */ private List f10533f; /* renamed from: g, reason: collision with root package name */ private int f10534g; /* renamed from: h, reason: collision with root package name */ private volatile m.a f10535h; /* renamed from: i, reason: collision with root package name */ private File f10536i; /* renamed from: j, reason: collision with root package name */ private x f10537j; w(n nVar, a.InterfaceC0152a interfaceC0152a) { this.f10529b = nVar; this.f10528a = interfaceC0152a; } private boolean b() { return this.f10534g < this.f10533f.size(); } @Override // h6.a public boolean a() { List k10 = this.f10529b.k(); boolean z10 = false; if (k10.isEmpty()) { return false; } List t10 = this.f10529b.t(); if (t10.isEmpty()) { if (File.class.equals(this.f10529b.v())) { return false; } throw new IllegalStateException("Failed to find any load path from " + this.f10529b.q() + " to " + this.f10529b.v()); } while (true) { if (this.f10533f != null && b()) { this.f10535h = null; while (!z10 && b()) { List list = this.f10533f; int i10 = this.f10534g; this.f10534g = i10 + 1; this.f10535h = ((l6.m) list.get(i10)).b(this.f10536i, this.f10529b.w(), this.f10529b.o(), this.f10529b.r()); if (this.f10535h != null && this.f10529b.l(this.f10535h.f11676c.a())) { this.f10535h.f11676c.f(this.f10529b.s(), this); z10 = true; } } return z10; } int i11 = this.f10531d + 1; this.f10531d = i11; if (i11 >= t10.size()) { int i12 = this.f10530c + 1; this.f10530c = i12; if (i12 >= k10.size()) { return false; } this.f10531d = 0; } e6.h hVar = (e6.h) k10.get(this.f10530c); Class cls = (Class) t10.get(this.f10531d); this.f10537j = new x(this.f10529b.i(), hVar, this.f10529b.u(), this.f10529b.w(), this.f10529b.o(), this.f10529b.h(cls), cls, this.f10529b.r()); File b10 = this.f10529b.m().b(this.f10537j); this.f10536i = b10; if (b10 != null) { this.f10532e = hVar; this.f10533f = this.f10529b.d(b10); this.f10534g = 0; } } } @Override // f6.d.a public void c(Exception exc) { this.f10528a.d(this.f10537j, exc, this.f10535h.f11676c, e6.a.RESOURCE_DISK_CACHE); } @Override // h6.a public void cancel() { m.a aVar = this.f10535h; if (aVar != null) { aVar.f11676c.cancel(); } } @Override // f6.d.a public void e(Object obj) { this.f10528a.e(this.f10532e, obj, this.f10535h.f11676c, e6.a.RESOURCE_DISK_CACHE, this.f10537j); } }