@depup/sanity 5.17.1-depup.0

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.
Files changed (116) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +57 -0
  3. package/bin/sanity +209 -0
  4. package/changes.json +114 -0
  5. package/lib/_chunks-dts/ActiveWorkspaceMatcherContext.d.ts +16164 -0
  6. package/lib/_chunks-dts/index.d.ts +780 -0
  7. package/lib/_chunks-dts/types.d.ts +2765 -0
  8. package/lib/_chunks-dts/types2.d.ts +656 -0
  9. package/lib/_chunks-dts/types3.d.ts +303 -0
  10. package/lib/_chunks-es/BroadcastDisplayedDocument.js +20 -0
  11. package/lib/_chunks-es/BroadcastDisplayedDocument.js.map +1 -0
  12. package/lib/_chunks-es/DisplayedDocumentBroadcaster.js +32 -0
  13. package/lib/_chunks-es/DisplayedDocumentBroadcaster.js.map +1 -0
  14. package/lib/_chunks-es/LiveQueries.js +339 -0
  15. package/lib/_chunks-es/LiveQueries.js.map +1 -0
  16. package/lib/_chunks-es/MenuGroup.js +106 -0
  17. package/lib/_chunks-es/MenuGroup.js.map +1 -0
  18. package/lib/_chunks-es/PostMessageDocuments.js +72 -0
  19. package/lib/_chunks-es/PostMessageDocuments.js.map +1 -0
  20. package/lib/_chunks-es/PostMessagePerspective.js +23 -0
  21. package/lib/_chunks-es/PostMessagePerspective.js.map +1 -0
  22. package/lib/_chunks-es/PostMessagePreviewSnapshots.js +69 -0
  23. package/lib/_chunks-es/PostMessagePreviewSnapshots.js.map +1 -0
  24. package/lib/_chunks-es/PostMessageRefreshMutations.js +74 -0
  25. package/lib/_chunks-es/PostMessageRefreshMutations.js.map +1 -0
  26. package/lib/_chunks-es/PostMessageSchema.js +502 -0
  27. package/lib/_chunks-es/PostMessageSchema.js.map +1 -0
  28. package/lib/_chunks-es/PostMessageTelemetry.js +21 -0
  29. package/lib/_chunks-es/PostMessageTelemetry.js.map +1 -0
  30. package/lib/_chunks-es/PresentationToolGrantsCheck.js +3848 -0
  31. package/lib/_chunks-es/PresentationToolGrantsCheck.js.map +1 -0
  32. package/lib/_chunks-es/QRCodeSVG.js +692 -0
  33. package/lib/_chunks-es/QRCodeSVG.js.map +1 -0
  34. package/lib/_chunks-es/StructureToolProvider.js +2360 -0
  35. package/lib/_chunks-es/StructureToolProvider.js.map +1 -0
  36. package/lib/_chunks-es/VideoPlayer.js +22 -0
  37. package/lib/_chunks-es/VideoPlayer.js.map +1 -0
  38. package/lib/_chunks-es/ViteDevServerStopped.js +52 -0
  39. package/lib/_chunks-es/ViteDevServerStopped.js.map +1 -0
  40. package/lib/_chunks-es/index.js +285 -0
  41. package/lib/_chunks-es/index.js.map +1 -0
  42. package/lib/_chunks-es/index2.js +105 -0
  43. package/lib/_chunks-es/index2.js.map +1 -0
  44. package/lib/_chunks-es/index3.js +139 -0
  45. package/lib/_chunks-es/index3.js.map +1 -0
  46. package/lib/_chunks-es/index4.js +1020 -0
  47. package/lib/_chunks-es/index4.js.map +1 -0
  48. package/lib/_chunks-es/pane.js +5 -0
  49. package/lib/_chunks-es/pane.js.map +1 -0
  50. package/lib/_chunks-es/pane2.js +5 -0
  51. package/lib/_chunks-es/pane2.js.map +1 -0
  52. package/lib/_chunks-es/presentation.js +549 -0
  53. package/lib/_chunks-es/presentation.js.map +1 -0
  54. package/lib/_chunks-es/resources.js +303 -0
  55. package/lib/_chunks-es/resources.js.map +1 -0
  56. package/lib/_chunks-es/resources2.js +459 -0
  57. package/lib/_chunks-es/resources2.js.map +1 -0
  58. package/lib/_chunks-es/resources3.js +281 -0
  59. package/lib/_chunks-es/resources3.js.map +1 -0
  60. package/lib/_chunks-es/resources4.js +184 -0
  61. package/lib/_chunks-es/resources4.js.map +1 -0
  62. package/lib/_chunks-es/resources5.js +161 -0
  63. package/lib/_chunks-es/resources5.js.map +1 -0
  64. package/lib/_chunks-es/resources6.js +141 -0
  65. package/lib/_chunks-es/resources6.js.map +1 -0
  66. package/lib/_chunks-es/resources7.js +24 -0
  67. package/lib/_chunks-es/resources7.js.map +1 -0
  68. package/lib/_chunks-es/resources8.js +603 -0
  69. package/lib/_chunks-es/resources8.js.map +1 -0
  70. package/lib/_chunks-es/resources9.js +126 -0
  71. package/lib/_chunks-es/resources9.js.map +1 -0
  72. package/lib/_chunks-es/structureTool.js +13673 -0
  73. package/lib/_chunks-es/structureTool.js.map +1 -0
  74. package/lib/_chunks-es/version.js +17 -0
  75. package/lib/_chunks-es/version.js.map +1 -0
  76. package/lib/_createContext.d.ts +12 -0
  77. package/lib/_createContext.js +38 -0
  78. package/lib/_createContext.js.map +1 -0
  79. package/lib/_internal.d.ts +9 -0
  80. package/lib/_internal.js +12 -0
  81. package/lib/_internal.js.map +1 -0
  82. package/lib/_singletons.d.ts +951 -0
  83. package/lib/_singletons.js +284 -0
  84. package/lib/_singletons.js.map +1 -0
  85. package/lib/cli.d.ts +3 -0
  86. package/lib/cli.js +9 -0
  87. package/lib/cli.js.map +1 -0
  88. package/lib/desk.d.ts +910 -0
  89. package/lib/desk.js +71 -0
  90. package/lib/desk.js.map +1 -0
  91. package/lib/index.d.ts +4 -0
  92. package/lib/index.js +92934 -0
  93. package/lib/index.js.map +1 -0
  94. package/lib/media-library.d.ts +85 -0
  95. package/lib/media-library.js +11 -0
  96. package/lib/media-library.js.map +1 -0
  97. package/lib/migrate.d.ts +1 -0
  98. package/lib/migrate.js +2 -0
  99. package/lib/migrate.js.map +1 -0
  100. package/lib/presentation.d.ts +28 -0
  101. package/lib/presentation.js +10 -0
  102. package/lib/presentation.js.map +1 -0
  103. package/lib/router.d.ts +560 -0
  104. package/lib/router.js +777 -0
  105. package/lib/router.js.map +1 -0
  106. package/lib/structure.d.ts +3 -0
  107. package/lib/structure.js +639 -0
  108. package/lib/structure.js.map +1 -0
  109. package/mock-browser-env-stub-loader.mjs +27 -0
  110. package/package.json +383 -0
  111. package/static/favicons/apple-touch-icon.png +0 -0
  112. package/static/favicons/favicon-192.png +0 -0
  113. package/static/favicons/favicon-512.png +0 -0
  114. package/static/favicons/favicon-96.png +0 -0
  115. package/static/favicons/favicon.ico +0 -0
  116. package/static/favicons/favicon.svg +12 -0
@@ -0,0 +1,692 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { c } from "react/compiler-runtime";
3
+ import { motion } from "motion/react";
4
+ import { memo } from "react";
5
+ /**
6
+ * \@license QR Code generator library (TypeScript)
7
+ * Copyright (c) Project Nayuki.
8
+ * SPDX-License-Identifier: MIT
9
+ */
10
+ class QrCode {
11
+ /*-- Static factory functions (high level) --*/
12
+ // Returns a QR Code representing the given Unicode text string at the given error correction level.
13
+ // As a conservative upper bound, this function is guaranteed to succeed for strings that have 738 or fewer
14
+ // Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible
15
+ // QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the
16
+ // ecl argument if it can be done without increasing the version.
17
+ static encodeText(text, ecl) {
18
+ const segs = QrSegment.makeSegments(text);
19
+ return QrCode.encodeSegments(segs, ecl);
20
+ }
21
+ // Returns a QR Code representing the given binary data at the given error correction level.
22
+ // This function always encodes using the binary segment mode, not any text mode. The maximum number of
23
+ // bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
24
+ // The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
25
+ static encodeBinary(data, ecl) {
26
+ const seg = QrSegment.makeBytes(data);
27
+ return QrCode.encodeSegments([seg], ecl);
28
+ }
29
+ /*-- Static factory functions (mid level) --*/
30
+ // Returns a QR Code representing the given segments with the given encoding parameters.
31
+ // The smallest possible QR Code version within the given range is automatically
32
+ // chosen for the output. Iff boostEcl is true, then the ECC level of the result
33
+ // may be higher than the ecl argument if it can be done without increasing the
34
+ // version. The mask number is either between 0 to 7 (inclusive) to force that
35
+ // mask, or -1 to automatically choose an appropriate mask (which may be slow).
36
+ // This function allows the user to create a custom sequence of segments that switches
37
+ // between modes (such as alphanumeric and byte) to encode text in less space.
38
+ // This is a mid-level API; the high-level API is encodeText() and encodeBinary().
39
+ static encodeSegments(segs, ecl, minVersion = 1, maxVersion = 40, mask = -1, boostEcl = !0) {
40
+ if (!(QrCode.MIN_VERSION <= minVersion && minVersion <= maxVersion && maxVersion <= QrCode.MAX_VERSION) || mask < -1 || mask > 7) throw new RangeError("Invalid value");
41
+ let version, dataUsedBits;
42
+ for (version = minVersion; ; version++) {
43
+ const dataCapacityBits2 = QrCode.getNumDataCodewords(version, ecl) * 8, usedBits = QrSegment.getTotalBits(segs, version);
44
+ if (usedBits <= dataCapacityBits2) {
45
+ dataUsedBits = usedBits;
46
+ break;
47
+ }
48
+ if (version >= maxVersion)
49
+ throw new RangeError("Data too long");
50
+ }
51
+ for (const newEcl of [Ecc.MEDIUM, Ecc.QUARTILE, Ecc.HIGH])
52
+ boostEcl && dataUsedBits <= QrCode.getNumDataCodewords(version, newEcl) * 8 && (ecl = newEcl);
53
+ const bb = [];
54
+ for (const seg of segs) {
55
+ appendBits(seg.mode.modeBits, 4, bb), appendBits(seg.numChars, seg.mode.numCharCountBits(version), bb);
56
+ for (const b of seg.getData()) bb.push(b);
57
+ }
58
+ assert(bb.length == dataUsedBits);
59
+ const dataCapacityBits = QrCode.getNumDataCodewords(version, ecl) * 8;
60
+ assert(bb.length <= dataCapacityBits), appendBits(0, Math.min(4, dataCapacityBits - bb.length), bb), appendBits(0, (8 - bb.length % 8) % 8, bb), assert(bb.length % 8 == 0);
61
+ for (let padByte = 236; bb.length < dataCapacityBits; padByte ^= 253) appendBits(padByte, 8, bb);
62
+ const dataCodewords = [];
63
+ for (; dataCodewords.length * 8 < bb.length; ) dataCodewords.push(0);
64
+ return bb.forEach((b, i) => dataCodewords[i >>> 3] |= b << 7 - (i & 7)), new QrCode(version, ecl, dataCodewords, mask);
65
+ }
66
+ /*-- Fields --*/
67
+ // The width and height of this QR Code, measured in modules, between
68
+ // 21 and 177 (inclusive). This is equal to version * 4 + 17.
69
+ // The index of the mask pattern used in this QR Code, which is between 0 and 7 (inclusive).
70
+ // Even if a QR Code is created with automatic masking requested (mask = -1),
71
+ // the resulting object still has a mask value between 0 and 7.
72
+ // The modules of this QR Code (false = light, true = dark).
73
+ // Immutable after constructor finishes. Accessed through getModule().
74
+ modules = [];
75
+ // Indicates function modules that are not subjected to masking. Discarded when constructor finishes.
76
+ isFunction = [];
77
+ // The version number of this QR Code, which is between 1 and 40 (inclusive).
78
+ // This determines the size of this barcode.
79
+ // The error correction level used in this QR Code.
80
+ /*-- Constructor (low level) and fields --*/
81
+ // Creates a new QR Code with the given version number,
82
+ // error correction level, data codeword bytes, and mask number.
83
+ // This is a low-level API that most users should not use directly.
84
+ // A mid-level API is the encodeSegments() function.
85
+ constructor(version, errorCorrectionLevel, dataCodewords, msk) {
86
+ if (this.version = version, this.errorCorrectionLevel = errorCorrectionLevel, version < QrCode.MIN_VERSION || version > QrCode.MAX_VERSION) throw new RangeError("Version value out of range");
87
+ if (msk < -1 || msk > 7) throw new RangeError("Mask value out of range");
88
+ this.size = version * 4 + 17;
89
+ const row = [];
90
+ for (let i = 0; i < this.size; i++) row.push(!1);
91
+ for (let i = 0; i < this.size; i++)
92
+ this.modules.push(row.slice()), this.isFunction.push(row.slice());
93
+ this.drawFunctionPatterns();
94
+ const allCodewords = this.addEccAndInterleave(dataCodewords);
95
+ if (this.drawCodewords(allCodewords), msk == -1) {
96
+ let minPenalty = 1e9;
97
+ for (let i = 0; i < 8; i++) {
98
+ this.applyMask(i), this.drawFormatBits(i);
99
+ const penalty = this.getPenaltyScore();
100
+ penalty < minPenalty && (msk = i, minPenalty = penalty), this.applyMask(i);
101
+ }
102
+ }
103
+ assert(0 <= msk && msk <= 7), this.mask = msk, this.applyMask(msk), this.drawFormatBits(msk), this.isFunction = [];
104
+ }
105
+ /*-- Accessor methods --*/
106
+ // Returns the color of the module (pixel) at the given coordinates, which is false
107
+ // for light or true for dark. The top left corner has the coordinates (x=0, y=0).
108
+ // If the given coordinates are out of bounds, then false (light) is returned.
109
+ getModule(x, y) {
110
+ return 0 <= x && x < this.size && 0 <= y && y < this.size && this.modules[y][x];
111
+ }
112
+ // Modified to expose modules for easy access
113
+ getModules() {
114
+ return this.modules;
115
+ }
116
+ /*-- Private helper methods for constructor: Drawing function modules --*/
117
+ // Reads this object's version field, and draws and marks all function modules.
118
+ drawFunctionPatterns() {
119
+ for (let i = 0; i < this.size; i++)
120
+ this.setFunctionModule(6, i, i % 2 == 0), this.setFunctionModule(i, 6, i % 2 == 0);
121
+ this.drawFinderPattern(3, 3), this.drawFinderPattern(this.size - 4, 3), this.drawFinderPattern(3, this.size - 4);
122
+ const alignPatPos = this.getAlignmentPatternPositions(), numAlign = alignPatPos.length;
123
+ for (let i = 0; i < numAlign; i++)
124
+ for (let j = 0; j < numAlign; j++)
125
+ i == 0 && j == 0 || i == 0 && j == numAlign - 1 || i == numAlign - 1 && j == 0 || this.drawAlignmentPattern(alignPatPos[i], alignPatPos[j]);
126
+ this.drawFormatBits(0), this.drawVersion();
127
+ }
128
+ // Draws two copies of the format bits (with its own error correction code)
129
+ // based on the given mask and this object's error correction level field.
130
+ drawFormatBits(mask) {
131
+ const data = this.errorCorrectionLevel.formatBits << 3 | mask;
132
+ let rem = data;
133
+ for (let i = 0; i < 10; i++) rem = rem << 1 ^ (rem >>> 9) * 1335;
134
+ const bits = (data << 10 | rem) ^ 21522;
135
+ assert(bits >>> 15 == 0);
136
+ for (let i = 0; i <= 5; i++) this.setFunctionModule(8, i, getBit(bits, i));
137
+ this.setFunctionModule(8, 7, getBit(bits, 6)), this.setFunctionModule(8, 8, getBit(bits, 7)), this.setFunctionModule(7, 8, getBit(bits, 8));
138
+ for (let i = 9; i < 15; i++) this.setFunctionModule(14 - i, 8, getBit(bits, i));
139
+ for (let i = 0; i < 8; i++) this.setFunctionModule(this.size - 1 - i, 8, getBit(bits, i));
140
+ for (let i = 8; i < 15; i++) this.setFunctionModule(8, this.size - 15 + i, getBit(bits, i));
141
+ this.setFunctionModule(8, this.size - 8, !0);
142
+ }
143
+ // Draws two copies of the version bits (with its own error correction code),
144
+ // based on this object's version field, iff 7 <= version <= 40.
145
+ drawVersion() {
146
+ if (this.version < 7) return;
147
+ let rem = this.version;
148
+ for (let i = 0; i < 12; i++) rem = rem << 1 ^ (rem >>> 11) * 7973;
149
+ const bits = this.version << 12 | rem;
150
+ assert(bits >>> 18 == 0);
151
+ for (let i = 0; i < 18; i++) {
152
+ const color = getBit(bits, i), a = this.size - 11 + i % 3, b = Math.floor(i / 3);
153
+ this.setFunctionModule(a, b, color), this.setFunctionModule(b, a, color);
154
+ }
155
+ }
156
+ // Draws a 9*9 finder pattern including the border separator,
157
+ // with the center module at (x, y). Modules can be out of bounds.
158
+ drawFinderPattern(x, y) {
159
+ for (let dy = -4; dy <= 4; dy++)
160
+ for (let dx = -4; dx <= 4; dx++) {
161
+ const dist = Math.max(Math.abs(dx), Math.abs(dy)), xx = x + dx, yy = y + dy;
162
+ 0 <= xx && xx < this.size && 0 <= yy && yy < this.size && this.setFunctionModule(xx, yy, dist != 2 && dist != 4);
163
+ }
164
+ }
165
+ // Draws a 5*5 alignment pattern, with the center module
166
+ // at (x, y). All modules must be in bounds.
167
+ drawAlignmentPattern(x, y) {
168
+ for (let dy = -2; dy <= 2; dy++)
169
+ for (let dx = -2; dx <= 2; dx++) this.setFunctionModule(x + dx, y + dy, Math.max(Math.abs(dx), Math.abs(dy)) != 1);
170
+ }
171
+ // Sets the color of a module and marks it as a function module.
172
+ // Only used by the constructor. Coordinates must be in bounds.
173
+ setFunctionModule(x, y, isDark) {
174
+ this.modules[y][x] = isDark, this.isFunction[y][x] = !0;
175
+ }
176
+ /*-- Private helper methods for constructor: Codewords and masking --*/
177
+ // Returns a new byte string representing the given data with the appropriate error correction
178
+ // codewords appended to it, based on this object's version and error correction level.
179
+ addEccAndInterleave(data) {
180
+ const ver = this.version, ecl = this.errorCorrectionLevel;
181
+ if (data.length != QrCode.getNumDataCodewords(ver, ecl)) throw new RangeError("Invalid argument");
182
+ const numBlocks = QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver], blockEccLen = QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver], rawCodewords = Math.floor(QrCode.getNumRawDataModules(ver) / 8), numShortBlocks = numBlocks - rawCodewords % numBlocks, shortBlockLen = Math.floor(rawCodewords / numBlocks), blocks = [], rsDiv = QrCode.reedSolomonComputeDivisor(blockEccLen);
183
+ for (let i = 0, k = 0; i < numBlocks; i++) {
184
+ const dat = data.slice(k, k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1));
185
+ k += dat.length;
186
+ const ecc = QrCode.reedSolomonComputeRemainder(dat, rsDiv);
187
+ i < numShortBlocks && dat.push(0), blocks.push(dat.concat(ecc));
188
+ }
189
+ const result = [];
190
+ for (let i = 0; i < blocks[0].length; i++)
191
+ blocks.forEach((block, j) => {
192
+ (i != shortBlockLen - blockEccLen || j >= numShortBlocks) && result.push(block[i]);
193
+ });
194
+ return assert(result.length == rawCodewords), result;
195
+ }
196
+ // Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
197
+ // data area of this QR Code. Function modules need to be marked off before this is called.
198
+ drawCodewords(data) {
199
+ if (data.length != Math.floor(QrCode.getNumRawDataModules(this.version) / 8)) throw new RangeError("Invalid argument");
200
+ let i = 0;
201
+ for (let right = this.size - 1; right >= 1; right -= 2) {
202
+ right == 6 && (right = 5);
203
+ for (let vert = 0; vert < this.size; vert++)
204
+ for (let j = 0; j < 2; j++) {
205
+ const x = right - j, y = (right + 1 & 2) == 0 ? this.size - 1 - vert : vert;
206
+ !this.isFunction[y][x] && i < data.length * 8 && (this.modules[y][x] = getBit(data[i >>> 3], 7 - (i & 7)), i++);
207
+ }
208
+ }
209
+ assert(i == data.length * 8);
210
+ }
211
+ // XORs the codeword modules in this QR Code with the given mask pattern.
212
+ // The function modules must be marked and the codeword bits must be drawn
213
+ // before masking. Due to the arithmetic of XOR, calling applyMask() with
214
+ // the same mask value a second time will undo the mask. A final well-formed
215
+ // QR Code needs exactly one (not zero, two, etc.) mask applied.
216
+ applyMask(mask) {
217
+ if (mask < 0 || mask > 7) throw new RangeError("Mask value out of range");
218
+ for (let y = 0; y < this.size; y++)
219
+ for (let x = 0; x < this.size; x++) {
220
+ let invert;
221
+ switch (mask) {
222
+ case 0:
223
+ invert = (x + y) % 2 == 0;
224
+ break;
225
+ case 1:
226
+ invert = y % 2 == 0;
227
+ break;
228
+ case 2:
229
+ invert = x % 3 == 0;
230
+ break;
231
+ case 3:
232
+ invert = (x + y) % 3 == 0;
233
+ break;
234
+ case 4:
235
+ invert = (Math.floor(x / 3) + Math.floor(y / 2)) % 2 == 0;
236
+ break;
237
+ case 5:
238
+ invert = x * y % 2 + x * y % 3 == 0;
239
+ break;
240
+ case 6:
241
+ invert = (x * y % 2 + x * y % 3) % 2 == 0;
242
+ break;
243
+ case 7:
244
+ invert = ((x + y) % 2 + x * y % 3) % 2 == 0;
245
+ break;
246
+ default:
247
+ throw new Error("Unreachable");
248
+ }
249
+ !this.isFunction[y][x] && invert && (this.modules[y][x] = !this.modules[y][x]);
250
+ }
251
+ }
252
+ // Calculates and returns the penalty score based on state of this QR Code's current modules.
253
+ // This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.
254
+ getPenaltyScore() {
255
+ let result = 0;
256
+ for (let y = 0; y < this.size; y++) {
257
+ let runColor = !1, runX = 0;
258
+ const runHistory = [0, 0, 0, 0, 0, 0, 0];
259
+ for (let x = 0; x < this.size; x++)
260
+ this.modules[y][x] == runColor ? (runX++, runX == 5 ? result += QrCode.PENALTY_N1 : runX > 5 && result++) : (this.finderPenaltyAddHistory(runX, runHistory), runColor || (result += this.finderPenaltyCountPatterns(runHistory) * QrCode.PENALTY_N3), runColor = this.modules[y][x], runX = 1);
261
+ result += this.finderPenaltyTerminateAndCount(runColor, runX, runHistory) * QrCode.PENALTY_N3;
262
+ }
263
+ for (let x = 0; x < this.size; x++) {
264
+ let runColor = !1, runY = 0;
265
+ const runHistory = [0, 0, 0, 0, 0, 0, 0];
266
+ for (let y = 0; y < this.size; y++)
267
+ this.modules[y][x] == runColor ? (runY++, runY == 5 ? result += QrCode.PENALTY_N1 : runY > 5 && result++) : (this.finderPenaltyAddHistory(runY, runHistory), runColor || (result += this.finderPenaltyCountPatterns(runHistory) * QrCode.PENALTY_N3), runColor = this.modules[y][x], runY = 1);
268
+ result += this.finderPenaltyTerminateAndCount(runColor, runY, runHistory) * QrCode.PENALTY_N3;
269
+ }
270
+ for (let y = 0; y < this.size - 1; y++)
271
+ for (let x = 0; x < this.size - 1; x++) {
272
+ const color = this.modules[y][x];
273
+ color == this.modules[y][x + 1] && color == this.modules[y + 1][x] && color == this.modules[y + 1][x + 1] && (result += QrCode.PENALTY_N2);
274
+ }
275
+ let dark = 0;
276
+ for (const row of this.modules) dark = row.reduce((sum, color) => sum + (color ? 1 : 0), dark);
277
+ const total = this.size * this.size, k = Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1;
278
+ return assert(0 <= k && k <= 9), result += k * QrCode.PENALTY_N4, assert(0 <= result && result <= 2568888), result;
279
+ }
280
+ /*-- Private helper functions --*/
281
+ // Returns an ascending list of positions of alignment patterns for this version number.
282
+ // Each position is in the range [0,177), and are used on both the x and y axes.
283
+ // This could be implemented as lookup table of 40 variable-length lists of integers.
284
+ getAlignmentPatternPositions() {
285
+ if (this.version == 1) return [];
286
+ const numAlign = Math.floor(this.version / 7) + 2, step = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (numAlign * 2 - 2)) * 2, result = [6];
287
+ for (let pos = this.size - 7; result.length < numAlign; pos -= step) result.splice(1, 0, pos);
288
+ return result;
289
+ }
290
+ // Returns the number of data bits that can be stored in a QR Code of the given version number, after
291
+ // all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
292
+ // The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
293
+ static getNumRawDataModules(ver) {
294
+ if (ver < QrCode.MIN_VERSION || ver > QrCode.MAX_VERSION) throw new RangeError("Version number out of range");
295
+ let result = (16 * ver + 128) * ver + 64;
296
+ if (ver >= 2) {
297
+ const numAlign = Math.floor(ver / 7) + 2;
298
+ result -= (25 * numAlign - 10) * numAlign - 55, ver >= 7 && (result -= 36);
299
+ }
300
+ return assert(208 <= result && result <= 29648), result;
301
+ }
302
+ // Returns the number of 8-bit data (i.e. not error correction) codewords contained in any
303
+ // QR Code of the given version number and error correction level, with remainder bits discarded.
304
+ // This stateless pure function could be implemented as a (40*4)-cell lookup table.
305
+ static getNumDataCodewords(ver, ecl) {
306
+ return Math.floor(QrCode.getNumRawDataModules(ver) / 8) - QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver] * QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];
307
+ }
308
+ // Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
309
+ // implemented as a lookup table over all possible parameter values, instead of as an algorithm.
310
+ static reedSolomonComputeDivisor(degree) {
311
+ if (degree < 1 || degree > 255) throw new RangeError("Degree out of range");
312
+ const result = [];
313
+ for (let i = 0; i < degree - 1; i++) result.push(0);
314
+ result.push(1);
315
+ let root = 1;
316
+ for (let i = 0; i < degree; i++) {
317
+ for (let j = 0; j < result.length; j++)
318
+ result[j] = QrCode.reedSolomonMultiply(result[j], root), j + 1 < result.length && (result[j] ^= result[j + 1]);
319
+ root = QrCode.reedSolomonMultiply(root, 2);
320
+ }
321
+ return result;
322
+ }
323
+ // Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.
324
+ static reedSolomonComputeRemainder(data, divisor) {
325
+ const result = divisor.map((_) => 0);
326
+ for (const b of data) {
327
+ const factor = b ^ result.shift();
328
+ result.push(0), divisor.forEach((coef, i) => result[i] ^= QrCode.reedSolomonMultiply(coef, factor));
329
+ }
330
+ return result;
331
+ }
332
+ // Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result
333
+ // are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.
334
+ static reedSolomonMultiply(x, y) {
335
+ if (x >>> 8 || y >>> 8) throw new RangeError("Byte out of range");
336
+ let z = 0;
337
+ for (let i = 7; i >= 0; i--)
338
+ z = z << 1 ^ (z >>> 7) * 285, z ^= (y >>> i & 1) * x;
339
+ return assert(z >>> 8 == 0), z;
340
+ }
341
+ // Can only be called immediately after a light run is added, and
342
+ // returns either 0, 1, or 2. A helper function for getPenaltyScore().
343
+ finderPenaltyCountPatterns(runHistory) {
344
+ const n = runHistory[1];
345
+ assert(n <= this.size * 3);
346
+ const core = n > 0 && runHistory[2] == n && runHistory[3] == n * 3 && runHistory[4] == n && runHistory[5] == n;
347
+ return (core && runHistory[0] >= n * 4 && runHistory[6] >= n ? 1 : 0) + (core && runHistory[6] >= n * 4 && runHistory[0] >= n ? 1 : 0);
348
+ }
349
+ // Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().
350
+ finderPenaltyTerminateAndCount(currentRunColor, currentRunLength, runHistory) {
351
+ return currentRunColor && (this.finderPenaltyAddHistory(currentRunLength, runHistory), currentRunLength = 0), currentRunLength += this.size, this.finderPenaltyAddHistory(currentRunLength, runHistory), this.finderPenaltyCountPatterns(runHistory);
352
+ }
353
+ // Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().
354
+ finderPenaltyAddHistory(currentRunLength, runHistory) {
355
+ runHistory[0] == 0 && (currentRunLength += this.size), runHistory.pop(), runHistory.unshift(currentRunLength);
356
+ }
357
+ /*-- Constants and tables --*/
358
+ // The minimum version number supported in the QR Code Model 2 standard.
359
+ static MIN_VERSION = 1;
360
+ // The maximum version number supported in the QR Code Model 2 standard.
361
+ static MAX_VERSION = 40;
362
+ // For use in getPenaltyScore(), when evaluating which mask is best.
363
+ static PENALTY_N1 = 3;
364
+ static PENALTY_N2 = 3;
365
+ static PENALTY_N3 = 40;
366
+ static PENALTY_N4 = 10;
367
+ static ECC_CODEWORDS_PER_BLOCK = [
368
+ // Version: (note that index 0 is for padding, and is set to an illegal value)
369
+ //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
370
+ [-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
371
+ // Low
372
+ [-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28],
373
+ // Medium
374
+ [-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
375
+ // Quartile
376
+ [-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]
377
+ // High
378
+ ];
379
+ static NUM_ERROR_CORRECTION_BLOCKS = [
380
+ // Version: (note that index 0 is for padding, and is set to an illegal value)
381
+ //0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
382
+ [-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],
383
+ // Low
384
+ [-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49],
385
+ // Medium
386
+ [-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68],
387
+ // Quartile
388
+ [-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]
389
+ // High
390
+ ];
391
+ }
392
+ function appendBits(val, len, bb) {
393
+ if (len < 0 || len > 31 || val >>> len) throw new RangeError("Value out of range");
394
+ for (let i = len - 1; i >= 0; i--) bb.push(val >>> i & 1);
395
+ }
396
+ function getBit(x, i) {
397
+ return (x >>> i & 1) != 0;
398
+ }
399
+ function assert(cond) {
400
+ if (!cond) throw new Error("Assertion error");
401
+ }
402
+ class QrSegment {
403
+ /*-- Static factory functions (mid level) --*/
404
+ // Returns a segment representing the given binary data encoded in
405
+ // byte mode. All input byte arrays are acceptable. Any text string
406
+ // can be converted to UTF-8 bytes and encoded as a byte mode segment.
407
+ static makeBytes(data) {
408
+ const bb = [];
409
+ for (const b of data) appendBits(b, 8, bb);
410
+ return new QrSegment(Mode.BYTE, data.length, bb);
411
+ }
412
+ // Returns a segment representing the given string of decimal digits encoded in numeric mode.
413
+ static makeNumeric(digits) {
414
+ if (!QrSegment.isNumeric(digits)) throw new RangeError("String contains non-numeric characters");
415
+ const bb = [];
416
+ for (let i = 0; i < digits.length; ) {
417
+ const n = Math.min(digits.length - i, 3);
418
+ appendBits(parseInt(digits.substring(i, i + n), 10), n * 3 + 1, bb), i += n;
419
+ }
420
+ return new QrSegment(Mode.NUMERIC, digits.length, bb);
421
+ }
422
+ // Returns a segment representing the given text string encoded in alphanumeric mode.
423
+ // The characters allowed are: 0 to 9, A to Z (uppercase only), space,
424
+ // dollar, percent, asterisk, plus, hyphen, period, slash, colon.
425
+ static makeAlphanumeric(text) {
426
+ if (!QrSegment.isAlphanumeric(text)) throw new RangeError("String contains unencodable characters in alphanumeric mode");
427
+ const bb = [];
428
+ let i;
429
+ for (i = 0; i + 2 <= text.length; i += 2) {
430
+ let temp = QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)) * 45;
431
+ temp += QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i + 1)), appendBits(temp, 11, bb);
432
+ }
433
+ return i < text.length && appendBits(QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)), 6, bb), new QrSegment(Mode.ALPHANUMERIC, text.length, bb);
434
+ }
435
+ // Returns a new mutable list of zero or more segments to represent the given Unicode text string.
436
+ // The result may use various segment modes and switch modes to optimize the length of the bit stream.
437
+ static makeSegments(text) {
438
+ return text == "" ? [] : QrSegment.isNumeric(text) ? [QrSegment.makeNumeric(text)] : QrSegment.isAlphanumeric(text) ? [QrSegment.makeAlphanumeric(text)] : [QrSegment.makeBytes(QrSegment.toUtf8ByteArray(text))];
439
+ }
440
+ // Returns a segment representing an Extended Channel Interpretation
441
+ // (ECI) designator with the given assignment value.
442
+ static makeEci(assignVal) {
443
+ const bb = [];
444
+ if (assignVal < 0) throw new RangeError("ECI assignment value out of range");
445
+ if (assignVal < 128) appendBits(assignVal, 8, bb);
446
+ else if (assignVal < 16384)
447
+ appendBits(2, 2, bb), appendBits(assignVal, 14, bb);
448
+ else if (assignVal < 1e6)
449
+ appendBits(6, 3, bb), appendBits(assignVal, 21, bb);
450
+ else throw new RangeError("ECI assignment value out of range");
451
+ return new QrSegment(Mode.ECI, 0, bb);
452
+ }
453
+ // Tests whether the given string can be encoded as a segment in numeric mode.
454
+ // A string is encodable iff each character is in the range 0 to 9.
455
+ static isNumeric(text) {
456
+ return QrSegment.NUMERIC_REGEX.test(text);
457
+ }
458
+ // Tests whether the given string can be encoded as a segment in alphanumeric mode.
459
+ // A string is encodable iff each character is in the following set: 0 to 9, A to Z
460
+ // (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
461
+ static isAlphanumeric(text) {
462
+ return QrSegment.ALPHANUMERIC_REGEX.test(text);
463
+ }
464
+ // The mode indicator of this segment.
465
+ // The length of this segment's unencoded data. Measured in characters for
466
+ // numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
467
+ // Always zero or positive. Not the same as the data's bit length.
468
+ // The data bits of this segment. Accessed through getData().
469
+ /*-- Constructor (low level) and fields --*/
470
+ // Creates a new QR Code segment with the given attributes and data.
471
+ // The character count (numChars) must agree with the mode and the bit buffer length,
472
+ // but the constraint isn't checked. The given bit buffer is cloned and stored.
473
+ constructor(mode, numChars, bitData) {
474
+ if (this.mode = mode, this.numChars = numChars, numChars < 0) throw new RangeError("Invalid argument");
475
+ this.bitData = bitData.slice();
476
+ }
477
+ /*-- Methods --*/
478
+ // Returns a new copy of the data bits of this segment.
479
+ getData() {
480
+ return this.bitData.slice();
481
+ }
482
+ // (Package-private) Calculates and returns the number of bits needed to encode the given segments at
483
+ // the given version. The result is infinity if a segment has too many characters to fit its length field.
484
+ static getTotalBits(segs, version) {
485
+ let result = 0;
486
+ for (const seg of segs) {
487
+ const ccbits = seg.mode.numCharCountBits(version);
488
+ if (seg.numChars >= 1 << ccbits) return 1 / 0;
489
+ result += 4 + ccbits + seg.bitData.length;
490
+ }
491
+ return result;
492
+ }
493
+ // Returns a new array of bytes representing the given string encoded in UTF-8.
494
+ static toUtf8ByteArray(str) {
495
+ str = encodeURI(str);
496
+ const result = [];
497
+ for (let i = 0; i < str.length; i++)
498
+ str.charAt(i) != "%" ? result.push(str.charCodeAt(i)) : (result.push(parseInt(str.substring(i + 1, i + 3), 16)), i += 2);
499
+ return result;
500
+ }
501
+ /*-- Constants --*/
502
+ // Describes precisely all strings that are encodable in numeric mode.
503
+ static NUMERIC_REGEX = /^[0-9]*$/;
504
+ // Describes precisely all strings that are encodable in alphanumeric mode.
505
+ static ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+./:-]*$/;
506
+ // The set of all legal characters in alphanumeric mode,
507
+ // where each character value maps to the index in the string.
508
+ static ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
509
+ }
510
+ class Ecc {
511
+ /*-- Constants --*/
512
+ static LOW = new Ecc(0, 1);
513
+ // The QR Code can tolerate about 7% erroneous codewords
514
+ static MEDIUM = new Ecc(1, 0);
515
+ // The QR Code can tolerate about 15% erroneous codewords
516
+ static QUARTILE = new Ecc(2, 3);
517
+ // The QR Code can tolerate about 25% erroneous codewords
518
+ static HIGH = new Ecc(3, 2);
519
+ // The QR Code can tolerate about 30% erroneous codewords
520
+ // In the range 0 to 3 (unsigned 2-bit integer).
521
+ // (Package-private) In the range 0 to 3 (unsigned 2-bit integer).
522
+ /*-- Constructor and fields --*/
523
+ constructor(ordinal, formatBits) {
524
+ this.ordinal = ordinal, this.formatBits = formatBits;
525
+ }
526
+ }
527
+ class Mode {
528
+ /*-- Constants --*/
529
+ static NUMERIC = new Mode(1, [10, 12, 14]);
530
+ static ALPHANUMERIC = new Mode(2, [9, 11, 13]);
531
+ static BYTE = new Mode(4, [8, 16, 16]);
532
+ static KANJI = new Mode(8, [8, 10, 12]);
533
+ static ECI = new Mode(7, [0, 0, 0]);
534
+ // The mode indicator bits, which is a uint4 value (range 0 to 15).
535
+ // Number of character count bits for three different version ranges.
536
+ /*-- Constructor and fields --*/
537
+ constructor(modeBits, numBitsCharCount) {
538
+ this.modeBits = modeBits, this.numBitsCharCount = numBitsCharCount;
539
+ }
540
+ /*-- Method --*/
541
+ // (Package-private) Returns the bit width of the character count field for a segment in
542
+ // this mode in a QR Code at the given version number. The result is in the range [0, 16].
543
+ numCharCountBits(ver) {
544
+ return this.numBitsCharCount[Math.floor((ver + 7) / 17)];
545
+ }
546
+ }
547
+ const ERROR_LEVEL_MAP = {
548
+ L: Ecc.LOW,
549
+ M: Ecc.MEDIUM,
550
+ Q: Ecc.QUARTILE,
551
+ H: Ecc.HIGH
552
+ }, DEFAULT_SIZE = 128, DEFAULT_LEVEL = "L", DEFAULT_FGCOLOR = "#000000", DEFAULT_INCLUDEMARGIN = !1, DEFAULT_MINVERSION = 1, SPEC_MARGIN_SIZE = 4, DEFAULT_MARGIN_SIZE = 0;
553
+ function generatePath(modules, margin = 0) {
554
+ const ops = [];
555
+ return modules.forEach(function(row, y) {
556
+ let start = null;
557
+ row.forEach(function(cell, x) {
558
+ if (!cell && start !== null) {
559
+ ops.push(`M${start + margin} ${y + margin}h${x - start}v1H${start + margin}z`), start = null;
560
+ return;
561
+ }
562
+ if (x === row.length - 1) {
563
+ if (!cell)
564
+ return;
565
+ start === null ? ops.push(`M${x + margin},${y + margin} h1v1H${x + margin}z`) : ops.push(`M${start + margin},${y + margin} h${x + 1 - start}v1H${start + margin}z`);
566
+ return;
567
+ }
568
+ cell && start === null && (start = x);
569
+ });
570
+ }), ops.join("");
571
+ }
572
+ function excavateModules(modules, excavation) {
573
+ return modules.slice().map((row, y) => y < excavation.y || y >= excavation.y + excavation.h ? row : row.map((cell, x) => x < excavation.x || x >= excavation.x + excavation.w ? cell : !1));
574
+ }
575
+ function getImageSettings(cells, size, margin, logoSize) {
576
+ if (!logoSize)
577
+ return null;
578
+ const scale = (cells.length + margin * 2) / size, w = logoSize * scale, h = logoSize * scale, x = cells.length / 2 - w / 2, y = cells.length / 2 - h / 2, floorX = Math.floor(x), floorY = Math.floor(y), ceilW = Math.ceil(w + x - floorX), ceilH = Math.ceil(h + y - floorY);
579
+ return {
580
+ x,
581
+ y,
582
+ h,
583
+ w,
584
+ excavation: {
585
+ x: floorX,
586
+ y: floorY,
587
+ w: ceilW,
588
+ h: ceilH
589
+ }
590
+ };
591
+ }
592
+ function getMarginSize(includeMargin, marginSize) {
593
+ return marginSize != null ? Math.max(Math.floor(marginSize), 0) : includeMargin ? SPEC_MARGIN_SIZE : DEFAULT_MARGIN_SIZE;
594
+ }
595
+ function useQRCode(t0) {
596
+ const $ = c(24), {
597
+ value,
598
+ level,
599
+ minVersion,
600
+ includeMargin,
601
+ marginSize,
602
+ logoSize,
603
+ size
604
+ } = t0;
605
+ let t1;
606
+ if ($[0] !== level || $[1] !== minVersion || $[2] !== value) {
607
+ const segments = QrSegment.makeSegments(value);
608
+ t1 = QrCode.encodeSegments(segments, ERROR_LEVEL_MAP[level], minVersion), $[0] = level, $[1] = minVersion, $[2] = value, $[3] = t1;
609
+ } else
610
+ t1 = $[3];
611
+ const qrcode = t1;
612
+ let cells, margin, numCells, t2;
613
+ $[4] !== includeMargin || $[5] !== logoSize || $[6] !== marginSize || $[7] !== qrcode || $[8] !== size ? (cells = qrcode.getModules(), margin = getMarginSize(includeMargin, marginSize), numCells = cells.length + margin * 2, t2 = getImageSettings(cells, size, margin, logoSize), $[4] = includeMargin, $[5] = logoSize, $[6] = marginSize, $[7] = qrcode, $[8] = size, $[9] = cells, $[10] = margin, $[11] = numCells, $[12] = t2) : (cells = $[9], margin = $[10], numCells = $[11], t2 = $[12]);
614
+ const calculatedImageSettings = t2;
615
+ let t3;
616
+ $[13] !== calculatedImageSettings || $[14] !== cells || $[15] !== margin || $[16] !== numCells ? (t3 = {
617
+ cells,
618
+ margin,
619
+ numCells,
620
+ calculatedImageSettings
621
+ }, $[13] = calculatedImageSettings, $[14] = cells, $[15] = margin, $[16] = numCells, $[17] = t3) : t3 = $[17];
622
+ const {
623
+ cells: cells_0,
624
+ margin: margin_0,
625
+ numCells: numCells_0,
626
+ calculatedImageSettings: calculatedImageSettings_0
627
+ } = t3;
628
+ let t4;
629
+ return $[18] !== calculatedImageSettings_0 || $[19] !== cells_0 || $[20] !== margin_0 || $[21] !== numCells_0 || $[22] !== qrcode ? (t4 = {
630
+ qrcode,
631
+ margin: margin_0,
632
+ cells: cells_0,
633
+ numCells: numCells_0,
634
+ calculatedImageSettings: calculatedImageSettings_0
635
+ }, $[18] = calculatedImageSettings_0, $[19] = cells_0, $[20] = margin_0, $[21] = numCells_0, $[22] = qrcode, $[23] = t4) : t4 = $[23], t4;
636
+ }
637
+ function QRCodeSVGComponent(props) {
638
+ const $ = c(26), {
639
+ value,
640
+ size: t0,
641
+ level: t1,
642
+ color: t2,
643
+ minVersion: t3,
644
+ title,
645
+ logoSize
646
+ } = props, size = t0 === void 0 ? DEFAULT_SIZE : t0, level = t1 === void 0 ? DEFAULT_LEVEL : t1, color = t2 === void 0 ? DEFAULT_FGCOLOR : t2, minVersion = t3 === void 0 ? DEFAULT_MINVERSION : t3;
647
+ let t4;
648
+ $[0] !== level || $[1] !== logoSize || $[2] !== minVersion || $[3] !== size || $[4] !== value ? (t4 = {
649
+ value,
650
+ level,
651
+ minVersion,
652
+ includeMargin: DEFAULT_INCLUDEMARGIN,
653
+ marginSize: void 0,
654
+ logoSize,
655
+ size
656
+ }, $[0] = level, $[1] = logoSize, $[2] = minVersion, $[3] = size, $[4] = value, $[5] = t4) : t4 = $[5];
657
+ const {
658
+ margin,
659
+ cells,
660
+ numCells,
661
+ calculatedImageSettings
662
+ } = useQRCode(t4);
663
+ let t5;
664
+ $[6] !== calculatedImageSettings || $[7] !== cells || $[8] !== logoSize ? (t5 = logoSize && calculatedImageSettings?.excavation ? excavateModules(cells, calculatedImageSettings.excavation) : cells, $[6] = calculatedImageSettings, $[7] = cells, $[8] = logoSize, $[9] = t5) : t5 = $[9];
665
+ const cellsToDraw = t5;
666
+ let t6;
667
+ $[10] !== cellsToDraw || $[11] !== margin ? (t6 = generatePath(cellsToDraw, margin), $[10] = cellsToDraw, $[11] = margin, $[12] = t6) : t6 = $[12];
668
+ const fgPath = t6, t7 = `0 0 ${numCells} ${numCells}`;
669
+ let t8;
670
+ $[13] !== title ? (t8 = !!title && /* @__PURE__ */ jsx("title", { children: title }), $[13] = title, $[14] = t8) : t8 = $[14];
671
+ let t10, t11, t9;
672
+ $[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t9 = {
673
+ opacity: 0
674
+ }, t10 = {
675
+ opacity: 2
676
+ }, t11 = {
677
+ opacity: -1
678
+ }, $[15] = t10, $[16] = t11, $[17] = t9) : (t10 = $[15], t11 = $[16], t9 = $[17]);
679
+ let t12;
680
+ $[18] !== color || $[19] !== fgPath ? (t12 = /* @__PURE__ */ jsx(motion.path, { fill: color, d: fgPath, shapeRendering: "crispEdges", initial: t9, animate: t10, exit: t11 }), $[18] = color, $[19] = fgPath, $[20] = t12) : t12 = $[20];
681
+ let t13;
682
+ return $[21] !== size || $[22] !== t12 || $[23] !== t7 || $[24] !== t8 ? (t13 = /* @__PURE__ */ jsxs("svg", { height: size, width: size, viewBox: t7, role: "img", children: [
683
+ t8,
684
+ t12
685
+ ] }), $[21] = size, $[22] = t12, $[23] = t7, $[24] = t8, $[25] = t13) : t13 = $[25], t13;
686
+ }
687
+ const QRCodeSVG = memo(QRCodeSVGComponent);
688
+ QRCodeSVG.displayName = "Memo(QRCodeSVG)";
689
+ export {
690
+ QRCodeSVG as default
691
+ };
692
+ //# sourceMappingURL=QRCodeSVG.js.map