package o; import android.util.Log; import com.bumptech.glide.Registry; import java.io.IOException; import java.util.Collections; import java.util.List; import java.util.Objects; import o.InterfaceC12232euN; import o.SCe; import o.XGP; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public final class LiZ implements XGP, XGP.IeS { volatile VwL a; volatile SCe.IeS b; final LTe c; volatile Object d; final XGP.IeS e; private volatile C15921jdR g; private volatile int h; /* JADX INFO: Access modifiers changed from: package-private */ public LiZ(LTe lTe, XGP.IeS ieS) { this.c = lTe; this.e = ieS; } @Override // o.XGP public final boolean c() { if (this.d != null) { Object obj = this.d; this.d = null; try { if (!a(obj)) { return true; } } catch (IOException unused) { } } if (this.g != null && this.g.c()) { return true; } this.g = null; this.b = null; boolean z = false; while (!z && this.h < this.c.b().size()) { List> b = this.c.b(); int i = this.h; this.h = i + 1; this.b = b.get(i); if (this.b != null) { if (!this.c.b.c(this.b.d.d())) { LTe lTe = this.c; if (lTe.a.j.c().b(this.b.d.c(), lTe.g, lTe.m) != null) { } } this.b.d.c(this.c.j, new InterfaceC12232euN.IeS(this, this.b) { // from class: o.LiZ.1 private SCe.IeS b; private LiZ c; { this.c = this; this.b = r2; } @Override // o.InterfaceC12232euN.IeS public final void a(Object obj2) { LiZ liZ = this.c; SCe.IeS ieS = this.b; SCe.IeS ieS2 = liZ.b; if (ieS2 == null || ieS2 != ieS) { return; } LiZ liZ2 = this.c; SCe.IeS ieS3 = this.b; LHy lHy = liZ2.c.b; if (obj2 != null && lHy.c(ieS3.d.d())) { liZ2.d = obj2; liZ2.e.b(); } else { liZ2.e.e(ieS3.e, obj2, ieS3.d, ieS3.d.d(), liZ2.a); } } @Override // o.InterfaceC12232euN.IeS public final void a(Exception exc) { LiZ liZ = this.c; SCe.IeS ieS = this.b; SCe.IeS ieS2 = liZ.b; if (ieS2 == null || ieS2 != ieS) { return; } LiZ liZ2 = this.c; SCe.IeS ieS3 = this.b; liZ2.e.b(liZ2.a, exc, ieS3.d, ieS3.d.d()); } }); z = true; } } return z; } private boolean a(Object obj) throws IOException { long e = PYC.e(); boolean z = false; try { Box d = this.c.a.j.c().e.d(obj); Object a = d.a(); gaU d2 = this.c.a.j.c().d.d(a.getClass()); if (d2 != null) { AWA awa = new AWA(d2, a, this.c.h); VwL vwL = new VwL(this.b.e, this.c.n); InterfaceC1095VmX e2 = this.c.e.e(); e2.b(vwL, awa); if (Log.isLoggable("SourceGenerator", 2)) { vwL.toString(); Objects.toString(obj); Objects.toString(d2); PYC.e(e); } if (e2.a(vwL) != null) { this.a = vwL; this.g = new C15921jdR(Collections.singletonList(this.b.e), this.c, this); this.b.d.e(); return true; } if (Log.isLoggable("SourceGenerator", 3)) { Objects.toString(this.a); Objects.toString(obj); } try { this.e.e(this.b.e, d.a(), this.b.d, this.b.d.d(), this.b.e); return false; } catch (Throwable th) { th = th; z = true; if (!z) { this.b.d.e(); } throw th; } } throw new Registry.NoSourceEncoderAvailableException(a.getClass()); } catch (Throwable th2) { th = th2; } } @Override // o.XGP public final void e() { SCe.IeS ieS = this.b; if (ieS != null) { ieS.d.a(); } } @Override // o.XGP.IeS public final void b() { throw new UnsupportedOperationException(); } @Override // o.XGP.IeS public final void e(InterfaceC2545agd interfaceC2545agd, Object obj, InterfaceC12232euN interfaceC12232euN, pNW pnw, InterfaceC2545agd interfaceC2545agd2) { this.e.e(interfaceC2545agd, obj, interfaceC12232euN, this.b.d.d(), interfaceC2545agd); } @Override // o.XGP.IeS public final void b(InterfaceC2545agd interfaceC2545agd, Exception exc, InterfaceC12232euN interfaceC12232euN, pNW pnw) { this.e.b(interfaceC2545agd, exc, interfaceC12232euN, this.b.d.d()); } }