Add Discord community version (64-bit only)

- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
This commit is contained in:
2026-02-18 15:48:36 -08:00
parent c19eb3d7ff
commit c080f0d97f
26930 changed files with 2529574 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
package com.google.zxing;
/* loaded from: classes3.dex */
public enum BarcodeFormat {
AZTEC,
CODABAR,
CODE_39,
CODE_93,
CODE_128,
DATA_MATRIX,
EAN_8,
EAN_13,
ITF,
MAXICODE,
PDF_417,
QR_CODE,
RSS_14,
RSS_EXPANDED,
UPC_A,
UPC_E,
UPC_EAN_EXTENSION
}

View File

@@ -0,0 +1,5 @@
package com.google.zxing;
/* loaded from: classes3.dex */
public abstract class Dimension {
}

View File

@@ -0,0 +1,17 @@
package com.google.zxing;
/* loaded from: classes3.dex */
public enum EncodeHintType {
ERROR_CORRECTION,
CHARACTER_SET,
DATA_MATRIX_SHAPE,
MIN_SIZE,
MAX_SIZE,
MARGIN,
PDF417_COMPACT,
PDF417_COMPACTION,
PDF417_DIMENSIONS,
AZTEC_LAYERS,
QR_VERSION,
GS1_FORMAT
}

View File

@@ -0,0 +1,16 @@
package com.google.zxing;
/* loaded from: classes3.dex */
public final class FormatException extends ReaderException {
public static final FormatException INSTANCE;
static {
FormatException formatException = new FormatException();
INSTANCE = formatException;
formatException.setStackTrace(ReaderException.NO_TRACE);
}
public static FormatException getFormatInstance() {
return ReaderException.isStackTrace ? new FormatException() : INSTANCE;
}
}

View File

@@ -0,0 +1,132 @@
package com.google.zxing;
import com.google.zxing.aztec.AztecWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.datamatrix.DataMatrixWriter;
import com.google.zxing.oned.CodaBarWriter;
import com.google.zxing.oned.Code128Writer;
import com.google.zxing.oned.Code39Writer;
import com.google.zxing.oned.Code93Writer;
import com.google.zxing.oned.EAN13Writer;
import com.google.zxing.oned.EAN8Writer;
import com.google.zxing.oned.ITFWriter;
import com.google.zxing.oned.UPCAWriter;
import com.google.zxing.oned.UPCEWriter;
import com.google.zxing.pdf417.PDF417Writer;
import com.google.zxing.qrcode.QRCodeWriter;
import java.util.Map;
/* loaded from: classes3.dex */
public final class MultiFormatWriter implements Writer {
/* renamed from: com.google.zxing.MultiFormatWriter$1, reason: invalid class name */
public static /* synthetic */ class AnonymousClass1 {
public static final /* synthetic */ int[] $SwitchMap$com$google$zxing$BarcodeFormat;
static {
int[] iArr = new int[BarcodeFormat.values().length];
$SwitchMap$com$google$zxing$BarcodeFormat = iArr;
try {
iArr[BarcodeFormat.EAN_8.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$google$zxing$BarcodeFormat[BarcodeFormat.UPC_E.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$google$zxing$BarcodeFormat[BarcodeFormat.EAN_13.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$com$google$zxing$BarcodeFormat[BarcodeFormat.UPC_A.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$com$google$zxing$BarcodeFormat[BarcodeFormat.QR_CODE.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$com$google$zxing$BarcodeFormat[BarcodeFormat.CODE_39.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
$SwitchMap$com$google$zxing$BarcodeFormat[BarcodeFormat.CODE_93.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
$SwitchMap$com$google$zxing$BarcodeFormat[BarcodeFormat.CODE_128.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
try {
$SwitchMap$com$google$zxing$BarcodeFormat[BarcodeFormat.ITF.ordinal()] = 9;
} catch (NoSuchFieldError unused9) {
}
try {
$SwitchMap$com$google$zxing$BarcodeFormat[BarcodeFormat.PDF_417.ordinal()] = 10;
} catch (NoSuchFieldError unused10) {
}
try {
$SwitchMap$com$google$zxing$BarcodeFormat[BarcodeFormat.CODABAR.ordinal()] = 11;
} catch (NoSuchFieldError unused11) {
}
try {
$SwitchMap$com$google$zxing$BarcodeFormat[BarcodeFormat.DATA_MATRIX.ordinal()] = 12;
} catch (NoSuchFieldError unused12) {
}
try {
$SwitchMap$com$google$zxing$BarcodeFormat[BarcodeFormat.AZTEC.ordinal()] = 13;
} catch (NoSuchFieldError unused13) {
}
}
}
@Override // com.google.zxing.Writer
public BitMatrix encode(String str, BarcodeFormat barcodeFormat, int i, int i2, Map map) {
Writer eAN8Writer;
switch (AnonymousClass1.$SwitchMap$com$google$zxing$BarcodeFormat[barcodeFormat.ordinal()]) {
case 1:
eAN8Writer = new EAN8Writer();
break;
case 2:
eAN8Writer = new UPCEWriter();
break;
case 3:
eAN8Writer = new EAN13Writer();
break;
case 4:
eAN8Writer = new UPCAWriter();
break;
case 5:
eAN8Writer = new QRCodeWriter();
break;
case 6:
eAN8Writer = new Code39Writer();
break;
case 7:
eAN8Writer = new Code93Writer();
break;
case 8:
eAN8Writer = new Code128Writer();
break;
case 9:
eAN8Writer = new ITFWriter();
break;
case 10:
eAN8Writer = new PDF417Writer();
break;
case 11:
eAN8Writer = new CodaBarWriter();
break;
case 12:
eAN8Writer = new DataMatrixWriter();
break;
case 13:
eAN8Writer = new AztecWriter();
break;
default:
throw new IllegalArgumentException("No encoder available for format ".concat(String.valueOf(barcodeFormat)));
}
return eAN8Writer.encode(str, barcodeFormat, i, i2, map);
}
}

View File

@@ -0,0 +1,17 @@
package com.google.zxing;
/* loaded from: classes3.dex */
public abstract class ReaderException extends Exception {
public static final StackTraceElement[] NO_TRACE;
public static final boolean isStackTrace;
static {
isStackTrace = System.getProperty("surefire.test.class.path") != null;
NO_TRACE = new StackTraceElement[0];
}
@Override // java.lang.Throwable
public final synchronized Throwable fillInStackTrace() {
return null;
}
}

View File

@@ -0,0 +1,9 @@
package com.google.zxing;
import com.google.zxing.common.BitMatrix;
import java.util.Map;
/* loaded from: classes3.dex */
public interface Writer {
BitMatrix encode(String str, BarcodeFormat barcodeFormat, int i, int i2, Map map);
}

View File

@@ -0,0 +1,15 @@
package com.google.zxing;
/* loaded from: classes3.dex */
public final class WriterException extends Exception {
public WriterException() {
}
public WriterException(String str) {
super(str);
}
public WriterException(Throwable th) {
super(th);
}
}

View File

@@ -0,0 +1,70 @@
package com.google.zxing.aztec;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.Writer;
import com.google.zxing.aztec.encoder.AztecCode;
import com.google.zxing.aztec.encoder.Encoder;
import com.google.zxing.common.BitMatrix;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Map;
/* loaded from: classes3.dex */
public final class AztecWriter implements Writer {
@Override // com.google.zxing.Writer
public BitMatrix encode(String str, BarcodeFormat barcodeFormat, int i, int i2, Map map) {
Charset charset = StandardCharsets.ISO_8859_1;
int i3 = 0;
if (map != null) {
EncodeHintType encodeHintType = EncodeHintType.CHARACTER_SET;
if (map.containsKey(encodeHintType)) {
charset = Charset.forName(map.get(encodeHintType).toString());
}
EncodeHintType encodeHintType2 = EncodeHintType.ERROR_CORRECTION;
r1 = map.containsKey(encodeHintType2) ? Integer.parseInt(map.get(encodeHintType2).toString()) : 33;
EncodeHintType encodeHintType3 = EncodeHintType.AZTEC_LAYERS;
if (map.containsKey(encodeHintType3)) {
i3 = Integer.parseInt(map.get(encodeHintType3).toString());
}
}
return encode(str, barcodeFormat, i, i2, charset, r1, i3);
}
public static BitMatrix encode(String str, BarcodeFormat barcodeFormat, int i, int i2, Charset charset, int i3, int i4) {
if (barcodeFormat != BarcodeFormat.AZTEC) {
throw new IllegalArgumentException("Can only encode AZTEC, but got ".concat(String.valueOf(barcodeFormat)));
}
return renderResult(Encoder.encode(str.getBytes(charset), i3, i4), i, i2);
}
public static BitMatrix renderResult(AztecCode aztecCode, int i, int i2) {
BitMatrix matrix = aztecCode.getMatrix();
if (matrix == null) {
throw new IllegalStateException();
}
int width = matrix.getWidth();
int height = matrix.getHeight();
int max = Math.max(i, width);
int max2 = Math.max(i2, height);
int min = Math.min(max / width, max2 / height);
int i3 = (max - (width * min)) / 2;
int i4 = (max2 - (height * min)) / 2;
BitMatrix bitMatrix = new BitMatrix(max, max2);
int i5 = 0;
while (i5 < height) {
int i6 = 0;
int i7 = i3;
while (i6 < width) {
if (matrix.get(i6, i5)) {
bitMatrix.setRegion(i7, i4, min, min);
}
i6++;
i7 += min;
}
i5++;
i4 += min;
}
return bitMatrix;
}
}

View File

@@ -0,0 +1,36 @@
package com.google.zxing.aztec.encoder;
import com.google.zxing.common.BitMatrix;
/* loaded from: classes3.dex */
public final class AztecCode {
public int codeWords;
public boolean compact;
public int layers;
public BitMatrix matrix;
public int size;
public BitMatrix getMatrix() {
return this.matrix;
}
public void setCodeWords(int i) {
this.codeWords = i;
}
public void setCompact(boolean z) {
this.compact = z;
}
public void setLayers(int i) {
this.layers = i;
}
public void setMatrix(BitMatrix bitMatrix) {
this.matrix = bitMatrix;
}
public void setSize(int i) {
this.size = i;
}
}

View File

@@ -0,0 +1,48 @@
package com.google.zxing.aztec.encoder;
import com.google.zxing.common.BitArray;
/* loaded from: classes3.dex */
public final class BinaryShiftToken extends Token {
public final short binaryShiftByteCount;
public final short binaryShiftStart;
public BinaryShiftToken(Token token, int i, int i2) {
super(token);
this.binaryShiftStart = (short) i;
this.binaryShiftByteCount = (short) i2;
}
@Override // com.google.zxing.aztec.encoder.Token
public void appendTo(BitArray bitArray, byte[] bArr) {
int i = 0;
while (true) {
short s = this.binaryShiftByteCount;
if (i >= s) {
return;
}
if (i == 0 || (i == 31 && s <= 62)) {
bitArray.appendBits(31, 5);
short s2 = this.binaryShiftByteCount;
if (s2 > 62) {
bitArray.appendBits(s2 - 31, 16);
} else if (i == 0) {
bitArray.appendBits(Math.min((int) s2, 31), 5);
} else {
bitArray.appendBits(s2 - 31, 5);
}
}
bitArray.appendBits(bArr[this.binaryShiftStart + i], 8);
i++;
}
}
public String toString() {
StringBuilder sb = new StringBuilder("<");
sb.append((int) this.binaryShiftStart);
sb.append("::");
sb.append((this.binaryShiftStart + this.binaryShiftByteCount) - 1);
sb.append('>');
return sb.toString();
}
}

View File

@@ -0,0 +1,309 @@
package com.google.zxing.aztec.encoder;
import com.google.zxing.common.BitArray;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.reedsolomon.GenericGF;
import com.google.zxing.common.reedsolomon.ReedSolomonEncoder;
/* loaded from: classes3.dex */
public abstract class Encoder {
public static final int[] WORD_SIZE = {4, 6, 6, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12};
public static int totalBitsInLayer(int i, boolean z) {
return ((z ? 88 : 112) + (i << 4)) * i;
}
/* JADX WARN: Multi-variable type inference failed */
public static AztecCode encode(byte[] bArr, int i, int i2) {
BitArray bitArray;
int i3;
boolean z;
int i4;
int i5;
int i6;
BitArray encode = new HighLevelEncoder(bArr).encode();
int size = ((encode.getSize() * i) / 100) + 11;
int size2 = encode.getSize() + size;
int i7 = 1;
if (i2 != 0) {
z = i2 < 0;
i4 = Math.abs(i2);
if (i4 > (z ? 4 : 32)) {
throw new IllegalArgumentException(String.format("Illegal value %s for layers", Integer.valueOf(i2)));
}
i5 = totalBitsInLayer(i4, z);
i3 = WORD_SIZE[i4];
int i8 = i5 - (i5 % i3);
bitArray = stuffBits(encode, i3);
if (bitArray.getSize() + size > i8) {
throw new IllegalArgumentException("Data to large for user specified layer");
}
if (z && bitArray.getSize() > (i3 << 6)) {
throw new IllegalArgumentException("Data to large for user specified layer");
}
} else {
BitArray bitArray2 = null;
int i9 = 0;
int i10 = 0;
while (i9 <= 32) {
boolean z2 = i9 <= 3 ? i7 : 0;
int i11 = z2 != 0 ? i9 + 1 : i9;
int i12 = totalBitsInLayer(i11, z2);
if (size2 <= i12) {
if (bitArray2 == null || i10 != WORD_SIZE[i11]) {
int i13 = WORD_SIZE[i11];
i10 = i13;
bitArray2 = stuffBits(encode, i13);
}
int i14 = i12 - (i12 % i10);
if ((z2 == 0 || bitArray2.getSize() <= (i10 << 6)) && bitArray2.getSize() + size <= i14) {
bitArray = bitArray2;
i3 = i10;
z = z2;
i4 = i11;
i5 = i12;
}
}
i9++;
i7 = i7;
}
throw new IllegalArgumentException("Data too large for an Aztec code");
}
BitArray generateCheckWords = generateCheckWords(bitArray, i5, i3);
int size3 = bitArray.getSize() / i3;
BitArray generateModeMessage = generateModeMessage(z, i4, size3);
int i15 = (z ? 11 : 14) + (i4 << 2);
int[] iArr = new int[i15];
int i16 = 2;
if (z) {
for (int i17 = 0; i17 < i15; i17++) {
iArr[i17] = i17;
}
i6 = i15;
} else {
int i18 = i15 / 2;
i6 = i15 + 1 + (((i18 - 1) / 15) * 2);
int i19 = i6 / 2;
for (int i20 = 0; i20 < i18; i20++) {
iArr[(i18 - i20) - i7] = (i19 - r14) - 1;
iArr[i18 + i20] = (i20 / 15) + i20 + i19 + i7;
}
}
BitMatrix bitMatrix = new BitMatrix(i6);
int i21 = 0;
int i22 = 0;
while (i21 < i4) {
int i23 = ((i4 - i21) << i16) + (z ? 9 : 12);
int i24 = 0;
while (i24 < i23) {
int i25 = i24 << 1;
int i26 = 0;
while (i26 < i16) {
if (generateCheckWords.get(i22 + i25 + i26)) {
int i27 = i21 << 1;
bitMatrix.set(iArr[i27 + i26], iArr[i27 + i24]);
}
if (generateCheckWords.get((i23 << 1) + i22 + i25 + i26)) {
int i28 = i21 << 1;
bitMatrix.set(iArr[i28 + i24], iArr[((i15 - 1) - i28) - i26]);
}
if (generateCheckWords.get((i23 << 2) + i22 + i25 + i26)) {
int i29 = (i15 - 1) - (i21 << 1);
bitMatrix.set(iArr[i29 - i26], iArr[i29 - i24]);
}
if (generateCheckWords.get((i23 * 6) + i22 + i25 + i26)) {
int i30 = i21 << 1;
bitMatrix.set(iArr[((i15 - 1) - i30) - i24], iArr[i30 + i26]);
}
i26++;
i16 = 2;
}
i24++;
i16 = 2;
}
i22 += i23 << 3;
i21++;
i16 = 2;
}
drawModeMessage(bitMatrix, z, i6, generateModeMessage);
if (z) {
drawBullsEye(bitMatrix, i6 / 2, 5);
} else {
int i31 = i6 / 2;
drawBullsEye(bitMatrix, i31, 7);
int i32 = 0;
int i33 = 0;
while (i33 < (i15 / 2) - 1) {
for (int i34 = i31 & 1; i34 < i6; i34 += 2) {
int i35 = i31 - i32;
bitMatrix.set(i35, i34);
int i36 = i31 + i32;
bitMatrix.set(i36, i34);
bitMatrix.set(i34, i35);
bitMatrix.set(i34, i36);
}
i33 += 15;
i32 += 16;
}
}
AztecCode aztecCode = new AztecCode();
aztecCode.setCompact(z);
aztecCode.setSize(i6);
aztecCode.setLayers(i4);
aztecCode.setCodeWords(size3);
aztecCode.setMatrix(bitMatrix);
return aztecCode;
}
public static void drawBullsEye(BitMatrix bitMatrix, int i, int i2) {
for (int i3 = 0; i3 < i2; i3 += 2) {
int i4 = i - i3;
int i5 = i4;
while (true) {
int i6 = i + i3;
if (i5 <= i6) {
bitMatrix.set(i5, i4);
bitMatrix.set(i5, i6);
bitMatrix.set(i4, i5);
bitMatrix.set(i6, i5);
i5++;
}
}
}
int i7 = i - i2;
bitMatrix.set(i7, i7);
int i8 = i7 + 1;
bitMatrix.set(i8, i7);
bitMatrix.set(i7, i8);
int i9 = i + i2;
bitMatrix.set(i9, i7);
bitMatrix.set(i9, i8);
bitMatrix.set(i9, i9 - 1);
}
public static BitArray generateModeMessage(boolean z, int i, int i2) {
BitArray bitArray = new BitArray();
if (z) {
bitArray.appendBits(i - 1, 2);
bitArray.appendBits(i2 - 1, 6);
return generateCheckWords(bitArray, 28, 4);
}
bitArray.appendBits(i - 1, 5);
bitArray.appendBits(i2 - 1, 11);
return generateCheckWords(bitArray, 40, 4);
}
public static void drawModeMessage(BitMatrix bitMatrix, boolean z, int i, BitArray bitArray) {
int i2 = i / 2;
int i3 = 0;
if (z) {
while (i3 < 7) {
int i4 = (i2 - 3) + i3;
if (bitArray.get(i3)) {
bitMatrix.set(i4, i2 - 5);
}
if (bitArray.get(i3 + 7)) {
bitMatrix.set(i2 + 5, i4);
}
if (bitArray.get(20 - i3)) {
bitMatrix.set(i4, i2 + 5);
}
if (bitArray.get(27 - i3)) {
bitMatrix.set(i2 - 5, i4);
}
i3++;
}
return;
}
while (i3 < 10) {
int i5 = (i2 - 5) + i3 + (i3 / 5);
if (bitArray.get(i3)) {
bitMatrix.set(i5, i2 - 7);
}
if (bitArray.get(i3 + 10)) {
bitMatrix.set(i2 + 7, i5);
}
if (bitArray.get(29 - i3)) {
bitMatrix.set(i5, i2 + 7);
}
if (bitArray.get(39 - i3)) {
bitMatrix.set(i2 - 7, i5);
}
i3++;
}
}
public static BitArray generateCheckWords(BitArray bitArray, int i, int i2) {
int size = bitArray.getSize() / i2;
ReedSolomonEncoder reedSolomonEncoder = new ReedSolomonEncoder(getGF(i2));
int i3 = i / i2;
int[] bitsToWords = bitsToWords(bitArray, i2, i3);
reedSolomonEncoder.encode(bitsToWords, i3 - size);
BitArray bitArray2 = new BitArray();
bitArray2.appendBits(0, i % i2);
for (int i4 : bitsToWords) {
bitArray2.appendBits(i4, i2);
}
return bitArray2;
}
public static int[] bitsToWords(BitArray bitArray, int i, int i2) {
int[] iArr = new int[i2];
int size = bitArray.getSize() / i;
for (int i3 = 0; i3 < size; i3++) {
int i4 = 0;
for (int i5 = 0; i5 < i; i5++) {
i4 |= bitArray.get((i3 * i) + i5) ? 1 << ((i - i5) - 1) : 0;
}
iArr[i3] = i4;
}
return iArr;
}
public static GenericGF getGF(int i) {
if (i == 4) {
return GenericGF.AZTEC_PARAM;
}
if (i == 6) {
return GenericGF.AZTEC_DATA_6;
}
if (i == 8) {
return GenericGF.AZTEC_DATA_8;
}
if (i == 10) {
return GenericGF.AZTEC_DATA_10;
}
if (i == 12) {
return GenericGF.AZTEC_DATA_12;
}
throw new IllegalArgumentException("Unsupported word size ".concat(String.valueOf(i)));
}
public static BitArray stuffBits(BitArray bitArray, int i) {
BitArray bitArray2 = new BitArray();
int size = bitArray.getSize();
int i2 = (1 << i) - 2;
int i3 = 0;
while (i3 < size) {
int i4 = 0;
for (int i5 = 0; i5 < i; i5++) {
int i6 = i3 + i5;
if (i6 >= size || bitArray.get(i6)) {
i4 |= 1 << ((i - 1) - i5);
}
}
int i7 = i4 & i2;
if (i7 == i2) {
bitArray2.appendBits(i7, i);
} else if (i7 == 0) {
bitArray2.appendBits(i4 | 1, i);
} else {
bitArray2.appendBits(i4, i);
i3 += i;
}
i3--;
i3 += i;
}
return bitArray2;
}
}

View File

@@ -0,0 +1,220 @@
package com.google.zxing.aztec.encoder;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
/* loaded from: classes3.dex */
public final class HighLevelEncoder {
public static final int[][] CHAR_MAP;
public static final int[][] SHIFT_TABLE;
public final byte[] text;
public static final String[] MODE_NAMES = {"UPPER", "LOWER", "DIGIT", "MIXED", "PUNCT"};
public static final int[][] LATCH_TABLE = {new int[]{0, 327708, 327710, 327709, 656318}, new int[]{590318, 0, 327710, 327709, 656318}, new int[]{262158, 590300, 0, 590301, 932798}, new int[]{327709, 327708, 656318, 0, 327710}, new int[]{327711, 656380, 656382, 656381, 0}};
static {
int[][] iArr = (int[][]) Array.newInstance((Class<?>) Integer.TYPE, 5, 256);
CHAR_MAP = iArr;
iArr[0][32] = 1;
for (int i = 65; i <= 90; i++) {
CHAR_MAP[0][i] = i - 63;
}
CHAR_MAP[1][32] = 1;
for (int i2 = 97; i2 <= 122; i2++) {
CHAR_MAP[1][i2] = i2 - 95;
}
CHAR_MAP[2][32] = 1;
for (int i3 = 48; i3 <= 57; i3++) {
CHAR_MAP[2][i3] = i3 - 46;
}
int[] iArr2 = CHAR_MAP[2];
iArr2[44] = 12;
iArr2[46] = 13;
int[] iArr3 = {0, 32, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 27, 28, 29, 30, 31, 64, 92, 94, 95, 96, 124, 126, 127};
for (int i4 = 0; i4 < 28; i4++) {
CHAR_MAP[3][iArr3[i4]] = i4;
}
int[] iArr4 = {0, 13, 0, 0, 0, 0, 33, 39, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 58, 59, 60, 61, 62, 63, 91, 93, 123, 125};
for (int i5 = 0; i5 < 31; i5++) {
int i6 = iArr4[i5];
if (i6 > 0) {
CHAR_MAP[4][i6] = i5;
}
}
int[][] iArr5 = (int[][]) Array.newInstance((Class<?>) Integer.TYPE, 6, 6);
SHIFT_TABLE = iArr5;
for (int[] iArr6 : iArr5) {
Arrays.fill(iArr6, -1);
}
int[][] iArr7 = SHIFT_TABLE;
iArr7[0][4] = 0;
int[] iArr8 = iArr7[1];
iArr8[4] = 0;
iArr8[0] = 28;
iArr7[3][4] = 0;
int[] iArr9 = iArr7[2];
iArr9[4] = 0;
iArr9[0] = 15;
}
public HighLevelEncoder(byte[] bArr) {
this.text = bArr;
}
/* JADX WARN: Removed duplicated region for block: B:17:0x003f */
/* JADX WARN: Removed duplicated region for block: B:20:0x0045 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public com.google.zxing.common.BitArray encode() {
/*
r8 = this;
com.google.zxing.aztec.encoder.State r0 = com.google.zxing.aztec.encoder.State.INITIAL_STATE
java.util.List r0 = java.util.Collections.singletonList(r0)
r1 = 0
r2 = r1
L8:
byte[] r3 = r8.text
int r4 = r3.length
if (r2 >= r4) goto L4c
int r4 = r2 + 1
int r5 = r3.length
if (r4 >= r5) goto L15
r5 = r3[r4]
goto L16
L15:
r5 = r1
L16:
r3 = r3[r2]
r6 = 13
if (r3 == r6) goto L38
r6 = 44
r7 = 32
if (r3 == r6) goto L34
r6 = 46
if (r3 == r6) goto L30
r6 = 58
if (r3 == r6) goto L2c
L2a:
r3 = r1
goto L3d
L2c:
if (r5 != r7) goto L2a
r3 = 5
goto L3d
L30:
if (r5 != r7) goto L2a
r3 = 3
goto L3d
L34:
if (r5 != r7) goto L2a
r3 = 4
goto L3d
L38:
r3 = 10
if (r5 != r3) goto L2a
r3 = 2
L3d:
if (r3 <= 0) goto L45
java.util.Collection r0 = updateStateListForPair(r0, r2, r3)
r2 = r4
goto L49
L45:
java.util.Collection r0 = r8.updateStateListForChar(r0, r2)
L49:
int r2 = r2 + 1
goto L8
L4c:
com.google.zxing.aztec.encoder.HighLevelEncoder$1 r1 = new com.google.zxing.aztec.encoder.HighLevelEncoder$1
r1.<init>()
java.lang.Object r0 = java.util.Collections.min(r0, r1)
com.google.zxing.aztec.encoder.State r0 = (com.google.zxing.aztec.encoder.State) r0
byte[] r1 = r8.text
com.google.zxing.common.BitArray r0 = r0.toBitArray(r1)
return r0
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.aztec.encoder.HighLevelEncoder.encode():com.google.zxing.common.BitArray");
}
public final Collection updateStateListForChar(Iterable iterable, int i) {
LinkedList linkedList = new LinkedList();
Iterator it = iterable.iterator();
while (it.hasNext()) {
updateStateForChar((State) it.next(), i, linkedList);
}
return simplifyStates(linkedList);
}
public final void updateStateForChar(State state, int i, Collection collection) {
char c = (char) (this.text[i] & 255);
boolean z = CHAR_MAP[state.getMode()][c] > 0;
State state2 = null;
for (int i2 = 0; i2 <= 4; i2++) {
int i3 = CHAR_MAP[i2][c];
if (i3 > 0) {
if (state2 == null) {
state2 = state.endBinaryShift(i);
}
if (!z || i2 == state.getMode() || i2 == 2) {
collection.add(state2.latchAndAppend(i2, i3));
}
if (!z && SHIFT_TABLE[state.getMode()][i2] >= 0) {
collection.add(state2.shiftAndAppend(i2, i3));
}
}
}
if (state.getBinaryShiftByteCount() > 0 || CHAR_MAP[state.getMode()][c] == 0) {
collection.add(state.addBinaryShiftChar(i));
}
}
public static Collection updateStateListForPair(Iterable iterable, int i, int i2) {
LinkedList linkedList = new LinkedList();
Iterator it = iterable.iterator();
while (it.hasNext()) {
updateStateForPair((State) it.next(), i, i2, linkedList);
}
return simplifyStates(linkedList);
}
public static void updateStateForPair(State state, int i, int i2, Collection collection) {
State endBinaryShift = state.endBinaryShift(i);
collection.add(endBinaryShift.latchAndAppend(4, i2));
if (state.getMode() != 4) {
collection.add(endBinaryShift.shiftAndAppend(4, i2));
}
if (i2 == 3 || i2 == 4) {
collection.add(endBinaryShift.latchAndAppend(2, 16 - i2).latchAndAppend(2, 1));
}
if (state.getBinaryShiftByteCount() > 0) {
collection.add(state.addBinaryShiftChar(i).addBinaryShiftChar(i + 1));
}
}
public static Collection simplifyStates(Iterable iterable) {
LinkedList linkedList = new LinkedList();
Iterator it = iterable.iterator();
while (it.hasNext()) {
State state = (State) it.next();
Iterator it2 = linkedList.iterator();
while (true) {
if (it2.hasNext()) {
State state2 = (State) it2.next();
if (state2.isBetterThanOrEqualTo(state)) {
break;
}
if (state.isBetterThanOrEqualTo(state2)) {
it2.remove();
}
} else {
linkedList.add(state);
break;
}
}
}
return linkedList;
}
}

View File

@@ -0,0 +1,26 @@
package com.google.zxing.aztec.encoder;
import com.google.zxing.common.BitArray;
/* loaded from: classes3.dex */
public final class SimpleToken extends Token {
public final short bitCount;
public final short value;
public SimpleToken(Token token, int i, int i2) {
super(token);
this.value = (short) i;
this.bitCount = (short) i2;
}
@Override // com.google.zxing.aztec.encoder.Token
public void appendTo(BitArray bitArray, byte[] bArr) {
bitArray.appendBits(this.value, this.bitCount);
}
public String toString() {
short s = this.value;
short s2 = this.bitCount;
return "<" + Integer.toBinaryString((s & ((1 << s2) - 1)) | (1 << s2) | (1 << this.bitCount)).substring(1) + '>';
}
}

View File

@@ -0,0 +1,104 @@
package com.google.zxing.aztec.encoder;
import com.google.zxing.common.BitArray;
import java.util.Iterator;
import java.util.LinkedList;
/* loaded from: classes3.dex */
public final class State {
public static final State INITIAL_STATE = new State(Token.EMPTY, 0, 0, 0);
public final int binaryShiftByteCount;
public final int bitCount;
public final int mode;
public final Token token;
public int getBinaryShiftByteCount() {
return this.binaryShiftByteCount;
}
public int getBitCount() {
return this.bitCount;
}
public int getMode() {
return this.mode;
}
public State(Token token, int i, int i2, int i3) {
this.token = token;
this.mode = i;
this.binaryShiftByteCount = i2;
this.bitCount = i3;
}
public State latchAndAppend(int i, int i2) {
int i3 = this.bitCount;
Token token = this.token;
int i4 = this.mode;
if (i != i4) {
int i5 = HighLevelEncoder.LATCH_TABLE[i4][i];
int i6 = 65535 & i5;
int i7 = i5 >> 16;
token = token.add(i6, i7);
i3 += i7;
}
int i8 = i == 2 ? 4 : 5;
return new State(token.add(i2, i8), i, 0, i3 + i8);
}
public State shiftAndAppend(int i, int i2) {
Token token = this.token;
int i3 = this.mode;
int i4 = i3 == 2 ? 4 : 5;
return new State(token.add(HighLevelEncoder.SHIFT_TABLE[i3][i], i4).add(i2, 5), this.mode, 0, this.bitCount + i4 + 5);
}
public State addBinaryShiftChar(int i) {
Token token = this.token;
int i2 = this.mode;
int i3 = this.bitCount;
if (i2 == 4 || i2 == 2) {
int i4 = HighLevelEncoder.LATCH_TABLE[i2][0];
int i5 = 65535 & i4;
int i6 = i4 >> 16;
token = token.add(i5, i6);
i3 += i6;
i2 = 0;
}
int i7 = this.binaryShiftByteCount;
State state = new State(token, i2, i7 + 1, i3 + ((i7 == 0 || i7 == 31) ? 18 : i7 == 62 ? 9 : 8));
return state.binaryShiftByteCount == 2078 ? state.endBinaryShift(i + 1) : state;
}
public State endBinaryShift(int i) {
int i2 = this.binaryShiftByteCount;
return i2 == 0 ? this : new State(this.token.addBinaryShift(i - i2, i2), this.mode, 0, this.bitCount);
}
public boolean isBetterThanOrEqualTo(State state) {
int i;
int i2 = this.bitCount + (HighLevelEncoder.LATCH_TABLE[this.mode][state.mode] >> 16);
int i3 = state.binaryShiftByteCount;
if (i3 > 0 && ((i = this.binaryShiftByteCount) == 0 || i > i3)) {
i2 += 10;
}
return i2 <= state.bitCount;
}
public BitArray toBitArray(byte[] bArr) {
LinkedList linkedList = new LinkedList();
for (Token token = endBinaryShift(bArr.length).token; token != null; token = token.getPrevious()) {
linkedList.addFirst(token);
}
BitArray bitArray = new BitArray();
Iterator it = linkedList.iterator();
while (it.hasNext()) {
((Token) it.next()).appendTo(bitArray, bArr);
}
return bitArray;
}
public String toString() {
return String.format("%s bits=%d bytes=%d", HighLevelEncoder.MODE_NAMES[this.mode], Integer.valueOf(this.bitCount), Integer.valueOf(this.binaryShiftByteCount));
}
}

View File

@@ -0,0 +1,27 @@
package com.google.zxing.aztec.encoder;
import com.google.zxing.common.BitArray;
/* loaded from: classes3.dex */
public abstract class Token {
public static final Token EMPTY = new SimpleToken(null, 0, 0);
public final Token previous;
public abstract void appendTo(BitArray bitArray, byte[] bArr);
public final Token getPrevious() {
return this.previous;
}
public Token(Token token) {
this.previous = token;
}
public final Token add(int i, int i2) {
return new SimpleToken(this, i, i2);
}
public final Token addBinaryShift(int i, int i2) {
return new BinaryShiftToken(this, i, i2);
}
}

View File

@@ -0,0 +1,135 @@
package com.google.zxing.common;
import java.util.Arrays;
/* loaded from: classes3.dex */
public final class BitArray implements Cloneable {
public int[] bits;
public int size;
public int getSize() {
return this.size;
}
public BitArray() {
this.size = 0;
this.bits = new int[1];
}
public BitArray(int[] iArr, int i) {
this.bits = iArr;
this.size = i;
}
public int getSizeInBytes() {
return (this.size + 7) / 8;
}
public final void ensureCapacity(int i) {
if (i > (this.bits.length << 5)) {
int[] makeArray = makeArray(i);
int[] iArr = this.bits;
System.arraycopy(iArr, 0, makeArray, 0, iArr.length);
this.bits = makeArray;
}
}
public boolean get(int i) {
return ((1 << (i & 31)) & this.bits[i / 32]) != 0;
}
public void appendBit(boolean z) {
ensureCapacity(this.size + 1);
if (z) {
int[] iArr = this.bits;
int i = this.size;
int i2 = i / 32;
iArr[i2] = (1 << (i & 31)) | iArr[i2];
}
this.size++;
}
public void appendBits(int i, int i2) {
if (i2 < 0 || i2 > 32) {
throw new IllegalArgumentException("Num bits must be between 0 and 32");
}
ensureCapacity(this.size + i2);
while (i2 > 0) {
boolean z = true;
if (((i >> (i2 - 1)) & 1) != 1) {
z = false;
}
appendBit(z);
i2--;
}
}
public void appendBitArray(BitArray bitArray) {
int i = bitArray.size;
ensureCapacity(this.size + i);
for (int i2 = 0; i2 < i; i2++) {
appendBit(bitArray.get(i2));
}
}
public void xor(BitArray bitArray) {
if (this.size != bitArray.size) {
throw new IllegalArgumentException("Sizes don't match");
}
int i = 0;
while (true) {
int[] iArr = this.bits;
if (i >= iArr.length) {
return;
}
iArr[i] = iArr[i] ^ bitArray.bits[i];
i++;
}
}
public void toBytes(int i, byte[] bArr, int i2, int i3) {
for (int i4 = 0; i4 < i3; i4++) {
int i5 = 0;
for (int i6 = 0; i6 < 8; i6++) {
if (get(i)) {
i5 |= 1 << (7 - i6);
}
i++;
}
bArr[i2 + i4] = (byte) i5;
}
}
public static int[] makeArray(int i) {
return new int[(i + 31) / 32];
}
public boolean equals(Object obj) {
if (!(obj instanceof BitArray)) {
return false;
}
BitArray bitArray = (BitArray) obj;
return this.size == bitArray.size && Arrays.equals(this.bits, bitArray.bits);
}
public int hashCode() {
return (this.size * 31) + Arrays.hashCode(this.bits);
}
public String toString() {
int i = this.size;
StringBuilder sb = new StringBuilder(i + (i / 8) + 1);
for (int i2 = 0; i2 < this.size; i2++) {
if ((i2 & 7) == 0) {
sb.append(' ');
}
sb.append(get(i2) ? 'X' : '.');
}
return sb.toString();
}
/* renamed from: clone, reason: merged with bridge method [inline-methods] */
public BitArray m858clone() {
return new BitArray((int[]) this.bits.clone(), this.size);
}
}

View File

@@ -0,0 +1,118 @@
package com.google.zxing.common;
import java.util.Arrays;
/* loaded from: classes3.dex */
public final class BitMatrix implements Cloneable {
public final int[] bits;
public final int height;
public final int rowSize;
public final int width;
public int getHeight() {
return this.height;
}
public int getWidth() {
return this.width;
}
public BitMatrix(int i) {
this(i, i);
}
public BitMatrix(int i, int i2) {
if (i <= 0 || i2 <= 0) {
throw new IllegalArgumentException("Both dimensions must be greater than 0");
}
this.width = i;
this.height = i2;
int i3 = (i + 31) / 32;
this.rowSize = i3;
this.bits = new int[i3 * i2];
}
public BitMatrix(int i, int i2, int i3, int[] iArr) {
this.width = i;
this.height = i2;
this.rowSize = i3;
this.bits = iArr;
}
public boolean get(int i, int i2) {
return ((this.bits[(i2 * this.rowSize) + (i / 32)] >>> (i & 31)) & 1) != 0;
}
public void set(int i, int i2) {
int i3 = (i2 * this.rowSize) + (i / 32);
int[] iArr = this.bits;
iArr[i3] = (1 << (i & 31)) | iArr[i3];
}
public void clear() {
int length = this.bits.length;
for (int i = 0; i < length; i++) {
this.bits[i] = 0;
}
}
public void setRegion(int i, int i2, int i3, int i4) {
if (i2 < 0 || i < 0) {
throw new IllegalArgumentException("Left and top must be nonnegative");
}
if (i4 <= 0 || i3 <= 0) {
throw new IllegalArgumentException("Height and width must be at least 1");
}
int i5 = i3 + i;
int i6 = i4 + i2;
if (i6 > this.height || i5 > this.width) {
throw new IllegalArgumentException("The region must fit inside the matrix");
}
while (i2 < i6) {
int i7 = this.rowSize * i2;
for (int i8 = i; i8 < i5; i8++) {
int[] iArr = this.bits;
int i9 = (i8 / 32) + i7;
iArr[i9] = iArr[i9] | (1 << (i8 & 31));
}
i2++;
}
}
public boolean equals(Object obj) {
if (!(obj instanceof BitMatrix)) {
return false;
}
BitMatrix bitMatrix = (BitMatrix) obj;
return this.width == bitMatrix.width && this.height == bitMatrix.height && this.rowSize == bitMatrix.rowSize && Arrays.equals(this.bits, bitMatrix.bits);
}
public int hashCode() {
int i = this.width;
return (((((((i * 31) + i) * 31) + this.height) * 31) + this.rowSize) * 31) + Arrays.hashCode(this.bits);
}
public String toString() {
return toString("X ", " ");
}
public String toString(String str, String str2) {
return buildToString(str, str2, "\n");
}
public final String buildToString(String str, String str2, String str3) {
StringBuilder sb = new StringBuilder(this.height * (this.width + 1));
for (int i = 0; i < this.height; i++) {
for (int i2 = 0; i2 < this.width; i2++) {
sb.append(get(i2, i) ? str : str2);
}
sb.append(str3);
}
return sb.toString();
}
/* renamed from: clone, reason: merged with bridge method [inline-methods] */
public BitMatrix m859clone() {
return new BitMatrix(this.width, this.height, this.rowSize, (int[]) this.bits.clone());
}
}

View File

@@ -0,0 +1,82 @@
package com.google.zxing.common;
import com.google.zxing.FormatException;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes3.dex */
public enum CharacterSetECI {
Cp437(new int[]{0, 2}, new String[0]),
ISO8859_1(new int[]{1, 3}, "ISO-8859-1"),
ISO8859_2(4, "ISO-8859-2"),
ISO8859_3(5, "ISO-8859-3"),
ISO8859_4(6, "ISO-8859-4"),
ISO8859_5(7, "ISO-8859-5"),
ISO8859_6(8, "ISO-8859-6"),
ISO8859_7(9, "ISO-8859-7"),
ISO8859_8(10, "ISO-8859-8"),
ISO8859_9(11, "ISO-8859-9"),
ISO8859_10(12, "ISO-8859-10"),
ISO8859_11(13, "ISO-8859-11"),
ISO8859_13(15, "ISO-8859-13"),
ISO8859_14(16, "ISO-8859-14"),
ISO8859_15(17, "ISO-8859-15"),
ISO8859_16(18, "ISO-8859-16"),
SJIS(20, "Shift_JIS"),
Cp1250(21, "windows-1250"),
Cp1251(22, "windows-1251"),
Cp1252(23, "windows-1252"),
Cp1256(24, "windows-1256"),
UnicodeBigUnmarked(25, "UTF-16BE", "UnicodeBig"),
UTF8(26, "UTF-8"),
ASCII(new int[]{27, 170}, "US-ASCII"),
Big5(28),
GB18030(29, "GB2312", "EUC_CN", "GBK"),
EUC_KR(30, "EUC-KR");
private final String[] otherEncodingNames;
private final int[] values;
private static final Map<Integer, CharacterSetECI> VALUE_TO_ECI = new HashMap();
private static final Map<String, CharacterSetECI> NAME_TO_ECI = new HashMap();
static {
for (CharacterSetECI characterSetECI : values()) {
for (int i : characterSetECI.values) {
VALUE_TO_ECI.put(Integer.valueOf(i), characterSetECI);
}
NAME_TO_ECI.put(characterSetECI.name(), characterSetECI);
for (String str : characterSetECI.otherEncodingNames) {
NAME_TO_ECI.put(str, characterSetECI);
}
}
}
CharacterSetECI(int i) {
this(new int[]{i}, new String[0]);
}
CharacterSetECI(int i, String... strArr) {
this.values = new int[]{i};
this.otherEncodingNames = strArr;
}
CharacterSetECI(int[] iArr, String... strArr) {
this.values = iArr;
this.otherEncodingNames = strArr;
}
public int getValue() {
return this.values[0];
}
public static CharacterSetECI getCharacterSetECIByValue(int i) throws FormatException {
if (i < 0 || i >= 900) {
throw FormatException.getFormatInstance();
}
return VALUE_TO_ECI.get(Integer.valueOf(i));
}
public static CharacterSetECI getCharacterSetECIByName(String str) {
return NAME_TO_ECI.get(str);
}
}

View File

@@ -0,0 +1,109 @@
package com.google.zxing.common.reedsolomon;
import com.ironsource.mediationsdk.logger.IronSourceError;
/* loaded from: classes3.dex */
public final class GenericGF {
public static final GenericGF AZTEC_DATA_6;
public static final GenericGF AZTEC_DATA_8;
public static final GenericGF AZTEC_PARAM;
public static final GenericGF DATA_MATRIX_FIELD_256;
public static final GenericGF MAXICODE_FIELD_64;
public static final GenericGF QR_CODE_FIELD_256;
public final int[] expTable;
public final int generatorBase;
public final int[] logTable;
public final GenericGFPoly one;
public final int primitive;
public final int size;
public final GenericGFPoly zero;
public static final GenericGF AZTEC_DATA_12 = new GenericGF(4201, 4096, 1);
public static final GenericGF AZTEC_DATA_10 = new GenericGF(IronSourceError.ERROR_RV_LOAD_FAIL_DUE_TO_INIT, 1024, 1);
public static int addOrSubtract(int i, int i2) {
return i ^ i2;
}
public int getGeneratorBase() {
return this.generatorBase;
}
public GenericGFPoly getZero() {
return this.zero;
}
static {
GenericGF genericGF = new GenericGF(67, 64, 1);
AZTEC_DATA_6 = genericGF;
AZTEC_PARAM = new GenericGF(19, 16, 1);
QR_CODE_FIELD_256 = new GenericGF(285, 256, 0);
GenericGF genericGF2 = new GenericGF(301, 256, 1);
DATA_MATRIX_FIELD_256 = genericGF2;
AZTEC_DATA_8 = genericGF2;
MAXICODE_FIELD_64 = genericGF;
}
public GenericGF(int i, int i2, int i3) {
this.primitive = i;
this.size = i2;
this.generatorBase = i3;
this.expTable = new int[i2];
this.logTable = new int[i2];
int i4 = 1;
for (int i5 = 0; i5 < i2; i5++) {
this.expTable[i5] = i4;
i4 <<= 1;
if (i4 >= i2) {
i4 = (i4 ^ i) & (i2 - 1);
}
}
for (int i6 = 0; i6 < i2 - 1; i6++) {
this.logTable[this.expTable[i6]] = i6;
}
this.zero = new GenericGFPoly(this, new int[]{0});
this.one = new GenericGFPoly(this, new int[]{1});
}
public GenericGFPoly buildMonomial(int i, int i2) {
if (i < 0) {
throw new IllegalArgumentException();
}
if (i2 == 0) {
return this.zero;
}
int[] iArr = new int[i + 1];
iArr[0] = i2;
return new GenericGFPoly(this, iArr);
}
public int exp(int i) {
return this.expTable[i];
}
public int log(int i) {
if (i == 0) {
throw new IllegalArgumentException();
}
return this.logTable[i];
}
public int inverse(int i) {
if (i == 0) {
throw new ArithmeticException();
}
return this.expTable[(this.size - this.logTable[i]) - 1];
}
public int multiply(int i, int i2) {
if (i == 0 || i2 == 0) {
return 0;
}
int[] iArr = this.expTable;
int[] iArr2 = this.logTable;
return iArr[(iArr2[i] + iArr2[i2]) % (this.size - 1)];
}
public String toString() {
return "GF(0x" + Integer.toHexString(this.primitive) + ',' + this.size + ')';
}
}

View File

@@ -0,0 +1,163 @@
package com.google.zxing.common.reedsolomon;
/* loaded from: classes3.dex */
public final class GenericGFPoly {
public final int[] coefficients;
public final GenericGF field;
public int[] getCoefficients() {
return this.coefficients;
}
public GenericGFPoly(GenericGF genericGF, int[] iArr) {
if (iArr.length == 0) {
throw new IllegalArgumentException();
}
this.field = genericGF;
int length = iArr.length;
int i = 1;
if (length <= 1 || iArr[0] != 0) {
this.coefficients = iArr;
return;
}
while (i < length && iArr[i] == 0) {
i++;
}
if (i == length) {
this.coefficients = new int[]{0};
return;
}
int[] iArr2 = new int[length - i];
this.coefficients = iArr2;
System.arraycopy(iArr, i, iArr2, 0, iArr2.length);
}
public int getDegree() {
return this.coefficients.length - 1;
}
public boolean isZero() {
return this.coefficients[0] == 0;
}
public int getCoefficient(int i) {
return this.coefficients[(r0.length - 1) - i];
}
public GenericGFPoly addOrSubtract(GenericGFPoly genericGFPoly) {
if (!this.field.equals(genericGFPoly.field)) {
throw new IllegalArgumentException("GenericGFPolys do not have same GenericGF field");
}
if (isZero()) {
return genericGFPoly;
}
if (genericGFPoly.isZero()) {
return this;
}
int[] iArr = this.coefficients;
int[] iArr2 = genericGFPoly.coefficients;
if (iArr.length <= iArr2.length) {
iArr = iArr2;
iArr2 = iArr;
}
int[] iArr3 = new int[iArr.length];
int length = iArr.length - iArr2.length;
System.arraycopy(iArr, 0, iArr3, 0, length);
for (int i = length; i < iArr.length; i++) {
iArr3[i] = GenericGF.addOrSubtract(iArr2[i - length], iArr[i]);
}
return new GenericGFPoly(this.field, iArr3);
}
public GenericGFPoly multiply(GenericGFPoly genericGFPoly) {
if (!this.field.equals(genericGFPoly.field)) {
throw new IllegalArgumentException("GenericGFPolys do not have same GenericGF field");
}
if (isZero() || genericGFPoly.isZero()) {
return this.field.getZero();
}
int[] iArr = this.coefficients;
int length = iArr.length;
int[] iArr2 = genericGFPoly.coefficients;
int length2 = iArr2.length;
int[] iArr3 = new int[(length + length2) - 1];
for (int i = 0; i < length; i++) {
int i2 = iArr[i];
for (int i3 = 0; i3 < length2; i3++) {
int i4 = i + i3;
iArr3[i4] = GenericGF.addOrSubtract(iArr3[i4], this.field.multiply(i2, iArr2[i3]));
}
}
return new GenericGFPoly(this.field, iArr3);
}
public GenericGFPoly multiplyByMonomial(int i, int i2) {
if (i < 0) {
throw new IllegalArgumentException();
}
if (i2 == 0) {
return this.field.getZero();
}
int length = this.coefficients.length;
int[] iArr = new int[i + length];
for (int i3 = 0; i3 < length; i3++) {
iArr[i3] = this.field.multiply(this.coefficients[i3], i2);
}
return new GenericGFPoly(this.field, iArr);
}
public GenericGFPoly[] divide(GenericGFPoly genericGFPoly) {
if (!this.field.equals(genericGFPoly.field)) {
throw new IllegalArgumentException("GenericGFPolys do not have same GenericGF field");
}
if (genericGFPoly.isZero()) {
throw new IllegalArgumentException("Divide by 0");
}
GenericGFPoly zero = this.field.getZero();
int inverse = this.field.inverse(genericGFPoly.getCoefficient(genericGFPoly.getDegree()));
GenericGFPoly genericGFPoly2 = this;
while (genericGFPoly2.getDegree() >= genericGFPoly.getDegree() && !genericGFPoly2.isZero()) {
int degree = genericGFPoly2.getDegree() - genericGFPoly.getDegree();
int multiply = this.field.multiply(genericGFPoly2.getCoefficient(genericGFPoly2.getDegree()), inverse);
GenericGFPoly multiplyByMonomial = genericGFPoly.multiplyByMonomial(degree, multiply);
zero = zero.addOrSubtract(this.field.buildMonomial(degree, multiply));
genericGFPoly2 = genericGFPoly2.addOrSubtract(multiplyByMonomial);
}
return new GenericGFPoly[]{zero, genericGFPoly2};
}
public String toString() {
StringBuilder sb = new StringBuilder(getDegree() * 8);
for (int degree = getDegree(); degree >= 0; degree--) {
int coefficient = getCoefficient(degree);
if (coefficient != 0) {
if (coefficient < 0) {
sb.append(" - ");
coefficient = -coefficient;
} else if (sb.length() > 0) {
sb.append(" + ");
}
if (degree == 0 || coefficient != 1) {
int log = this.field.log(coefficient);
if (log == 0) {
sb.append('1');
} else if (log == 1) {
sb.append('a');
} else {
sb.append("a^");
sb.append(log);
}
}
if (degree != 0) {
if (degree == 1) {
sb.append('x');
} else {
sb.append("x^");
sb.append(degree);
}
}
}
}
return sb.toString();
}
}

View File

@@ -0,0 +1,49 @@
package com.google.zxing.common.reedsolomon;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes3.dex */
public final class ReedSolomonEncoder {
public final List cachedGenerators;
public final GenericGF field;
public ReedSolomonEncoder(GenericGF genericGF) {
this.field = genericGF;
ArrayList arrayList = new ArrayList();
this.cachedGenerators = arrayList;
arrayList.add(new GenericGFPoly(genericGF, new int[]{1}));
}
public final GenericGFPoly buildGenerator(int i) {
if (i >= this.cachedGenerators.size()) {
List list = this.cachedGenerators;
GenericGFPoly genericGFPoly = (GenericGFPoly) list.get(list.size() - 1);
for (int size = this.cachedGenerators.size(); size <= i; size++) {
GenericGF genericGF = this.field;
genericGFPoly = genericGFPoly.multiply(new GenericGFPoly(genericGF, new int[]{1, genericGF.exp((size - 1) + genericGF.getGeneratorBase())}));
this.cachedGenerators.add(genericGFPoly);
}
}
return (GenericGFPoly) this.cachedGenerators.get(i);
}
public void encode(int[] iArr, int i) {
if (i == 0) {
throw new IllegalArgumentException("No error correction bytes");
}
int length = iArr.length - i;
if (length <= 0) {
throw new IllegalArgumentException("No data bytes provided");
}
GenericGFPoly buildGenerator = buildGenerator(i);
int[] iArr2 = new int[length];
System.arraycopy(iArr, 0, iArr2, 0, length);
int[] coefficients = new GenericGFPoly(this.field, iArr2).multiplyByMonomial(i, 1).divide(buildGenerator)[1].getCoefficients();
int length2 = i - coefficients.length;
for (int i2 = 0; i2 < length2; i2++) {
iArr[length + i2] = 0;
}
System.arraycopy(coefficients, 0, iArr, length + length2, coefficients.length);
}
}

View File

@@ -0,0 +1,124 @@
package com.google.zxing.datamatrix;
import com.amazonaws.handlers.HandlerChainFactory$$ExternalSyntheticThrowCCEIfNotNull0;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.Writer;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.datamatrix.encoder.DefaultPlacement;
import com.google.zxing.datamatrix.encoder.ErrorCorrection;
import com.google.zxing.datamatrix.encoder.HighLevelEncoder;
import com.google.zxing.datamatrix.encoder.SymbolInfo;
import com.google.zxing.datamatrix.encoder.SymbolShapeHint;
import com.google.zxing.qrcode.encoder.ByteMatrix;
import java.util.Map;
/* loaded from: classes3.dex */
public final class DataMatrixWriter implements Writer {
@Override // com.google.zxing.Writer
public BitMatrix encode(String str, BarcodeFormat barcodeFormat, int i, int i2, Map map) {
if (str.isEmpty()) {
throw new IllegalArgumentException("Found empty contents");
}
if (barcodeFormat != BarcodeFormat.DATA_MATRIX) {
throw new IllegalArgumentException("Can only encode DATA_MATRIX, but got ".concat(String.valueOf(barcodeFormat)));
}
if (i < 0 || i2 < 0) {
throw new IllegalArgumentException("Requested dimensions can't be negative: " + i + 'x' + i2);
}
SymbolShapeHint symbolShapeHint = SymbolShapeHint.FORCE_NONE;
if (map != null) {
SymbolShapeHint symbolShapeHint2 = (SymbolShapeHint) map.get(EncodeHintType.DATA_MATRIX_SHAPE);
if (symbolShapeHint2 != null) {
symbolShapeHint = symbolShapeHint2;
}
HandlerChainFactory$$ExternalSyntheticThrowCCEIfNotNull0.m(map.get(EncodeHintType.MIN_SIZE));
HandlerChainFactory$$ExternalSyntheticThrowCCEIfNotNull0.m(map.get(EncodeHintType.MAX_SIZE));
}
String encodeHighLevel = HighLevelEncoder.encodeHighLevel(str, symbolShapeHint, null, null);
SymbolInfo lookup = SymbolInfo.lookup(encodeHighLevel.length(), symbolShapeHint, null, null, true);
DefaultPlacement defaultPlacement = new DefaultPlacement(ErrorCorrection.encodeECC200(encodeHighLevel, lookup), lookup.getSymbolDataWidth(), lookup.getSymbolDataHeight());
defaultPlacement.place();
return encodeLowLevel(defaultPlacement, lookup, i, i2);
}
public static BitMatrix encodeLowLevel(DefaultPlacement defaultPlacement, SymbolInfo symbolInfo, int i, int i2) {
int symbolDataWidth = symbolInfo.getSymbolDataWidth();
int symbolDataHeight = symbolInfo.getSymbolDataHeight();
ByteMatrix byteMatrix = new ByteMatrix(symbolInfo.getSymbolWidth(), symbolInfo.getSymbolHeight());
int i3 = 0;
for (int i4 = 0; i4 < symbolDataHeight; i4++) {
if (i4 % symbolInfo.matrixHeight == 0) {
int i5 = 0;
for (int i6 = 0; i6 < symbolInfo.getSymbolWidth(); i6++) {
byteMatrix.set(i5, i3, i6 % 2 == 0);
i5++;
}
i3++;
}
int i7 = 0;
for (int i8 = 0; i8 < symbolDataWidth; i8++) {
if (i8 % symbolInfo.matrixWidth == 0) {
byteMatrix.set(i7, i3, true);
i7++;
}
byteMatrix.set(i7, i3, defaultPlacement.getBit(i8, i4));
int i9 = i7 + 1;
int i10 = symbolInfo.matrixWidth;
if (i8 % i10 == i10 - 1) {
byteMatrix.set(i9, i3, i4 % 2 == 0);
i7 += 2;
} else {
i7 = i9;
}
}
int i11 = i3 + 1;
int i12 = symbolInfo.matrixHeight;
if (i4 % i12 == i12 - 1) {
int i13 = 0;
for (int i14 = 0; i14 < symbolInfo.getSymbolWidth(); i14++) {
byteMatrix.set(i13, i11, true);
i13++;
}
i3 += 2;
} else {
i3 = i11;
}
}
return convertByteMatrixToBitMatrix(byteMatrix, i, i2);
}
public static BitMatrix convertByteMatrixToBitMatrix(ByteMatrix byteMatrix, int i, int i2) {
BitMatrix bitMatrix;
int width = byteMatrix.getWidth();
int height = byteMatrix.getHeight();
int max = Math.max(i, width);
int max2 = Math.max(i2, height);
int min = Math.min(max / width, max2 / height);
int i3 = (max - (width * min)) / 2;
int i4 = (max2 - (height * min)) / 2;
if (i2 < height || i < width) {
bitMatrix = new BitMatrix(width, height);
i3 = 0;
i4 = 0;
} else {
bitMatrix = new BitMatrix(i, i2);
}
bitMatrix.clear();
int i5 = 0;
while (i5 < height) {
int i6 = i3;
int i7 = 0;
while (i7 < width) {
if (byteMatrix.get(i7, i5) == 1) {
bitMatrix.setRegion(i6, i4, min, min);
}
i7++;
i6 += min;
}
i5++;
i4 += min;
}
return bitMatrix;
}
}

View File

@@ -0,0 +1,62 @@
package com.google.zxing.datamatrix.encoder;
/* loaded from: classes3.dex */
public final class ASCIIEncoder implements Encoder {
public int getEncodingMode() {
return 0;
}
@Override // com.google.zxing.datamatrix.encoder.Encoder
public void encode(EncoderContext encoderContext) {
if (HighLevelEncoder.determineConsecutiveDigitCount(encoderContext.getMessage(), encoderContext.pos) >= 2) {
encoderContext.writeCodeword(encodeASCIIDigits(encoderContext.getMessage().charAt(encoderContext.pos), encoderContext.getMessage().charAt(encoderContext.pos + 1)));
encoderContext.pos += 2;
return;
}
char currentChar = encoderContext.getCurrentChar();
int lookAheadTest = HighLevelEncoder.lookAheadTest(encoderContext.getMessage(), encoderContext.pos, getEncodingMode());
if (lookAheadTest == getEncodingMode()) {
if (HighLevelEncoder.isExtendedASCII(currentChar)) {
encoderContext.writeCodeword((char) 235);
encoderContext.writeCodeword((char) (currentChar - 127));
encoderContext.pos++;
return;
} else {
encoderContext.writeCodeword((char) (currentChar + 1));
encoderContext.pos++;
return;
}
}
if (lookAheadTest == 1) {
encoderContext.writeCodeword((char) 230);
encoderContext.signalEncoderChange(1);
return;
}
if (lookAheadTest == 2) {
encoderContext.writeCodeword((char) 239);
encoderContext.signalEncoderChange(2);
return;
}
if (lookAheadTest == 3) {
encoderContext.writeCodeword((char) 238);
encoderContext.signalEncoderChange(3);
} else if (lookAheadTest == 4) {
encoderContext.writeCodeword((char) 240);
encoderContext.signalEncoderChange(4);
} else {
if (lookAheadTest == 5) {
encoderContext.writeCodeword((char) 231);
encoderContext.signalEncoderChange(5);
return;
}
throw new IllegalStateException("Illegal mode: ".concat(String.valueOf(lookAheadTest)));
}
}
public static char encodeASCIIDigits(char c, char c2) {
if (HighLevelEncoder.isDigit(c) && HighLevelEncoder.isDigit(c2)) {
return (char) (((c - '0') * 10) + (c2 - '0') + 130);
}
throw new IllegalArgumentException("not digits: " + c + c2);
}
}

View File

@@ -0,0 +1,48 @@
package com.google.zxing.datamatrix.encoder;
/* loaded from: classes3.dex */
public final class Base256Encoder implements Encoder {
public int getEncodingMode() {
return 5;
}
@Override // com.google.zxing.datamatrix.encoder.Encoder
public void encode(EncoderContext encoderContext) {
StringBuilder sb = new StringBuilder();
sb.append((char) 0);
while (true) {
if (!encoderContext.hasMoreCharacters()) {
break;
}
sb.append(encoderContext.getCurrentChar());
encoderContext.pos++;
if (HighLevelEncoder.lookAheadTest(encoderContext.getMessage(), encoderContext.pos, getEncodingMode()) != getEncodingMode()) {
encoderContext.signalEncoderChange(0);
break;
}
}
int length = sb.length() - 1;
int codewordCount = encoderContext.getCodewordCount() + length + 1;
encoderContext.updateSymbolInfo(codewordCount);
boolean z = encoderContext.getSymbolInfo().getDataCapacity() - codewordCount > 0;
if (encoderContext.hasMoreCharacters() || z) {
if (length <= 249) {
sb.setCharAt(0, (char) length);
} else if (length <= 1555) {
sb.setCharAt(0, (char) ((length / 250) + 249));
sb.insert(1, (char) (length % 250));
} else {
throw new IllegalStateException("Message length not in valid ranges: ".concat(String.valueOf(length)));
}
}
int length2 = sb.length();
for (int i = 0; i < length2; i++) {
encoderContext.writeCodeword(randomize255State(sb.charAt(i), encoderContext.getCodewordCount() + 1));
}
}
public static char randomize255State(char c, int i) {
int i2 = c + ((i * 149) % 255) + 1;
return i2 <= 255 ? (char) i2 : (char) (i2 - 256);
}
}

View File

@@ -0,0 +1,133 @@
package com.google.zxing.datamatrix.encoder;
/* loaded from: classes3.dex */
public class C40Encoder implements Encoder {
public int getEncodingMode() {
return 1;
}
@Override // com.google.zxing.datamatrix.encoder.Encoder
public void encode(EncoderContext encoderContext) {
StringBuilder sb = new StringBuilder();
while (true) {
if (!encoderContext.hasMoreCharacters()) {
break;
}
char currentChar = encoderContext.getCurrentChar();
encoderContext.pos++;
int encodeChar = encodeChar(currentChar, sb);
int codewordCount = encoderContext.getCodewordCount() + ((sb.length() / 3) << 1);
encoderContext.updateSymbolInfo(codewordCount);
int dataCapacity = encoderContext.getSymbolInfo().getDataCapacity() - codewordCount;
if (!encoderContext.hasMoreCharacters()) {
StringBuilder sb2 = new StringBuilder();
if (sb.length() % 3 == 2 && (dataCapacity < 2 || dataCapacity > 2)) {
encodeChar = backtrackOneCharacter(encoderContext, sb, sb2, encodeChar);
}
while (sb.length() % 3 == 1 && ((encodeChar <= 3 && dataCapacity != 1) || encodeChar > 3)) {
encodeChar = backtrackOneCharacter(encoderContext, sb, sb2, encodeChar);
}
} else if (sb.length() % 3 == 0 && HighLevelEncoder.lookAheadTest(encoderContext.getMessage(), encoderContext.pos, getEncodingMode()) != getEncodingMode()) {
encoderContext.signalEncoderChange(0);
break;
}
}
handleEOD(encoderContext, sb);
}
public final int backtrackOneCharacter(EncoderContext encoderContext, StringBuilder sb, StringBuilder sb2, int i) {
int length = sb.length();
sb.delete(length - i, length);
encoderContext.pos--;
int encodeChar = encodeChar(encoderContext.getCurrentChar(), sb2);
encoderContext.resetSymbolInfo();
return encodeChar;
}
public static void writeNextTriplet(EncoderContext encoderContext, StringBuilder sb) {
encoderContext.writeCodewords(encodeToCodewords(sb, 0));
sb.delete(0, 3);
}
public void handleEOD(EncoderContext encoderContext, StringBuilder sb) {
int length = (sb.length() / 3) << 1;
int length2 = sb.length() % 3;
int codewordCount = encoderContext.getCodewordCount() + length;
encoderContext.updateSymbolInfo(codewordCount);
int dataCapacity = encoderContext.getSymbolInfo().getDataCapacity() - codewordCount;
if (length2 == 2) {
sb.append((char) 0);
while (sb.length() >= 3) {
writeNextTriplet(encoderContext, sb);
}
if (encoderContext.hasMoreCharacters()) {
encoderContext.writeCodeword((char) 254);
}
} else if (dataCapacity == 1 && length2 == 1) {
while (sb.length() >= 3) {
writeNextTriplet(encoderContext, sb);
}
if (encoderContext.hasMoreCharacters()) {
encoderContext.writeCodeword((char) 254);
}
encoderContext.pos--;
} else if (length2 == 0) {
while (sb.length() >= 3) {
writeNextTriplet(encoderContext, sb);
}
if (dataCapacity > 0 || encoderContext.hasMoreCharacters()) {
encoderContext.writeCodeword((char) 254);
}
} else {
throw new IllegalStateException("Unexpected case. Please report!");
}
encoderContext.signalEncoderChange(0);
}
public int encodeChar(char c, StringBuilder sb) {
if (c == ' ') {
sb.append((char) 3);
return 1;
}
if (c >= '0' && c <= '9') {
sb.append((char) (c - ','));
return 1;
}
if (c >= 'A' && c <= 'Z') {
sb.append((char) (c - '3'));
return 1;
}
if (c < ' ') {
sb.append((char) 0);
sb.append(c);
return 2;
}
if (c >= '!' && c <= '/') {
sb.append((char) 1);
sb.append((char) (c - '!'));
return 2;
}
if (c >= ':' && c <= '@') {
sb.append((char) 1);
sb.append((char) (c - '+'));
return 2;
}
if (c >= '[' && c <= '_') {
sb.append((char) 1);
sb.append((char) (c - 'E'));
return 2;
}
if (c >= '`' && c <= 127) {
sb.append((char) 2);
sb.append((char) (c - '`'));
return 2;
}
sb.append("\u0001\u001e");
return encodeChar((char) (c - 128), sb) + 2;
}
public static String encodeToCodewords(CharSequence charSequence, int i) {
int charAt = (charSequence.charAt(i) * 1600) + (charSequence.charAt(i + 1) * '(') + charSequence.charAt(i + 2) + 1;
return new String(new char[]{(char) (charAt / 256), (char) (charAt % 256)});
}
}

View File

@@ -0,0 +1,20 @@
package com.google.zxing.datamatrix.encoder;
import com.ironsource.mediationsdk.logger.IronSourceError;
/* loaded from: classes3.dex */
public final class DataMatrixSymbolInfo144 extends SymbolInfo {
@Override // com.google.zxing.datamatrix.encoder.SymbolInfo
public int getDataLengthForInterleavedBlock(int i) {
return i <= 8 ? 156 : 155;
}
@Override // com.google.zxing.datamatrix.encoder.SymbolInfo
public int getInterleavedBlockCount() {
return 10;
}
public DataMatrixSymbolInfo144() {
super(false, 1558, IronSourceError.ERROR_DO_BN_LOAD_DURING_SHOW, 22, 22, 36, -1, 62);
}
}

View File

@@ -0,0 +1,170 @@
package com.google.zxing.datamatrix.encoder;
import java.util.Arrays;
/* loaded from: classes3.dex */
public class DefaultPlacement {
public final byte[] bits;
public final CharSequence codewords;
public final int numcols;
public final int numrows;
public DefaultPlacement(CharSequence charSequence, int i, int i2) {
this.codewords = charSequence;
this.numcols = i;
this.numrows = i2;
byte[] bArr = new byte[i * i2];
this.bits = bArr;
Arrays.fill(bArr, (byte) -1);
}
public final boolean getBit(int i, int i2) {
return this.bits[(i2 * this.numcols) + i] == 1;
}
public final void setBit(int i, int i2, boolean z) {
this.bits[(i2 * this.numcols) + i] = z ? (byte) 1 : (byte) 0;
}
public final boolean hasBit(int i, int i2) {
return this.bits[(i2 * this.numcols) + i] >= 0;
}
public final void place() {
int i;
int i2;
int i3 = 0;
int i4 = 0;
int i5 = 4;
while (true) {
if (i5 == this.numrows && i3 == 0) {
corner1(i4);
i4++;
}
if (i5 == this.numrows - 2 && i3 == 0 && this.numcols % 4 != 0) {
corner2(i4);
i4++;
}
if (i5 == this.numrows - 2 && i3 == 0 && this.numcols % 8 == 4) {
corner3(i4);
i4++;
}
if (i5 == this.numrows + 4 && i3 == 2 && this.numcols % 8 == 0) {
corner4(i4);
i4++;
}
while (true) {
if (i5 < this.numrows && i3 >= 0 && !hasBit(i3, i5)) {
utah(i5, i3, i4);
i4++;
}
int i6 = i5 - 2;
int i7 = i3 + 2;
if (i6 < 0 || i7 >= this.numcols) {
break;
}
i5 = i6;
i3 = i7;
}
int i8 = i5 - 1;
int i9 = i3 + 5;
while (true) {
if (i8 >= 0 && i9 < this.numcols && !hasBit(i9, i8)) {
utah(i8, i9, i4);
i4++;
}
int i10 = i8 + 2;
int i11 = i9 - 2;
i = this.numrows;
if (i10 >= i || i11 < 0) {
break;
}
i8 = i10;
i9 = i11;
}
i5 = i8 + 5;
i3 = i9 - 1;
if (i5 >= i && i3 >= (i2 = this.numcols)) {
break;
}
}
if (hasBit(i2 - 1, i - 1)) {
return;
}
setBit(this.numcols - 1, this.numrows - 1, true);
setBit(this.numcols - 2, this.numrows - 2, true);
}
public final void module(int i, int i2, int i3, int i4) {
if (i < 0) {
int i5 = this.numrows;
i += i5;
i2 += 4 - ((i5 + 4) % 8);
}
if (i2 < 0) {
int i6 = this.numcols;
i2 += i6;
i += 4 - ((i6 + 4) % 8);
}
setBit(i2, i, (this.codewords.charAt(i3) & (1 << (8 - i4))) != 0);
}
public final void utah(int i, int i2, int i3) {
int i4 = i - 2;
int i5 = i2 - 2;
module(i4, i5, i3, 1);
int i6 = i2 - 1;
module(i4, i6, i3, 2);
int i7 = i - 1;
module(i7, i5, i3, 3);
module(i7, i6, i3, 4);
module(i7, i2, i3, 5);
module(i, i5, i3, 6);
module(i, i6, i3, 7);
module(i, i2, i3, 8);
}
public final void corner1(int i) {
module(this.numrows - 1, 0, i, 1);
module(this.numrows - 1, 1, i, 2);
module(this.numrows - 1, 2, i, 3);
module(0, this.numcols - 2, i, 4);
module(0, this.numcols - 1, i, 5);
module(1, this.numcols - 1, i, 6);
module(2, this.numcols - 1, i, 7);
module(3, this.numcols - 1, i, 8);
}
public final void corner2(int i) {
module(this.numrows - 3, 0, i, 1);
module(this.numrows - 2, 0, i, 2);
module(this.numrows - 1, 0, i, 3);
module(0, this.numcols - 4, i, 4);
module(0, this.numcols - 3, i, 5);
module(0, this.numcols - 2, i, 6);
module(0, this.numcols - 1, i, 7);
module(1, this.numcols - 1, i, 8);
}
public final void corner3(int i) {
module(this.numrows - 3, 0, i, 1);
module(this.numrows - 2, 0, i, 2);
module(this.numrows - 1, 0, i, 3);
module(0, this.numcols - 2, i, 4);
module(0, this.numcols - 1, i, 5);
module(1, this.numcols - 1, i, 6);
module(2, this.numcols - 1, i, 7);
module(3, this.numcols - 1, i, 8);
}
public final void corner4(int i) {
module(this.numrows - 1, 0, i, 1);
module(this.numrows - 1, this.numcols - 1, i, 2);
module(0, this.numcols - 3, i, 3);
module(0, this.numcols - 2, i, 4);
module(0, this.numcols - 1, i, 5);
module(1, this.numcols - 3, i, 6);
module(1, this.numcols - 2, i, 7);
module(1, this.numcols - 1, i, 8);
}
}

View File

@@ -0,0 +1,104 @@
package com.google.zxing.datamatrix.encoder;
/* loaded from: classes3.dex */
public final class EdifactEncoder implements Encoder {
public int getEncodingMode() {
return 4;
}
@Override // com.google.zxing.datamatrix.encoder.Encoder
public void encode(EncoderContext encoderContext) {
StringBuilder sb = new StringBuilder();
while (true) {
if (!encoderContext.hasMoreCharacters()) {
break;
}
encodeChar(encoderContext.getCurrentChar(), sb);
encoderContext.pos++;
if (sb.length() >= 4) {
encoderContext.writeCodewords(encodeToCodewords(sb, 0));
sb.delete(0, 4);
if (HighLevelEncoder.lookAheadTest(encoderContext.getMessage(), encoderContext.pos, getEncodingMode()) != getEncodingMode()) {
encoderContext.signalEncoderChange(0);
break;
}
}
}
sb.append((char) 31);
handleEOD(encoderContext, sb);
}
public static void handleEOD(EncoderContext encoderContext, CharSequence charSequence) {
try {
int length = charSequence.length();
if (length == 0) {
return;
}
boolean z = true;
if (length == 1) {
encoderContext.updateSymbolInfo();
int dataCapacity = encoderContext.getSymbolInfo().getDataCapacity() - encoderContext.getCodewordCount();
int remainingCharacters = encoderContext.getRemainingCharacters();
if (remainingCharacters > dataCapacity) {
encoderContext.updateSymbolInfo(encoderContext.getCodewordCount() + 1);
dataCapacity = encoderContext.getSymbolInfo().getDataCapacity() - encoderContext.getCodewordCount();
}
if (remainingCharacters <= dataCapacity && dataCapacity <= 2) {
return;
}
}
if (length > 4) {
throw new IllegalStateException("Count must not exceed 4");
}
int i = length - 1;
String encodeToCodewords = encodeToCodewords(charSequence, 0);
if (!(!encoderContext.hasMoreCharacters()) || i > 2) {
z = false;
}
if (i <= 2) {
encoderContext.updateSymbolInfo(encoderContext.getCodewordCount() + i);
if (encoderContext.getSymbolInfo().getDataCapacity() - encoderContext.getCodewordCount() >= 3) {
encoderContext.updateSymbolInfo(encoderContext.getCodewordCount() + encodeToCodewords.length());
encoderContext.writeCodewords(encodeToCodewords);
}
}
if (z) {
encoderContext.resetSymbolInfo();
encoderContext.pos -= i;
}
encoderContext.writeCodewords(encodeToCodewords);
} finally {
encoderContext.signalEncoderChange(0);
}
}
public static void encodeChar(char c, StringBuilder sb) {
if (c >= ' ' && c <= '?') {
sb.append(c);
} else if (c >= '@' && c <= '^') {
sb.append((char) (c - '@'));
} else {
HighLevelEncoder.illegalCharacter(c);
}
}
private static String encodeToCodewords(CharSequence charSequence, int i) {
int length = charSequence.length() - i;
if (length == 0) {
throw new IllegalStateException("StringBuilder must not be empty");
}
int charAt = (charSequence.charAt(i) << 18) + ((length >= 2 ? charSequence.charAt(i + 1) : (char) 0) << '\f') + ((length >= 3 ? charSequence.charAt(i + 2) : (char) 0) << 6) + (length >= 4 ? charSequence.charAt(i + 3) : (char) 0);
char c = (char) ((charAt >> 16) & 255);
char c2 = (char) ((charAt >> 8) & 255);
char c3 = (char) (charAt & 255);
StringBuilder sb = new StringBuilder(3);
sb.append(c);
if (length >= 2) {
sb.append(c2);
}
if (length >= 3) {
sb.append(c3);
}
return sb.toString();
}
}

View File

@@ -0,0 +1,6 @@
package com.google.zxing.datamatrix.encoder;
/* loaded from: classes3.dex */
public interface Encoder {
void encode(EncoderContext encoderContext);
}

View File

@@ -0,0 +1,110 @@
package com.google.zxing.datamatrix.encoder;
import com.google.zxing.Dimension;
import java.nio.charset.StandardCharsets;
/* loaded from: classes3.dex */
public final class EncoderContext {
public final StringBuilder codewords;
public final String msg;
public int newEncoding;
public int pos;
public SymbolShapeHint shape;
public int skipAtEnd;
public SymbolInfo symbolInfo;
public StringBuilder getCodewords() {
return this.codewords;
}
public String getMessage() {
return this.msg;
}
public int getNewEncoding() {
return this.newEncoding;
}
public SymbolInfo getSymbolInfo() {
return this.symbolInfo;
}
public void resetEncoderSignal() {
this.newEncoding = -1;
}
public void resetSymbolInfo() {
this.symbolInfo = null;
}
public void setSizeConstraints(Dimension dimension, Dimension dimension2) {
}
public void setSkipAtEnd(int i) {
this.skipAtEnd = i;
}
public void setSymbolShape(SymbolShapeHint symbolShapeHint) {
this.shape = symbolShapeHint;
}
public void signalEncoderChange(int i) {
this.newEncoding = i;
}
public EncoderContext(String str) {
byte[] bytes = str.getBytes(StandardCharsets.ISO_8859_1);
StringBuilder sb = new StringBuilder(bytes.length);
int length = bytes.length;
for (int i = 0; i < length; i++) {
char c = (char) (bytes[i] & 255);
if (c == '?' && str.charAt(i) != '?') {
throw new IllegalArgumentException("Message contains characters outside ISO-8859-1 encoding.");
}
sb.append(c);
}
this.msg = sb.toString();
this.shape = SymbolShapeHint.FORCE_NONE;
this.codewords = new StringBuilder(str.length());
this.newEncoding = -1;
}
public char getCurrentChar() {
return this.msg.charAt(this.pos);
}
public void writeCodewords(String str) {
this.codewords.append(str);
}
public void writeCodeword(char c) {
this.codewords.append(c);
}
public int getCodewordCount() {
return this.codewords.length();
}
public boolean hasMoreCharacters() {
return this.pos < getTotalMessageCharCount();
}
public final int getTotalMessageCharCount() {
return this.msg.length() - this.skipAtEnd;
}
public int getRemainingCharacters() {
return getTotalMessageCharCount() - this.pos;
}
public void updateSymbolInfo() {
updateSymbolInfo(getCodewordCount());
}
public void updateSymbolInfo(int i) {
SymbolInfo symbolInfo = this.symbolInfo;
if (symbolInfo == null || i > symbolInfo.getDataCapacity()) {
this.symbolInfo = SymbolInfo.lookup(i, this.shape, null, null, true);
}
}
}

View File

@@ -0,0 +1,126 @@
package com.google.zxing.datamatrix.encoder;
import com.facebook.internal.FacebookRequestErrorClassification;
import com.ironsource.mediationsdk.utils.IronSourceConstants;
import com.mbridge.msdk.playercommon.exoplayer2.extractor.ts.PsExtractor;
import com.vungle.ads.internal.protos.Sdk;
import com.vungle.ads.internal.signals.SignalKey;
/* loaded from: classes3.dex */
public abstract class ErrorCorrection {
public static final int[] FACTOR_SETS = {5, 7, 10, 11, 12, 14, 18, 20, 24, 28, 36, 42, 48, 56, 62, 68};
public static final int[][] FACTORS = {new int[]{228, 48, 15, 111, 62}, new int[]{23, 68, 144, 134, PsExtractor.VIDEO_STREAM_MASK, 92, 254}, new int[]{28, 24, 185, 166, Sdk.SDKError.Reason.STALE_CACHED_RESPONSE_VALUE, 248, 116, 255, 110, 61}, new int[]{175, 138, 205, 12, 194, 168, 39, 245, 60, 97, 120}, new int[]{41, 153, 158, 91, 61, 42, 142, 213, 97, 178, 100, 242}, new int[]{156, 97, PsExtractor.AUDIO_STREAM, 252, 95, 9, 157, 119, 138, 45, 18, 186, 83, 185}, new int[]{83, 195, 100, 39, 188, 75, 66, 61, 241, 213, 109, 129, 94, 254, 225, 48, 90, 188}, new int[]{15, 195, 244, 9, 233, 71, 168, 2, 188, 160, 153, 145, 253, 79, 108, 82, 27, 174, 186, 172}, new int[]{52, FacebookRequestErrorClassification.EC_INVALID_TOKEN, 88, 205, 109, 39, 176, 21, 155, 197, 251, Sdk.SDKError.Reason.STALE_CACHED_RESPONSE_VALUE, 155, 21, 5, 172, 254, 124, 12, 181, 184, 96, 50, 193}, new int[]{211, 231, 43, 97, 71, 96, 103, 174, 37, 151, 170, 53, 75, 34, 249, 121, 17, 138, 110, 213, 141, 136, 120, 151, 233, 168, 93, 255}, new int[]{245, 127, 242, 218, 130, 250, 162, 181, 102, 120, 84, 179, 220, 251, 80, 182, 229, 18, 2, 4, 68, 33, 101, 137, 95, 119, 115, 44, 175, 184, 59, 25, 225, 98, 81, 112}, new int[]{77, 193, 137, 31, 19, 38, 22, 153, 247, 105, 122, 2, 245, 133, 242, 8, 175, 95, 100, 9, 167, 105, 214, 111, 57, 121, 21, 1, 253, 57, 54, 101, 248, 202, 69, 50, IronSourceConstants.REWARDED_VIDEO_DAILY_CAPPED, 177, 226, 5, 9, 5}, new int[]{245, 132, 172, Sdk.SDKError.Reason.STALE_CACHED_RESPONSE_VALUE, 96, 32, 117, 22, 238, 133, 238, 231, 205, 188, 237, 87, 191, 106, 16, 147, 118, 23, 37, 90, 170, 205, 131, 88, 120, 100, 66, 138, 186, PsExtractor.VIDEO_STREAM_MASK, 82, 44, 176, 87, 187, 147, 160, 175, 69, 213, 92, 253, 225, 19}, new int[]{175, 9, Sdk.SDKError.Reason.STALE_CACHED_RESPONSE_VALUE, 238, 12, 17, 220, 208, 100, 29, 175, 170, 230, PsExtractor.AUDIO_STREAM, 215, 235, IronSourceConstants.REWARDED_VIDEO_DAILY_CAPPED, 159, 36, Sdk.SDKError.Reason.STALE_CACHED_RESPONSE_VALUE, 38, 200, 132, 54, 228, 146, 218, 234, 117, 203, 29, 232, 144, 238, 22, IronSourceConstants.REWARDED_VIDEO_DAILY_CAPPED, 201, 117, 62, 207, 164, 13, 137, 245, 127, 67, 247, 28, 155, 43, 203, SignalKey.EVENT_ID, 233, 53, 143, 46}, new int[]{242, 93, 169, 50, 144, 210, 39, 118, 202, 188, 201, PsExtractor.PRIVATE_STREAM_1, 143, 108, 196, 37, 185, 112, 134, 230, 245, 63, 197, FacebookRequestErrorClassification.EC_INVALID_TOKEN, 250, 106, 185, 221, 175, 64, 114, 71, 161, 44, 147, 6, 27, 218, 51, 63, 87, 10, 40, 130, 188, 17, 163, 31, 176, 170, 4, SignalKey.EVENT_ID, 232, 7, 94, 166, 224, 124, 86, 47, 11, 204}, new int[]{220, 228, 173, 89, 251, 149, 159, 56, 89, 33, 147, 244, 154, 36, 73, 127, 213, 136, 248, 180, 234, 197, 158, 177, 68, 122, 93, 213, 15, 160, 227, 236, 66, 139, 153, 185, 202, 167, 179, 25, 220, 232, 96, 210, 231, 136, Sdk.SDKError.Reason.STALE_CACHED_RESPONSE_VALUE, 239, 181, 241, 59, 52, 172, 25, 49, 232, 211, PsExtractor.PRIVATE_STREAM_1, 64, 54, 108, 153, 132, 63, 96, 103, 82, 186}};
public static final int[] LOG = new int[256];
public static final int[] ALOG = new int[255];
static {
int i = 1;
for (int i2 = 0; i2 < 255; i2++) {
ALOG[i2] = i;
LOG[i] = i2;
i <<= 1;
if (i >= 256) {
i ^= 301;
}
}
}
public static String encodeECC200(String str, SymbolInfo symbolInfo) {
if (str.length() != symbolInfo.getDataCapacity()) {
throw new IllegalArgumentException("The number of codewords does not match the selected symbol");
}
StringBuilder sb = new StringBuilder(symbolInfo.getDataCapacity() + symbolInfo.getErrorCodewords());
sb.append(str);
int interleavedBlockCount = symbolInfo.getInterleavedBlockCount();
if (interleavedBlockCount == 1) {
sb.append(createECCBlock(str, symbolInfo.getErrorCodewords()));
} else {
sb.setLength(sb.capacity());
int[] iArr = new int[interleavedBlockCount];
int[] iArr2 = new int[interleavedBlockCount];
int[] iArr3 = new int[interleavedBlockCount];
int i = 0;
while (i < interleavedBlockCount) {
int i2 = i + 1;
iArr[i] = symbolInfo.getDataLengthForInterleavedBlock(i2);
iArr2[i] = symbolInfo.getErrorLengthForInterleavedBlock(i2);
iArr3[i] = 0;
if (i > 0) {
iArr3[i] = iArr3[i - 1] + iArr[i];
}
i = i2;
}
for (int i3 = 0; i3 < interleavedBlockCount; i3++) {
StringBuilder sb2 = new StringBuilder(iArr[i3]);
for (int i4 = i3; i4 < symbolInfo.getDataCapacity(); i4 += interleavedBlockCount) {
sb2.append(str.charAt(i4));
}
String createECCBlock = createECCBlock(sb2.toString(), iArr2[i3]);
int i5 = i3;
int i6 = 0;
while (i5 < iArr2[i3] * interleavedBlockCount) {
sb.setCharAt(symbolInfo.getDataCapacity() + i5, createECCBlock.charAt(i6));
i5 += interleavedBlockCount;
i6++;
}
}
}
return sb.toString();
}
public static String createECCBlock(CharSequence charSequence, int i) {
return createECCBlock(charSequence, 0, charSequence.length(), i);
}
public static String createECCBlock(CharSequence charSequence, int i, int i2, int i3) {
int i4;
int i5;
int i6 = 0;
while (true) {
int[] iArr = FACTOR_SETS;
if (i6 >= iArr.length) {
i6 = -1;
break;
}
if (iArr[i6] == i3) {
break;
}
i6++;
}
if (i6 < 0) {
throw new IllegalArgumentException("Illegal number of error correction codewords specified: ".concat(String.valueOf(i3)));
}
int[] iArr2 = FACTORS[i6];
char[] cArr = new char[i3];
for (int i7 = 0; i7 < i3; i7++) {
cArr[i7] = 0;
}
for (int i8 = i; i8 < i + i2; i8++) {
int i9 = i3 - 1;
int charAt = cArr[i9] ^ charSequence.charAt(i8);
while (i9 > 0) {
if (charAt != 0 && (i5 = iArr2[i9]) != 0) {
char c = cArr[i9 - 1];
int[] iArr3 = ALOG;
int[] iArr4 = LOG;
cArr[i9] = (char) (iArr3[(iArr4[charAt] + iArr4[i5]) % 255] ^ c);
} else {
cArr[i9] = cArr[i9 - 1];
}
i9--;
}
if (charAt != 0 && (i4 = iArr2[0]) != 0) {
int[] iArr5 = ALOG;
int[] iArr6 = LOG;
cArr[0] = (char) iArr5[(iArr6[charAt] + iArr6[i4]) % 255];
} else {
cArr[0] = 0;
}
}
char[] cArr2 = new char[i3];
for (int i10 = 0; i10 < i3; i10++) {
cArr2[i10] = cArr[(i3 - i10) - 1];
}
return String.valueOf(cArr2);
}
}

View File

@@ -0,0 +1,284 @@
package com.google.zxing.datamatrix.encoder;
import com.google.zxing.Dimension;
import java.util.Arrays;
/* loaded from: classes3.dex */
public abstract class HighLevelEncoder {
public static boolean isDigit(char c) {
return c >= '0' && c <= '9';
}
public static boolean isExtendedASCII(char c) {
return c >= 128 && c <= 255;
}
public static boolean isNativeC40(char c) {
if (c == ' ') {
return true;
}
if (c < '0' || c > '9') {
return c >= 'A' && c <= 'Z';
}
return true;
}
public static boolean isNativeEDIFACT(char c) {
return c >= ' ' && c <= '^';
}
public static boolean isNativeText(char c) {
if (c == ' ') {
return true;
}
if (c < '0' || c > '9') {
return c >= 'a' && c <= 'z';
}
return true;
}
public static boolean isSpecialB256(char c) {
return false;
}
public static boolean isX12TermSep(char c) {
return c == '\r' || c == '*' || c == '>';
}
public static char randomize253State(char c, int i) {
int i2 = c + ((i * 149) % 253) + 1;
if (i2 > 254) {
i2 -= 254;
}
return (char) i2;
}
public static String encodeHighLevel(String str, SymbolShapeHint symbolShapeHint, Dimension dimension, Dimension dimension2) {
int i = 0;
Encoder[] encoderArr = {new ASCIIEncoder(), new C40Encoder(), new TextEncoder(), new X12Encoder(), new EdifactEncoder(), new Base256Encoder()};
EncoderContext encoderContext = new EncoderContext(str);
encoderContext.setSymbolShape(symbolShapeHint);
encoderContext.setSizeConstraints(dimension, dimension2);
if (str.startsWith("[)>\u001e05\u001d") && str.endsWith("\u001e\u0004")) {
encoderContext.writeCodeword((char) 236);
encoderContext.setSkipAtEnd(2);
encoderContext.pos += 7;
} else if (str.startsWith("[)>\u001e06\u001d") && str.endsWith("\u001e\u0004")) {
encoderContext.writeCodeword((char) 237);
encoderContext.setSkipAtEnd(2);
encoderContext.pos += 7;
}
while (encoderContext.hasMoreCharacters()) {
encoderArr[i].encode(encoderContext);
if (encoderContext.getNewEncoding() >= 0) {
i = encoderContext.getNewEncoding();
encoderContext.resetEncoderSignal();
}
}
int codewordCount = encoderContext.getCodewordCount();
encoderContext.updateSymbolInfo();
int dataCapacity = encoderContext.getSymbolInfo().getDataCapacity();
if (codewordCount < dataCapacity && i != 0 && i != 5 && i != 4) {
encoderContext.writeCodeword((char) 254);
}
StringBuilder codewords = encoderContext.getCodewords();
if (codewords.length() < dataCapacity) {
codewords.append((char) 129);
}
while (codewords.length() < dataCapacity) {
codewords.append(randomize253State((char) 129, codewords.length() + 1));
}
return encoderContext.getCodewords().toString();
}
public static int lookAheadTest(CharSequence charSequence, int i, int i2) {
float[] fArr;
char c;
if (i >= charSequence.length()) {
return i2;
}
int i3 = 6;
if (i2 == 0) {
fArr = new float[]{0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.25f};
} else {
fArr = new float[]{1.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.25f};
fArr[i2] = 0.0f;
}
int i4 = 0;
while (true) {
int i5 = i + i4;
if (i5 == charSequence.length()) {
byte[] bArr = new byte[i3];
int[] iArr = new int[i3];
int findMinimums = findMinimums(fArr, iArr, Integer.MAX_VALUE, bArr);
int minimumCount = getMinimumCount(bArr);
if (iArr[0] == findMinimums) {
return 0;
}
if (minimumCount == 1 && bArr[5] > 0) {
return 5;
}
if (minimumCount == 1 && bArr[4] > 0) {
return 4;
}
if (minimumCount != 1 || bArr[2] <= 0) {
return (minimumCount != 1 || bArr[3] <= 0) ? 1 : 3;
}
return 2;
}
char charAt = charSequence.charAt(i5);
i4++;
if (isDigit(charAt)) {
fArr[0] = fArr[0] + 0.5f;
} else if (isExtendedASCII(charAt)) {
float ceil = (float) Math.ceil(fArr[0]);
fArr[0] = ceil;
fArr[0] = ceil + 2.0f;
} else {
float ceil2 = (float) Math.ceil(fArr[0]);
fArr[0] = ceil2;
fArr[0] = ceil2 + 1.0f;
}
if (isNativeC40(charAt)) {
fArr[1] = fArr[1] + 0.6666667f;
} else if (isExtendedASCII(charAt)) {
fArr[1] = fArr[1] + 2.6666667f;
} else {
fArr[1] = fArr[1] + 1.3333334f;
}
if (isNativeText(charAt)) {
fArr[2] = fArr[2] + 0.6666667f;
} else if (isExtendedASCII(charAt)) {
fArr[2] = fArr[2] + 2.6666667f;
} else {
fArr[2] = fArr[2] + 1.3333334f;
}
if (isNativeX12(charAt)) {
fArr[3] = fArr[3] + 0.6666667f;
} else if (isExtendedASCII(charAt)) {
fArr[3] = fArr[3] + 4.3333335f;
} else {
fArr[3] = fArr[3] + 3.3333333f;
}
if (isNativeEDIFACT(charAt)) {
fArr[4] = fArr[4] + 0.75f;
} else if (isExtendedASCII(charAt)) {
fArr[4] = fArr[4] + 4.25f;
} else {
fArr[4] = fArr[4] + 3.25f;
}
if (isSpecialB256(charAt)) {
c = 5;
fArr[5] = fArr[5] + 4.0f;
} else {
c = 5;
fArr[5] = fArr[5] + 1.0f;
}
if (i4 >= 4) {
int[] iArr2 = new int[i3];
byte[] bArr2 = new byte[i3];
findMinimums(fArr, iArr2, Integer.MAX_VALUE, bArr2);
int minimumCount2 = getMinimumCount(bArr2);
int i6 = iArr2[0];
int i7 = iArr2[c];
if (i6 < i7 && i6 < iArr2[1] && i6 < iArr2[2] && i6 < iArr2[3] && i6 < iArr2[4]) {
return 0;
}
if (i7 < i6) {
return 5;
}
byte b = bArr2[1];
byte b2 = bArr2[2];
byte b3 = bArr2[3];
byte b4 = bArr2[4];
if (b + b2 + b3 + b4 == 0) {
return 5;
}
if (minimumCount2 == 1 && b4 > 0) {
return 4;
}
if (minimumCount2 == 1 && b2 > 0) {
return 2;
}
if (minimumCount2 == 1 && b3 > 0) {
return 3;
}
int i8 = iArr2[1];
if (i8 + 1 < i6 && i8 + 1 < i7 && i8 + 1 < iArr2[4] && i8 + 1 < iArr2[2]) {
int i9 = iArr2[3];
if (i8 < i9) {
return 1;
}
if (i8 == i9) {
for (int i10 = i + i4 + 1; i10 < charSequence.length(); i10++) {
char charAt2 = charSequence.charAt(i10);
if (isX12TermSep(charAt2)) {
return 3;
}
if (!isNativeX12(charAt2)) {
break;
}
}
return 1;
}
}
}
i3 = 6;
}
}
public static int findMinimums(float[] fArr, int[] iArr, int i, byte[] bArr) {
Arrays.fill(bArr, (byte) 0);
for (int i2 = 0; i2 < 6; i2++) {
int ceil = (int) Math.ceil(fArr[i2]);
iArr[i2] = ceil;
if (i > ceil) {
Arrays.fill(bArr, (byte) 0);
i = ceil;
}
if (i == ceil) {
bArr[i2] = (byte) (bArr[i2] + 1);
}
}
return i;
}
public static int getMinimumCount(byte[] bArr) {
int i = 0;
for (int i2 = 0; i2 < 6; i2++) {
i += bArr[i2];
}
return i;
}
public static boolean isNativeX12(char c) {
if (isX12TermSep(c) || c == ' ') {
return true;
}
if (c < '0' || c > '9') {
return c >= 'A' && c <= 'Z';
}
return true;
}
public static int determineConsecutiveDigitCount(CharSequence charSequence, int i) {
int length = charSequence.length();
int i2 = 0;
if (i < length) {
char charAt = charSequence.charAt(i);
while (isDigit(charAt) && i < length) {
i2++;
i++;
if (i < length) {
charAt = charSequence.charAt(i);
}
}
}
return i2;
}
public static void illegalCharacter(char c) {
String hexString = Integer.toHexString(c);
throw new IllegalArgumentException("Illegal character: " + c + " (0x" + ("0000".substring(0, 4 - hexString.length()) + hexString) + ')');
}
}

View File

@@ -0,0 +1,145 @@
package com.google.zxing.datamatrix.encoder;
import com.google.zxing.Dimension;
import com.ironsource.mediationsdk.utils.IronSourceConstants;
import com.mbridge.msdk.playercommon.exoplayer2.extractor.ts.PsExtractor;
/* loaded from: classes3.dex */
public class SymbolInfo {
public static final SymbolInfo[] PROD_SYMBOLS;
public static SymbolInfo[] symbols;
public final int dataCapacity;
public final int dataRegions;
public final int errorCodewords;
public final int matrixHeight;
public final int matrixWidth;
public final boolean rectangular;
public final int rsBlockData;
public final int rsBlockError;
public final int getDataCapacity() {
return this.dataCapacity;
}
public int getDataLengthForInterleavedBlock(int i) {
return this.rsBlockData;
}
public final int getErrorCodewords() {
return this.errorCodewords;
}
public final int getErrorLengthForInterleavedBlock(int i) {
return this.rsBlockError;
}
static {
SymbolInfo[] symbolInfoArr = {new SymbolInfo(false, 3, 5, 8, 8, 1), new SymbolInfo(false, 5, 7, 10, 10, 1), new SymbolInfo(true, 5, 7, 16, 6, 1), new SymbolInfo(false, 8, 10, 12, 12, 1), new SymbolInfo(true, 10, 11, 14, 6, 2), new SymbolInfo(false, 12, 12, 14, 14, 1), new SymbolInfo(true, 16, 14, 24, 10, 1), new SymbolInfo(false, 18, 14, 16, 16, 1), new SymbolInfo(false, 22, 18, 18, 18, 1), new SymbolInfo(true, 22, 18, 16, 10, 2), new SymbolInfo(false, 30, 20, 20, 20, 1), new SymbolInfo(true, 32, 24, 16, 14, 2), new SymbolInfo(false, 36, 24, 22, 22, 1), new SymbolInfo(false, 44, 28, 24, 24, 1), new SymbolInfo(true, 49, 28, 22, 14, 2), new SymbolInfo(false, 62, 36, 14, 14, 4), new SymbolInfo(false, 86, 42, 16, 16, 4), new SymbolInfo(false, 114, 48, 18, 18, 4), new SymbolInfo(false, 144, 56, 20, 20, 4), new SymbolInfo(false, 174, 68, 22, 22, 4), new SymbolInfo(false, 204, 84, 24, 24, 4, 102, 42), new SymbolInfo(false, 280, 112, 14, 14, 16, IronSourceConstants.USING_CACHE_FOR_INIT_EVENT, 56), new SymbolInfo(false, 368, 144, 16, 16, 16, 92, 36), new SymbolInfo(false, 456, PsExtractor.AUDIO_STREAM, 18, 18, 16, 114, 48), new SymbolInfo(false, 576, 224, 20, 20, 16, 144, 56), new SymbolInfo(false, 696, 272, 22, 22, 16, 174, 68), new SymbolInfo(false, 816, 336, 24, 24, 16, 136, 56), new SymbolInfo(false, 1050, 408, 18, 18, 36, 175, 68), new SymbolInfo(false, 1304, 496, 20, 20, 36, 163, 62), new DataMatrixSymbolInfo144()};
PROD_SYMBOLS = symbolInfoArr;
symbols = symbolInfoArr;
}
public SymbolInfo(boolean z, int i, int i2, int i3, int i4, int i5) {
this(z, i, i2, i3, i4, i5, i, i2);
}
public SymbolInfo(boolean z, int i, int i2, int i3, int i4, int i5, int i6, int i7) {
this.rectangular = z;
this.dataCapacity = i;
this.errorCodewords = i2;
this.matrixWidth = i3;
this.matrixHeight = i4;
this.dataRegions = i5;
this.rsBlockData = i6;
this.rsBlockError = i7;
}
public static SymbolInfo lookup(int i, SymbolShapeHint symbolShapeHint, Dimension dimension, Dimension dimension2, boolean z) {
for (SymbolInfo symbolInfo : symbols) {
if (!(symbolShapeHint == SymbolShapeHint.FORCE_SQUARE && symbolInfo.rectangular) && ((symbolShapeHint != SymbolShapeHint.FORCE_RECTANGLE || symbolInfo.rectangular) && i <= symbolInfo.dataCapacity)) {
return symbolInfo;
}
}
if (z) {
throw new IllegalArgumentException("Can't find a symbol arrangement that matches the message. Data codewords: ".concat(String.valueOf(i)));
}
return null;
}
public final int getHorizontalDataRegions() {
int i = this.dataRegions;
int i2 = 1;
if (i != 1) {
i2 = 2;
if (i != 2 && i != 4) {
if (i == 16) {
return 4;
}
if (i == 36) {
return 6;
}
throw new IllegalStateException("Cannot handle this number of data regions");
}
}
return i2;
}
public final int getVerticalDataRegions() {
int i = this.dataRegions;
if (i == 1 || i == 2) {
return 1;
}
if (i == 4) {
return 2;
}
if (i == 16) {
return 4;
}
if (i == 36) {
return 6;
}
throw new IllegalStateException("Cannot handle this number of data regions");
}
public final int getSymbolDataWidth() {
return getHorizontalDataRegions() * this.matrixWidth;
}
public final int getSymbolDataHeight() {
return getVerticalDataRegions() * this.matrixHeight;
}
public final int getSymbolWidth() {
return getSymbolDataWidth() + (getHorizontalDataRegions() << 1);
}
public final int getSymbolHeight() {
return getSymbolDataHeight() + (getVerticalDataRegions() << 1);
}
public int getInterleavedBlockCount() {
return this.dataCapacity / this.rsBlockData;
}
public final String toString() {
StringBuilder sb = new StringBuilder();
sb.append(this.rectangular ? "Rectangular Symbol:" : "Square Symbol:");
sb.append(" data region ");
sb.append(this.matrixWidth);
sb.append('x');
sb.append(this.matrixHeight);
sb.append(", symbol size ");
sb.append(getSymbolWidth());
sb.append('x');
sb.append(getSymbolHeight());
sb.append(", symbol data size ");
sb.append(getSymbolDataWidth());
sb.append('x');
sb.append(getSymbolDataHeight());
sb.append(", codewords ");
sb.append(this.dataCapacity);
sb.append('+');
sb.append(this.errorCodewords);
return sb.toString();
}
}

View File

@@ -0,0 +1,8 @@
package com.google.zxing.datamatrix.encoder;
/* loaded from: classes3.dex */
public enum SymbolShapeHint {
FORCE_NONE,
FORCE_SQUARE,
FORCE_RECTANGLE
}

View File

@@ -0,0 +1,62 @@
package com.google.zxing.datamatrix.encoder;
/* loaded from: classes3.dex */
public final class TextEncoder extends C40Encoder {
@Override // com.google.zxing.datamatrix.encoder.C40Encoder
public int getEncodingMode() {
return 2;
}
@Override // com.google.zxing.datamatrix.encoder.C40Encoder
public int encodeChar(char c, StringBuilder sb) {
if (c == ' ') {
sb.append((char) 3);
return 1;
}
if (c >= '0' && c <= '9') {
sb.append((char) (c - ','));
return 1;
}
if (c >= 'a' && c <= 'z') {
sb.append((char) (c - 'S'));
return 1;
}
if (c < ' ') {
sb.append((char) 0);
sb.append(c);
return 2;
}
if (c >= '!' && c <= '/') {
sb.append((char) 1);
sb.append((char) (c - '!'));
return 2;
}
if (c >= ':' && c <= '@') {
sb.append((char) 1);
sb.append((char) (c - '+'));
return 2;
}
if (c >= '[' && c <= '_') {
sb.append((char) 1);
sb.append((char) (c - 'E'));
return 2;
}
if (c == '`') {
sb.append((char) 2);
sb.append((char) (c - '`'));
return 2;
}
if (c >= 'A' && c <= 'Z') {
sb.append((char) 2);
sb.append((char) (c - '@'));
return 2;
}
if (c >= '{' && c <= 127) {
sb.append((char) 2);
sb.append((char) (c - '`'));
return 2;
}
sb.append("\u0001\u001e");
return encodeChar((char) (c - 128), sb) + 2;
}
}

View File

@@ -0,0 +1,63 @@
package com.google.zxing.datamatrix.encoder;
/* loaded from: classes3.dex */
public final class X12Encoder extends C40Encoder {
@Override // com.google.zxing.datamatrix.encoder.C40Encoder
public int getEncodingMode() {
return 3;
}
@Override // com.google.zxing.datamatrix.encoder.C40Encoder, com.google.zxing.datamatrix.encoder.Encoder
public void encode(EncoderContext encoderContext) {
StringBuilder sb = new StringBuilder();
while (true) {
if (!encoderContext.hasMoreCharacters()) {
break;
}
char currentChar = encoderContext.getCurrentChar();
encoderContext.pos++;
encodeChar(currentChar, sb);
if (sb.length() % 3 == 0) {
C40Encoder.writeNextTriplet(encoderContext, sb);
if (HighLevelEncoder.lookAheadTest(encoderContext.getMessage(), encoderContext.pos, getEncodingMode()) != getEncodingMode()) {
encoderContext.signalEncoderChange(0);
break;
}
}
}
handleEOD(encoderContext, sb);
}
@Override // com.google.zxing.datamatrix.encoder.C40Encoder
public int encodeChar(char c, StringBuilder sb) {
if (c == '\r') {
sb.append((char) 0);
} else if (c == ' ') {
sb.append((char) 3);
} else if (c == '*') {
sb.append((char) 1);
} else if (c == '>') {
sb.append((char) 2);
} else if (c >= '0' && c <= '9') {
sb.append((char) (c - ','));
} else if (c >= 'A' && c <= 'Z') {
sb.append((char) (c - '3'));
} else {
HighLevelEncoder.illegalCharacter(c);
}
return 1;
}
@Override // com.google.zxing.datamatrix.encoder.C40Encoder
public void handleEOD(EncoderContext encoderContext, StringBuilder sb) {
encoderContext.updateSymbolInfo();
int dataCapacity = encoderContext.getSymbolInfo().getDataCapacity() - encoderContext.getCodewordCount();
encoderContext.pos -= sb.length();
if (encoderContext.getRemainingCharacters() > 1 || dataCapacity > 1 || encoderContext.getRemainingCharacters() != dataCapacity) {
encoderContext.writeCodeword((char) 254);
}
if (encoderContext.getNewEncoding() < 0) {
encoderContext.signalEncoderChange(0);
}
}
}

View File

@@ -0,0 +1,19 @@
package com.google.zxing.oned;
/* loaded from: classes3.dex */
public abstract class CodaBarReader extends OneDReader {
public static final char[] ALPHABET = "0123456789-$:/.+ABCD".toCharArray();
public static final int[] CHARACTER_ENCODINGS = {3, 6, 9, 96, 18, 66, 33, 36, 48, 72, 12, 24, 69, 81, 84, 21, 26, 41, 11, 14};
public static final char[] STARTEND_ENCODING = {'A', 'B', 'C', 'D'};
public static boolean arrayContains(char[] cArr, char c) {
if (cArr != null) {
for (char c2 : cArr) {
if (c2 == c) {
return true;
}
}
}
return false;
}
}

View File

@@ -0,0 +1,113 @@
package com.google.zxing.oned;
/* loaded from: classes3.dex */
public final class CodaBarWriter extends OneDimensionalCodeWriter {
public static final char[] ALT_START_END_CHARS = {'T', 'N', '*', 'E'};
public static final char[] CHARS_WHICH_ARE_TEN_LENGTH_EACH_AFTER_DECODED = {'/', ':', '+', '.'};
public static final char DEFAULT_GUARD;
public static final char[] START_END_CHARS;
static {
char[] cArr = {'A', 'B', 'C', 'D'};
START_END_CHARS = cArr;
DEFAULT_GUARD = cArr[0];
}
@Override // com.google.zxing.oned.OneDimensionalCodeWriter
public boolean[] encode(String str) {
int i;
if (str.length() < 2) {
StringBuilder sb = new StringBuilder();
char c = DEFAULT_GUARD;
sb.append(c);
sb.append(str);
sb.append(c);
str = sb.toString();
} else {
char upperCase = Character.toUpperCase(str.charAt(0));
char upperCase2 = Character.toUpperCase(str.charAt(str.length() - 1));
char[] cArr = START_END_CHARS;
boolean arrayContains = CodaBarReader.arrayContains(cArr, upperCase);
boolean arrayContains2 = CodaBarReader.arrayContains(cArr, upperCase2);
char[] cArr2 = ALT_START_END_CHARS;
boolean arrayContains3 = CodaBarReader.arrayContains(cArr2, upperCase);
boolean arrayContains4 = CodaBarReader.arrayContains(cArr2, upperCase2);
if (arrayContains) {
if (!arrayContains2) {
throw new IllegalArgumentException("Invalid start/end guards: ".concat(str));
}
} else if (!arrayContains3) {
if (arrayContains2 || arrayContains4) {
throw new IllegalArgumentException("Invalid start/end guards: ".concat(str));
}
StringBuilder sb2 = new StringBuilder();
char c2 = DEFAULT_GUARD;
sb2.append(c2);
sb2.append(str);
sb2.append(c2);
str = sb2.toString();
} else if (!arrayContains4) {
throw new IllegalArgumentException("Invalid start/end guards: ".concat(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 (!CodaBarReader.arrayContains(CHARS_WHICH_ARE_TEN_LENGTH_EACH_AFTER_DECODED, str.charAt(i3))) {
throw new IllegalArgumentException("Cannot encode : '" + str.charAt(i3) + '\'');
}
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) {
char[] cArr3 = CodaBarReader.ALPHABET;
if (i6 >= cArr3.length) {
i = 0;
break;
}
if (upperCase3 == cArr3[i6]) {
i = CodaBarReader.CHARACTER_ENCODINGS[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;
}
}

View File

@@ -0,0 +1,6 @@
package com.google.zxing.oned;
/* loaded from: classes3.dex */
public abstract class Code128Reader extends OneDReader {
public static final int[][] CODE_PATTERNS = {new int[]{2, 1, 2, 2, 2, 2}, new int[]{2, 2, 2, 1, 2, 2}, new int[]{2, 2, 2, 2, 2, 1}, new int[]{1, 2, 1, 2, 2, 3}, new int[]{1, 2, 1, 3, 2, 2}, new int[]{1, 3, 1, 2, 2, 2}, new int[]{1, 2, 2, 2, 1, 3}, new int[]{1, 2, 2, 3, 1, 2}, new int[]{1, 3, 2, 2, 1, 2}, new int[]{2, 2, 1, 2, 1, 3}, new int[]{2, 2, 1, 3, 1, 2}, new int[]{2, 3, 1, 2, 1, 2}, new int[]{1, 1, 2, 2, 3, 2}, new int[]{1, 2, 2, 1, 3, 2}, new int[]{1, 2, 2, 2, 3, 1}, new int[]{1, 1, 3, 2, 2, 2}, new int[]{1, 2, 3, 1, 2, 2}, new int[]{1, 2, 3, 2, 2, 1}, new int[]{2, 2, 3, 2, 1, 1}, new int[]{2, 2, 1, 1, 3, 2}, new int[]{2, 2, 1, 2, 3, 1}, new int[]{2, 1, 3, 2, 1, 2}, new int[]{2, 2, 3, 1, 1, 2}, new int[]{3, 1, 2, 1, 3, 1}, new int[]{3, 1, 1, 2, 2, 2}, new int[]{3, 2, 1, 1, 2, 2}, new int[]{3, 2, 1, 2, 2, 1}, new int[]{3, 1, 2, 2, 1, 2}, new int[]{3, 2, 2, 1, 1, 2}, new int[]{3, 2, 2, 2, 1, 1}, new int[]{2, 1, 2, 1, 2, 3}, new int[]{2, 1, 2, 3, 2, 1}, new int[]{2, 3, 2, 1, 2, 1}, new int[]{1, 1, 1, 3, 2, 3}, new int[]{1, 3, 1, 1, 2, 3}, new int[]{1, 3, 1, 3, 2, 1}, new int[]{1, 1, 2, 3, 1, 3}, new int[]{1, 3, 2, 1, 1, 3}, new int[]{1, 3, 2, 3, 1, 1}, new int[]{2, 1, 1, 3, 1, 3}, new int[]{2, 3, 1, 1, 1, 3}, new int[]{2, 3, 1, 3, 1, 1}, new int[]{1, 1, 2, 1, 3, 3}, new int[]{1, 1, 2, 3, 3, 1}, new int[]{1, 3, 2, 1, 3, 1}, new int[]{1, 1, 3, 1, 2, 3}, new int[]{1, 1, 3, 3, 2, 1}, new int[]{1, 3, 3, 1, 2, 1}, new int[]{3, 1, 3, 1, 2, 1}, new int[]{2, 1, 1, 3, 3, 1}, new int[]{2, 3, 1, 1, 3, 1}, new int[]{2, 1, 3, 1, 1, 3}, new int[]{2, 1, 3, 3, 1, 1}, new int[]{2, 1, 3, 1, 3, 1}, new int[]{3, 1, 1, 1, 2, 3}, new int[]{3, 1, 1, 3, 2, 1}, new int[]{3, 3, 1, 1, 2, 1}, new int[]{3, 1, 2, 1, 1, 3}, new int[]{3, 1, 2, 3, 1, 1}, new int[]{3, 3, 2, 1, 1, 1}, new int[]{3, 1, 4, 1, 1, 1}, new int[]{2, 2, 1, 4, 1, 1}, new int[]{4, 3, 1, 1, 1, 1}, new int[]{1, 1, 1, 2, 2, 4}, new int[]{1, 1, 1, 4, 2, 2}, new int[]{1, 2, 1, 1, 2, 4}, new int[]{1, 2, 1, 4, 2, 1}, new int[]{1, 4, 1, 1, 2, 2}, new int[]{1, 4, 1, 2, 2, 1}, new int[]{1, 1, 2, 2, 1, 4}, new int[]{1, 1, 2, 4, 1, 2}, new int[]{1, 2, 2, 1, 1, 4}, new int[]{1, 2, 2, 4, 1, 1}, new int[]{1, 4, 2, 1, 1, 2}, new int[]{1, 4, 2, 2, 1, 1}, new int[]{2, 4, 1, 2, 1, 1}, new int[]{2, 2, 1, 1, 1, 4}, new int[]{4, 1, 3, 1, 1, 1}, new int[]{2, 4, 1, 1, 1, 2}, new int[]{1, 3, 4, 1, 1, 1}, new int[]{1, 1, 1, 2, 4, 2}, new int[]{1, 2, 1, 1, 4, 2}, new int[]{1, 2, 1, 2, 4, 1}, new int[]{1, 1, 4, 2, 1, 2}, new int[]{1, 2, 4, 1, 1, 2}, new int[]{1, 2, 4, 2, 1, 1}, new int[]{4, 1, 1, 2, 1, 2}, new int[]{4, 2, 1, 1, 1, 2}, new int[]{4, 2, 1, 2, 1, 1}, new int[]{2, 1, 2, 1, 4, 1}, new int[]{2, 1, 4, 1, 2, 1}, new int[]{4, 1, 2, 1, 2, 1}, new int[]{1, 1, 1, 1, 4, 3}, new int[]{1, 1, 1, 3, 4, 1}, new int[]{1, 3, 1, 1, 4, 1}, new int[]{1, 1, 4, 1, 1, 3}, new int[]{1, 1, 4, 3, 1, 1}, new int[]{4, 1, 1, 1, 1, 3}, new int[]{4, 1, 1, 3, 1, 1}, new int[]{1, 1, 3, 1, 4, 1}, new int[]{1, 1, 4, 1, 3, 1}, new int[]{3, 1, 1, 1, 4, 1}, new int[]{4, 1, 1, 1, 3, 1}, new int[]{2, 1, 1, 4, 1, 2}, new int[]{2, 1, 1, 2, 1, 4}, new int[]{2, 1, 1, 2, 3, 2}, new int[]{2, 3, 3, 1, 1, 1, 2}};
}

View File

@@ -0,0 +1,195 @@
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.common.BitMatrix;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
/* loaded from: classes3.dex */
public final class Code128Writer extends OneDimensionalCodeWriter {
public enum CType {
UNCODABLE,
ONE_DIGIT,
TWO_DIGITS,
FNC_1
}
@Override // com.google.zxing.oned.OneDimensionalCodeWriter, com.google.zxing.Writer
public BitMatrix encode(String str, BarcodeFormat barcodeFormat, int i, int i2, Map map) {
if (barcodeFormat != BarcodeFormat.CODE_128) {
throw new IllegalArgumentException("Can only encode CODE_128, but got ".concat(String.valueOf(barcodeFormat)));
}
return super.encode(str, barcodeFormat, i, i2, map);
}
@Override // com.google.zxing.oned.OneDimensionalCodeWriter
public boolean[] encode(String str) {
int length = str.length();
if (length <= 0 || length > 80) {
throw new IllegalArgumentException("Contents length should be between 1 and 80 characters, but got ".concat(String.valueOf(length)));
}
int i = 0;
for (int i2 = 0; i2 < length; i2++) {
char charAt = str.charAt(i2);
switch (charAt) {
case 241:
case 242:
case 243:
case 244:
break;
default:
if (charAt > 127) {
throw new IllegalArgumentException("Bad character in input: ".concat(String.valueOf(charAt)));
}
break;
}
}
ArrayList<int[]> arrayList = new ArrayList();
int i3 = 0;
int i4 = 0;
int i5 = 0;
int i6 = 1;
while (true) {
int i7 = 103;
if (i3 < length) {
int chooseCode = chooseCode(str, i3, i5);
int i8 = 100;
if (chooseCode == i5) {
switch (str.charAt(i3)) {
case 241:
i8 = 102;
break;
case 242:
i8 = 97;
break;
case 243:
i8 = 96;
break;
case 244:
if (i5 == 101) {
i8 = 101;
break;
}
break;
default:
if (i5 != 100) {
if (i5 == 101) {
char charAt2 = str.charAt(i3);
i8 = charAt2 - ' ';
if (i8 < 0) {
i8 = charAt2 + '@';
break;
}
} else {
i8 = Integer.parseInt(str.substring(i3, i3 + 2));
i3++;
break;
}
} else {
i8 = str.charAt(i3) - ' ';
break;
}
break;
}
i3++;
} else {
if (i5 != 0) {
i7 = chooseCode;
} else if (chooseCode == 100) {
i7 = 104;
} else if (chooseCode != 101) {
i7 = 105;
}
i8 = i7;
i5 = chooseCode;
}
arrayList.add(Code128Reader.CODE_PATTERNS[i8]);
i4 += i8 * i6;
if (i3 != 0) {
i6++;
}
} else {
int[][] iArr = Code128Reader.CODE_PATTERNS;
arrayList.add(iArr[i4 % 103]);
arrayList.add(iArr[106]);
int i9 = 0;
for (int[] iArr2 : arrayList) {
for (int i10 : iArr2) {
i9 += i10;
}
}
boolean[] zArr = new boolean[i9];
Iterator it = arrayList.iterator();
while (it.hasNext()) {
i += OneDimensionalCodeWriter.appendPattern(zArr, i, (int[]) it.next(), true);
}
return zArr;
}
}
}
public static CType findCType(CharSequence charSequence, int i) {
int length = charSequence.length();
if (i >= length) {
return CType.UNCODABLE;
}
char charAt = charSequence.charAt(i);
if (charAt == 241) {
return CType.FNC_1;
}
if (charAt < '0' || charAt > '9') {
return CType.UNCODABLE;
}
int i2 = i + 1;
if (i2 >= length) {
return CType.ONE_DIGIT;
}
char charAt2 = charSequence.charAt(i2);
if (charAt2 < '0' || charAt2 > '9') {
return CType.ONE_DIGIT;
}
return CType.TWO_DIGITS;
}
public static int chooseCode(CharSequence charSequence, int i, int i2) {
CType findCType;
CType findCType2;
char charAt;
CType findCType3 = findCType(charSequence, i);
CType cType = CType.ONE_DIGIT;
if (findCType3 == cType) {
return 100;
}
CType cType2 = CType.UNCODABLE;
if (findCType3 == cType2) {
return (i >= charSequence.length() || ((charAt = charSequence.charAt(i)) >= ' ' && (i2 != 101 || charAt >= '`'))) ? 100 : 101;
}
if (i2 == 99) {
return 99;
}
if (i2 == 100) {
CType cType3 = CType.FNC_1;
if (findCType3 == cType3 || (findCType = findCType(charSequence, i + 2)) == cType2 || findCType == cType) {
return 100;
}
if (findCType == cType3) {
return findCType(charSequence, i + 3) == CType.TWO_DIGITS ? 99 : 100;
}
int i3 = i + 4;
while (true) {
findCType2 = findCType(charSequence, i3);
if (findCType2 != CType.TWO_DIGITS) {
break;
}
i3 += 2;
}
return findCType2 == CType.ONE_DIGIT ? 100 : 99;
}
if (findCType3 == CType.FNC_1) {
findCType3 = findCType(charSequence, i + 1);
}
return findCType3 == CType.TWO_DIGITS ? 99 : 100;
}
}

View File

@@ -0,0 +1,6 @@
package com.google.zxing.oned;
/* loaded from: classes3.dex */
public abstract class Code39Reader extends OneDReader {
public static final int[] CHARACTER_ENCODINGS = {52, 289, 97, 352, 49, 304, 112, 37, 292, 100, 265, 73, 328, 25, 280, 88, 13, 268, 76, 28, 259, 67, 322, 19, 274, 82, 7, 262, 70, 22, 385, 193, 448, 145, 400, 208, 133, 388, 196, 168, 162, 138, 42};
}

View File

@@ -0,0 +1,120 @@
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.common.BitMatrix;
import java.util.Map;
/* loaded from: classes3.dex */
public final class Code39Writer extends OneDimensionalCodeWriter {
@Override // com.google.zxing.oned.OneDimensionalCodeWriter, com.google.zxing.Writer
public BitMatrix encode(String str, BarcodeFormat barcodeFormat, int i, int i2, Map map) {
if (barcodeFormat != BarcodeFormat.CODE_39) {
throw new IllegalArgumentException("Can only encode CODE_39, but got ".concat(String.valueOf(barcodeFormat)));
}
return super.encode(str, barcodeFormat, i, i2, map);
}
@Override // com.google.zxing.oned.OneDimensionalCodeWriter
public boolean[] encode(String str) {
int length = str.length();
if (length > 80) {
throw new IllegalArgumentException("Requested contents should be less than 80 digits long, but got ".concat(String.valueOf(length)));
}
int i = 0;
while (true) {
if (i >= length) {
break;
}
if ("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%".indexOf(str.charAt(i)) < 0) {
str = tryToConvertToExtendedMode(str);
length = str.length();
if (length > 80) {
throw new IllegalArgumentException("Requested contents should be less than 80 digits long, but got " + length + " (extended full ASCII mode)");
}
} else {
i++;
}
}
int[] iArr = new int[9];
int i2 = length + 25;
for (int i3 = 0; i3 < length; i3++) {
toIntArray(Code39Reader.CHARACTER_ENCODINGS["0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%".indexOf(str.charAt(i3))], iArr);
for (int i4 = 0; i4 < 9; i4++) {
i2 += iArr[i4];
}
}
boolean[] zArr = new boolean[i2];
toIntArray(148, iArr);
int appendPattern = OneDimensionalCodeWriter.appendPattern(zArr, 0, iArr, true);
int[] iArr2 = {1};
int appendPattern2 = appendPattern + OneDimensionalCodeWriter.appendPattern(zArr, appendPattern, iArr2, false);
for (int i5 = 0; i5 < length; i5++) {
toIntArray(Code39Reader.CHARACTER_ENCODINGS["0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%".indexOf(str.charAt(i5))], iArr);
int appendPattern3 = appendPattern2 + OneDimensionalCodeWriter.appendPattern(zArr, appendPattern2, iArr, true);
appendPattern2 = appendPattern3 + OneDimensionalCodeWriter.appendPattern(zArr, appendPattern3, iArr2, false);
}
toIntArray(148, iArr);
OneDimensionalCodeWriter.appendPattern(zArr, appendPattern2, iArr, true);
return zArr;
}
public static void toIntArray(int i, int[] iArr) {
for (int i2 = 0; i2 < 9; i2++) {
int i3 = 1;
if (((1 << (8 - i2)) & i) != 0) {
i3 = 2;
}
iArr[i2] = i3;
}
}
public static String tryToConvertToExtendedMode(String str) {
int length = str.length();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < length; i++) {
char charAt = str.charAt(i);
if (charAt == 0) {
sb.append("%U");
} else {
if (charAt != ' ') {
if (charAt == '@') {
sb.append("%V");
} else if (charAt == '`') {
sb.append("%W");
} else if (charAt != '-' && charAt != '.') {
if (charAt <= 26) {
sb.append('$');
sb.append((char) (charAt + '@'));
} else if (charAt < ' ') {
sb.append('%');
sb.append((char) (charAt + '&'));
} else if (charAt <= ',' || charAt == '/' || charAt == ':') {
sb.append('/');
sb.append((char) (charAt + ' '));
} else if (charAt <= '9') {
sb.append(charAt);
} else if (charAt <= '?') {
sb.append('%');
sb.append((char) (charAt + 11));
} else if (charAt <= 'Z') {
sb.append(charAt);
} else if (charAt <= '_') {
sb.append('%');
sb.append((char) (charAt - 16));
} else if (charAt <= 'z') {
sb.append('+');
sb.append((char) (charAt - ' '));
} else if (charAt <= 127) {
sb.append('%');
sb.append((char) (charAt - '+'));
} else {
throw new IllegalArgumentException("Requested content contains a non-encodable character: '" + str.charAt(i) + "'");
}
}
}
sb.append(charAt);
}
}
return sb.toString();
}
}

View File

@@ -0,0 +1,17 @@
package com.google.zxing.oned;
import com.facebook.internal.FacebookRequestErrorClassification;
import org.apache.http.HttpStatus;
/* loaded from: classes3.dex */
public abstract class Code93Reader extends OneDReader {
public static final char[] ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*".toCharArray();
public static final int ASTERISK_ENCODING;
public static final int[] CHARACTER_ENCODINGS;
static {
int[] iArr = {276, 328, 324, 322, 296, 292, 290, 336, 274, 266, HttpStatus.SC_FAILED_DEPENDENCY, HttpStatus.SC_METHOD_FAILURE, 418, 404, 402, 394, 360, 356, 354, 308, 282, 344, 332, 326, 300, 278, 436, 434, 428, HttpStatus.SC_UNPROCESSABLE_ENTITY, 406, 410, 364, 358, 310, 314, 302, 468, 466, FacebookRequestErrorClassification.ESC_APP_NOT_INSTALLED, 366, 374, 430, 294, 474, 470, 306, 350};
CHARACTER_ENCODINGS = iArr;
ASTERISK_ENCODING = iArr[47];
}
}

View File

@@ -0,0 +1,77 @@
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.common.BitMatrix;
import java.util.Map;
/* loaded from: classes3.dex */
public class Code93Writer extends OneDimensionalCodeWriter {
@Override // com.google.zxing.oned.OneDimensionalCodeWriter, com.google.zxing.Writer
public BitMatrix encode(String str, BarcodeFormat barcodeFormat, int i, int i2, Map map) {
if (barcodeFormat != BarcodeFormat.CODE_93) {
throw new IllegalArgumentException("Can only encode CODE_93, but got ".concat(String.valueOf(barcodeFormat)));
}
return super.encode(str, barcodeFormat, i, i2, map);
}
@Override // com.google.zxing.oned.OneDimensionalCodeWriter
public boolean[] encode(String str) {
int length = str.length();
if (length > 80) {
throw new IllegalArgumentException("Requested contents should be less than 80 digits long, but got ".concat(String.valueOf(length)));
}
int[] iArr = new int[9];
int length2 = ((str.length() + 4) * 9) + 1;
toIntArray(Code93Reader.CHARACTER_ENCODINGS[47], iArr);
boolean[] zArr = new boolean[length2];
int appendPattern = appendPattern(zArr, 0, iArr);
for (int i = 0; i < length; i++) {
toIntArray(Code93Reader.CHARACTER_ENCODINGS["0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*".indexOf(str.charAt(i))], iArr);
appendPattern += appendPattern(zArr, appendPattern, iArr);
}
int computeChecksumIndex = computeChecksumIndex(str, 20);
int[] iArr2 = Code93Reader.CHARACTER_ENCODINGS;
toIntArray(iArr2[computeChecksumIndex], iArr);
int appendPattern2 = appendPattern + appendPattern(zArr, appendPattern, iArr);
toIntArray(iArr2[computeChecksumIndex(str + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*".charAt(computeChecksumIndex), 15)], iArr);
int appendPattern3 = appendPattern2 + appendPattern(zArr, appendPattern2, iArr);
toIntArray(iArr2[47], iArr);
zArr[appendPattern3 + appendPattern(zArr, appendPattern3, iArr)] = true;
return zArr;
}
private static void toIntArray(int i, int[] iArr) {
for (int i2 = 0; i2 < 9; i2++) {
int i3 = 1;
if (((1 << (8 - i2)) & i) == 0) {
i3 = 0;
}
iArr[i2] = i3;
}
}
public static int appendPattern(boolean[] zArr, int i, int[] iArr) {
int length = iArr.length;
int i2 = 0;
while (i2 < length) {
int i3 = i + 1;
zArr[i] = iArr[i2] != 0;
i2++;
i = i3;
}
return 9;
}
public static int computeChecksumIndex(String str, int i) {
int i2 = 0;
int i3 = 1;
for (int length = str.length() - 1; length >= 0; length--) {
i2 += "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*".indexOf(str.charAt(length)) * i3;
i3++;
if (i3 > i) {
i3 = 1;
}
}
return i2 % 47;
}
}

View File

@@ -0,0 +1,6 @@
package com.google.zxing.oned;
/* loaded from: classes3.dex */
public abstract class EAN13Reader extends UPCEANReader {
public static final int[] FIRST_DIGIT_ENCODINGS = {0, 11, 13, 14, 19, 25, 28, 21, 22, 26};
}

View File

@@ -0,0 +1,55 @@
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.FormatException;
import com.google.zxing.common.BitMatrix;
import java.util.Map;
/* loaded from: classes3.dex */
public final class EAN13Writer extends UPCEANWriter {
@Override // com.google.zxing.oned.OneDimensionalCodeWriter, com.google.zxing.Writer
public BitMatrix encode(String str, BarcodeFormat barcodeFormat, int i, int i2, Map map) {
if (barcodeFormat != BarcodeFormat.EAN_13) {
throw new IllegalArgumentException("Can only encode EAN_13, but got ".concat(String.valueOf(barcodeFormat)));
}
return super.encode(str, barcodeFormat, i, i2, map);
}
@Override // com.google.zxing.oned.OneDimensionalCodeWriter
public boolean[] encode(String str) {
int length = str.length();
if (length == 12) {
try {
str = str + UPCEANReader.getStandardUPCEANChecksum(str);
} catch (FormatException e) {
throw new IllegalArgumentException(e);
}
} else if (length == 13) {
try {
if (!UPCEANReader.checkStandardUPCEANChecksum(str)) {
throw new IllegalArgumentException("Contents do not pass checksum");
}
} catch (FormatException unused) {
throw new IllegalArgumentException("Illegal contents");
}
} else {
throw new IllegalArgumentException("Requested contents should be 12 or 13 digits long, but got ".concat(String.valueOf(length)));
}
int i = EAN13Reader.FIRST_DIGIT_ENCODINGS[Character.digit(str.charAt(0), 10)];
boolean[] zArr = new boolean[95];
int appendPattern = OneDimensionalCodeWriter.appendPattern(zArr, 0, UPCEANReader.START_END_PATTERN, true);
for (int i2 = 1; i2 <= 6; i2++) {
int digit = Character.digit(str.charAt(i2), 10);
if (((i >> (6 - i2)) & 1) == 1) {
digit += 10;
}
appendPattern += OneDimensionalCodeWriter.appendPattern(zArr, appendPattern, UPCEANReader.L_AND_G_PATTERNS[digit], false);
}
int appendPattern2 = appendPattern + OneDimensionalCodeWriter.appendPattern(zArr, appendPattern, UPCEANReader.MIDDLE_PATTERN, false);
for (int i3 = 7; i3 <= 12; i3++) {
appendPattern2 += OneDimensionalCodeWriter.appendPattern(zArr, appendPattern2, UPCEANReader.L_PATTERNS[Character.digit(str.charAt(i3), 10)], true);
}
OneDimensionalCodeWriter.appendPattern(zArr, appendPattern2, UPCEANReader.START_END_PATTERN, true);
return zArr;
}
}

View File

@@ -0,0 +1,50 @@
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.FormatException;
import com.google.zxing.common.BitMatrix;
import java.util.Map;
/* loaded from: classes3.dex */
public final class EAN8Writer extends UPCEANWriter {
@Override // com.google.zxing.oned.OneDimensionalCodeWriter, com.google.zxing.Writer
public BitMatrix encode(String str, BarcodeFormat barcodeFormat, int i, int i2, Map map) {
if (barcodeFormat != BarcodeFormat.EAN_8) {
throw new IllegalArgumentException("Can only encode EAN_8, but got ".concat(String.valueOf(barcodeFormat)));
}
return super.encode(str, barcodeFormat, i, i2, map);
}
@Override // com.google.zxing.oned.OneDimensionalCodeWriter
public boolean[] encode(String str) {
int length = str.length();
if (length == 7) {
try {
str = str + UPCEANReader.getStandardUPCEANChecksum(str);
} catch (FormatException e) {
throw new IllegalArgumentException(e);
}
} else if (length == 8) {
try {
if (!UPCEANReader.checkStandardUPCEANChecksum(str)) {
throw new IllegalArgumentException("Contents do not pass checksum");
}
} catch (FormatException unused) {
throw new IllegalArgumentException("Illegal contents");
}
} else {
throw new IllegalArgumentException("Requested contents should be 8 digits long, but got ".concat(String.valueOf(length)));
}
boolean[] zArr = new boolean[67];
int appendPattern = OneDimensionalCodeWriter.appendPattern(zArr, 0, UPCEANReader.START_END_PATTERN, true);
for (int i = 0; i <= 3; i++) {
appendPattern += OneDimensionalCodeWriter.appendPattern(zArr, appendPattern, UPCEANReader.L_PATTERNS[Character.digit(str.charAt(i), 10)], false);
}
int appendPattern2 = appendPattern + OneDimensionalCodeWriter.appendPattern(zArr, appendPattern, UPCEANReader.MIDDLE_PATTERN, false);
for (int i2 = 4; i2 <= 7; i2++) {
appendPattern2 += OneDimensionalCodeWriter.appendPattern(zArr, appendPattern2, UPCEANReader.L_PATTERNS[Character.digit(str.charAt(i2), 10)], true);
}
OneDimensionalCodeWriter.appendPattern(zArr, appendPattern2, UPCEANReader.START_END_PATTERN, true);
return zArr;
}
}

View File

@@ -0,0 +1,47 @@
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.common.BitMatrix;
import java.util.Map;
/* loaded from: classes3.dex */
public final class ITFWriter extends OneDimensionalCodeWriter {
public static final int[] START_PATTERN = {1, 1, 1, 1};
public static final int[] END_PATTERN = {3, 1, 1};
public static final int[][] PATTERNS = {new int[]{1, 1, 3, 3, 1}, new int[]{3, 1, 1, 1, 3}, new int[]{1, 3, 1, 1, 3}, new int[]{3, 3, 1, 1, 1}, new int[]{1, 1, 3, 1, 3}, new int[]{3, 1, 3, 1, 1}, new int[]{1, 3, 3, 1, 1}, new int[]{1, 1, 1, 3, 3}, new int[]{3, 1, 1, 3, 1}, new int[]{1, 3, 1, 3, 1}};
@Override // com.google.zxing.oned.OneDimensionalCodeWriter, com.google.zxing.Writer
public BitMatrix encode(String str, BarcodeFormat barcodeFormat, int i, int i2, Map map) {
if (barcodeFormat != BarcodeFormat.ITF) {
throw new IllegalArgumentException("Can only encode ITF, but got ".concat(String.valueOf(barcodeFormat)));
}
return super.encode(str, barcodeFormat, i, i2, map);
}
@Override // com.google.zxing.oned.OneDimensionalCodeWriter
public boolean[] encode(String str) {
int length = str.length();
if (length % 2 != 0) {
throw new IllegalArgumentException("The length of the input should be even");
}
if (length > 80) {
throw new IllegalArgumentException("Requested contents should be less than 80 digits long, but got ".concat(String.valueOf(length)));
}
boolean[] zArr = new boolean[(length * 9) + 9];
int appendPattern = OneDimensionalCodeWriter.appendPattern(zArr, 0, START_PATTERN, true);
for (int i = 0; i < length; i += 2) {
int digit = Character.digit(str.charAt(i), 10);
int digit2 = Character.digit(str.charAt(i + 1), 10);
int[] iArr = new int[10];
for (int i2 = 0; i2 < 5; i2++) {
int i3 = i2 * 2;
int[][] iArr2 = PATTERNS;
iArr[i3] = iArr2[digit][i2];
iArr[i3 + 1] = iArr2[digit2][i2];
}
appendPattern += OneDimensionalCodeWriter.appendPattern(zArr, appendPattern, iArr, true);
}
OneDimensionalCodeWriter.appendPattern(zArr, appendPattern, END_PATTERN, true);
return zArr;
}
}

View File

@@ -0,0 +1,5 @@
package com.google.zxing.oned;
/* loaded from: classes3.dex */
public abstract class OneDReader {
}

View File

@@ -0,0 +1,68 @@
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.Writer;
import com.google.zxing.common.BitMatrix;
import java.util.Map;
/* loaded from: classes3.dex */
public abstract class OneDimensionalCodeWriter implements Writer {
public abstract boolean[] encode(String str);
public int getDefaultMargin() {
return 10;
}
@Override // com.google.zxing.Writer
public BitMatrix encode(String str, BarcodeFormat barcodeFormat, int i, int i2, Map map) {
if (str.isEmpty()) {
throw new IllegalArgumentException("Found empty contents");
}
if (i < 0 || i2 < 0) {
throw new IllegalArgumentException("Negative size is not allowed. Input: " + i + 'x' + i2);
}
int defaultMargin = getDefaultMargin();
if (map != null) {
EncodeHintType encodeHintType = EncodeHintType.MARGIN;
if (map.containsKey(encodeHintType)) {
defaultMargin = Integer.parseInt(map.get(encodeHintType).toString());
}
}
return renderResult(encode(str), i, i2, defaultMargin);
}
public static BitMatrix renderResult(boolean[] zArr, int i, int i2, int i3) {
int length = zArr.length;
int i4 = i3 + length;
int max = Math.max(i, i4);
int max2 = Math.max(1, i2);
int i5 = max / i4;
int i6 = (max - (length * i5)) / 2;
BitMatrix bitMatrix = new BitMatrix(max, max2);
int i7 = 0;
while (i7 < length) {
if (zArr[i7]) {
bitMatrix.setRegion(i6, 0, i5, max2);
}
i7++;
i6 += i5;
}
return bitMatrix;
}
public static int appendPattern(boolean[] zArr, int i, int[] iArr, boolean z) {
int i2 = 0;
for (int i3 : iArr) {
int i4 = 0;
while (i4 < i3) {
zArr[i] = z;
i4++;
i++;
}
i2 += i3;
z = !z;
}
return i2;
}
}

View File

@@ -0,0 +1,19 @@
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.Writer;
import com.google.zxing.common.BitMatrix;
import java.util.Map;
/* loaded from: classes3.dex */
public final class UPCAWriter implements Writer {
public final EAN13Writer subWriter = new EAN13Writer();
@Override // com.google.zxing.Writer
public BitMatrix encode(String str, BarcodeFormat barcodeFormat, int i, int i2, Map map) {
if (barcodeFormat != BarcodeFormat.UPC_A) {
throw new IllegalArgumentException("Can only encode UPC-A, but got ".concat(String.valueOf(barcodeFormat)));
}
return this.subWriter.encode("0".concat(String.valueOf(str)), BarcodeFormat.EAN_13, i, i2, map);
}
}

View File

@@ -0,0 +1,58 @@
package com.google.zxing.oned;
import com.google.zxing.FormatException;
/* loaded from: classes3.dex */
public abstract class UPCEANReader extends OneDReader {
public static final int[][] L_AND_G_PATTERNS;
public static final int[][] L_PATTERNS;
public static final int[] START_END_PATTERN = {1, 1, 1};
public static final int[] MIDDLE_PATTERN = {1, 1, 1, 1, 1};
public static final int[] END_PATTERN = {1, 1, 1, 1, 1, 1};
static {
int[][] iArr = {new int[]{3, 2, 1, 1}, new int[]{2, 2, 2, 1}, new int[]{2, 1, 2, 2}, new int[]{1, 4, 1, 1}, new int[]{1, 1, 3, 2}, new int[]{1, 2, 3, 1}, new int[]{1, 1, 1, 4}, new int[]{1, 3, 1, 2}, new int[]{1, 2, 1, 3}, new int[]{3, 1, 1, 2}};
L_PATTERNS = iArr;
int[][] iArr2 = new int[20][];
L_AND_G_PATTERNS = iArr2;
System.arraycopy(iArr, 0, iArr2, 0, 10);
for (int i = 10; i < 20; i++) {
int[] iArr3 = L_PATTERNS[i - 10];
int[] iArr4 = new int[iArr3.length];
for (int i2 = 0; i2 < iArr3.length; i2++) {
iArr4[i2] = iArr3[(iArr3.length - i2) - 1];
}
L_AND_G_PATTERNS[i] = iArr4;
}
}
public static boolean checkStandardUPCEANChecksum(CharSequence charSequence) {
int length = charSequence.length();
if (length == 0) {
return false;
}
int i = length - 1;
return getStandardUPCEANChecksum(charSequence.subSequence(0, i)) == Character.digit(charSequence.charAt(i), 10);
}
public static int getStandardUPCEANChecksum(CharSequence charSequence) {
int length = charSequence.length();
int i = 0;
for (int i2 = length - 1; i2 >= 0; i2 -= 2) {
int charAt = charSequence.charAt(i2) - '0';
if (charAt < 0 || charAt > 9) {
throw FormatException.getFormatInstance();
}
i += charAt;
}
int i3 = i * 3;
for (int i4 = length - 2; i4 >= 0; i4 -= 2) {
int charAt2 = charSequence.charAt(i4) - '0';
if (charAt2 < 0 || charAt2 > 9) {
throw FormatException.getFormatInstance();
}
i3 += charAt2;
}
return (1000 - i3) % 10;
}
}

View File

@@ -0,0 +1,9 @@
package com.google.zxing.oned;
/* loaded from: classes3.dex */
public abstract class UPCEANWriter extends OneDimensionalCodeWriter {
@Override // com.google.zxing.oned.OneDimensionalCodeWriter
public int getDefaultMargin() {
return 9;
}
}

View File

@@ -0,0 +1,46 @@
package com.google.zxing.oned;
import com.fyber.inneractive.sdk.bidder.TokenParametersOuterClass$TokenParameters;
/* loaded from: classes3.dex */
public abstract class UPCEReader extends UPCEANReader {
public static final int[] MIDDLE_END_PATTERN = {1, 1, 1, 1, 1, 1};
public static final int[][] NUMSYS_AND_CHECK_DIGIT_PATTERNS = {new int[]{56, 52, 50, 49, 44, 38, 35, 42, 41, 37}, new int[]{7, 11, 13, 14, 19, 25, 28, 21, 22, 26}};
public static String convertUPCEtoUPCA(String str) {
char[] cArr = new char[6];
str.getChars(1, 7, cArr, 0);
StringBuilder sb = new StringBuilder(12);
sb.append(str.charAt(0));
char c = cArr[5];
switch (c) {
case TokenParametersOuterClass$TokenParameters.LOWPOWERMODE_FIELD_NUMBER /* 48 */:
case TokenParametersOuterClass$TokenParameters.DARKMODE_FIELD_NUMBER /* 49 */:
case '2':
sb.append(cArr, 0, 2);
sb.append(c);
sb.append("0000");
sb.append(cArr, 2, 3);
break;
case '3':
sb.append(cArr, 0, 3);
sb.append("00000");
sb.append(cArr, 3, 2);
break;
case '4':
sb.append(cArr, 0, 4);
sb.append("00000");
sb.append(cArr[4]);
break;
default:
sb.append(cArr, 0, 5);
sb.append("0000");
sb.append(c);
break;
}
if (str.length() >= 8) {
sb.append(str.charAt(7));
}
return sb.toString();
}
}

View File

@@ -0,0 +1,55 @@
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.FormatException;
import com.google.zxing.common.BitMatrix;
import java.util.Map;
/* loaded from: classes3.dex */
public final class UPCEWriter extends UPCEANWriter {
@Override // com.google.zxing.oned.OneDimensionalCodeWriter, com.google.zxing.Writer
public BitMatrix encode(String str, BarcodeFormat barcodeFormat, int i, int i2, Map map) {
if (barcodeFormat != BarcodeFormat.UPC_E) {
throw new IllegalArgumentException("Can only encode UPC_E, but got ".concat(String.valueOf(barcodeFormat)));
}
return super.encode(str, barcodeFormat, i, i2, map);
}
@Override // com.google.zxing.oned.OneDimensionalCodeWriter
public boolean[] encode(String str) {
int length = str.length();
if (length == 7) {
try {
str = str + UPCEANReader.getStandardUPCEANChecksum(UPCEReader.convertUPCEtoUPCA(str));
} catch (FormatException e) {
throw new IllegalArgumentException(e);
}
} else if (length == 8) {
try {
if (!UPCEANReader.checkStandardUPCEANChecksum(str)) {
throw new IllegalArgumentException("Contents do not pass checksum");
}
} catch (FormatException unused) {
throw new IllegalArgumentException("Illegal contents");
}
} else {
throw new IllegalArgumentException("Requested contents should be 8 digits long, but got ".concat(String.valueOf(length)));
}
int digit = Character.digit(str.charAt(0), 10);
if (digit != 0 && digit != 1) {
throw new IllegalArgumentException("Number system must be 0 or 1");
}
int i = UPCEReader.NUMSYS_AND_CHECK_DIGIT_PATTERNS[digit][Character.digit(str.charAt(7), 10)];
boolean[] zArr = new boolean[51];
int appendPattern = OneDimensionalCodeWriter.appendPattern(zArr, 0, UPCEANReader.START_END_PATTERN, true);
for (int i2 = 1; i2 <= 6; i2++) {
int digit2 = Character.digit(str.charAt(i2), 10);
if (((i >> (6 - i2)) & 1) == 1) {
digit2 += 10;
}
appendPattern += OneDimensionalCodeWriter.appendPattern(zArr, appendPattern, UPCEANReader.L_AND_G_PATTERNS[digit2], false);
}
OneDimensionalCodeWriter.appendPattern(zArr, appendPattern, UPCEANReader.END_PATTERN, false);
return zArr;
}
}

View File

@@ -0,0 +1,102 @@
package com.google.zxing.pdf417;
import com.amazonaws.handlers.HandlerChainFactory$$ExternalSyntheticThrowCCEIfNotNull0;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.Writer;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.pdf417.encoder.Compaction;
import com.google.zxing.pdf417.encoder.PDF417;
import java.lang.reflect.Array;
import java.nio.charset.Charset;
import java.util.Map;
/* loaded from: classes3.dex */
public final class PDF417Writer implements Writer {
@Override // com.google.zxing.Writer
public BitMatrix encode(String str, BarcodeFormat barcodeFormat, int i, int i2, Map map) {
if (barcodeFormat != BarcodeFormat.PDF_417) {
throw new IllegalArgumentException("Can only encode PDF_417, but got ".concat(String.valueOf(barcodeFormat)));
}
PDF417 pdf417 = new PDF417();
if (map != null) {
EncodeHintType encodeHintType = EncodeHintType.PDF417_COMPACT;
if (map.containsKey(encodeHintType)) {
pdf417.setCompact(Boolean.valueOf(map.get(encodeHintType).toString()).booleanValue());
}
EncodeHintType encodeHintType2 = EncodeHintType.PDF417_COMPACTION;
if (map.containsKey(encodeHintType2)) {
pdf417.setCompaction(Compaction.valueOf(map.get(encodeHintType2).toString()));
}
EncodeHintType encodeHintType3 = EncodeHintType.PDF417_DIMENSIONS;
if (map.containsKey(encodeHintType3)) {
HandlerChainFactory$$ExternalSyntheticThrowCCEIfNotNull0.m(map.get(encodeHintType3));
throw null;
}
EncodeHintType encodeHintType4 = EncodeHintType.MARGIN;
r9 = map.containsKey(encodeHintType4) ? Integer.parseInt(map.get(encodeHintType4).toString()) : 30;
EncodeHintType encodeHintType5 = EncodeHintType.ERROR_CORRECTION;
r0 = map.containsKey(encodeHintType5) ? Integer.parseInt(map.get(encodeHintType5).toString()) : 2;
EncodeHintType encodeHintType6 = EncodeHintType.CHARACTER_SET;
if (map.containsKey(encodeHintType6)) {
pdf417.setEncoding(Charset.forName(map.get(encodeHintType6).toString()));
}
}
return bitMatrixFromEncoder(pdf417, str, r0, i, i2, r9);
}
public static BitMatrix bitMatrixFromEncoder(PDF417 pdf417, String str, int i, int i2, int i3, int i4) {
boolean z;
pdf417.generateBarcodeLogic(str, i);
byte[][] scaledMatrix = pdf417.getBarcodeMatrix().getScaledMatrix(1, 4);
if ((i3 > i2) != (scaledMatrix[0].length < scaledMatrix.length)) {
scaledMatrix = rotateArray(scaledMatrix);
z = true;
} else {
z = false;
}
int length = i2 / scaledMatrix[0].length;
int length2 = i3 / scaledMatrix.length;
if (length >= length2) {
length = length2;
}
if (length > 1) {
byte[][] scaledMatrix2 = pdf417.getBarcodeMatrix().getScaledMatrix(length, length << 2);
if (z) {
scaledMatrix2 = rotateArray(scaledMatrix2);
}
return bitMatrixFromBitArray(scaledMatrix2, i4);
}
return bitMatrixFromBitArray(scaledMatrix, i4);
}
public static BitMatrix bitMatrixFromBitArray(byte[][] bArr, int i) {
int i2 = i * 2;
BitMatrix bitMatrix = new BitMatrix(bArr[0].length + i2, bArr.length + i2);
bitMatrix.clear();
int height = (bitMatrix.getHeight() - i) - 1;
int i3 = 0;
while (i3 < bArr.length) {
byte[] bArr2 = bArr[i3];
for (int i4 = 0; i4 < bArr[0].length; i4++) {
if (bArr2[i4] == 1) {
bitMatrix.set(i4 + i, height);
}
}
i3++;
height--;
}
return bitMatrix;
}
public static byte[][] rotateArray(byte[][] bArr) {
byte[][] bArr2 = (byte[][]) Array.newInstance((Class<?>) Byte.TYPE, bArr[0].length, bArr.length);
for (int i = 0; i < bArr.length; i++) {
int length = (bArr.length - i) - 1;
for (int i2 = 0; i2 < bArr[0].length; i2++) {
bArr2[i2][length] = bArr[i][i2];
}
}
return bArr2;
}
}

View File

@@ -0,0 +1,40 @@
package com.google.zxing.pdf417.encoder;
import java.lang.reflect.Array;
/* loaded from: classes3.dex */
public final class BarcodeMatrix {
public int currentRow;
public final int height;
public final BarcodeRow[] matrix;
public final int width;
public void startRow() {
this.currentRow++;
}
public BarcodeMatrix(int i, int i2) {
BarcodeRow[] barcodeRowArr = new BarcodeRow[i];
this.matrix = barcodeRowArr;
int length = barcodeRowArr.length;
for (int i3 = 0; i3 < length; i3++) {
this.matrix[i3] = new BarcodeRow(((i2 + 4) * 17) + 1);
}
this.width = i2 * 17;
this.height = i;
this.currentRow = -1;
}
public BarcodeRow getCurrentRow() {
return this.matrix[this.currentRow];
}
public byte[][] getScaledMatrix(int i, int i2) {
byte[][] bArr = (byte[][]) Array.newInstance((Class<?>) Byte.TYPE, this.height * i2, this.width * i);
int i3 = this.height * i2;
for (int i4 = 0; i4 < i3; i4++) {
bArr[(i3 - i4) - 1] = this.matrix[i4 / i2].getScaledRow(i);
}
return bArr;
}
}

View File

@@ -0,0 +1,32 @@
package com.google.zxing.pdf417.encoder;
/* loaded from: classes3.dex */
public final class BarcodeRow {
public int currentLocation = 0;
public final byte[] row;
public BarcodeRow(int i) {
this.row = new byte[i];
}
public final void set(int i, boolean z) {
this.row[i] = z ? (byte) 1 : (byte) 0;
}
public void addBar(boolean z, int i) {
for (int i2 = 0; i2 < i; i2++) {
int i3 = this.currentLocation;
this.currentLocation = i3 + 1;
set(i3, z);
}
}
public byte[] getScaledRow(int i) {
int length = this.row.length * i;
byte[] bArr = new byte[length];
for (int i2 = 0; i2 < length; i2++) {
bArr[i2] = this.row[i2 / i];
}
return bArr;
}
}

View File

@@ -0,0 +1,9 @@
package com.google.zxing.pdf417.encoder;
/* loaded from: classes3.dex */
public enum Compaction {
AUTO,
TEXT,
BYTE,
NUMERIC
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,376 @@
package com.google.zxing.pdf417.encoder;
import com.applovin.exoplayer2.common.base.Ascii;
import com.google.zxing.WriterException;
import com.google.zxing.common.CharacterSetECI;
import java.math.BigInteger;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
/* loaded from: classes3.dex */
public abstract class PDF417HighLevelEncoder {
public static final byte[] MIXED;
public static final byte[] TEXT_MIXED_RAW = {48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 38, Ascii.CR, 9, 44, 58, 35, 45, 46, 36, 47, 43, 37, 42, 61, 94, 0, 32, 0, 0, 0};
public static final byte[] TEXT_PUNCTUATION_RAW = {59, 60, 62, 64, 91, 92, 93, 95, 96, 126, 33, Ascii.CR, 9, 44, 58, 10, 45, 46, 36, 47, 34, 124, 42, 40, 41, 63, 123, 125, 39, 0};
public static final byte[] PUNCTUATION = new byte[128];
public static final Charset DEFAULT_ENCODING = StandardCharsets.ISO_8859_1;
public static boolean isAlphaLower(char c) {
if (c != ' ') {
return c >= 'a' && c <= 'z';
}
return true;
}
public static boolean isAlphaUpper(char c) {
if (c != ' ') {
return c >= 'A' && c <= 'Z';
}
return true;
}
public static boolean isDigit(char c) {
return c >= '0' && c <= '9';
}
public static boolean isText(char c) {
if (c == '\t' || c == '\n' || c == '\r') {
return true;
}
return c >= ' ' && c <= '~';
}
static {
byte[] bArr = new byte[128];
MIXED = bArr;
Arrays.fill(bArr, (byte) -1);
int i = 0;
int i2 = 0;
while (true) {
byte[] bArr2 = TEXT_MIXED_RAW;
if (i2 >= bArr2.length) {
break;
}
byte b = bArr2[i2];
if (b > 0) {
MIXED[b] = (byte) i2;
}
i2++;
}
Arrays.fill(PUNCTUATION, (byte) -1);
while (true) {
byte[] bArr3 = TEXT_PUNCTUATION_RAW;
if (i >= bArr3.length) {
return;
}
byte b2 = bArr3[i];
if (b2 > 0) {
PUNCTUATION[b2] = (byte) i;
}
i++;
}
}
public static String encodeHighLevel(String str, Compaction compaction, Charset charset) {
CharacterSetECI characterSetECIByName;
StringBuilder sb = new StringBuilder(str.length());
if (charset == null) {
charset = DEFAULT_ENCODING;
} else if (!DEFAULT_ENCODING.equals(charset) && (characterSetECIByName = CharacterSetECI.getCharacterSetECIByName(charset.name())) != null) {
encodingECI(characterSetECIByName.getValue(), sb);
}
int length = str.length();
int i = AnonymousClass1.$SwitchMap$com$google$zxing$pdf417$encoder$Compaction[compaction.ordinal()];
if (i == 1) {
encodeText(str, 0, length, sb, 0);
} else if (i == 2) {
byte[] bytes = str.getBytes(charset);
encodeBinary(bytes, 0, bytes.length, 1, sb);
} else if (i != 3) {
int i2 = 0;
int i3 = 0;
int i4 = 0;
while (i2 < length) {
int determineConsecutiveDigitCount = determineConsecutiveDigitCount(str, i2);
if (determineConsecutiveDigitCount >= 13) {
sb.append((char) 902);
encodeNumeric(str, i2, determineConsecutiveDigitCount, sb);
i2 += determineConsecutiveDigitCount;
i3 = 0;
i4 = 2;
} else {
int determineConsecutiveTextCount = determineConsecutiveTextCount(str, i2);
if (determineConsecutiveTextCount >= 5 || determineConsecutiveDigitCount == length) {
if (i4 != 0) {
sb.append((char) 900);
i3 = 0;
i4 = 0;
}
i3 = encodeText(str, i2, determineConsecutiveTextCount, sb, i3);
i2 += determineConsecutiveTextCount;
} else {
int determineConsecutiveBinaryCount = determineConsecutiveBinaryCount(str, i2, charset);
if (determineConsecutiveBinaryCount == 0) {
determineConsecutiveBinaryCount = 1;
}
int i5 = determineConsecutiveBinaryCount + i2;
byte[] bytes2 = str.substring(i2, i5).getBytes(charset);
if (bytes2.length == 1 && i4 == 0) {
encodeBinary(bytes2, 0, 1, 0, sb);
} else {
encodeBinary(bytes2, 0, bytes2.length, i4, sb);
i4 = 1;
i3 = 0;
}
i2 = i5;
}
}
}
} else {
sb.append((char) 902);
encodeNumeric(str, 0, length, sb);
}
return sb.toString();
}
/* renamed from: com.google.zxing.pdf417.encoder.PDF417HighLevelEncoder$1, reason: invalid class name */
public static /* synthetic */ class AnonymousClass1 {
public static final /* synthetic */ int[] $SwitchMap$com$google$zxing$pdf417$encoder$Compaction;
static {
int[] iArr = new int[Compaction.values().length];
$SwitchMap$com$google$zxing$pdf417$encoder$Compaction = iArr;
try {
iArr[Compaction.TEXT.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$google$zxing$pdf417$encoder$Compaction[Compaction.BYTE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$google$zxing$pdf417$encoder$Compaction[Compaction.NUMERIC.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
}
}
/* JADX WARN: Removed duplicated region for block: B:21:0x00f4 A[EDGE_INSN: B:21:0x00f4->B:22:0x00f4 BREAK A[LOOP:0: B:2:0x000f->B:16:0x000f], SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:37:0x000f A[SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static int encodeText(java.lang.CharSequence r16, int r17, int r18, java.lang.StringBuilder r19, int r20) {
/*
Method dump skipped, instructions count: 285
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.pdf417.encoder.PDF417HighLevelEncoder.encodeText(java.lang.CharSequence, int, int, java.lang.StringBuilder, int):int");
}
public static void encodeBinary(byte[] bArr, int i, int i2, int i3, StringBuilder sb) {
int i4;
if (i2 == 1 && i3 == 0) {
sb.append((char) 913);
} else if (i2 % 6 == 0) {
sb.append((char) 924);
} else {
sb.append((char) 901);
}
if (i2 >= 6) {
char[] cArr = new char[5];
i4 = i;
while ((i + i2) - i4 >= 6) {
long j = 0;
for (int i5 = 0; i5 < 6; i5++) {
j = (j << 8) + (bArr[i4 + i5] & 255);
}
for (int i6 = 0; i6 < 5; i6++) {
cArr[i6] = (char) (j % 900);
j /= 900;
}
for (int i7 = 4; i7 >= 0; i7--) {
sb.append(cArr[i7]);
}
i4 += 6;
}
} else {
i4 = i;
}
while (i4 < i + i2) {
sb.append((char) (bArr[i4] & 255));
i4++;
}
}
public static void encodeNumeric(String str, int i, int i2, StringBuilder sb) {
StringBuilder sb2 = new StringBuilder((i2 / 3) + 1);
BigInteger valueOf = BigInteger.valueOf(900L);
BigInteger valueOf2 = BigInteger.valueOf(0L);
int i3 = 0;
while (i3 < i2) {
sb2.setLength(0);
int min = Math.min(44, i2 - i3);
StringBuilder sb3 = new StringBuilder("1");
int i4 = i + i3;
sb3.append(str.substring(i4, i4 + min));
BigInteger bigInteger = new BigInteger(sb3.toString());
do {
sb2.append((char) bigInteger.mod(valueOf).intValue());
bigInteger = bigInteger.divide(valueOf);
} while (!bigInteger.equals(valueOf2));
for (int length = sb2.length() - 1; length >= 0; length--) {
sb.append(sb2.charAt(length));
}
i3 += min;
}
}
public static boolean isMixed(char c) {
return MIXED[c] != -1;
}
public static boolean isPunctuation(char c) {
return PUNCTUATION[c] != -1;
}
public static int determineConsecutiveDigitCount(CharSequence charSequence, int i) {
int length = charSequence.length();
int i2 = 0;
if (i < length) {
char charAt = charSequence.charAt(i);
while (isDigit(charAt) && i < length) {
i2++;
i++;
if (i < length) {
charAt = charSequence.charAt(i);
}
}
}
return i2;
}
/* JADX WARN: Code restructure failed: missing block: B:32:0x0027, code lost:
return (r1 - r7) - r3;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static int determineConsecutiveTextCount(java.lang.CharSequence r6, int r7) {
/*
int r0 = r6.length()
r1 = r7
L5:
if (r1 >= r0) goto L37
char r2 = r6.charAt(r1)
r3 = 0
Lc:
r4 = 13
if (r3 >= r4) goto L23
boolean r5 = isDigit(r2)
if (r5 == 0) goto L23
if (r1 >= r0) goto L23
int r3 = r3 + 1
int r1 = r1 + 1
if (r1 >= r0) goto Lc
char r2 = r6.charAt(r1)
goto Lc
L23:
if (r3 < r4) goto L28
int r1 = r1 - r7
int r1 = r1 - r3
return r1
L28:
if (r3 > 0) goto L5
char r2 = r6.charAt(r1)
boolean r2 = isText(r2)
if (r2 == 0) goto L37
int r1 = r1 + 1
goto L5
L37:
int r1 = r1 - r7
return r1
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.pdf417.encoder.PDF417HighLevelEncoder.determineConsecutiveTextCount(java.lang.CharSequence, int):int");
}
/* JADX WARN: Code restructure failed: missing block: B:22:0x0028, code lost:
return r1 - r6;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static int determineConsecutiveBinaryCount(java.lang.String r5, int r6, java.nio.charset.Charset r7) {
/*
java.nio.charset.CharsetEncoder r7 = r7.newEncoder()
int r0 = r5.length()
r1 = r6
L9:
if (r1 >= r0) goto L57
char r2 = r5.charAt(r1)
r3 = 0
L10:
r4 = 13
if (r3 >= r4) goto L25
boolean r2 = isDigit(r2)
if (r2 == 0) goto L25
int r3 = r3 + 1
int r2 = r1 + r3
if (r2 >= r0) goto L25
char r2 = r5.charAt(r2)
goto L10
L25:
if (r3 < r4) goto L29
int r1 = r1 - r6
return r1
L29:
char r2 = r5.charAt(r1)
boolean r3 = r7.canEncode(r2)
if (r3 == 0) goto L36
int r1 = r1 + 1
goto L9
L36:
com.google.zxing.WriterException r5 = new com.google.zxing.WriterException
java.lang.StringBuilder r6 = new java.lang.StringBuilder
java.lang.String r7 = "Non-encodable character detected: "
r6.<init>(r7)
r6.append(r2)
java.lang.String r7 = " (Unicode: "
r6.append(r7)
r6.append(r2)
r7 = 41
r6.append(r7)
java.lang.String r6 = r6.toString()
r5.<init>(r6)
throw r5
L57:
int r1 = r1 - r6
return r1
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.pdf417.encoder.PDF417HighLevelEncoder.determineConsecutiveBinaryCount(java.lang.String, int, java.nio.charset.Charset):int");
}
public static void encodingECI(int i, StringBuilder sb) {
if (i >= 0 && i < 900) {
sb.append((char) 927);
sb.append((char) i);
} else if (i < 810900) {
sb.append((char) 926);
sb.append((char) ((i / 900) - 1));
sb.append((char) (i % 900));
} else {
if (i < 811800) {
sb.append((char) 925);
sb.append((char) (810900 - i));
return;
}
throw new WriterException("ECI number not in valid range from 0..811799, but was ".concat(String.valueOf(i)));
}
}
}

View File

@@ -0,0 +1,73 @@
package com.google.zxing.qrcode;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.Writer;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import com.google.zxing.qrcode.encoder.ByteMatrix;
import com.google.zxing.qrcode.encoder.Encoder;
import com.google.zxing.qrcode.encoder.QRCode;
import java.util.Map;
/* loaded from: classes3.dex */
public final class QRCodeWriter implements Writer {
@Override // com.google.zxing.Writer
public BitMatrix encode(String str, BarcodeFormat barcodeFormat, int i, int i2, Map map) {
if (str.isEmpty()) {
throw new IllegalArgumentException("Found empty contents");
}
if (barcodeFormat != BarcodeFormat.QR_CODE) {
throw new IllegalArgumentException("Can only encode QR_CODE, but got ".concat(String.valueOf(barcodeFormat)));
}
if (i < 0 || i2 < 0) {
throw new IllegalArgumentException("Requested dimensions are too small: " + i + 'x' + i2);
}
ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.L;
int i3 = 4;
if (map != null) {
EncodeHintType encodeHintType = EncodeHintType.ERROR_CORRECTION;
if (map.containsKey(encodeHintType)) {
errorCorrectionLevel = ErrorCorrectionLevel.valueOf(map.get(encodeHintType).toString());
}
EncodeHintType encodeHintType2 = EncodeHintType.MARGIN;
if (map.containsKey(encodeHintType2)) {
i3 = Integer.parseInt(map.get(encodeHintType2).toString());
}
}
return renderResult(Encoder.encode(str, errorCorrectionLevel, map), i, i2, i3);
}
public static BitMatrix renderResult(QRCode qRCode, int i, int i2, int i3) {
ByteMatrix matrix = qRCode.getMatrix();
if (matrix == null) {
throw new IllegalStateException();
}
int width = matrix.getWidth();
int height = matrix.getHeight();
int i4 = i3 << 1;
int i5 = width + i4;
int i6 = i4 + height;
int max = Math.max(i, i5);
int max2 = Math.max(i2, i6);
int min = Math.min(max / i5, max2 / i6);
int i7 = (max - (width * min)) / 2;
int i8 = (max2 - (height * min)) / 2;
BitMatrix bitMatrix = new BitMatrix(max, max2);
int i9 = 0;
while (i9 < height) {
int i10 = 0;
int i11 = i7;
while (i10 < width) {
if (matrix.get(i10, i9) == 1) {
bitMatrix.setRegion(i11, i8, min, min);
}
i10++;
i11 += min;
}
i9++;
i8 += min;
}
return bitMatrix;
}
}

View File

@@ -0,0 +1,37 @@
package com.google.zxing.qrcode.decoder;
/* loaded from: classes3.dex */
public enum ErrorCorrectionLevel {
L(1),
M(0),
Q(3),
H(2);
private static final ErrorCorrectionLevel[] FOR_BITS;
private final int bits;
public int getBits() {
return this.bits;
}
static {
ErrorCorrectionLevel errorCorrectionLevel = L;
ErrorCorrectionLevel errorCorrectionLevel2 = M;
ErrorCorrectionLevel errorCorrectionLevel3 = Q;
FOR_BITS = new ErrorCorrectionLevel[]{errorCorrectionLevel2, errorCorrectionLevel, H, errorCorrectionLevel3};
}
ErrorCorrectionLevel(int i) {
this.bits = i;
}
public static ErrorCorrectionLevel forBits(int i) {
if (i >= 0) {
ErrorCorrectionLevel[] errorCorrectionLevelArr = FOR_BITS;
if (i < errorCorrectionLevelArr.length) {
return errorCorrectionLevelArr[i];
}
}
throw new IllegalArgumentException();
}
}

View File

@@ -0,0 +1,66 @@
package com.google.zxing.qrcode.decoder;
/* loaded from: classes3.dex */
public enum Mode {
TERMINATOR(new int[]{0, 0, 0}, 0),
NUMERIC(new int[]{10, 12, 14}, 1),
ALPHANUMERIC(new int[]{9, 11, 13}, 2),
STRUCTURED_APPEND(new int[]{0, 0, 0}, 3),
BYTE(new int[]{8, 16, 16}, 4),
ECI(new int[]{0, 0, 0}, 7),
KANJI(new int[]{8, 10, 12}, 8),
FNC1_FIRST_POSITION(new int[]{0, 0, 0}, 5),
FNC1_SECOND_POSITION(new int[]{0, 0, 0}, 9),
HANZI(new int[]{8, 10, 12}, 13);
private final int bits;
private final int[] characterCountBitsForVersions;
public int getBits() {
return this.bits;
}
Mode(int[] iArr, int i) {
this.characterCountBitsForVersions = iArr;
this.bits = i;
}
public static Mode forBits(int i) {
if (i == 0) {
return TERMINATOR;
}
if (i == 1) {
return NUMERIC;
}
if (i == 2) {
return ALPHANUMERIC;
}
if (i == 3) {
return STRUCTURED_APPEND;
}
if (i == 4) {
return BYTE;
}
if (i == 5) {
return FNC1_FIRST_POSITION;
}
if (i == 7) {
return ECI;
}
if (i == 8) {
return KANJI;
}
if (i == 9) {
return FNC1_SECOND_POSITION;
}
if (i == 13) {
return HANZI;
}
throw new IllegalArgumentException();
}
public int getCharacterCountBits(Version version) {
int versionNumber = version.getVersionNumber();
return this.characterCountBitsForVersions[versionNumber <= 9 ? (char) 0 : versionNumber <= 26 ? (char) 1 : (char) 2];
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,20 @@
package com.google.zxing.qrcode.encoder;
/* loaded from: classes3.dex */
public final class BlockPair {
public final byte[] dataBytes;
public final byte[] errorCorrectionBytes;
public byte[] getDataBytes() {
return this.dataBytes;
}
public byte[] getErrorCorrectionBytes() {
return this.errorCorrectionBytes;
}
public BlockPair(byte[] bArr, byte[] bArr2) {
this.dataBytes = bArr;
this.errorCorrectionBytes = bArr2;
}
}

View File

@@ -0,0 +1,66 @@
package com.google.zxing.qrcode.encoder;
import java.lang.reflect.Array;
import java.util.Arrays;
/* loaded from: classes3.dex */
public final class ByteMatrix {
public final byte[][] bytes;
public final int height;
public final int width;
public byte[][] getArray() {
return this.bytes;
}
public int getHeight() {
return this.height;
}
public int getWidth() {
return this.width;
}
public ByteMatrix(int i, int i2) {
this.bytes = (byte[][]) Array.newInstance((Class<?>) Byte.TYPE, i2, i);
this.width = i;
this.height = i2;
}
public byte get(int i, int i2) {
return this.bytes[i2][i];
}
public void set(int i, int i2, int i3) {
this.bytes[i2][i] = (byte) i3;
}
public void set(int i, int i2, boolean z) {
this.bytes[i2][i] = z ? (byte) 1 : (byte) 0;
}
public void clear(byte b) {
for (byte[] bArr : this.bytes) {
Arrays.fill(bArr, b);
}
}
public String toString() {
StringBuilder sb = new StringBuilder((this.width * 2 * this.height) + 2);
for (int i = 0; i < this.height; i++) {
byte[] bArr = this.bytes[i];
for (int i2 = 0; i2 < this.width; i2++) {
byte b = bArr[i2];
if (b == 0) {
sb.append(" 0");
} else if (b == 1) {
sb.append(" 1");
} else {
sb.append(" ");
}
}
sb.append('\n');
}
return sb.toString();
}
}

View File

@@ -0,0 +1,516 @@
package com.google.zxing.qrcode.encoder;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitArray;
import com.google.zxing.common.CharacterSetECI;
import com.google.zxing.common.reedsolomon.GenericGF;
import com.google.zxing.common.reedsolomon.ReedSolomonEncoder;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import com.google.zxing.qrcode.decoder.Mode;
import com.google.zxing.qrcode.decoder.Version;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Iterator;
/* loaded from: classes3.dex */
public abstract class Encoder {
public static final int[] ALPHANUMERIC_TABLE = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1};
public static int calculateMaskPenalty(ByteMatrix byteMatrix) {
return MaskUtil.applyMaskPenaltyRule1(byteMatrix) + MaskUtil.applyMaskPenaltyRule2(byteMatrix) + MaskUtil.applyMaskPenaltyRule3(byteMatrix) + MaskUtil.applyMaskPenaltyRule4(byteMatrix);
}
/* JADX WARN: Removed duplicated region for block: B:30:0x009b */
/* JADX WARN: Removed duplicated region for block: B:33:0x00a0 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static com.google.zxing.qrcode.encoder.QRCode encode(java.lang.String r6, com.google.zxing.qrcode.decoder.ErrorCorrectionLevel r7, java.util.Map r8) {
/*
if (r8 == 0) goto Lc
com.google.zxing.EncodeHintType r0 = com.google.zxing.EncodeHintType.CHARACTER_SET
boolean r0 = r8.containsKey(r0)
if (r0 == 0) goto Lc
r0 = 1
goto Ld
Lc:
r0 = 0
Ld:
if (r0 == 0) goto L1a
com.google.zxing.EncodeHintType r1 = com.google.zxing.EncodeHintType.CHARACTER_SET
java.lang.Object r1 = r8.get(r1)
java.lang.String r1 = r1.toString()
goto L1c
L1a:
java.lang.String r1 = "ISO-8859-1"
L1c:
com.google.zxing.qrcode.decoder.Mode r2 = chooseMode(r6, r1)
com.google.zxing.common.BitArray r3 = new com.google.zxing.common.BitArray
r3.<init>()
com.google.zxing.qrcode.decoder.Mode r4 = com.google.zxing.qrcode.decoder.Mode.BYTE
if (r2 != r4) goto L34
if (r0 == 0) goto L34
com.google.zxing.common.CharacterSetECI r0 = com.google.zxing.common.CharacterSetECI.getCharacterSetECIByName(r1)
if (r0 == 0) goto L34
appendECI(r0, r3)
L34:
if (r8 == 0) goto L55
com.google.zxing.EncodeHintType r0 = com.google.zxing.EncodeHintType.GS1_FORMAT
boolean r5 = r8.containsKey(r0)
if (r5 == 0) goto L55
java.lang.Object r0 = r8.get(r0)
java.lang.String r0 = r0.toString()
java.lang.Boolean r0 = java.lang.Boolean.valueOf(r0)
boolean r0 = r0.booleanValue()
if (r0 == 0) goto L55
com.google.zxing.qrcode.decoder.Mode r0 = com.google.zxing.qrcode.decoder.Mode.FNC1_FIRST_POSITION
appendModeInfo(r0, r3)
L55:
appendModeInfo(r2, r3)
com.google.zxing.common.BitArray r0 = new com.google.zxing.common.BitArray
r0.<init>()
appendBytes(r6, r2, r0, r1)
if (r8 == 0) goto L8d
com.google.zxing.EncodeHintType r1 = com.google.zxing.EncodeHintType.QR_VERSION
boolean r5 = r8.containsKey(r1)
if (r5 == 0) goto L8d
java.lang.Object r8 = r8.get(r1)
java.lang.String r8 = r8.toString()
int r8 = java.lang.Integer.parseInt(r8)
com.google.zxing.qrcode.decoder.Version r8 = com.google.zxing.qrcode.decoder.Version.getVersionForNumber(r8)
int r1 = calculateBitsNeeded(r2, r3, r0, r8)
boolean r1 = willFit(r1, r8, r7)
if (r1 == 0) goto L85
goto L91
L85:
com.google.zxing.WriterException r6 = new com.google.zxing.WriterException
java.lang.String r7 = "Data too big for requested version"
r6.<init>(r7)
throw r6
L8d:
com.google.zxing.qrcode.decoder.Version r8 = recommendVersion(r7, r2, r3, r0)
L91:
com.google.zxing.common.BitArray r1 = new com.google.zxing.common.BitArray
r1.<init>()
r1.appendBitArray(r3)
if (r2 != r4) goto La0
int r6 = r0.getSizeInBytes()
goto La4
La0:
int r6 = r6.length()
La4:
appendLengthInfo(r6, r8, r2, r1)
r1.appendBitArray(r0)
com.google.zxing.qrcode.decoder.Version$ECBlocks r6 = r8.getECBlocksForLevel(r7)
int r0 = r8.getTotalCodewords()
int r3 = r6.getTotalECCodewords()
int r0 = r0 - r3
terminateBits(r0, r1)
int r3 = r8.getTotalCodewords()
int r6 = r6.getNumBlocks()
com.google.zxing.common.BitArray r6 = interleaveWithECBytes(r1, r3, r0, r6)
com.google.zxing.qrcode.encoder.QRCode r0 = new com.google.zxing.qrcode.encoder.QRCode
r0.<init>()
r0.setECLevel(r7)
r0.setMode(r2)
r0.setVersion(r8)
int r1 = r8.getDimensionForVersion()
com.google.zxing.qrcode.encoder.ByteMatrix r2 = new com.google.zxing.qrcode.encoder.ByteMatrix
r2.<init>(r1, r1)
int r1 = chooseMaskPattern(r6, r7, r8, r2)
r0.setMaskPattern(r1)
com.google.zxing.qrcode.encoder.MatrixUtil.buildMatrix(r6, r7, r8, r1, r2)
r0.setMatrix(r2)
return r0
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.qrcode.encoder.Encoder.encode(java.lang.String, com.google.zxing.qrcode.decoder.ErrorCorrectionLevel, java.util.Map):com.google.zxing.qrcode.encoder.QRCode");
}
public static Version recommendVersion(ErrorCorrectionLevel errorCorrectionLevel, Mode mode, BitArray bitArray, BitArray bitArray2) {
return chooseVersion(calculateBitsNeeded(mode, bitArray, bitArray2, chooseVersion(calculateBitsNeeded(mode, bitArray, bitArray2, Version.getVersionForNumber(1)), errorCorrectionLevel)), errorCorrectionLevel);
}
public static int calculateBitsNeeded(Mode mode, BitArray bitArray, BitArray bitArray2, Version version) {
return bitArray.getSize() + mode.getCharacterCountBits(version) + bitArray2.getSize();
}
public static int getAlphanumericCode(int i) {
int[] iArr = ALPHANUMERIC_TABLE;
if (i < iArr.length) {
return iArr[i];
}
return -1;
}
public static Mode chooseMode(String str, String str2) {
if ("Shift_JIS".equals(str2) && isOnlyDoubleByteKanji(str)) {
return Mode.KANJI;
}
boolean z = false;
boolean z2 = false;
for (int i = 0; i < str.length(); i++) {
char charAt = str.charAt(i);
if (charAt >= '0' && charAt <= '9') {
z2 = true;
} else {
if (getAlphanumericCode(charAt) == -1) {
return Mode.BYTE;
}
z = true;
}
}
if (z) {
return Mode.ALPHANUMERIC;
}
if (z2) {
return Mode.NUMERIC;
}
return Mode.BYTE;
}
public static boolean isOnlyDoubleByteKanji(String str) {
try {
byte[] bytes = str.getBytes("Shift_JIS");
int length = bytes.length;
if (length % 2 != 0) {
return false;
}
for (int i = 0; i < length; i += 2) {
int i2 = bytes[i] & 255;
if ((i2 < 129 || i2 > 159) && (i2 < 224 || i2 > 235)) {
return false;
}
}
return true;
} catch (UnsupportedEncodingException unused) {
return false;
}
}
public static int chooseMaskPattern(BitArray bitArray, ErrorCorrectionLevel errorCorrectionLevel, Version version, ByteMatrix byteMatrix) {
int i = Integer.MAX_VALUE;
int i2 = -1;
for (int i3 = 0; i3 < 8; i3++) {
MatrixUtil.buildMatrix(bitArray, errorCorrectionLevel, version, i3, byteMatrix);
int calculateMaskPenalty = calculateMaskPenalty(byteMatrix);
if (calculateMaskPenalty < i) {
i2 = i3;
i = calculateMaskPenalty;
}
}
return i2;
}
public static Version chooseVersion(int i, ErrorCorrectionLevel errorCorrectionLevel) {
for (int i2 = 1; i2 <= 40; i2++) {
Version versionForNumber = Version.getVersionForNumber(i2);
if (willFit(i, versionForNumber, errorCorrectionLevel)) {
return versionForNumber;
}
}
throw new WriterException("Data too big");
}
public static boolean willFit(int i, Version version, ErrorCorrectionLevel errorCorrectionLevel) {
return version.getTotalCodewords() - version.getECBlocksForLevel(errorCorrectionLevel).getTotalECCodewords() >= (i + 7) / 8;
}
public static void terminateBits(int i, BitArray bitArray) {
int i2 = i << 3;
if (bitArray.getSize() > i2) {
throw new WriterException("data bits cannot fit in the QR Code" + bitArray.getSize() + " > " + i2);
}
for (int i3 = 0; i3 < 4 && bitArray.getSize() < i2; i3++) {
bitArray.appendBit(false);
}
int size = bitArray.getSize() & 7;
if (size > 0) {
while (size < 8) {
bitArray.appendBit(false);
size++;
}
}
int sizeInBytes = i - bitArray.getSizeInBytes();
for (int i4 = 0; i4 < sizeInBytes; i4++) {
bitArray.appendBits((i4 & 1) == 0 ? 236 : 17, 8);
}
if (bitArray.getSize() != i2) {
throw new WriterException("Bits size does not equal capacity");
}
}
public static void getNumDataBytesAndNumECBytesForBlockID(int i, int i2, int i3, int i4, int[] iArr, int[] iArr2) {
if (i4 >= i3) {
throw new WriterException("Block ID too large");
}
int i5 = i % i3;
int i6 = i3 - i5;
int i7 = i / i3;
int i8 = i7 + 1;
int i9 = i2 / i3;
int i10 = i9 + 1;
int i11 = i7 - i9;
int i12 = i8 - i10;
if (i11 != i12) {
throw new WriterException("EC bytes mismatch");
}
if (i3 != i6 + i5) {
throw new WriterException("RS blocks mismatch");
}
if (i != ((i9 + i11) * i6) + ((i10 + i12) * i5)) {
throw new WriterException("Total bytes mismatch");
}
if (i4 < i6) {
iArr[0] = i9;
iArr2[0] = i11;
} else {
iArr[0] = i10;
iArr2[0] = i12;
}
}
public static BitArray interleaveWithECBytes(BitArray bitArray, int i, int i2, int i3) {
if (bitArray.getSizeInBytes() != i2) {
throw new WriterException("Number of bits and data bytes does not match");
}
ArrayList arrayList = new ArrayList(i3);
int i4 = 0;
int i5 = 0;
int i6 = 0;
for (int i7 = 0; i7 < i3; i7++) {
int[] iArr = new int[1];
int[] iArr2 = new int[1];
getNumDataBytesAndNumECBytesForBlockID(i, i2, i3, i7, iArr, iArr2);
int i8 = iArr[0];
byte[] bArr = new byte[i8];
bitArray.toBytes(i4 << 3, bArr, 0, i8);
byte[] generateECBytes = generateECBytes(bArr, iArr2[0]);
arrayList.add(new BlockPair(bArr, generateECBytes));
i5 = Math.max(i5, i8);
i6 = Math.max(i6, generateECBytes.length);
i4 += iArr[0];
}
if (i2 != i4) {
throw new WriterException("Data bytes does not match offset");
}
BitArray bitArray2 = new BitArray();
for (int i9 = 0; i9 < i5; i9++) {
Iterator it = arrayList.iterator();
while (it.hasNext()) {
byte[] dataBytes = ((BlockPair) it.next()).getDataBytes();
if (i9 < dataBytes.length) {
bitArray2.appendBits(dataBytes[i9], 8);
}
}
}
for (int i10 = 0; i10 < i6; i10++) {
Iterator it2 = arrayList.iterator();
while (it2.hasNext()) {
byte[] errorCorrectionBytes = ((BlockPair) it2.next()).getErrorCorrectionBytes();
if (i10 < errorCorrectionBytes.length) {
bitArray2.appendBits(errorCorrectionBytes[i10], 8);
}
}
}
if (i == bitArray2.getSizeInBytes()) {
return bitArray2;
}
throw new WriterException("Interleaving error: " + i + " and " + bitArray2.getSizeInBytes() + " differ.");
}
public static byte[] generateECBytes(byte[] bArr, int i) {
int length = bArr.length;
int[] iArr = new int[length + i];
for (int i2 = 0; i2 < length; i2++) {
iArr[i2] = bArr[i2] & 255;
}
new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256).encode(iArr, i);
byte[] bArr2 = new byte[i];
for (int i3 = 0; i3 < i; i3++) {
bArr2[i3] = (byte) iArr[length + i3];
}
return bArr2;
}
public static void appendModeInfo(Mode mode, BitArray bitArray) {
bitArray.appendBits(mode.getBits(), 4);
}
public static void appendLengthInfo(int i, Version version, Mode mode, BitArray bitArray) {
int characterCountBits = mode.getCharacterCountBits(version);
int i2 = 1 << characterCountBits;
if (i >= i2) {
throw new WriterException(i + " is bigger than " + (i2 - 1));
}
bitArray.appendBits(i, characterCountBits);
}
/* renamed from: com.google.zxing.qrcode.encoder.Encoder$1, reason: invalid class name */
public static /* synthetic */ class AnonymousClass1 {
public static final /* synthetic */ int[] $SwitchMap$com$google$zxing$qrcode$decoder$Mode;
static {
int[] iArr = new int[Mode.values().length];
$SwitchMap$com$google$zxing$qrcode$decoder$Mode = iArr;
try {
iArr[Mode.NUMERIC.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$google$zxing$qrcode$decoder$Mode[Mode.ALPHANUMERIC.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$google$zxing$qrcode$decoder$Mode[Mode.BYTE.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$com$google$zxing$qrcode$decoder$Mode[Mode.KANJI.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
}
}
public static void appendBytes(String str, Mode mode, BitArray bitArray, String str2) {
int i = AnonymousClass1.$SwitchMap$com$google$zxing$qrcode$decoder$Mode[mode.ordinal()];
if (i == 1) {
appendNumericBytes(str, bitArray);
return;
}
if (i == 2) {
appendAlphanumericBytes(str, bitArray);
} else if (i == 3) {
append8BitBytes(str, bitArray, str2);
} else {
if (i == 4) {
appendKanjiBytes(str, bitArray);
return;
}
throw new WriterException("Invalid mode: ".concat(String.valueOf(mode)));
}
}
public static void appendNumericBytes(CharSequence charSequence, BitArray bitArray) {
int length = charSequence.length();
int i = 0;
while (i < length) {
int charAt = charSequence.charAt(i) - '0';
int i2 = i + 2;
if (i2 < length) {
bitArray.appendBits((charAt * 100) + ((charSequence.charAt(i + 1) - '0') * 10) + (charSequence.charAt(i2) - '0'), 10);
i += 3;
} else {
i++;
if (i < length) {
bitArray.appendBits((charAt * 10) + (charSequence.charAt(i) - '0'), 7);
i = i2;
} else {
bitArray.appendBits(charAt, 4);
}
}
}
}
public static void appendAlphanumericBytes(CharSequence charSequence, BitArray bitArray) {
int length = charSequence.length();
int i = 0;
while (i < length) {
int alphanumericCode = getAlphanumericCode(charSequence.charAt(i));
if (alphanumericCode == -1) {
throw new WriterException();
}
int i2 = i + 1;
if (i2 < length) {
int alphanumericCode2 = getAlphanumericCode(charSequence.charAt(i2));
if (alphanumericCode2 == -1) {
throw new WriterException();
}
bitArray.appendBits((alphanumericCode * 45) + alphanumericCode2, 11);
i += 2;
} else {
bitArray.appendBits(alphanumericCode, 6);
i = i2;
}
}
}
public static void append8BitBytes(String str, BitArray bitArray, String str2) {
try {
for (byte b : str.getBytes(str2)) {
bitArray.appendBits(b, 8);
}
} catch (UnsupportedEncodingException e) {
throw new WriterException(e);
}
}
/* JADX WARN: Removed duplicated region for block: B:11:0x0035 A[LOOP:0: B:4:0x0008->B:11:0x0035, LOOP_END] */
/* JADX WARN: Removed duplicated region for block: B:12:0x0044 A[SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static void appendKanjiBytes(java.lang.String r6, com.google.zxing.common.BitArray r7) {
/*
java.lang.String r0 = "Shift_JIS"
byte[] r6 = r6.getBytes(r0) // Catch: java.io.UnsupportedEncodingException -> L4d
int r0 = r6.length
r1 = 0
L8:
if (r1 >= r0) goto L4c
r2 = r6[r1]
r2 = r2 & 255(0xff, float:3.57E-43)
int r3 = r1 + 1
r3 = r6[r3]
r3 = r3 & 255(0xff, float:3.57E-43)
int r2 = r2 << 8
r2 = r2 | r3
r3 = 33088(0x8140, float:4.6366E-41)
r4 = -1
if (r2 < r3) goto L24
r5 = 40956(0x9ffc, float:5.7392E-41)
if (r2 > r5) goto L24
L22:
int r2 = r2 - r3
goto L33
L24:
r3 = 57408(0xe040, float:8.0446E-41)
if (r2 < r3) goto L32
r3 = 60351(0xebbf, float:8.457E-41)
if (r2 > r3) goto L32
r3 = 49472(0xc140, float:6.9325E-41)
goto L22
L32:
r2 = r4
L33:
if (r2 == r4) goto L44
int r3 = r2 >> 8
int r3 = r3 * 192
r2 = r2 & 255(0xff, float:3.57E-43)
int r3 = r3 + r2
r2 = 13
r7.appendBits(r3, r2)
int r1 = r1 + 2
goto L8
L44:
com.google.zxing.WriterException r6 = new com.google.zxing.WriterException
java.lang.String r7 = "Invalid byte sequence"
r6.<init>(r7)
throw r6
L4c:
return
L4d:
r6 = move-exception
com.google.zxing.WriterException r7 = new com.google.zxing.WriterException
r7.<init>(r6)
throw r7
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.qrcode.encoder.Encoder.appendKanjiBytes(java.lang.String, com.google.zxing.common.BitArray):void");
}
public static void appendECI(CharacterSetECI characterSetECI, BitArray bitArray) {
bitArray.appendBits(Mode.ECI.getBits(), 4);
bitArray.appendBits(characterSetECI.getValue(), 8);
}
}

View File

@@ -0,0 +1,189 @@
package com.google.zxing.qrcode.encoder;
/* loaded from: classes3.dex */
public abstract class MaskUtil {
public static int applyMaskPenaltyRule1(ByteMatrix byteMatrix) {
return applyMaskPenaltyRule1Internal(byteMatrix, true) + applyMaskPenaltyRule1Internal(byteMatrix, false);
}
public static int applyMaskPenaltyRule2(ByteMatrix byteMatrix) {
byte[][] array = byteMatrix.getArray();
int width = byteMatrix.getWidth();
int height = byteMatrix.getHeight();
int i = 0;
for (int i2 = 0; i2 < height - 1; i2++) {
byte[] bArr = array[i2];
int i3 = 0;
while (i3 < width - 1) {
byte b = bArr[i3];
int i4 = i3 + 1;
if (b == bArr[i4]) {
byte[] bArr2 = array[i2 + 1];
if (b == bArr2[i3] && b == bArr2[i4]) {
i++;
}
}
i3 = i4;
}
}
return i * 3;
}
public static int applyMaskPenaltyRule3(ByteMatrix byteMatrix) {
byte[][] array = byteMatrix.getArray();
int width = byteMatrix.getWidth();
int height = byteMatrix.getHeight();
int i = 0;
for (int i2 = 0; i2 < height; i2++) {
for (int i3 = 0; i3 < width; i3++) {
byte[] bArr = array[i2];
int i4 = i3 + 6;
if (i4 < width && bArr[i3] == 1 && bArr[i3 + 1] == 0 && bArr[i3 + 2] == 1 && bArr[i3 + 3] == 1 && bArr[i3 + 4] == 1 && bArr[i3 + 5] == 0 && bArr[i4] == 1 && (isWhiteHorizontal(bArr, i3 - 4, i3) || isWhiteHorizontal(bArr, i3 + 7, i3 + 11))) {
i++;
}
int i5 = i2 + 6;
if (i5 < height && array[i2][i3] == 1 && array[i2 + 1][i3] == 0 && array[i2 + 2][i3] == 1 && array[i2 + 3][i3] == 1 && array[i2 + 4][i3] == 1 && array[i2 + 5][i3] == 0 && array[i5][i3] == 1 && (isWhiteVertical(array, i3, i2 - 4, i2) || isWhiteVertical(array, i3, i2 + 7, i2 + 11))) {
i++;
}
}
}
return i * 40;
}
public static boolean isWhiteHorizontal(byte[] bArr, int i, int i2) {
int min = Math.min(i2, bArr.length);
for (int max = Math.max(i, 0); max < min; max++) {
if (bArr[max] == 1) {
return false;
}
}
return true;
}
public static boolean isWhiteVertical(byte[][] bArr, int i, int i2, int i3) {
int min = Math.min(i3, bArr.length);
for (int max = Math.max(i2, 0); max < min; max++) {
if (bArr[max][i] == 1) {
return false;
}
}
return true;
}
public static int applyMaskPenaltyRule4(ByteMatrix byteMatrix) {
byte[][] array = byteMatrix.getArray();
int width = byteMatrix.getWidth();
int height = byteMatrix.getHeight();
int i = 0;
for (int i2 = 0; i2 < height; i2++) {
byte[] bArr = array[i2];
for (int i3 = 0; i3 < width; i3++) {
if (bArr[i3] == 1) {
i++;
}
}
}
int height2 = byteMatrix.getHeight() * byteMatrix.getWidth();
return ((Math.abs((i << 1) - height2) * 10) / height2) * 10;
}
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
/* JADX WARN: Removed duplicated region for block: B:10:0x003d A[RETURN] */
/* JADX WARN: Removed duplicated region for block: B:9:0x003c A[RETURN] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static boolean getDataMaskBit(int r1, int r2, int r3) {
/*
r0 = 1
switch(r1) {
case 0: goto L30;
case 1: goto L31;
case 2: goto L38;
case 3: goto L34;
case 4: goto L2c;
case 5: goto L25;
case 6: goto L1e;
case 7: goto L14;
default: goto L4;
}
L4:
java.lang.IllegalArgumentException r2 = new java.lang.IllegalArgumentException
java.lang.String r3 = "Invalid mask pattern: "
java.lang.String r1 = java.lang.String.valueOf(r1)
java.lang.String r1 = r3.concat(r1)
r2.<init>(r1)
throw r2
L14:
int r1 = r3 * r2
int r1 = r1 % 3
int r3 = r3 + r2
r2 = r3 & 1
int r1 = r1 + r2
L1c:
r1 = r1 & r0
goto L3a
L1e:
int r3 = r3 * r2
r1 = r3 & 1
int r3 = r3 % 3
int r1 = r1 + r3
goto L1c
L25:
int r3 = r3 * r2
r1 = r3 & 1
int r3 = r3 % 3
int r1 = r1 + r3
goto L3a
L2c:
int r3 = r3 / 2
int r2 = r2 / 3
L30:
int r3 = r3 + r2
L31:
r1 = r3 & 1
goto L3a
L34:
int r3 = r3 + r2
int r1 = r3 % 3
goto L3a
L38:
int r1 = r2 % 3
L3a:
if (r1 != 0) goto L3d
return r0
L3d:
r1 = 0
return r1
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.qrcode.encoder.MaskUtil.getDataMaskBit(int, int, int):boolean");
}
public static int applyMaskPenaltyRule1Internal(ByteMatrix byteMatrix, boolean z) {
int height = z ? byteMatrix.getHeight() : byteMatrix.getWidth();
int width = z ? byteMatrix.getWidth() : byteMatrix.getHeight();
byte[][] array = byteMatrix.getArray();
int i = 0;
for (int i2 = 0; i2 < height; i2++) {
byte b = -1;
int i3 = 0;
for (int i4 = 0; i4 < width; i4++) {
byte b2 = z ? array[i2][i4] : array[i4][i2];
if (b2 == b) {
i3++;
} else {
if (i3 >= 5) {
i += i3 - 2;
}
i3 = 1;
b = b2;
}
}
if (i3 >= 5) {
i += i3 - 2;
}
}
return i;
}
}

View File

@@ -0,0 +1,238 @@
package com.google.zxing.qrcode.encoder;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitArray;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import com.google.zxing.qrcode.decoder.Version;
import com.ironsource.mediationsdk.utils.IronSourceConstants;
/* loaded from: classes3.dex */
public abstract class MatrixUtil {
public static final int[][] POSITION_DETECTION_PATTERN = {new int[]{1, 1, 1, 1, 1, 1, 1}, new int[]{1, 0, 0, 0, 0, 0, 1}, new int[]{1, 0, 1, 1, 1, 0, 1}, new int[]{1, 0, 1, 1, 1, 0, 1}, new int[]{1, 0, 1, 1, 1, 0, 1}, new int[]{1, 0, 0, 0, 0, 0, 1}, new int[]{1, 1, 1, 1, 1, 1, 1}};
public static final int[][] POSITION_ADJUSTMENT_PATTERN = {new int[]{1, 1, 1, 1, 1}, new int[]{1, 0, 0, 0, 1}, new int[]{1, 0, 1, 0, 1}, new int[]{1, 0, 0, 0, 1}, new int[]{1, 1, 1, 1, 1}};
public static final int[][] POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE = {new int[]{-1, -1, -1, -1, -1, -1, -1}, new int[]{6, 18, -1, -1, -1, -1, -1}, new int[]{6, 22, -1, -1, -1, -1, -1}, new int[]{6, 26, -1, -1, -1, -1, -1}, new int[]{6, 30, -1, -1, -1, -1, -1}, new int[]{6, 34, -1, -1, -1, -1, -1}, new int[]{6, 22, 38, -1, -1, -1, -1}, new int[]{6, 24, 42, -1, -1, -1, -1}, new int[]{6, 26, 46, -1, -1, -1, -1}, new int[]{6, 28, 50, -1, -1, -1, -1}, new int[]{6, 30, 54, -1, -1, -1, -1}, new int[]{6, 32, 58, -1, -1, -1, -1}, new int[]{6, 34, 62, -1, -1, -1, -1}, new int[]{6, 26, 46, 66, -1, -1, -1}, new int[]{6, 26, 48, 70, -1, -1, -1}, new int[]{6, 26, 50, 74, -1, -1, -1}, new int[]{6, 30, 54, 78, -1, -1, -1}, new int[]{6, 30, 56, 82, -1, -1, -1}, new int[]{6, 30, 58, 86, -1, -1, -1}, new int[]{6, 34, 62, 90, -1, -1, -1}, new int[]{6, 28, 50, 72, 94, -1, -1}, new int[]{6, 26, 50, 74, 98, -1, -1}, new int[]{6, 30, 54, 78, 102, -1, -1}, new int[]{6, 28, 54, 80, 106, -1, -1}, new int[]{6, 32, 58, 84, 110, -1, -1}, new int[]{6, 30, 58, 86, 114, -1, -1}, new int[]{6, 34, 62, 90, 118, -1, -1}, new int[]{6, 26, 50, 74, 98, 122, -1}, new int[]{6, 30, 54, 78, 102, 126, -1}, new int[]{6, 26, 52, 78, 104, 130, -1}, new int[]{6, 30, 56, 82, 108, 134, -1}, new int[]{6, 34, 60, 86, 112, 138, -1}, new int[]{6, 30, 58, 86, 114, 142, -1}, new int[]{6, 34, 62, 90, 118, 146, -1}, new int[]{6, 30, 54, 78, 102, 126, IronSourceConstants.REWARDED_VIDEO_DAILY_CAPPED}, new int[]{6, 24, 50, 76, 102, 128, 154}, new int[]{6, 28, 54, 80, 106, 132, 158}, new int[]{6, 32, 58, 84, 110, 136, 162}, new int[]{6, 26, 54, 82, 110, 138, 166}, new int[]{6, 30, 58, 86, 114, 142, 170}};
public static final int[][] TYPE_INFO_COORDINATES = {new int[]{8, 0}, new int[]{8, 1}, new int[]{8, 2}, new int[]{8, 3}, new int[]{8, 4}, new int[]{8, 5}, new int[]{8, 7}, new int[]{8, 8}, new int[]{7, 8}, new int[]{5, 8}, new int[]{4, 8}, new int[]{3, 8}, new int[]{2, 8}, new int[]{1, 8}, new int[]{0, 8}};
public static boolean isEmpty(int i) {
return i == -1;
}
public static void clearMatrix(ByteMatrix byteMatrix) {
byteMatrix.clear((byte) -1);
}
public static void buildMatrix(BitArray bitArray, ErrorCorrectionLevel errorCorrectionLevel, Version version, int i, ByteMatrix byteMatrix) {
clearMatrix(byteMatrix);
embedBasicPatterns(version, byteMatrix);
embedTypeInfo(errorCorrectionLevel, i, byteMatrix);
maybeEmbedVersionInfo(version, byteMatrix);
embedDataBits(bitArray, i, byteMatrix);
}
public static void embedBasicPatterns(Version version, ByteMatrix byteMatrix) {
embedPositionDetectionPatternsAndSeparators(byteMatrix);
embedDarkDotAtLeftBottomCorner(byteMatrix);
maybeEmbedPositionAdjustmentPatterns(version, byteMatrix);
embedTimingPatterns(byteMatrix);
}
public static void embedTypeInfo(ErrorCorrectionLevel errorCorrectionLevel, int i, ByteMatrix byteMatrix) {
BitArray bitArray = new BitArray();
makeTypeInfoBits(errorCorrectionLevel, i, bitArray);
for (int i2 = 0; i2 < bitArray.getSize(); i2++) {
boolean z = bitArray.get((bitArray.getSize() - 1) - i2);
int[] iArr = TYPE_INFO_COORDINATES[i2];
byteMatrix.set(iArr[0], iArr[1], z);
if (i2 < 8) {
byteMatrix.set((byteMatrix.getWidth() - i2) - 1, 8, z);
} else {
byteMatrix.set(8, (byteMatrix.getHeight() - 7) + (i2 - 8), z);
}
}
}
public static void maybeEmbedVersionInfo(Version version, ByteMatrix byteMatrix) {
if (version.getVersionNumber() < 7) {
return;
}
BitArray bitArray = new BitArray();
makeVersionInfoBits(version, bitArray);
int i = 17;
for (int i2 = 0; i2 < 6; i2++) {
for (int i3 = 0; i3 < 3; i3++) {
boolean z = bitArray.get(i);
i--;
byteMatrix.set(i2, (byteMatrix.getHeight() - 11) + i3, z);
byteMatrix.set((byteMatrix.getHeight() - 11) + i3, i2, z);
}
}
}
public static void embedDataBits(BitArray bitArray, int i, ByteMatrix byteMatrix) {
boolean z;
int width = byteMatrix.getWidth() - 1;
int height = byteMatrix.getHeight() - 1;
int i2 = 0;
int i3 = -1;
while (width > 0) {
if (width == 6) {
width--;
}
while (height >= 0 && height < byteMatrix.getHeight()) {
for (int i4 = 0; i4 < 2; i4++) {
int i5 = width - i4;
if (isEmpty(byteMatrix.get(i5, height))) {
if (i2 < bitArray.getSize()) {
z = bitArray.get(i2);
i2++;
} else {
z = false;
}
if (i != -1 && MaskUtil.getDataMaskBit(i, i5, height)) {
z = !z;
}
byteMatrix.set(i5, height, z);
}
}
height += i3;
}
i3 = -i3;
height += i3;
width -= 2;
}
if (i2 == bitArray.getSize()) {
return;
}
throw new WriterException("Not all bits consumed: " + i2 + '/' + bitArray.getSize());
}
public static int findMSBSet(int i) {
return 32 - Integer.numberOfLeadingZeros(i);
}
public static int calculateBCHCode(int i, int i2) {
if (i2 == 0) {
throw new IllegalArgumentException("0 polynomial");
}
int findMSBSet = findMSBSet(i2);
int i3 = i << (findMSBSet - 1);
while (findMSBSet(i3) >= findMSBSet) {
i3 ^= i2 << (findMSBSet(i3) - findMSBSet);
}
return i3;
}
public static void makeTypeInfoBits(ErrorCorrectionLevel errorCorrectionLevel, int i, BitArray bitArray) {
if (!QRCode.isValidMaskPattern(i)) {
throw new WriterException("Invalid mask pattern");
}
int bits = (errorCorrectionLevel.getBits() << 3) | i;
bitArray.appendBits(bits, 5);
bitArray.appendBits(calculateBCHCode(bits, 1335), 10);
BitArray bitArray2 = new BitArray();
bitArray2.appendBits(21522, 15);
bitArray.xor(bitArray2);
if (bitArray.getSize() == 15) {
return;
}
throw new WriterException("should not happen but we got: " + bitArray.getSize());
}
public static void makeVersionInfoBits(Version version, BitArray bitArray) {
bitArray.appendBits(version.getVersionNumber(), 6);
bitArray.appendBits(calculateBCHCode(version.getVersionNumber(), 7973), 12);
if (bitArray.getSize() == 18) {
return;
}
throw new WriterException("should not happen but we got: " + bitArray.getSize());
}
public static void embedTimingPatterns(ByteMatrix byteMatrix) {
int i = 8;
while (i < byteMatrix.getWidth() - 8) {
int i2 = i + 1;
int i3 = i2 % 2;
if (isEmpty(byteMatrix.get(i, 6))) {
byteMatrix.set(i, 6, i3);
}
if (isEmpty(byteMatrix.get(6, i))) {
byteMatrix.set(6, i, i3);
}
i = i2;
}
}
public static void embedDarkDotAtLeftBottomCorner(ByteMatrix byteMatrix) {
if (byteMatrix.get(8, byteMatrix.getHeight() - 8) == 0) {
throw new WriterException();
}
byteMatrix.set(8, byteMatrix.getHeight() - 8, 1);
}
public static void embedHorizontalSeparationPattern(int i, int i2, ByteMatrix byteMatrix) {
for (int i3 = 0; i3 < 8; i3++) {
int i4 = i + i3;
if (!isEmpty(byteMatrix.get(i4, i2))) {
throw new WriterException();
}
byteMatrix.set(i4, i2, 0);
}
}
public static void embedVerticalSeparationPattern(int i, int i2, ByteMatrix byteMatrix) {
for (int i3 = 0; i3 < 7; i3++) {
int i4 = i2 + i3;
if (!isEmpty(byteMatrix.get(i, i4))) {
throw new WriterException();
}
byteMatrix.set(i, i4, 0);
}
}
public static void embedPositionAdjustmentPattern(int i, int i2, ByteMatrix byteMatrix) {
for (int i3 = 0; i3 < 5; i3++) {
int[] iArr = POSITION_ADJUSTMENT_PATTERN[i3];
for (int i4 = 0; i4 < 5; i4++) {
byteMatrix.set(i + i4, i2 + i3, iArr[i4]);
}
}
}
public static void embedPositionDetectionPattern(int i, int i2, ByteMatrix byteMatrix) {
for (int i3 = 0; i3 < 7; i3++) {
int[] iArr = POSITION_DETECTION_PATTERN[i3];
for (int i4 = 0; i4 < 7; i4++) {
byteMatrix.set(i + i4, i2 + i3, iArr[i4]);
}
}
}
public static void embedPositionDetectionPatternsAndSeparators(ByteMatrix byteMatrix) {
int length = POSITION_DETECTION_PATTERN[0].length;
embedPositionDetectionPattern(0, 0, byteMatrix);
embedPositionDetectionPattern(byteMatrix.getWidth() - length, 0, byteMatrix);
embedPositionDetectionPattern(0, byteMatrix.getWidth() - length, byteMatrix);
embedHorizontalSeparationPattern(0, 7, byteMatrix);
embedHorizontalSeparationPattern(byteMatrix.getWidth() - 8, 7, byteMatrix);
embedHorizontalSeparationPattern(0, byteMatrix.getWidth() - 8, byteMatrix);
embedVerticalSeparationPattern(7, 0, byteMatrix);
embedVerticalSeparationPattern(byteMatrix.getHeight() - 8, 0, byteMatrix);
embedVerticalSeparationPattern(7, byteMatrix.getHeight() - 7, byteMatrix);
}
public static void maybeEmbedPositionAdjustmentPatterns(Version version, ByteMatrix byteMatrix) {
if (version.getVersionNumber() < 2) {
return;
}
int[] iArr = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[version.getVersionNumber() - 1];
for (int i : iArr) {
if (i >= 0) {
for (int i2 : iArr) {
if (i2 >= 0 && isEmpty(byteMatrix.get(i2, i))) {
embedPositionAdjustmentPattern(i2 - 2, i - 2, byteMatrix);
}
}
}
}
}
}

View File

@@ -0,0 +1,63 @@
package com.google.zxing.qrcode.encoder;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import com.google.zxing.qrcode.decoder.Mode;
import com.google.zxing.qrcode.decoder.Version;
/* loaded from: classes3.dex */
public final class QRCode {
public ErrorCorrectionLevel ecLevel;
public int maskPattern = -1;
public ByteMatrix matrix;
public Mode mode;
public Version version;
public static boolean isValidMaskPattern(int i) {
return i >= 0 && i < 8;
}
public ByteMatrix getMatrix() {
return this.matrix;
}
public void setECLevel(ErrorCorrectionLevel errorCorrectionLevel) {
this.ecLevel = errorCorrectionLevel;
}
public void setMaskPattern(int i) {
this.maskPattern = i;
}
public void setMatrix(ByteMatrix byteMatrix) {
this.matrix = byteMatrix;
}
public void setMode(Mode mode) {
this.mode = mode;
}
public void setVersion(Version version) {
this.version = version;
}
public String toString() {
StringBuilder sb = new StringBuilder(200);
sb.append("<<\n");
sb.append(" mode: ");
sb.append(this.mode);
sb.append("\n ecLevel: ");
sb.append(this.ecLevel);
sb.append("\n version: ");
sb.append(this.version);
sb.append("\n maskPattern: ");
sb.append(this.maskPattern);
if (this.matrix == null) {
sb.append("\n matrix: null\n");
} else {
sb.append("\n matrix:\n");
sb.append(this.matrix);
}
sb.append(">>\n");
return sb.toString();
}
}