package h6; import f6.d; import h6.a; import java.io.File; import java.util.List; import l6.m; /* loaded from: classes2.dex */ class k implements a, d.a { /* renamed from: a, reason: collision with root package name */ private final List f10392a; /* renamed from: b, reason: collision with root package name */ private final n f10393b; /* renamed from: c, reason: collision with root package name */ private final a.InterfaceC0152a f10394c; /* renamed from: d, reason: collision with root package name */ private int f10395d; /* renamed from: e, reason: collision with root package name */ private e6.h f10396e; /* renamed from: f, reason: collision with root package name */ private List f10397f; /* renamed from: g, reason: collision with root package name */ private int f10398g; /* renamed from: h, reason: collision with root package name */ private volatile m.a f10399h; /* renamed from: i, reason: collision with root package name */ private File f10400i; k(n nVar, a.InterfaceC0152a interfaceC0152a) { this(nVar.k(), nVar, interfaceC0152a); } private boolean b() { return this.f10398g < this.f10397f.size(); } @Override // h6.a public boolean a() { while (true) { boolean z10 = false; if (this.f10397f != null && b()) { this.f10399h = null; while (!z10 && b()) { List list = this.f10397f; int i10 = this.f10398g; this.f10398g = i10 + 1; this.f10399h = ((l6.m) list.get(i10)).b(this.f10400i, this.f10393b.w(), this.f10393b.o(), this.f10393b.r()); if (this.f10399h != null && this.f10393b.l(this.f10399h.f11676c.a())) { this.f10399h.f11676c.f(this.f10393b.s(), this); z10 = true; } } return z10; } int i11 = this.f10395d + 1; this.f10395d = i11; if (i11 >= this.f10392a.size()) { return false; } e6.h hVar = (e6.h) this.f10392a.get(this.f10395d); File b10 = this.f10393b.m().b(new l(hVar, this.f10393b.u())); this.f10400i = b10; if (b10 != null) { this.f10396e = hVar; this.f10397f = this.f10393b.d(b10); this.f10398g = 0; } } } @Override // f6.d.a public void c(Exception exc) { this.f10394c.d(this.f10396e, exc, this.f10399h.f11676c, e6.a.DATA_DISK_CACHE); } @Override // h6.a public void cancel() { m.a aVar = this.f10399h; if (aVar != null) { aVar.f11676c.cancel(); } } @Override // f6.d.a public void e(Object obj) { this.f10394c.e(this.f10396e, obj, this.f10399h.f11676c, e6.a.DATA_DISK_CACHE, this.f10396e); } k(List list, n nVar, a.InterfaceC0152a interfaceC0152a) { this.f10395d = -1; this.f10392a = list; this.f10393b = nVar; this.f10394c = interfaceC0152a; } }