discord-jadx/app/src/main/java/c/q/a/k/a.java

1254 lines
46 KiB
Java

package c.q.a.k;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.RectF;
import android.hardware.Camera;
import android.opengl.EGL14;
import android.opengl.EGLConfig;
import android.opengl.EGLContext;
import android.opengl.EGLDisplay;
import android.opengl.EGLSurface;
import android.opengl.GLES20;
import android.view.Display;
import android.view.WindowManager;
import d0.d0.f;
import d0.g0.s;
import d0.g0.w;
import d0.k;
import d0.l;
import d0.w.d;
import d0.w.h.a.d;
import d0.w.h.a.e;
import d0.z.d.e0;
import d0.z.d.m;
import f0.f0.f.d;
import g0.n;
import g0.p;
import g0.v;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.IDN;
import java.net.InetAddress;
import java.net.Socket;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.concurrent.CancellationException;
import java.util.concurrent.atomic.AtomicLong;
import java.util.logging.Logger;
import kotlin.TypeCastException;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.CoroutineExceptionHandler;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Job;
import kotlinx.coroutines.internal.UndeliveredElementException;
import rx.exceptions.CompositeException;
import rx.exceptions.OnCompletedFailedException;
import rx.exceptions.OnErrorFailedException;
import rx.exceptions.OnErrorNotImplementedException;
import rx.exceptions.OnErrorThrowable;
import s.a.a.g;
import s.a.a.q;
import s.a.a.t;
import s.a.a0;
import s.a.c1;
import s.a.d;
import s.a.d0;
import s.a.f0;
import s.a.f1;
import s.a.g0;
import s.a.g1;
import s.a.h0;
import s.a.h1;
import s.a.i0;
import s.a.j;
import s.a.j0;
import s.a.k0;
import s.a.n1;
import s.a.o1;
import s.a.t1;
import s.a.u;
import s.a.x;
/* compiled from: EglUtils */
public class a {
/* compiled from: Await.kt */
@e(c = "kotlinx.coroutines.AwaitKt", f = "Await.kt", l = {26}, m = "awaitAll")
/* renamed from: c.q.a.k.a$a reason: collision with other inner class name */
public static final class C0171a extends d {
public Object L$0;
public int label;
public /* synthetic */ Object result;
public C0171a(Continuation continuation) {
super(continuation);
}
@Override // d0.w.h.a.a
public final Object invokeSuspend(Object obj) {
this.result = obj;
this.label |= Integer.MIN_VALUE;
return a.g(null, this);
}
}
/* compiled from: KotlinExtensions.kt */
public static final class b implements Runnable {
public final /* synthetic */ Continuation i;
public final /* synthetic */ Exception j;
public b(Continuation continuation, Exception exc) {
this.i = continuation;
this.j = exc;
}
@Override // java.lang.Runnable
public final void run() {
Continuation intercepted = d0.w.g.b.intercepted(this.i);
Exception exc = this.j;
k.a aVar = k.i;
intercepted.resumeWith(k.m78constructorimpl(l.createFailure(exc)));
}
}
/* compiled from: KotlinExtensions.kt */
@e(c = "retrofit2.KotlinExtensions", f = "KotlinExtensions.kt", l = {113}, m = "suspendAndThrow")
public static final class c extends d {
public Object L$0;
public int label;
public /* synthetic */ Object result;
public c(Continuation continuation) {
super(continuation);
}
@Override // d0.w.h.a.a
public final Object invokeSuspend(Object obj) {
this.result = obj;
this.label |= Integer.MIN_VALUE;
return a.T(null, this);
}
}
public static final boolean A(AssertionError assertionError) {
m.checkParameterIsNotNull(assertionError, "$this$isAndroidGetsocknameError");
if (assertionError.getCause() == null) {
return false;
}
String message = assertionError.getMessage();
return message != null ? w.contains$default(message, "getsockname failed", false, 2, null) : false;
}
public static final boolean B(int i) {
return i == 1 || i == 2;
}
public static boolean C(Camera camera) {
List<String> supportedFlashModes;
if (camera != null) {
Camera.Parameters parameters = camera.getParameters();
if (parameters.getFlashMode() != null && (supportedFlashModes = parameters.getSupportedFlashModes()) != null && !supportedFlashModes.isEmpty() && (supportedFlashModes.size() != 1 || !supportedFlashModes.get(0).equals("off"))) {
return true;
}
}
return false;
}
public static final boolean D(g0.e eVar) {
m.checkParameterIsNotNull(eVar, "$this$isProbablyUtf8");
try {
g0.e eVar2 = new g0.e();
eVar.p(eVar2, 0, f.coerceAtMost(eVar.j, 64));
for (int i = 0; i < 16; i++) {
if (eVar2.v()) {
return true;
}
int I = eVar2.I();
if (Character.isISOControl(I) && !Character.isWhitespace(I)) {
return false;
}
}
return true;
} catch (EOFException unused) {
return false;
}
}
public static final Job E(CoroutineScope coroutineScope, CoroutineContext coroutineContext, CoroutineStart coroutineStart, Function2<? super CoroutineScope, ? super Continuation<? super Unit>, ? extends Object> function2) {
CoroutineContext a = x.a(coroutineScope, coroutineContext);
Objects.requireNonNull(coroutineStart);
s.a.b h1Var = coroutineStart == CoroutineStart.LAZY ? new h1(a, function2) : new n1(a, true);
h1Var.a0(coroutineStart, h1Var, function2);
return h1Var;
}
public static /* synthetic */ Job F(CoroutineScope coroutineScope, CoroutineContext coroutineContext, CoroutineStart coroutineStart, Function2 function2, int i, Object obj) {
if ((i & 1) != 0) {
coroutineContext = d0.w.f.i;
}
return E(coroutineScope, coroutineContext, (i & 2) != 0 ? CoroutineStart.DEFAULT : null, function2);
}
public static int G(CharSequence charSequence, int i, int i2, int i3) {
int i4 = i + i2;
int i5 = i;
int i6 = i3;
int i7 = 0;
int i8 = 0;
int i9 = 0;
while (i5 < i4) {
int i10 = i5 + 1;
int charAt = charSequence.charAt(i5);
int i11 = 24;
if (charAt < 128) {
i11 = 8;
} else if (charAt < 2048) {
charAt = (((charAt & 63) | 128) << 8) | (charAt >> 6) | 192;
i11 = 16;
} else if (charAt < 55296 || charAt > 57343 || i10 >= i4) {
charAt = (((charAt & 63) | 128) << 16) | (charAt >> 12) | 224 | ((((charAt >> 6) & 63) | 128) << 8);
} else {
int charAt2 = ((charAt - 55232) << 10) + (charSequence.charAt(i10) & 1023);
charAt = (((charAt2 & 63) | 128) << 24) | ((((charAt2 >> 12) & 63) | 128) << 8) | (((charAt2 >> 18) | 240) & 255) | ((((charAt2 >> 6) & 63) | 128) << 16);
i10++;
i11 = 32;
}
int i12 = (charAt << i7) | i9;
i7 += i11;
if (i7 >= 32) {
int i13 = i12 * -862048943;
int i14 = (((i13 >>> 17) | (i13 << 15)) * 461845907) ^ i6;
i7 -= 32;
i8 += 4;
i6 = (((i14 >>> 19) | (i14 << 13)) * 5) - 430675100;
i9 = i7 != 0 ? charAt >>> (i11 - i7) : 0;
} else {
i9 = i12;
}
i5 = i10;
}
if (i7 > 0) {
i8 += i7 >> 3;
int i15 = i9 * -862048943;
i6 ^= ((i15 << 15) | (i15 >>> 17)) * 461845907;
}
int i16 = i6 ^ i8;
int i17 = (i16 ^ (i16 >>> 16)) * -2048144789;
int i18 = (i17 ^ (i17 >>> 13)) * -1028477387;
return i18 ^ (i18 >>> 16);
}
public static long H(AtomicLong atomicLong, long j) {
long j2;
long j3;
do {
j2 = atomicLong.get();
if (j2 == Long.MAX_VALUE) {
return Long.MAX_VALUE;
}
j3 = j2 - j;
if (j3 < 0) {
throw new IllegalStateException(c.d.b.a.a.q("More produced than requested: ", j3));
}
} while (!atomicLong.compareAndSet(j2, j3));
return j3;
}
public static RuntimeException I(Throwable th) {
if (th instanceof RuntimeException) {
throw ((RuntimeException) th);
} else if (th instanceof Error) {
throw ((Error) th);
} else {
throw new RuntimeException(th);
}
}
/* JADX ERROR: JadxRuntimeException in pass: RegionMakerVisitor
jadx.core.utils.exceptions.JadxRuntimeException: Failed to find switch 'out' block
at jadx.core.dex.visitors.regions.RegionMaker.processSwitch(RegionMaker.java:821)
at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:157)
at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:94)
at jadx.core.dex.visitors.regions.RegionMaker.processSwitch(RegionMaker.java:860)
at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:157)
at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:94)
at jadx.core.dex.visitors.regions.RegionMaker.processIf(RegionMaker.java:731)
at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:152)
at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:94)
at jadx.core.dex.visitors.regions.RegionMakerVisitor.visit(RegionMakerVisitor.java:50)
*/
public static void J(int r2, h0.a.a.c r3) {
/*
int r0 = r2 >>> 24
if (r0 == 0) goto L_0x0025
r1 = 1
if (r0 == r1) goto L_0x0025
switch(r0) {
case 16: goto L_0x001b;
case 17: goto L_0x001b;
case 18: goto L_0x001b;
case 19: goto L_0x0013;
case 20: goto L_0x0013;
case 21: goto L_0x0013;
case 22: goto L_0x0025;
case 23: goto L_0x001b;
default: goto L_0x000a;
}
L_0x000a:
switch(r0) {
case 66: goto L_0x001b;
case 67: goto L_0x001b;
case 68: goto L_0x001b;
case 69: goto L_0x001b;
case 70: goto L_0x001b;
case 71: goto L_0x0017;
case 72: goto L_0x0017;
case 73: goto L_0x0017;
case 74: goto L_0x0017;
case 75: goto L_0x0017;
default: goto L_0x000d;
}
L_0x000d:
java.lang.IllegalArgumentException r2 = new java.lang.IllegalArgumentException
r2.<init>()
throw r2
L_0x0013:
r3.g(r0)
goto L_0x002a
L_0x0017:
r3.i(r2)
goto L_0x002a
L_0x001b:
r1 = 16776960(0xffff00, float:2.3509528E-38)
r2 = r2 & r1
int r2 = r2 >> 8
r3.e(r0, r2)
goto L_0x002a
L_0x0025:
int r2 = r2 >>> 16
r3.j(r2)
L_0x002a:
return
switch-data {16->0x001b, 17->0x001b, 18->0x001b, 19->0x0013, 20->0x0013, 21->0x0013, 22->0x0025, 23->0x001b, }
switch-data {66->0x001b, 67->0x001b, 68->0x001b, 69->0x001b, 70->0x001b, 71->0x0017, 72->0x0017, 73->0x0017, 74->0x0017, 75->0x0017, }
*/
throw new UnsupportedOperationException("Method not decompiled: c.q.a.k.a.J(int, h0.a.a.c):void");
}
public static final <T> Object K(Object obj, Continuation<? super T> continuation) {
if (obj instanceof u) {
k.a aVar = k.i;
return k.m78constructorimpl(l.createFailure(((u) obj).b));
}
k.a aVar2 = k.i;
return k.m78constructorimpl(obj);
}
public static final <T> void L(i0<? super T> i0Var, Continuation<? super T> continuation, boolean z2) {
Object obj;
Object n = i0Var.n();
Throwable f = i0Var.f(n);
if (f != null) {
k.a aVar = k.i;
obj = l.createFailure(f);
} else {
k.a aVar2 = k.i;
obj = i0Var.l(n);
}
Object r2 = k.m78constructorimpl(obj);
if (z2) {
Objects.requireNonNull(continuation, "null cannot be cast to non-null type kotlinx.coroutines.internal.DispatchedContinuation<T>");
s.a.a.f fVar = (s.a.a.f) continuation;
CoroutineContext context = fVar.getContext();
Object b2 = s.a.a.a.b(context, fVar.o);
try {
fVar.q.resumeWith(r2);
} finally {
s.a.a.a.a(context, b2);
}
} else {
continuation.resumeWith(r2);
}
}
public static int M(int i) {
return 1 << (32 - Integer.numberOfLeadingZeros(i - 1));
}
public static final int N(g0.u uVar, int i) {
int i2;
m.checkParameterIsNotNull(uVar, "$this$segment");
int[] iArr = uVar.n;
int i3 = i + 1;
int length = uVar.m.length;
m.checkParameterIsNotNull(iArr, "$this$binarySearch");
int i4 = length - 1;
int i5 = 0;
while (true) {
if (i5 <= i4) {
i2 = (i5 + i4) >>> 1;
int i6 = iArr[i2];
if (i6 >= i3) {
if (i6 <= i3) {
break;
}
i4 = i2 - 1;
} else {
i5 = i2 + 1;
}
} else {
i2 = (-i5) - 1;
break;
}
}
return i2 >= 0 ? i2 : ~i2;
}
public static final v O(Socket socket) throws IOException {
m.checkParameterIsNotNull(socket, "$this$sink");
g0.w wVar = new g0.w(socket);
OutputStream outputStream = socket.getOutputStream();
m.checkExpressionValueIsNotNull(outputStream, "getOutputStream()");
p pVar = new p(outputStream, wVar);
m.checkParameterIsNotNull(pVar, "sink");
return new g0.c(wVar, pVar);
}
public static final g0.x P(Socket socket) throws IOException {
m.checkParameterIsNotNull(socket, "$this$source");
g0.w wVar = new g0.w(socket);
InputStream inputStream = socket.getInputStream();
m.checkExpressionValueIsNotNull(inputStream, "getInputStream()");
n nVar = new n(inputStream, wVar);
m.checkParameterIsNotNull(nVar, "source");
return new g0.d(wVar, nVar);
}
public static final void Q(Continuation<? super Unit> continuation, Continuation<?> continuation2) {
try {
Continuation intercepted = d0.w.g.b.intercepted(continuation);
k.a aVar = k.i;
g.b(intercepted, k.m78constructorimpl(Unit.a), null, 2);
} catch (Throwable th) {
k.a aVar2 = k.i;
((s.a.b) continuation2).resumeWith(k.m78constructorimpl(l.createFailure(th)));
}
}
public static void R(Function2 function2, Object obj, Continuation continuation, Function1 function1, int i) {
int i2 = i & 4;
try {
Continuation intercepted = d0.w.g.b.intercepted(d0.w.g.b.createCoroutineUnintercepted(function2, obj, continuation));
k.a aVar = k.i;
g.a(intercepted, k.m78constructorimpl(Unit.a), null);
} catch (Throwable th) {
k.a aVar2 = k.i;
continuation.resumeWith(k.m78constructorimpl(l.createFailure(th)));
}
}
public static final <T, R> Object S(q<? super T> qVar, R r, Function2<? super R, ? super Continuation<? super T>, ? extends Object> function2) {
Object obj;
qVar.Y();
if (function2 != null) {
try {
obj = ((Function2) e0.beforeCheckcastToFunctionOfArity(function2, 2)).invoke(r, qVar);
} catch (Throwable th) {
obj = new u(th, false, 2);
}
if (obj == d0.w.g.c.getCOROUTINE_SUSPENDED()) {
return d0.w.g.c.getCOROUTINE_SUSPENDED();
}
Object L = qVar.L(obj);
if (L == f1.b) {
return d0.w.g.c.getCOROUTINE_SUSPENDED();
}
if (!(L instanceof u)) {
return f1.a(L);
}
throw ((u) L).b;
}
throw new NullPointerException("null cannot be cast to non-null type (R, kotlin.coroutines.Continuation<T>) -> kotlin.Any?");
}
/* JADX WARNING: Removed duplicated region for block: B:12:0x0035 */
/* JADX WARNING: Removed duplicated region for block: B:8:0x0023 */
public static final Object T(Exception exc, Continuation<?> continuation) {
c cVar;
int i;
if (continuation instanceof c) {
cVar = (c) continuation;
int i2 = cVar.label;
if ((i2 & Integer.MIN_VALUE) != 0) {
cVar.label = i2 - Integer.MIN_VALUE;
Object obj = cVar.result;
Object coroutine_suspended = d0.w.g.c.getCOROUTINE_SUSPENDED();
i = cVar.label;
if (i != 0) {
l.throwOnFailure(obj);
cVar.L$0 = exc;
cVar.label = 1;
j0.a.dispatch(cVar.getContext(), new b(cVar, exc));
Object coroutine_suspended2 = d0.w.g.c.getCOROUTINE_SUSPENDED();
if (coroutine_suspended2 == d0.w.g.c.getCOROUTINE_SUSPENDED()) {
d0.w.h.a.g.probeCoroutineSuspended(cVar);
}
if (coroutine_suspended2 == coroutine_suspended) {
return coroutine_suspended;
}
} else if (i == 1) {
Exception exc2 = (Exception) cVar.L$0;
l.throwOnFailure(obj);
} else {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
return Unit.a;
}
}
cVar = new c(continuation);
Object obj = cVar.result;
Object coroutine_suspended = d0.w.g.c.getCOROUTINE_SUSPENDED();
i = cVar.label;
if (i != 0) {
}
return Unit.a;
}
public static final long U(String str, long j, long j2, long j3) {
String V = V(str);
if (V == null) {
return j;
}
Long longOrNull = s.toLongOrNull(V);
if (longOrNull != null) {
long longValue = longOrNull.longValue();
if (j2 <= longValue && j3 >= longValue) {
return longValue;
}
throw new IllegalStateException(("System property '" + str + "' should be in range " + j2 + ".." + j3 + ", but is '" + longValue + '\'').toString());
}
throw new IllegalStateException(("System property '" + str + "' has unrecognized value '" + V + '\'').toString());
}
public static final String V(String str) {
int i = t.a;
try {
return System.getProperty(str);
} catch (SecurityException unused) {
return null;
}
}
public static int W(String str, int i, int i2, int i3, int i4, Object obj) {
if ((i4 & 4) != 0) {
i2 = 1;
}
if ((i4 & 8) != 0) {
i3 = Integer.MAX_VALUE;
}
return (int) U(str, (long) i, (long) i2, (long) i3);
}
public static /* synthetic */ long X(String str, long j, long j2, long j3, int i, Object obj) {
if ((i & 4) != 0) {
j2 = 1;
}
if ((i & 8) != 0) {
j3 = Long.MAX_VALUE;
}
return U(str, j, j2, j3);
}
public static void Y(List<? extends Throwable> list) {
if (list != null && !list.isEmpty()) {
if (list.size() == 1) {
Throwable th = (Throwable) list.get(0);
if (th instanceof RuntimeException) {
throw ((RuntimeException) th);
} else if (th instanceof Error) {
throw ((Error) th);
} else {
throw new RuntimeException(th);
}
} else {
throw new CompositeException(list);
}
}
}
public static void Z(Throwable th) {
if (th instanceof OnErrorNotImplementedException) {
throw ((OnErrorNotImplementedException) th);
} else if (th instanceof OnErrorFailedException) {
throw ((OnErrorFailedException) th);
} else if (th instanceof OnCompletedFailedException) {
throw ((OnCompletedFailedException) th);
} else if (th instanceof VirtualMachineError) {
throw ((VirtualMachineError) th);
} else if (th instanceof ThreadDeath) {
throw ((ThreadDeath) th);
} else if (th instanceof LinkageError) {
throw ((LinkageError) th);
}
}
public static final CoroutineScope a(CoroutineContext coroutineContext) {
if (coroutineContext.get(Job.h) == null) {
coroutineContext = coroutineContext.plus(new c1(null));
}
return new s.a.a.e(coroutineContext);
}
public static void a0(Throwable th, j0.g<?> gVar, Object obj) {
Z(th);
gVar.onError(OnErrorThrowable.a(th, obj));
}
public static s.a.s b(Job job, int i) {
int i2 = i & 1;
return new o1(null);
}
/* JADX WARNING: Code restructure failed: missing block: B:66:0x010b, code lost:
r1 = 1;
*/
public static final String b0(String str) {
m.checkParameterIsNotNull(str, "$this$toCanonicalHost");
int i = 0;
int i2 = -1;
if (w.contains$default((CharSequence) str, (CharSequence) ":", false, 2, (Object) null)) {
InetAddress l = (!d0.g0.t.startsWith$default(str, "[", false, 2, null) || !d0.g0.t.endsWith$default(str, "]", false, 2, null)) ? l(str, 0, str.length()) : l(str, 1, str.length() - 1);
if (l == null) {
return null;
}
byte[] address = l.getAddress();
if (address.length == 16) {
m.checkExpressionValueIsNotNull(address, "address");
int i3 = 0;
int i4 = 0;
while (i3 < address.length) {
int i5 = i3;
while (i5 < 16 && address[i5] == 0 && address[i5 + 1] == 0) {
i5 += 2;
}
int i6 = i5 - i3;
if (i6 > i4 && i6 >= 4) {
i2 = i3;
i4 = i6;
}
i3 = i5 + 2;
}
g0.e eVar = new g0.e();
while (i < address.length) {
if (i == i2) {
eVar.T(58);
i += i4;
if (i == 16) {
eVar.T(58);
}
} else {
if (i > 0) {
eVar.T(58);
}
byte b2 = address[i];
byte[] bArr = f0.f0.c.a;
eVar.P((long) (((b2 & 255) << 8) | (address[i + 1] & 255)));
i += 2;
}
}
return eVar.G();
} else if (address.length == 4) {
return l.getHostAddress();
} else {
throw new AssertionError("Invalid IPv6 address: '" + str + '\'');
}
} else {
try {
String ascii = IDN.toASCII(str);
m.checkExpressionValueIsNotNull(ascii, "IDN.toASCII(host)");
Locale locale = Locale.US;
m.checkExpressionValueIsNotNull(locale, "Locale.US");
if (ascii != null) {
String lowerCase = ascii.toLowerCase(locale);
m.checkExpressionValueIsNotNull(lowerCase, "(this as java.lang.String).toLowerCase(locale)");
if (lowerCase.length() == 0) {
return null;
}
int length = lowerCase.length();
int i7 = 0;
while (true) {
if (i7 >= length) {
break;
}
char charAt = lowerCase.charAt(i7);
if (charAt <= 31) {
break;
} else if (charAt >= 127) {
break;
} else if (w.indexOf$default((CharSequence) " #%/:?@[\\]", charAt, 0, false, 6, (Object) null) != -1) {
break;
} else {
i7++;
}
}
if (i != 0) {
return null;
}
return lowerCase;
}
throw new TypeCastException("null cannot be cast to non-null type java.lang.String");
} catch (IllegalArgumentException unused) {
return null;
}
}
}
public static final void c(f0.f0.f.a aVar, f0.f0.f.c cVar, String str) {
d.b bVar = f0.f0.f.d.f2701c;
Logger logger = f0.f0.f.d.b;
StringBuilder sb = new StringBuilder();
sb.append(cVar.f);
sb.append(' ');
String format = String.format("%-22s", Arrays.copyOf(new Object[]{str}, 1));
m.checkExpressionValueIsNotNull(format, "java.lang.String.format(format, *args)");
sb.append(format);
sb.append(": ");
sb.append(aVar.f2699c);
logger.fine(sb.toString());
}
public static final String c0(Continuation<?> continuation) {
Object obj;
if (continuation instanceof s.a.a.f) {
return continuation.toString();
}
try {
k.a aVar = k.i;
obj = k.m78constructorimpl(continuation + '@' + t(continuation));
} catch (Throwable th) {
k.a aVar2 = k.i;
obj = k.m78constructorimpl(l.createFailure(th));
}
if (k.m80exceptionOrNullimpl(obj) != null) {
obj = continuation.getClass().getName() + '@' + t(continuation);
}
return (String) obj;
}
public static long d(long j, long j2) {
long j3 = j + j2;
if (j3 < 0) {
return Long.MAX_VALUE;
}
return j3;
}
public static final String d0(byte b2) {
char[] cArr = g0.z.b.a;
return new String(new char[]{cArr[(b2 >> 4) & 15], cArr[b2 & 15]});
}
public static final boolean e(byte[] bArr, int i, byte[] bArr2, int i2, int i3) {
m.checkParameterIsNotNull(bArr, "a");
m.checkParameterIsNotNull(bArr2, "b");
for (int i4 = 0; i4 < i3; i4++) {
if (bArr[i4 + i] != bArr2[i4 + i2]) {
return false;
}
}
return true;
}
public static final <T> Object e0(Object obj, Function1<? super Throwable, Unit> function1) {
Throwable r0 = k.m80exceptionOrNullimpl(obj);
return r0 == null ? function1 != null ? new s.a.v(obj, function1) : obj : new u(r0, false, 2);
}
public static s.a.e0 f(CoroutineScope coroutineScope, CoroutineContext coroutineContext, CoroutineStart coroutineStart, Function2 function2, int i, Object obj) {
CoroutineStart coroutineStart2 = null;
d0.w.f fVar = (i & 1) != 0 ? d0.w.f.i : null;
if ((i & 2) != 0) {
coroutineStart2 = CoroutineStart.DEFAULT;
}
CoroutineContext a = x.a(coroutineScope, fVar);
Objects.requireNonNull(coroutineStart2);
f0 g1Var = coroutineStart2 == CoroutineStart.LAZY ? new g1(a, function2) : new f0(a, true);
g1Var.a0(coroutineStart2, g1Var, function2);
return g1Var;
}
public static RectF f0(float[] fArr) {
RectF rectF = new RectF(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY);
for (int i = 1; i < fArr.length; i += 2) {
float round = ((float) Math.round(fArr[i - 1] * 10.0f)) / 10.0f;
float round2 = ((float) Math.round(fArr[i] * 10.0f)) / 10.0f;
float f = rectF.left;
if (round < f) {
f = round;
}
rectF.left = f;
float f2 = rectF.top;
if (round2 < f2) {
f2 = round2;
}
rectF.top = f2;
float f3 = rectF.right;
if (round <= f3) {
round = f3;
}
rectF.right = round;
float f4 = rectF.bottom;
if (round2 <= f4) {
round2 = f4;
}
rectF.bottom = round2;
}
rectF.sort();
return rectF;
}
/* JADX WARNING: Removed duplicated region for block: B:12:0x0036 */
/* JADX WARNING: Removed duplicated region for block: B:8:0x0023 */
public static final <T> Object g(s.a.e0<? extends T>[] e0VarArr, Continuation<? super List<? extends T>> continuation) {
C0171a aVar;
int i;
if (continuation instanceof C0171a) {
aVar = (C0171a) continuation;
int i2 = aVar.label;
if ((i2 & Integer.MIN_VALUE) != 0) {
aVar.label = i2 - Integer.MIN_VALUE;
Object obj = aVar.result;
Object coroutine_suspended = d0.w.g.c.getCOROUTINE_SUSPENDED();
i = aVar.label;
if (i != 0) {
l.throwOnFailure(obj);
if (e0VarArr.length == 0) {
return d0.t.n.emptyList();
}
s.a.d dVar = new s.a.d(e0VarArr);
aVar.L$0 = e0VarArr;
aVar.label = 1;
j jVar = new j(d0.w.g.b.intercepted(aVar), 1);
jVar.A();
int length = e0VarArr.length;
d.a[] aVarArr = new d.a[length];
for (int i3 = 0; i3 < length; i3++) {
s.a.e0<T> e0Var = dVar.b[d0.w.h.a.b.boxInt(i3).intValue()];
e0Var.start();
d.a aVar2 = new d.a(jVar, e0Var);
aVar2.m = e0Var.t(aVar2);
aVarArr[i3] = aVar2;
}
d.b bVar = new d.b(dVar, aVarArr);
for (int i4 = 0; i4 < length; i4++) {
aVarArr[i4]._disposer = bVar;
}
if (jVar.v()) {
bVar.b();
} else {
jVar.e(bVar);
}
obj = jVar.u();
if (obj == d0.w.g.c.getCOROUTINE_SUSPENDED()) {
d0.w.h.a.g.probeCoroutineSuspended(aVar);
}
if (obj == coroutine_suspended) {
return coroutine_suspended;
}
} else if (i == 1) {
s.a.e0[] e0VarArr2 = (s.a.e0[]) aVar.L$0;
l.throwOnFailure(obj);
} else {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
return (List) obj;
}
}
aVar = new C0171a(continuation);
Object obj = aVar.result;
Object coroutine_suspended = d0.w.g.c.getCOROUTINE_SUSPENDED();
i = aVar.label;
if (i != 0) {
}
return (List) obj;
}
public static boolean g0(long j) {
int i = (j > 0 ? 1 : (j == 0 ? 0 : -1));
if (i >= 0) {
return i != 0;
}
throw new IllegalArgumentException(c.d.b.a.a.q("n >= 0 required but it was ", j));
}
public static final <E> UndeliveredElementException h(Function1<? super E, Unit> function1, E e, UndeliveredElementException undeliveredElementException) {
try {
function1.invoke(e);
} catch (Throwable th) {
if (undeliveredElementException == null || undeliveredElementException.getCause() == th) {
return new UndeliveredElementException(c.d.b.a.a.t("Exception in undelivered element handler for ", e), th);
}
d0.b.addSuppressed(undeliveredElementException, th);
}
return undeliveredElementException;
}
/* JADX INFO: finally extract failed */
/* JADX DEBUG: Multi-variable search result rejected for r3v11, resolved type: java.util.concurrent.atomic.AtomicIntegerFieldUpdater */
/* JADX WARN: Multi-variable type inference failed */
public static final <T> Object h0(CoroutineContext coroutineContext, Function2<? super CoroutineScope, ? super Continuation<? super T>, ? extends Object> function2, Continuation<? super T> continuation) {
Object obj;
boolean z2;
CoroutineContext context = continuation.getContext();
CoroutineContext plus = context.plus(coroutineContext);
Job job = (Job) plus.get(Job.h);
if (job == null || job.a()) {
if (plus == context) {
q qVar = new q(plus, continuation);
obj = S(qVar, qVar, function2);
} else {
int i = d0.w.d.e;
d.b bVar = d.b.a;
if (m.areEqual((d0.w.d) plus.get(bVar), (d0.w.d) context.get(bVar))) {
t1 t1Var = new t1(plus, continuation);
Object b2 = s.a.a.a.b(plus, null);
try {
Object S = S(t1Var, t1Var, function2);
s.a.a.a.a(plus, b2);
obj = S;
} catch (Throwable th) {
s.a.a.a.a(plus, b2);
throw th;
}
} else {
h0 h0Var = new h0(plus, continuation);
h0Var.Y();
R(function2, h0Var, h0Var, null, 4);
while (true) {
int i2 = h0Var._decision;
z2 = false;
if (i2 == 0) {
if (h0.m.compareAndSet(h0Var, 0, 1)) {
z2 = true;
break;
}
} else if (i2 != 2) {
throw new IllegalStateException("Already suspended".toString());
}
}
if (z2) {
obj = d0.w.g.c.getCOROUTINE_SUSPENDED();
} else {
obj = f1.a(h0Var.F());
if (obj instanceof u) {
throw ((u) obj).b;
}
}
}
}
if (obj == d0.w.g.c.getCOROUTINE_SUSPENDED()) {
d0.w.h.a.g.probeCoroutineSuspended(continuation);
}
return obj;
}
throw job.p();
}
public static void i(CoroutineContext coroutineContext, CancellationException cancellationException, int i, Object obj) {
int i2 = i & 1;
Job job = (Job) coroutineContext.get(Job.h);
if (job != null) {
job.B(null);
}
}
public static /* synthetic */ void j(Job job, CancellationException cancellationException, int i, Object obj) {
int i2 = i & 1;
job.B(null);
}
public static final void k(long j, long j2, long j3) {
if ((j2 | j3) < 0 || j2 > j || j - j2 < j3) {
StringBuilder O = c.d.b.a.a.O("size=", j, " offset=");
O.append(j2);
O.append(" byteCount=");
O.append(j3);
throw new ArrayIndexOutOfBoundsException(O.toString());
}
}
/* JADX WARNING: Code restructure failed: missing block: B:40:0x00a0, code lost:
if ((r2 - r15) != 0) goto L_0x00a3;
*/
/* JADX WARNING: Code restructure failed: missing block: B:61:0x00ea, code lost:
return null;
*/
public static final InetAddress l(String str, int i, int i2) {
boolean z2;
int i3;
int i4;
byte[] bArr = new byte[16];
int i5 = i;
int i6 = 0;
int i7 = -1;
int i8 = -1;
while (true) {
if (i5 >= i2) {
break;
} else if (i6 == 16) {
return null;
} else {
int i9 = i5 + 2;
if (i9 > i2 || !d0.g0.t.startsWith$default(str, "::", i5, false, 4, null)) {
if (i6 != 0) {
if (d0.g0.t.startsWith$default(str, ":", i5, false, 4, null)) {
i5++;
} else if (!d0.g0.t.startsWith$default(str, ".", i5, false, 4, null)) {
return null;
} else {
int i10 = i6 - 2;
int i11 = i10;
loop1:
while (true) {
if (i8 < i2) {
if (i11 == 16) {
break;
}
if (i11 != i10) {
if (str.charAt(i8) != '.') {
break;
}
i8++;
}
i3 = i8;
i4 = 0;
while (true) {
if (i3 < i2) {
char charAt = str.charAt(i3);
if (charAt >= '0' && charAt <= '9') {
if ((i4 == 0 && i8 != i3) || (i4 = ((i4 * 10) + charAt) - 48) > 255) {
break loop1;
}
i3++;
} else {
break;
}
} else {
break;
}
}
} else if (i11 == i10 + 4) {
z2 = true;
}
bArr[i11] = (byte) i4;
i8 = i3;
i11++;
}
z2 = false;
if (!z2) {
return null;
}
i6 += 2;
}
}
i8 = i5;
} else if (i7 != -1) {
return null;
} else {
i6 += 2;
if (i9 == i2) {
i7 = i6;
break;
}
i8 = i9;
i7 = i6;
}
i5 = i8;
int i12 = 0;
while (i5 < i2) {
int r = f0.f0.c.r(str.charAt(i5));
if (r == -1) {
break;
}
i12 = (i12 << 4) + r;
i5++;
}
int i13 = i5 - i8;
if (i13 == 0 || i13 > 4) {
break;
}
int i14 = i6 + 1;
bArr[i6] = (byte) ((i12 >>> 8) & 255);
i6 = i14 + 1;
bArr[i14] = (byte) (i12 & 255);
}
}
if (i6 != 16) {
if (i7 == -1) {
return null;
}
int i15 = i6 - i7;
System.arraycopy(bArr, i7, bArr, 16 - i15, i15);
Arrays.fill(bArr, i7, (16 - i6) + i7, (byte) 0);
}
return InetAddress.getByAddress(bArr);
}
public static final Object m(long j, Continuation<? super Unit> continuation) {
if (j <= 0) {
return Unit.a;
}
j jVar = new j(d0.w.g.b.intercepted(continuation), 1);
jVar.A();
if (j < Long.MAX_VALUE) {
s(jVar.n).b(j, jVar);
}
Object u = jVar.u();
if (u == d0.w.g.c.getCOROUTINE_SUSPENDED()) {
d0.w.h.a.g.probeCoroutineSuspended(continuation);
}
return u;
}
public static final String n(long j) {
String str;
if (j <= ((long) -999500000)) {
str = ((j - ((long) 500000000)) / ((long) 1000000000)) + " s ";
} else if (j <= ((long) -999500)) {
str = ((j - ((long) 500000)) / ((long) 1000000)) + " ms";
} else if (j <= 0) {
str = ((j - ((long) 500)) / ((long) 1000)) + " µs";
} else if (j < ((long) 999500)) {
str = ((j + ((long) 500)) / ((long) 1000)) + " µs";
} else if (j < ((long) 999500000)) {
str = ((j + ((long) 500000)) / ((long) 1000000)) + " ms";
} else {
str = ((j + ((long) 500000000)) / ((long) 1000000000)) + " s ";
}
String format = String.format("%6s", Arrays.copyOf(new Object[]{str}, 1));
m.checkExpressionValueIsNotNull(format, "java.lang.String.format(format, *args)");
return format;
}
public static long o(AtomicLong atomicLong, long j) {
long j2;
do {
j2 = atomicLong.get();
} while (!atomicLong.compareAndSet(j2, d(j2, j)));
return j2;
}
public static float[] p(RectF rectF) {
return new float[]{rectF.centerX(), rectF.centerY()};
}
public static final String q(Object obj) {
return obj.getClass().getSimpleName();
}
public static float[] r(RectF rectF) {
float f = rectF.left;
float f2 = rectF.top;
float f3 = rectF.right;
float f4 = rectF.bottom;
return new float[]{f, f2, f3, f2, f3, f4, f, f4};
}
public static final g0 s(CoroutineContext coroutineContext) {
int i = d0.w.d.e;
CoroutineContext.Element element = coroutineContext.get(d.b.a);
if (!(element instanceof g0)) {
element = null;
}
g0 g0Var = (g0) element;
return g0Var != null ? g0Var : d0.a;
}
public static final String t(Object obj) {
return Integer.toHexString(System.identityHashCode(obj));
}
@TargetApi(17)
public static int u() {
EGLDisplay eglGetDisplay = EGL14.eglGetDisplay(0);
int[] iArr = new int[2];
EGL14.eglInitialize(eglGetDisplay, iArr, 0, iArr, 1);
EGLConfig[] eGLConfigArr = new EGLConfig[1];
int[] iArr2 = new int[1];
EGL14.eglChooseConfig(eglGetDisplay, new int[]{12351, 12430, 12329, 0, 12352, 4, 12339, 1, 12344}, 0, eGLConfigArr, 0, 1, iArr2, 0);
if (iArr2[0] == 0) {
return 0;
}
EGLConfig eGLConfig = eGLConfigArr[0];
EGLSurface eglCreatePbufferSurface = EGL14.eglCreatePbufferSurface(eglGetDisplay, eGLConfig, new int[]{12375, 64, 12374, 64, 12344}, 0);
EGLContext eglCreateContext = EGL14.eglCreateContext(eglGetDisplay, eGLConfig, EGL14.EGL_NO_CONTEXT, new int[]{12440, 2, 12344}, 0);
EGL14.eglMakeCurrent(eglGetDisplay, eglCreatePbufferSurface, eglCreatePbufferSurface, eglCreateContext);
int[] iArr3 = new int[1];
GLES20.glGetIntegerv(3379, iArr3, 0);
EGLSurface eGLSurface = EGL14.EGL_NO_SURFACE;
EGL14.eglMakeCurrent(eglGetDisplay, eGLSurface, eGLSurface, EGL14.EGL_NO_CONTEXT);
EGL14.eglDestroySurface(eglGetDisplay, eglCreatePbufferSurface);
EGL14.eglDestroyContext(eglGetDisplay, eglCreateContext);
EGL14.eglTerminate(eglGetDisplay);
return iArr3[0];
}
public static int v(Context context) {
Display defaultDisplay = ((WindowManager) context.getSystemService("window")).getDefaultDisplay();
if (defaultDisplay.getWidth() == defaultDisplay.getHeight()) {
return 3;
}
return defaultDisplay.getWidth() < defaultDisplay.getHeight() ? 1 : 2;
}
public static final void w(CoroutineContext coroutineContext, Throwable th) {
try {
int i = CoroutineExceptionHandler.g;
CoroutineExceptionHandler coroutineExceptionHandler = (CoroutineExceptionHandler) coroutineContext.get(CoroutineExceptionHandler.a.a);
if (coroutineExceptionHandler != null) {
coroutineExceptionHandler.handleException(coroutineContext, th);
} else {
a0.a(coroutineContext, th);
}
} catch (Throwable th2) {
if (th != th2) {
RuntimeException runtimeException = new RuntimeException("Exception while trying to handle coroutine exception", th2);
d0.b.addSuppressed(runtimeException, th);
th = runtimeException;
}
a0.a(coroutineContext, th);
}
}
public static /* synthetic */ k0 x(Job job, boolean z2, boolean z3, Function1 function1, int i, Object obj) {
if ((i & 1) != 0) {
z2 = false;
}
if ((i & 2) != 0) {
z3 = true;
}
return job.f(z2, z3, function1);
}
public static k0 y(long j, Runnable runnable, CoroutineContext coroutineContext) {
return d0.a.w(j, runnable, coroutineContext);
}
public static final boolean z(CoroutineScope coroutineScope) {
Job job = (Job) coroutineScope.getCoroutineContext().get(Job.h);
if (job != null) {
return job.a();
}
return true;
}
}