package o; import android.util.Base64; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import o.InterfaceC12232euN; import o.SCe; /* loaded from: classes.dex */ public final class sOU implements SCe { private final HBt e; /* loaded from: classes.dex */ public interface HBt { Data c(String str) throws IllegalArgumentException; Class e(); void e(Data data) throws IOException; } public sOU(HBt hBt) { this.e = hBt; } @Override // o.SCe public final SCe.IeS e(Model model, int i, int i2, unA una) { return new SCe.IeS<>(new xBn(model), new LWm(model.toString(), this.e)); } @Override // o.SCe public final boolean d(Model model) { return model.toString().startsWith("data:image"); } /* loaded from: classes.dex */ static final class LWm implements InterfaceC12232euN { private final HBt b; private Data c; private final String d; @Override // o.InterfaceC12232euN public final void a() { } LWm(String str, HBt hBt) { this.d = str; this.b = hBt; } /* JADX WARN: Type inference failed for: r2v3, types: [java.lang.Object, Data] */ @Override // o.InterfaceC12232euN public final void c(EnumC3495ayd enumC3495ayd, InterfaceC12232euN.IeS ieS) { try { Data c = this.b.c(this.d); this.c = c; ieS.a((InterfaceC12232euN.IeS) c); } catch (IllegalArgumentException e) { ieS.a((Exception) e); } } @Override // o.InterfaceC12232euN public final void e() { try { this.b.e(this.c); } catch (IOException unused) { } } @Override // o.InterfaceC12232euN public final Class c() { return this.b.e(); } @Override // o.InterfaceC12232euN public final pNW d() { return pNW.LOCAL; } } /* loaded from: classes.dex */ public static final class IeS implements rIx { private final HBt b = new HBt(this) { // from class: o.sOU.IeS.3 private IeS b; { this.b = this; } @Override // o.sOU.HBt public final /* synthetic */ void e(InputStream inputStream) throws IOException { inputStream.close(); } @Override // o.sOU.HBt public final Class e() { return InputStream.class; } @Override // o.sOU.HBt public final /* synthetic */ InputStream c(String str) throws IllegalArgumentException { if (!str.startsWith("data:image")) { throw new IllegalArgumentException("Not a valid image data URL."); } int indexOf = str.indexOf(44); if (indexOf == -1) { throw new IllegalArgumentException("Missing comma in data URL."); } if (!str.substring(0, indexOf).endsWith(";base64")) { throw new IllegalArgumentException("Not a base64 image data URL."); } return new ByteArrayInputStream(Base64.decode(str.substring(indexOf + 1), 0)); } }; @Override // o.rIx public final SCe c(Vzp vzp) { return new sOU(this.b); } } }