@atooyu/uxto-ui 1.1.35 → 1.1.37

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.js CHANGED
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
2
5
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
6
  const vue = require("vue");
4
7
  const _hoisted_1$H = ["disabled", "hover-class"];
@@ -5051,464 +5054,721 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
5051
5054
  if (moduleCount.value === 0) return 0;
5052
5055
  return props.size / moduleCount.value;
5053
5056
  });
5054
- const ECL = { L: 1, M: 0, Q: 3, H: 2 };
5055
- const ALIGNMENT_PATTERNS = {
5056
- 1: [],
5057
- 2: [6, 18],
5058
- 3: [6, 22],
5059
- 4: [6, 26],
5060
- 5: [6, 30],
5061
- 6: [6, 34],
5062
- 7: [6, 22, 38],
5063
- 8: [6, 24, 42],
5064
- 9: [6, 26, 46],
5065
- 10: [6, 28, 50],
5066
- 11: [6, 30, 54],
5067
- 12: [6, 32, 58],
5068
- 13: [6, 34, 62],
5069
- 14: [6, 26, 46, 66],
5070
- 15: [6, 26, 48, 70],
5071
- 16: [6, 26, 50, 74],
5072
- 17: [6, 30, 54, 78],
5073
- 18: [6, 30, 56, 82],
5074
- 19: [6, 30, 58, 86],
5075
- 20: [6, 34, 62, 90]
5076
- };
5057
+ const QRErrorCorrectionLevel = { L: 1, M: 0, Q: 3, H: 2 };
5058
+ const PAD0 = 236;
5059
+ const PAD1 = 17;
5060
+ const PATTERN_POSITION_TABLE = [
5061
+ [],
5062
+ [6, 18],
5063
+ [6, 22],
5064
+ [6, 26],
5065
+ [6, 30],
5066
+ [6, 34],
5067
+ [6, 22, 38],
5068
+ [6, 24, 42],
5069
+ [6, 26, 46],
5070
+ [6, 28, 50],
5071
+ [6, 30, 54],
5072
+ [6, 32, 58],
5073
+ [6, 34, 62],
5074
+ [6, 26, 46, 66],
5075
+ [6, 26, 48, 70],
5076
+ [6, 26, 50, 74],
5077
+ [6, 30, 54, 78],
5078
+ [6, 30, 56, 82],
5079
+ [6, 30, 58, 86],
5080
+ [6, 34, 62, 90],
5081
+ [6, 28, 50, 72, 94],
5082
+ [6, 26, 50, 74, 98],
5083
+ [6, 30, 54, 78, 102],
5084
+ [6, 28, 54, 80, 106],
5085
+ [6, 32, 58, 84, 110],
5086
+ [6, 30, 58, 86, 114],
5087
+ [6, 34, 62, 90, 118],
5088
+ [6, 26, 50, 74, 98, 122],
5089
+ [6, 30, 54, 78, 102, 126],
5090
+ [6, 26, 52, 78, 104, 130],
5091
+ [6, 30, 56, 82, 108, 134],
5092
+ [6, 34, 60, 86, 112, 138],
5093
+ [6, 30, 58, 86, 114, 142],
5094
+ [6, 34, 62, 90, 118, 146],
5095
+ [6, 30, 54, 78, 102, 126, 150],
5096
+ [6, 24, 50, 76, 102, 128, 154],
5097
+ [6, 28, 54, 80, 106, 132, 158],
5098
+ [6, 32, 58, 84, 110, 136, 162],
5099
+ [6, 26, 54, 82, 110, 138, 166],
5100
+ [6, 30, 58, 86, 114, 142, 170]
5101
+ ];
5102
+ const G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
5103
+ const G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
5104
+ const G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
5077
5105
  const RS_BLOCK_TABLE = [
5078
- // Version 1
5079
5106
  [1, 26, 19],
5080
5107
  [1, 26, 16],
5081
5108
  [1, 26, 13],
5082
5109
  [1, 26, 9],
5083
- // Version 2
5084
5110
  [1, 44, 34],
5085
5111
  [1, 44, 28],
5086
5112
  [1, 44, 22],
5087
5113
  [1, 44, 16],
5088
- // Version 3
5089
5114
  [1, 70, 55],
5090
5115
  [1, 70, 44],
5091
5116
  [2, 35, 17],
5092
5117
  [2, 35, 13],
5093
- // Version 4
5094
5118
  [1, 100, 80],
5095
5119
  [2, 50, 32],
5096
5120
  [2, 50, 24],
5097
5121
  [4, 25, 9],
5098
- // Version 5
5099
5122
  [1, 134, 108],
5100
5123
  [2, 67, 43],
5101
5124
  [2, 33, 15, 2, 34, 16],
5102
5125
  [2, 33, 11, 2, 34, 12],
5103
- // Version 6
5104
5126
  [2, 86, 68],
5105
5127
  [4, 43, 27],
5106
5128
  [4, 43, 19],
5107
5129
  [4, 43, 15],
5108
- // Version 7
5109
5130
  [2, 98, 78],
5110
5131
  [4, 49, 31],
5111
5132
  [2, 32, 14, 4, 33, 15],
5112
5133
  [4, 39, 13, 1, 40, 14],
5113
- // Version 8
5114
5134
  [2, 121, 97],
5115
5135
  [2, 60, 38, 2, 61, 39],
5116
5136
  [4, 40, 18, 2, 41, 19],
5117
5137
  [4, 40, 14, 2, 41, 15],
5118
- // Version 9
5119
5138
  [2, 146, 116],
5120
5139
  [3, 58, 36, 2, 59, 37],
5121
5140
  [4, 36, 16, 4, 37, 17],
5122
5141
  [4, 36, 12, 4, 37, 13],
5123
- // Version 10
5124
5142
  [2, 86, 68, 2, 87, 69],
5125
5143
  [4, 69, 43, 1, 70, 44],
5126
5144
  [6, 43, 19, 2, 44, 20],
5127
5145
  [6, 43, 15, 2, 44, 16],
5128
- // Version 11
5129
5146
  [4, 101, 81],
5130
5147
  [1, 80, 50, 4, 81, 51],
5131
5148
  [4, 50, 22, 4, 51, 23],
5132
5149
  [3, 36, 12, 8, 37, 13],
5133
- // Version 12
5134
5150
  [2, 116, 92, 2, 117, 93],
5135
5151
  [6, 58, 36, 2, 59, 37],
5136
5152
  [4, 46, 20, 6, 47, 21],
5137
5153
  [7, 42, 14, 4, 43, 15],
5138
- // Version 13
5139
5154
  [4, 133, 107],
5140
5155
  [8, 59, 37, 1, 60, 38],
5141
5156
  [8, 44, 20, 4, 45, 21],
5142
5157
  [12, 33, 11, 4, 34, 12],
5143
- // Version 14
5144
5158
  [3, 145, 115, 1, 146, 116],
5145
5159
  [4, 64, 40, 5, 65, 41],
5146
5160
  [11, 36, 16, 5, 37, 17],
5147
5161
  [11, 36, 12, 5, 37, 13],
5148
- // Version 15
5149
5162
  [5, 109, 87, 1, 110, 88],
5150
5163
  [5, 65, 41, 5, 66, 42],
5151
5164
  [5, 54, 24, 7, 55, 25],
5152
5165
  [11, 36, 12, 7, 37, 13],
5153
- // Version 16
5154
5166
  [5, 122, 98, 1, 123, 99],
5155
5167
  [7, 73, 45, 3, 74, 46],
5156
5168
  [15, 43, 19, 2, 44, 20],
5157
5169
  [3, 45, 15, 13, 46, 16],
5158
- // Version 17
5159
5170
  [1, 135, 107, 5, 136, 108],
5160
5171
  [10, 74, 46, 1, 75, 47],
5161
5172
  [1, 50, 22, 15, 51, 23],
5162
5173
  [2, 42, 14, 17, 43, 15],
5163
- // Version 18
5164
5174
  [5, 150, 120, 1, 151, 121],
5165
5175
  [9, 69, 43, 4, 70, 44],
5166
5176
  [17, 50, 22, 1, 51, 23],
5167
5177
  [2, 42, 14, 19, 43, 15],
5168
- // Version 19
5169
5178
  [3, 141, 113, 4, 142, 114],
5170
5179
  [3, 70, 44, 11, 71, 45],
5171
5180
  [17, 47, 21, 4, 48, 22],
5172
5181
  [9, 39, 13, 16, 40, 14],
5173
- // Version 20
5174
5182
  [3, 135, 107, 5, 136, 108],
5175
5183
  [3, 67, 41, 13, 68, 42],
5176
5184
  [15, 54, 24, 5, 55, 25],
5177
- [15, 43, 15, 10, 44, 16]
5185
+ [15, 43, 15, 10, 44, 16],
5186
+ [4, 144, 116, 4, 145, 117],
5187
+ [17, 68, 42],
5188
+ [17, 50, 22, 6, 51, 23],
5189
+ [19, 46, 16, 6, 47, 17],
5190
+ [2, 139, 111, 7, 140, 112],
5191
+ [17, 74, 46],
5192
+ [7, 54, 24, 16, 55, 25],
5193
+ [34, 37, 13],
5194
+ [4, 151, 121, 5, 152, 122],
5195
+ [4, 75, 47, 14, 76, 48],
5196
+ [11, 54, 24, 14, 55, 25],
5197
+ [16, 45, 15, 14, 46, 16],
5198
+ [6, 147, 117, 4, 148, 118],
5199
+ [6, 73, 45, 14, 74, 46],
5200
+ [11, 54, 24, 16, 55, 25],
5201
+ [30, 46, 16, 2, 47, 17],
5202
+ [8, 132, 106, 4, 133, 107],
5203
+ [8, 75, 47, 13, 76, 48],
5204
+ [7, 54, 24, 22, 55, 25],
5205
+ [22, 45, 15, 13, 46, 16],
5206
+ [10, 142, 114, 2, 143, 115],
5207
+ [19, 74, 46, 4, 75, 47],
5208
+ [28, 50, 22, 6, 51, 23],
5209
+ [33, 46, 16, 4, 47, 17],
5210
+ [8, 152, 122, 4, 153, 123],
5211
+ [22, 73, 45, 3, 74, 46],
5212
+ [8, 53, 23, 26, 54, 24],
5213
+ [12, 45, 15, 28, 46, 16],
5214
+ [3, 147, 117, 10, 148, 118],
5215
+ [3, 73, 45, 23, 74, 46],
5216
+ [4, 54, 24, 31, 55, 25],
5217
+ [11, 45, 15, 31, 46, 16],
5218
+ [7, 146, 116, 7, 147, 117],
5219
+ [21, 73, 45, 7, 74, 46],
5220
+ [1, 53, 23, 37, 54, 24],
5221
+ [19, 45, 15, 26, 46, 16],
5222
+ [5, 145, 115, 10, 146, 116],
5223
+ [19, 75, 47, 10, 76, 48],
5224
+ [15, 54, 24, 25, 55, 25],
5225
+ [23, 45, 15, 25, 46, 16],
5226
+ [13, 145, 115, 3, 146, 116],
5227
+ [2, 74, 46, 29, 75, 47],
5228
+ [42, 54, 24, 1, 55, 25],
5229
+ [23, 45, 15, 28, 46, 16],
5230
+ [17, 145, 115],
5231
+ [10, 74, 46, 23, 75, 47],
5232
+ [10, 54, 24, 35, 55, 25],
5233
+ [19, 45, 15, 35, 46, 16],
5234
+ [17, 145, 115, 1, 146, 116],
5235
+ [14, 74, 46, 21, 75, 47],
5236
+ [29, 54, 24, 19, 55, 25],
5237
+ [11, 45, 15, 46, 46, 16],
5238
+ [13, 145, 115, 6, 146, 116],
5239
+ [14, 74, 46, 23, 75, 47],
5240
+ [44, 54, 24, 7, 55, 25],
5241
+ [59, 46, 16, 1, 47, 17],
5242
+ [12, 151, 121, 7, 152, 122],
5243
+ [12, 75, 47, 26, 76, 48],
5244
+ [39, 54, 24, 14, 55, 25],
5245
+ [22, 45, 15, 41, 46, 16],
5246
+ [6, 151, 121, 14, 152, 122],
5247
+ [6, 75, 47, 34, 76, 48],
5248
+ [46, 54, 24, 10, 55, 25],
5249
+ [2, 45, 15, 64, 46, 16],
5250
+ [17, 152, 122, 4, 153, 123],
5251
+ [29, 74, 46, 14, 75, 47],
5252
+ [49, 54, 24, 10, 55, 25],
5253
+ [24, 45, 15, 46, 46, 16],
5254
+ [4, 152, 122, 18, 153, 123],
5255
+ [13, 74, 46, 32, 75, 47],
5256
+ [48, 54, 24, 14, 55, 25],
5257
+ [42, 45, 15, 32, 46, 16],
5258
+ [20, 147, 117, 4, 148, 118],
5259
+ [40, 75, 47, 7, 76, 48],
5260
+ [43, 54, 24, 22, 55, 25],
5261
+ [10, 45, 15, 67, 46, 16],
5262
+ [19, 148, 118, 6, 149, 119],
5263
+ [18, 75, 47, 31, 76, 48],
5264
+ [34, 54, 24, 34, 55, 25],
5265
+ [20, 45, 15, 61, 46, 16]
5178
5266
  ];
5179
- const GF_EXP = new Array(512);
5180
- const GF_LOG = new Array(256);
5181
- let gfX = 1;
5182
- for (let gfI = 0; gfI < 255; gfI++) {
5183
- GF_EXP[gfI] = gfX;
5184
- GF_LOG[gfX] = gfI;
5185
- gfX <<= 1;
5186
- if (gfX & 256) {
5187
- gfX ^= 285;
5267
+ const EXP_TABLE = new Array(256);
5268
+ const LOG_TABLE = new Array(256);
5269
+ for (let i = 0; i < 8; i++) {
5270
+ EXP_TABLE[i] = 1 << i;
5271
+ }
5272
+ for (let i = 8; i < 256; i++) {
5273
+ EXP_TABLE[i] = EXP_TABLE[i - 4] ^ EXP_TABLE[i - 5] ^ EXP_TABLE[i - 6] ^ EXP_TABLE[i - 8];
5274
+ }
5275
+ for (let i = 0; i < 255; i++) {
5276
+ LOG_TABLE[EXP_TABLE[i]] = i;
5277
+ }
5278
+ function glog(n) {
5279
+ if (n < 1) throw new Error("glog(" + n + ")");
5280
+ return LOG_TABLE[n];
5281
+ }
5282
+ function gexp(n) {
5283
+ while (n < 0) n += 255;
5284
+ while (n >= 256) n -= 255;
5285
+ return EXP_TABLE[n];
5286
+ }
5287
+ function createPolynomial(num, shift) {
5288
+ let offset = 0;
5289
+ while (offset < num.length && num[offset] === 0) offset++;
5290
+ const _num = new Array(num.length - offset + shift).fill(0);
5291
+ for (let i = 0; i < num.length - offset; i++) {
5292
+ _num[i] = num[i + offset];
5293
+ }
5294
+ return {
5295
+ getAt: (index) => _num[index],
5296
+ getLength: () => _num.length,
5297
+ multiply: (e) => {
5298
+ const result = new Array(_num.length + e.getLength() - 1).fill(0);
5299
+ for (let i = 0; i < _num.length; i++) {
5300
+ for (let j = 0; j < e.getLength(); j++) {
5301
+ result[i + j] ^= gexp(glog(_num[i]) + glog(e.getAt(j)));
5302
+ }
5303
+ }
5304
+ return createPolynomial(result, 0);
5305
+ },
5306
+ mod: (e) => {
5307
+ const lenDiff = _num.length - e.getLength();
5308
+ if (lenDiff < 0) return createPolynomial(_num, 0);
5309
+ const ratio = glog(_num[0]) - glog(e.getAt(0));
5310
+ const result = [..._num];
5311
+ for (let i = 0; i < e.getLength(); i++) {
5312
+ result[i] ^= gexp(glog(e.getAt(i)) + ratio);
5313
+ }
5314
+ return createPolynomial(result, 0).mod(e);
5315
+ }
5316
+ };
5317
+ }
5318
+ function getBCHDigit(data) {
5319
+ let digit = 0;
5320
+ while (data !== 0) {
5321
+ digit++;
5322
+ data >>>= 1;
5323
+ }
5324
+ return digit;
5325
+ }
5326
+ function getBCHTypeInfo(data) {
5327
+ let d = data << 10;
5328
+ while (getBCHDigit(d) - getBCHDigit(G15) >= 0) {
5329
+ d ^= G15 << getBCHDigit(d) - getBCHDigit(G15);
5330
+ }
5331
+ return (data << 10 | d) ^ G15_MASK;
5332
+ }
5333
+ function getBCHTypeNumber(data) {
5334
+ let d = data << 12;
5335
+ while (getBCHDigit(d) - getBCHDigit(G18) >= 0) {
5336
+ d ^= G18 << getBCHDigit(d) - getBCHDigit(G18);
5188
5337
  }
5338
+ return data << 12 | d;
5339
+ }
5340
+ function getPatternPosition(typeNumber) {
5341
+ return PATTERN_POSITION_TABLE[typeNumber - 1];
5189
5342
  }
5190
- for (let gfI = 255; gfI < 512; gfI++) {
5191
- GF_EXP[gfI] = GF_EXP[gfI - 255];
5343
+ function getMaskFunction(maskPattern) {
5344
+ switch (maskPattern) {
5345
+ case 0:
5346
+ return (i, j) => (i + j) % 2 === 0;
5347
+ case 1:
5348
+ return (i, j) => i % 2 === 0;
5349
+ case 2:
5350
+ return (i, j) => j % 3 === 0;
5351
+ case 3:
5352
+ return (i, j) => (i + j) % 3 === 0;
5353
+ case 4:
5354
+ return (i, j) => (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0;
5355
+ case 5:
5356
+ return (i, j) => i * j % 2 + i * j % 3 === 0;
5357
+ case 6:
5358
+ return (i, j) => (i * j % 2 + i * j % 3) % 2 === 0;
5359
+ case 7:
5360
+ return (i, j) => (i * j % 3 + (i + j) % 2) % 2 === 0;
5361
+ default:
5362
+ throw new Error("bad maskPattern:" + maskPattern);
5363
+ }
5192
5364
  }
5193
- function gfMul(a, b) {
5194
- if (a === 0 || b === 0) return 0;
5195
- return GF_EXP[GF_LOG[a] + GF_LOG[b]];
5365
+ function getErrorCorrectPolynomial(errorCorrectLength) {
5366
+ let a = createPolynomial([1], 0);
5367
+ for (let i = 0; i < errorCorrectLength; i++) {
5368
+ a = a.multiply(createPolynomial([1, gexp(i)], 0));
5369
+ }
5370
+ return a;
5196
5371
  }
5197
- function getRSBlocks(version, ecl) {
5198
- const index = (version - 1) * 4 + ecl;
5199
- const blockData = RS_BLOCK_TABLE[index];
5200
- const blocks = [];
5201
- if (blockData.length === 3) {
5202
- const count = blockData[0];
5203
- const total = blockData[1];
5204
- const data = blockData[2];
5205
- for (let i = 0; i < count; i++) {
5206
- blocks.push({ totalCount: total, dataCount: data });
5372
+ function getLengthInBits(mode, type) {
5373
+ if (1 <= type && type < 10) {
5374
+ switch (mode) {
5375
+ case 1:
5376
+ return 10;
5377
+ case 2:
5378
+ return 9;
5379
+ case 4:
5380
+ return 8;
5381
+ case 8:
5382
+ return 8;
5383
+ default:
5384
+ throw new Error("mode:" + mode);
5207
5385
  }
5208
- } else if (blockData.length === 6) {
5209
- const count1 = blockData[0];
5210
- const total1 = blockData[1];
5211
- const data1 = blockData[2];
5212
- for (let i = 0; i < count1; i++) {
5213
- blocks.push({ totalCount: total1, dataCount: data1 });
5386
+ } else if (type < 27) {
5387
+ switch (mode) {
5388
+ case 1:
5389
+ return 12;
5390
+ case 2:
5391
+ return 11;
5392
+ case 4:
5393
+ return 16;
5394
+ case 8:
5395
+ return 10;
5396
+ default:
5397
+ throw new Error("mode:" + mode);
5214
5398
  }
5215
- const count2 = blockData[3];
5216
- const total2 = blockData[4];
5217
- const data2 = blockData[5];
5218
- for (let i = 0; i < count2; i++) {
5219
- blocks.push({ totalCount: total2, dataCount: data2 });
5399
+ } else if (type < 41) {
5400
+ switch (mode) {
5401
+ case 1:
5402
+ return 14;
5403
+ case 2:
5404
+ return 13;
5405
+ case 4:
5406
+ return 16;
5407
+ case 8:
5408
+ return 12;
5409
+ default:
5410
+ throw new Error("mode:" + mode);
5220
5411
  }
5412
+ } else {
5413
+ throw new Error("type:" + type);
5221
5414
  }
5222
- return blocks;
5223
5415
  }
5224
- function getECCodewords(data, ecCount) {
5225
- let gen = [1];
5226
- for (let i = 0; i < ecCount; i++) {
5227
- const temp = new Array(gen.length + 1).fill(0);
5228
- for (let j = 0; j < gen.length; j++) {
5229
- temp[j] ^= gen[j];
5230
- temp[j + 1] ^= gfMul(gen[j], GF_EXP[i]);
5231
- }
5232
- gen = temp;
5233
- }
5234
- const ecc = new Array(ecCount).fill(0);
5235
- for (const byte of data) {
5236
- const factor = byte ^ ecc[0];
5237
- ecc.shift();
5238
- ecc.push(0);
5239
- for (let i = 0; i < ecCount; i++) {
5240
- ecc[i] ^= gfMul(gen[i + 1], factor);
5416
+ function getRSBlocks(typeNumber, errorCorrectionLevel) {
5417
+ const rsBlock = RS_BLOCK_TABLE[(typeNumber - 1) * 4 + errorCorrectionLevel];
5418
+ if (!rsBlock) throw new Error("bad rs block");
5419
+ const length = rsBlock.length / 3;
5420
+ const list2 = [];
5421
+ for (let i = 0; i < length; i++) {
5422
+ const count = rsBlock[i * 3 + 0];
5423
+ const totalCount = rsBlock[i * 3 + 1];
5424
+ const dataCount = rsBlock[i * 3 + 2];
5425
+ for (let j = 0; j < count; j++) {
5426
+ list2.push({ totalCount, dataCount });
5241
5427
  }
5242
5428
  }
5243
- return ecc;
5429
+ return list2;
5244
5430
  }
5245
- function createData(text, version, ecl) {
5246
- const rsBlocks = getRSBlocks(version, ecl);
5247
- let totalDataCount = 0;
5248
- for (const block of rsBlocks) {
5249
- totalDataCount += block.dataCount;
5250
- }
5251
- const buffer = [];
5252
- buffer.push(0, 1, 0, 0);
5253
- const cciBits = version <= 9 ? 8 : 16;
5254
- for (let i = cciBits - 1; i >= 0; i--) {
5255
- buffer.push(text.length >>> i & 1);
5431
+ class BitBuffer {
5432
+ constructor() {
5433
+ __publicField(this, "buffer", []);
5434
+ __publicField(this, "length", 0);
5256
5435
  }
5257
- for (const char of text) {
5258
- const code2 = char.charCodeAt(0);
5259
- for (let i = 7; i >= 0; i--) {
5260
- buffer.push(code2 >>> i & 1);
5261
- }
5436
+ getBuffer() {
5437
+ return this.buffer;
5262
5438
  }
5263
- const totalBits = totalDataCount * 8;
5264
- const termLen = Math.min(4, totalBits - buffer.length);
5265
- for (let i = 0; i < termLen; i++) {
5266
- buffer.push(0);
5439
+ getLengthInBits() {
5440
+ return this.length;
5267
5441
  }
5268
- while (buffer.length % 8 !== 0) {
5269
- buffer.push(0);
5442
+ put(num, len) {
5443
+ for (let i = 0; i < len; i++) {
5444
+ this.putBit((num >>> len - i - 1 & 1) === 1);
5445
+ }
5270
5446
  }
5271
- let padIdx = 0;
5272
- const pads = [236, 17];
5273
- while (buffer.length < totalBits) {
5274
- const pad = pads[padIdx];
5275
- for (let i = 7; i >= 0; i--) {
5276
- buffer.push(pad >>> i & 1);
5447
+ putBit(bit) {
5448
+ const bufIndex = Math.floor(this.length / 8);
5449
+ if (this.buffer.length <= bufIndex) {
5450
+ this.buffer.push(0);
5451
+ }
5452
+ if (bit) {
5453
+ this.buffer[bufIndex] |= 128 >>> this.length % 8;
5277
5454
  }
5278
- padIdx = (padIdx + 1) % 2;
5455
+ this.length++;
5279
5456
  }
5280
- const dataBytes = [];
5281
- for (let i = 0; i < buffer.length; i += 8) {
5282
- let byte = 0;
5283
- for (let j = 0; j < 8; j++) {
5284
- byte = byte << 1 | (buffer[i + j] || 0);
5457
+ }
5458
+ function stringToBytes(s) {
5459
+ const bytes = [];
5460
+ for (let i = 0; i < s.length; i++) {
5461
+ const c = s.charCodeAt(i);
5462
+ bytes.push(c & 255);
5463
+ }
5464
+ return bytes;
5465
+ }
5466
+ function createData(typeNumber, errorCorrectionLevel, dataList) {
5467
+ const rsBlocks = getRSBlocks(typeNumber, errorCorrectionLevel);
5468
+ const buffer = new BitBuffer();
5469
+ for (const data of dataList) {
5470
+ buffer.put(data.mode, 4);
5471
+ buffer.put(stringToBytes(data.data).length, getLengthInBits(data.mode, typeNumber));
5472
+ for (const byte of stringToBytes(data.data)) {
5473
+ buffer.put(byte, 8);
5285
5474
  }
5286
- dataBytes.push(byte);
5287
5475
  }
5288
- let dataIndex = 0;
5289
- const ecData = [];
5290
- const dcData = [];
5476
+ let totalDataCount = 0;
5291
5477
  for (const block of rsBlocks) {
5292
- const dc = dataBytes.slice(dataIndex, dataIndex + block.dataCount);
5293
- dataIndex += block.dataCount;
5294
- dcData.push(dc);
5295
- const ecCount = block.totalCount - block.dataCount;
5296
- ecData.push(getECCodewords(dc, ecCount));
5478
+ totalDataCount += block.dataCount;
5297
5479
  }
5298
- const result = [];
5480
+ if (buffer.getLengthInBits() > totalDataCount * 8) {
5481
+ throw new Error("code length overflow");
5482
+ }
5483
+ if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
5484
+ buffer.put(0, 4);
5485
+ }
5486
+ while (buffer.getLengthInBits() % 8 !== 0) {
5487
+ buffer.putBit(false);
5488
+ }
5489
+ while (true) {
5490
+ if (buffer.getLengthInBits() >= totalDataCount * 8) break;
5491
+ buffer.put(PAD0, 8);
5492
+ if (buffer.getLengthInBits() >= totalDataCount * 8) break;
5493
+ buffer.put(PAD1, 8);
5494
+ }
5495
+ return createBytes(buffer, rsBlocks);
5496
+ }
5497
+ function createBytes(buffer, rsBlocks) {
5498
+ let offset = 0;
5299
5499
  let maxDcCount = 0;
5300
5500
  let maxEcCount = 0;
5501
+ const dcdata = [];
5502
+ const ecdata = [];
5301
5503
  for (const block of rsBlocks) {
5302
- maxDcCount = Math.max(maxDcCount, block.dataCount);
5303
- maxEcCount = Math.max(maxEcCount, block.totalCount - block.dataCount);
5504
+ const dcCount = block.dataCount;
5505
+ const ecCount = block.totalCount - dcCount;
5506
+ maxDcCount = Math.max(maxDcCount, dcCount);
5507
+ maxEcCount = Math.max(maxEcCount, ecCount);
5508
+ const dc = [];
5509
+ for (let i = 0; i < dcCount; i++) {
5510
+ dc.push(255 & buffer.getBuffer()[i + offset]);
5511
+ }
5512
+ dcdata.push(dc);
5513
+ offset += dcCount;
5514
+ const rsPoly = getErrorCorrectPolynomial(ecCount);
5515
+ const rawPoly = createPolynomial(dc, rsPoly.getLength() - 1);
5516
+ const modPoly = rawPoly.mod(rsPoly);
5517
+ const ec = new Array(rsPoly.getLength() - 1).fill(0);
5518
+ for (let i = 0; i < ec.length; i++) {
5519
+ const modIndex = i + modPoly.getLength() - ec.length;
5520
+ ec[i] = modIndex >= 0 ? modPoly.getAt(modIndex) : 0;
5521
+ }
5522
+ ecdata.push(ec);
5304
5523
  }
5524
+ const result = [];
5305
5525
  for (let i = 0; i < maxDcCount; i++) {
5306
- for (let j = 0; j < dcData.length; j++) {
5307
- if (i < dcData[j].length) {
5308
- result.push(dcData[j][i]);
5309
- }
5526
+ for (let j = 0; j < dcdata.length; j++) {
5527
+ if (i < dcdata[j].length) result.push(dcdata[j][i]);
5310
5528
  }
5311
5529
  }
5312
5530
  for (let i = 0; i < maxEcCount; i++) {
5313
- for (let j = 0; j < ecData.length; j++) {
5314
- if (i < ecData[j].length) {
5315
- result.push(ecData[j][i]);
5316
- }
5531
+ for (let j = 0; j < ecdata.length; j++) {
5532
+ if (i < ecdata[j].length) result.push(ecdata[j][i]);
5317
5533
  }
5318
5534
  }
5319
5535
  return result;
5320
5536
  }
5321
- function getMinVersion(text) {
5322
- const CAPACITIES = [
5323
- 0,
5324
- 14,
5325
- 26,
5326
- 42,
5327
- 62,
5328
- 84,
5329
- 106,
5330
- 122,
5331
- 152,
5332
- 180,
5333
- 213,
5334
- 251,
5335
- 287,
5336
- 331,
5337
- 362,
5338
- 412,
5339
- 450,
5340
- 504,
5341
- 560,
5342
- 624,
5343
- 666
5344
- ];
5345
- for (let v = 1; v <= 20; v++) {
5346
- if (text.length <= CAPACITIES[v]) return v;
5537
+ class QRCode {
5538
+ constructor(typeNumber, errorCorrectionLevel) {
5539
+ __publicField(this, "typeNumber");
5540
+ __publicField(this, "errorCorrectionLevel");
5541
+ __publicField(this, "modules", []);
5542
+ __publicField(this, "moduleCount", 0);
5543
+ __publicField(this, "dataCache", null);
5544
+ this.typeNumber = typeNumber;
5545
+ this.errorCorrectionLevel = QRErrorCorrectionLevel[errorCorrectionLevel];
5546
+ }
5547
+ addData(data) {
5548
+ const dataList = [{ mode: 4, data }];
5549
+ this.dataCache = createData(this.typeNumber, this.errorCorrectionLevel, dataList);
5550
+ }
5551
+ make() {
5552
+ if (this.typeNumber < 1) {
5553
+ let typeNumber = 1;
5554
+ for (; typeNumber < 40; typeNumber++) {
5555
+ try {
5556
+ const testData = createData(typeNumber, this.errorCorrectionLevel, [{ mode: 4, data: "test" }]);
5557
+ this.dataCache = createData(typeNumber, this.errorCorrectionLevel, [{ mode: 4, data: "" }]);
5558
+ break;
5559
+ } catch {
5560
+ continue;
5561
+ }
5562
+ }
5563
+ this.typeNumber = typeNumber;
5564
+ }
5565
+ this.makeImpl(false, this.getBestMaskPattern());
5566
+ }
5567
+ getBestMaskPattern() {
5568
+ let minLostPoint = 0;
5569
+ let pattern = 0;
5570
+ for (let i = 0; i < 8; i++) {
5571
+ this.makeImpl(true, i);
5572
+ const lostPoint = this.getLostPoint();
5573
+ if (i === 0 || minLostPoint > lostPoint) {
5574
+ minLostPoint = lostPoint;
5575
+ pattern = i;
5576
+ }
5577
+ }
5578
+ return pattern;
5347
5579
  }
5348
- return 20;
5349
- }
5350
- function createQRCode(text, errorLevel) {
5351
- const ecl = ECL[errorLevel] ?? 0;
5352
- const version = getMinVersion(text);
5353
- const size = version * 4 + 17;
5354
- const mod = [];
5355
- for (let i = 0; i < size; i++) {
5356
- mod[i] = new Array(size).fill(-1);
5357
- }
5358
- const setModule = (row, col, value) => {
5359
- if (row >= 0 && row < size && col >= 0 && col < size) {
5360
- mod[row][col] = value;
5580
+ makeImpl(test, maskPattern) {
5581
+ this.moduleCount = this.typeNumber * 4 + 17;
5582
+ this.modules = [];
5583
+ for (let row = 0; row < this.moduleCount; row++) {
5584
+ this.modules[row] = new Array(this.moduleCount).fill(null);
5361
5585
  }
5362
- };
5363
- const isSet = (row, col) => {
5364
- return row >= 0 && row < size && col >= 0 && col < size && mod[row][col] !== -1;
5365
- };
5366
- const addFinderPattern = (baseRow, baseCol) => {
5586
+ this.setupPositionProbePattern(0, 0);
5587
+ this.setupPositionProbePattern(this.moduleCount - 7, 0);
5588
+ this.setupPositionProbePattern(0, this.moduleCount - 7);
5589
+ this.setupPositionAdjustPattern();
5590
+ this.setupTimingPattern();
5591
+ this.setupTypeInfo(test, maskPattern);
5592
+ if (this.typeNumber >= 7) {
5593
+ this.setupTypeNumber(test);
5594
+ }
5595
+ if (this.dataCache === null) {
5596
+ throw new Error("dataCache is null");
5597
+ }
5598
+ this.mapData(this.dataCache, maskPattern);
5599
+ }
5600
+ setupPositionProbePattern(row, col) {
5367
5601
  for (let r = -1; r <= 7; r++) {
5602
+ if (row + r <= -1 || this.moduleCount <= row + r) continue;
5368
5603
  for (let c = -1; c <= 7; c++) {
5369
- const nr = baseRow + r;
5370
- const nc = baseCol + c;
5371
- if (nr < 0 || nr >= size || nc < 0 || nc >= size) continue;
5372
- if (r >= 0 && r <= 6 && c >= 0 && c <= 6) {
5373
- if (r === 0 || r === 6 || c === 0 || c === 6 || r >= 2 && r <= 4 && c >= 2 && c <= 4) {
5374
- setModule(nr, nc, 1);
5375
- } else {
5376
- setModule(nr, nc, 0);
5377
- }
5604
+ if (col + c <= -1 || this.moduleCount <= col + c) continue;
5605
+ if (0 <= r && r <= 6 && (c === 0 || c === 6) || 0 <= c && c <= 6 && (r === 0 || r === 6) || 2 <= r && r <= 4 && 2 <= c && c <= 4) {
5606
+ this.modules[row + r][col + c] = true;
5378
5607
  } else {
5379
- setModule(nr, nc, 0);
5608
+ this.modules[row + r][col + c] = false;
5380
5609
  }
5381
5610
  }
5382
5611
  }
5383
- };
5384
- addFinderPattern(0, 0);
5385
- addFinderPattern(size - 7, 0);
5386
- addFinderPattern(0, size - 7);
5387
- const addAlignmentPattern = (row, col) => {
5388
- for (let r = -2; r <= 2; r++) {
5389
- for (let c = -2; c <= 2; c++) {
5390
- if (Math.abs(r) === 2 || Math.abs(c) === 2 || r === 0 && c === 0) {
5391
- setModule(row + r, col + c, 1);
5392
- } else {
5393
- setModule(row + r, col + c, 0);
5394
- }
5395
- }
5612
+ }
5613
+ setupTimingPattern() {
5614
+ for (let r = 8; r < this.moduleCount - 8; r++) {
5615
+ if (this.modules[r][6] !== null) continue;
5616
+ this.modules[r][6] = r % 2 === 0;
5396
5617
  }
5397
- };
5398
- const alignPositions = ALIGNMENT_PATTERNS[version] || [];
5399
- for (const r of alignPositions) {
5400
- for (const c of alignPositions) {
5401
- if (isSet(r, c)) continue;
5402
- addAlignmentPattern(r, c);
5618
+ for (let c = 8; c < this.moduleCount - 8; c++) {
5619
+ if (this.modules[6][c] !== null) continue;
5620
+ this.modules[6][c] = c % 2 === 0;
5403
5621
  }
5404
5622
  }
5405
- for (let i = 8; i < size - 8; i++) {
5406
- setModule(6, i, i % 2 === 0 ? 1 : 0);
5407
- setModule(i, 6, i % 2 === 0 ? 1 : 0);
5408
- }
5409
- setModule(size - 8, 8, 1);
5410
- const reserved = [];
5411
- for (let i = 0; i < size; i++) {
5412
- reserved[i] = new Array(size).fill(false);
5413
- }
5414
- for (let r = 0; r < 9; r++) {
5415
- for (let c = 0; c < 9; c++) {
5416
- reserved[r][c] = true;
5623
+ setupPositionAdjustPattern() {
5624
+ const pos = getPatternPosition(this.typeNumber);
5625
+ for (let i = 0; i < pos.length; i++) {
5626
+ for (let j = 0; j < pos.length; j++) {
5627
+ const row = pos[i];
5628
+ const col = pos[j];
5629
+ if (this.modules[row][col] !== null) continue;
5630
+ for (let r = -2; r <= 2; r++) {
5631
+ for (let c = -2; c <= 2; c++) {
5632
+ if (r === -2 || r === 2 || c === -2 || c === 2 || r === 0 && c === 0) {
5633
+ this.modules[row + r][col + c] = true;
5634
+ } else {
5635
+ this.modules[row + r][col + c] = false;
5636
+ }
5637
+ }
5638
+ }
5639
+ }
5417
5640
  }
5418
5641
  }
5419
- for (let r = 0; r < 9; r++) {
5420
- for (let c = size - 8; c < size; c++) {
5421
- reserved[r][c] = true;
5642
+ setupTypeNumber(test) {
5643
+ const bits = getBCHTypeNumber(this.typeNumber);
5644
+ for (let i = 0; i < 18; i++) {
5645
+ const mod = !test && (bits >> i & 1) === 1;
5646
+ this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod;
5422
5647
  }
5423
- }
5424
- for (let r = size - 8; r < size; r++) {
5425
- for (let c = 0; c < 9; c++) {
5426
- reserved[r][c] = true;
5648
+ for (let i = 0; i < 18; i++) {
5649
+ const mod = !test && (bits >> i & 1) === 1;
5650
+ this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
5427
5651
  }
5428
5652
  }
5429
- for (let i = 0; i < size; i++) {
5430
- reserved[6][i] = true;
5431
- reserved[i][6] = true;
5432
- }
5433
- for (const r of alignPositions) {
5434
- for (const c of alignPositions) {
5435
- for (let dr = -2; dr <= 2; dr++) {
5436
- for (let dc = -2; dc <= 2; dc++) {
5437
- const nr = r + dr;
5438
- const nc = c + dc;
5439
- if (nr >= 0 && nr < size && nc >= 0 && nc < size) {
5440
- reserved[nr][nc] = true;
5653
+ setupTypeInfo(test, maskPattern) {
5654
+ const data = this.errorCorrectionLevel << 3 | maskPattern;
5655
+ const bits = getBCHTypeInfo(data);
5656
+ for (let i = 0; i < 15; i++) {
5657
+ const mod = !test && (bits >> i & 1) === 1;
5658
+ if (i < 6) {
5659
+ this.modules[i][8] = mod;
5660
+ } else if (i < 8) {
5661
+ this.modules[i + 1][8] = mod;
5662
+ } else {
5663
+ this.modules[this.moduleCount - 15 + i][8] = mod;
5664
+ }
5665
+ }
5666
+ for (let i = 0; i < 15; i++) {
5667
+ const mod = !test && (bits >> i & 1) === 1;
5668
+ if (i < 8) {
5669
+ this.modules[8][this.moduleCount - i - 1] = mod;
5670
+ } else if (i < 9) {
5671
+ this.modules[8][15 - i - 1 + 1] = mod;
5672
+ } else {
5673
+ this.modules[8][15 - i - 1] = mod;
5674
+ }
5675
+ }
5676
+ this.modules[this.moduleCount - 8][8] = !test;
5677
+ }
5678
+ mapData(data, maskPattern) {
5679
+ let inc = -1;
5680
+ let row = this.moduleCount - 1;
5681
+ let bitIndex = 7;
5682
+ let byteIndex = 0;
5683
+ const maskFunc = getMaskFunction(maskPattern);
5684
+ for (let col = this.moduleCount - 1; col > 0; col -= 2) {
5685
+ if (col === 6) col -= 1;
5686
+ while (true) {
5687
+ for (let c = 0; c < 2; c++) {
5688
+ if (this.modules[row][col - c] === null) {
5689
+ let dark = false;
5690
+ if (byteIndex < data.length) {
5691
+ dark = (data[byteIndex] >>> bitIndex & 1) === 1;
5692
+ }
5693
+ const mask = maskFunc(row, col - c);
5694
+ if (mask) dark = !dark;
5695
+ this.modules[row][col - c] = dark;
5696
+ bitIndex--;
5697
+ if (bitIndex === -1) {
5698
+ byteIndex++;
5699
+ bitIndex = 7;
5700
+ }
5441
5701
  }
5442
5702
  }
5703
+ row += inc;
5704
+ if (row < 0 || this.moduleCount <= row) {
5705
+ row -= inc;
5706
+ inc = -inc;
5707
+ break;
5708
+ }
5443
5709
  }
5444
5710
  }
5445
5711
  }
5446
- reserved[size - 8][8] = true;
5447
- const dataBytes = createData(text, version, ecl);
5448
- let bitIndex = 0;
5449
- let direction = -1;
5450
- for (let col = size - 1; col >= 0; col -= 2) {
5451
- if (col === 6) col = 5;
5452
- for (let row = direction === -1 ? size - 1 : 0; direction === -1 ? row >= 0 : row < size; row += direction) {
5453
- for (let c = 0; c < 2; c++) {
5454
- const tc = col - c;
5455
- if (!reserved[row][tc] && mod[row][tc] === -1) {
5456
- let dark = false;
5457
- if (bitIndex < dataBytes.length * 8) {
5458
- const byteIndex = Math.floor(bitIndex / 8);
5459
- const bitPos = 7 - bitIndex % 8;
5460
- dark = (dataBytes[byteIndex] >>> bitPos & 1) === 1;
5712
+ getLostPoint() {
5713
+ let lostPoint = 0;
5714
+ for (let row = 0; row < this.moduleCount; row++) {
5715
+ for (let col = 0; col < this.moduleCount; col++) {
5716
+ let sameCount = 0;
5717
+ const dark = this.modules[row][col];
5718
+ for (let r = -1; r <= 1; r++) {
5719
+ if (row + r < 0 || this.moduleCount <= row + r) continue;
5720
+ for (let c = -1; c <= 1; c++) {
5721
+ if (col + c < 0 || this.moduleCount <= col + c) continue;
5722
+ if (r === 0 && c === 0) continue;
5723
+ if (dark === this.modules[row + r][col + c]) sameCount++;
5461
5724
  }
5462
- setModule(row, tc, dark ? 1 : 0);
5463
- bitIndex++;
5464
5725
  }
5726
+ if (sameCount > 5) lostPoint += 3 + sameCount - 5;
5465
5727
  }
5466
5728
  }
5467
- direction = -direction;
5468
- }
5469
- const maskPattern = 0;
5470
- for (let row = 0; row < size; row++) {
5471
- for (let col = 0; col < size; col++) {
5472
- if (!reserved[row][col] && mod[row][col] !== -1) {
5473
- if ((row + col) % 2 === 0) {
5474
- mod[row][col] = mod[row][col] === 1 ? 0 : 1;
5729
+ for (let row = 0; row < this.moduleCount - 1; row++) {
5730
+ for (let col = 0; col < this.moduleCount - 1; col++) {
5731
+ let count = 0;
5732
+ if (this.modules[row][col]) count++;
5733
+ if (this.modules[row + 1][col]) count++;
5734
+ if (this.modules[row][col + 1]) count++;
5735
+ if (this.modules[row + 1][col + 1]) count++;
5736
+ if (count === 0 || count === 4) lostPoint += 3;
5737
+ }
5738
+ }
5739
+ for (let row = 0; row < this.moduleCount; row++) {
5740
+ for (let col = 0; col < this.moduleCount - 6; col++) {
5741
+ if (this.modules[row][col] && !this.modules[row][col + 1] && this.modules[row][col + 2] && this.modules[row][col + 3] && this.modules[row][col + 4] && !this.modules[row][col + 5] && this.modules[row][col + 6]) {
5742
+ lostPoint += 40;
5475
5743
  }
5476
5744
  }
5477
5745
  }
5746
+ for (let col = 0; col < this.moduleCount; col++) {
5747
+ for (let row = 0; row < this.moduleCount - 6; row++) {
5748
+ if (this.modules[row][col] && !this.modules[row + 1][col] && this.modules[row + 2][col] && this.modules[row + 3][col] && this.modules[row + 4][col] && !this.modules[row + 5][col] && this.modules[row + 6][col]) {
5749
+ lostPoint += 40;
5750
+ }
5751
+ }
5752
+ }
5753
+ let darkCount = 0;
5754
+ for (let col = 0; col < this.moduleCount; col++) {
5755
+ for (let row = 0; row < this.moduleCount; row++) {
5756
+ if (this.modules[row][col]) darkCount++;
5757
+ }
5758
+ }
5759
+ const ratio = Math.abs(100 * darkCount / this.moduleCount / this.moduleCount - 50) / 5;
5760
+ lostPoint += ratio * 10;
5761
+ return lostPoint;
5478
5762
  }
5479
- const formatData = ecl << 3 | maskPattern;
5480
- let rem = formatData;
5481
- for (let i = 0; i < 10; i++) {
5482
- rem = rem << 1 ^ (rem >>> 9) * 1335;
5483
- }
5484
- const format = (formatData << 10 | rem & 1023) ^ 21522;
5485
- const formatBits = [];
5486
- for (let i = 14; i >= 0; i--) {
5487
- formatBits.push(format >>> i & 1);
5488
- }
5489
- for (let i = 0; i < 6; i++) {
5490
- mod[8][i] = formatBits[i];
5491
- }
5492
- mod[8][7] = formatBits[6];
5493
- mod[8][8] = formatBits[7];
5494
- mod[7][8] = formatBits[8];
5495
- for (let i = 9; i < 15; i++) {
5496
- mod[14 - i][8] = formatBits[i];
5497
- }
5498
- for (let i = 0; i < 8; i++) {
5499
- mod[8][size - 1 - i] = formatBits[14 - i];
5500
- }
5501
- for (let i = 7; i < 15; i++) {
5502
- mod[size - 1 - (14 - i)][8] = formatBits[14 - i];
5763
+ getModuleCount() {
5764
+ return this.moduleCount;
5503
5765
  }
5504
- const result = [];
5505
- for (let r = 0; r < size; r++) {
5506
- result[r] = [];
5507
- for (let c = 0; c < size; c++) {
5508
- result[r][c] = mod[r][c] === 1;
5766
+ isDark(row, col) {
5767
+ if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) {
5768
+ throw new Error(row + "," + col);
5509
5769
  }
5770
+ return this.modules[row][col] === true;
5510
5771
  }
5511
- return { modules: result, moduleCount: size };
5512
5772
  }
5513
5773
  const generate = () => {
5514
5774
  if (!props.value) {
@@ -5517,9 +5777,19 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
5517
5777
  return;
5518
5778
  }
5519
5779
  try {
5520
- const qr = createQRCode(props.value, props.errorCorrectLevel);
5521
- modules.value = qr.modules;
5522
- moduleCount.value = qr.moduleCount;
5780
+ const qr = new QRCode(0, props.errorCorrectLevel);
5781
+ qr.addData(props.value);
5782
+ qr.make();
5783
+ const count = qr.getModuleCount();
5784
+ moduleCount.value = count;
5785
+ const result = [];
5786
+ for (let row = 0; row < count; row++) {
5787
+ result[row] = [];
5788
+ for (let col = 0; col < count; col++) {
5789
+ result[row][col] = qr.isDark(row, col);
5790
+ }
5791
+ }
5792
+ modules.value = result;
5523
5793
  } catch (e) {
5524
5794
  console.error("QR Code generation failed:", e);
5525
5795
  modules.value = [];
@@ -5561,7 +5831,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
5561
5831
  };
5562
5832
  }
5563
5833
  });
5564
- const uQrcode = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-97271d75"]]);
5834
+ const uQrcode = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-e3d52c6f"]]);
5565
5835
  const _hoisted_1 = { class: "u-barcode" };
5566
5836
  const _hoisted_2 = ["canvas-id"];
5567
5837
  const _hoisted_3 = ["src"];