package com.google.android.gms.internal.vision; import com.kofax.mobile.sdk._internal.impl.camera.h; import java.nio.ByteBuffer; /* loaded from: classes2.dex */ final class zzjb extends zziy { /* JADX WARN: Code restructure failed: missing block: B:71:0x0055, code lost: return -1; */ @Override // com.google.android.gms.internal.vision.zziy /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ final int zzb(int r12, byte[] r13, int r14, int r15) { /* Method dump skipped, instructions count: 207 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.vision.zzjb.zzb(int, byte[], int, int):int"); } /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.android.gms.internal.vision.zziy public final String zzi(byte[] bArr, int i, int i2) throws zzgf { boolean zzd; boolean zzd2; boolean zze; boolean zzf; boolean zzd3; if ((i | i2 | ((bArr.length - i) - i2)) < 0) { throw new ArrayIndexOutOfBoundsException(String.format("buffer length=%d, index=%d, size=%d", Integer.valueOf(bArr.length), Integer.valueOf(i), Integer.valueOf(i2))); } int i3 = i + i2; char[] cArr = new char[i2]; int i4 = 0; while (i < i3) { byte zza = zziu.zza(bArr, i); zzd3 = zzix.zzd(zza); if (!zzd3) { break; } i++; zzix.zza(zza, cArr, i4); i4++; } int i5 = i4; while (i < i3) { int i6 = i + 1; byte zza2 = zziu.zza(bArr, i); zzd = zzix.zzd(zza2); if (zzd) { zzix.zza(zza2, cArr, i5); i5++; i = i6; while (i < i3) { byte zza3 = zziu.zza(bArr, i); zzd2 = zzix.zzd(zza3); if (zzd2) { i++; zzix.zza(zza3, cArr, i5); i5++; } } } else { zze = zzix.zze(zza2); if (!zze) { zzf = zzix.zzf(zza2); if (zzf) { if (i6 >= i3 - 1) { throw zzgf.zzfp(); } zzix.zza(zza2, zziu.zza(bArr, i6), zziu.zza(bArr, i + 2), cArr, i5); i5++; i += 3; } else if (i6 < i3 - 2) { zzix.zza(zza2, zziu.zza(bArr, i6), zziu.zza(bArr, i + 2), zziu.zza(bArr, i + 3), cArr, i5); i5 += 2; i += 4; } else { throw zzgf.zzfp(); } } else if (i6 < i3) { i += 2; zzix.zza(zza2, zziu.zza(bArr, i6), cArr, i5); i5++; } else { throw zzgf.zzfp(); } } } return new String(cArr, 0, i5); } /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.android.gms.internal.vision.zziy public final int zzb(CharSequence charSequence, byte[] bArr, int i, int i2) { long j; String str; String str2; long j2; int i3; char charAt; long j3 = i; long j4 = i2 + j3; int length = charSequence.length(); String str3 = " at index "; String str4 = "Failed writing "; if (length > i2 || bArr.length - i2 < i) { char charAt2 = charSequence.charAt(length - 1); StringBuilder sb = new StringBuilder(37); sb.append("Failed writing "); sb.append(charAt2); sb.append(" at index "); sb.append(i + i2); throw new ArrayIndexOutOfBoundsException(sb.toString()); } int i4 = 0; while (true) { j = 1; if (i4 >= length || (charAt = charSequence.charAt(i4)) >= 128) { break; } zziu.zza(bArr, j3, (byte) charAt); i4++; j3++; } if (i4 == length) { return (int) j3; } while (i4 < length) { char charAt3 = charSequence.charAt(i4); if (charAt3 >= 128 || j3 >= j4) { if (charAt3 < 2048 && j3 <= j4 - 2) { zziu.zza(bArr, j3, (byte) ((charAt3 >>> 6) | 960)); j2 = 2 + j3; zziu.zza(bArr, j3 + j, (byte) ((charAt3 & '?') | 128)); str = str3; str2 = str4; } else { if ((charAt3 >= 55296 && 57343 >= charAt3) || j3 > j4 - 3) { str = str3; str2 = str4; if (j3 <= j4 - 4) { int i5 = i4 + 1; if (i5 != length) { char charAt4 = charSequence.charAt(i5); if (Character.isSurrogatePair(charAt3, charAt4)) { int codePoint = Character.toCodePoint(charAt3, charAt4); zziu.zza(bArr, j3, (byte) ((codePoint >>> 18) | 240)); zziu.zza(bArr, j3 + j, (byte) (((codePoint >>> 12) & 63) | 128)); zziu.zza(bArr, j3 + 2, (byte) (((codePoint >>> 6) & 63) | 128)); zziu.zza(bArr, j3 + 3, (byte) ((codePoint & 63) | 128)); j3 = 4 + j3; i4 = i5; } else { i4 = i5; } } throw new zzja(i4 - 1, length); } if (55296 <= charAt3 && charAt3 <= 57343 && ((i3 = i4 + 1) == length || !Character.isSurrogatePair(charAt3, charSequence.charAt(i3)))) { throw new zzja(i4, length); } StringBuilder sb2 = new StringBuilder(46); sb2.append(str2); sb2.append(charAt3); sb2.append(str); sb2.append(j3); throw new ArrayIndexOutOfBoundsException(sb2.toString()); } zziu.zza(bArr, j3, (byte) ((charAt3 >>> '\f') | h.Az)); str = str3; str2 = str4; zziu.zza(bArr, j3 + j, (byte) (((charAt3 >>> 6) & 63) | 128)); j2 = j3 + 3; zziu.zza(bArr, j3 + 2, (byte) ((charAt3 & '?') | 128)); } j3 = j2; } else { zziu.zza(bArr, j3, (byte) charAt3); j3 += j; str = str3; str2 = str4; } i4++; str3 = str; str4 = str2; j = 1; } return (int) j3; } /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.android.gms.internal.vision.zziy public final void zzb(CharSequence charSequence, ByteBuffer byteBuffer) { long j; char c; long j2; int i; long j3; char c2; char charAt; long zzb = zziu.zzb(byteBuffer); long position = byteBuffer.position() + zzb; long limit = byteBuffer.limit() + zzb; int length = charSequence.length(); if (length > limit - position) { char charAt2 = charSequence.charAt(length - 1); int limit2 = byteBuffer.limit(); StringBuilder sb = new StringBuilder(37); sb.append("Failed writing "); sb.append(charAt2); sb.append(" at index "); sb.append(limit2); throw new ArrayIndexOutOfBoundsException(sb.toString()); } int i2 = 0; while (true) { j = 1; c = 128; if (i2 >= length || (charAt = charSequence.charAt(i2)) >= 128) { break; } zziu.zza(position, (byte) charAt); i2++; position++; } if (i2 == length) { byteBuffer.position((int) (position - zzb)); return; } while (i2 < length) { char charAt3 = charSequence.charAt(i2); if (charAt3 >= c || position >= limit) { if (charAt3 < 2048 && position <= limit - 2) { zziu.zza(position, (byte) ((charAt3 >>> 6) | 960)); j2 = position + 2; zziu.zza(position + 1, (byte) ((charAt3 & '?') | c)); } else { if ((charAt3 >= 55296 && 57343 >= charAt3) || position > limit - 3) { if (position <= limit - 4) { int i3 = i2 + 1; if (i3 != length) { char charAt4 = charSequence.charAt(i3); if (Character.isSurrogatePair(charAt3, charAt4)) { int codePoint = Character.toCodePoint(charAt3, charAt4); zziu.zza(position, (byte) ((codePoint >>> 18) | 240)); j3 = limit; zziu.zza(position + 1, (byte) (((codePoint >>> 12) & 63) | 128)); zziu.zza(position + 2, (byte) (((codePoint >>> 6) & 63) | 128)); c2 = 128; zziu.zza(position + 3, (byte) ((codePoint & 63) | 128)); i2 = i3; position += 4; } else { i2 = i3; } } throw new zzja(i2 - 1, length); } if (55296 <= charAt3 && charAt3 <= 57343 && ((i = i2 + 1) == length || !Character.isSurrogatePair(charAt3, charSequence.charAt(i)))) { throw new zzja(i2, length); } StringBuilder sb2 = new StringBuilder(46); sb2.append("Failed writing "); sb2.append(charAt3); sb2.append(" at index "); sb2.append(position); throw new ArrayIndexOutOfBoundsException(sb2.toString()); } zziu.zza(position, (byte) ((charAt3 >>> '\f') | h.Az)); zziu.zza(position + 1, (byte) (((charAt3 >>> 6) & 63) | c)); zziu.zza(position + 2, (byte) ((charAt3 & '?') | 128)); j2 = position + 3; } j3 = limit; position = j2; c2 = 128; } else { zziu.zza(position, (byte) charAt3); position += j; j3 = limit; c2 = c; } i2++; c = c2; limit = j3; j = 1; } byteBuffer.position((int) (position - zzb)); } private static int zza(byte[] bArr, int i, long j, int i2) { int zzbr; int zzt; int zzc; if (i2 == 0) { zzbr = zziw.zzbr(i); return zzbr; } if (i2 == 1) { zzt = zziw.zzt(i, zziu.zza(bArr, j)); return zzt; } if (i2 == 2) { zzc = zziw.zzc(i, zziu.zza(bArr, j), zziu.zza(bArr, j + 1)); return zzc; } throw new AssertionError(); } }