discord-jadx/app/src/main/java/c/f/j/e/p.java

375 lines
12 KiB
Java

package c.f.j.e;
import android.content.ContentResolver;
import android.net.Uri;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import c.f.d.d.l;
import c.f.j.c.w;
import c.f.j.j.e;
import c.f.j.p.a;
import c.f.j.p.a1;
import c.f.j.p.d0;
import c.f.j.p.e0;
import c.f.j.p.e1;
import c.f.j.p.f;
import c.f.j.p.f0;
import c.f.j.p.f1;
import c.f.j.p.g;
import c.f.j.p.h;
import c.f.j.p.h0;
import c.f.j.p.h1;
import c.f.j.p.i;
import c.f.j.p.i0;
import c.f.j.p.i1;
import c.f.j.p.j;
import c.f.j.p.j0;
import c.f.j.p.j1;
import c.f.j.p.k;
import c.f.j.p.m;
import c.f.j.p.m0;
import c.f.j.p.n;
import c.f.j.p.n0;
import c.f.j.p.o;
import c.f.j.p.q0;
import c.f.j.p.r0;
import c.f.j.p.s;
import c.f.j.p.s0;
import c.f.j.p.t;
import c.f.j.p.u;
import c.f.j.p.v;
import c.f.j.p.v0;
import c.f.j.r.b;
import c.f.j.s.c;
import com.airbnb.lottie.parser.AnimatableValueParser;
import com.facebook.cache.common.CacheKey;
import com.facebook.common.memory.PooledByteBuffer;
import com.facebook.common.references.CloseableReference;
import com.facebook.imagepipeline.producers.LocalExifThumbnailProducer;
import com.facebook.imagepipeline.request.ImageRequest;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/* compiled from: ProducerSequenceFactory */
public class p {
public final ContentResolver a;
public final o b;
/* renamed from: c reason: collision with root package name */
public final n0 f443c;
public final boolean d;
public final boolean e;
public final f1 f;
public final boolean g;
public final boolean h;
public final boolean i;
public final c j;
public final boolean k;
public final boolean l;
public final boolean m;
@Nullable
@VisibleForTesting
public v0<CloseableReference<c.f.j.j.c>> n;
@Nullable
public v0<e> o;
@Nullable
@VisibleForTesting
public v0<CloseableReference<c.f.j.j.c>> p;
@Nullable
@VisibleForTesting
public v0<CloseableReference<c.f.j.j.c>> q;
@Nullable
@VisibleForTesting
public v0<CloseableReference<c.f.j.j.c>> r;
@Nullable
@VisibleForTesting
/* renamed from: s reason: collision with root package name */
public v0<CloseableReference<c.f.j.j.c>> f444s;
@Nullable
@VisibleForTesting
public v0<CloseableReference<c.f.j.j.c>> t;
@Nullable
@VisibleForTesting
public v0<CloseableReference<c.f.j.j.c>> u;
@Nullable
@VisibleForTesting
public v0<CloseableReference<c.f.j.j.c>> v;
@VisibleForTesting
public Map<v0<CloseableReference<c.f.j.j.c>>, v0<CloseableReference<c.f.j.j.c>>> w = new HashMap();
@VisibleForTesting
/* renamed from: x reason: collision with root package name */
public Map<v0<CloseableReference<c.f.j.j.c>>, v0<CloseableReference<c.f.j.j.c>>> f445x;
public p(ContentResolver contentResolver, o oVar, n0 n0Var, boolean z2, boolean z3, f1 f1Var, boolean z4, boolean z5, boolean z6, boolean z7, c cVar, boolean z8, boolean z9, boolean z10, boolean z11) {
this.a = contentResolver;
this.b = oVar;
this.f443c = n0Var;
this.d = z2;
new HashMap();
this.f445x = new HashMap();
this.f = f1Var;
this.g = z4;
this.h = z5;
this.e = z6;
this.i = z7;
this.j = cVar;
this.k = z8;
this.l = z9;
this.m = z11;
}
public final synchronized v0<e> a() {
b.b();
if (this.o == null) {
b.b();
o oVar = this.b;
v0<e> m = m(new m0(oVar.k, oVar.d, this.f443c));
Objects.requireNonNull(m);
a aVar = new a(m);
this.o = aVar;
this.o = this.b.a(aVar, this.d && !this.g, this.j);
b.b();
}
b.b();
return this.o;
}
public final synchronized v0<CloseableReference<c.f.j.j.c>> b() {
if (this.u == null) {
m mVar = new m(this.b.k);
c.f.d.m.b bVar = c.f.d.m.c.a;
this.u = j(this.b.a(new a(mVar), true, this.j));
}
return this.u;
}
/* JADX INFO: finally extract failed */
public v0<CloseableReference<c.f.j.j.c>> c(ImageRequest imageRequest) {
r0 r0Var;
o oVar;
b.b();
try {
b.b();
Objects.requireNonNull(imageRequest);
Uri uri = imageRequest.f2182c;
AnimatableValueParser.y(uri, "Uri is null.");
int i = imageRequest.d;
if (i != 0) {
boolean z2 = false;
switch (i) {
case 2:
r0Var = g();
break;
case 3:
synchronized (this) {
if (this.p == null) {
o oVar2 = this.b;
this.p = k(new h0(oVar2.j.e(), oVar2.k));
}
r0Var = this.p;
break;
}
case 4:
String type = this.a.getType(uri);
Map<String, String> map = c.f.d.f.a.a;
if (type != null && type.startsWith("video/")) {
z2 = true;
}
if (!z2) {
r0Var = e();
break;
} else {
r0Var = g();
break;
}
case 5:
r0Var = d();
break;
case 6:
r0Var = f();
break;
case 7:
r0Var = b();
break;
case 8:
r0Var = h();
break;
default:
StringBuilder sb = new StringBuilder();
sb.append("Unsupported uri scheme! Uri is: ");
String valueOf = String.valueOf(uri);
if (valueOf.length() > 30) {
valueOf = valueOf.substring(0, 30) + "...";
}
sb.append(valueOf);
throw new IllegalArgumentException(sb.toString());
}
} else {
synchronized (this) {
b.b();
if (this.n == null) {
b.b();
this.n = j(a());
b.b();
}
b.b();
r0Var = this.n;
}
}
b.b();
if (imageRequest.q != null) {
synchronized (this) {
v0<CloseableReference<c.f.j.j.c>> v0Var = this.w.get(r0Var);
if (v0Var == null) {
o oVar3 = this.b;
s0 s0Var = new s0(r0Var, oVar3.f440s, oVar3.j.c());
o oVar4 = this.b;
r0 r0Var2 = new r0(oVar4.o, oVar4.p, s0Var);
this.w.put(r0Var, r0Var2);
r0Var = r0Var2;
} else {
r0Var = v0Var;
}
}
}
if (this.h) {
synchronized (this) {
v0<CloseableReference<c.f.j.j.c>> v0Var2 = this.f445x.get(r0Var);
if (v0Var2 == null) {
o oVar5 = this.b;
i iVar = new i(r0Var, oVar5.t, oVar5.u, oVar5.v);
this.f445x.put(r0Var, iVar);
r0Var = iVar;
} else {
r0Var = v0Var2;
}
}
}
if (this.m && imageRequest.f2183s > 0) {
synchronized (this) {
oVar = new o(r0Var, this.b.j.g());
}
r0Var = oVar;
}
b.b();
return r0Var;
} catch (Throwable th) {
b.b();
throw th;
}
}
public final synchronized v0<CloseableReference<c.f.j.j.c>> d() {
if (this.t == null) {
o oVar = this.b;
this.t = k(new d0(oVar.j.e(), oVar.k, oVar.f439c));
}
return this.t;
}
public final synchronized v0<CloseableReference<c.f.j.j.c>> e() {
if (this.r == null) {
o oVar = this.b;
e0 e0Var = new e0(oVar.j.e(), oVar.k, oVar.a);
o oVar2 = this.b;
Objects.requireNonNull(oVar2);
o oVar3 = this.b;
this.r = l(e0Var, new j1[]{new f0(oVar2.j.e(), oVar2.k, oVar2.a), new LocalExifThumbnailProducer(oVar3.j.f(), oVar3.k, oVar3.a)});
}
return this.r;
}
public final synchronized v0<CloseableReference<c.f.j.j.c>> f() {
if (this.f444s == null) {
o oVar = this.b;
this.f444s = k(new i0(oVar.j.e(), oVar.k, oVar.b));
}
return this.f444s;
}
public final synchronized v0<CloseableReference<c.f.j.j.c>> g() {
if (this.q == null) {
o oVar = this.b;
this.q = i(new j0(oVar.j.e(), oVar.a));
}
return this.q;
}
public final synchronized v0<CloseableReference<c.f.j.j.c>> h() {
if (this.v == null) {
o oVar = this.b;
this.v = k(new a1(oVar.j.e(), oVar.k, oVar.a));
}
return this.v;
}
public final v0<CloseableReference<c.f.j.j.c>> i(v0<CloseableReference<c.f.j.j.c>> v0Var) {
o oVar = this.b;
w<CacheKey, c.f.j.j.c> wVar = oVar.o;
c.f.j.c.i iVar = oVar.p;
g gVar = new g(iVar, new h(wVar, iVar, v0Var));
o oVar2 = this.b;
f1 f1Var = this.f;
Objects.requireNonNull(oVar2);
e1 e1Var = new e1(gVar, f1Var);
if (this.k || this.l) {
o oVar3 = this.b;
w<CacheKey, c.f.j.j.c> wVar2 = oVar3.o;
c.f.j.c.i iVar2 = oVar3.p;
return new j(oVar3.n, oVar3.l, oVar3.m, iVar2, oVar3.q, oVar3.r, new f(wVar2, iVar2, e1Var));
}
o oVar4 = this.b;
return new f(oVar4.o, oVar4.p, e1Var);
}
public final v0<CloseableReference<c.f.j.j.c>> j(v0<e> v0Var) {
b.b();
o oVar = this.b;
v0<CloseableReference<c.f.j.j.c>> i = i(new n(oVar.d, oVar.j.a(), oVar.e, oVar.f, oVar.g, oVar.h, oVar.i, v0Var, oVar.f441x, oVar.w, null, l.a));
b.b();
return i;
}
public final v0<CloseableReference<c.f.j.j.c>> k(v0<e> v0Var) {
o oVar = this.b;
return l(v0Var, new j1[]{new LocalExifThumbnailProducer(oVar.j.f(), oVar.k, oVar.a)});
}
public final v0<CloseableReference<c.f.j.j.c>> l(v0<e> v0Var, j1<e>[] j1VarArr) {
h1 h1Var = new h1(5, this.b.j.b(), this.b.a(new a(m(v0Var)), true, this.j));
Objects.requireNonNull(this.b);
return j(new k(this.b.a(new i1(j1VarArr), true, this.j), h1Var));
}
public final v0<e> m(v0<e> v0Var) {
t tVar;
c.f.d.m.b bVar = c.f.d.m.c.a;
if (this.i) {
b.b();
if (this.e) {
o oVar = this.b;
c.f.j.c.f fVar = oVar.l;
c.f.j.c.i iVar = oVar.p;
tVar = new t(fVar, oVar.m, iVar, new q0(fVar, iVar, oVar.k, oVar.d, v0Var));
} else {
o oVar2 = this.b;
tVar = new t(oVar2.l, oVar2.m, oVar2.p, v0Var);
}
o oVar3 = this.b;
s sVar = new s(oVar3.l, oVar3.m, oVar3.p, tVar);
b.b();
v0Var = sVar;
}
o oVar4 = this.b;
w<CacheKey, PooledByteBuffer> wVar = oVar4.n;
c.f.j.c.i iVar2 = oVar4.p;
v vVar = new v(wVar, iVar2, v0Var);
if (!this.l) {
return new u(iVar2, oVar4.f442y, vVar);
}
return new u(iVar2, oVar4.f442y, new c.f.j.p.w(oVar4.l, oVar4.m, iVar2, oVar4.q, oVar4.r, vVar));
}
}