what-the-bank/sources/o/Kjg.java

124 lines
4.1 KiB
Java

package o;
import java.util.Collection;
import java.util.Collections;
/* loaded from: classes2.dex */
public final class Kjg extends Ggl {
private static final char c;
private static final char[] e;
private static final char[] b = {'T', 'N', '*', 'E'};
private static final char[] a = {'/', ':', '+', '.'};
@Override // o.Ggl
protected final Collection<PTS> b() {
return Collections.singleton(PTS.CODABAR);
}
@Override // o.Ggl
public final boolean[] d(String str) {
int i;
if (str.length() < 2) {
StringBuilder sb = new StringBuilder();
char c2 = c;
sb.append(c2);
sb.append(str);
sb.append(c2);
str = sb.toString();
} else {
char upperCase = Character.toUpperCase(str.charAt(0));
char upperCase2 = Character.toUpperCase(str.charAt(str.length() - 1));
char[] cArr = e;
boolean a2 = C17084tlL.a(cArr, upperCase);
boolean a3 = C17084tlL.a(cArr, upperCase2);
char[] cArr2 = b;
boolean a4 = C17084tlL.a(cArr2, upperCase);
boolean a5 = C17084tlL.a(cArr2, upperCase2);
if (a2) {
if (!a3) {
throw new IllegalArgumentException("Invalid start/end guards: ".concat(String.valueOf(str)));
}
} else if (!a4) {
if (a3 || a5) {
throw new IllegalArgumentException("Invalid start/end guards: ".concat(String.valueOf(str)));
}
StringBuilder sb2 = new StringBuilder();
char c3 = c;
sb2.append(c3);
sb2.append(str);
sb2.append(c3);
str = sb2.toString();
} else if (!a5) {
throw new IllegalArgumentException("Invalid start/end guards: ".concat(String.valueOf(str)));
}
}
int i2 = 20;
for (int i3 = 1; i3 < str.length() - 1; i3++) {
if (Character.isDigit(str.charAt(i3)) || str.charAt(i3) == '-' || str.charAt(i3) == '$') {
i2 += 9;
} else {
if (!C17084tlL.a(a, str.charAt(i3))) {
StringBuilder sb3 = new StringBuilder("Cannot encode : '");
sb3.append(str.charAt(i3));
sb3.append('\'');
throw new IllegalArgumentException(sb3.toString());
}
i2 += 10;
}
}
boolean[] zArr = new boolean[i2 + (str.length() - 1)];
int i4 = 0;
for (int i5 = 0; i5 < str.length(); i5++) {
char upperCase3 = Character.toUpperCase(str.charAt(i5));
if (i5 == 0 || i5 == str.length() - 1) {
if (upperCase3 == '*') {
upperCase3 = 'C';
} else if (upperCase3 == 'E') {
upperCase3 = 'D';
} else if (upperCase3 == 'N') {
upperCase3 = 'B';
} else if (upperCase3 == 'T') {
upperCase3 = 'A';
}
}
int i6 = 0;
while (true) {
if (i6 >= C17084tlL.c.length) {
i = 0;
break;
}
if (upperCase3 == C17084tlL.c[i6]) {
i = C17084tlL.d[i6];
break;
}
i6++;
}
int i7 = 0;
int i8 = 0;
boolean z = true;
while (i7 < 7) {
zArr[i4] = z;
i4++;
if (((i >> (6 - i7)) & 1) == 0 || i8 == 1) {
z = !z;
i7++;
i8 = 0;
} else {
i8++;
}
}
if (i5 < str.length() - 1) {
zArr[i4] = false;
i4++;
}
}
return zArr;
}
static {
char[] cArr = {'A', 'B', 'C', 'D'};
e = cArr;
c = cArr[0];
}
}