imatrix-ui 2.8.97-dw-tmp2 → 2.8.97-dw-tmp4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/super-ui.css +1 -0
- package/lib/super-ui.umd.min.js +36 -1
- package/package.json +1 -2
- package/src/i18n/i18n.js +1 -1
- package/src/i18n/langs/cn.js +1 -1
- package/src/i18n/langs/en.js +1 -1
- package/src/permission.js +1 -1
- package/src/plugins.js +4 -4
- package/src/store/modules/permission.js +5 -0
- package/src/styles/index.scss +2 -2
- package/src/utils/permissionAuth.js +6 -0
- package/src/utils/request.js +1 -1
- package/src/views/login/index.vue +1 -1
- package/lib/css/super-ui.common~46f24e9d.f712732a.css +0 -1
- package/lib/css/super-ui.common~60a56baa.e6f54088.css +0 -1
- package/lib/css/super-ui.common~691e02b5.3387eefb.css +0 -1
- package/lib/css/super-ui.common~e2e93592.e9ec19a9.css +0 -1
- package/lib/css/super-ui.umd.min~46f24e9d.f712732a.css +0 -1
- package/lib/css/super-ui.umd.min~60a56baa.e6f54088.css +0 -1
- package/lib/css/super-ui.umd.min~691e02b5.3387eefb.css +0 -1
- package/lib/css/super-ui.umd.min~e2e93592.e9ec19a9.css +0 -1
- package/lib/css/super-ui.umd~46f24e9d.f712732a.css +0 -1
- package/lib/css/super-ui.umd~60a56baa.e6f54088.css +0 -1
- package/lib/css/super-ui.umd~691e02b5.3387eefb.css +0 -1
- package/lib/css/super-ui.umd~e2e93592.e9ec19a9.css +0 -1
- package/lib/css/vendors~super-ui.common~253ae210.b57e4bfb.css +0 -1
- package/lib/css/vendors~super-ui.umd.min~253ae210.b57e4bfb.css +0 -1
- package/lib/css/vendors~super-ui.umd~253ae210.b57e4bfb.css +0 -1
- package/lib/css/yarn.tinymce~97d7b732.ea366551.css +0 -1
- package/lib/super-ui.common.super-ui.common~46f24e9d.js +0 -12446
- package/lib/super-ui.common.super-ui.common~60a56baa.js +0 -2774
- package/lib/super-ui.common.super-ui.common~691e02b5.js +0 -3062
- package/lib/super-ui.common.super-ui.common~970f9218.js +0 -3729
- package/lib/super-ui.common.super-ui.common~bd3594d6.js +0 -5264
- package/lib/super-ui.common.super-ui.common~e2e93592.js +0 -6945
- package/lib/super-ui.common.vendors~super-ui.common~253ae210.js +0 -3504
- package/lib/super-ui.common.yarn.async-validator~7864cd12.js +0 -1225
- package/lib/super-ui.common.yarn.core-js~2b13b260.js +0 -7542
- package/lib/super-ui.common.yarn.gcommon~c5c7b9b4.js +0 -11
- package/lib/super-ui.common.yarn.gcommon~cd278a5f.js +0 -4846
- package/lib/super-ui.common.yarn.resize-observer-polyfill~7370204d.js +0 -942
- package/lib/super-ui.common.yarn.sortablejs~f811d8fd.js +0 -3714
- package/lib/super-ui.common.yarn.tinymce~253ae210.js +0 -568
- package/lib/super-ui.common.yarn.tinymce~29bc5d46.js +0 -2125
- package/lib/super-ui.common.yarn.tinymce~35f50c21.js +0 -34090
- package/lib/super-ui.common.yarn.tinymce~8a52df3b.js +0 -30088
- package/lib/super-ui.common.yarn.tinymce~97d7b732.js +0 -31
- package/lib/super-ui.common.yarn.tinymce~b5d80f29.js +0 -7936
- package/lib/super-ui.common.yarn.tinymce~c1068939.js +0 -13346
- package/lib/super-ui.common.yarn.vue-i18n~02576867.js +0 -2179
- package/lib/super-ui.common.yarn.vue-virtual-scroll-list~bd67cfcd.js +0 -1069
- package/lib/super-ui.common.yarn.zxing~3446ce64.js +0 -11996
- package/lib/super-ui.common.yarn.zxing~61a1471b.js +0 -11202
- package/lib/super-ui.common.yarn.zxing~b49f3034.js +0 -3576
- package/lib/super-ui.common.yarn.zxing~fd3cc9f3.js +0 -2916
- package/lib/super-ui.umd.min.super-ui.umd.min~46f24e9d.js +0 -2
- package/lib/super-ui.umd.min.super-ui.umd.min~60a56baa.js +0 -2
- package/lib/super-ui.umd.min.super-ui.umd.min~691e02b5.js +0 -2
- package/lib/super-ui.umd.min.super-ui.umd.min~970f9218.js +0 -2
- package/lib/super-ui.umd.min.super-ui.umd.min~bd3594d6.js +0 -2
- package/lib/super-ui.umd.min.super-ui.umd.min~e2e93592.js +0 -2
- package/lib/super-ui.umd.min.vendors~super-ui.umd.min~253ae210.js +0 -24
- package/lib/super-ui.umd.min.yarn.async-validator~7864cd12.js +0 -2
- package/lib/super-ui.umd.min.yarn.core-js~2b13b260.js +0 -2
- package/lib/super-ui.umd.min.yarn.gcommon~c5c7b9b4.js +0 -2
- package/lib/super-ui.umd.min.yarn.gcommon~cd278a5f.js +0 -26
- package/lib/super-ui.umd.min.yarn.resize-observer-polyfill~7370204d.js +0 -2
- package/lib/super-ui.umd.min.yarn.sortablejs~f811d8fd.js +0 -8
- package/lib/super-ui.umd.min.yarn.tinymce~253ae210.js +0 -2
- package/lib/super-ui.umd.min.yarn.tinymce~29bc5d46.js +0 -2
- package/lib/super-ui.umd.min.yarn.tinymce~35f50c21.js +0 -2
- package/lib/super-ui.umd.min.yarn.tinymce~8a52df3b.js +0 -2
- package/lib/super-ui.umd.min.yarn.tinymce~97d7b732.js +0 -2
- package/lib/super-ui.umd.min.yarn.tinymce~b5d80f29.js +0 -2
- package/lib/super-ui.umd.min.yarn.tinymce~c1068939.js +0 -2
- package/lib/super-ui.umd.min.yarn.vue-i18n~02576867.js +0 -7
- package/lib/super-ui.umd.min.yarn.vue-virtual-scroll-list~bd67cfcd.js +0 -8
- package/lib/super-ui.umd.min.yarn.zxing~3446ce64.js +0 -2
- package/lib/super-ui.umd.min.yarn.zxing~61a1471b.js +0 -2
- package/lib/super-ui.umd.min.yarn.zxing~b49f3034.js +0 -2
- package/lib/super-ui.umd.min.yarn.zxing~fd3cc9f3.js +0 -2
- package/lib/super-ui.umd.super-ui.umd~46f24e9d.js +0 -12446
- package/lib/super-ui.umd.super-ui.umd~60a56baa.js +0 -2774
- package/lib/super-ui.umd.super-ui.umd~691e02b5.js +0 -3062
- package/lib/super-ui.umd.super-ui.umd~970f9218.js +0 -3739
- package/lib/super-ui.umd.super-ui.umd~bd3594d6.js +0 -5264
- package/lib/super-ui.umd.super-ui.umd~e2e93592.js +0 -6945
- package/lib/super-ui.umd.vendors~super-ui.umd~253ae210.js +0 -3504
- package/lib/super-ui.umd.yarn.async-validator~7864cd12.js +0 -1225
- package/lib/super-ui.umd.yarn.core-js~2b13b260.js +0 -7542
- package/lib/super-ui.umd.yarn.gcommon~c5c7b9b4.js +0 -11
- package/lib/super-ui.umd.yarn.gcommon~cd278a5f.js +0 -4846
- package/lib/super-ui.umd.yarn.resize-observer-polyfill~7370204d.js +0 -942
- package/lib/super-ui.umd.yarn.sortablejs~f811d8fd.js +0 -3714
- package/lib/super-ui.umd.yarn.tinymce~253ae210.js +0 -568
- package/lib/super-ui.umd.yarn.tinymce~29bc5d46.js +0 -2125
- package/lib/super-ui.umd.yarn.tinymce~35f50c21.js +0 -34090
- package/lib/super-ui.umd.yarn.tinymce~8a52df3b.js +0 -30088
- package/lib/super-ui.umd.yarn.tinymce~97d7b732.js +0 -31
- package/lib/super-ui.umd.yarn.tinymce~b5d80f29.js +0 -7936
- package/lib/super-ui.umd.yarn.tinymce~c1068939.js +0 -13346
- package/lib/super-ui.umd.yarn.vue-i18n~02576867.js +0 -2179
- package/lib/super-ui.umd.yarn.vue-virtual-scroll-list~bd67cfcd.js +0 -1069
- package/lib/super-ui.umd.yarn.zxing~3446ce64.js +0 -11996
- package/lib/super-ui.umd.yarn.zxing~61a1471b.js +0 -11202
- package/lib/super-ui.umd.yarn.zxing~b49f3034.js +0 -3576
- package/lib/super-ui.umd.yarn.zxing~fd3cc9f3.js +0 -2916
|
@@ -1,2916 +0,0 @@
|
|
|
1
|
-
((typeof self !== 'undefined' ? self : this)["webpackJsonpsuper_ui"] = (typeof self !== 'undefined' ? self : this)["webpackJsonpsuper_ui"] || []).push([[26],{
|
|
2
|
-
|
|
3
|
-
/***/ "08a0":
|
|
4
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
5
|
-
|
|
6
|
-
"use strict";
|
|
7
|
-
/* harmony import */ var _common_DecoderResult__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("a652");
|
|
8
|
-
/* harmony import */ var _common_reedsolomon_GenericGF__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("547e");
|
|
9
|
-
/* harmony import */ var _common_reedsolomon_ReedSolomonDecoder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("34c8");
|
|
10
|
-
/* harmony import */ var _IllegalStateException__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("9cca");
|
|
11
|
-
/* harmony import */ var _FormatException__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("7978");
|
|
12
|
-
/* harmony import */ var _common_StringUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("f823");
|
|
13
|
-
/* harmony import */ var _util_Integer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("ea29");
|
|
14
|
-
/*
|
|
15
|
-
* Copyright 2010 ZXing authors
|
|
16
|
-
*
|
|
17
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
18
|
-
* you may not use this file except in compliance with the License.
|
|
19
|
-
* You may obtain a copy of the License at
|
|
20
|
-
*
|
|
21
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
-
*
|
|
23
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
24
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
25
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26
|
-
* See the License for the specific language governing permissions and
|
|
27
|
-
* limitations under the License.
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// import java.util.Arrays;
|
|
37
|
-
var Table;
|
|
38
|
-
(function (Table) {
|
|
39
|
-
Table[Table["UPPER"] = 0] = "UPPER";
|
|
40
|
-
Table[Table["LOWER"] = 1] = "LOWER";
|
|
41
|
-
Table[Table["MIXED"] = 2] = "MIXED";
|
|
42
|
-
Table[Table["DIGIT"] = 3] = "DIGIT";
|
|
43
|
-
Table[Table["PUNCT"] = 4] = "PUNCT";
|
|
44
|
-
Table[Table["BINARY"] = 5] = "BINARY";
|
|
45
|
-
})(Table || (Table = {}));
|
|
46
|
-
/**
|
|
47
|
-
* <p>The main class which implements Aztec Code decoding -- as opposed to locating and extracting
|
|
48
|
-
* the Aztec Code from an image.</p>
|
|
49
|
-
*
|
|
50
|
-
* @author David Olivier
|
|
51
|
-
*/
|
|
52
|
-
var Decoder = /** @class */ (function () {
|
|
53
|
-
function Decoder() {
|
|
54
|
-
}
|
|
55
|
-
Decoder.prototype.decode = function (detectorResult) {
|
|
56
|
-
this.ddata = detectorResult;
|
|
57
|
-
var matrix = detectorResult.getBits();
|
|
58
|
-
var rawbits = this.extractBits(matrix);
|
|
59
|
-
var correctedBits = this.correctBits(rawbits);
|
|
60
|
-
var rawBytes = Decoder.convertBoolArrayToByteArray(correctedBits);
|
|
61
|
-
var result = Decoder.getEncodedData(correctedBits);
|
|
62
|
-
var decoderResult = new _common_DecoderResult__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](rawBytes, result, null, null);
|
|
63
|
-
decoderResult.setNumBits(correctedBits.length);
|
|
64
|
-
return decoderResult;
|
|
65
|
-
};
|
|
66
|
-
// This method is used for testing the high-level encoder
|
|
67
|
-
Decoder.highLevelDecode = function (correctedBits) {
|
|
68
|
-
return this.getEncodedData(correctedBits);
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Gets the string encoded in the aztec code bits
|
|
72
|
-
*
|
|
73
|
-
* @return the decoded string
|
|
74
|
-
*/
|
|
75
|
-
Decoder.getEncodedData = function (correctedBits) {
|
|
76
|
-
var endIndex = correctedBits.length;
|
|
77
|
-
var latchTable = Table.UPPER; // table most recently latched to
|
|
78
|
-
var shiftTable = Table.UPPER; // table to use for the next read
|
|
79
|
-
var result = '';
|
|
80
|
-
var index = 0;
|
|
81
|
-
while (index < endIndex) {
|
|
82
|
-
if (shiftTable === Table.BINARY) {
|
|
83
|
-
if (endIndex - index < 5) {
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
var length_1 = Decoder.readCode(correctedBits, index, 5);
|
|
87
|
-
index += 5;
|
|
88
|
-
if (length_1 === 0) {
|
|
89
|
-
if (endIndex - index < 11) {
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
length_1 = Decoder.readCode(correctedBits, index, 11) + 31;
|
|
93
|
-
index += 11;
|
|
94
|
-
}
|
|
95
|
-
for (var charCount = 0; charCount < length_1; charCount++) {
|
|
96
|
-
if (endIndex - index < 8) {
|
|
97
|
-
index = endIndex; // Force outer loop to exit
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
var code = Decoder.readCode(correctedBits, index, 8);
|
|
101
|
-
result += /*(char)*/ _common_StringUtils__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].castAsNonUtf8Char(code);
|
|
102
|
-
index += 8;
|
|
103
|
-
}
|
|
104
|
-
// Go back to whatever mode we had been in
|
|
105
|
-
shiftTable = latchTable;
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
var size = shiftTable === Table.DIGIT ? 4 : 5;
|
|
109
|
-
if (endIndex - index < size) {
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
var code = Decoder.readCode(correctedBits, index, size);
|
|
113
|
-
index += size;
|
|
114
|
-
var str = Decoder.getCharacter(shiftTable, code);
|
|
115
|
-
if (str.startsWith('CTRL_')) {
|
|
116
|
-
// Table changes
|
|
117
|
-
// ISO/IEC 24778:2008 prescribes ending a shift sequence in the mode from which it was invoked.
|
|
118
|
-
// That's including when that mode is a shift.
|
|
119
|
-
// Our test case dlusbs.png for issue #642 exercises that.
|
|
120
|
-
latchTable = shiftTable; // Latch the current mode, so as to return to Upper after U/S B/S
|
|
121
|
-
shiftTable = Decoder.getTable(str.charAt(5));
|
|
122
|
-
if (str.charAt(6) === 'L') {
|
|
123
|
-
latchTable = shiftTable;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
result += str;
|
|
128
|
-
// Go back to whatever mode we had been in
|
|
129
|
-
shiftTable = latchTable;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return result;
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* gets the table corresponding to the char passed
|
|
137
|
-
*/
|
|
138
|
-
Decoder.getTable = function (t) {
|
|
139
|
-
switch (t) {
|
|
140
|
-
case 'L':
|
|
141
|
-
return Table.LOWER;
|
|
142
|
-
case 'P':
|
|
143
|
-
return Table.PUNCT;
|
|
144
|
-
case 'M':
|
|
145
|
-
return Table.MIXED;
|
|
146
|
-
case 'D':
|
|
147
|
-
return Table.DIGIT;
|
|
148
|
-
case 'B':
|
|
149
|
-
return Table.BINARY;
|
|
150
|
-
case 'U':
|
|
151
|
-
default:
|
|
152
|
-
return Table.UPPER;
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
/**
|
|
156
|
-
* Gets the character (or string) corresponding to the passed code in the given table
|
|
157
|
-
*
|
|
158
|
-
* @param table the table used
|
|
159
|
-
* @param code the code of the character
|
|
160
|
-
*/
|
|
161
|
-
Decoder.getCharacter = function (table, code) {
|
|
162
|
-
switch (table) {
|
|
163
|
-
case Table.UPPER:
|
|
164
|
-
return Decoder.UPPER_TABLE[code];
|
|
165
|
-
case Table.LOWER:
|
|
166
|
-
return Decoder.LOWER_TABLE[code];
|
|
167
|
-
case Table.MIXED:
|
|
168
|
-
return Decoder.MIXED_TABLE[code];
|
|
169
|
-
case Table.PUNCT:
|
|
170
|
-
return Decoder.PUNCT_TABLE[code];
|
|
171
|
-
case Table.DIGIT:
|
|
172
|
-
return Decoder.DIGIT_TABLE[code];
|
|
173
|
-
default:
|
|
174
|
-
// Should not reach here.
|
|
175
|
-
throw new _IllegalStateException__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"]('Bad table');
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
/**
|
|
179
|
-
* <p>Performs RS error correction on an array of bits.</p>
|
|
180
|
-
*
|
|
181
|
-
* @return the corrected array
|
|
182
|
-
* @throws FormatException if the input contains too many errors
|
|
183
|
-
*/
|
|
184
|
-
Decoder.prototype.correctBits = function (rawbits) {
|
|
185
|
-
var gf;
|
|
186
|
-
var codewordSize;
|
|
187
|
-
if (this.ddata.getNbLayers() <= 2) {
|
|
188
|
-
codewordSize = 6;
|
|
189
|
-
gf = _common_reedsolomon_GenericGF__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].AZTEC_DATA_6;
|
|
190
|
-
}
|
|
191
|
-
else if (this.ddata.getNbLayers() <= 8) {
|
|
192
|
-
codewordSize = 8;
|
|
193
|
-
gf = _common_reedsolomon_GenericGF__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].AZTEC_DATA_8;
|
|
194
|
-
}
|
|
195
|
-
else if (this.ddata.getNbLayers() <= 22) {
|
|
196
|
-
codewordSize = 10;
|
|
197
|
-
gf = _common_reedsolomon_GenericGF__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].AZTEC_DATA_10;
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
codewordSize = 12;
|
|
201
|
-
gf = _common_reedsolomon_GenericGF__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].AZTEC_DATA_12;
|
|
202
|
-
}
|
|
203
|
-
var numDataCodewords = this.ddata.getNbDatablocks();
|
|
204
|
-
var numCodewords = rawbits.length / codewordSize;
|
|
205
|
-
if (numCodewords < numDataCodewords) {
|
|
206
|
-
throw new _FormatException__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"]();
|
|
207
|
-
}
|
|
208
|
-
var offset = rawbits.length % codewordSize;
|
|
209
|
-
var dataWords = new Int32Array(numCodewords);
|
|
210
|
-
for (var i = 0; i < numCodewords; i++, offset += codewordSize) {
|
|
211
|
-
dataWords[i] = Decoder.readCode(rawbits, offset, codewordSize);
|
|
212
|
-
}
|
|
213
|
-
try {
|
|
214
|
-
var rsDecoder = new _common_reedsolomon_ReedSolomonDecoder__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"](gf);
|
|
215
|
-
rsDecoder.decode(dataWords, numCodewords - numDataCodewords);
|
|
216
|
-
}
|
|
217
|
-
catch (ex) {
|
|
218
|
-
throw new _FormatException__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"](ex);
|
|
219
|
-
}
|
|
220
|
-
// Now perform the unstuffing operation.
|
|
221
|
-
// First, count how many bits are going to be thrown out as stuffing
|
|
222
|
-
var mask = (1 << codewordSize) - 1;
|
|
223
|
-
var stuffedBits = 0;
|
|
224
|
-
for (var i = 0; i < numDataCodewords; i++) {
|
|
225
|
-
var dataWord = dataWords[i];
|
|
226
|
-
if (dataWord === 0 || dataWord === mask) {
|
|
227
|
-
throw new _FormatException__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"]();
|
|
228
|
-
}
|
|
229
|
-
else if (dataWord === 1 || dataWord === mask - 1) {
|
|
230
|
-
stuffedBits++;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
// Now, actually unpack the bits and remove the stuffing
|
|
234
|
-
var correctedBits = new Array(numDataCodewords * codewordSize - stuffedBits);
|
|
235
|
-
var index = 0;
|
|
236
|
-
for (var i = 0; i < numDataCodewords; i++) {
|
|
237
|
-
var dataWord = dataWords[i];
|
|
238
|
-
if (dataWord === 1 || dataWord === mask - 1) {
|
|
239
|
-
// next codewordSize-1 bits are all zeros or all ones
|
|
240
|
-
correctedBits.fill(dataWord > 1, index, index + codewordSize - 1);
|
|
241
|
-
// Arrays.fill(correctedBits, index, index + codewordSize - 1, dataWord > 1);
|
|
242
|
-
index += codewordSize - 1;
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
for (var bit = codewordSize - 1; bit >= 0; --bit) {
|
|
246
|
-
correctedBits[index++] = (dataWord & (1 << bit)) !== 0;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
return correctedBits;
|
|
251
|
-
};
|
|
252
|
-
/**
|
|
253
|
-
* Gets the array of bits from an Aztec Code matrix
|
|
254
|
-
*
|
|
255
|
-
* @return the array of bits
|
|
256
|
-
*/
|
|
257
|
-
Decoder.prototype.extractBits = function (matrix) {
|
|
258
|
-
var compact = this.ddata.isCompact();
|
|
259
|
-
var layers = this.ddata.getNbLayers();
|
|
260
|
-
var baseMatrixSize = (compact ? 11 : 14) + layers * 4; // not including alignment lines
|
|
261
|
-
var alignmentMap = new Int32Array(baseMatrixSize);
|
|
262
|
-
var rawbits = new Array(this.totalBitsInLayer(layers, compact));
|
|
263
|
-
if (compact) {
|
|
264
|
-
for (var i = 0; i < alignmentMap.length; i++) {
|
|
265
|
-
alignmentMap[i] = i;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
else {
|
|
269
|
-
var matrixSize = baseMatrixSize + 1 + 2 * _util_Integer__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"].truncDivision((_util_Integer__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"].truncDivision(baseMatrixSize, 2) - 1), 15);
|
|
270
|
-
var origCenter = baseMatrixSize / 2;
|
|
271
|
-
var center = _util_Integer__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"].truncDivision(matrixSize, 2);
|
|
272
|
-
for (var i = 0; i < origCenter; i++) {
|
|
273
|
-
var newOffset = i + _util_Integer__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"].truncDivision(i, 15);
|
|
274
|
-
alignmentMap[origCenter - i - 1] = center - newOffset - 1;
|
|
275
|
-
alignmentMap[origCenter + i] = center + newOffset + 1;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
for (var i = 0, rowOffset = 0; i < layers; i++) {
|
|
279
|
-
var rowSize = (layers - i) * 4 + (compact ? 9 : 12);
|
|
280
|
-
// The top-left most point of this layer is <low, low> (not including alignment lines)
|
|
281
|
-
var low = i * 2;
|
|
282
|
-
// The bottom-right most point of this layer is <high, high> (not including alignment lines)
|
|
283
|
-
var high = baseMatrixSize - 1 - low;
|
|
284
|
-
// We pull bits from the two 2 x rowSize columns and two rowSize x 2 rows
|
|
285
|
-
for (var j = 0; j < rowSize; j++) {
|
|
286
|
-
var columnOffset = j * 2;
|
|
287
|
-
for (var k = 0; k < 2; k++) {
|
|
288
|
-
// left column
|
|
289
|
-
rawbits[rowOffset + columnOffset + k] =
|
|
290
|
-
matrix.get(alignmentMap[low + k], alignmentMap[low + j]);
|
|
291
|
-
// bottom row
|
|
292
|
-
rawbits[rowOffset + 2 * rowSize + columnOffset + k] =
|
|
293
|
-
matrix.get(alignmentMap[low + j], alignmentMap[high - k]);
|
|
294
|
-
// right column
|
|
295
|
-
rawbits[rowOffset + 4 * rowSize + columnOffset + k] =
|
|
296
|
-
matrix.get(alignmentMap[high - k], alignmentMap[high - j]);
|
|
297
|
-
// top row
|
|
298
|
-
rawbits[rowOffset + 6 * rowSize + columnOffset + k] =
|
|
299
|
-
matrix.get(alignmentMap[high - j], alignmentMap[low + k]);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
rowOffset += rowSize * 8;
|
|
303
|
-
}
|
|
304
|
-
return rawbits;
|
|
305
|
-
};
|
|
306
|
-
/**
|
|
307
|
-
* Reads a code of given length and at given index in an array of bits
|
|
308
|
-
*/
|
|
309
|
-
Decoder.readCode = function (rawbits, startIndex, length) {
|
|
310
|
-
var res = 0;
|
|
311
|
-
for (var i = startIndex; i < startIndex + length; i++) {
|
|
312
|
-
res <<= 1;
|
|
313
|
-
if (rawbits[i]) {
|
|
314
|
-
res |= 0x01;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
return res;
|
|
318
|
-
};
|
|
319
|
-
/**
|
|
320
|
-
* Reads a code of length 8 in an array of bits, padding with zeros
|
|
321
|
-
*/
|
|
322
|
-
Decoder.readByte = function (rawbits, startIndex) {
|
|
323
|
-
var n = rawbits.length - startIndex;
|
|
324
|
-
if (n >= 8) {
|
|
325
|
-
return Decoder.readCode(rawbits, startIndex, 8);
|
|
326
|
-
}
|
|
327
|
-
return Decoder.readCode(rawbits, startIndex, n) << (8 - n);
|
|
328
|
-
};
|
|
329
|
-
/**
|
|
330
|
-
* Packs a bit array into bytes, most significant bit first
|
|
331
|
-
*/
|
|
332
|
-
Decoder.convertBoolArrayToByteArray = function (boolArr) {
|
|
333
|
-
var byteArr = new Uint8Array((boolArr.length + 7) / 8);
|
|
334
|
-
for (var i = 0; i < byteArr.length; i++) {
|
|
335
|
-
byteArr[i] = Decoder.readByte(boolArr, 8 * i);
|
|
336
|
-
}
|
|
337
|
-
return byteArr;
|
|
338
|
-
};
|
|
339
|
-
Decoder.prototype.totalBitsInLayer = function (layers, compact) {
|
|
340
|
-
return ((compact ? 88 : 112) + 16 * layers) * layers;
|
|
341
|
-
};
|
|
342
|
-
Decoder.UPPER_TABLE = [
|
|
343
|
-
'CTRL_PS', ' ', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
|
344
|
-
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'CTRL_LL', 'CTRL_ML', 'CTRL_DL', 'CTRL_BS'
|
|
345
|
-
];
|
|
346
|
-
Decoder.LOWER_TABLE = [
|
|
347
|
-
'CTRL_PS', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
|
|
348
|
-
'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'CTRL_US', 'CTRL_ML', 'CTRL_DL', 'CTRL_BS'
|
|
349
|
-
];
|
|
350
|
-
Decoder.MIXED_TABLE = [
|
|
351
|
-
// Module parse failed: Octal literal in strict mode (50:29)
|
|
352
|
-
// so number string were scaped
|
|
353
|
-
'CTRL_PS', ' ', '\\1', '\\2', '\\3', '\\4', '\\5', '\\6', '\\7', '\b', '\t', '\n',
|
|
354
|
-
'\\13', '\f', '\r', '\\33', '\\34', '\\35', '\\36', '\\37', '@', '\\', '^', '_',
|
|
355
|
-
'`', '|', '~', '\\177', 'CTRL_LL', 'CTRL_UL', 'CTRL_PL', 'CTRL_BS'
|
|
356
|
-
];
|
|
357
|
-
Decoder.PUNCT_TABLE = [
|
|
358
|
-
'', '\r', '\r\n', '. ', ', ', ': ', '!', '"', '#', '$', '%', '&', '\'', '(', ')',
|
|
359
|
-
'*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '[', ']', '{', '}', 'CTRL_UL'
|
|
360
|
-
];
|
|
361
|
-
Decoder.DIGIT_TABLE = [
|
|
362
|
-
'CTRL_PS', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ',', '.', 'CTRL_UL', 'CTRL_US'
|
|
363
|
-
];
|
|
364
|
-
return Decoder;
|
|
365
|
-
}());
|
|
366
|
-
/* harmony default export */ __webpack_exports__["a"] = (Decoder);
|
|
367
|
-
//# sourceMappingURL=Decoder.js.map
|
|
368
|
-
|
|
369
|
-
/***/ }),
|
|
370
|
-
|
|
371
|
-
/***/ "0ba3":
|
|
372
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
373
|
-
|
|
374
|
-
"use strict";
|
|
375
|
-
/* harmony import */ var _Result__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("2f50");
|
|
376
|
-
/* harmony import */ var _BarcodeFormat__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("a363");
|
|
377
|
-
/* harmony import */ var _DecodeHintType__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("fe96");
|
|
378
|
-
/* harmony import */ var _ResultMetadataType__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("64a7");
|
|
379
|
-
/* harmony import */ var _util_System__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("63af");
|
|
380
|
-
/* harmony import */ var _decoder_Decoder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("08a0");
|
|
381
|
-
/* harmony import */ var _detector_Detector__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("dd05");
|
|
382
|
-
/*
|
|
383
|
-
* Copyright 2010 ZXing authors
|
|
384
|
-
*
|
|
385
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
386
|
-
* you may not use this file except in compliance with the License.
|
|
387
|
-
* You may obtain a copy of the License at
|
|
388
|
-
*
|
|
389
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
390
|
-
*
|
|
391
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
392
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
393
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
394
|
-
* See the License for the specific language governing permissions and
|
|
395
|
-
* limitations under the License.
|
|
396
|
-
*/
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
// import java.util.List;
|
|
405
|
-
// import java.util.Map;
|
|
406
|
-
/**
|
|
407
|
-
* This implementation can detect and decode Aztec codes in an image.
|
|
408
|
-
*
|
|
409
|
-
* @author David Olivier
|
|
410
|
-
*/
|
|
411
|
-
var AztecReader = /** @class */ (function () {
|
|
412
|
-
function AztecReader() {
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* Locates and decodes a Data Matrix code in an image.
|
|
416
|
-
*
|
|
417
|
-
* @return a String representing the content encoded by the Data Matrix code
|
|
418
|
-
* @throws NotFoundException if a Data Matrix code cannot be found
|
|
419
|
-
* @throws FormatException if a Data Matrix code cannot be decoded
|
|
420
|
-
*/
|
|
421
|
-
AztecReader.prototype.decode = function (image, hints) {
|
|
422
|
-
if (hints === void 0) { hints = null; }
|
|
423
|
-
var exception = null;
|
|
424
|
-
var detector = new _detector_Detector__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"](image.getBlackMatrix());
|
|
425
|
-
var points = null;
|
|
426
|
-
var decoderResult = null;
|
|
427
|
-
try {
|
|
428
|
-
var detectorResult = detector.detectMirror(false);
|
|
429
|
-
points = detectorResult.getPoints();
|
|
430
|
-
this.reportFoundResultPoints(hints, points);
|
|
431
|
-
decoderResult = new _decoder_Decoder__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"]().decode(detectorResult);
|
|
432
|
-
}
|
|
433
|
-
catch (e) {
|
|
434
|
-
exception = e;
|
|
435
|
-
}
|
|
436
|
-
if (decoderResult == null) {
|
|
437
|
-
try {
|
|
438
|
-
var detectorResult = detector.detectMirror(true);
|
|
439
|
-
points = detectorResult.getPoints();
|
|
440
|
-
this.reportFoundResultPoints(hints, points);
|
|
441
|
-
decoderResult = new _decoder_Decoder__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"]().decode(detectorResult);
|
|
442
|
-
}
|
|
443
|
-
catch (e) {
|
|
444
|
-
if (exception != null) {
|
|
445
|
-
throw exception;
|
|
446
|
-
}
|
|
447
|
-
throw e;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
var result = new _Result__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](decoderResult.getText(), decoderResult.getRawBytes(), decoderResult.getNumBits(), points, _BarcodeFormat__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].AZTEC, _util_System__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].currentTimeMillis());
|
|
451
|
-
var byteSegments = decoderResult.getByteSegments();
|
|
452
|
-
if (byteSegments != null) {
|
|
453
|
-
result.putMetadata(_ResultMetadataType__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].BYTE_SEGMENTS, byteSegments);
|
|
454
|
-
}
|
|
455
|
-
var ecLevel = decoderResult.getECLevel();
|
|
456
|
-
if (ecLevel != null) {
|
|
457
|
-
result.putMetadata(_ResultMetadataType__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].ERROR_CORRECTION_LEVEL, ecLevel);
|
|
458
|
-
}
|
|
459
|
-
return result;
|
|
460
|
-
};
|
|
461
|
-
AztecReader.prototype.reportFoundResultPoints = function (hints, points) {
|
|
462
|
-
if (hints != null) {
|
|
463
|
-
var rpcb_1 = hints.get(_DecodeHintType__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].NEED_RESULT_POINT_CALLBACK);
|
|
464
|
-
if (rpcb_1 != null) {
|
|
465
|
-
points.forEach(function (point, idx, arr) {
|
|
466
|
-
rpcb_1.foundPossibleResultPoint(point);
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
};
|
|
471
|
-
// @Override
|
|
472
|
-
AztecReader.prototype.reset = function () {
|
|
473
|
-
// do nothing
|
|
474
|
-
};
|
|
475
|
-
return AztecReader;
|
|
476
|
-
}());
|
|
477
|
-
/* harmony default export */ __webpack_exports__["a"] = (AztecReader);
|
|
478
|
-
//# sourceMappingURL=AztecReader.js.map
|
|
479
|
-
|
|
480
|
-
/***/ }),
|
|
481
|
-
|
|
482
|
-
/***/ "1cba":
|
|
483
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
484
|
-
|
|
485
|
-
"use strict";
|
|
486
|
-
/* harmony import */ var _Exception__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("d0b6");
|
|
487
|
-
var __extends = (undefined && undefined.__extends) || (function () {
|
|
488
|
-
var extendStatics = function (d, b) {
|
|
489
|
-
extendStatics = Object.setPrototypeOf ||
|
|
490
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
491
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
492
|
-
return extendStatics(d, b);
|
|
493
|
-
};
|
|
494
|
-
return function (d, b) {
|
|
495
|
-
extendStatics(d, b);
|
|
496
|
-
function __() { this.constructor = d; }
|
|
497
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
498
|
-
};
|
|
499
|
-
})();
|
|
500
|
-
|
|
501
|
-
/**
|
|
502
|
-
* Custom Error class of type Exception.
|
|
503
|
-
*/
|
|
504
|
-
var UnsupportedOperationException = /** @class */ (function (_super) {
|
|
505
|
-
__extends(UnsupportedOperationException, _super);
|
|
506
|
-
function UnsupportedOperationException() {
|
|
507
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
508
|
-
}
|
|
509
|
-
UnsupportedOperationException.kind = 'UnsupportedOperationException';
|
|
510
|
-
return UnsupportedOperationException;
|
|
511
|
-
}(_Exception__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]));
|
|
512
|
-
/* harmony default export */ __webpack_exports__["a"] = (UnsupportedOperationException);
|
|
513
|
-
//# sourceMappingURL=UnsupportedOperationException.js.map
|
|
514
|
-
|
|
515
|
-
/***/ }),
|
|
516
|
-
|
|
517
|
-
/***/ "2ea4":
|
|
518
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
519
|
-
|
|
520
|
-
"use strict";
|
|
521
|
-
|
|
522
|
-
// EXTERNAL MODULE: ./node_modules/@zxing/library/esm/core/util/Collections.js
|
|
523
|
-
var Collections = __webpack_require__("c168");
|
|
524
|
-
|
|
525
|
-
// EXTERNAL MODULE: ./node_modules/@zxing/library/esm/core/common/BitArray.js
|
|
526
|
-
var BitArray = __webpack_require__("9068");
|
|
527
|
-
|
|
528
|
-
// CONCATENATED MODULE: ./node_modules/@zxing/library/esm/core/aztec/encoder/Token.js
|
|
529
|
-
/*
|
|
530
|
-
* Copyright 2013 ZXing authors
|
|
531
|
-
*
|
|
532
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
533
|
-
* you may not use this file except in compliance with the License.
|
|
534
|
-
* You may obtain a copy of the License at
|
|
535
|
-
*
|
|
536
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
537
|
-
*
|
|
538
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
539
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
540
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
541
|
-
* See the License for the specific language governing permissions and
|
|
542
|
-
* limitations under the License.
|
|
543
|
-
*/
|
|
544
|
-
var Token = /** @class */ (function () {
|
|
545
|
-
function Token(previous) {
|
|
546
|
-
this.previous = previous;
|
|
547
|
-
}
|
|
548
|
-
Token.prototype.getPrevious = function () {
|
|
549
|
-
return this.previous;
|
|
550
|
-
};
|
|
551
|
-
return Token;
|
|
552
|
-
}());
|
|
553
|
-
/* harmony default export */ var encoder_Token = (Token);
|
|
554
|
-
//# sourceMappingURL=Token.js.map
|
|
555
|
-
// EXTERNAL MODULE: ./node_modules/@zxing/library/esm/core/util/Integer.js
|
|
556
|
-
var Integer = __webpack_require__("ea29");
|
|
557
|
-
|
|
558
|
-
// CONCATENATED MODULE: ./node_modules/@zxing/library/esm/core/aztec/encoder/SimpleToken.js
|
|
559
|
-
/*
|
|
560
|
-
* Copyright 2013 ZXing authors
|
|
561
|
-
*
|
|
562
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
563
|
-
* you may not use this file except in compliance with the License.
|
|
564
|
-
* You may obtain a copy of the License at
|
|
565
|
-
*
|
|
566
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
567
|
-
*
|
|
568
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
569
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
570
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
571
|
-
* See the License for the specific language governing permissions and
|
|
572
|
-
* limitations under the License.
|
|
573
|
-
*/
|
|
574
|
-
var __extends = (undefined && undefined.__extends) || (function () {
|
|
575
|
-
var extendStatics = function (d, b) {
|
|
576
|
-
extendStatics = Object.setPrototypeOf ||
|
|
577
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
578
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
579
|
-
return extendStatics(d, b);
|
|
580
|
-
};
|
|
581
|
-
return function (d, b) {
|
|
582
|
-
extendStatics(d, b);
|
|
583
|
-
function __() { this.constructor = d; }
|
|
584
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
585
|
-
};
|
|
586
|
-
})();
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
var SimpleToken_SimpleToken = /** @class */ (function (_super) {
|
|
590
|
-
__extends(SimpleToken, _super);
|
|
591
|
-
function SimpleToken(previous, value, bitCount) {
|
|
592
|
-
var _this = _super.call(this, previous) || this;
|
|
593
|
-
_this.value = value;
|
|
594
|
-
_this.bitCount = bitCount;
|
|
595
|
-
return _this;
|
|
596
|
-
}
|
|
597
|
-
/**
|
|
598
|
-
* @Override
|
|
599
|
-
*/
|
|
600
|
-
SimpleToken.prototype.appendTo = function (bitArray, text) {
|
|
601
|
-
bitArray.appendBits(this.value, this.bitCount);
|
|
602
|
-
};
|
|
603
|
-
SimpleToken.prototype.add = function (value, bitCount) {
|
|
604
|
-
return new SimpleToken(this, value, bitCount);
|
|
605
|
-
};
|
|
606
|
-
SimpleToken.prototype.addBinaryShift = function (start, byteCount) {
|
|
607
|
-
// no-op can't binary shift a simple token
|
|
608
|
-
console.warn('addBinaryShift on SimpleToken, this simply returns a copy of this token');
|
|
609
|
-
return new SimpleToken(this, start, byteCount);
|
|
610
|
-
};
|
|
611
|
-
/**
|
|
612
|
-
* @Override
|
|
613
|
-
*/
|
|
614
|
-
SimpleToken.prototype.toString = function () {
|
|
615
|
-
var value = this.value & ((1 << this.bitCount) - 1);
|
|
616
|
-
value |= 1 << this.bitCount;
|
|
617
|
-
return '<' + Integer["a" /* default */].toBinaryString(value | (1 << this.bitCount)).substring(1) + '>';
|
|
618
|
-
};
|
|
619
|
-
return SimpleToken;
|
|
620
|
-
}(encoder_Token));
|
|
621
|
-
/* harmony default export */ var encoder_SimpleToken = (SimpleToken_SimpleToken);
|
|
622
|
-
//# sourceMappingURL=SimpleToken.js.map
|
|
623
|
-
// CONCATENATED MODULE: ./node_modules/@zxing/library/esm/core/aztec/encoder/BinaryShiftToken.js
|
|
624
|
-
/*
|
|
625
|
-
* Copyright 2013 ZXing authors
|
|
626
|
-
*
|
|
627
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
628
|
-
* you may not use this file except in compliance with the License.
|
|
629
|
-
* You may obtain a copy of the License at
|
|
630
|
-
*
|
|
631
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
632
|
-
*
|
|
633
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
634
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
635
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
636
|
-
* See the License for the specific language governing permissions and
|
|
637
|
-
* limitations under the License.
|
|
638
|
-
*/
|
|
639
|
-
var BinaryShiftToken_extends = (undefined && undefined.__extends) || (function () {
|
|
640
|
-
var extendStatics = function (d, b) {
|
|
641
|
-
extendStatics = Object.setPrototypeOf ||
|
|
642
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
643
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
644
|
-
return extendStatics(d, b);
|
|
645
|
-
};
|
|
646
|
-
return function (d, b) {
|
|
647
|
-
extendStatics(d, b);
|
|
648
|
-
function __() { this.constructor = d; }
|
|
649
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
650
|
-
};
|
|
651
|
-
})();
|
|
652
|
-
|
|
653
|
-
var BinaryShiftToken = /** @class */ (function (_super) {
|
|
654
|
-
BinaryShiftToken_extends(BinaryShiftToken, _super);
|
|
655
|
-
function BinaryShiftToken(previous, binaryShiftStart, binaryShiftByteCount) {
|
|
656
|
-
var _this = _super.call(this, previous, 0, 0) || this;
|
|
657
|
-
_this.binaryShiftStart = binaryShiftStart;
|
|
658
|
-
_this.binaryShiftByteCount = binaryShiftByteCount;
|
|
659
|
-
return _this;
|
|
660
|
-
}
|
|
661
|
-
/**
|
|
662
|
-
* @Override
|
|
663
|
-
*/
|
|
664
|
-
BinaryShiftToken.prototype.appendTo = function (bitArray, text) {
|
|
665
|
-
for (var i = 0; i < this.binaryShiftByteCount; i++) {
|
|
666
|
-
if (i === 0 || (i === 31 && this.binaryShiftByteCount <= 62)) {
|
|
667
|
-
// We need a header before the first character, and before
|
|
668
|
-
// character 31 when the total byte code is <= 62
|
|
669
|
-
bitArray.appendBits(31, 5); // BINARY_SHIFT
|
|
670
|
-
if (this.binaryShiftByteCount > 62) {
|
|
671
|
-
bitArray.appendBits(this.binaryShiftByteCount - 31, 16);
|
|
672
|
-
}
|
|
673
|
-
else if (i === 0) {
|
|
674
|
-
// 1 <= binaryShiftByteCode <= 62
|
|
675
|
-
bitArray.appendBits(Math.min(this.binaryShiftByteCount, 31), 5);
|
|
676
|
-
}
|
|
677
|
-
else {
|
|
678
|
-
// 32 <= binaryShiftCount <= 62 and i == 31
|
|
679
|
-
bitArray.appendBits(this.binaryShiftByteCount - 31, 5);
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
bitArray.appendBits(text[this.binaryShiftStart + i], 8);
|
|
683
|
-
}
|
|
684
|
-
};
|
|
685
|
-
BinaryShiftToken.prototype.addBinaryShift = function (start, byteCount) {
|
|
686
|
-
// int bitCount = (byteCount * 8) + (byteCount <= 31 ? 10 : byteCount <= 62 ? 20 : 21);
|
|
687
|
-
return new BinaryShiftToken(this, start, byteCount);
|
|
688
|
-
};
|
|
689
|
-
/**
|
|
690
|
-
* @Override
|
|
691
|
-
*/
|
|
692
|
-
BinaryShiftToken.prototype.toString = function () {
|
|
693
|
-
return '<' + this.binaryShiftStart + '::' + (this.binaryShiftStart + this.binaryShiftByteCount - 1) + '>';
|
|
694
|
-
};
|
|
695
|
-
return BinaryShiftToken;
|
|
696
|
-
}(encoder_SimpleToken));
|
|
697
|
-
/* harmony default export */ var encoder_BinaryShiftToken = (BinaryShiftToken);
|
|
698
|
-
//# sourceMappingURL=BinaryShiftToken.js.map
|
|
699
|
-
// CONCATENATED MODULE: ./node_modules/@zxing/library/esm/core/aztec/encoder/TokenHelpers.js
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
function addBinaryShift(token, start, byteCount) {
|
|
703
|
-
// int bitCount = (byteCount * 8) + (byteCount <= 31 ? 10 : byteCount <= 62 ? 20 : 21);
|
|
704
|
-
return new encoder_BinaryShiftToken(token, start, byteCount);
|
|
705
|
-
}
|
|
706
|
-
function add(token, value, bitCount) {
|
|
707
|
-
return new encoder_SimpleToken(token, value, bitCount);
|
|
708
|
-
}
|
|
709
|
-
//# sourceMappingURL=TokenHelpers.js.map
|
|
710
|
-
// CONCATENATED MODULE: ./node_modules/@zxing/library/esm/core/aztec/encoder/EncoderConstants.js
|
|
711
|
-
|
|
712
|
-
var /*final*/ MODE_NAMES = [
|
|
713
|
-
'UPPER',
|
|
714
|
-
'LOWER',
|
|
715
|
-
'DIGIT',
|
|
716
|
-
'MIXED',
|
|
717
|
-
'PUNCT'
|
|
718
|
-
];
|
|
719
|
-
var /*final*/ MODE_UPPER = 0; // 5 bits
|
|
720
|
-
var /*final*/ MODE_LOWER = 1; // 5 bits
|
|
721
|
-
var /*final*/ MODE_DIGIT = 2; // 4 bits
|
|
722
|
-
var /*final*/ MODE_MIXED = 3; // 5 bits
|
|
723
|
-
var /*final*/ MODE_PUNCT = 4; // 5 bits
|
|
724
|
-
var EMPTY_TOKEN = new encoder_SimpleToken(null, 0, 0);
|
|
725
|
-
//# sourceMappingURL=EncoderConstants.js.map
|
|
726
|
-
// CONCATENATED MODULE: ./node_modules/@zxing/library/esm/core/aztec/encoder/LatchTable.js
|
|
727
|
-
// The Latch Table shows, for each pair of Modes, the optimal method for
|
|
728
|
-
// getting from one mode to another. In the worst possible case, this can
|
|
729
|
-
// be up to 14 bits. In the best possible case, we are already there!
|
|
730
|
-
// The high half-word of each entry gives the number of bits.
|
|
731
|
-
// The low half-word of each entry are the actual bits necessary to change
|
|
732
|
-
var LATCH_TABLE = [
|
|
733
|
-
Int32Array.from([
|
|
734
|
-
0,
|
|
735
|
-
(5 << 16) + 28,
|
|
736
|
-
(5 << 16) + 30,
|
|
737
|
-
(5 << 16) + 29,
|
|
738
|
-
(10 << 16) + (29 << 5) + 30 // UPPER -> MIXED -> PUNCT
|
|
739
|
-
]),
|
|
740
|
-
Int32Array.from([
|
|
741
|
-
(9 << 16) + (30 << 4) + 14,
|
|
742
|
-
0,
|
|
743
|
-
(5 << 16) + 30,
|
|
744
|
-
(5 << 16) + 29,
|
|
745
|
-
(10 << 16) + (29 << 5) + 30 // LOWER -> MIXED -> PUNCT
|
|
746
|
-
]),
|
|
747
|
-
Int32Array.from([
|
|
748
|
-
(4 << 16) + 14,
|
|
749
|
-
(9 << 16) + (14 << 5) + 28,
|
|
750
|
-
0,
|
|
751
|
-
(9 << 16) + (14 << 5) + 29,
|
|
752
|
-
(14 << 16) + (14 << 10) + (29 << 5) + 30
|
|
753
|
-
// DIGIT -> UPPER -> MIXED -> PUNCT
|
|
754
|
-
]),
|
|
755
|
-
Int32Array.from([
|
|
756
|
-
(5 << 16) + 29,
|
|
757
|
-
(5 << 16) + 28,
|
|
758
|
-
(10 << 16) + (29 << 5) + 30,
|
|
759
|
-
0,
|
|
760
|
-
(5 << 16) + 30 // MIXED -> PUNCT
|
|
761
|
-
]),
|
|
762
|
-
Int32Array.from([
|
|
763
|
-
(5 << 16) + 31,
|
|
764
|
-
(10 << 16) + (31 << 5) + 28,
|
|
765
|
-
(10 << 16) + (31 << 5) + 30,
|
|
766
|
-
(10 << 16) + (31 << 5) + 29,
|
|
767
|
-
0
|
|
768
|
-
])
|
|
769
|
-
];
|
|
770
|
-
//# sourceMappingURL=LatchTable.js.map
|
|
771
|
-
// EXTERNAL MODULE: ./node_modules/@zxing/library/esm/core/util/Arrays.js
|
|
772
|
-
var Arrays = __webpack_require__("cb12");
|
|
773
|
-
|
|
774
|
-
// CONCATENATED MODULE: ./node_modules/@zxing/library/esm/core/aztec/encoder/ShiftTable.js
|
|
775
|
-
var __values = (undefined && undefined.__values) || function(o) {
|
|
776
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
777
|
-
if (m) return m.call(o);
|
|
778
|
-
if (o && typeof o.length === "number") return {
|
|
779
|
-
next: function () {
|
|
780
|
-
if (o && i >= o.length) o = void 0;
|
|
781
|
-
return { value: o && o[i++], done: !o };
|
|
782
|
-
}
|
|
783
|
-
};
|
|
784
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
785
|
-
};
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
function static_SHIFT_TABLE(SHIFT_TABLE) {
|
|
789
|
-
var e_1, _a;
|
|
790
|
-
try {
|
|
791
|
-
for (var SHIFT_TABLE_1 = __values(SHIFT_TABLE), SHIFT_TABLE_1_1 = SHIFT_TABLE_1.next(); !SHIFT_TABLE_1_1.done; SHIFT_TABLE_1_1 = SHIFT_TABLE_1.next()) {
|
|
792
|
-
var table = SHIFT_TABLE_1_1.value /*Int32Array*/;
|
|
793
|
-
Arrays["a" /* default */].fill(table, -1);
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
797
|
-
finally {
|
|
798
|
-
try {
|
|
799
|
-
if (SHIFT_TABLE_1_1 && !SHIFT_TABLE_1_1.done && (_a = SHIFT_TABLE_1.return)) _a.call(SHIFT_TABLE_1);
|
|
800
|
-
}
|
|
801
|
-
finally { if (e_1) throw e_1.error; }
|
|
802
|
-
}
|
|
803
|
-
SHIFT_TABLE[MODE_UPPER][MODE_PUNCT] = 0;
|
|
804
|
-
SHIFT_TABLE[MODE_LOWER][MODE_PUNCT] = 0;
|
|
805
|
-
SHIFT_TABLE[MODE_LOWER][MODE_UPPER] = 28;
|
|
806
|
-
SHIFT_TABLE[MODE_MIXED][MODE_PUNCT] = 0;
|
|
807
|
-
SHIFT_TABLE[MODE_DIGIT][MODE_PUNCT] = 0;
|
|
808
|
-
SHIFT_TABLE[MODE_DIGIT][MODE_UPPER] = 15;
|
|
809
|
-
return SHIFT_TABLE;
|
|
810
|
-
}
|
|
811
|
-
var /*final*/ ShiftTable_SHIFT_TABLE = static_SHIFT_TABLE(Arrays["a" /* default */].createInt32Array(6, 6)); // mode shift codes, per table
|
|
812
|
-
//# sourceMappingURL=ShiftTable.js.map
|
|
813
|
-
// EXTERNAL MODULE: ./node_modules/@zxing/library/esm/core/common/StringUtils.js
|
|
814
|
-
var StringUtils = __webpack_require__("f823");
|
|
815
|
-
|
|
816
|
-
// CONCATENATED MODULE: ./node_modules/@zxing/library/esm/core/aztec/encoder/State.js
|
|
817
|
-
/*
|
|
818
|
-
* Copyright 2013 ZXing authors
|
|
819
|
-
*
|
|
820
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
821
|
-
* you may not use this file except in compliance with the License.
|
|
822
|
-
* You may obtain a copy of the License at
|
|
823
|
-
*
|
|
824
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
825
|
-
*
|
|
826
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
827
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
828
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
829
|
-
* See the License for the specific language governing permissions and
|
|
830
|
-
* limitations under the License.
|
|
831
|
-
*/
|
|
832
|
-
var State_values = (undefined && undefined.__values) || function(o) {
|
|
833
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
834
|
-
if (m) return m.call(o);
|
|
835
|
-
if (o && typeof o.length === "number") return {
|
|
836
|
-
next: function () {
|
|
837
|
-
if (o && i >= o.length) o = void 0;
|
|
838
|
-
return { value: o && o[i++], done: !o };
|
|
839
|
-
}
|
|
840
|
-
};
|
|
841
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
842
|
-
};
|
|
843
|
-
// package com.google.zxing.aztec.encoder;
|
|
844
|
-
// import java.util.Deque;
|
|
845
|
-
// import java.util.LinkedList;
|
|
846
|
-
// import com.google.zxing.common.BitArray;
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
/**
|
|
854
|
-
* State represents all information about a sequence necessary to generate the current output.
|
|
855
|
-
* Note that a state is immutable.
|
|
856
|
-
*/
|
|
857
|
-
var State_State = /** @class */ (function () {
|
|
858
|
-
function State(token, mode, binaryBytes, bitCount) {
|
|
859
|
-
this.token = token;
|
|
860
|
-
this.mode = mode;
|
|
861
|
-
this.binaryShiftByteCount = binaryBytes;
|
|
862
|
-
this.bitCount = bitCount;
|
|
863
|
-
// Make sure we match the token
|
|
864
|
-
// int binaryShiftBitCount = (binaryShiftByteCount * 8) +
|
|
865
|
-
// (binaryShiftByteCount === 0 ? 0 :
|
|
866
|
-
// binaryShiftByteCount <= 31 ? 10 :
|
|
867
|
-
// binaryShiftByteCount <= 62 ? 20 : 21);
|
|
868
|
-
// assert this.bitCount === token.getTotalBitCount() + binaryShiftBitCount;
|
|
869
|
-
}
|
|
870
|
-
State.prototype.getMode = function () {
|
|
871
|
-
return this.mode;
|
|
872
|
-
};
|
|
873
|
-
State.prototype.getToken = function () {
|
|
874
|
-
return this.token;
|
|
875
|
-
};
|
|
876
|
-
State.prototype.getBinaryShiftByteCount = function () {
|
|
877
|
-
return this.binaryShiftByteCount;
|
|
878
|
-
};
|
|
879
|
-
State.prototype.getBitCount = function () {
|
|
880
|
-
return this.bitCount;
|
|
881
|
-
};
|
|
882
|
-
// Create a new state representing this state with a latch to a (not
|
|
883
|
-
// necessary different) mode, and then a code.
|
|
884
|
-
State.prototype.latchAndAppend = function (mode, value) {
|
|
885
|
-
// assert binaryShiftByteCount === 0;
|
|
886
|
-
var bitCount = this.bitCount;
|
|
887
|
-
var token = this.token;
|
|
888
|
-
if (mode !== this.mode) {
|
|
889
|
-
var latch = LATCH_TABLE[this.mode][mode];
|
|
890
|
-
token = add(token, latch & 0xffff, latch >> 16);
|
|
891
|
-
bitCount += latch >> 16;
|
|
892
|
-
}
|
|
893
|
-
var latchModeBitCount = mode === MODE_DIGIT ? 4 : 5;
|
|
894
|
-
token = add(token, value, latchModeBitCount);
|
|
895
|
-
return new State(token, mode, 0, bitCount + latchModeBitCount);
|
|
896
|
-
};
|
|
897
|
-
// Create a new state representing this state, with a temporary shift
|
|
898
|
-
// to a different mode to output a single value.
|
|
899
|
-
State.prototype.shiftAndAppend = function (mode, value) {
|
|
900
|
-
// assert binaryShiftByteCount === 0 && this.mode !== mode;
|
|
901
|
-
var token = this.token;
|
|
902
|
-
var thisModeBitCount = this.mode === MODE_DIGIT ? 4 : 5;
|
|
903
|
-
// Shifts exist only to UPPER and PUNCT, both with tokens size 5.
|
|
904
|
-
token = add(token, ShiftTable_SHIFT_TABLE[this.mode][mode], thisModeBitCount);
|
|
905
|
-
token = add(token, value, 5);
|
|
906
|
-
return new State(token, this.mode, 0, this.bitCount + thisModeBitCount + 5);
|
|
907
|
-
};
|
|
908
|
-
// Create a new state representing this state, but an additional character
|
|
909
|
-
// output in Binary Shift mode.
|
|
910
|
-
State.prototype.addBinaryShiftChar = function (index) {
|
|
911
|
-
var token = this.token;
|
|
912
|
-
var mode = this.mode;
|
|
913
|
-
var bitCount = this.bitCount;
|
|
914
|
-
if (this.mode === MODE_PUNCT || this.mode === MODE_DIGIT) {
|
|
915
|
-
// assert binaryShiftByteCount === 0;
|
|
916
|
-
var latch = LATCH_TABLE[mode][MODE_UPPER];
|
|
917
|
-
token = add(token, latch & 0xffff, latch >> 16);
|
|
918
|
-
bitCount += latch >> 16;
|
|
919
|
-
mode = MODE_UPPER;
|
|
920
|
-
}
|
|
921
|
-
var deltaBitCount = this.binaryShiftByteCount === 0 || this.binaryShiftByteCount === 31
|
|
922
|
-
? 18
|
|
923
|
-
: this.binaryShiftByteCount === 62
|
|
924
|
-
? 9
|
|
925
|
-
: 8;
|
|
926
|
-
var result = new State(token, mode, this.binaryShiftByteCount + 1, bitCount + deltaBitCount);
|
|
927
|
-
if (result.binaryShiftByteCount === 2047 + 31) {
|
|
928
|
-
// The string is as long as it's allowed to be. We should end it.
|
|
929
|
-
result = result.endBinaryShift(index + 1);
|
|
930
|
-
}
|
|
931
|
-
return result;
|
|
932
|
-
};
|
|
933
|
-
// Create the state identical to this one, but we are no longer in
|
|
934
|
-
// Binary Shift mode.
|
|
935
|
-
State.prototype.endBinaryShift = function (index) {
|
|
936
|
-
if (this.binaryShiftByteCount === 0) {
|
|
937
|
-
return this;
|
|
938
|
-
}
|
|
939
|
-
var token = this.token;
|
|
940
|
-
token = addBinaryShift(token, index - this.binaryShiftByteCount, this.binaryShiftByteCount);
|
|
941
|
-
// assert token.getTotalBitCount() === this.bitCount;
|
|
942
|
-
return new State(token, this.mode, 0, this.bitCount);
|
|
943
|
-
};
|
|
944
|
-
// Returns true if "this" state is better (equal: or) to be in than "that"
|
|
945
|
-
// state under all possible circumstances.
|
|
946
|
-
State.prototype.isBetterThanOrEqualTo = function (other) {
|
|
947
|
-
var newModeBitCount = this.bitCount + (LATCH_TABLE[this.mode][other.mode] >> 16);
|
|
948
|
-
if (this.binaryShiftByteCount < other.binaryShiftByteCount) {
|
|
949
|
-
// add additional B/S encoding cost of other, if any
|
|
950
|
-
newModeBitCount +=
|
|
951
|
-
State.calculateBinaryShiftCost(other) -
|
|
952
|
-
State.calculateBinaryShiftCost(this);
|
|
953
|
-
}
|
|
954
|
-
else if (this.binaryShiftByteCount > other.binaryShiftByteCount &&
|
|
955
|
-
other.binaryShiftByteCount > 0) {
|
|
956
|
-
// maximum possible additional cost (it: h)
|
|
957
|
-
newModeBitCount += 10;
|
|
958
|
-
}
|
|
959
|
-
return newModeBitCount <= other.bitCount;
|
|
960
|
-
};
|
|
961
|
-
State.prototype.toBitArray = function (text) {
|
|
962
|
-
var e_1, _a;
|
|
963
|
-
// Reverse the tokens, so that they are in the order that they should
|
|
964
|
-
// be output
|
|
965
|
-
var symbols = [];
|
|
966
|
-
for (var token = this.endBinaryShift(text.length).token; token !== null; token = token.getPrevious()) {
|
|
967
|
-
symbols.unshift(token);
|
|
968
|
-
}
|
|
969
|
-
var bitArray = new BitArray["a" /* default */]();
|
|
970
|
-
try {
|
|
971
|
-
// Add each token to the result.
|
|
972
|
-
for (var symbols_1 = State_values(symbols), symbols_1_1 = symbols_1.next(); !symbols_1_1.done; symbols_1_1 = symbols_1.next()) {
|
|
973
|
-
var symbol = symbols_1_1.value;
|
|
974
|
-
symbol.appendTo(bitArray, text);
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
978
|
-
finally {
|
|
979
|
-
try {
|
|
980
|
-
if (symbols_1_1 && !symbols_1_1.done && (_a = symbols_1.return)) _a.call(symbols_1);
|
|
981
|
-
}
|
|
982
|
-
finally { if (e_1) throw e_1.error; }
|
|
983
|
-
}
|
|
984
|
-
// assert bitArray.getSize() === this.bitCount;
|
|
985
|
-
return bitArray;
|
|
986
|
-
};
|
|
987
|
-
/**
|
|
988
|
-
* @Override
|
|
989
|
-
*/
|
|
990
|
-
State.prototype.toString = function () {
|
|
991
|
-
return StringUtils["a" /* default */].format('%s bits=%d bytes=%d', MODE_NAMES[this.mode], this.bitCount, this.binaryShiftByteCount);
|
|
992
|
-
};
|
|
993
|
-
State.calculateBinaryShiftCost = function (state) {
|
|
994
|
-
if (state.binaryShiftByteCount > 62) {
|
|
995
|
-
return 21; // B/S with extended length
|
|
996
|
-
}
|
|
997
|
-
if (state.binaryShiftByteCount > 31) {
|
|
998
|
-
return 20; // two B/S
|
|
999
|
-
}
|
|
1000
|
-
if (state.binaryShiftByteCount > 0) {
|
|
1001
|
-
return 10; // one B/S
|
|
1002
|
-
}
|
|
1003
|
-
return 0;
|
|
1004
|
-
};
|
|
1005
|
-
State.INITIAL_STATE = new State(EMPTY_TOKEN, MODE_UPPER, 0, 0);
|
|
1006
|
-
return State;
|
|
1007
|
-
}());
|
|
1008
|
-
/* harmony default export */ var encoder_State = (State_State);
|
|
1009
|
-
//# sourceMappingURL=State.js.map
|
|
1010
|
-
// CONCATENATED MODULE: ./node_modules/@zxing/library/esm/core/aztec/encoder/CharMap.js
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
function static_CHAR_MAP(CHAR_MAP) {
|
|
1015
|
-
var spaceCharCode = StringUtils["a" /* default */].getCharCode(' ');
|
|
1016
|
-
var pointCharCode = StringUtils["a" /* default */].getCharCode('.');
|
|
1017
|
-
var commaCharCode = StringUtils["a" /* default */].getCharCode(',');
|
|
1018
|
-
CHAR_MAP[MODE_UPPER][spaceCharCode] = 1;
|
|
1019
|
-
var zUpperCharCode = StringUtils["a" /* default */].getCharCode('Z');
|
|
1020
|
-
var aUpperCharCode = StringUtils["a" /* default */].getCharCode('A');
|
|
1021
|
-
for (var c = aUpperCharCode; c <= zUpperCharCode; c++) {
|
|
1022
|
-
CHAR_MAP[MODE_UPPER][c] = c - aUpperCharCode + 2;
|
|
1023
|
-
}
|
|
1024
|
-
CHAR_MAP[MODE_LOWER][spaceCharCode] = 1;
|
|
1025
|
-
var zLowerCharCode = StringUtils["a" /* default */].getCharCode('z');
|
|
1026
|
-
var aLowerCharCode = StringUtils["a" /* default */].getCharCode('a');
|
|
1027
|
-
for (var c = aLowerCharCode; c <= zLowerCharCode; c++) {
|
|
1028
|
-
CHAR_MAP[MODE_LOWER][c] = c - aLowerCharCode + 2;
|
|
1029
|
-
}
|
|
1030
|
-
CHAR_MAP[MODE_DIGIT][spaceCharCode] = 1;
|
|
1031
|
-
var nineCharCode = StringUtils["a" /* default */].getCharCode('9');
|
|
1032
|
-
var zeroCharCode = StringUtils["a" /* default */].getCharCode('0');
|
|
1033
|
-
for (var c = zeroCharCode; c <= nineCharCode; c++) {
|
|
1034
|
-
CHAR_MAP[MODE_DIGIT][c] = c - zeroCharCode + 2;
|
|
1035
|
-
}
|
|
1036
|
-
CHAR_MAP[MODE_DIGIT][commaCharCode] = 12;
|
|
1037
|
-
CHAR_MAP[MODE_DIGIT][pointCharCode] = 13;
|
|
1038
|
-
var mixedTable = [
|
|
1039
|
-
'\x00',
|
|
1040
|
-
' ',
|
|
1041
|
-
'\x01',
|
|
1042
|
-
'\x02',
|
|
1043
|
-
'\x03',
|
|
1044
|
-
'\x04',
|
|
1045
|
-
'\x05',
|
|
1046
|
-
'\x06',
|
|
1047
|
-
'\x07',
|
|
1048
|
-
'\b',
|
|
1049
|
-
'\t',
|
|
1050
|
-
'\n',
|
|
1051
|
-
'\x0b',
|
|
1052
|
-
'\f',
|
|
1053
|
-
'\r',
|
|
1054
|
-
'\x1b',
|
|
1055
|
-
'\x1c',
|
|
1056
|
-
'\x1d',
|
|
1057
|
-
'\x1e',
|
|
1058
|
-
'\x1f',
|
|
1059
|
-
'@',
|
|
1060
|
-
'\\',
|
|
1061
|
-
'^',
|
|
1062
|
-
'_',
|
|
1063
|
-
'`',
|
|
1064
|
-
'|',
|
|
1065
|
-
'~',
|
|
1066
|
-
'\x7f'
|
|
1067
|
-
];
|
|
1068
|
-
for (var i = 0; i < mixedTable.length; i++) {
|
|
1069
|
-
CHAR_MAP[MODE_MIXED][StringUtils["a" /* default */].getCharCode(mixedTable[i])] = i;
|
|
1070
|
-
}
|
|
1071
|
-
var punctTable = [
|
|
1072
|
-
'\x00',
|
|
1073
|
-
'\r',
|
|
1074
|
-
'\x00',
|
|
1075
|
-
'\x00',
|
|
1076
|
-
'\x00',
|
|
1077
|
-
'\x00',
|
|
1078
|
-
'!',
|
|
1079
|
-
'\'',
|
|
1080
|
-
'#',
|
|
1081
|
-
'$',
|
|
1082
|
-
'%',
|
|
1083
|
-
'&',
|
|
1084
|
-
'\'',
|
|
1085
|
-
'(',
|
|
1086
|
-
')',
|
|
1087
|
-
'*',
|
|
1088
|
-
'+',
|
|
1089
|
-
',',
|
|
1090
|
-
'-',
|
|
1091
|
-
'.',
|
|
1092
|
-
'/',
|
|
1093
|
-
':',
|
|
1094
|
-
';',
|
|
1095
|
-
'<',
|
|
1096
|
-
'=',
|
|
1097
|
-
'>',
|
|
1098
|
-
'?',
|
|
1099
|
-
'[',
|
|
1100
|
-
']',
|
|
1101
|
-
'{',
|
|
1102
|
-
'}'
|
|
1103
|
-
];
|
|
1104
|
-
for (var i = 0; i < punctTable.length; i++) {
|
|
1105
|
-
if (StringUtils["a" /* default */].getCharCode(punctTable[i]) > 0) {
|
|
1106
|
-
CHAR_MAP[MODE_PUNCT][StringUtils["a" /* default */].getCharCode(punctTable[i])] = i;
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
return CHAR_MAP;
|
|
1110
|
-
}
|
|
1111
|
-
var CharMap_CHAR_MAP = static_CHAR_MAP(Arrays["a" /* default */].createInt32Array(5, 256));
|
|
1112
|
-
//# sourceMappingURL=CharMap.js.map
|
|
1113
|
-
// CONCATENATED MODULE: ./node_modules/@zxing/library/esm/core/aztec/encoder/HighLevelEncoder.js
|
|
1114
|
-
/*
|
|
1115
|
-
* Copyright 2013 ZXing authors
|
|
1116
|
-
*
|
|
1117
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1118
|
-
* you may not use this file except in compliance with the License.
|
|
1119
|
-
* You may obtain a copy of the License at
|
|
1120
|
-
*
|
|
1121
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1122
|
-
*
|
|
1123
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1124
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1125
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1126
|
-
* See the License for the specific language governing permissions and
|
|
1127
|
-
* limitations under the License.
|
|
1128
|
-
*/
|
|
1129
|
-
var HighLevelEncoder_values = (undefined && undefined.__values) || function(o) {
|
|
1130
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
1131
|
-
if (m) return m.call(o);
|
|
1132
|
-
if (o && typeof o.length === "number") return {
|
|
1133
|
-
next: function () {
|
|
1134
|
-
if (o && i >= o.length) o = void 0;
|
|
1135
|
-
return { value: o && o[i++], done: !o };
|
|
1136
|
-
}
|
|
1137
|
-
};
|
|
1138
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
1139
|
-
};
|
|
1140
|
-
// import java.util.Collection;
|
|
1141
|
-
// import java.util.Collections;
|
|
1142
|
-
|
|
1143
|
-
// import java.util.Comparator;
|
|
1144
|
-
// import java.util.Iterator;
|
|
1145
|
-
// import java.util.LinkedList;
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
/**
|
|
1152
|
-
* This produces nearly optimal encodings of text into the first-level of
|
|
1153
|
-
* encoding used by Aztec code.
|
|
1154
|
-
*
|
|
1155
|
-
* It uses a dynamic algorithm. For each prefix of the string, it determines
|
|
1156
|
-
* a set of encodings that could lead to this prefix. We repeatedly add a
|
|
1157
|
-
* character and generate a new set of optimal encodings until we have read
|
|
1158
|
-
* through the entire input.
|
|
1159
|
-
*
|
|
1160
|
-
* @author Frank Yellin
|
|
1161
|
-
* @author Rustam Abdullaev
|
|
1162
|
-
*/
|
|
1163
|
-
var HighLevelEncoder_HighLevelEncoder = /** @class */ (function () {
|
|
1164
|
-
function HighLevelEncoder(text) {
|
|
1165
|
-
this.text = text;
|
|
1166
|
-
}
|
|
1167
|
-
/**
|
|
1168
|
-
* @return text represented by this encoder encoded as a {@link BitArray}
|
|
1169
|
-
*/
|
|
1170
|
-
HighLevelEncoder.prototype.encode = function () {
|
|
1171
|
-
var spaceCharCode = StringUtils["a" /* default */].getCharCode(' ');
|
|
1172
|
-
var lineBreakCharCode = StringUtils["a" /* default */].getCharCode('\n');
|
|
1173
|
-
var states = Collections["a" /* default */].singletonList(encoder_State.INITIAL_STATE);
|
|
1174
|
-
for (var index = 0; index < this.text.length; index++) {
|
|
1175
|
-
var pairCode = void 0;
|
|
1176
|
-
var nextChar = index + 1 < this.text.length ? this.text[index + 1] : 0;
|
|
1177
|
-
switch (this.text[index]) {
|
|
1178
|
-
case StringUtils["a" /* default */].getCharCode('\r'):
|
|
1179
|
-
pairCode = nextChar === lineBreakCharCode ? 2 : 0;
|
|
1180
|
-
break;
|
|
1181
|
-
case StringUtils["a" /* default */].getCharCode('.'):
|
|
1182
|
-
pairCode = nextChar === spaceCharCode ? 3 : 0;
|
|
1183
|
-
break;
|
|
1184
|
-
case StringUtils["a" /* default */].getCharCode(','):
|
|
1185
|
-
pairCode = nextChar === spaceCharCode ? 4 : 0;
|
|
1186
|
-
break;
|
|
1187
|
-
case StringUtils["a" /* default */].getCharCode(':'):
|
|
1188
|
-
pairCode = nextChar === spaceCharCode ? 5 : 0;
|
|
1189
|
-
break;
|
|
1190
|
-
default:
|
|
1191
|
-
pairCode = 0;
|
|
1192
|
-
}
|
|
1193
|
-
if (pairCode > 0) {
|
|
1194
|
-
// We have one of the four special PUNCT pairs. Treat them specially.
|
|
1195
|
-
// Get a new set of states for the two new characters.
|
|
1196
|
-
states = HighLevelEncoder.updateStateListForPair(states, index, pairCode);
|
|
1197
|
-
index++;
|
|
1198
|
-
}
|
|
1199
|
-
else {
|
|
1200
|
-
// Get a new set of states for the new character.
|
|
1201
|
-
states = this.updateStateListForChar(states, index);
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1204
|
-
// We are left with a set of states. Find the shortest one.
|
|
1205
|
-
var minState = Collections["a" /* default */].min(states, function (a, b) {
|
|
1206
|
-
return a.getBitCount() - b.getBitCount();
|
|
1207
|
-
});
|
|
1208
|
-
// Convert it to a bit array, and return.
|
|
1209
|
-
return minState.toBitArray(this.text);
|
|
1210
|
-
};
|
|
1211
|
-
// We update a set of states for a new character by updating each state
|
|
1212
|
-
// for the new character, merging the results, and then removing the
|
|
1213
|
-
// non-optimal states.
|
|
1214
|
-
HighLevelEncoder.prototype.updateStateListForChar = function (states, index) {
|
|
1215
|
-
var e_1, _a;
|
|
1216
|
-
var result = [];
|
|
1217
|
-
try {
|
|
1218
|
-
for (var states_1 = HighLevelEncoder_values(states), states_1_1 = states_1.next(); !states_1_1.done; states_1_1 = states_1.next()) {
|
|
1219
|
-
var state = states_1_1.value /*State*/;
|
|
1220
|
-
this.updateStateForChar(state, index, result);
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1224
|
-
finally {
|
|
1225
|
-
try {
|
|
1226
|
-
if (states_1_1 && !states_1_1.done && (_a = states_1.return)) _a.call(states_1);
|
|
1227
|
-
}
|
|
1228
|
-
finally { if (e_1) throw e_1.error; }
|
|
1229
|
-
}
|
|
1230
|
-
return HighLevelEncoder.simplifyStates(result);
|
|
1231
|
-
};
|
|
1232
|
-
// Return a set of states that represent the possible ways of updating this
|
|
1233
|
-
// state for the next character. The resulting set of states are added to
|
|
1234
|
-
// the "result" list.
|
|
1235
|
-
HighLevelEncoder.prototype.updateStateForChar = function (state, index, result) {
|
|
1236
|
-
var ch = (this.text[index] & 0xff);
|
|
1237
|
-
var charInCurrentTable = CharMap_CHAR_MAP[state.getMode()][ch] > 0;
|
|
1238
|
-
var stateNoBinary = null;
|
|
1239
|
-
for (var mode /*int*/ = 0; mode <= MODE_PUNCT; mode++) {
|
|
1240
|
-
var charInMode = CharMap_CHAR_MAP[mode][ch];
|
|
1241
|
-
if (charInMode > 0) {
|
|
1242
|
-
if (stateNoBinary == null) {
|
|
1243
|
-
// Only create stateNoBinary the first time it's required.
|
|
1244
|
-
stateNoBinary = state.endBinaryShift(index);
|
|
1245
|
-
}
|
|
1246
|
-
// Try generating the character by latching to its mode
|
|
1247
|
-
if (!charInCurrentTable ||
|
|
1248
|
-
mode === state.getMode() ||
|
|
1249
|
-
mode === MODE_DIGIT) {
|
|
1250
|
-
// If the character is in the current table, we don't want to latch to
|
|
1251
|
-
// any other mode except possibly digit (which uses only 4 bits). Any
|
|
1252
|
-
// other latch would be equally successful *after* this character, and
|
|
1253
|
-
// so wouldn't save any bits.
|
|
1254
|
-
var latchState = stateNoBinary.latchAndAppend(mode, charInMode);
|
|
1255
|
-
result.push(latchState);
|
|
1256
|
-
}
|
|
1257
|
-
// Try generating the character by switching to its mode.
|
|
1258
|
-
if (!charInCurrentTable &&
|
|
1259
|
-
ShiftTable_SHIFT_TABLE[state.getMode()][mode] >= 0) {
|
|
1260
|
-
// It never makes sense to temporarily shift to another mode if the
|
|
1261
|
-
// character exists in the current mode. That can never save bits.
|
|
1262
|
-
var shiftState = stateNoBinary.shiftAndAppend(mode, charInMode);
|
|
1263
|
-
result.push(shiftState);
|
|
1264
|
-
}
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
if (state.getBinaryShiftByteCount() > 0 ||
|
|
1268
|
-
CharMap_CHAR_MAP[state.getMode()][ch] === 0) {
|
|
1269
|
-
// It's never worthwhile to go into binary shift mode if you're not already
|
|
1270
|
-
// in binary shift mode, and the character exists in your current mode.
|
|
1271
|
-
// That can never save bits over just outputting the char in the current mode.
|
|
1272
|
-
var binaryState = state.addBinaryShiftChar(index);
|
|
1273
|
-
result.push(binaryState);
|
|
1274
|
-
}
|
|
1275
|
-
};
|
|
1276
|
-
HighLevelEncoder.updateStateListForPair = function (states, index, pairCode) {
|
|
1277
|
-
var e_2, _a;
|
|
1278
|
-
var result = [];
|
|
1279
|
-
try {
|
|
1280
|
-
for (var states_2 = HighLevelEncoder_values(states), states_2_1 = states_2.next(); !states_2_1.done; states_2_1 = states_2.next()) {
|
|
1281
|
-
var state = states_2_1.value /*State*/;
|
|
1282
|
-
this.updateStateForPair(state, index, pairCode, result);
|
|
1283
|
-
}
|
|
1284
|
-
}
|
|
1285
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1286
|
-
finally {
|
|
1287
|
-
try {
|
|
1288
|
-
if (states_2_1 && !states_2_1.done && (_a = states_2.return)) _a.call(states_2);
|
|
1289
|
-
}
|
|
1290
|
-
finally { if (e_2) throw e_2.error; }
|
|
1291
|
-
}
|
|
1292
|
-
return this.simplifyStates(result);
|
|
1293
|
-
};
|
|
1294
|
-
HighLevelEncoder.updateStateForPair = function (state, index, pairCode, result) {
|
|
1295
|
-
var stateNoBinary = state.endBinaryShift(index);
|
|
1296
|
-
// Possibility 1. Latch to C.MODE_PUNCT, and then append this code
|
|
1297
|
-
result.push(stateNoBinary.latchAndAppend(MODE_PUNCT, pairCode));
|
|
1298
|
-
if (state.getMode() !== MODE_PUNCT) {
|
|
1299
|
-
// Possibility 2. Shift to C.MODE_PUNCT, and then append this code.
|
|
1300
|
-
// Every state except C.MODE_PUNCT (handled above) can shift
|
|
1301
|
-
result.push(stateNoBinary.shiftAndAppend(MODE_PUNCT, pairCode));
|
|
1302
|
-
}
|
|
1303
|
-
if (pairCode === 3 || pairCode === 4) {
|
|
1304
|
-
// both characters are in DIGITS. Sometimes better to just add two digits
|
|
1305
|
-
var digitState = stateNoBinary
|
|
1306
|
-
.latchAndAppend(MODE_DIGIT, 16 - pairCode) // period or comma in DIGIT
|
|
1307
|
-
.latchAndAppend(MODE_DIGIT, 1); // space in DIGIT
|
|
1308
|
-
result.push(digitState);
|
|
1309
|
-
}
|
|
1310
|
-
if (state.getBinaryShiftByteCount() > 0) {
|
|
1311
|
-
// It only makes sense to do the characters as binary if we're already
|
|
1312
|
-
// in binary mode.
|
|
1313
|
-
var binaryState = state
|
|
1314
|
-
.addBinaryShiftChar(index)
|
|
1315
|
-
.addBinaryShiftChar(index + 1);
|
|
1316
|
-
result.push(binaryState);
|
|
1317
|
-
}
|
|
1318
|
-
};
|
|
1319
|
-
HighLevelEncoder.simplifyStates = function (states) {
|
|
1320
|
-
var e_3, _a, e_4, _b;
|
|
1321
|
-
var result = [];
|
|
1322
|
-
try {
|
|
1323
|
-
for (var states_3 = HighLevelEncoder_values(states), states_3_1 = states_3.next(); !states_3_1.done; states_3_1 = states_3.next()) {
|
|
1324
|
-
var newState = states_3_1.value;
|
|
1325
|
-
var add = true;
|
|
1326
|
-
var _loop_1 = function (oldState) {
|
|
1327
|
-
if (oldState.isBetterThanOrEqualTo(newState)) {
|
|
1328
|
-
add = false;
|
|
1329
|
-
return "break";
|
|
1330
|
-
}
|
|
1331
|
-
if (newState.isBetterThanOrEqualTo(oldState)) {
|
|
1332
|
-
// iterator.remove();
|
|
1333
|
-
result = result.filter(function (x) { return x !== oldState; }); // remove old state
|
|
1334
|
-
}
|
|
1335
|
-
};
|
|
1336
|
-
try {
|
|
1337
|
-
for (var result_1 = (e_4 = void 0, HighLevelEncoder_values(result)), result_1_1 = result_1.next(); !result_1_1.done; result_1_1 = result_1.next()) {
|
|
1338
|
-
var oldState = result_1_1.value;
|
|
1339
|
-
var state_1 = _loop_1(oldState);
|
|
1340
|
-
if (state_1 === "break")
|
|
1341
|
-
break;
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1345
|
-
finally {
|
|
1346
|
-
try {
|
|
1347
|
-
if (result_1_1 && !result_1_1.done && (_b = result_1.return)) _b.call(result_1);
|
|
1348
|
-
}
|
|
1349
|
-
finally { if (e_4) throw e_4.error; }
|
|
1350
|
-
}
|
|
1351
|
-
if (add) {
|
|
1352
|
-
result.push(newState);
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1357
|
-
finally {
|
|
1358
|
-
try {
|
|
1359
|
-
if (states_3_1 && !states_3_1.done && (_a = states_3.return)) _a.call(states_3);
|
|
1360
|
-
}
|
|
1361
|
-
finally { if (e_3) throw e_3.error; }
|
|
1362
|
-
}
|
|
1363
|
-
return result;
|
|
1364
|
-
};
|
|
1365
|
-
return HighLevelEncoder;
|
|
1366
|
-
}());
|
|
1367
|
-
/* harmony default export */ var encoder_HighLevelEncoder = __webpack_exports__["a"] = (HighLevelEncoder_HighLevelEncoder);
|
|
1368
|
-
//# sourceMappingURL=HighLevelEncoder.js.map
|
|
1369
|
-
|
|
1370
|
-
/***/ }),
|
|
1371
|
-
|
|
1372
|
-
/***/ "2f50":
|
|
1373
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1374
|
-
|
|
1375
|
-
"use strict";
|
|
1376
|
-
/* harmony import */ var _util_System__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("63af");
|
|
1377
|
-
/*
|
|
1378
|
-
* Copyright 2007 ZXing authors
|
|
1379
|
-
*
|
|
1380
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1381
|
-
* you may not use this file except in compliance with the License.
|
|
1382
|
-
* You may obtain a copy of the License at
|
|
1383
|
-
*
|
|
1384
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1385
|
-
*
|
|
1386
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1387
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1388
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1389
|
-
* See the License for the specific language governing permissions and
|
|
1390
|
-
* limitations under the License.
|
|
1391
|
-
*/
|
|
1392
|
-
|
|
1393
|
-
/**
|
|
1394
|
-
* <p>Encapsulates the result of decoding a barcode within an image.</p>
|
|
1395
|
-
*
|
|
1396
|
-
* @author Sean Owen
|
|
1397
|
-
*/
|
|
1398
|
-
var Result = /** @class */ (function () {
|
|
1399
|
-
// public constructor(private text: string,
|
|
1400
|
-
// Uint8Array rawBytes,
|
|
1401
|
-
// ResultPoconst resultPoints: Int32Array,
|
|
1402
|
-
// BarcodeFormat format) {
|
|
1403
|
-
// this(text, rawBytes, resultPoints, format, System.currentTimeMillis())
|
|
1404
|
-
// }
|
|
1405
|
-
// public constructor(text: string,
|
|
1406
|
-
// Uint8Array rawBytes,
|
|
1407
|
-
// ResultPoconst resultPoints: Int32Array,
|
|
1408
|
-
// BarcodeFormat format,
|
|
1409
|
-
// long timestamp) {
|
|
1410
|
-
// this(text, rawBytes, rawBytes == null ? 0 : 8 * rawBytes.length,
|
|
1411
|
-
// resultPoints, format, timestamp)
|
|
1412
|
-
// }
|
|
1413
|
-
function Result(text, rawBytes, numBits, resultPoints, format, timestamp) {
|
|
1414
|
-
if (numBits === void 0) { numBits = rawBytes == null ? 0 : 8 * rawBytes.length; }
|
|
1415
|
-
if (timestamp === void 0) { timestamp = _util_System__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].currentTimeMillis(); }
|
|
1416
|
-
this.text = text;
|
|
1417
|
-
this.rawBytes = rawBytes;
|
|
1418
|
-
this.numBits = numBits;
|
|
1419
|
-
this.resultPoints = resultPoints;
|
|
1420
|
-
this.format = format;
|
|
1421
|
-
this.timestamp = timestamp;
|
|
1422
|
-
this.text = text;
|
|
1423
|
-
this.rawBytes = rawBytes;
|
|
1424
|
-
if (undefined === numBits || null === numBits) {
|
|
1425
|
-
this.numBits = (rawBytes === null || rawBytes === undefined) ? 0 : 8 * rawBytes.length;
|
|
1426
|
-
}
|
|
1427
|
-
else {
|
|
1428
|
-
this.numBits = numBits;
|
|
1429
|
-
}
|
|
1430
|
-
this.resultPoints = resultPoints;
|
|
1431
|
-
this.format = format;
|
|
1432
|
-
this.resultMetadata = null;
|
|
1433
|
-
if (undefined === timestamp || null === timestamp) {
|
|
1434
|
-
this.timestamp = _util_System__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].currentTimeMillis();
|
|
1435
|
-
}
|
|
1436
|
-
else {
|
|
1437
|
-
this.timestamp = timestamp;
|
|
1438
|
-
}
|
|
1439
|
-
}
|
|
1440
|
-
/**
|
|
1441
|
-
* @return raw text encoded by the barcode
|
|
1442
|
-
*/
|
|
1443
|
-
Result.prototype.getText = function () {
|
|
1444
|
-
return this.text;
|
|
1445
|
-
};
|
|
1446
|
-
/**
|
|
1447
|
-
* @return raw bytes encoded by the barcode, if applicable, otherwise {@code null}
|
|
1448
|
-
*/
|
|
1449
|
-
Result.prototype.getRawBytes = function () {
|
|
1450
|
-
return this.rawBytes;
|
|
1451
|
-
};
|
|
1452
|
-
/**
|
|
1453
|
-
* @return how many bits of {@link #getRawBytes()} are valid; typically 8 times its length
|
|
1454
|
-
* @since 3.3.0
|
|
1455
|
-
*/
|
|
1456
|
-
Result.prototype.getNumBits = function () {
|
|
1457
|
-
return this.numBits;
|
|
1458
|
-
};
|
|
1459
|
-
/**
|
|
1460
|
-
* @return points related to the barcode in the image. These are typically points
|
|
1461
|
-
* identifying finder patterns or the corners of the barcode. The exact meaning is
|
|
1462
|
-
* specific to the type of barcode that was decoded.
|
|
1463
|
-
*/
|
|
1464
|
-
Result.prototype.getResultPoints = function () {
|
|
1465
|
-
return this.resultPoints;
|
|
1466
|
-
};
|
|
1467
|
-
/**
|
|
1468
|
-
* @return {@link BarcodeFormat} representing the format of the barcode that was decoded
|
|
1469
|
-
*/
|
|
1470
|
-
Result.prototype.getBarcodeFormat = function () {
|
|
1471
|
-
return this.format;
|
|
1472
|
-
};
|
|
1473
|
-
/**
|
|
1474
|
-
* @return {@link Map} mapping {@link ResultMetadataType} keys to values. May be
|
|
1475
|
-
* {@code null}. This contains optional metadata about what was detected about the barcode,
|
|
1476
|
-
* like orientation.
|
|
1477
|
-
*/
|
|
1478
|
-
Result.prototype.getResultMetadata = function () {
|
|
1479
|
-
return this.resultMetadata;
|
|
1480
|
-
};
|
|
1481
|
-
Result.prototype.putMetadata = function (type, value) {
|
|
1482
|
-
if (this.resultMetadata === null) {
|
|
1483
|
-
this.resultMetadata = new Map();
|
|
1484
|
-
}
|
|
1485
|
-
this.resultMetadata.set(type, value);
|
|
1486
|
-
};
|
|
1487
|
-
Result.prototype.putAllMetadata = function (metadata) {
|
|
1488
|
-
if (metadata !== null) {
|
|
1489
|
-
if (this.resultMetadata === null) {
|
|
1490
|
-
this.resultMetadata = metadata;
|
|
1491
|
-
}
|
|
1492
|
-
else {
|
|
1493
|
-
this.resultMetadata = new Map(metadata);
|
|
1494
|
-
}
|
|
1495
|
-
}
|
|
1496
|
-
};
|
|
1497
|
-
Result.prototype.addResultPoints = function (newPoints) {
|
|
1498
|
-
var oldPoints = this.resultPoints;
|
|
1499
|
-
if (oldPoints === null) {
|
|
1500
|
-
this.resultPoints = newPoints;
|
|
1501
|
-
}
|
|
1502
|
-
else if (newPoints !== null && newPoints.length > 0) {
|
|
1503
|
-
var allPoints = new Array(oldPoints.length + newPoints.length);
|
|
1504
|
-
_util_System__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].arraycopy(oldPoints, 0, allPoints, 0, oldPoints.length);
|
|
1505
|
-
_util_System__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].arraycopy(newPoints, 0, allPoints, oldPoints.length, newPoints.length);
|
|
1506
|
-
this.resultPoints = allPoints;
|
|
1507
|
-
}
|
|
1508
|
-
};
|
|
1509
|
-
Result.prototype.getTimestamp = function () {
|
|
1510
|
-
return this.timestamp;
|
|
1511
|
-
};
|
|
1512
|
-
/*@Override*/
|
|
1513
|
-
Result.prototype.toString = function () {
|
|
1514
|
-
return this.text;
|
|
1515
|
-
};
|
|
1516
|
-
return Result;
|
|
1517
|
-
}());
|
|
1518
|
-
/* harmony default export */ __webpack_exports__["a"] = (Result);
|
|
1519
|
-
//# sourceMappingURL=Result.js.map
|
|
1520
|
-
|
|
1521
|
-
/***/ }),
|
|
1522
|
-
|
|
1523
|
-
/***/ "3ab8":
|
|
1524
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1525
|
-
|
|
1526
|
-
"use strict";
|
|
1527
|
-
/*
|
|
1528
|
-
* Copyright 2013 ZXing authors
|
|
1529
|
-
*
|
|
1530
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1531
|
-
* you may not use this file except in compliance with the License.
|
|
1532
|
-
* You may obtain a copy of the License at
|
|
1533
|
-
*
|
|
1534
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1535
|
-
*
|
|
1536
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1537
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1538
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1539
|
-
* See the License for the specific language governing permissions and
|
|
1540
|
-
* limitations under the License.
|
|
1541
|
-
*/
|
|
1542
|
-
/**
|
|
1543
|
-
* Aztec 2D code representation
|
|
1544
|
-
*
|
|
1545
|
-
* @author Rustam Abdullaev
|
|
1546
|
-
*/
|
|
1547
|
-
var AztecCode = /** @class */ (function () {
|
|
1548
|
-
function AztecCode() {
|
|
1549
|
-
}
|
|
1550
|
-
/**
|
|
1551
|
-
* @return {@code true} if compact instead of full mode
|
|
1552
|
-
*/
|
|
1553
|
-
AztecCode.prototype.isCompact = function () {
|
|
1554
|
-
return this.compact;
|
|
1555
|
-
};
|
|
1556
|
-
AztecCode.prototype.setCompact = function (compact) {
|
|
1557
|
-
this.compact = compact;
|
|
1558
|
-
};
|
|
1559
|
-
/**
|
|
1560
|
-
* @return size in pixels (width and height)
|
|
1561
|
-
*/
|
|
1562
|
-
AztecCode.prototype.getSize = function () {
|
|
1563
|
-
return this.size;
|
|
1564
|
-
};
|
|
1565
|
-
AztecCode.prototype.setSize = function (size) {
|
|
1566
|
-
this.size = size;
|
|
1567
|
-
};
|
|
1568
|
-
/**
|
|
1569
|
-
* @return number of levels
|
|
1570
|
-
*/
|
|
1571
|
-
AztecCode.prototype.getLayers = function () {
|
|
1572
|
-
return this.layers;
|
|
1573
|
-
};
|
|
1574
|
-
AztecCode.prototype.setLayers = function (layers) {
|
|
1575
|
-
this.layers = layers;
|
|
1576
|
-
};
|
|
1577
|
-
/**
|
|
1578
|
-
* @return number of data codewords
|
|
1579
|
-
*/
|
|
1580
|
-
AztecCode.prototype.getCodeWords = function () {
|
|
1581
|
-
return this.codeWords;
|
|
1582
|
-
};
|
|
1583
|
-
AztecCode.prototype.setCodeWords = function (codeWords) {
|
|
1584
|
-
this.codeWords = codeWords;
|
|
1585
|
-
};
|
|
1586
|
-
/**
|
|
1587
|
-
* @return the symbol image
|
|
1588
|
-
*/
|
|
1589
|
-
AztecCode.prototype.getMatrix = function () {
|
|
1590
|
-
return this.matrix;
|
|
1591
|
-
};
|
|
1592
|
-
AztecCode.prototype.setMatrix = function (matrix) {
|
|
1593
|
-
this.matrix = matrix;
|
|
1594
|
-
};
|
|
1595
|
-
return AztecCode;
|
|
1596
|
-
}());
|
|
1597
|
-
/* harmony default export */ __webpack_exports__["a"] = (AztecCode);
|
|
1598
|
-
//# sourceMappingURL=AztecCode.js.map
|
|
1599
|
-
|
|
1600
|
-
/***/ }),
|
|
1601
|
-
|
|
1602
|
-
/***/ "4986":
|
|
1603
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1604
|
-
|
|
1605
|
-
"use strict";
|
|
1606
|
-
/* harmony import */ var _Exception__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("d0b6");
|
|
1607
|
-
var __extends = (undefined && undefined.__extends) || (function () {
|
|
1608
|
-
var extendStatics = function (d, b) {
|
|
1609
|
-
extendStatics = Object.setPrototypeOf ||
|
|
1610
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
1611
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
1612
|
-
return extendStatics(d, b);
|
|
1613
|
-
};
|
|
1614
|
-
return function (d, b) {
|
|
1615
|
-
extendStatics(d, b);
|
|
1616
|
-
function __() { this.constructor = d; }
|
|
1617
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1618
|
-
};
|
|
1619
|
-
})();
|
|
1620
|
-
|
|
1621
|
-
/**
|
|
1622
|
-
* Custom Error class of type Exception.
|
|
1623
|
-
*/
|
|
1624
|
-
var WriterException = /** @class */ (function (_super) {
|
|
1625
|
-
__extends(WriterException, _super);
|
|
1626
|
-
function WriterException() {
|
|
1627
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
1628
|
-
}
|
|
1629
|
-
WriterException.kind = 'WriterException';
|
|
1630
|
-
return WriterException;
|
|
1631
|
-
}(_Exception__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]));
|
|
1632
|
-
/* harmony default export */ __webpack_exports__["a"] = (WriterException);
|
|
1633
|
-
//# sourceMappingURL=WriterException.js.map
|
|
1634
|
-
|
|
1635
|
-
/***/ }),
|
|
1636
|
-
|
|
1637
|
-
/***/ "64a7":
|
|
1638
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1639
|
-
|
|
1640
|
-
"use strict";
|
|
1641
|
-
/*
|
|
1642
|
-
* Copyright 2008 ZXing authors
|
|
1643
|
-
*
|
|
1644
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1645
|
-
* you may not use this file except in compliance with the License.
|
|
1646
|
-
* You may obtain a copy of the License at
|
|
1647
|
-
*
|
|
1648
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1649
|
-
*
|
|
1650
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1651
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1652
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1653
|
-
* See the License for the specific language governing permissions and
|
|
1654
|
-
* limitations under the License.
|
|
1655
|
-
*/
|
|
1656
|
-
/*namespace com.google.zxing {*/
|
|
1657
|
-
/**
|
|
1658
|
-
* Represents some type of metadata about the result of the decoding that the decoder
|
|
1659
|
-
* wishes to communicate back to the caller.
|
|
1660
|
-
*
|
|
1661
|
-
* @author Sean Owen
|
|
1662
|
-
*/
|
|
1663
|
-
var ResultMetadataType;
|
|
1664
|
-
(function (ResultMetadataType) {
|
|
1665
|
-
/**
|
|
1666
|
-
* Unspecified, application-specific metadata. Maps to an unspecified {@link Object}.
|
|
1667
|
-
*/
|
|
1668
|
-
ResultMetadataType[ResultMetadataType["OTHER"] = 0] = "OTHER";
|
|
1669
|
-
/**
|
|
1670
|
-
* Denotes the likely approximate orientation of the barcode in the image. This value
|
|
1671
|
-
* is given as degrees rotated clockwise from the normal, upright orientation.
|
|
1672
|
-
* For example a 1D barcode which was found by reading top-to-bottom would be
|
|
1673
|
-
* said to have orientation "90". This key maps to an {@link Integer} whose
|
|
1674
|
-
* value is in the range [0,360).
|
|
1675
|
-
*/
|
|
1676
|
-
ResultMetadataType[ResultMetadataType["ORIENTATION"] = 1] = "ORIENTATION";
|
|
1677
|
-
/**
|
|
1678
|
-
* <p>2D barcode formats typically encode text, but allow for a sort of 'byte mode'
|
|
1679
|
-
* which is sometimes used to encode binary data. While {@link Result} makes available
|
|
1680
|
-
* the complete raw bytes in the barcode for these formats, it does not offer the bytes
|
|
1681
|
-
* from the byte segments alone.</p>
|
|
1682
|
-
*
|
|
1683
|
-
* <p>This maps to a {@link java.util.List} of byte arrays corresponding to the
|
|
1684
|
-
* raw bytes in the byte segments in the barcode, in order.</p>
|
|
1685
|
-
*/
|
|
1686
|
-
ResultMetadataType[ResultMetadataType["BYTE_SEGMENTS"] = 2] = "BYTE_SEGMENTS";
|
|
1687
|
-
/**
|
|
1688
|
-
* Error correction level used, if applicable. The value type depends on the
|
|
1689
|
-
* format, but is typically a String.
|
|
1690
|
-
*/
|
|
1691
|
-
ResultMetadataType[ResultMetadataType["ERROR_CORRECTION_LEVEL"] = 3] = "ERROR_CORRECTION_LEVEL";
|
|
1692
|
-
/**
|
|
1693
|
-
* For some periodicals, indicates the issue number as an {@link Integer}.
|
|
1694
|
-
*/
|
|
1695
|
-
ResultMetadataType[ResultMetadataType["ISSUE_NUMBER"] = 4] = "ISSUE_NUMBER";
|
|
1696
|
-
/**
|
|
1697
|
-
* For some products, indicates the suggested retail price in the barcode as a
|
|
1698
|
-
* formatted {@link String}.
|
|
1699
|
-
*/
|
|
1700
|
-
ResultMetadataType[ResultMetadataType["SUGGESTED_PRICE"] = 5] = "SUGGESTED_PRICE";
|
|
1701
|
-
/**
|
|
1702
|
-
* For some products, the possible country of manufacture as a {@link String} denoting the
|
|
1703
|
-
* ISO country code. Some map to multiple possible countries, like "US/CA".
|
|
1704
|
-
*/
|
|
1705
|
-
ResultMetadataType[ResultMetadataType["POSSIBLE_COUNTRY"] = 6] = "POSSIBLE_COUNTRY";
|
|
1706
|
-
/**
|
|
1707
|
-
* For some products, the extension text
|
|
1708
|
-
*/
|
|
1709
|
-
ResultMetadataType[ResultMetadataType["UPC_EAN_EXTENSION"] = 7] = "UPC_EAN_EXTENSION";
|
|
1710
|
-
/**
|
|
1711
|
-
* PDF417-specific metadata
|
|
1712
|
-
*/
|
|
1713
|
-
ResultMetadataType[ResultMetadataType["PDF417_EXTRA_METADATA"] = 8] = "PDF417_EXTRA_METADATA";
|
|
1714
|
-
/**
|
|
1715
|
-
* If the code format supports structured append and the current scanned code is part of one then the
|
|
1716
|
-
* sequence number is given with it.
|
|
1717
|
-
*/
|
|
1718
|
-
ResultMetadataType[ResultMetadataType["STRUCTURED_APPEND_SEQUENCE"] = 9] = "STRUCTURED_APPEND_SEQUENCE";
|
|
1719
|
-
/**
|
|
1720
|
-
* If the code format supports structured append and the current scanned code is part of one then the
|
|
1721
|
-
* parity is given with it.
|
|
1722
|
-
*/
|
|
1723
|
-
ResultMetadataType[ResultMetadataType["STRUCTURED_APPEND_PARITY"] = 10] = "STRUCTURED_APPEND_PARITY";
|
|
1724
|
-
})(ResultMetadataType || (ResultMetadataType = {}));
|
|
1725
|
-
/* harmony default export */ __webpack_exports__["a"] = (ResultMetadataType);
|
|
1726
|
-
//# sourceMappingURL=ResultMetadataType.js.map
|
|
1727
|
-
|
|
1728
|
-
/***/ }),
|
|
1729
|
-
|
|
1730
|
-
/***/ "84b8":
|
|
1731
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1732
|
-
|
|
1733
|
-
"use strict";
|
|
1734
|
-
/* harmony import */ var _common_BitArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("9068");
|
|
1735
|
-
/* harmony import */ var _IllegalArgumentException__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("f0a7");
|
|
1736
|
-
/* harmony import */ var _common_StringUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("f823");
|
|
1737
|
-
/* harmony import */ var _common_BitMatrix__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("2011");
|
|
1738
|
-
/* harmony import */ var _AztecCode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("3ab8");
|
|
1739
|
-
/* harmony import */ var _common_reedsolomon_ReedSolomonEncoder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("1092");
|
|
1740
|
-
/* harmony import */ var _common_reedsolomon_GenericGF__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("547e");
|
|
1741
|
-
/* harmony import */ var _HighLevelEncoder__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("2ea4");
|
|
1742
|
-
/* harmony import */ var _util_Integer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("ea29");
|
|
1743
|
-
var __values = (undefined && undefined.__values) || function(o) {
|
|
1744
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
1745
|
-
if (m) return m.call(o);
|
|
1746
|
-
if (o && typeof o.length === "number") return {
|
|
1747
|
-
next: function () {
|
|
1748
|
-
if (o && i >= o.length) o = void 0;
|
|
1749
|
-
return { value: o && o[i++], done: !o };
|
|
1750
|
-
}
|
|
1751
|
-
};
|
|
1752
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
1753
|
-
};
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
/*
|
|
1764
|
-
* Copyright 2013 ZXing authors
|
|
1765
|
-
*
|
|
1766
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1767
|
-
* you may not use this file except in compliance with the License.
|
|
1768
|
-
* You may obtain a copy of the License at
|
|
1769
|
-
*
|
|
1770
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1771
|
-
*
|
|
1772
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1773
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1774
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1775
|
-
* See the License for the specific language governing permissions and
|
|
1776
|
-
* limitations under the License.
|
|
1777
|
-
*/
|
|
1778
|
-
// package com.google.zxing.aztec.encoder;
|
|
1779
|
-
// import com.google.zxing.common.BitArray;
|
|
1780
|
-
// import com.google.zxing.common.BitMatrix;
|
|
1781
|
-
// import com.google.zxing.common.reedsolomon.GenericGF;
|
|
1782
|
-
// import com.google.zxing.common.reedsolomon.ReedSolomonEncoder;
|
|
1783
|
-
/**
|
|
1784
|
-
* Generates Aztec 2D barcodes.
|
|
1785
|
-
*
|
|
1786
|
-
* @author Rustam Abdullaev
|
|
1787
|
-
*/
|
|
1788
|
-
var Encoder = /** @class */ (function () {
|
|
1789
|
-
function Encoder() {
|
|
1790
|
-
}
|
|
1791
|
-
/**
|
|
1792
|
-
* Encodes the given binary content as an Aztec symbol
|
|
1793
|
-
*
|
|
1794
|
-
* @param data input data string
|
|
1795
|
-
* @return Aztec symbol matrix with metadata
|
|
1796
|
-
*/
|
|
1797
|
-
Encoder.encodeBytes = function (data) {
|
|
1798
|
-
return Encoder.encode(data, Encoder.DEFAULT_EC_PERCENT, Encoder.DEFAULT_AZTEC_LAYERS);
|
|
1799
|
-
};
|
|
1800
|
-
/**
|
|
1801
|
-
* Encodes the given binary content as an Aztec symbol
|
|
1802
|
-
*
|
|
1803
|
-
* @param data input data string
|
|
1804
|
-
* @param minECCPercent minimal percentage of error check words (According to ISO/IEC 24778:2008,
|
|
1805
|
-
* a minimum of 23% + 3 words is recommended)
|
|
1806
|
-
* @param userSpecifiedLayers if non-zero, a user-specified value for the number of layers
|
|
1807
|
-
* @return Aztec symbol matrix with metadata
|
|
1808
|
-
*/
|
|
1809
|
-
Encoder.encode = function (data, minECCPercent, userSpecifiedLayers) {
|
|
1810
|
-
// High-level encode
|
|
1811
|
-
var bits = new _HighLevelEncoder__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"](data).encode();
|
|
1812
|
-
// stuff bits and choose symbol size
|
|
1813
|
-
var eccBits = _util_Integer__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].truncDivision((bits.getSize() * minECCPercent), 100) + 11;
|
|
1814
|
-
var totalSizeBits = bits.getSize() + eccBits;
|
|
1815
|
-
var compact;
|
|
1816
|
-
var layers;
|
|
1817
|
-
var totalBitsInLayer;
|
|
1818
|
-
var wordSize;
|
|
1819
|
-
var stuffedBits;
|
|
1820
|
-
if (userSpecifiedLayers !== Encoder.DEFAULT_AZTEC_LAYERS) {
|
|
1821
|
-
compact = userSpecifiedLayers < 0;
|
|
1822
|
-
layers = Math.abs(userSpecifiedLayers);
|
|
1823
|
-
if (layers > (compact ? Encoder.MAX_NB_BITS_COMPACT : Encoder.MAX_NB_BITS)) {
|
|
1824
|
-
throw new _IllegalArgumentException__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"](_common_StringUtils__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].format('Illegal value %s for layers', userSpecifiedLayers));
|
|
1825
|
-
}
|
|
1826
|
-
totalBitsInLayer = Encoder.totalBitsInLayer(layers, compact);
|
|
1827
|
-
wordSize = Encoder.WORD_SIZE[layers];
|
|
1828
|
-
var usableBitsInLayers = totalBitsInLayer - (totalBitsInLayer % wordSize);
|
|
1829
|
-
stuffedBits = Encoder.stuffBits(bits, wordSize);
|
|
1830
|
-
if (stuffedBits.getSize() + eccBits > usableBitsInLayers) {
|
|
1831
|
-
throw new _IllegalArgumentException__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"]('Data to large for user specified layer');
|
|
1832
|
-
}
|
|
1833
|
-
if (compact && stuffedBits.getSize() > wordSize * 64) {
|
|
1834
|
-
// Compact format only allows 64 data words, though C4 can hold more words than that
|
|
1835
|
-
throw new _IllegalArgumentException__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"]('Data to large for user specified layer');
|
|
1836
|
-
}
|
|
1837
|
-
}
|
|
1838
|
-
else {
|
|
1839
|
-
wordSize = 0;
|
|
1840
|
-
stuffedBits = null;
|
|
1841
|
-
// We look at the possible table sizes in the order Compact1, Compact2, Compact3,
|
|
1842
|
-
// Compact4, Normal4,... Normal(i) for i < 4 isn't typically used since Compact(i+1)
|
|
1843
|
-
// is the same size, but has more data.
|
|
1844
|
-
for (var i /*int*/ = 0;; i++) {
|
|
1845
|
-
if (i > Encoder.MAX_NB_BITS) {
|
|
1846
|
-
throw new _IllegalArgumentException__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"]('Data too large for an Aztec code');
|
|
1847
|
-
}
|
|
1848
|
-
compact = i <= 3;
|
|
1849
|
-
layers = compact ? i + 1 : i;
|
|
1850
|
-
totalBitsInLayer = Encoder.totalBitsInLayer(layers, compact);
|
|
1851
|
-
if (totalSizeBits > totalBitsInLayer) {
|
|
1852
|
-
continue;
|
|
1853
|
-
}
|
|
1854
|
-
// [Re]stuff the bits if this is the first opportunity, or if the
|
|
1855
|
-
// wordSize has changed
|
|
1856
|
-
if (stuffedBits == null || wordSize !== Encoder.WORD_SIZE[layers]) {
|
|
1857
|
-
wordSize = Encoder.WORD_SIZE[layers];
|
|
1858
|
-
stuffedBits = Encoder.stuffBits(bits, wordSize);
|
|
1859
|
-
}
|
|
1860
|
-
var usableBitsInLayers = totalBitsInLayer - (totalBitsInLayer % wordSize);
|
|
1861
|
-
if (compact && stuffedBits.getSize() > wordSize * 64) {
|
|
1862
|
-
// Compact format only allows 64 data words, though C4 can hold more words than that
|
|
1863
|
-
continue;
|
|
1864
|
-
}
|
|
1865
|
-
if (stuffedBits.getSize() + eccBits <= usableBitsInLayers) {
|
|
1866
|
-
break;
|
|
1867
|
-
}
|
|
1868
|
-
}
|
|
1869
|
-
}
|
|
1870
|
-
var messageBits = Encoder.generateCheckWords(stuffedBits, totalBitsInLayer, wordSize);
|
|
1871
|
-
// generate mode message
|
|
1872
|
-
var messageSizeInWords = stuffedBits.getSize() / wordSize;
|
|
1873
|
-
var modeMessage = Encoder.generateModeMessage(compact, layers, messageSizeInWords);
|
|
1874
|
-
// allocate symbol
|
|
1875
|
-
var baseMatrixSize = (compact ? 11 : 14) + layers * 4; // not including alignment lines
|
|
1876
|
-
var alignmentMap = new Int32Array(baseMatrixSize);
|
|
1877
|
-
var matrixSize;
|
|
1878
|
-
if (compact) {
|
|
1879
|
-
// no alignment marks in compact mode, alignmentMap is a no-op
|
|
1880
|
-
matrixSize = baseMatrixSize;
|
|
1881
|
-
for (var i /*int*/ = 0; i < alignmentMap.length; i++) {
|
|
1882
|
-
alignmentMap[i] = i;
|
|
1883
|
-
}
|
|
1884
|
-
}
|
|
1885
|
-
else {
|
|
1886
|
-
matrixSize = baseMatrixSize + 1 + 2 * _util_Integer__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].truncDivision((_util_Integer__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].truncDivision(baseMatrixSize, 2) - 1), 15);
|
|
1887
|
-
var origCenter = _util_Integer__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].truncDivision(baseMatrixSize, 2);
|
|
1888
|
-
var center = _util_Integer__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].truncDivision(matrixSize, 2);
|
|
1889
|
-
for (var i /*int*/ = 0; i < origCenter; i++) {
|
|
1890
|
-
var newOffset = i + _util_Integer__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].truncDivision(i, 15);
|
|
1891
|
-
alignmentMap[origCenter - i - 1] = center - newOffset - 1;
|
|
1892
|
-
alignmentMap[origCenter + i] = center + newOffset + 1;
|
|
1893
|
-
}
|
|
1894
|
-
}
|
|
1895
|
-
var matrix = new _common_BitMatrix__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"](matrixSize);
|
|
1896
|
-
// draw data bits
|
|
1897
|
-
for (var i /*int*/ = 0, rowOffset = 0; i < layers; i++) {
|
|
1898
|
-
var rowSize = (layers - i) * 4 + (compact ? 9 : 12);
|
|
1899
|
-
for (var j /*int*/ = 0; j < rowSize; j++) {
|
|
1900
|
-
var columnOffset = j * 2;
|
|
1901
|
-
for (var k /*int*/ = 0; k < 2; k++) {
|
|
1902
|
-
if (messageBits.get(rowOffset + columnOffset + k)) {
|
|
1903
|
-
matrix.set(alignmentMap[i * 2 + k], alignmentMap[i * 2 + j]);
|
|
1904
|
-
}
|
|
1905
|
-
if (messageBits.get(rowOffset + rowSize * 2 + columnOffset + k)) {
|
|
1906
|
-
matrix.set(alignmentMap[i * 2 + j], alignmentMap[baseMatrixSize - 1 - i * 2 - k]);
|
|
1907
|
-
}
|
|
1908
|
-
if (messageBits.get(rowOffset + rowSize * 4 + columnOffset + k)) {
|
|
1909
|
-
matrix.set(alignmentMap[baseMatrixSize - 1 - i * 2 - k], alignmentMap[baseMatrixSize - 1 - i * 2 - j]);
|
|
1910
|
-
}
|
|
1911
|
-
if (messageBits.get(rowOffset + rowSize * 6 + columnOffset + k)) {
|
|
1912
|
-
matrix.set(alignmentMap[baseMatrixSize - 1 - i * 2 - j], alignmentMap[i * 2 + k]);
|
|
1913
|
-
}
|
|
1914
|
-
}
|
|
1915
|
-
}
|
|
1916
|
-
rowOffset += rowSize * 8;
|
|
1917
|
-
}
|
|
1918
|
-
// draw mode message
|
|
1919
|
-
Encoder.drawModeMessage(matrix, compact, matrixSize, modeMessage);
|
|
1920
|
-
// draw alignment marks
|
|
1921
|
-
if (compact) {
|
|
1922
|
-
Encoder.drawBullsEye(matrix, _util_Integer__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].truncDivision(matrixSize, 2), 5);
|
|
1923
|
-
}
|
|
1924
|
-
else {
|
|
1925
|
-
Encoder.drawBullsEye(matrix, _util_Integer__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].truncDivision(matrixSize, 2), 7);
|
|
1926
|
-
for (var i /*int*/ = 0, j = 0; i < _util_Integer__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].truncDivision(baseMatrixSize, 2) - 1; i += 15, j += 16) {
|
|
1927
|
-
for (var k /*int*/ = _util_Integer__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].truncDivision(matrixSize, 2) & 1; k < matrixSize; k += 2) {
|
|
1928
|
-
matrix.set(_util_Integer__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].truncDivision(matrixSize, 2) - j, k);
|
|
1929
|
-
matrix.set(_util_Integer__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].truncDivision(matrixSize, 2) + j, k);
|
|
1930
|
-
matrix.set(k, _util_Integer__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].truncDivision(matrixSize, 2) - j);
|
|
1931
|
-
matrix.set(k, _util_Integer__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].truncDivision(matrixSize, 2) + j);
|
|
1932
|
-
}
|
|
1933
|
-
}
|
|
1934
|
-
}
|
|
1935
|
-
var aztec = new _AztecCode__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"]();
|
|
1936
|
-
aztec.setCompact(compact);
|
|
1937
|
-
aztec.setSize(matrixSize);
|
|
1938
|
-
aztec.setLayers(layers);
|
|
1939
|
-
aztec.setCodeWords(messageSizeInWords);
|
|
1940
|
-
aztec.setMatrix(matrix);
|
|
1941
|
-
return aztec;
|
|
1942
|
-
};
|
|
1943
|
-
Encoder.drawBullsEye = function (matrix, center, size) {
|
|
1944
|
-
for (var i /*int*/ = 0; i < size; i += 2) {
|
|
1945
|
-
for (var j /*int*/ = center - i; j <= center + i; j++) {
|
|
1946
|
-
matrix.set(j, center - i);
|
|
1947
|
-
matrix.set(j, center + i);
|
|
1948
|
-
matrix.set(center - i, j);
|
|
1949
|
-
matrix.set(center + i, j);
|
|
1950
|
-
}
|
|
1951
|
-
}
|
|
1952
|
-
matrix.set(center - size, center - size);
|
|
1953
|
-
matrix.set(center - size + 1, center - size);
|
|
1954
|
-
matrix.set(center - size, center - size + 1);
|
|
1955
|
-
matrix.set(center + size, center - size);
|
|
1956
|
-
matrix.set(center + size, center - size + 1);
|
|
1957
|
-
matrix.set(center + size, center + size - 1);
|
|
1958
|
-
};
|
|
1959
|
-
Encoder.generateModeMessage = function (compact, layers, messageSizeInWords) {
|
|
1960
|
-
var modeMessage = new _common_BitArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]();
|
|
1961
|
-
if (compact) {
|
|
1962
|
-
modeMessage.appendBits(layers - 1, 2);
|
|
1963
|
-
modeMessage.appendBits(messageSizeInWords - 1, 6);
|
|
1964
|
-
modeMessage = Encoder.generateCheckWords(modeMessage, 28, 4);
|
|
1965
|
-
}
|
|
1966
|
-
else {
|
|
1967
|
-
modeMessage.appendBits(layers - 1, 5);
|
|
1968
|
-
modeMessage.appendBits(messageSizeInWords - 1, 11);
|
|
1969
|
-
modeMessage = Encoder.generateCheckWords(modeMessage, 40, 4);
|
|
1970
|
-
}
|
|
1971
|
-
return modeMessage;
|
|
1972
|
-
};
|
|
1973
|
-
Encoder.drawModeMessage = function (matrix, compact, matrixSize, modeMessage) {
|
|
1974
|
-
var center = _util_Integer__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].truncDivision(matrixSize, 2);
|
|
1975
|
-
if (compact) {
|
|
1976
|
-
for (var i /*int*/ = 0; i < 7; i++) {
|
|
1977
|
-
var offset = center - 3 + i;
|
|
1978
|
-
if (modeMessage.get(i)) {
|
|
1979
|
-
matrix.set(offset, center - 5);
|
|
1980
|
-
}
|
|
1981
|
-
if (modeMessage.get(i + 7)) {
|
|
1982
|
-
matrix.set(center + 5, offset);
|
|
1983
|
-
}
|
|
1984
|
-
if (modeMessage.get(20 - i)) {
|
|
1985
|
-
matrix.set(offset, center + 5);
|
|
1986
|
-
}
|
|
1987
|
-
if (modeMessage.get(27 - i)) {
|
|
1988
|
-
matrix.set(center - 5, offset);
|
|
1989
|
-
}
|
|
1990
|
-
}
|
|
1991
|
-
}
|
|
1992
|
-
else {
|
|
1993
|
-
for (var i /*int*/ = 0; i < 10; i++) {
|
|
1994
|
-
var offset = center - 5 + i + _util_Integer__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].truncDivision(i, 5);
|
|
1995
|
-
if (modeMessage.get(i)) {
|
|
1996
|
-
matrix.set(offset, center - 7);
|
|
1997
|
-
}
|
|
1998
|
-
if (modeMessage.get(i + 10)) {
|
|
1999
|
-
matrix.set(center + 7, offset);
|
|
2000
|
-
}
|
|
2001
|
-
if (modeMessage.get(29 - i)) {
|
|
2002
|
-
matrix.set(offset, center + 7);
|
|
2003
|
-
}
|
|
2004
|
-
if (modeMessage.get(39 - i)) {
|
|
2005
|
-
matrix.set(center - 7, offset);
|
|
2006
|
-
}
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
2009
|
-
};
|
|
2010
|
-
Encoder.generateCheckWords = function (bitArray, totalBits, wordSize) {
|
|
2011
|
-
var e_1, _a;
|
|
2012
|
-
// bitArray is guaranteed to be a multiple of the wordSize, so no padding needed
|
|
2013
|
-
var messageSizeInWords = bitArray.getSize() / wordSize;
|
|
2014
|
-
var rs = new _common_reedsolomon_ReedSolomonEncoder__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"](Encoder.getGF(wordSize));
|
|
2015
|
-
var totalWords = _util_Integer__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].truncDivision(totalBits, wordSize);
|
|
2016
|
-
var messageWords = Encoder.bitsToWords(bitArray, wordSize, totalWords);
|
|
2017
|
-
rs.encode(messageWords, totalWords - messageSizeInWords);
|
|
2018
|
-
var startPad = totalBits % wordSize;
|
|
2019
|
-
var messageBits = new _common_BitArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]();
|
|
2020
|
-
messageBits.appendBits(0, startPad);
|
|
2021
|
-
try {
|
|
2022
|
-
for (var _b = __values(Array.from(messageWords)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2023
|
-
var messageWord = _c.value /*: int*/;
|
|
2024
|
-
messageBits.appendBits(messageWord, wordSize);
|
|
2025
|
-
}
|
|
2026
|
-
}
|
|
2027
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2028
|
-
finally {
|
|
2029
|
-
try {
|
|
2030
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2031
|
-
}
|
|
2032
|
-
finally { if (e_1) throw e_1.error; }
|
|
2033
|
-
}
|
|
2034
|
-
return messageBits;
|
|
2035
|
-
};
|
|
2036
|
-
Encoder.bitsToWords = function (stuffedBits, wordSize, totalWords) {
|
|
2037
|
-
var message = new Int32Array(totalWords);
|
|
2038
|
-
var i;
|
|
2039
|
-
var n;
|
|
2040
|
-
for (i = 0, n = stuffedBits.getSize() / wordSize; i < n; i++) {
|
|
2041
|
-
var value = 0;
|
|
2042
|
-
for (var j /*int*/ = 0; j < wordSize; j++) {
|
|
2043
|
-
value |= stuffedBits.get(i * wordSize + j) ? (1 << wordSize - j - 1) : 0;
|
|
2044
|
-
}
|
|
2045
|
-
message[i] = value;
|
|
2046
|
-
}
|
|
2047
|
-
return message;
|
|
2048
|
-
};
|
|
2049
|
-
Encoder.getGF = function (wordSize) {
|
|
2050
|
-
switch (wordSize) {
|
|
2051
|
-
case 4:
|
|
2052
|
-
return _common_reedsolomon_GenericGF__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"].AZTEC_PARAM;
|
|
2053
|
-
case 6:
|
|
2054
|
-
return _common_reedsolomon_GenericGF__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"].AZTEC_DATA_6;
|
|
2055
|
-
case 8:
|
|
2056
|
-
return _common_reedsolomon_GenericGF__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"].AZTEC_DATA_8;
|
|
2057
|
-
case 10:
|
|
2058
|
-
return _common_reedsolomon_GenericGF__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"].AZTEC_DATA_10;
|
|
2059
|
-
case 12:
|
|
2060
|
-
return _common_reedsolomon_GenericGF__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"].AZTEC_DATA_12;
|
|
2061
|
-
default:
|
|
2062
|
-
throw new _IllegalArgumentException__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"]('Unsupported word size ' + wordSize);
|
|
2063
|
-
}
|
|
2064
|
-
};
|
|
2065
|
-
Encoder.stuffBits = function (bits, wordSize) {
|
|
2066
|
-
var out = new _common_BitArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]();
|
|
2067
|
-
var n = bits.getSize();
|
|
2068
|
-
var mask = (1 << wordSize) - 2;
|
|
2069
|
-
for (var i /*int*/ = 0; i < n; i += wordSize) {
|
|
2070
|
-
var word = 0;
|
|
2071
|
-
for (var j /*int*/ = 0; j < wordSize; j++) {
|
|
2072
|
-
if (i + j >= n || bits.get(i + j)) {
|
|
2073
|
-
word |= 1 << (wordSize - 1 - j);
|
|
2074
|
-
}
|
|
2075
|
-
}
|
|
2076
|
-
if ((word & mask) === mask) {
|
|
2077
|
-
out.appendBits(word & mask, wordSize);
|
|
2078
|
-
i--;
|
|
2079
|
-
}
|
|
2080
|
-
else if ((word & mask) === 0) {
|
|
2081
|
-
out.appendBits(word | 1, wordSize);
|
|
2082
|
-
i--;
|
|
2083
|
-
}
|
|
2084
|
-
else {
|
|
2085
|
-
out.appendBits(word, wordSize);
|
|
2086
|
-
}
|
|
2087
|
-
}
|
|
2088
|
-
return out;
|
|
2089
|
-
};
|
|
2090
|
-
Encoder.totalBitsInLayer = function (layers, compact) {
|
|
2091
|
-
return ((compact ? 88 : 112) + 16 * layers) * layers;
|
|
2092
|
-
};
|
|
2093
|
-
Encoder.DEFAULT_EC_PERCENT = 33; // default minimal percentage of error check words
|
|
2094
|
-
Encoder.DEFAULT_AZTEC_LAYERS = 0;
|
|
2095
|
-
Encoder.MAX_NB_BITS = 32;
|
|
2096
|
-
Encoder.MAX_NB_BITS_COMPACT = 4;
|
|
2097
|
-
Encoder.WORD_SIZE = Int32Array.from([
|
|
2098
|
-
4, 6, 6, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
|
|
2099
|
-
12, 12, 12, 12, 12, 12, 12, 12, 12, 12
|
|
2100
|
-
]);
|
|
2101
|
-
return Encoder;
|
|
2102
|
-
}());
|
|
2103
|
-
/* harmony default export */ __webpack_exports__["a"] = (Encoder);
|
|
2104
|
-
//# sourceMappingURL=Encoder.js.map
|
|
2105
|
-
|
|
2106
|
-
/***/ }),
|
|
2107
|
-
|
|
2108
|
-
/***/ "8c95":
|
|
2109
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
2110
|
-
|
|
2111
|
-
"use strict";
|
|
2112
|
-
/* harmony import */ var _common_detector_MathUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("fb63");
|
|
2113
|
-
/* harmony import */ var _util_Float__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("2e1c");
|
|
2114
|
-
/*
|
|
2115
|
-
* Copyright 2007 ZXing authors
|
|
2116
|
-
*
|
|
2117
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2118
|
-
* you may not use this file except in compliance with the License.
|
|
2119
|
-
* You may obtain a copy of the License at
|
|
2120
|
-
*
|
|
2121
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2122
|
-
*
|
|
2123
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2124
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2125
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2126
|
-
* See the License for the specific language governing permissions and
|
|
2127
|
-
* limitations under the License.
|
|
2128
|
-
*/
|
|
2129
|
-
/*namespace com.google.zxing {*/
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
/**
|
|
2133
|
-
* <p>Encapsulates a point of interest in an image containing a barcode. Typically, this
|
|
2134
|
-
* would be the location of a finder pattern or the corner of the barcode, for example.</p>
|
|
2135
|
-
*
|
|
2136
|
-
* @author Sean Owen
|
|
2137
|
-
*/
|
|
2138
|
-
var ResultPoint = /** @class */ (function () {
|
|
2139
|
-
function ResultPoint(x, y) {
|
|
2140
|
-
this.x = x;
|
|
2141
|
-
this.y = y;
|
|
2142
|
-
}
|
|
2143
|
-
ResultPoint.prototype.getX = function () {
|
|
2144
|
-
return this.x;
|
|
2145
|
-
};
|
|
2146
|
-
ResultPoint.prototype.getY = function () {
|
|
2147
|
-
return this.y;
|
|
2148
|
-
};
|
|
2149
|
-
/*@Override*/
|
|
2150
|
-
ResultPoint.prototype.equals = function (other) {
|
|
2151
|
-
if (other instanceof ResultPoint) {
|
|
2152
|
-
var otherPoint = other;
|
|
2153
|
-
return this.x === otherPoint.x && this.y === otherPoint.y;
|
|
2154
|
-
}
|
|
2155
|
-
return false;
|
|
2156
|
-
};
|
|
2157
|
-
/*@Override*/
|
|
2158
|
-
ResultPoint.prototype.hashCode = function () {
|
|
2159
|
-
return 31 * _util_Float__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].floatToIntBits(this.x) + _util_Float__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].floatToIntBits(this.y);
|
|
2160
|
-
};
|
|
2161
|
-
/*@Override*/
|
|
2162
|
-
ResultPoint.prototype.toString = function () {
|
|
2163
|
-
return '(' + this.x + ',' + this.y + ')';
|
|
2164
|
-
};
|
|
2165
|
-
/**
|
|
2166
|
-
* Orders an array of three ResultPoints in an order [A,B,C] such that AB is less than AC
|
|
2167
|
-
* and BC is less than AC, and the angle between BC and BA is less than 180 degrees.
|
|
2168
|
-
*
|
|
2169
|
-
* @param patterns array of three {@code ResultPoint} to order
|
|
2170
|
-
*/
|
|
2171
|
-
ResultPoint.orderBestPatterns = function (patterns) {
|
|
2172
|
-
// Find distances between pattern centers
|
|
2173
|
-
var zeroOneDistance = this.distance(patterns[0], patterns[1]);
|
|
2174
|
-
var oneTwoDistance = this.distance(patterns[1], patterns[2]);
|
|
2175
|
-
var zeroTwoDistance = this.distance(patterns[0], patterns[2]);
|
|
2176
|
-
var pointA;
|
|
2177
|
-
var pointB;
|
|
2178
|
-
var pointC;
|
|
2179
|
-
// Assume one closest to other two is B; A and C will just be guesses at first
|
|
2180
|
-
if (oneTwoDistance >= zeroOneDistance && oneTwoDistance >= zeroTwoDistance) {
|
|
2181
|
-
pointB = patterns[0];
|
|
2182
|
-
pointA = patterns[1];
|
|
2183
|
-
pointC = patterns[2];
|
|
2184
|
-
}
|
|
2185
|
-
else if (zeroTwoDistance >= oneTwoDistance && zeroTwoDistance >= zeroOneDistance) {
|
|
2186
|
-
pointB = patterns[1];
|
|
2187
|
-
pointA = patterns[0];
|
|
2188
|
-
pointC = patterns[2];
|
|
2189
|
-
}
|
|
2190
|
-
else {
|
|
2191
|
-
pointB = patterns[2];
|
|
2192
|
-
pointA = patterns[0];
|
|
2193
|
-
pointC = patterns[1];
|
|
2194
|
-
}
|
|
2195
|
-
// Use cross product to figure out whether A and C are correct or flipped.
|
|
2196
|
-
// This asks whether BC x BA has a positive z component, which is the arrangement
|
|
2197
|
-
// we want for A, B, C. If it's negative, then we've got it flipped around and
|
|
2198
|
-
// should swap A and C.
|
|
2199
|
-
if (this.crossProductZ(pointA, pointB, pointC) < 0.0) {
|
|
2200
|
-
var temp = pointA;
|
|
2201
|
-
pointA = pointC;
|
|
2202
|
-
pointC = temp;
|
|
2203
|
-
}
|
|
2204
|
-
patterns[0] = pointA;
|
|
2205
|
-
patterns[1] = pointB;
|
|
2206
|
-
patterns[2] = pointC;
|
|
2207
|
-
};
|
|
2208
|
-
/**
|
|
2209
|
-
* @param pattern1 first pattern
|
|
2210
|
-
* @param pattern2 second pattern
|
|
2211
|
-
* @return distance between two points
|
|
2212
|
-
*/
|
|
2213
|
-
ResultPoint.distance = function (pattern1, pattern2) {
|
|
2214
|
-
return _common_detector_MathUtils__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].distance(pattern1.x, pattern1.y, pattern2.x, pattern2.y);
|
|
2215
|
-
};
|
|
2216
|
-
/**
|
|
2217
|
-
* Returns the z component of the cross product between vectors BC and BA.
|
|
2218
|
-
*/
|
|
2219
|
-
ResultPoint.crossProductZ = function (pointA, pointB, pointC) {
|
|
2220
|
-
var bX = pointB.x;
|
|
2221
|
-
var bY = pointB.y;
|
|
2222
|
-
return ((pointC.x - bX) * (pointA.y - bY)) - ((pointC.y - bY) * (pointA.x - bX));
|
|
2223
|
-
};
|
|
2224
|
-
return ResultPoint;
|
|
2225
|
-
}());
|
|
2226
|
-
/* harmony default export */ __webpack_exports__["a"] = (ResultPoint);
|
|
2227
|
-
//# sourceMappingURL=ResultPoint.js.map
|
|
2228
|
-
|
|
2229
|
-
/***/ }),
|
|
2230
|
-
|
|
2231
|
-
/***/ "dd05":
|
|
2232
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
2233
|
-
|
|
2234
|
-
"use strict";
|
|
2235
|
-
/* unused harmony export Point */
|
|
2236
|
-
/* harmony import */ var _ResultPoint__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("8c95");
|
|
2237
|
-
/* harmony import */ var _AztecDetectorResult__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("f52c");
|
|
2238
|
-
/* harmony import */ var _common_detector_MathUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("fb63");
|
|
2239
|
-
/* harmony import */ var _common_detector_WhiteRectangleDetector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("7f3b");
|
|
2240
|
-
/* harmony import */ var _common_reedsolomon_GenericGF__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("547e");
|
|
2241
|
-
/* harmony import */ var _common_reedsolomon_ReedSolomonDecoder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("34c8");
|
|
2242
|
-
/* harmony import */ var _NotFoundException__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("ca08");
|
|
2243
|
-
/* harmony import */ var _common_GridSamplerInstance__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("be40");
|
|
2244
|
-
/* harmony import */ var _util_Integer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("ea29");
|
|
2245
|
-
/*
|
|
2246
|
-
* Copyright 2010 ZXing authors
|
|
2247
|
-
*
|
|
2248
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2249
|
-
* you may not use this file except in compliance with the License.
|
|
2250
|
-
* You may obtain a copy of the License at
|
|
2251
|
-
*
|
|
2252
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2253
|
-
*
|
|
2254
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2255
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2256
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2257
|
-
* See the License for the specific language governing permissions and
|
|
2258
|
-
* limitations under the License.
|
|
2259
|
-
*/
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
var Point = /** @class */ (function () {
|
|
2270
|
-
function Point(x, y) {
|
|
2271
|
-
this.x = x;
|
|
2272
|
-
this.y = y;
|
|
2273
|
-
}
|
|
2274
|
-
Point.prototype.toResultPoint = function () {
|
|
2275
|
-
return new _ResultPoint__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](this.getX(), this.getY());
|
|
2276
|
-
};
|
|
2277
|
-
Point.prototype.getX = function () {
|
|
2278
|
-
return this.x;
|
|
2279
|
-
};
|
|
2280
|
-
Point.prototype.getY = function () {
|
|
2281
|
-
return this.y;
|
|
2282
|
-
};
|
|
2283
|
-
return Point;
|
|
2284
|
-
}());
|
|
2285
|
-
|
|
2286
|
-
/**
|
|
2287
|
-
* Encapsulates logic that can detect an Aztec Code in an image, even if the Aztec Code
|
|
2288
|
-
* is rotated or skewed, or partially obscured.
|
|
2289
|
-
*
|
|
2290
|
-
* @author David Olivier
|
|
2291
|
-
* @author Frank Yellin
|
|
2292
|
-
*/
|
|
2293
|
-
var Detector = /** @class */ (function () {
|
|
2294
|
-
function Detector(image) {
|
|
2295
|
-
this.EXPECTED_CORNER_BITS = new Int32Array([
|
|
2296
|
-
0xee0,
|
|
2297
|
-
0x1dc,
|
|
2298
|
-
0x83b,
|
|
2299
|
-
0x707,
|
|
2300
|
-
]);
|
|
2301
|
-
this.image = image;
|
|
2302
|
-
}
|
|
2303
|
-
Detector.prototype.detect = function () {
|
|
2304
|
-
return this.detectMirror(false);
|
|
2305
|
-
};
|
|
2306
|
-
/**
|
|
2307
|
-
* Detects an Aztec Code in an image.
|
|
2308
|
-
*
|
|
2309
|
-
* @param isMirror if true, image is a mirror-image of original
|
|
2310
|
-
* @return {@link AztecDetectorResult} encapsulating results of detecting an Aztec Code
|
|
2311
|
-
* @throws NotFoundException if no Aztec Code can be found
|
|
2312
|
-
*/
|
|
2313
|
-
Detector.prototype.detectMirror = function (isMirror) {
|
|
2314
|
-
// 1. Get the center of the aztec matrix
|
|
2315
|
-
var pCenter = this.getMatrixCenter();
|
|
2316
|
-
// 2. Get the center points of the four diagonal points just outside the bull's eye
|
|
2317
|
-
// [topRight, bottomRight, bottomLeft, topLeft]
|
|
2318
|
-
var bullsEyeCorners = this.getBullsEyeCorners(pCenter);
|
|
2319
|
-
if (isMirror) {
|
|
2320
|
-
var temp = bullsEyeCorners[0];
|
|
2321
|
-
bullsEyeCorners[0] = bullsEyeCorners[2];
|
|
2322
|
-
bullsEyeCorners[2] = temp;
|
|
2323
|
-
}
|
|
2324
|
-
// 3. Get the size of the matrix and other parameters from the bull's eye
|
|
2325
|
-
this.extractParameters(bullsEyeCorners);
|
|
2326
|
-
// 4. Sample the grid
|
|
2327
|
-
var bits = this.sampleGrid(this.image, bullsEyeCorners[this.shift % 4], bullsEyeCorners[(this.shift + 1) % 4], bullsEyeCorners[(this.shift + 2) % 4], bullsEyeCorners[(this.shift + 3) % 4]);
|
|
2328
|
-
// 5. Get the corners of the matrix.
|
|
2329
|
-
var corners = this.getMatrixCornerPoints(bullsEyeCorners);
|
|
2330
|
-
return new _AztecDetectorResult__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"](bits, corners, this.compact, this.nbDataBlocks, this.nbLayers);
|
|
2331
|
-
};
|
|
2332
|
-
/**
|
|
2333
|
-
* Extracts the number of data layers and data blocks from the layer around the bull's eye.
|
|
2334
|
-
*
|
|
2335
|
-
* @param bullsEyeCorners the array of bull's eye corners
|
|
2336
|
-
* @throws NotFoundException in case of too many errors or invalid parameters
|
|
2337
|
-
*/
|
|
2338
|
-
Detector.prototype.extractParameters = function (bullsEyeCorners) {
|
|
2339
|
-
if (!this.isValidPoint(bullsEyeCorners[0]) || !this.isValidPoint(bullsEyeCorners[1]) ||
|
|
2340
|
-
!this.isValidPoint(bullsEyeCorners[2]) || !this.isValidPoint(bullsEyeCorners[3])) {
|
|
2341
|
-
throw new _NotFoundException__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"]();
|
|
2342
|
-
}
|
|
2343
|
-
var length = 2 * this.nbCenterLayers;
|
|
2344
|
-
// Get the bits around the bull's eye
|
|
2345
|
-
var sides = new Int32Array([
|
|
2346
|
-
this.sampleLine(bullsEyeCorners[0], bullsEyeCorners[1], length),
|
|
2347
|
-
this.sampleLine(bullsEyeCorners[1], bullsEyeCorners[2], length),
|
|
2348
|
-
this.sampleLine(bullsEyeCorners[2], bullsEyeCorners[3], length),
|
|
2349
|
-
this.sampleLine(bullsEyeCorners[3], bullsEyeCorners[0], length) // Top
|
|
2350
|
-
]);
|
|
2351
|
-
// bullsEyeCorners[shift] is the corner of the bulls'eye that has three
|
|
2352
|
-
// orientation marks.
|
|
2353
|
-
// sides[shift] is the row/column that goes from the corner with three
|
|
2354
|
-
// orientation marks to the corner with two.
|
|
2355
|
-
this.shift = this.getRotation(sides, length);
|
|
2356
|
-
// Flatten the parameter bits into a single 28- or 40-bit long
|
|
2357
|
-
var parameterData = 0;
|
|
2358
|
-
for (var i = 0; i < 4; i++) {
|
|
2359
|
-
var side = sides[(this.shift + i) % 4];
|
|
2360
|
-
if (this.compact) {
|
|
2361
|
-
// Each side of the form ..XXXXXXX. where Xs are parameter data
|
|
2362
|
-
parameterData <<= 7;
|
|
2363
|
-
parameterData += (side >> 1) & 0x7F;
|
|
2364
|
-
}
|
|
2365
|
-
else {
|
|
2366
|
-
// Each side of the form ..XXXXX.XXXXX. where Xs are parameter data
|
|
2367
|
-
parameterData <<= 10;
|
|
2368
|
-
parameterData += ((side >> 2) & (0x1f << 5)) + ((side >> 1) & 0x1F);
|
|
2369
|
-
}
|
|
2370
|
-
}
|
|
2371
|
-
// Corrects parameter data using RS. Returns just the data portion
|
|
2372
|
-
// without the error correction.
|
|
2373
|
-
var correctedData = this.getCorrectedParameterData(parameterData, this.compact);
|
|
2374
|
-
if (this.compact) {
|
|
2375
|
-
// 8 bits: 2 bits layers and 6 bits data blocks
|
|
2376
|
-
this.nbLayers = (correctedData >> 6) + 1;
|
|
2377
|
-
this.nbDataBlocks = (correctedData & 0x3F) + 1;
|
|
2378
|
-
}
|
|
2379
|
-
else {
|
|
2380
|
-
// 16 bits: 5 bits layers and 11 bits data blocks
|
|
2381
|
-
this.nbLayers = (correctedData >> 11) + 1;
|
|
2382
|
-
this.nbDataBlocks = (correctedData & 0x7FF) + 1;
|
|
2383
|
-
}
|
|
2384
|
-
};
|
|
2385
|
-
Detector.prototype.getRotation = function (sides, length) {
|
|
2386
|
-
// In a normal pattern, we expect to See
|
|
2387
|
-
// ** .* D A
|
|
2388
|
-
// * *
|
|
2389
|
-
//
|
|
2390
|
-
// . *
|
|
2391
|
-
// .. .. C B
|
|
2392
|
-
//
|
|
2393
|
-
// Grab the 3 bits from each of the sides the form the locator pattern and concatenate
|
|
2394
|
-
// into a 12-bit integer. Start with the bit at A
|
|
2395
|
-
var cornerBits = 0;
|
|
2396
|
-
sides.forEach(function (side, idx, arr) {
|
|
2397
|
-
// XX......X where X's are orientation marks
|
|
2398
|
-
var t = ((side >> (length - 2)) << 1) + (side & 1);
|
|
2399
|
-
cornerBits = (cornerBits << 3) + t;
|
|
2400
|
-
});
|
|
2401
|
-
// for (var side in sides) {
|
|
2402
|
-
// // XX......X where X's are orientation marks
|
|
2403
|
-
// var t = ((side >> (length - 2)) << 1) + (side & 1);
|
|
2404
|
-
// cornerBits = (cornerBits << 3) + t;
|
|
2405
|
-
// }
|
|
2406
|
-
// Mov the bottom bit to the top, so that the three bits of the locator pattern at A are
|
|
2407
|
-
// together. cornerBits is now:
|
|
2408
|
-
// 3 orientation bits at A || 3 orientation bits at B || ... || 3 orientation bits at D
|
|
2409
|
-
cornerBits = ((cornerBits & 1) << 11) + (cornerBits >> 1);
|
|
2410
|
-
// The result shift indicates which element of BullsEyeCorners[] goes into the top-left
|
|
2411
|
-
// corner. Since the four rotation values have a Hamming distance of 8, we
|
|
2412
|
-
// can easily tolerate two errors.
|
|
2413
|
-
for (var shift = 0; shift < 4; shift++) {
|
|
2414
|
-
if (_util_Integer__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].bitCount(cornerBits ^ this.EXPECTED_CORNER_BITS[shift]) <= 2) {
|
|
2415
|
-
return shift;
|
|
2416
|
-
}
|
|
2417
|
-
}
|
|
2418
|
-
throw new _NotFoundException__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"]();
|
|
2419
|
-
};
|
|
2420
|
-
/**
|
|
2421
|
-
* Corrects the parameter bits using Reed-Solomon algorithm.
|
|
2422
|
-
*
|
|
2423
|
-
* @param parameterData parameter bits
|
|
2424
|
-
* @param compact true if this is a compact Aztec code
|
|
2425
|
-
* @throws NotFoundException if the array contains too many errors
|
|
2426
|
-
*/
|
|
2427
|
-
Detector.prototype.getCorrectedParameterData = function (parameterData, compact) {
|
|
2428
|
-
var numCodewords;
|
|
2429
|
-
var numDataCodewords;
|
|
2430
|
-
if (compact) {
|
|
2431
|
-
numCodewords = 7;
|
|
2432
|
-
numDataCodewords = 2;
|
|
2433
|
-
}
|
|
2434
|
-
else {
|
|
2435
|
-
numCodewords = 10;
|
|
2436
|
-
numDataCodewords = 4;
|
|
2437
|
-
}
|
|
2438
|
-
var numECCodewords = numCodewords - numDataCodewords;
|
|
2439
|
-
var parameterWords = new Int32Array(numCodewords);
|
|
2440
|
-
for (var i = numCodewords - 1; i >= 0; --i) {
|
|
2441
|
-
parameterWords[i] = parameterData & 0xF;
|
|
2442
|
-
parameterData >>= 4;
|
|
2443
|
-
}
|
|
2444
|
-
try {
|
|
2445
|
-
var rsDecoder = new _common_reedsolomon_ReedSolomonDecoder__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"](_common_reedsolomon_GenericGF__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].AZTEC_PARAM);
|
|
2446
|
-
rsDecoder.decode(parameterWords, numECCodewords);
|
|
2447
|
-
}
|
|
2448
|
-
catch (ignored) {
|
|
2449
|
-
throw new _NotFoundException__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"]();
|
|
2450
|
-
}
|
|
2451
|
-
// Toss the error correction. Just return the data as an integer
|
|
2452
|
-
var result = 0;
|
|
2453
|
-
for (var i = 0; i < numDataCodewords; i++) {
|
|
2454
|
-
result = (result << 4) + parameterWords[i];
|
|
2455
|
-
}
|
|
2456
|
-
return result;
|
|
2457
|
-
};
|
|
2458
|
-
/**
|
|
2459
|
-
* Finds the corners of a bull-eye centered on the passed point.
|
|
2460
|
-
* This returns the centers of the diagonal points just outside the bull's eye
|
|
2461
|
-
* Returns [topRight, bottomRight, bottomLeft, topLeft]
|
|
2462
|
-
*
|
|
2463
|
-
* @param pCenter Center point
|
|
2464
|
-
* @return The corners of the bull-eye
|
|
2465
|
-
* @throws NotFoundException If no valid bull-eye can be found
|
|
2466
|
-
*/
|
|
2467
|
-
Detector.prototype.getBullsEyeCorners = function (pCenter) {
|
|
2468
|
-
var pina = pCenter;
|
|
2469
|
-
var pinb = pCenter;
|
|
2470
|
-
var pinc = pCenter;
|
|
2471
|
-
var pind = pCenter;
|
|
2472
|
-
var color = true;
|
|
2473
|
-
for (this.nbCenterLayers = 1; this.nbCenterLayers < 9; this.nbCenterLayers++) {
|
|
2474
|
-
var pouta = this.getFirstDifferent(pina, color, 1, -1);
|
|
2475
|
-
var poutb = this.getFirstDifferent(pinb, color, 1, 1);
|
|
2476
|
-
var poutc = this.getFirstDifferent(pinc, color, -1, 1);
|
|
2477
|
-
var poutd = this.getFirstDifferent(pind, color, -1, -1);
|
|
2478
|
-
// d a
|
|
2479
|
-
//
|
|
2480
|
-
// c b
|
|
2481
|
-
if (this.nbCenterLayers > 2) {
|
|
2482
|
-
var q = (this.distancePoint(poutd, pouta) * this.nbCenterLayers) / (this.distancePoint(pind, pina) * (this.nbCenterLayers + 2));
|
|
2483
|
-
if (q < 0.75 || q > 1.25 || !this.isWhiteOrBlackRectangle(pouta, poutb, poutc, poutd)) {
|
|
2484
|
-
break;
|
|
2485
|
-
}
|
|
2486
|
-
}
|
|
2487
|
-
pina = pouta;
|
|
2488
|
-
pinb = poutb;
|
|
2489
|
-
pinc = poutc;
|
|
2490
|
-
pind = poutd;
|
|
2491
|
-
color = !color;
|
|
2492
|
-
}
|
|
2493
|
-
if (this.nbCenterLayers !== 5 && this.nbCenterLayers !== 7) {
|
|
2494
|
-
throw new _NotFoundException__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"]();
|
|
2495
|
-
}
|
|
2496
|
-
this.compact = this.nbCenterLayers === 5;
|
|
2497
|
-
// Expand the square by .5 pixel in each direction so that we're on the border
|
|
2498
|
-
// between the white square and the black square
|
|
2499
|
-
var pinax = new _ResultPoint__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](pina.getX() + 0.5, pina.getY() - 0.5);
|
|
2500
|
-
var pinbx = new _ResultPoint__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](pinb.getX() + 0.5, pinb.getY() + 0.5);
|
|
2501
|
-
var pincx = new _ResultPoint__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](pinc.getX() - 0.5, pinc.getY() + 0.5);
|
|
2502
|
-
var pindx = new _ResultPoint__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](pind.getX() - 0.5, pind.getY() - 0.5);
|
|
2503
|
-
// Expand the square so that its corners are the centers of the points
|
|
2504
|
-
// just outside the bull's eye.
|
|
2505
|
-
return this.expandSquare([pinax, pinbx, pincx, pindx], 2 * this.nbCenterLayers - 3, 2 * this.nbCenterLayers);
|
|
2506
|
-
};
|
|
2507
|
-
/**
|
|
2508
|
-
* Finds a candidate center point of an Aztec code from an image
|
|
2509
|
-
*
|
|
2510
|
-
* @return the center point
|
|
2511
|
-
*/
|
|
2512
|
-
Detector.prototype.getMatrixCenter = function () {
|
|
2513
|
-
var pointA;
|
|
2514
|
-
var pointB;
|
|
2515
|
-
var pointC;
|
|
2516
|
-
var pointD;
|
|
2517
|
-
// Get a white rectangle that can be the border of the matrix in center bull's eye or
|
|
2518
|
-
try {
|
|
2519
|
-
var cornerPoints = new _common_detector_WhiteRectangleDetector__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"](this.image).detect();
|
|
2520
|
-
pointA = cornerPoints[0];
|
|
2521
|
-
pointB = cornerPoints[1];
|
|
2522
|
-
pointC = cornerPoints[2];
|
|
2523
|
-
pointD = cornerPoints[3];
|
|
2524
|
-
}
|
|
2525
|
-
catch (e) {
|
|
2526
|
-
// This exception can be in case the initial rectangle is white
|
|
2527
|
-
// In that case, surely in the bull's eye, we try to expand the rectangle.
|
|
2528
|
-
var cx_1 = this.image.getWidth() / 2;
|
|
2529
|
-
var cy_1 = this.image.getHeight() / 2;
|
|
2530
|
-
pointA = this.getFirstDifferent(new Point(cx_1 + 7, cy_1 - 7), false, 1, -1).toResultPoint();
|
|
2531
|
-
pointB = this.getFirstDifferent(new Point(cx_1 + 7, cy_1 + 7), false, 1, 1).toResultPoint();
|
|
2532
|
-
pointC = this.getFirstDifferent(new Point(cx_1 - 7, cy_1 + 7), false, -1, 1).toResultPoint();
|
|
2533
|
-
pointD = this.getFirstDifferent(new Point(cx_1 - 7, cy_1 - 7), false, -1, -1).toResultPoint();
|
|
2534
|
-
}
|
|
2535
|
-
// Compute the center of the rectangle
|
|
2536
|
-
var cx = _common_detector_MathUtils__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].round((pointA.getX() + pointD.getX() + pointB.getX() + pointC.getX()) / 4.0);
|
|
2537
|
-
var cy = _common_detector_MathUtils__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].round((pointA.getY() + pointD.getY() + pointB.getY() + pointC.getY()) / 4.0);
|
|
2538
|
-
// Redetermine the white rectangle starting from previously computed center.
|
|
2539
|
-
// This will ensure that we end up with a white rectangle in center bull's eye
|
|
2540
|
-
// in order to compute a more accurate center.
|
|
2541
|
-
try {
|
|
2542
|
-
var cornerPoints = new _common_detector_WhiteRectangleDetector__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"](this.image, 15, cx, cy).detect();
|
|
2543
|
-
pointA = cornerPoints[0];
|
|
2544
|
-
pointB = cornerPoints[1];
|
|
2545
|
-
pointC = cornerPoints[2];
|
|
2546
|
-
pointD = cornerPoints[3];
|
|
2547
|
-
}
|
|
2548
|
-
catch (e) {
|
|
2549
|
-
// This exception can be in case the initial rectangle is white
|
|
2550
|
-
// In that case we try to expand the rectangle.
|
|
2551
|
-
pointA = this.getFirstDifferent(new Point(cx + 7, cy - 7), false, 1, -1).toResultPoint();
|
|
2552
|
-
pointB = this.getFirstDifferent(new Point(cx + 7, cy + 7), false, 1, 1).toResultPoint();
|
|
2553
|
-
pointC = this.getFirstDifferent(new Point(cx - 7, cy + 7), false, -1, 1).toResultPoint();
|
|
2554
|
-
pointD = this.getFirstDifferent(new Point(cx - 7, cy - 7), false, -1, -1).toResultPoint();
|
|
2555
|
-
}
|
|
2556
|
-
// Recompute the center of the rectangle
|
|
2557
|
-
cx = _common_detector_MathUtils__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].round((pointA.getX() + pointD.getX() + pointB.getX() + pointC.getX()) / 4.0);
|
|
2558
|
-
cy = _common_detector_MathUtils__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].round((pointA.getY() + pointD.getY() + pointB.getY() + pointC.getY()) / 4.0);
|
|
2559
|
-
return new Point(cx, cy);
|
|
2560
|
-
};
|
|
2561
|
-
/**
|
|
2562
|
-
* Gets the Aztec code corners from the bull's eye corners and the parameters.
|
|
2563
|
-
*
|
|
2564
|
-
* @param bullsEyeCorners the array of bull's eye corners
|
|
2565
|
-
* @return the array of aztec code corners
|
|
2566
|
-
*/
|
|
2567
|
-
Detector.prototype.getMatrixCornerPoints = function (bullsEyeCorners) {
|
|
2568
|
-
return this.expandSquare(bullsEyeCorners, 2 * this.nbCenterLayers, this.getDimension());
|
|
2569
|
-
};
|
|
2570
|
-
/**
|
|
2571
|
-
* Creates a BitMatrix by sampling the provided image.
|
|
2572
|
-
* topLeft, topRight, bottomRight, and bottomLeft are the centers of the squares on the
|
|
2573
|
-
* diagonal just outside the bull's eye.
|
|
2574
|
-
*/
|
|
2575
|
-
Detector.prototype.sampleGrid = function (image, topLeft, topRight, bottomRight, bottomLeft) {
|
|
2576
|
-
var sampler = _common_GridSamplerInstance__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"].getInstance();
|
|
2577
|
-
var dimension = this.getDimension();
|
|
2578
|
-
var low = dimension / 2 - this.nbCenterLayers;
|
|
2579
|
-
var high = dimension / 2 + this.nbCenterLayers;
|
|
2580
|
-
return sampler.sampleGrid(image, dimension, dimension, low, low, // topleft
|
|
2581
|
-
high, low, // topright
|
|
2582
|
-
high, high, // bottomright
|
|
2583
|
-
low, high, // bottomleft
|
|
2584
|
-
topLeft.getX(), topLeft.getY(), topRight.getX(), topRight.getY(), bottomRight.getX(), bottomRight.getY(), bottomLeft.getX(), bottomLeft.getY());
|
|
2585
|
-
};
|
|
2586
|
-
/**
|
|
2587
|
-
* Samples a line.
|
|
2588
|
-
*
|
|
2589
|
-
* @param p1 start point (inclusive)
|
|
2590
|
-
* @param p2 end point (exclusive)
|
|
2591
|
-
* @param size number of bits
|
|
2592
|
-
* @return the array of bits as an int (first bit is high-order bit of result)
|
|
2593
|
-
*/
|
|
2594
|
-
Detector.prototype.sampleLine = function (p1, p2, size) {
|
|
2595
|
-
var result = 0;
|
|
2596
|
-
var d = this.distanceResultPoint(p1, p2);
|
|
2597
|
-
var moduleSize = d / size;
|
|
2598
|
-
var px = p1.getX();
|
|
2599
|
-
var py = p1.getY();
|
|
2600
|
-
var dx = moduleSize * (p2.getX() - p1.getX()) / d;
|
|
2601
|
-
var dy = moduleSize * (p2.getY() - p1.getY()) / d;
|
|
2602
|
-
for (var i = 0; i < size; i++) {
|
|
2603
|
-
if (this.image.get(_common_detector_MathUtils__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].round(px + i * dx), _common_detector_MathUtils__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].round(py + i * dy))) {
|
|
2604
|
-
result |= 1 << (size - i - 1);
|
|
2605
|
-
}
|
|
2606
|
-
}
|
|
2607
|
-
return result;
|
|
2608
|
-
};
|
|
2609
|
-
/**
|
|
2610
|
-
* @return true if the border of the rectangle passed in parameter is compound of white points only
|
|
2611
|
-
* or black points only
|
|
2612
|
-
*/
|
|
2613
|
-
Detector.prototype.isWhiteOrBlackRectangle = function (p1, p2, p3, p4) {
|
|
2614
|
-
var corr = 3;
|
|
2615
|
-
p1 = new Point(p1.getX() - corr, p1.getY() + corr);
|
|
2616
|
-
p2 = new Point(p2.getX() - corr, p2.getY() - corr);
|
|
2617
|
-
p3 = new Point(p3.getX() + corr, p3.getY() - corr);
|
|
2618
|
-
p4 = new Point(p4.getX() + corr, p4.getY() + corr);
|
|
2619
|
-
var cInit = this.getColor(p4, p1);
|
|
2620
|
-
if (cInit === 0) {
|
|
2621
|
-
return false;
|
|
2622
|
-
}
|
|
2623
|
-
var c = this.getColor(p1, p2);
|
|
2624
|
-
if (c !== cInit) {
|
|
2625
|
-
return false;
|
|
2626
|
-
}
|
|
2627
|
-
c = this.getColor(p2, p3);
|
|
2628
|
-
if (c !== cInit) {
|
|
2629
|
-
return false;
|
|
2630
|
-
}
|
|
2631
|
-
c = this.getColor(p3, p4);
|
|
2632
|
-
return c === cInit;
|
|
2633
|
-
};
|
|
2634
|
-
/**
|
|
2635
|
-
* Gets the color of a segment
|
|
2636
|
-
*
|
|
2637
|
-
* @return 1 if segment more than 90% black, -1 if segment is more than 90% white, 0 else
|
|
2638
|
-
*/
|
|
2639
|
-
Detector.prototype.getColor = function (p1, p2) {
|
|
2640
|
-
var d = this.distancePoint(p1, p2);
|
|
2641
|
-
var dx = (p2.getX() - p1.getX()) / d;
|
|
2642
|
-
var dy = (p2.getY() - p1.getY()) / d;
|
|
2643
|
-
var error = 0;
|
|
2644
|
-
var px = p1.getX();
|
|
2645
|
-
var py = p1.getY();
|
|
2646
|
-
var colorModel = this.image.get(p1.getX(), p1.getY());
|
|
2647
|
-
var iMax = Math.ceil(d);
|
|
2648
|
-
for (var i = 0; i < iMax; i++) {
|
|
2649
|
-
px += dx;
|
|
2650
|
-
py += dy;
|
|
2651
|
-
if (this.image.get(_common_detector_MathUtils__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].round(px), _common_detector_MathUtils__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].round(py)) !== colorModel) {
|
|
2652
|
-
error++;
|
|
2653
|
-
}
|
|
2654
|
-
}
|
|
2655
|
-
var errRatio = error / d;
|
|
2656
|
-
if (errRatio > 0.1 && errRatio < 0.9) {
|
|
2657
|
-
return 0;
|
|
2658
|
-
}
|
|
2659
|
-
return (errRatio <= 0.1) === colorModel ? 1 : -1;
|
|
2660
|
-
};
|
|
2661
|
-
/**
|
|
2662
|
-
* Gets the coordinate of the first point with a different color in the given direction
|
|
2663
|
-
*/
|
|
2664
|
-
Detector.prototype.getFirstDifferent = function (init, color, dx, dy) {
|
|
2665
|
-
var x = init.getX() + dx;
|
|
2666
|
-
var y = init.getY() + dy;
|
|
2667
|
-
while (this.isValid(x, y) && this.image.get(x, y) === color) {
|
|
2668
|
-
x += dx;
|
|
2669
|
-
y += dy;
|
|
2670
|
-
}
|
|
2671
|
-
x -= dx;
|
|
2672
|
-
y -= dy;
|
|
2673
|
-
while (this.isValid(x, y) && this.image.get(x, y) === color) {
|
|
2674
|
-
x += dx;
|
|
2675
|
-
}
|
|
2676
|
-
x -= dx;
|
|
2677
|
-
while (this.isValid(x, y) && this.image.get(x, y) === color) {
|
|
2678
|
-
y += dy;
|
|
2679
|
-
}
|
|
2680
|
-
y -= dy;
|
|
2681
|
-
return new Point(x, y);
|
|
2682
|
-
};
|
|
2683
|
-
/**
|
|
2684
|
-
* Expand the square represented by the corner points by pushing out equally in all directions
|
|
2685
|
-
*
|
|
2686
|
-
* @param cornerPoints the corners of the square, which has the bull's eye at its center
|
|
2687
|
-
* @param oldSide the original length of the side of the square in the target bit matrix
|
|
2688
|
-
* @param newSide the new length of the size of the square in the target bit matrix
|
|
2689
|
-
* @return the corners of the expanded square
|
|
2690
|
-
*/
|
|
2691
|
-
Detector.prototype.expandSquare = function (cornerPoints, oldSide, newSide) {
|
|
2692
|
-
var ratio = newSide / (2.0 * oldSide);
|
|
2693
|
-
var dx = cornerPoints[0].getX() - cornerPoints[2].getX();
|
|
2694
|
-
var dy = cornerPoints[0].getY() - cornerPoints[2].getY();
|
|
2695
|
-
var centerx = (cornerPoints[0].getX() + cornerPoints[2].getX()) / 2.0;
|
|
2696
|
-
var centery = (cornerPoints[0].getY() + cornerPoints[2].getY()) / 2.0;
|
|
2697
|
-
var result0 = new _ResultPoint__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](centerx + ratio * dx, centery + ratio * dy);
|
|
2698
|
-
var result2 = new _ResultPoint__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](centerx - ratio * dx, centery - ratio * dy);
|
|
2699
|
-
dx = cornerPoints[1].getX() - cornerPoints[3].getX();
|
|
2700
|
-
dy = cornerPoints[1].getY() - cornerPoints[3].getY();
|
|
2701
|
-
centerx = (cornerPoints[1].getX() + cornerPoints[3].getX()) / 2.0;
|
|
2702
|
-
centery = (cornerPoints[1].getY() + cornerPoints[3].getY()) / 2.0;
|
|
2703
|
-
var result1 = new _ResultPoint__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](centerx + ratio * dx, centery + ratio * dy);
|
|
2704
|
-
var result3 = new _ResultPoint__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](centerx - ratio * dx, centery - ratio * dy);
|
|
2705
|
-
var results = [result0, result1, result2, result3];
|
|
2706
|
-
return results;
|
|
2707
|
-
};
|
|
2708
|
-
Detector.prototype.isValid = function (x, y) {
|
|
2709
|
-
return x >= 0 && x < this.image.getWidth() && y > 0 && y < this.image.getHeight();
|
|
2710
|
-
};
|
|
2711
|
-
Detector.prototype.isValidPoint = function (point) {
|
|
2712
|
-
var x = _common_detector_MathUtils__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].round(point.getX());
|
|
2713
|
-
var y = _common_detector_MathUtils__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].round(point.getY());
|
|
2714
|
-
return this.isValid(x, y);
|
|
2715
|
-
};
|
|
2716
|
-
Detector.prototype.distancePoint = function (a, b) {
|
|
2717
|
-
return _common_detector_MathUtils__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].distance(a.getX(), a.getY(), b.getX(), b.getY());
|
|
2718
|
-
};
|
|
2719
|
-
Detector.prototype.distanceResultPoint = function (a, b) {
|
|
2720
|
-
return _common_detector_MathUtils__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].distance(a.getX(), a.getY(), b.getX(), b.getY());
|
|
2721
|
-
};
|
|
2722
|
-
Detector.prototype.getDimension = function () {
|
|
2723
|
-
if (this.compact) {
|
|
2724
|
-
return 4 * this.nbLayers + 11;
|
|
2725
|
-
}
|
|
2726
|
-
if (this.nbLayers <= 4) {
|
|
2727
|
-
return 4 * this.nbLayers + 15;
|
|
2728
|
-
}
|
|
2729
|
-
return 4 * this.nbLayers + 2 * (_util_Integer__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].truncDivision((this.nbLayers - 4), 8) + 1) + 15;
|
|
2730
|
-
};
|
|
2731
|
-
return Detector;
|
|
2732
|
-
}());
|
|
2733
|
-
/* harmony default export */ __webpack_exports__["a"] = (Detector);
|
|
2734
|
-
//# sourceMappingURL=Detector.js.map
|
|
2735
|
-
|
|
2736
|
-
/***/ }),
|
|
2737
|
-
|
|
2738
|
-
/***/ "f1aed":
|
|
2739
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
2740
|
-
|
|
2741
|
-
"use strict";
|
|
2742
|
-
/* harmony import */ var _BarcodeFormat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("a363");
|
|
2743
|
-
/* harmony import */ var _EncodeHintType__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("7163");
|
|
2744
|
-
/* harmony import */ var _encoder_Encoder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("84b8");
|
|
2745
|
-
/* harmony import */ var _common_BitMatrix__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("2011");
|
|
2746
|
-
/* harmony import */ var _util_Charset__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("ec6d");
|
|
2747
|
-
/* harmony import */ var _util_StandardCharsets__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("23a7");
|
|
2748
|
-
/* harmony import */ var _util_Integer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("ea29");
|
|
2749
|
-
/* harmony import */ var _IllegalStateException__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("9cca");
|
|
2750
|
-
/* harmony import */ var _IllegalArgumentException__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("f0a7");
|
|
2751
|
-
/* harmony import */ var _common_StringUtils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("f823");
|
|
2752
|
-
/*
|
|
2753
|
-
* Copyright 2013 ZXing authors
|
|
2754
|
-
*
|
|
2755
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2756
|
-
* you may not use this file except in compliance with the License.
|
|
2757
|
-
* You may obtain a copy of the License at
|
|
2758
|
-
*
|
|
2759
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2760
|
-
*
|
|
2761
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2762
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2763
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2764
|
-
* See the License for the specific language governing permissions and
|
|
2765
|
-
* limitations under the License.
|
|
2766
|
-
*/
|
|
2767
|
-
// package com.google.zxing.aztec;
|
|
2768
|
-
// import com.google.zxing.BarcodeFormat;
|
|
2769
|
-
|
|
2770
|
-
// import com.google.zxing.EncodeHintType;
|
|
2771
|
-
|
|
2772
|
-
// import com.google.zxing.aztec.encoder.Encoder;
|
|
2773
|
-
|
|
2774
|
-
// import com.google.zxing.common.BitMatrix;
|
|
2775
|
-
|
|
2776
|
-
// import java.nio.charset.Charset;
|
|
2777
|
-
|
|
2778
|
-
// import java.nio.charset.StandardCharsets;
|
|
2779
|
-
|
|
2780
|
-
// import java.util.Map;
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
/**
|
|
2786
|
-
* Renders an Aztec code as a {@link BitMatrix}.
|
|
2787
|
-
*/
|
|
2788
|
-
var AztecWriter = /** @class */ (function () {
|
|
2789
|
-
function AztecWriter() {
|
|
2790
|
-
}
|
|
2791
|
-
// @Override
|
|
2792
|
-
AztecWriter.prototype.encode = function (contents, format, width, height) {
|
|
2793
|
-
return this.encodeWithHints(contents, format, width, height, null);
|
|
2794
|
-
};
|
|
2795
|
-
// @Override
|
|
2796
|
-
AztecWriter.prototype.encodeWithHints = function (contents, format, width, height, hints) {
|
|
2797
|
-
var charset = _util_StandardCharsets__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].ISO_8859_1;
|
|
2798
|
-
var eccPercent = _encoder_Encoder__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].DEFAULT_EC_PERCENT;
|
|
2799
|
-
var layers = _encoder_Encoder__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].DEFAULT_AZTEC_LAYERS;
|
|
2800
|
-
if (hints != null) {
|
|
2801
|
-
if (hints.has(_EncodeHintType__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].CHARACTER_SET)) {
|
|
2802
|
-
charset = _util_Charset__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].forName(hints.get(_EncodeHintType__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].CHARACTER_SET).toString());
|
|
2803
|
-
}
|
|
2804
|
-
if (hints.has(_EncodeHintType__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].ERROR_CORRECTION)) {
|
|
2805
|
-
eccPercent = _util_Integer__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"].parseInt(hints.get(_EncodeHintType__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].ERROR_CORRECTION).toString());
|
|
2806
|
-
}
|
|
2807
|
-
if (hints.has(_EncodeHintType__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].AZTEC_LAYERS)) {
|
|
2808
|
-
layers = _util_Integer__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"].parseInt(hints.get(_EncodeHintType__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].AZTEC_LAYERS).toString());
|
|
2809
|
-
}
|
|
2810
|
-
}
|
|
2811
|
-
return AztecWriter.encodeLayers(contents, format, width, height, charset, eccPercent, layers);
|
|
2812
|
-
};
|
|
2813
|
-
AztecWriter.encodeLayers = function (contents, format, width, height, charset, eccPercent, layers) {
|
|
2814
|
-
if (format !== _BarcodeFormat__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].AZTEC) {
|
|
2815
|
-
throw new _IllegalArgumentException__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"]('Can only encode AZTEC, but got ' + format);
|
|
2816
|
-
}
|
|
2817
|
-
var aztec = _encoder_Encoder__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].encode(_common_StringUtils__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"].getBytes(contents, charset), eccPercent, layers);
|
|
2818
|
-
return AztecWriter.renderResult(aztec, width, height);
|
|
2819
|
-
};
|
|
2820
|
-
AztecWriter.renderResult = function (code, width, height) {
|
|
2821
|
-
var input = code.getMatrix();
|
|
2822
|
-
if (input == null) {
|
|
2823
|
-
throw new _IllegalStateException__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"]();
|
|
2824
|
-
}
|
|
2825
|
-
var inputWidth = input.getWidth();
|
|
2826
|
-
var inputHeight = input.getHeight();
|
|
2827
|
-
var outputWidth = Math.max(width, inputWidth);
|
|
2828
|
-
var outputHeight = Math.max(height, inputHeight);
|
|
2829
|
-
var multiple = Math.min(outputWidth / inputWidth, outputHeight / inputHeight);
|
|
2830
|
-
var leftPadding = (outputWidth - (inputWidth * multiple)) / 2;
|
|
2831
|
-
var topPadding = (outputHeight - (inputHeight * multiple)) / 2;
|
|
2832
|
-
var output = new _common_BitMatrix__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"](outputWidth, outputHeight);
|
|
2833
|
-
for (var inputY /*int*/ = 0, outputY = topPadding; inputY < inputHeight; inputY++, outputY += multiple) {
|
|
2834
|
-
// Write the contents of this row of the barcode
|
|
2835
|
-
for (var inputX /*int*/ = 0, outputX = leftPadding; inputX < inputWidth; inputX++, outputX += multiple) {
|
|
2836
|
-
if (input.get(inputX, inputY)) {
|
|
2837
|
-
output.setRegion(outputX, outputY, multiple, multiple);
|
|
2838
|
-
}
|
|
2839
|
-
}
|
|
2840
|
-
}
|
|
2841
|
-
return output;
|
|
2842
|
-
};
|
|
2843
|
-
return AztecWriter;
|
|
2844
|
-
}());
|
|
2845
|
-
/* unused harmony default export */ var _unused_webpack_default_export = (AztecWriter);
|
|
2846
|
-
//# sourceMappingURL=AztecWriter.js.map
|
|
2847
|
-
|
|
2848
|
-
/***/ }),
|
|
2849
|
-
|
|
2850
|
-
/***/ "f52c":
|
|
2851
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
2852
|
-
|
|
2853
|
-
"use strict";
|
|
2854
|
-
/* harmony import */ var _common_DetectorResult__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("7a37");
|
|
2855
|
-
/*
|
|
2856
|
-
* Copyright 2010 ZXing authors
|
|
2857
|
-
*
|
|
2858
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2859
|
-
* you may not use this file except in compliance with the License.
|
|
2860
|
-
* You may obtain a copy of the License at
|
|
2861
|
-
*
|
|
2862
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2863
|
-
*
|
|
2864
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2865
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2866
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2867
|
-
* See the License for the specific language governing permissions and
|
|
2868
|
-
* limitations under the License.
|
|
2869
|
-
*/
|
|
2870
|
-
var __extends = (undefined && undefined.__extends) || (function () {
|
|
2871
|
-
var extendStatics = function (d, b) {
|
|
2872
|
-
extendStatics = Object.setPrototypeOf ||
|
|
2873
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
2874
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
2875
|
-
return extendStatics(d, b);
|
|
2876
|
-
};
|
|
2877
|
-
return function (d, b) {
|
|
2878
|
-
extendStatics(d, b);
|
|
2879
|
-
function __() { this.constructor = d; }
|
|
2880
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
2881
|
-
};
|
|
2882
|
-
})();
|
|
2883
|
-
|
|
2884
|
-
/**
|
|
2885
|
-
* <p>Extends {@link DetectorResult} with more information specific to the Aztec format,
|
|
2886
|
-
* like the number of layers and whether it's compact.</p>
|
|
2887
|
-
*
|
|
2888
|
-
* @author Sean Owen
|
|
2889
|
-
*/
|
|
2890
|
-
var AztecDetectorResult = /** @class */ (function (_super) {
|
|
2891
|
-
__extends(AztecDetectorResult, _super);
|
|
2892
|
-
function AztecDetectorResult(bits, points, compact, nbDatablocks, nbLayers) {
|
|
2893
|
-
var _this = _super.call(this, bits, points) || this;
|
|
2894
|
-
_this.compact = compact;
|
|
2895
|
-
_this.nbDatablocks = nbDatablocks;
|
|
2896
|
-
_this.nbLayers = nbLayers;
|
|
2897
|
-
return _this;
|
|
2898
|
-
}
|
|
2899
|
-
AztecDetectorResult.prototype.getNbLayers = function () {
|
|
2900
|
-
return this.nbLayers;
|
|
2901
|
-
};
|
|
2902
|
-
AztecDetectorResult.prototype.getNbDatablocks = function () {
|
|
2903
|
-
return this.nbDatablocks;
|
|
2904
|
-
};
|
|
2905
|
-
AztecDetectorResult.prototype.isCompact = function () {
|
|
2906
|
-
return this.compact;
|
|
2907
|
-
};
|
|
2908
|
-
return AztecDetectorResult;
|
|
2909
|
-
}(_common_DetectorResult__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]));
|
|
2910
|
-
/* harmony default export */ __webpack_exports__["a"] = (AztecDetectorResult);
|
|
2911
|
-
//# sourceMappingURL=AztecDetectorResult.js.map
|
|
2912
|
-
|
|
2913
|
-
/***/ })
|
|
2914
|
-
|
|
2915
|
-
}]);
|
|
2916
|
-
//# sourceMappingURL=super-ui.common.yarn.zxing~fd3cc9f3.js.map
|