package com.facetec.sdk; import com.google.common.base.Ascii; import com.google.common.primitives.UnsignedBytes; import java.io.IOException; import java.io.InputStream; import java.io.InterruptedIOException; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; import net.sf.scuba.smartcards.ISO7816; import okhttp3.internal.publicsuffix.PublicSuffixDatabase; /* loaded from: classes.dex */ public final class mh { private static final byte[] a; private static final mh c; private static final String[] d; private static final String[] e; private static final byte[] g = null; private static final int i = 0; private final AtomicBoolean b = new AtomicBoolean(false); private final CountDownLatch f = new CountDownLatch(1); private byte[] h; private byte[] j; /* JADX WARN: Removed duplicated region for block: B:10:0x0026 */ /* JADX WARN: Removed duplicated region for block: B:7:0x001e */ /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:10:0x0026 -> B:4:0x002a). Please report as a decompilation issue!!! */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private static void k(short r5, byte r6, int r7, java.lang.Object[] r8) { /* int r6 = r6 * 12 int r6 = 15 - r6 int r5 = r5 * 7 int r5 = 106 - r5 byte[] r0 = com.facetec.sdk.mh.g int r7 = r7 * 3 int r7 = r7 + 13 byte[] r1 = new byte[r7] r2 = 0 if (r0 != 0) goto L16 r4 = r7 r3 = r2 goto L2a L16: r3 = r2 L17: byte r4 = (byte) r5 r1[r3] = r4 int r3 = r3 + 1 if (r3 != r7) goto L26 java.lang.String r5 = new java.lang.String r5.(r1, r2) r8[r2] = r5 return L26: int r6 = r6 + 1 r4 = r0[r6] L2a: int r5 = r5 - r4 int r5 = r5 + 2 goto L17 */ throw new UnsupportedOperationException("Method not decompiled: com.facetec.sdk.mh.k(short, byte, int, java.lang.Object[]):void"); } static { a(); a = new byte[]{ISO7816.INS_PSO}; e = new String[0]; d = new String[]{"*"}; c = new mh(); } public final String[] e(String[] strArr) { String str; String str2; Thread thread; InputStream resourceAsStream; int i2 = 0; String str3 = null; if (this.b.get() || !this.b.compareAndSet(false, true)) { try { try { this.f.await(); } catch (InterruptedException unused) { byte[] bArr = g; byte b = bArr[15]; byte b2 = (byte) (b + 1); Object[] objArr = new Object[1]; k(b2, b2, (byte) (-b), objArr); Class cls = Class.forName((String) objArr[0]); byte b3 = (byte) (-bArr[15]); byte b4 = b3; Object[] objArr2 = new Object[1]; k(b3, b4, (byte) (b4 - 1), objArr2); ((Thread) cls.getMethod((String) objArr2[0], null).invoke(null, null)).interrupt(); } } catch (Throwable th) { Throwable cause = th.getCause(); if (cause != null) { throw cause; } throw th; } } else { boolean z = false; while (true) { try { try { try { resourceAsStream = mh.class.getResourceAsStream(PublicSuffixDatabase.PUBLIC_SUFFIX_RESOURCE); break; } catch (Throwable th2) { if (z) { try { byte[] bArr2 = g; byte b5 = bArr2[15]; byte b6 = (byte) (b5 + 1); Object[] objArr3 = new Object[1]; k(b6, b6, (byte) (-b5), objArr3); Class cls2 = Class.forName((String) objArr3[0]); byte b7 = (byte) (-bArr2[15]); byte b8 = b7; Object[] objArr4 = new Object[1]; k(b7, b8, (byte) (b8 - 1), objArr4); ((Thread) cls2.getMethod((String) objArr4[0], null).invoke(null, null)).interrupt(); } catch (Throwable th3) { Throwable cause2 = th3.getCause(); if (cause2 != null) { throw cause2; } throw th3; } } throw th2; } } catch (IOException e2) { mi.c().d(5, "Failed to read public suffix list", e2); if (z) { try { byte[] bArr3 = g; byte b9 = bArr3[15]; byte b10 = (byte) (b9 + 1); Object[] objArr5 = new Object[1]; k(b10, b10, (byte) (-b9), objArr5); Class cls3 = Class.forName((String) objArr5[0]); byte b11 = (byte) (-bArr3[15]); byte b12 = b11; Object[] objArr6 = new Object[1]; k(b11, b12, (byte) (b12 - 1), objArr6); thread = (Thread) cls3.getMethod((String) objArr6[0], null).invoke(null, null); } catch (Throwable th4) { Throwable cause3 = th4.getCause(); if (cause3 != null) { throw cause3; } throw th4; } } } } catch (InterruptedIOException unused2) { Thread.interrupted(); z = true; } } if (resourceAsStream != null) { mr c2 = nb.c(new na(nb.e(resourceAsStream))); try { byte[] bArr4 = new byte[c2.h()]; c2.d(bArr4); byte[] bArr5 = new byte[c2.h()]; c2.d(bArr5); synchronized (this) { this.h = bArr4; this.j = bArr5; } this.f.countDown(); } finally { km.a(c2); } } if (z) { try { byte[] bArr6 = g; byte b13 = bArr6[15]; byte b14 = (byte) (b13 + 1); Object[] objArr7 = new Object[1]; k(b14, b14, (byte) (-b13), objArr7); Class cls4 = Class.forName((String) objArr7[0]); byte b15 = (byte) (-bArr6[15]); byte b16 = b15; Object[] objArr8 = new Object[1]; k(b15, b16, (byte) (b16 - 1), objArr8); thread = (Thread) cls4.getMethod((String) objArr8[0], null).invoke(null, null); thread.interrupt(); } catch (Throwable th5) { Throwable cause4 = th5.getCause(); if (cause4 != null) { throw cause4; } throw th5; } } } synchronized (this) { if (this.h == null) { throw new IllegalStateException("Unable to load publicsuffixes.gz resource from the classpath."); } } int length = strArr.length; byte[][] bArr7 = new byte[length]; for (int i3 = 0; i3 < strArr.length; i3++) { bArr7[i3] = strArr[i3].getBytes(km.c); } int i4 = 0; while (true) { if (i4 >= length) { str = null; break; } str = e(this.h, bArr7, i4); if (str != null) { break; } i4++; } if (length > 1) { byte[][] bArr8 = (byte[][]) bArr7.clone(); for (int i5 = 0; i5 < bArr8.length - 1; i5++) { bArr8[i5] = a; str2 = e(this.h, bArr8, i5); if (str2 != null) { break; } } } str2 = null; if (str2 != null) { while (true) { if (i2 >= length - 1) { break; } String e3 = e(this.j, bArr7, i2); if (e3 != null) { str3 = e3; break; } i2++; } } if (str3 != null) { return "!".concat(String.valueOf(str3)).split("\\."); } if (str == null && str2 == null) { return d; } String[] split = str != null ? str.split("\\.") : e; String[] split2 = str2 != null ? str2.split("\\.") : e; return split.length > split2.length ? split : split2; } private static String e(byte[] bArr, byte[][] bArr2, int i2) { int i3; boolean z; int i4; int i5; int length = bArr.length; int i6 = 0; while (i6 < length) { int i7 = (i6 + length) / 2; while (i7 >= 0 && bArr[i7] != 10) { i7--; } int i8 = i7 + 1; int i9 = 1; while (true) { i3 = i8 + i9; if (bArr[i3] == 10) { break; } i9++; } int i10 = i3 - i8; int i11 = i2; boolean z2 = false; int i12 = 0; int i13 = 0; while (true) { if (z2) { i4 = 46; z = false; } else { z = z2; i4 = bArr2[i11][i12] & UnsignedBytes.MAX_VALUE; } i5 = i4 - (bArr[i8 + i13] & UnsignedBytes.MAX_VALUE); if (i5 != 0) { break; } i13++; i12++; if (i13 == i10) { break; } if (bArr2[i11].length != i12) { z2 = z; } else { if (i11 == bArr2.length - 1) { break; } i11++; i12 = -1; z2 = true; } } if (i5 >= 0) { if (i5 <= 0) { int i14 = i10 - i13; int length2 = bArr2[i11].length - i12; while (true) { i11++; if (i11 >= bArr2.length) { break; } length2 += bArr2[i11].length; } if (length2 >= i14) { if (length2 <= i14) { return new String(bArr, i8, i10, km.c); } } } i6 = i3 + 1; } length = i7; } return null; } public static mh b() { return c; } static void a() { g = new byte[]{47, 72, -92, -108, -16, 5, 2, 15, -7, -4, ISO7816.INS_MSE, -18, -8, 15, 6, -1, 11, -19, Ascii.ETB, 53, -60, 13, -11, 9, 59, ISO7816.INS_UPDATE_RECORD, -18, -8, 15, 6, -1}; i = 122; } }