package w1; import android.util.Base64; import com.bumptech.glide.load.data.d; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import w1.m; /* loaded from: classes.dex */ public final class e implements m { /* renamed from: a, reason: collision with root package name */ private final a f15017a; public interface a { Class a(); void b(Object obj); Object c(String str); } private static final class b implements com.bumptech.glide.load.data.d { /* renamed from: a, reason: collision with root package name */ private final String f15018a; /* renamed from: b, reason: collision with root package name */ private final a f15019b; /* renamed from: c, reason: collision with root package name */ private Object f15020c; b(String str, a aVar) { this.f15018a = str; this.f15019b = aVar; } @Override // com.bumptech.glide.load.data.d public Class a() { return this.f15019b.a(); } @Override // com.bumptech.glide.load.data.d public void b() { try { this.f15019b.b(this.f15020c); } catch (IOException unused) { } } @Override // com.bumptech.glide.load.data.d public void cancel() { } @Override // com.bumptech.glide.load.data.d public q1.a d() { return q1.a.LOCAL; } @Override // com.bumptech.glide.load.data.d public void f(com.bumptech.glide.g gVar, d.a aVar) { try { Object c10 = this.f15019b.c(this.f15018a); this.f15020c = c10; aVar.e(c10); } catch (IllegalArgumentException e10) { aVar.c(e10); } } } public static final class c implements n { /* renamed from: a, reason: collision with root package name */ private final a f15021a = new a(); class a implements a { a() { } @Override // w1.e.a public Class a() { return InputStream.class; } @Override // w1.e.a /* renamed from: d, reason: merged with bridge method [inline-methods] */ public void b(InputStream inputStream) { inputStream.close(); } @Override // w1.e.a /* renamed from: e, reason: merged with bridge method [inline-methods] */ public InputStream c(String str) { 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")) { return new ByteArrayInputStream(Base64.decode(str.substring(indexOf + 1), 0)); } throw new IllegalArgumentException("Not a base64 image data URL."); } } @Override // w1.n public m b(q qVar) { return new e(this.f15021a); } } public e(a aVar) { this.f15017a = aVar; } @Override // w1.m public boolean a(Object obj) { return obj.toString().startsWith("data:image"); } @Override // w1.m public m.a b(Object obj, int i10, int i11, q1.h hVar) { return new m.a(new l2.b(obj), new b(obj.toString(), this.f15017a)); } }