@lglab/react-qr-code 1.7.2 → 1.7.3

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/dist/index.es.js CHANGED
@@ -203,804 +203,735 @@ var d = (e) => {
203
203
  d: `M0,0 h${n}v${n}H0z`,
204
204
  ...x
205
205
  })] });
206
- }, C;
207
- (function(e) {
208
- class t {
209
- static encodeText(e, n) {
210
- let r = C.QrSegment.makeSegments(e);
211
- return t.encodeSegments(r, n);
212
- }
213
- static encodeBinary(e, n) {
214
- let r = C.QrSegment.makeBytes(e);
215
- return t.encodeSegments([r], n);
216
- }
217
- static encodeSegments(e, r, o = 1, s = 40, c = -1, l = !0) {
218
- if (!(t.MIN_VERSION <= o && o <= s && s <= t.MAX_VERSION) || c < -1 || c > 7) throw RangeError("Invalid value");
219
- let u, d;
220
- for (u = o;; u++) {
221
- let n = t.getNumDataCodewords(u, r) * 8, i = a.getTotalBits(e, u);
222
- if (i <= n) {
223
- d = i;
224
- break;
225
- }
226
- if (u >= s) throw RangeError("Data too long");
227
- }
228
- for (let e of [
229
- t.Ecc.MEDIUM,
230
- t.Ecc.QUARTILE,
231
- t.Ecc.HIGH
232
- ]) l && d <= t.getNumDataCodewords(u, e) * 8 && (r = e);
233
- let f = [];
234
- for (let t of e) {
235
- n(t.mode.modeBits, 4, f), n(t.numChars, t.mode.numCharCountBits(u), f);
236
- for (let e of t.getData()) f.push(e);
237
- }
238
- i(f.length == d);
239
- let p = t.getNumDataCodewords(u, r) * 8;
240
- i(f.length <= p), n(0, Math.min(4, p - f.length), f), n(0, (8 - f.length % 8) % 8, f), i(f.length % 8 == 0);
241
- for (let e = 236; f.length < p; e ^= 253) n(e, 8, f);
242
- let m = [];
243
- for (; m.length * 8 < f.length;) m.push(0);
244
- return f.forEach((e, t) => m[t >>> 3] |= e << 7 - (t & 7)), new t(u, r, m, c);
245
- }
246
- constructor(e, n, r, a) {
247
- if (this.version = e, this.errorCorrectionLevel = n, this.modules = [], this.isFunction = [], e < t.MIN_VERSION || e > t.MAX_VERSION) throw RangeError("Version value out of range");
248
- if (a < -1 || a > 7) throw RangeError("Mask value out of range");
249
- this.size = e * 4 + 17;
250
- let o = [];
251
- for (let e = 0; e < this.size; e++) o.push(!1);
252
- for (let e = 0; e < this.size; e++) this.modules.push(o.slice()), this.isFunction.push(o.slice());
253
- this.drawFunctionPatterns();
254
- let s = this.addEccAndInterleave(r);
255
- if (this.drawCodewords(s), a == -1) {
256
- let e = 1e9;
257
- for (let t = 0; t < 8; t++) {
258
- this.applyMask(t), this.drawFormatBits(t);
259
- let n = this.getPenaltyScore();
260
- n < e && (a = t, e = n), this.applyMask(t);
261
- }
206
+ }, C, w, T, E, D = class e {
207
+ static encodeText(t, n) {
208
+ let r = j.makeSegments(t);
209
+ return e.encodeSegments(r, n);
210
+ }
211
+ static encodeBinary(t, n) {
212
+ let r = j.makeBytes(t);
213
+ return e.encodeSegments([r], n);
214
+ }
215
+ static encodeSegments(t, n, r = 1, i = 40, a = -1, o = !0) {
216
+ if (!(e.MIN_VERSION <= r && r <= i && i <= e.MAX_VERSION) || a < -1 || a > 7) throw RangeError("Invalid value");
217
+ let s, c;
218
+ for (s = r;; s++) {
219
+ let r = e.getNumDataCodewords(s, n) * 8, a = j.getTotalBits(t, s);
220
+ if (a <= r) {
221
+ c = a;
222
+ break;
262
223
  }
263
- i(0 <= a && a <= 7), this.mask = a, this.applyMask(a), this.drawFormatBits(a), this.isFunction = [];
224
+ if (s >= i) throw RangeError("Data too long");
264
225
  }
265
- getModule(e, t) {
266
- return 0 <= e && e < this.size && 0 <= t && t < this.size && this.modules[t][e];
226
+ for (let t of [
227
+ M.MEDIUM,
228
+ M.QUARTILE,
229
+ M.HIGH
230
+ ]) o && c <= e.getNumDataCodewords(s, t) * 8 && (n = t);
231
+ let l = [];
232
+ for (let e of t) {
233
+ O(e.mode.modeBits, 4, l), O(e.numChars, e.mode.numCharCountBits(s), l);
234
+ for (let t of e.getData()) l.push(t);
267
235
  }
268
- getModules() {
269
- return this.modules;
270
- }
271
- drawFunctionPatterns() {
272
- for (let e = 0; e < this.size; e++) this.setFunctionModule(6, e, e % 2 == 0), this.setFunctionModule(e, 6, e % 2 == 0);
273
- this.drawFinderPattern(3, 3), this.drawFinderPattern(this.size - 4, 3), this.drawFinderPattern(3, this.size - 4);
274
- let e = this.getAlignmentPatternPositions(), t = e.length;
275
- for (let n = 0; n < t; n++) for (let r = 0; r < t; r++) n == 0 && r == 0 || n == 0 && r == t - 1 || n == t - 1 && r == 0 || this.drawAlignmentPattern(e[n], e[r]);
276
- this.drawFormatBits(0), this.drawVersion();
277
- }
278
- drawFormatBits(e) {
279
- let t = this.errorCorrectionLevel.formatBits << 3 | e, n = t;
280
- for (let e = 0; e < 10; e++) n = n << 1 ^ (n >>> 9) * 1335;
281
- let a = (t << 10 | n) ^ 21522;
282
- i(!(a >>> 15));
283
- for (let e = 0; e <= 5; e++) this.setFunctionModule(8, e, r(a, e));
284
- this.setFunctionModule(8, 7, r(a, 6)), this.setFunctionModule(8, 8, r(a, 7)), this.setFunctionModule(7, 8, r(a, 8));
285
- for (let e = 9; e < 15; e++) this.setFunctionModule(14 - e, 8, r(a, e));
286
- for (let e = 0; e < 8; e++) this.setFunctionModule(this.size - 1 - e, 8, r(a, e));
287
- for (let e = 8; e < 15; e++) this.setFunctionModule(8, this.size - 15 + e, r(a, e));
288
- this.setFunctionModule(8, this.size - 8, !0);
289
- }
290
- drawVersion() {
291
- if (this.version < 7) return;
292
- let e = this.version;
293
- for (let t = 0; t < 12; t++) e = e << 1 ^ (e >>> 11) * 7973;
294
- let t = this.version << 12 | e;
295
- i(!(t >>> 18));
296
- for (let e = 0; e < 18; e++) {
297
- let n = r(t, e), i = this.size - 11 + e % 3, a = Math.floor(e / 3);
298
- this.setFunctionModule(i, a, n), this.setFunctionModule(a, i, n);
299
- }
300
- }
301
- drawFinderPattern(e, t) {
302
- for (let n = -4; n <= 4; n++) for (let r = -4; r <= 4; r++) {
303
- let i = Math.max(Math.abs(r), Math.abs(n)), a = e + r, o = t + n;
304
- 0 <= a && a < this.size && 0 <= o && o < this.size && this.setFunctionModule(a, o, i != 2 && i != 4);
236
+ A(l.length == c);
237
+ let u = e.getNumDataCodewords(s, n) * 8;
238
+ A(l.length <= u), O(0, Math.min(4, u - l.length), l), O(0, (8 - l.length % 8) % 8, l), A(l.length % 8 == 0);
239
+ for (let e = 236; l.length < u; e ^= 253) O(e, 8, l);
240
+ let d = [];
241
+ for (; d.length * 8 < l.length;) d.push(0);
242
+ return l.forEach((e, t) => d[t >>> 3] |= e << 7 - (t & 7)), new e(s, n, d, a);
243
+ }
244
+ constructor(t, n, r, i) {
245
+ if (this.version = t, this.errorCorrectionLevel = n, this.modules = [], this.isFunction = [], t < e.MIN_VERSION || t > e.MAX_VERSION) throw RangeError("Version value out of range");
246
+ if (i < -1 || i > 7) throw RangeError("Mask value out of range");
247
+ this.size = t * 4 + 17;
248
+ let a = [];
249
+ for (let e = 0; e < this.size; e++) a.push(!1);
250
+ for (let e = 0; e < this.size; e++) this.modules.push(a.slice()), this.isFunction.push(a.slice());
251
+ this.drawFunctionPatterns();
252
+ let o = this.addEccAndInterleave(r);
253
+ if (this.drawCodewords(o), i == -1) {
254
+ let e = 1e9;
255
+ for (let t = 0; t < 8; t++) {
256
+ this.applyMask(t), this.drawFormatBits(t);
257
+ let n = this.getPenaltyScore();
258
+ n < e && (i = t, e = n), this.applyMask(t);
305
259
  }
306
260
  }
307
- drawAlignmentPattern(e, t) {
308
- for (let n = -2; n <= 2; n++) for (let r = -2; r <= 2; r++) this.setFunctionModule(e + r, t + n, Math.max(Math.abs(r), Math.abs(n)) != 1);
309
- }
310
- setFunctionModule(e, t, n) {
311
- this.modules[t][e] = n, this.isFunction[t][e] = !0;
261
+ A(0 <= i && i <= 7), this.mask = i, this.applyMask(i), this.drawFormatBits(i), this.isFunction = [];
262
+ }
263
+ getModule(e, t) {
264
+ return 0 <= e && e < this.size && 0 <= t && t < this.size && this.modules[t][e];
265
+ }
266
+ getModules() {
267
+ return this.modules;
268
+ }
269
+ drawFunctionPatterns() {
270
+ for (let e = 0; e < this.size; e++) this.setFunctionModule(6, e, e % 2 == 0), this.setFunctionModule(e, 6, e % 2 == 0);
271
+ this.drawFinderPattern(3, 3), this.drawFinderPattern(this.size - 4, 3), this.drawFinderPattern(3, this.size - 4);
272
+ let e = this.getAlignmentPatternPositions(), t = e.length;
273
+ for (let n = 0; n < t; n++) for (let r = 0; r < t; r++) n == 0 && r == 0 || n == 0 && r == t - 1 || n == t - 1 && r == 0 || this.drawAlignmentPattern(e[n], e[r]);
274
+ this.drawFormatBits(0), this.drawVersion();
275
+ }
276
+ drawFormatBits(e) {
277
+ let t = this.errorCorrectionLevel.formatBits << 3 | e, n = t;
278
+ for (let e = 0; e < 10; e++) n = n << 1 ^ (n >>> 9) * 1335;
279
+ let r = (t << 10 | n) ^ 21522;
280
+ A(!(r >>> 15));
281
+ for (let e = 0; e <= 5; e++) this.setFunctionModule(8, e, k(r, e));
282
+ this.setFunctionModule(8, 7, k(r, 6)), this.setFunctionModule(8, 8, k(r, 7)), this.setFunctionModule(7, 8, k(r, 8));
283
+ for (let e = 9; e < 15; e++) this.setFunctionModule(14 - e, 8, k(r, e));
284
+ for (let e = 0; e < 8; e++) this.setFunctionModule(this.size - 1 - e, 8, k(r, e));
285
+ for (let e = 8; e < 15; e++) this.setFunctionModule(8, this.size - 15 + e, k(r, e));
286
+ this.setFunctionModule(8, this.size - 8, !0);
287
+ }
288
+ drawVersion() {
289
+ if (this.version < 7) return;
290
+ let e = this.version;
291
+ for (let t = 0; t < 12; t++) e = e << 1 ^ (e >>> 11) * 7973;
292
+ let t = this.version << 12 | e;
293
+ A(!(t >>> 18));
294
+ for (let e = 0; e < 18; e++) {
295
+ let n = k(t, e), r = this.size - 11 + e % 3, i = Math.floor(e / 3);
296
+ this.setFunctionModule(r, i, n), this.setFunctionModule(i, r, n);
312
297
  }
313
- addEccAndInterleave(e) {
314
- let n = this.version, r = this.errorCorrectionLevel;
315
- if (e.length != t.getNumDataCodewords(n, r)) throw RangeError("Invalid argument");
316
- let a = t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n], o = t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n], s = Math.floor(t.getNumRawDataModules(n) / 8), c = a - s % a, l = Math.floor(s / a), u = [], d = t.reedSolomonComputeDivisor(o);
317
- for (let n = 0, r = 0; n < a; n++) {
318
- let i = e.slice(r, r + l - o + (n < c ? 0 : 1));
319
- r += i.length;
320
- let a = t.reedSolomonComputeRemainder(i, d);
321
- n < c && i.push(0), u.push(i.concat(a));
322
- }
323
- let f = [];
324
- for (let e = 0; e < u[0].length; e++) u.forEach((t, n) => {
325
- (e != l - o || n >= c) && f.push(t[e]);
326
- });
327
- return i(f.length == s), f;
298
+ }
299
+ drawFinderPattern(e, t) {
300
+ for (let n = -4; n <= 4; n++) for (let r = -4; r <= 4; r++) {
301
+ let i = Math.max(Math.abs(r), Math.abs(n)), a = e + r, o = t + n;
302
+ 0 <= a && a < this.size && 0 <= o && o < this.size && this.setFunctionModule(a, o, i != 2 && i != 4);
328
303
  }
329
- drawCodewords(e) {
330
- if (e.length != Math.floor(t.getNumRawDataModules(this.version) / 8)) throw RangeError("Invalid argument");
331
- let n = 0;
332
- for (let t = this.size - 1; t >= 1; t -= 2) {
333
- t == 6 && (t = 5);
334
- for (let i = 0; i < this.size; i++) for (let a = 0; a < 2; a++) {
335
- let o = t - a, s = t + 1 & 2 ? i : this.size - 1 - i;
336
- !this.isFunction[s][o] && n < e.length * 8 && (this.modules[s][o] = r(e[n >>> 3], 7 - (n & 7)), n++);
337
- }
338
- }
339
- i(n == e.length * 8);
304
+ }
305
+ drawAlignmentPattern(e, t) {
306
+ for (let n = -2; n <= 2; n++) for (let r = -2; r <= 2; r++) this.setFunctionModule(e + r, t + n, Math.max(Math.abs(r), Math.abs(n)) != 1);
307
+ }
308
+ setFunctionModule(e, t, n) {
309
+ this.modules[t][e] = n, this.isFunction[t][e] = !0;
310
+ }
311
+ addEccAndInterleave(t) {
312
+ let n = this.version, r = this.errorCorrectionLevel;
313
+ if (t.length != e.getNumDataCodewords(n, r)) throw RangeError("Invalid argument");
314
+ let i = e.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n], a = e.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n], o = Math.floor(e.getNumRawDataModules(n) / 8), s = i - o % i, c = Math.floor(o / i), l = [], u = e.reedSolomonComputeDivisor(a);
315
+ for (let n = 0, r = 0; n < i; n++) {
316
+ let i = t.slice(r, r + c - a + (n < s ? 0 : 1));
317
+ r += i.length;
318
+ let o = e.reedSolomonComputeRemainder(i, u);
319
+ n < s && i.push(0), l.push(i.concat(o));
340
320
  }
341
- applyMask(e) {
342
- if (e < 0 || e > 7) throw RangeError("Mask value out of range");
343
- for (let t = 0; t < this.size; t++) for (let n = 0; n < this.size; n++) {
344
- let r;
345
- switch (e) {
346
- case 0:
347
- r = (n + t) % 2 == 0;
348
- break;
349
- case 1:
350
- r = t % 2 == 0;
351
- break;
352
- case 2:
353
- r = n % 3 == 0;
354
- break;
355
- case 3:
356
- r = (n + t) % 3 == 0;
357
- break;
358
- case 4:
359
- r = (Math.floor(n / 3) + Math.floor(t / 2)) % 2 == 0;
360
- break;
361
- case 5:
362
- r = n * t % 2 + n * t % 3 == 0;
363
- break;
364
- case 6:
365
- r = (n * t % 2 + n * t % 3) % 2 == 0;
366
- break;
367
- case 7:
368
- r = ((n + t) % 2 + n * t % 3) % 2 == 0;
369
- break;
370
- default: throw Error("Unreachable");
371
- }
372
- !this.isFunction[t][n] && r && (this.modules[t][n] = !this.modules[t][n]);
321
+ let d = [];
322
+ for (let e = 0; e < l[0].length; e++) l.forEach((t, n) => {
323
+ (e != c - a || n >= s) && d.push(t[e]);
324
+ });
325
+ return A(d.length == o), d;
326
+ }
327
+ drawCodewords(t) {
328
+ if (t.length != Math.floor(e.getNumRawDataModules(this.version) / 8)) throw RangeError("Invalid argument");
329
+ let n = 0;
330
+ for (let e = this.size - 1; e >= 1; e -= 2) {
331
+ e == 6 && (e = 5);
332
+ for (let r = 0; r < this.size; r++) for (let i = 0; i < 2; i++) {
333
+ let a = e - i, o = e + 1 & 2 ? r : this.size - 1 - r;
334
+ !this.isFunction[o][a] && n < t.length * 8 && (this.modules[o][a] = k(t[n >>> 3], 7 - (n & 7)), n++);
373
335
  }
374
336
  }
375
- getPenaltyScore() {
376
- let e = 0;
377
- for (let n = 0; n < this.size; n++) {
378
- let r = !1, i = 0, a = [
379
- 0,
380
- 0,
381
- 0,
382
- 0,
383
- 0,
384
- 0,
385
- 0
386
- ];
387
- for (let o = 0; o < this.size; o++) this.modules[n][o] == r ? (i++, i == 5 ? e += t.PENALTY_N1 : i > 5 && e++) : (this.finderPenaltyAddHistory(i, a), r || (e += this.finderPenaltyCountPatterns(a) * t.PENALTY_N3), r = this.modules[n][o], i = 1);
388
- e += this.finderPenaltyTerminateAndCount(r, i, a) * t.PENALTY_N3;
389
- }
390
- for (let n = 0; n < this.size; n++) {
391
- let r = !1, i = 0, a = [
392
- 0,
393
- 0,
394
- 0,
395
- 0,
396
- 0,
397
- 0,
398
- 0
399
- ];
400
- for (let o = 0; o < this.size; o++) this.modules[o][n] == r ? (i++, i == 5 ? e += t.PENALTY_N1 : i > 5 && e++) : (this.finderPenaltyAddHistory(i, a), r || (e += this.finderPenaltyCountPatterns(a) * t.PENALTY_N3), r = this.modules[o][n], i = 1);
401
- e += this.finderPenaltyTerminateAndCount(r, i, a) * t.PENALTY_N3;
402
- }
403
- for (let n = 0; n < this.size - 1; n++) for (let r = 0; r < this.size - 1; r++) {
404
- let i = this.modules[n][r];
405
- i == this.modules[n][r + 1] && i == this.modules[n + 1][r] && i == this.modules[n + 1][r + 1] && (e += t.PENALTY_N2);
337
+ A(n == t.length * 8);
338
+ }
339
+ applyMask(e) {
340
+ if (e < 0 || e > 7) throw RangeError("Mask value out of range");
341
+ for (let t = 0; t < this.size; t++) for (let n = 0; n < this.size; n++) {
342
+ let r;
343
+ switch (e) {
344
+ case 0:
345
+ r = (n + t) % 2 == 0;
346
+ break;
347
+ case 1:
348
+ r = t % 2 == 0;
349
+ break;
350
+ case 2:
351
+ r = n % 3 == 0;
352
+ break;
353
+ case 3:
354
+ r = (n + t) % 3 == 0;
355
+ break;
356
+ case 4:
357
+ r = (Math.floor(n / 3) + Math.floor(t / 2)) % 2 == 0;
358
+ break;
359
+ case 5:
360
+ r = n * t % 2 + n * t % 3 == 0;
361
+ break;
362
+ case 6:
363
+ r = (n * t % 2 + n * t % 3) % 2 == 0;
364
+ break;
365
+ case 7:
366
+ r = ((n + t) % 2 + n * t % 3) % 2 == 0;
367
+ break;
368
+ default: throw Error("Unreachable");
406
369
  }
407
- let n = 0;
408
- for (let e of this.modules) n = e.reduce((e, t) => e + +!!t, n);
409
- let r = this.size * this.size, a = Math.ceil(Math.abs(n * 20 - r * 10) / r) - 1;
410
- return i(0 <= a && a <= 9), e += a * t.PENALTY_N4, i(0 <= e && e <= 2568888), e;
370
+ !this.isFunction[t][n] && r && (this.modules[t][n] = !this.modules[t][n]);
411
371
  }
412
- getAlignmentPatternPositions() {
413
- if (this.version == 1) return [];
414
- {
415
- let e = Math.floor(this.version / 7) + 2, t = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (e * 2 - 2)) * 2, n = [6];
416
- for (let r = this.size - 7; n.length < e; r -= t) n.splice(1, 0, r);
417
- return n;
418
- }
372
+ }
373
+ getPenaltyScore() {
374
+ let t = 0;
375
+ for (let n = 0; n < this.size; n++) {
376
+ let r = !1, i = 0, a = [
377
+ 0,
378
+ 0,
379
+ 0,
380
+ 0,
381
+ 0,
382
+ 0,
383
+ 0
384
+ ];
385
+ for (let o = 0; o < this.size; o++) this.modules[n][o] == r ? (i++, i == 5 ? t += e.PENALTY_N1 : i > 5 && t++) : (this.finderPenaltyAddHistory(i, a), r || (t += this.finderPenaltyCountPatterns(a) * e.PENALTY_N3), r = this.modules[n][o], i = 1);
386
+ t += this.finderPenaltyTerminateAndCount(r, i, a) * e.PENALTY_N3;
419
387
  }
420
- static getNumRawDataModules(e) {
421
- if (e < t.MIN_VERSION || e > t.MAX_VERSION) throw RangeError("Version number out of range");
422
- let n = (16 * e + 128) * e + 64;
423
- if (e >= 2) {
424
- let t = Math.floor(e / 7) + 2;
425
- n -= (25 * t - 10) * t - 55, e >= 7 && (n -= 36);
426
- }
427
- return i(208 <= n && n <= 29648), n;
388
+ for (let n = 0; n < this.size; n++) {
389
+ let r = !1, i = 0, a = [
390
+ 0,
391
+ 0,
392
+ 0,
393
+ 0,
394
+ 0,
395
+ 0,
396
+ 0
397
+ ];
398
+ for (let o = 0; o < this.size; o++) this.modules[o][n] == r ? (i++, i == 5 ? t += e.PENALTY_N1 : i > 5 && t++) : (this.finderPenaltyAddHistory(i, a), r || (t += this.finderPenaltyCountPatterns(a) * e.PENALTY_N3), r = this.modules[o][n], i = 1);
399
+ t += this.finderPenaltyTerminateAndCount(r, i, a) * e.PENALTY_N3;
428
400
  }
429
- static getNumDataCodewords(e, n) {
430
- return Math.floor(t.getNumRawDataModules(e) / 8) - t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e] * t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e];
401
+ for (let n = 0; n < this.size - 1; n++) for (let r = 0; r < this.size - 1; r++) {
402
+ let i = this.modules[n][r];
403
+ i == this.modules[n][r + 1] && i == this.modules[n + 1][r] && i == this.modules[n + 1][r + 1] && (t += e.PENALTY_N2);
431
404
  }
432
- static reedSolomonComputeDivisor(e) {
433
- if (e < 1 || e > 255) throw RangeError("Degree out of range");
434
- let n = [];
435
- for (let t = 0; t < e - 1; t++) n.push(0);
436
- n.push(1);
437
- let r = 1;
438
- for (let i = 0; i < e; i++) {
439
- for (let e = 0; e < n.length; e++) n[e] = t.reedSolomonMultiply(n[e], r), e + 1 < n.length && (n[e] ^= n[e + 1]);
440
- r = t.reedSolomonMultiply(r, 2);
441
- }
405
+ let n = 0;
406
+ for (let e of this.modules) n = e.reduce((e, t) => e + +!!t, n);
407
+ let r = this.size * this.size, i = Math.ceil(Math.abs(n * 20 - r * 10) / r) - 1;
408
+ return A(0 <= i && i <= 9), t += i * e.PENALTY_N4, A(0 <= t && t <= 2568888), t;
409
+ }
410
+ getAlignmentPatternPositions() {
411
+ if (this.version == 1) return [];
412
+ {
413
+ let e = Math.floor(this.version / 7) + 2, t = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (e * 2 - 2)) * 2, n = [6];
414
+ for (let r = this.size - 7; n.length < e; r -= t) n.splice(1, 0, r);
442
415
  return n;
443
416
  }
444
- static reedSolomonComputeRemainder(e, n) {
445
- let r = n.map((e) => 0);
446
- for (let i of e) {
447
- let e = i ^ r.shift();
448
- r.push(0), n.forEach((n, i) => r[i] ^= t.reedSolomonMultiply(n, e));
449
- }
450
- return r;
451
- }
452
- static reedSolomonMultiply(e, t) {
453
- if (e >>> 8 || t >>> 8) throw RangeError("Byte out of range");
454
- let n = 0;
455
- for (let r = 7; r >= 0; r--) n = n << 1 ^ (n >>> 7) * 285, n ^= (t >>> r & 1) * e;
456
- return i(!(n >>> 8)), n;
457
- }
458
- finderPenaltyCountPatterns(e) {
459
- let t = e[1];
460
- i(t <= this.size * 3);
461
- let n = t > 0 && e[2] == t && e[3] == t * 3 && e[4] == t && e[5] == t;
462
- return (n && e[0] >= t * 4 && e[6] >= t ? 1 : 0) + (n && e[6] >= t * 4 && e[0] >= t ? 1 : 0);
463
- }
464
- finderPenaltyTerminateAndCount(e, t, n) {
465
- return e && (this.finderPenaltyAddHistory(t, n), t = 0), t += this.size, this.finderPenaltyAddHistory(t, n), this.finderPenaltyCountPatterns(n);
466
- }
467
- finderPenaltyAddHistory(e, t) {
468
- t[0] == 0 && (e += this.size), t.pop(), t.unshift(e);
469
- }
470
- static {
471
- this.MIN_VERSION = 1;
472
- }
473
- static {
474
- this.MAX_VERSION = 40;
475
- }
476
- static {
477
- this.PENALTY_N1 = 3;
478
- }
479
- static {
480
- this.PENALTY_N2 = 3;
481
- }
482
- static {
483
- this.PENALTY_N3 = 40;
484
- }
485
- static {
486
- this.PENALTY_N4 = 10;
417
+ }
418
+ static getNumRawDataModules(t) {
419
+ if (t < e.MIN_VERSION || t > e.MAX_VERSION) throw RangeError("Version number out of range");
420
+ let n = (16 * t + 128) * t + 64;
421
+ if (t >= 2) {
422
+ let e = Math.floor(t / 7) + 2;
423
+ n -= (25 * e - 10) * e - 55, t >= 7 && (n -= 36);
487
424
  }
488
- static {
489
- this.ECC_CODEWORDS_PER_BLOCK = [
490
- [
491
- -1,
492
- 7,
493
- 10,
494
- 15,
495
- 20,
496
- 26,
497
- 18,
498
- 20,
499
- 24,
500
- 30,
501
- 18,
502
- 20,
503
- 24,
504
- 26,
505
- 30,
506
- 22,
507
- 24,
508
- 28,
509
- 30,
510
- 28,
511
- 28,
512
- 28,
513
- 28,
514
- 30,
515
- 30,
516
- 26,
517
- 28,
518
- 30,
519
- 30,
520
- 30,
521
- 30,
522
- 30,
523
- 30,
524
- 30,
525
- 30,
526
- 30,
527
- 30,
528
- 30,
529
- 30,
530
- 30,
531
- 30
532
- ],
533
- [
534
- -1,
535
- 10,
536
- 16,
537
- 26,
538
- 18,
539
- 24,
540
- 16,
541
- 18,
542
- 22,
543
- 22,
544
- 26,
545
- 30,
546
- 22,
547
- 22,
548
- 24,
549
- 24,
550
- 28,
551
- 28,
552
- 26,
553
- 26,
554
- 26,
555
- 26,
556
- 28,
557
- 28,
558
- 28,
559
- 28,
560
- 28,
561
- 28,
562
- 28,
563
- 28,
564
- 28,
565
- 28,
566
- 28,
567
- 28,
568
- 28,
569
- 28,
570
- 28,
571
- 28,
572
- 28,
573
- 28,
574
- 28
575
- ],
576
- [
577
- -1,
578
- 13,
579
- 22,
580
- 18,
581
- 26,
582
- 18,
583
- 24,
584
- 18,
585
- 22,
586
- 20,
587
- 24,
588
- 28,
589
- 26,
590
- 24,
591
- 20,
592
- 30,
593
- 24,
594
- 28,
595
- 28,
596
- 26,
597
- 30,
598
- 28,
599
- 30,
600
- 30,
601
- 30,
602
- 30,
603
- 28,
604
- 30,
605
- 30,
606
- 30,
607
- 30,
608
- 30,
609
- 30,
610
- 30,
611
- 30,
612
- 30,
613
- 30,
614
- 30,
615
- 30,
616
- 30,
617
- 30
618
- ],
619
- [
620
- -1,
621
- 17,
622
- 28,
623
- 22,
624
- 16,
625
- 22,
626
- 28,
627
- 26,
628
- 26,
629
- 24,
630
- 28,
631
- 24,
632
- 28,
633
- 22,
634
- 24,
635
- 24,
636
- 30,
637
- 28,
638
- 28,
639
- 26,
640
- 28,
641
- 30,
642
- 24,
643
- 30,
644
- 30,
645
- 30,
646
- 30,
647
- 30,
648
- 30,
649
- 30,
650
- 30,
651
- 30,
652
- 30,
653
- 30,
654
- 30,
655
- 30,
656
- 30,
657
- 30,
658
- 30,
659
- 30,
660
- 30
661
- ]
662
- ];
425
+ return A(208 <= n && n <= 29648), n;
426
+ }
427
+ static getNumDataCodewords(t, n) {
428
+ return Math.floor(e.getNumRawDataModules(t) / 8) - e.ECC_CODEWORDS_PER_BLOCK[n.ordinal][t] * e.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][t];
429
+ }
430
+ static reedSolomonComputeDivisor(t) {
431
+ if (t < 1 || t > 255) throw RangeError("Degree out of range");
432
+ let n = [];
433
+ for (let e = 0; e < t - 1; e++) n.push(0);
434
+ n.push(1);
435
+ let r = 1;
436
+ for (let i = 0; i < t; i++) {
437
+ for (let t = 0; t < n.length; t++) n[t] = e.reedSolomonMultiply(n[t], r), t + 1 < n.length && (n[t] ^= n[t + 1]);
438
+ r = e.reedSolomonMultiply(r, 2);
663
439
  }
664
- static {
665
- this.NUM_ERROR_CORRECTION_BLOCKS = [
666
- [
667
- -1,
668
- 1,
669
- 1,
670
- 1,
671
- 1,
672
- 1,
673
- 2,
674
- 2,
675
- 2,
676
- 2,
677
- 4,
678
- 4,
679
- 4,
680
- 4,
681
- 4,
682
- 6,
683
- 6,
684
- 6,
685
- 6,
686
- 7,
687
- 8,
688
- 8,
689
- 9,
690
- 9,
691
- 10,
692
- 12,
693
- 12,
694
- 12,
695
- 13,
696
- 14,
697
- 15,
698
- 16,
699
- 17,
700
- 18,
701
- 19,
702
- 19,
703
- 20,
704
- 21,
705
- 22,
706
- 24,
707
- 25
708
- ],
709
- [
710
- -1,
711
- 1,
712
- 1,
713
- 1,
714
- 2,
715
- 2,
716
- 4,
717
- 4,
718
- 4,
719
- 5,
720
- 5,
721
- 5,
722
- 8,
723
- 9,
724
- 9,
725
- 10,
726
- 10,
727
- 11,
728
- 13,
729
- 14,
730
- 16,
731
- 17,
732
- 17,
733
- 18,
734
- 20,
735
- 21,
736
- 23,
737
- 25,
738
- 26,
739
- 28,
740
- 29,
741
- 31,
742
- 33,
743
- 35,
744
- 37,
745
- 38,
746
- 40,
747
- 43,
748
- 45,
749
- 47,
750
- 49
751
- ],
752
- [
753
- -1,
754
- 1,
755
- 1,
756
- 2,
757
- 2,
758
- 4,
759
- 4,
760
- 6,
761
- 6,
762
- 8,
763
- 8,
764
- 8,
765
- 10,
766
- 12,
767
- 16,
768
- 12,
769
- 17,
770
- 16,
771
- 18,
772
- 21,
773
- 20,
774
- 23,
775
- 23,
776
- 25,
777
- 27,
778
- 29,
779
- 34,
780
- 34,
781
- 35,
782
- 38,
783
- 40,
784
- 43,
785
- 45,
786
- 48,
787
- 51,
788
- 53,
789
- 56,
790
- 59,
791
- 62,
792
- 65,
793
- 68
794
- ],
795
- [
796
- -1,
797
- 1,
798
- 1,
799
- 2,
800
- 4,
801
- 4,
802
- 4,
803
- 5,
804
- 6,
805
- 8,
806
- 8,
807
- 11,
808
- 11,
809
- 16,
810
- 16,
811
- 18,
812
- 16,
813
- 19,
814
- 21,
815
- 25,
816
- 25,
817
- 25,
818
- 34,
819
- 30,
820
- 32,
821
- 35,
822
- 37,
823
- 40,
824
- 42,
825
- 45,
826
- 48,
827
- 51,
828
- 54,
829
- 57,
830
- 60,
831
- 63,
832
- 66,
833
- 70,
834
- 74,
835
- 77,
836
- 81
837
- ]
838
- ];
440
+ return n;
441
+ }
442
+ static reedSolomonComputeRemainder(t, n) {
443
+ let r = n.map((e) => 0);
444
+ for (let i of t) {
445
+ let t = i ^ r.shift();
446
+ r.push(0), n.forEach((n, i) => r[i] ^= e.reedSolomonMultiply(n, t));
839
447
  }
448
+ return r;
840
449
  }
841
- e.QrCode = t;
842
- function n(e, t, n) {
843
- if (t < 0 || t > 31 || e >>> t) throw RangeError("Value out of range");
844
- for (let r = t - 1; r >= 0; r--) n.push(e >>> r & 1);
450
+ static reedSolomonMultiply(e, t) {
451
+ if (e >>> 8 || t >>> 8) throw RangeError("Byte out of range");
452
+ let n = 0;
453
+ for (let r = 7; r >= 0; r--) n = n << 1 ^ (n >>> 7) * 285, n ^= (t >>> r & 1) * e;
454
+ return A(!(n >>> 8)), n;
845
455
  }
846
- function r(e, t) {
847
- return !!(e >>> t & 1);
456
+ finderPenaltyCountPatterns(e) {
457
+ let t = e[1];
458
+ A(t <= this.size * 3);
459
+ let n = t > 0 && e[2] == t && e[3] == t * 3 && e[4] == t && e[5] == t;
460
+ return (n && e[0] >= t * 4 && e[6] >= t ? 1 : 0) + (n && e[6] >= t * 4 && e[0] >= t ? 1 : 0);
848
461
  }
849
- function i(e) {
850
- if (!e) throw Error("Assertion error");
462
+ finderPenaltyTerminateAndCount(e, t, n) {
463
+ return e && (this.finderPenaltyAddHistory(t, n), t = 0), t += this.size, this.finderPenaltyAddHistory(t, n), this.finderPenaltyCountPatterns(n);
851
464
  }
852
- class a {
853
- static makeBytes(e) {
854
- let t = [];
855
- for (let r of e) n(r, 8, t);
856
- return new a(a.Mode.BYTE, e.length, t);
857
- }
858
- static makeNumeric(e) {
859
- if (!a.isNumeric(e)) throw RangeError("String contains non-numeric characters");
860
- let t = [];
861
- for (let r = 0; r < e.length;) {
862
- let i = Math.min(e.length - r, 3);
863
- n(parseInt(e.substring(r, r + i), 10), i * 3 + 1, t), r += i;
864
- }
865
- return new a(a.Mode.NUMERIC, e.length, t);
866
- }
867
- static makeAlphanumeric(e) {
868
- if (!a.isAlphanumeric(e)) throw RangeError("String contains unencodable characters in alphanumeric mode");
869
- let t = [], r;
870
- for (r = 0; r + 2 <= e.length; r += 2) {
871
- let i = a.ALPHANUMERIC_CHARSET.indexOf(e.charAt(r)) * 45;
872
- i += a.ALPHANUMERIC_CHARSET.indexOf(e.charAt(r + 1)), n(i, 11, t);
873
- }
874
- return r < e.length && n(a.ALPHANUMERIC_CHARSET.indexOf(e.charAt(r)), 6, t), new a(a.Mode.ALPHANUMERIC, e.length, t);
875
- }
876
- static makeSegments(e) {
877
- return e == "" ? [] : a.isNumeric(e) ? [a.makeNumeric(e)] : a.isAlphanumeric(e) ? [a.makeAlphanumeric(e)] : [a.makeBytes(a.toUtf8ByteArray(e))];
878
- }
879
- static makeEci(e) {
880
- let t = [];
881
- if (e < 0) throw RangeError("ECI assignment value out of range");
882
- if (e < 128) n(e, 8, t);
883
- else if (e < 16384) n(2, 2, t), n(e, 14, t);
884
- else if (e < 1e6) n(6, 3, t), n(e, 21, t);
885
- else throw RangeError("ECI assignment value out of range");
886
- return new a(a.Mode.ECI, 0, t);
887
- }
888
- static isNumeric(e) {
889
- return a.NUMERIC_REGEX.test(e);
890
- }
891
- static isAlphanumeric(e) {
892
- return a.ALPHANUMERIC_REGEX.test(e);
893
- }
894
- constructor(e, t, n) {
895
- if (this.mode = e, this.numChars = t, this.bitData = n, t < 0) throw RangeError("Invalid argument");
896
- this.bitData = n.slice();
897
- }
898
- getData() {
899
- return this.bitData.slice();
900
- }
901
- static getTotalBits(e, t) {
902
- let n = 0;
903
- for (let r of e) {
904
- let e = r.mode.numCharCountBits(t);
905
- if (r.numChars >= 1 << e) return Infinity;
906
- n += 4 + e + r.bitData.length;
907
- }
908
- return n;
909
- }
910
- static toUtf8ByteArray(e) {
911
- e = encodeURI(e);
912
- let t = [];
913
- for (let n = 0; n < e.length; n++) e.charAt(n) == "%" ? (t.push(parseInt(e.substring(n + 1, n + 3), 16)), n += 2) : t.push(e.charCodeAt(n));
914
- return t;
915
- }
916
- static {
917
- this.NUMERIC_REGEX = /^[0-9]*$/;
918
- }
919
- static {
920
- this.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/;
921
- }
922
- static {
923
- this.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
465
+ finderPenaltyAddHistory(e, t) {
466
+ t[0] == 0 && (e += this.size), t.pop(), t.unshift(e);
467
+ }
468
+ };
469
+ C = D, C.MIN_VERSION = 1, C.MAX_VERSION = 40, C.PENALTY_N1 = 3, C.PENALTY_N2 = 3, C.PENALTY_N3 = 40, C.PENALTY_N4 = 10, C.ECC_CODEWORDS_PER_BLOCK = [
470
+ [
471
+ -1,
472
+ 7,
473
+ 10,
474
+ 15,
475
+ 20,
476
+ 26,
477
+ 18,
478
+ 20,
479
+ 24,
480
+ 30,
481
+ 18,
482
+ 20,
483
+ 24,
484
+ 26,
485
+ 30,
486
+ 22,
487
+ 24,
488
+ 28,
489
+ 30,
490
+ 28,
491
+ 28,
492
+ 28,
493
+ 28,
494
+ 30,
495
+ 30,
496
+ 26,
497
+ 28,
498
+ 30,
499
+ 30,
500
+ 30,
501
+ 30,
502
+ 30,
503
+ 30,
504
+ 30,
505
+ 30,
506
+ 30,
507
+ 30,
508
+ 30,
509
+ 30,
510
+ 30,
511
+ 30
512
+ ],
513
+ [
514
+ -1,
515
+ 10,
516
+ 16,
517
+ 26,
518
+ 18,
519
+ 24,
520
+ 16,
521
+ 18,
522
+ 22,
523
+ 22,
524
+ 26,
525
+ 30,
526
+ 22,
527
+ 22,
528
+ 24,
529
+ 24,
530
+ 28,
531
+ 28,
532
+ 26,
533
+ 26,
534
+ 26,
535
+ 26,
536
+ 28,
537
+ 28,
538
+ 28,
539
+ 28,
540
+ 28,
541
+ 28,
542
+ 28,
543
+ 28,
544
+ 28,
545
+ 28,
546
+ 28,
547
+ 28,
548
+ 28,
549
+ 28,
550
+ 28,
551
+ 28,
552
+ 28,
553
+ 28,
554
+ 28
555
+ ],
556
+ [
557
+ -1,
558
+ 13,
559
+ 22,
560
+ 18,
561
+ 26,
562
+ 18,
563
+ 24,
564
+ 18,
565
+ 22,
566
+ 20,
567
+ 24,
568
+ 28,
569
+ 26,
570
+ 24,
571
+ 20,
572
+ 30,
573
+ 24,
574
+ 28,
575
+ 28,
576
+ 26,
577
+ 30,
578
+ 28,
579
+ 30,
580
+ 30,
581
+ 30,
582
+ 30,
583
+ 28,
584
+ 30,
585
+ 30,
586
+ 30,
587
+ 30,
588
+ 30,
589
+ 30,
590
+ 30,
591
+ 30,
592
+ 30,
593
+ 30,
594
+ 30,
595
+ 30,
596
+ 30,
597
+ 30
598
+ ],
599
+ [
600
+ -1,
601
+ 17,
602
+ 28,
603
+ 22,
604
+ 16,
605
+ 22,
606
+ 28,
607
+ 26,
608
+ 26,
609
+ 24,
610
+ 28,
611
+ 24,
612
+ 28,
613
+ 22,
614
+ 24,
615
+ 24,
616
+ 30,
617
+ 28,
618
+ 28,
619
+ 26,
620
+ 28,
621
+ 30,
622
+ 24,
623
+ 30,
624
+ 30,
625
+ 30,
626
+ 30,
627
+ 30,
628
+ 30,
629
+ 30,
630
+ 30,
631
+ 30,
632
+ 30,
633
+ 30,
634
+ 30,
635
+ 30,
636
+ 30,
637
+ 30,
638
+ 30,
639
+ 30,
640
+ 30
641
+ ]
642
+ ], C.NUM_ERROR_CORRECTION_BLOCKS = [
643
+ [
644
+ -1,
645
+ 1,
646
+ 1,
647
+ 1,
648
+ 1,
649
+ 1,
650
+ 2,
651
+ 2,
652
+ 2,
653
+ 2,
654
+ 4,
655
+ 4,
656
+ 4,
657
+ 4,
658
+ 4,
659
+ 6,
660
+ 6,
661
+ 6,
662
+ 6,
663
+ 7,
664
+ 8,
665
+ 8,
666
+ 9,
667
+ 9,
668
+ 10,
669
+ 12,
670
+ 12,
671
+ 12,
672
+ 13,
673
+ 14,
674
+ 15,
675
+ 16,
676
+ 17,
677
+ 18,
678
+ 19,
679
+ 19,
680
+ 20,
681
+ 21,
682
+ 22,
683
+ 24,
684
+ 25
685
+ ],
686
+ [
687
+ -1,
688
+ 1,
689
+ 1,
690
+ 1,
691
+ 2,
692
+ 2,
693
+ 4,
694
+ 4,
695
+ 4,
696
+ 5,
697
+ 5,
698
+ 5,
699
+ 8,
700
+ 9,
701
+ 9,
702
+ 10,
703
+ 10,
704
+ 11,
705
+ 13,
706
+ 14,
707
+ 16,
708
+ 17,
709
+ 17,
710
+ 18,
711
+ 20,
712
+ 21,
713
+ 23,
714
+ 25,
715
+ 26,
716
+ 28,
717
+ 29,
718
+ 31,
719
+ 33,
720
+ 35,
721
+ 37,
722
+ 38,
723
+ 40,
724
+ 43,
725
+ 45,
726
+ 47,
727
+ 49
728
+ ],
729
+ [
730
+ -1,
731
+ 1,
732
+ 1,
733
+ 2,
734
+ 2,
735
+ 4,
736
+ 4,
737
+ 6,
738
+ 6,
739
+ 8,
740
+ 8,
741
+ 8,
742
+ 10,
743
+ 12,
744
+ 16,
745
+ 12,
746
+ 17,
747
+ 16,
748
+ 18,
749
+ 21,
750
+ 20,
751
+ 23,
752
+ 23,
753
+ 25,
754
+ 27,
755
+ 29,
756
+ 34,
757
+ 34,
758
+ 35,
759
+ 38,
760
+ 40,
761
+ 43,
762
+ 45,
763
+ 48,
764
+ 51,
765
+ 53,
766
+ 56,
767
+ 59,
768
+ 62,
769
+ 65,
770
+ 68
771
+ ],
772
+ [
773
+ -1,
774
+ 1,
775
+ 1,
776
+ 2,
777
+ 4,
778
+ 4,
779
+ 4,
780
+ 5,
781
+ 6,
782
+ 8,
783
+ 8,
784
+ 11,
785
+ 11,
786
+ 16,
787
+ 16,
788
+ 18,
789
+ 16,
790
+ 19,
791
+ 21,
792
+ 25,
793
+ 25,
794
+ 25,
795
+ 34,
796
+ 30,
797
+ 32,
798
+ 35,
799
+ 37,
800
+ 40,
801
+ 42,
802
+ 45,
803
+ 48,
804
+ 51,
805
+ 54,
806
+ 57,
807
+ 60,
808
+ 63,
809
+ 66,
810
+ 70,
811
+ 74,
812
+ 77,
813
+ 81
814
+ ]
815
+ ];
816
+ function O(e, t, n) {
817
+ if (t < 0 || t > 31 || e >>> t) throw RangeError("Value out of range");
818
+ for (let r = t - 1; r >= 0; r--) n.push(e >>> r & 1);
819
+ }
820
+ function k(e, t) {
821
+ return !!(e >>> t & 1);
822
+ }
823
+ function A(e) {
824
+ if (!e) throw Error("Assertion error");
825
+ }
826
+ var j = class e {
827
+ static makeBytes(t) {
828
+ let n = [];
829
+ for (let e of t) O(e, 8, n);
830
+ return new e(N.BYTE, t.length, n);
831
+ }
832
+ static makeNumeric(t) {
833
+ if (!e.isNumeric(t)) throw RangeError("String contains non-numeric characters");
834
+ let n = [];
835
+ for (let e = 0; e < t.length;) {
836
+ let r = Math.min(t.length - e, 3);
837
+ O(parseInt(t.substring(e, e + r), 10), r * 3 + 1, n), e += r;
924
838
  }
839
+ return new e(N.NUMERIC, t.length, n);
925
840
  }
926
- e.QrSegment = a;
927
- })(C ||= {}), (function(e) {
928
- let t;
929
- (function(e) {
930
- class t {
931
- static {
932
- this.LOW = new t(0, 1);
933
- }
934
- static {
935
- this.MEDIUM = new t(1, 0);
936
- }
937
- static {
938
- this.QUARTILE = new t(2, 3);
939
- }
940
- static {
941
- this.HIGH = new t(3, 2);
942
- }
943
- constructor(e, t) {
944
- this.ordinal = e, this.formatBits = t;
945
- }
841
+ static makeAlphanumeric(t) {
842
+ if (!e.isAlphanumeric(t)) throw RangeError("String contains unencodable characters in alphanumeric mode");
843
+ let n = [], r;
844
+ for (r = 0; r + 2 <= t.length; r += 2) {
845
+ let i = e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(r)) * 45;
846
+ i += e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(r + 1)), O(i, 11, n);
946
847
  }
947
- e.Ecc = t;
948
- })(t ||= e.QrCode ||= {});
949
- })(C ||= {}), (function(e) {
950
- let t;
951
- (function(e) {
952
- class t {
953
- static {
954
- this.NUMERIC = new t(1, [
955
- 10,
956
- 12,
957
- 14
958
- ]);
959
- }
960
- static {
961
- this.ALPHANUMERIC = new t(2, [
962
- 9,
963
- 11,
964
- 13
965
- ]);
966
- }
967
- static {
968
- this.BYTE = new t(4, [
969
- 8,
970
- 16,
971
- 16
972
- ]);
973
- }
974
- static {
975
- this.KANJI = new t(8, [
976
- 8,
977
- 10,
978
- 12
979
- ]);
980
- }
981
- static {
982
- this.ECI = new t(7, [
983
- 0,
984
- 0,
985
- 0
986
- ]);
987
- }
988
- constructor(e, t) {
989
- this.modeBits = e, this.numBitsCharCount = t;
990
- }
991
- numCharCountBits(e) {
992
- return this.numBitsCharCount[Math.floor((e + 7) / 17)];
993
- }
848
+ return r < t.length && O(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(r)), 6, n), new e(N.ALPHANUMERIC, t.length, n);
849
+ }
850
+ static makeSegments(t) {
851
+ return t == "" ? [] : e.isNumeric(t) ? [e.makeNumeric(t)] : e.isAlphanumeric(t) ? [e.makeAlphanumeric(t)] : [e.makeBytes(e.toUtf8ByteArray(t))];
852
+ }
853
+ static makeEci(t) {
854
+ let n = [];
855
+ if (t < 0) throw RangeError("ECI assignment value out of range");
856
+ if (t < 128) O(t, 8, n);
857
+ else if (t < 16384) O(2, 2, n), O(t, 14, n);
858
+ else if (t < 1e6) O(6, 3, n), O(t, 21, n);
859
+ else throw RangeError("ECI assignment value out of range");
860
+ return new e(N.ECI, 0, n);
861
+ }
862
+ static isNumeric(t) {
863
+ return e.NUMERIC_REGEX.test(t);
864
+ }
865
+ static isAlphanumeric(t) {
866
+ return e.ALPHANUMERIC_REGEX.test(t);
867
+ }
868
+ constructor(e, t, n) {
869
+ if (this.mode = e, this.numChars = t, this.bitData = n, t < 0) throw RangeError("Invalid argument");
870
+ this.bitData = n.slice();
871
+ }
872
+ getData() {
873
+ return this.bitData.slice();
874
+ }
875
+ static getTotalBits(e, t) {
876
+ let n = 0;
877
+ for (let r of e) {
878
+ let e = r.mode.numCharCountBits(t);
879
+ if (r.numChars >= 1 << e) return Infinity;
880
+ n += 4 + e + r.bitData.length;
994
881
  }
995
- e.Mode = t;
996
- })(t ||= e.QrSegment ||= {});
997
- })(C ||= {});
998
- var w = C, T = {
999
- L: w.QrCode.Ecc.LOW,
1000
- M: w.QrCode.Ecc.MEDIUM,
1001
- Q: w.QrCode.Ecc.QUARTILE,
1002
- H: w.QrCode.Ecc.HIGH
1003
- }, E = .5, D = .5, O = "react-qr-code", k = "react-qr-code-gradient", A = "react-qr-code-bg-gradient", ee = .1, j = [
882
+ return n;
883
+ }
884
+ static toUtf8ByteArray(e) {
885
+ e = encodeURI(e);
886
+ let t = [];
887
+ for (let n = 0; n < e.length; n++) e.charAt(n) == "%" ? (t.push(parseInt(e.substring(n + 1, n + 3), 16)), n += 2) : t.push(e.charCodeAt(n));
888
+ return t;
889
+ }
890
+ };
891
+ w = j, w.NUMERIC_REGEX = /^[0-9]*$/, w.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/, w.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
892
+ var M = class {
893
+ constructor(e, t) {
894
+ this.ordinal = e, this.formatBits = t;
895
+ }
896
+ };
897
+ T = M, T.LOW = new T(0, 1), T.MEDIUM = new T(1, 0), T.QUARTILE = new T(2, 3), T.HIGH = new T(3, 2);
898
+ var N = class {
899
+ constructor(e, t) {
900
+ this.modeBits = e, this.numBitsCharCount = t;
901
+ }
902
+ numCharCountBits(e) {
903
+ return this.numBitsCharCount[Math.floor((e + 7) / 17)];
904
+ }
905
+ };
906
+ E = N, E.NUMERIC = new E(1, [
907
+ 10,
908
+ 12,
909
+ 14
910
+ ]), E.ALPHANUMERIC = new E(2, [
911
+ 9,
912
+ 11,
913
+ 13
914
+ ]), E.BYTE = new E(4, [
915
+ 8,
916
+ 16,
917
+ 16
918
+ ]), E.KANJI = new E(8, [
919
+ 8,
920
+ 10,
921
+ 12
922
+ ]), E.ECI = new E(7, [
923
+ 0,
924
+ 0,
925
+ 0
926
+ ]);
927
+ //#endregion
928
+ //#region src/constants.ts
929
+ var ee = {
930
+ L: M.LOW,
931
+ M: M.MEDIUM,
932
+ Q: M.QUARTILE,
933
+ H: M.HIGH
934
+ }, te = .5, ne = .5, re = "react-qr-code", ie = "react-qr-code-gradient", ae = "react-qr-code-bg-gradient", oe = .1, P = [
1004
935
  [
1005
936
  1,
1006
937
  1,
@@ -1064,7 +995,7 @@ var w = C, T = {
1064
995
  1,
1065
996
  1
1066
997
  ]
1067
- ], M = {
998
+ ], F = {
1068
999
  "inpoint-sm": [
1069
1000
  0,
1070
1001
  90,
@@ -1110,7 +1041,7 @@ var w = C, T = {
1110
1041
  90,
1111
1042
  -90
1112
1043
  ]
1113
- }, N = {
1044
+ }, I = {
1114
1045
  "rounded-sm": 3,
1115
1046
  rounded: 4,
1116
1047
  "rounded-lg": 5,
@@ -1123,7 +1054,7 @@ var w = C, T = {
1123
1054
  "outpoint-sm": 3,
1124
1055
  outpoint: 4,
1125
1056
  "outpoint-lg": 5
1126
- }, P = {
1057
+ }, L = {
1127
1058
  square: 0,
1128
1059
  diamond: 0,
1129
1060
  circle: 3,
@@ -1139,7 +1070,7 @@ var w = C, T = {
1139
1070
  "outpoint-sm": 1.5,
1140
1071
  outpoint: 2,
1141
1072
  "outpoint-lg": 2.3
1142
- }, F = [
1073
+ }, R = [
1143
1074
  [
1144
1075
  0,
1145
1076
  0,
@@ -1203,32 +1134,32 @@ var w = C, T = {
1203
1134
  0,
1204
1135
  0
1205
1136
  ]
1206
- ], I = ({ x: e, y: t, numCells: n }) => !!(F[e]?.[t] || F[e - n + 7]?.[t] || F[e]?.[t - n + 7]), te = ({ x: e, y: t, radius: n }) => {
1137
+ ], z = ({ x: e, y: t, numCells: n }) => !!(R[e]?.[t] || R[e - n + 7]?.[t] || R[e]?.[t - n + 7]), se = ({ x: e, y: t, radius: n }) => {
1207
1138
  let r = 3 - n, i = n / 2, a = 3 - i;
1208
1139
  return `M ${e} ${t + i}v ${r}a ${i} ${i}, 0, 0, 0, ${i} ${i}h ${a}v ${-a}a ${i} ${i}, 0, 0, 0, ${-i} ${-i}h ${-r}H ${e}z`;
1209
- }, L = ({ x: e, y: t, radius: n }) => {
1140
+ }, ce = ({ x: e, y: t, radius: n }) => {
1210
1141
  let r = 3 - n, i = n / 2, a = 3 - i;
1211
1142
  return `M ${e} ${t + i}v ${r}a ${i} ${i}, 0, 0, 0, ${i} ${i}h ${a}v ${-a}a ${i} ${i}, 0, 0, 0, ${-i} ${-i}h ${-r}a ${i} ${i}, 0, 0, 0, ${-i} ${i}`;
1212
- }, R = ({ x: e, y: t, numCells: n }) => !!(j[e]?.[t] || j[e - n + 7]?.[t] || j[e]?.[t - n + 7]), ne = ({ x: e, y: t, radius: n }) => {
1143
+ }, B = ({ x: e, y: t, numCells: n }) => !!(P[e]?.[t] || P[e - n + 7]?.[t] || P[e]?.[t - n + 7]), le = ({ x: e, y: t, radius: n }) => {
1213
1144
  let r = 7 - n, i = n / 2;
1214
1145
  return `M ${e} ${t + i}v ${r}a ${i} ${i}, 0, 0, 0, ${i} ${i}h ${r}a ${i} ${i}, 0, 0, 0, ${i} ${-i}v ${-r}a ${i} ${i}, 0, 0, 0, ${-i} ${-i}h ${-r}a ${i} ${i}, 0, 0, 0, ${-i} ${i}M ${e + i} ${t + 1}h ${r}a ${i - 1} ${i - 1}, 0, 0, 1, ${i - 1} ${i - 1}v ${r}a ${i - 1} ${i - 1}, 0, 0, 1, ${-(i - 1)} ${i - 1}h ${-r}a ${i - 1} ${i - 1}, 0, 0, 1, ${-(i - 1)} ${-(i - 1)}v ${-r}a ${i - 1} ${i - 1}, 0, 0, 1, ${i - 1} ${-(i - 1)}`;
1215
- }, re = ({ x: e, y: t, radius: n }) => {
1146
+ }, ue = ({ x: e, y: t, radius: n }) => {
1216
1147
  let r = 7 - n, i = n / 2, a = 7 - i;
1217
1148
  return `M ${e} ${t + i}v ${r}a ${i} ${i}, 0, 0, 0, ${i} ${i}h ${a}v ${-a}a ${i} ${i}, 0, 0, 0, ${-i} ${-i}h ${-r}H ${e}zM ${e + i} ${t + 1}h ${r}a ${i - 1} ${i - 1}, 0, 0, 1, ${i - 1} ${i - 1}v ${a - 1}h ${-(a - 1)}a ${i - 1} ${i - 1}, 0, 0, 1, ${-(i - 1)} ${-(i - 1)}v ${-(a - 1)}z`;
1218
- }, ie = ({ x: e, y: t, radius: n }) => {
1149
+ }, de = ({ x: e, y: t, radius: n }) => {
1219
1150
  let r = 7 - n, i = n / 2, a = 7 - i;
1220
1151
  return `M ${e} ${t + i}v ${r}a ${i} ${i}, 0, 0, 0, ${i} ${i}h ${a}v ${-a}a ${i} ${i}, 0, 0, 0, ${-i} ${-i}h ${-r}a ${i} ${i}, 0, 0, 0, ${-i} ${i}M ${e + i} ${t + 1}h ${r}a ${i - 1} ${i - 1}, 0, 0, 1, ${i - 1} ${i - 1}v ${a - 1}h ${-(a - 1)}a ${i - 1} ${i - 1}, 0, 0, 1, ${-(i - 1)} ${-(i - 1)}v ${-r}a ${i - 1} ${i - 1}, 0, 0, 1, ${i - 1} ${-(i - 1)}`;
1221
- }, z = (e) => e === "square" || e === "pinched-square" || e === "circle" || e === "star" || e === "heart" || e === "diamond" || e === "hashtag", ae = (e) => {
1152
+ }, V = (e) => e === "square" || e === "pinched-square" || e === "circle" || e === "star" || e === "heart" || e === "diamond" || e === "hashtag", fe = (e) => {
1222
1153
  let t = 2166136261;
1223
1154
  return e.forEach((e) => {
1224
1155
  e.forEach((e) => {
1225
1156
  t = Math.imul(t ^ +!!e, 16777619);
1226
1157
  });
1227
1158
  }), t >>> 0;
1228
- }, oe = (e, t, n) => {
1159
+ }, pe = (e, t, n) => {
1229
1160
  let r = (n ^ Math.imul(e, 668265261) ^ Math.imul(t, 374761393)) >>> 0;
1230
1161
  return r = Math.imul(r ^ r >>> 15, 739982445) >>> 0, r = Math.imul(r ^ r >>> 13, 695872825) >>> 0, ((r ^ r >>> 16) >>> 0) / 4294967296;
1231
- }, se = (e, t, n = 1, r = 0, i = 0, a = 0) => e === "square-sm" ? .75 : t ? oe(r, i, a) * .25 + .75 : z(e) ? n : 1, B = (e, t, n) => {
1162
+ }, me = (e, t, n = 1, r = 0, i = 0, a = 0) => e === "square-sm" ? .75 : t ? pe(r, i, a) * .25 + .75 : V(e) ? n : 1, H = (e, t, n) => {
1232
1163
  let r = {
1233
1164
  left: e !== 0 && n[t][e - 1],
1234
1165
  right: e !== n[t].length - 1 && n[t][e + 1],
@@ -1239,35 +1170,35 @@ var w = C, T = {
1239
1170
  ...r,
1240
1171
  count: Object.values(r).filter(Boolean).length
1241
1172
  };
1242
- }, V = ({ x: e, y: t, modules: n, numCells: r }) => t >= 0 && t < n.length && e >= 0 && e < n[t].length && n[t][e] && !R({
1173
+ }, U = ({ x: e, y: t, modules: n, numCells: r }) => t >= 0 && t < n.length && e >= 0 && e < n[t].length && n[t][e] && !B({
1243
1174
  x: e,
1244
1175
  y: t,
1245
1176
  numCells: r
1246
- }) && !I({
1177
+ }) && !z({
1247
1178
  x: e,
1248
1179
  y: t,
1249
1180
  numCells: r
1250
- }), ce = (e, t, n, r) => {
1181
+ }), he = (e, t, n, r) => {
1251
1182
  let i = {
1252
- left: V({
1183
+ left: U({
1253
1184
  x: e - 1,
1254
1185
  y: t,
1255
1186
  modules: n,
1256
1187
  numCells: r
1257
1188
  }),
1258
- right: V({
1189
+ right: U({
1259
1190
  x: e + 1,
1260
1191
  y: t,
1261
1192
  modules: n,
1262
1193
  numCells: r
1263
1194
  }),
1264
- top: V({
1195
+ top: U({
1265
1196
  x: e,
1266
1197
  y: t - 1,
1267
1198
  modules: n,
1268
1199
  numCells: r
1269
1200
  }),
1270
- bottom: V({
1201
+ bottom: U({
1271
1202
  x: e,
1272
1203
  y: t + 1,
1273
1204
  modules: n,
@@ -1278,53 +1209,53 @@ var w = C, T = {
1278
1209
  ...i,
1279
1210
  count: Object.values(i).filter(Boolean).length
1280
1211
  };
1281
- }, H = (e, t, n, r) => `M${e},${t}h${n}v${r}h${-n}Z`, U = (e, t, n) => H(e, t, n, n), W = (e, t, n) => `M${e},${t + n / 2}a${n / 2},${n / 2} 0 1,0 ${n},0a${n / 2},${n / 2} 0 1,0 -${n},0Z`, le = (e, t, n) => `M${e},${t + n / 2}l${n / 2},-${n / 2}l${n / 2},${n / 2}l-${n / 2},${n / 2}Z`, ue = (e, t, n) => `M${e - n},${t}a${n},${n} 0 1,1 ${n * 2},0a${n},${n} 0 1,1 ${-n * 2},0Z`, de = ({ count: e }) => e === 1, fe = (e, t) => `M ${e} ${t}
1212
+ }, W = (e, t, n, r) => `M${e},${t}h${n}v${r}h${-n}Z`, G = (e, t, n) => W(e, t, n, n), K = (e, t, n) => `M${e},${t + n / 2}a${n / 2},${n / 2} 0 1,0 ${n},0a${n / 2},${n / 2} 0 1,0 -${n},0Z`, ge = (e, t, n) => `M${e},${t + n / 2}l${n / 2},-${n / 2}l${n / 2},${n / 2}l-${n / 2},${n / 2}Z`, _e = (e, t, n) => `M${e - n},${t}a${n},${n} 0 1,1 ${n * 2},0a${n},${n} 0 1,1 ${-n * 2},0Z`, ve = ({ count: e }) => e === 1, ye = (e, t) => `M ${e} ${t}
1282
1213
  v 1
1283
1214
  h 1
1284
1215
  v -0.5
1285
- a 0.5 0.5, 0, 0, 0, -0.5 -0.5`, G = (e, t) => `M ${e + 1} ${t}
1216
+ a 0.5 0.5, 0, 0, 0, -0.5 -0.5`, q = (e, t) => `M ${e + 1} ${t}
1286
1217
  v 1
1287
1218
  h -1
1288
1219
  v -0.5
1289
- a 0.5 0.5, 0, 0, 1, 0.5 -0.5`, K = (e, t) => `M ${e} ${t}
1220
+ a 0.5 0.5, 0, 0, 1, 0.5 -0.5`, J = (e, t) => `M ${e} ${t}
1290
1221
  v 1
1291
1222
  h 0.5
1292
1223
  a 0.5 0.5, 0, 0, 0, 0.5 -0.5
1293
1224
  v -0.5
1294
- h -1`, pe = (e, t) => `M ${e + 1} ${t}
1225
+ h -1`, be = (e, t) => `M ${e + 1} ${t}
1295
1226
  v 1
1296
1227
  h -0.5
1297
1228
  a 0.5 0.5, 0, 0, 1, -0.5 -0.5
1298
1229
  v -0.5
1299
- h 1`, q = (e, t, n = 1) => {
1230
+ h 1`, Y = (e, t, n = 1) => {
1300
1231
  let r = t + .5, i = n / 2, a = 1 - i;
1301
1232
  return `M ${e} ${r - i}
1302
1233
  v ${n}
1303
1234
  h ${a}
1304
1235
  a ${i} ${i}, 0, 0, 0, 0 -${n}`;
1305
- }, J = (e, t, n = 1) => {
1236
+ }, X = (e, t, n = 1) => {
1306
1237
  let r = t + .5, i = n / 2, a = 1 - i;
1307
1238
  return `M ${e + 1} ${r - i}
1308
1239
  v ${n}
1309
1240
  h -${a}
1310
1241
  a ${i} ${i}, 0, 0, 1, 0 -${n}`;
1311
- }, Y = (e, t, n = 1) => {
1242
+ }, Z = (e, t, n = 1) => {
1312
1243
  let r = e + .5, i = n / 2, a = 1 - i;
1313
1244
  return `M ${r - i} ${t + 1}
1314
1245
  h ${n}
1315
1246
  v -${a}
1316
1247
  a ${i} ${i}, 0, 0, 0, -${n} 0`;
1317
- }, X = (e, t, n = 1) => {
1248
+ }, Q = (e, t, n = 1) => {
1318
1249
  let r = e + .5, i = n / 2, a = 1 - i;
1319
1250
  return `M ${r - i} ${t}
1320
1251
  h ${n}
1321
1252
  v ${a}
1322
1253
  a ${i} ${i}, 0, 0, 1, -${n} 0`;
1323
- }, me = (e, t, n, r) => {
1254
+ }, xe = (e, t, n, r) => {
1324
1255
  let { left: i, right: a, top: o, bottom: s } = r, c = e + .5, l = t + .5, u = n / 2, d = !o && !i, f = !o && !a, p = !s && !a, m = !s && !i, h = o ? t : l - u, g = a ? e + 1 : c + u, _ = s ? t + 1 : l + u, v = i ? e : c - u, y = [`M ${d ? c : c - u} ${h}`];
1325
1256
  return y.push(`L ${f ? c : c + u} ${h}`), f ? y.push(`A ${u} ${u} 0 0 1 ${c + u} ${l}`) : o && a ? y.push(`L ${c + u} ${l - u} L ${e + 1} ${l - u}`) : o ? y.push(`L ${c + u} ${l - u}`) : a && y.push(`L ${e + 1} ${l - u}`), y.push(`L ${g} ${p ? l : l + u}`), p ? y.push(`A ${u} ${u} 0 0 1 ${c} ${l + u}`) : a && s ? y.push(`L ${c + u} ${l + u} L ${c + u} ${t + 1}`) : a ? y.push(`L ${c + u} ${l + u}`) : s && y.push(`L ${c + u} ${t + 1}`), y.push(`L ${m ? c : c - u} ${_}`), m ? y.push(`A ${u} ${u} 0 0 1 ${c - u} ${l}`) : s && i ? y.push(`L ${c - u} ${l + u} L ${e} ${l + u}`) : s ? y.push(`L ${c - u} ${l + u}`) : i && y.push(`L ${e} ${l + u}`), y.push(`L ${v} ${d ? l : l - u}`), d ? y.push(`A ${u} ${u} 0 0 1 ${c} ${l - u}`) : i && o ? y.push(`L ${c - u} ${l - u} L ${c - u} ${t}`) : i ? y.push(`L ${c - u} ${l - u}`) : o && y.push(`L ${c - u} ${t}`), y.push("Z"), y.join(" ");
1326
- }, he = (e, t, n) => `M ${e + 1} ${t}h -${n / 2}a ${n / 2.5} ${n / 2.5}, 0, 0, 0, ${-n / 2.5} ${n / 2.5}v ${n / 2}h ${n / 2}a ${n / 2.5} ${n / 2.5}, 0, 0, 0, ${n / 2.5} ${-n / 2.5}`, ge = (e) => {
1327
- let t = e?.style || "square", n = t === "circuit-board" ? E : 1;
1257
+ }, Se = (e, t, n) => `M ${e + 1} ${t}h -${n / 2}a ${n / 2.5} ${n / 2.5}, 0, 0, 0, ${-n / 2.5} ${n / 2.5}v ${n / 2}h ${n / 2}a ${n / 2.5} ${n / 2.5}, 0, 0, 0, ${n / 2.5} ${-n / 2.5}`, Ce = (e) => {
1258
+ let t = e?.style || "square", n = t === "circuit-board" ? te : 1;
1328
1259
  return {
1329
1260
  color: e?.color || "#000000",
1330
1261
  style: t,
@@ -1332,14 +1263,14 @@ var w = C, T = {
1332
1263
  size: e?.size ?? 1,
1333
1264
  lineWidth: e?.lineWidth ?? n
1334
1265
  };
1335
- }, _e = (e) => ({
1266
+ }, we = (e) => ({
1336
1267
  color: e?.color || "#000000",
1337
1268
  style: e?.style || "square"
1338
- }), ve = (e) => ({
1269
+ }), Te = (e) => ({
1339
1270
  color: e?.color || "#000000",
1340
1271
  style: e?.style || "square"
1341
- }), ye = ({ modules: e, cells: n, margin: r, settings: a, gradient: o, gradientId: c }) => {
1342
- let { color: l, style: u, randomSize: d, size: m, lineWidth: h } = i(() => ge(a), [a]), g = [], _ = e.length, v = z(u) && d, x = i(() => v ? ae(n) : 0, [v, n]), S = t((e, t) => se(u, v, m, e, t, x), [
1272
+ }), Ee = ({ modules: e, cells: n, margin: r, settings: a, gradient: o, gradientId: c }) => {
1273
+ let { color: l, style: u, randomSize: d, size: m, lineWidth: h } = i(() => Ce(a), [a]), g = [], _ = e.length, v = V(u) && d, x = i(() => v ? fe(n) : 0, [v, n]), S = t((e, t) => me(u, v, m, e, t, x), [
1343
1274
  u,
1344
1275
  v,
1345
1276
  m,
@@ -1347,11 +1278,11 @@ var w = C, T = {
1347
1278
  ]);
1348
1279
  e.forEach((t, n) => {
1349
1280
  t.forEach((t, i) => {
1350
- if (R({
1281
+ if (B({
1351
1282
  x: i,
1352
1283
  y: n,
1353
1284
  numCells: _
1354
- }) || I({
1285
+ }) || z({
1355
1286
  x: i,
1356
1287
  y: n,
1357
1288
  numCells: _
@@ -1359,37 +1290,37 @@ var w = C, T = {
1359
1290
  let a = S(i, n), o = 1 * a, s = (1 - 1 * a) / 2, c = i + r, l = n + r, d = c + s, m = l + s, v = (1 - h) / 2;
1360
1291
  if (t) {
1361
1292
  if (u === "circuit-board") {
1362
- let t = c + .5, r = l + .5, a = h / 2, o = 1 + h, s = ce(i, n, e, _), { right: u, bottom: d, count: f } = s;
1363
- if (u && g.push(H(t - a, r - a, o, h)), d && g.push(H(t - a, r - a, h, o)), f === 0) {
1293
+ let t = c + .5, r = l + .5, a = h / 2, o = 1 + h, s = he(i, n, e, _), { right: u, bottom: d, count: f } = s;
1294
+ if (u && g.push(W(t - a, r - a, o, h)), d && g.push(W(t - a, r - a, h, o)), f === 0) {
1364
1295
  let e = .25 / 2;
1365
- g.push(U(c + e, l + e, .75));
1366
- } else de({
1296
+ g.push(G(c + e, l + e, .75));
1297
+ } else ve({
1367
1298
  ...s,
1368
1299
  count: f
1369
- }) && g.push(ue(t, r, D));
1370
- } else if (u === "square" || u === "square-sm") g.push(U(d, m, o));
1300
+ }) && g.push(_e(t, r, ne));
1301
+ } else if (u === "square" || u === "square-sm") g.push(G(d, m, o));
1371
1302
  else if (u === "pinched-square") g.push(p(d, m, o, .25));
1372
- else if (u === "circle") g.push(W(d, m, o));
1373
- else if (u === "diamond") g.push(le(d, m, o));
1303
+ else if (u === "circle") g.push(K(d, m, o));
1304
+ else if (u === "diamond") g.push(ge(d, m, o));
1374
1305
  else if (u === "star") g.push(f(d + o / 2, m + o / 2, o * 1.1, 5));
1375
1306
  else if (u === "heart") g.push(b(d, m, o));
1376
1307
  else if (u === "hashtag") g.push(y(d, m, o));
1377
1308
  else if (u === "rounded") {
1378
- let t = B(i, n, e), { left: r, right: a, top: o, bottom: s, count: u } = t;
1379
- h === 1 ? u === 0 ? g.push(W(d, m, 1)) : u > 2 || r && a || o && s ? g.push(U(d, m, 1)) : u === 2 ? r && o ? g.push(K(d, m)) : o && a ? g.push(pe(d, m)) : a && s ? g.push(G(d, m)) : g.push(fe(d, m)) : o ? g.push(X(d, m)) : a ? g.push(J(d, m)) : s ? g.push(Y(d, m)) : g.push(q(d, m)) : g.push(me(c, l, h, t));
1309
+ let t = H(i, n, e), { left: r, right: a, top: o, bottom: s, count: u } = t;
1310
+ h === 1 ? u === 0 ? g.push(K(d, m, 1)) : u > 2 || r && a || o && s ? g.push(G(d, m, 1)) : u === 2 ? r && o ? g.push(J(d, m)) : o && a ? g.push(be(d, m)) : a && s ? g.push(q(d, m)) : g.push(ye(d, m)) : o ? g.push(Q(d, m)) : a ? g.push(X(d, m)) : s ? g.push(Z(d, m)) : g.push(Y(d, m)) : g.push(xe(c, l, h, t));
1380
1311
  } else if (u === "leaf") {
1381
- let { left: t, right: r, top: a, bottom: s, count: c } = B(i, n, e);
1382
- if (c === 0) g.push(he(d, m, o));
1312
+ let { left: t, right: r, top: a, bottom: s, count: c } = H(i, n, e);
1313
+ if (c === 0) g.push(Se(d, m, o));
1383
1314
  else if (!t && !a) {
1384
- g.push(G(d, m));
1315
+ g.push(q(d, m));
1385
1316
  return;
1386
- } else !r && !s ? g.push(K(d, m)) : g.push(U(d, m, 1));
1317
+ } else !r && !s ? g.push(J(d, m)) : g.push(G(d, m, 1));
1387
1318
  } else if (u === "vertical-line") {
1388
- let { left: t, right: r, top: a, bottom: o, count: s } = B(i, n, e);
1389
- s === 0 || t && !(a || o) || r && !(a || o) ? g.push(W(c + v, l + v, h)) : a && o ? g.push(H(c + v, l, h, 1)) : a && !o ? g.push(X(c, l, h)) : o && !a && g.push(Y(c, l, h));
1319
+ let { left: t, right: r, top: a, bottom: o, count: s } = H(i, n, e);
1320
+ s === 0 || t && !(a || o) || r && !(a || o) ? g.push(K(c + v, l + v, h)) : a && o ? g.push(W(c + v, l, h, 1)) : a && !o ? g.push(Q(c, l, h)) : o && !a && g.push(Z(c, l, h));
1390
1321
  } else if (u === "horizontal-line") {
1391
- let { left: t, right: r, top: a, bottom: o, count: s } = B(i, n, e);
1392
- s === 0 || a && !(t || r) || o && !(t || r) ? g.push(W(c + v, l + v, h)) : t && r ? g.push(H(c, l + v, 1, h)) : t && !r ? g.push(q(c, l, h)) : r && !t && g.push(J(c, l, h));
1322
+ let { left: t, right: r, top: a, bottom: o, count: s } = H(i, n, e);
1323
+ s === 0 || a && !(t || r) || o && !(t || r) ? g.push(K(c + v, l + v, h)) : t && r ? g.push(W(c, l + v, 1, h)) : t && !r ? g.push(Y(c, l, h)) : r && !t && g.push(X(c, l, h));
1393
1324
  }
1394
1325
  }
1395
1326
  });
@@ -1401,8 +1332,8 @@ var w = C, T = {
1401
1332
  shapeRendering: u === "square" ? "crispEdges" : "geometricPrecision",
1402
1333
  "data-testid": "data-modules"
1403
1334
  });
1404
- }, Z = { "data-testid": "finder-patterns-inner" }, be = ({ modules: e, margin: t, settings: n, gradient: r, gradientId: a }) => {
1405
- let { color: o, style: c } = i(() => ve(n), [n]), l = r ? `url(#${a})` : o, u = i(() => [
1335
+ }, $ = { "data-testid": "finder-patterns-inner" }, De = ({ modules: e, margin: t, settings: n, gradient: r, gradientId: a }) => {
1336
+ let { color: o, style: c } = i(() => Te(n), [n]), l = r ? `url(#${a})` : o, u = i(() => [
1406
1337
  {
1407
1338
  x: t + 2,
1408
1339
  y: t + 2
@@ -1424,8 +1355,8 @@ var w = C, T = {
1424
1355
  width: 3,
1425
1356
  height: 3,
1426
1357
  fill: l,
1427
- rx: P[c],
1428
- ...Z
1358
+ rx: L[c],
1359
+ ...$
1429
1360
  }, d(t, n));
1430
1361
  });
1431
1362
  if (c === "pinched-square") return u.map((e) => {
@@ -1433,7 +1364,7 @@ var w = C, T = {
1433
1364
  return /* @__PURE__ */ s("path", {
1434
1365
  fill: l,
1435
1366
  d: r,
1436
- ...Z
1367
+ ...$
1437
1368
  }, d(t, n));
1438
1369
  });
1439
1370
  if (c === "diamond") return u.map((e) => {
@@ -1449,19 +1380,19 @@ var w = C, T = {
1449
1380
  transformOrigin: "center",
1450
1381
  transformBox: "fill-box"
1451
1382
  },
1452
- ...Z
1383
+ ...$
1453
1384
  }, d(t, n));
1454
1385
  });
1455
1386
  if (c === "inpoint-sm" || c === "inpoint" || c === "inpoint-lg" || c === "outpoint-sm" || c === "outpoint" || c === "outpoint-lg" || c === "leaf-sm" || c === "leaf" || c === "leaf-lg") {
1456
- let e = c === "leaf-sm" || c === "leaf" || c === "leaf-lg" ? te : L;
1387
+ let e = c === "leaf-sm" || c === "leaf" || c === "leaf-lg" ? se : ce;
1457
1388
  return u.map((e, t) => ({
1458
1389
  ...e,
1459
- rotation: M[c][t]
1390
+ rotation: F[c][t]
1460
1391
  })).map(({ x: t, y: n, rotation: r }) => {
1461
1392
  let i = e({
1462
1393
  x: t,
1463
1394
  y: n,
1464
- radius: P[c]
1395
+ radius: L[c]
1465
1396
  });
1466
1397
  return /* @__PURE__ */ s("path", {
1467
1398
  fill: l,
@@ -1471,21 +1402,21 @@ var w = C, T = {
1471
1402
  transformOrigin: "center",
1472
1403
  transformBox: "fill-box"
1473
1404
  },
1474
- ...Z
1405
+ ...$
1475
1406
  }, d(t, n));
1476
1407
  });
1477
1408
  }
1478
1409
  if (c === "heart") return u.map(({ x: e, y: t }) => /* @__PURE__ */ s("path", {
1479
1410
  fill: l,
1480
1411
  d: b(e, t, 3),
1481
- ...Z
1412
+ ...$
1482
1413
  }, d(e, t)));
1483
1414
  if (c === "star") return u.map(({ x: e, y: t }) => {
1484
1415
  let n = f(e + 3 / 2, t + 3 / 2, 3 * 1.2, 5);
1485
1416
  return /* @__PURE__ */ s("path", {
1486
1417
  fill: l,
1487
1418
  d: n,
1488
- ...Z
1419
+ ...$
1489
1420
  }, d(e, t));
1490
1421
  });
1491
1422
  if (c === "microchip") return u.map(({ x: e, y: t }) => {
@@ -1493,7 +1424,7 @@ var w = C, T = {
1493
1424
  return /* @__PURE__ */ s("path", {
1494
1425
  fill: l,
1495
1426
  d: n,
1496
- ...Z
1427
+ ...$
1497
1428
  }, d(e, t));
1498
1429
  });
1499
1430
  if (c === "hashtag") return u.map(({ x: e, y: t }) => {
@@ -1501,11 +1432,11 @@ var w = C, T = {
1501
1432
  return /* @__PURE__ */ s("path", {
1502
1433
  fill: l,
1503
1434
  d: n,
1504
- ...Z
1435
+ ...$
1505
1436
  }, d(e, t));
1506
1437
  });
1507
- }, Q = { "data-testid": "finder-patterns-outer" }, xe = ({ modules: e, margin: t, settings: n, gradient: r, gradientId: a }) => {
1508
- let { style: o, color: c } = i(() => _e(n), [n]), l = r ? `url(#${a})` : c, u = [], d = i(() => [
1438
+ }, Oe = { "data-testid": "finder-patterns-outer" }, ke = ({ modules: e, margin: t, settings: n, gradient: r, gradientId: a }) => {
1439
+ let { style: o, color: c } = i(() => we(n), [n]), l = r ? `url(#${a})` : c, u = [], d = i(() => [
1509
1440
  {
1510
1441
  x: t,
1511
1442
  y: t
@@ -1529,10 +1460,10 @@ var w = C, T = {
1529
1460
  ].includes(o)) {
1530
1461
  for (let e of d) {
1531
1462
  let { x: t, y: n } = e;
1532
- if (o === "rounded-sm" || o === "rounded" || o === "rounded-lg") u.push(ne({
1463
+ if (o === "rounded-sm" || o === "rounded" || o === "rounded-lg") u.push(le({
1533
1464
  x: t,
1534
1465
  y: n,
1535
- radius: N[o]
1466
+ radius: I[o]
1536
1467
  }));
1537
1468
  else if (o === "circle") u.push(`M ${t + 7 / 2} ${n}a ${7 / 2} ${7 / 2} 0 1 0 0.01 0zzm 0 1a ${7 / 2 - 1} ${7 / 2 - 1} 0 1 1 -0.01 0Z`);
1538
1469
  else if (o === "pinched-square") {
@@ -1543,19 +1474,19 @@ var w = C, T = {
1543
1474
  return /* @__PURE__ */ s("path", {
1544
1475
  fill: l,
1545
1476
  d: u.join(""),
1546
- ...Q
1477
+ ...Oe
1547
1478
  });
1548
1479
  }
1549
1480
  if (o === "inpoint-sm" || o === "inpoint" || o === "inpoint-lg" || o === "outpoint-sm" || o === "outpoint" || o === "outpoint-lg" || o === "leaf-sm" || o === "leaf" || o === "leaf-lg") {
1550
- let e = o === "leaf-sm" || o === "leaf" || o === "leaf-lg" ? re : ie;
1481
+ let e = o === "leaf-sm" || o === "leaf" || o === "leaf-lg" ? ue : de;
1551
1482
  return d.map((e, t) => ({
1552
1483
  ...e,
1553
- rotation: M[o][t]
1484
+ rotation: F[o][t]
1554
1485
  })).map(({ x: t, y: n, rotation: r }) => {
1555
1486
  let i = e({
1556
1487
  x: t,
1557
1488
  y: n,
1558
- radius: N[o]
1489
+ radius: I[o]
1559
1490
  });
1560
1491
  return /* @__PURE__ */ s("path", {
1561
1492
  fill: l,
@@ -1565,11 +1496,11 @@ var w = C, T = {
1565
1496
  transformOrigin: "center",
1566
1497
  transformBox: "fill-box"
1567
1498
  },
1568
- ...Q
1499
+ ...Oe
1569
1500
  }, `finder-patterns-outer-${o}-${t}-${n}`);
1570
1501
  });
1571
1502
  }
1572
- }, Se = ({ gradient: e, gradientId: t }) => {
1503
+ }, Ae = ({ gradient: e, gradientId: t }) => {
1573
1504
  if (!e) return null;
1574
1505
  let n = d(e?.rotation || 0);
1575
1506
  return /* @__PURE__ */ s("defs", { children: e.type === "linear" ? /* @__PURE__ */ s("linearGradient", {
@@ -1591,15 +1522,15 @@ var w = C, T = {
1591
1522
  stopColor: e.color
1592
1523
  }, t))
1593
1524
  }) });
1594
- }, Ce = () => {
1525
+ }, je = () => {
1595
1526
  let e = n();
1596
1527
  return {
1597
- gradientId: `${k}-${e}`,
1598
- bgGradientId: `${A}-${e}`
1528
+ gradientId: `${ie}-${e}`,
1529
+ bgGradientId: `${ae}-${e}`
1599
1530
  };
1600
- }, we = (e, t) => e.slice().map((e, n) => n < t.y || n >= t.y + t.h ? e : e.map((e, n) => n < t.x || n >= t.x + t.w ? e : !1)), Te = (e, t, n, r) => {
1531
+ }, Me = (e, t) => e.slice().map((e, n) => n < t.y || n >= t.y + t.h ? e : e.map((e, n) => n < t.x || n >= t.x + t.w ? e : !1)), Ne = (e, t, n, r) => {
1601
1532
  if (r == null) return null;
1602
- let i = e.length + n * 2, a = Math.floor(t * ee), o = i / t, s = (r.width || a) * o, c = (r.height || a) * o, l = r.x == null ? e.length / 2 - s / 2 : r.x * o, u = r.y == null ? e.length / 2 - c / 2 : r.y * o, d = r.opacity == null ? 1 : r.opacity, f = null;
1533
+ let i = e.length + n * 2, a = Math.floor(t * oe), o = i / t, s = (r.width || a) * o, c = (r.height || a) * o, l = r.x == null ? e.length / 2 - s / 2 : r.x * o, u = r.y == null ? e.length / 2 - c / 2 : r.y * o, d = r.opacity == null ? 1 : r.opacity, f = null;
1603
1534
  if (r.excavate) {
1604
1535
  let e = Math.floor(l), t = Math.floor(u);
1605
1536
  f = {
@@ -1619,22 +1550,22 @@ var w = C, T = {
1619
1550
  opacity: d,
1620
1551
  crossOrigin: p
1621
1552
  };
1622
- }, Ee = (e) => e == null ? 4 : Math.max(Math.floor(e), 0), De = ({ value: e, level: t, minVersion: n, marginSize: r, imageSettings: a, size: o, boostLevel: s }) => {
1553
+ }, Pe = (e) => e == null ? 4 : Math.max(Math.floor(e), 0), Fe = ({ value: e, level: t, minVersion: n, marginSize: r, imageSettings: a, size: o, boostLevel: s }) => {
1623
1554
  let c = i(() => {
1624
- let r = (Array.isArray(e) ? e : [e]).reduce((e, t) => (e.push(...w.QrSegment.makeSegments(t)), e), []);
1625
- return w.QrCode.encodeSegments(r, T[t], n, void 0, void 0, s);
1555
+ let r = (Array.isArray(e) ? e : [e]).reduce((e, t) => (e.push(...j.makeSegments(t)), e), []);
1556
+ return D.encodeSegments(r, ee[t], n, void 0, void 0, s);
1626
1557
  }, [
1627
1558
  e,
1628
1559
  t,
1629
1560
  n,
1630
1561
  s
1631
1562
  ]), { cells: l, margin: u, numCells: d, calculatedImageSettings: f } = i(() => {
1632
- let e = c.getModules(), t = Ee(r);
1563
+ let e = c.getModules(), t = Pe(r);
1633
1564
  return {
1634
1565
  cells: e,
1635
1566
  margin: t,
1636
1567
  numCells: e.length + t * 2,
1637
- calculatedImageSettings: Te(e, o, t, a)
1568
+ calculatedImageSettings: Ne(e, o, t, a)
1638
1569
  };
1639
1570
  }, [
1640
1571
  c,
@@ -1649,13 +1580,13 @@ var w = C, T = {
1649
1580
  numCells: d,
1650
1581
  calculatedImageSettings: f
1651
1582
  };
1652
- }, Oe = ({ svgRef: e, fileSize: t, fileName: n }) => {
1583
+ }, Ie = ({ svgRef: e, fileSize: t, fileName: n }) => {
1653
1584
  if (!e.current) return;
1654
1585
  let r = e.current.cloneNode(!0);
1655
1586
  r.setAttribute("width", t.toString()), r.setAttribute("height", t.toString());
1656
1587
  let i = new XMLSerializer(), a = new Blob([i.serializeToString(r)], { type: "image/svg+xml" }), o = URL.createObjectURL(a), s = document.createElement("a");
1657
1588
  s.href = o, s.download = `${n}.svg`, document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(o);
1658
- }, ke = ({ svgRef: e, fileSize: t, fileName: n, fileFormat: r, imageSettings: i, calculatedImageSettings: a, size: o, numCells: s, margin: c }) => {
1589
+ }, Le = ({ svgRef: e, fileSize: t, fileName: n, fileFormat: r, imageSettings: i, calculatedImageSettings: a, size: o, numCells: s, margin: c }) => {
1659
1590
  if (!e.current) return;
1660
1591
  let l = document.createElement("canvas"), u = l.getContext("2d");
1661
1592
  if (!u) return;
@@ -1675,8 +1606,8 @@ var w = C, T = {
1675
1606
  t.href = l.toDataURL(e), t.download = `${n}.${r}`, document.body.appendChild(t), t.click(), document.body.removeChild(t);
1676
1607
  }
1677
1608
  }, m.onerror = (e) => console.error("Error loading QR code:", e);
1678
- }, $ = e((e, t) => {
1679
- let { value: n, size: i = 128, level: o = "M", background: l, gradient: u, minVersion: d = 1, boostLevel: f, marginSize: p, finderPatternOuterSettings: m, finderPatternInnerSettings: h, dataModulesSettings: g, imageSettings: _, svgProps: v } = e, y = a(null), { gradientId: b, bgGradientId: x } = Ce(), { margin: C, cells: w, numCells: T, calculatedImageSettings: E } = De({
1609
+ }, Re = e((e, t) => {
1610
+ let { value: n, size: i = 128, level: o = "M", background: l, gradient: u, minVersion: d = 1, boostLevel: f, marginSize: p, finderPatternOuterSettings: m, finderPatternInnerSettings: h, dataModulesSettings: g, imageSettings: _, svgProps: v } = e, y = a(null), { gradientId: b, bgGradientId: x } = je(), { margin: C, cells: w, numCells: T, calculatedImageSettings: E } = Fe({
1680
1611
  value: n,
1681
1612
  level: o,
1682
1613
  minVersion: d,
@@ -1687,12 +1618,12 @@ var w = C, T = {
1687
1618
  });
1688
1619
  r(t, () => ({
1689
1620
  svg: y.current,
1690
- download: ({ name: e = O, format: t = "svg", size: n = 500 }) => {
1691
- y.current && (t === "svg" ? Oe({
1621
+ download: ({ name: e = re, format: t = "svg", size: n = 500 }) => {
1622
+ y.current && (t === "svg" ? Ie({
1692
1623
  svgRef: y,
1693
1624
  fileSize: n,
1694
1625
  fileName: e
1695
- }) : ke({
1626
+ }) : Le({
1696
1627
  svgRef: y,
1697
1628
  fileSize: n,
1698
1629
  fileName: e,
@@ -1705,8 +1636,8 @@ var w = C, T = {
1705
1636
  }));
1706
1637
  }
1707
1638
  }));
1708
- let D = w, k = null;
1709
- _ != null && E != null && (E.excavation != null && (D = we(w, E.excavation)), k = /* @__PURE__ */ s("image", {
1639
+ let D = w, O = null;
1640
+ _ != null && E != null && (E.excavation != null && (D = Me(w, E.excavation)), O = /* @__PURE__ */ s("image", {
1710
1641
  href: _.src,
1711
1642
  height: E.h,
1712
1643
  width: E.w,
@@ -1716,7 +1647,7 @@ var w = C, T = {
1716
1647
  opacity: E.opacity,
1717
1648
  crossOrigin: E.crossOrigin
1718
1649
  }));
1719
- let A = {
1650
+ let k = {
1720
1651
  modules: D,
1721
1652
  margin: C,
1722
1653
  gradient: u,
@@ -1731,7 +1662,7 @@ var w = C, T = {
1731
1662
  "aria-label": v?.["aria-label"] || "QR Code",
1732
1663
  ...v,
1733
1664
  children: [
1734
- /* @__PURE__ */ s(Se, {
1665
+ /* @__PURE__ */ s(Ae, {
1735
1666
  gradient: u,
1736
1667
  gradientId: b
1737
1668
  }),
@@ -1740,23 +1671,23 @@ var w = C, T = {
1740
1671
  bgGradientId: x,
1741
1672
  numCells: T
1742
1673
  }),
1743
- /* @__PURE__ */ s(xe, {
1674
+ /* @__PURE__ */ s(ke, {
1744
1675
  settings: m,
1745
- ...A
1676
+ ...k
1746
1677
  }),
1747
- /* @__PURE__ */ s(be, {
1678
+ /* @__PURE__ */ s(De, {
1748
1679
  settings: h,
1749
- ...A
1680
+ ...k
1750
1681
  }),
1751
- /* @__PURE__ */ s(ye, {
1682
+ /* @__PURE__ */ s(Ee, {
1752
1683
  settings: g,
1753
1684
  cells: w,
1754
- ...A
1685
+ ...k
1755
1686
  }),
1756
- k
1687
+ O
1757
1688
  ]
1758
1689
  });
1759
1690
  });
1760
- $.displayName = "ReactQRCode";
1691
+ Re.displayName = "ReactQRCode";
1761
1692
  //#endregion
1762
- export { $ as ReactQRCode };
1693
+ export { Re as ReactQRCode };