sanity 3.74.2-corel.18 → 3.74.2-coreui.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/_chunks-cjs/runtime.js +8 -4
- package/lib/_chunks-cjs/runtime.js.map +1 -1
- package/lib/_chunks-cjs/version.js +1 -1
- package/lib/_chunks-es/version.mjs +1 -1
- package/lib/_legacy/version.esm.js +1 -1
- package/package.json +10 -11
- package/src/_internal/cli/server/renderDocument.tsx +12 -0
- package/src/_internal/cli/server/runtime.ts +13 -10
- package/src/_internal/cli/server/vite/plugin-sanity-build-entries.ts +14 -12
- package/dist/BroadcastDisplayedDocument-BHYI8o6u.mjs +0 -19
- package/dist/BroadcastDisplayedDocument-BHYI8o6u.mjs.map +0 -1
- package/dist/DisplayedDocumentBroadcaster-DfHPxc7C.mjs +0 -58
- package/dist/DisplayedDocumentBroadcaster-DfHPxc7C.mjs.map +0 -1
- package/dist/LiveQueries-sYvgBCKh.mjs +0 -267
- package/dist/LiveQueries-sYvgBCKh.mjs.map +0 -1
- package/dist/LoaderQueries-AQneabiG.mjs +0 -581
- package/dist/LoaderQueries-AQneabiG.mjs.map +0 -1
- package/dist/Observable-wwWYwtkh.mjs +0 -551
- package/dist/Observable-wwWYwtkh.mjs.map +0 -1
- package/dist/PostMessageDocuments-DLMdHDk6.mjs +0 -75
- package/dist/PostMessageDocuments-DLMdHDk6.mjs.map +0 -1
- package/dist/PostMessageFeatures-CazMQz3f.mjs +0 -21
- package/dist/PostMessageFeatures-CazMQz3f.mjs.map +0 -1
- package/dist/PostMessagePerspective-m4uZ6sI5.mjs +0 -23
- package/dist/PostMessagePerspective-m4uZ6sI5.mjs.map +0 -1
- package/dist/PostMessagePreviewSnapshots-Dr7CEAiM.mjs +0 -66
- package/dist/PostMessagePreviewSnapshots-Dr7CEAiM.mjs.map +0 -1
- package/dist/PostMessageRefreshMutations-CWb9UqSy.mjs +0 -66
- package/dist/PostMessageRefreshMutations-CWb9UqSy.mjs.map +0 -1
- package/dist/PostMessageSchema-BVFyZOH1.mjs +0 -514
- package/dist/PostMessageSchema-BVFyZOH1.mjs.map +0 -1
- package/dist/PostMessageTelemetry-CSluBvcC.mjs +0 -51
- package/dist/PostMessageTelemetry-CSluBvcC.mjs.map +0 -1
- package/dist/PresentationToolGrantsCheck-4zo266wj.mjs +0 -3919
- package/dist/PresentationToolGrantsCheck-4zo266wj.mjs.map +0 -1
- package/dist/QRCodeSVG-D6VfGEbM.mjs +0 -648
- package/dist/QRCodeSVG-D6VfGEbM.mjs.map +0 -1
- package/dist/SourceContext-T8zcpOpp.mjs +0 -33
- package/dist/SourceContext-T8zcpOpp.mjs.map +0 -1
- package/dist/StructureToolProvider-BMLps71e.mjs +0 -13815
- package/dist/StructureToolProvider-BMLps71e.mjs.map +0 -1
- package/dist/Subject-DP0DoUP_.mjs +0 -108
- package/dist/Subject-DP0DoUP_.mjs.map +0 -1
- package/dist/ViteDevServerStopped-DdibXNvO.mjs +0 -44
- package/dist/ViteDevServerStopped-DdibXNvO.mjs.map +0 -1
- package/dist/_createContext.mjs +0 -36
- package/dist/_createContext.mjs.map +0 -1
- package/dist/_singletons.mjs +0 -195
- package/dist/_singletons.mjs.map +0 -1
- package/dist/browser-BzDH2pyp.mjs +0 -455
- package/dist/browser-BzDH2pyp.mjs.map +0 -1
- package/dist/browser-DWCoWoiH.mjs +0 -3988
- package/dist/browser-DWCoWoiH.mjs.map +0 -1
- package/dist/debounceTime-BeoKrERE.mjs +0 -130
- package/dist/debounceTime-BeoKrERE.mjs.map +0 -1
- package/dist/desk.mjs +0 -52
- package/dist/desk.mjs.map +0 -1
- package/dist/first-Di4GZDIY.mjs +0 -42
- package/dist/first-Di4GZDIY.mjs.map +0 -1
- package/dist/get-psIoeD-z.mjs +0 -327
- package/dist/get-psIoeD-z.mjs.map +0 -1
- package/dist/hooks-4sgcd521.mjs +0 -90
- package/dist/hooks-4sgcd521.mjs.map +0 -1
- package/dist/index-9PJcXUTv.mjs +0 -87
- package/dist/index-9PJcXUTv.mjs.map +0 -1
- package/dist/index-ByFK-IwD.mjs +0 -528
- package/dist/index-ByFK-IwD.mjs.map +0 -1
- package/dist/index-C2OAo3To.mjs +0 -7079
- package/dist/index-C2OAo3To.mjs.map +0 -1
- package/dist/index-C3OvVLVP.mjs +0 -4636
- package/dist/index-C3OvVLVP.mjs.map +0 -1
- package/dist/index-DBPVDKJN.mjs +0 -1198
- package/dist/index-DBPVDKJN.mjs.map +0 -1
- package/dist/index-DkvUNBNf.mjs +0 -73
- package/dist/index-DkvUNBNf.mjs.map +0 -1
- package/dist/index-Sp9w8lMg.mjs +0 -118
- package/dist/index-Sp9w8lMg.mjs.map +0 -1
- package/dist/index.browser-BxT2qp9y.mjs +0 -104
- package/dist/index.browser-BxT2qp9y.mjs.map +0 -1
- package/dist/index.mjs +0 -129019
- package/dist/index.mjs.map +0 -1
- package/dist/isObservable-ByOheaM8.mjs +0 -8
- package/dist/isObservable-ByOheaM8.mjs.map +0 -1
- package/dist/never-ChKjLemk.mjs +0 -6
- package/dist/never-ChKjLemk.mjs.map +0 -1
- package/dist/pane-C4tskUPg.mjs +0 -5
- package/dist/pane-C4tskUPg.mjs.map +0 -1
- package/dist/pane-Dhx8FvsK.mjs +0 -5
- package/dist/pane-Dhx8FvsK.mjs.map +0 -1
- package/dist/presentation-CSS9GR9X.mjs +0 -984
- package/dist/presentation-CSS9GR9X.mjs.map +0 -1
- package/dist/presentation.mjs +0 -14
- package/dist/presentation.mjs.map +0 -1
- package/dist/resources-4cbq8YlR.mjs +0 -124
- package/dist/resources-4cbq8YlR.mjs.map +0 -1
- package/dist/resources-BVETz6Ur.mjs +0 -57
- package/dist/resources-BVETz6Ur.mjs.map +0 -1
- package/dist/resources-D4AaU75F.mjs +0 -434
- package/dist/resources-D4AaU75F.mjs.map +0 -1
- package/dist/resources-Dc-6ZcPg.mjs +0 -157
- package/dist/resources-Dc-6ZcPg.mjs.map +0 -1
- package/dist/resources-DgU0prBM.mjs +0 -179
- package/dist/resources-DgU0prBM.mjs.map +0 -1
- package/dist/resources-MD8RsYhH.mjs +0 -288
- package/dist/resources-MD8RsYhH.mjs.map +0 -1
- package/dist/router.mjs +0 -689
- package/dist/router.mjs.map +0 -1
- package/dist/share-bcOpIdQz.mjs +0 -71
- package/dist/share-bcOpIdQz.mjs.map +0 -1
- package/dist/shareReplay-Dj1O6fKV.mjs +0 -43
- package/dist/shareReplay-Dj1O6fKV.mjs.map +0 -1
- package/dist/stegaEncodeSourceMap-DXdUZQye.mjs +0 -342
- package/dist/stegaEncodeSourceMap-DXdUZQye.mjs.map +0 -1
- package/dist/structure.mjs +0 -56
- package/dist/structure.mjs.map +0 -1
- package/dist/takeUntil-CgZP1bze.mjs +0 -111
- package/dist/takeUntil-CgZP1bze.mjs.map +0 -1
- package/dist/v4-C78sE4Gb.mjs +0 -27082
- package/dist/v4-C78sE4Gb.mjs.map +0 -1
- package/dist/version-D7UZEoYI.mjs +0 -5
- package/dist/version-D7UZEoYI.mjs.map +0 -1
@@ -1,648 +0,0 @@
|
|
1
|
-
var y = Object.defineProperty;
|
2
|
-
var F = (c, t, e) => t in c ? y(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
|
3
|
-
var f = (c, t, e) => F(c, typeof t != "symbol" ? t + "" : t, e);
|
4
|
-
import { jsxs as O, jsx as b } from "react/jsx-runtime";
|
5
|
-
import { memo as T, useMemo as S } from "react";
|
6
|
-
import { m as D } from "./v4-C78sE4Gb.mjs";
|
7
|
-
/**
|
8
|
-
* @license QR Code generator library (TypeScript)
|
9
|
-
* Copyright (c) Project Nayuki.
|
10
|
-
* SPDX-License-Identifier: MIT
|
11
|
-
*/
|
12
|
-
const a = class a {
|
13
|
-
/*-- Constructor (low level) and fields --*/
|
14
|
-
// Creates a new QR Code with the given version number,
|
15
|
-
// error correction level, data codeword bytes, and mask number.
|
16
|
-
// This is a low-level API that most users should not use directly.
|
17
|
-
// A mid-level API is the encodeSegments() function.
|
18
|
-
constructor(t, e, s, n) {
|
19
|
-
/*-- Fields --*/
|
20
|
-
// The width and height of this QR Code, measured in modules, between
|
21
|
-
// 21 and 177 (inclusive). This is equal to version * 4 + 17.
|
22
|
-
// The index of the mask pattern used in this QR Code, which is between 0 and 7 (inclusive).
|
23
|
-
// Even if a QR Code is created with automatic masking requested (mask = -1),
|
24
|
-
// the resulting object still has a mask value between 0 and 7.
|
25
|
-
// The modules of this QR Code (false = light, true = dark).
|
26
|
-
// Immutable after constructor finishes. Accessed through getModule().
|
27
|
-
f(this, "modules", []);
|
28
|
-
// Indicates function modules that are not subjected to masking. Discarded when constructor finishes.
|
29
|
-
f(this, "isFunction", []);
|
30
|
-
if (this.version = t, this.errorCorrectionLevel = e, t < a.MIN_VERSION || t > a.MAX_VERSION) throw new RangeError("Version value out of range");
|
31
|
-
if (n < -1 || n > 7) throw new RangeError("Mask value out of range");
|
32
|
-
this.size = t * 4 + 17;
|
33
|
-
const o = [];
|
34
|
-
for (let i = 0; i < this.size; i++) o.push(!1);
|
35
|
-
for (let i = 0; i < this.size; i++)
|
36
|
-
this.modules.push(o.slice()), this.isFunction.push(o.slice());
|
37
|
-
this.drawFunctionPatterns();
|
38
|
-
const r = this.addEccAndInterleave(s);
|
39
|
-
if (this.drawCodewords(r), n == -1) {
|
40
|
-
let i = 1e9;
|
41
|
-
for (let u = 0; u < 8; u++) {
|
42
|
-
this.applyMask(u), this.drawFormatBits(u);
|
43
|
-
const h = this.getPenaltyScore();
|
44
|
-
h < i && (n = u, i = h), this.applyMask(u);
|
45
|
-
}
|
46
|
-
}
|
47
|
-
w(0 <= n && n <= 7), this.mask = n, this.applyMask(n), this.drawFormatBits(n), this.isFunction = [];
|
48
|
-
}
|
49
|
-
/*-- Static factory functions (high level) --*/
|
50
|
-
// Returns a QR Code representing the given Unicode text string at the given error correction level.
|
51
|
-
// As a conservative upper bound, this function is guaranteed to succeed for strings that have 738 or fewer
|
52
|
-
// Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible
|
53
|
-
// QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the
|
54
|
-
// ecl argument if it can be done without increasing the version.
|
55
|
-
static encodeText(t, e) {
|
56
|
-
const s = P.makeSegments(t);
|
57
|
-
return a.encodeSegments(s, e);
|
58
|
-
}
|
59
|
-
// Returns a QR Code representing the given binary data at the given error correction level.
|
60
|
-
// This function always encodes using the binary segment mode, not any text mode. The maximum number of
|
61
|
-
// bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
|
62
|
-
// The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
|
63
|
-
static encodeBinary(t, e) {
|
64
|
-
const s = P.makeBytes(t);
|
65
|
-
return a.encodeSegments([s], e);
|
66
|
-
}
|
67
|
-
/*-- Static factory functions (mid level) --*/
|
68
|
-
// Returns a QR Code representing the given segments with the given encoding parameters.
|
69
|
-
// The smallest possible QR Code version within the given range is automatically
|
70
|
-
// chosen for the output. Iff boostEcl is true, then the ECC level of the result
|
71
|
-
// may be higher than the ecl argument if it can be done without increasing the
|
72
|
-
// version. The mask number is either between 0 to 7 (inclusive) to force that
|
73
|
-
// mask, or -1 to automatically choose an appropriate mask (which may be slow).
|
74
|
-
// This function allows the user to create a custom sequence of segments that switches
|
75
|
-
// between modes (such as alphanumeric and byte) to encode text in less space.
|
76
|
-
// This is a mid-level API; the high-level API is encodeText() and encodeBinary().
|
77
|
-
static encodeSegments(t, e, s = 1, n = 40, o = -1, r = !0) {
|
78
|
-
if (!(a.MIN_VERSION <= s && s <= n && n <= a.MAX_VERSION) || o < -1 || o > 7) throw new RangeError("Invalid value");
|
79
|
-
let i, u;
|
80
|
-
for (i = s; ; i++) {
|
81
|
-
const l = a.getNumDataCodewords(i, e) * 8, m = P.getTotalBits(t, i);
|
82
|
-
if (m <= l) {
|
83
|
-
u = m;
|
84
|
-
break;
|
85
|
-
}
|
86
|
-
if (i >= n)
|
87
|
-
throw new RangeError("Data too long");
|
88
|
-
}
|
89
|
-
for (const l of [p.MEDIUM, p.QUARTILE, p.HIGH])
|
90
|
-
r && u <= a.getNumDataCodewords(i, l) * 8 && (e = l);
|
91
|
-
const h = [];
|
92
|
-
for (const l of t) {
|
93
|
-
M(l.mode.modeBits, 4, h), M(l.numChars, l.mode.numCharCountBits(i), h);
|
94
|
-
for (const m of l.getData()) h.push(m);
|
95
|
-
}
|
96
|
-
w(h.length == u);
|
97
|
-
const g = a.getNumDataCodewords(i, e) * 8;
|
98
|
-
w(h.length <= g), M(0, Math.min(4, g - h.length), h), M(0, (8 - h.length % 8) % 8, h), w(h.length % 8 == 0);
|
99
|
-
for (let l = 236; h.length < g; l ^= 253) M(l, 8, h);
|
100
|
-
const E = [];
|
101
|
-
for (; E.length * 8 < h.length; ) E.push(0);
|
102
|
-
return h.forEach((l, m) => E[m >>> 3] |= l << 7 - (m & 7)), new a(i, e, E, o);
|
103
|
-
}
|
104
|
-
/*-- Accessor methods --*/
|
105
|
-
// Returns the color of the module (pixel) at the given coordinates, which is false
|
106
|
-
// for light or true for dark. The top left corner has the coordinates (x=0, y=0).
|
107
|
-
// If the given coordinates are out of bounds, then false (light) is returned.
|
108
|
-
getModule(t, e) {
|
109
|
-
return 0 <= t && t < this.size && 0 <= e && e < this.size && this.modules[e][t];
|
110
|
-
}
|
111
|
-
// Modified to expose modules for easy access
|
112
|
-
getModules() {
|
113
|
-
return this.modules;
|
114
|
-
}
|
115
|
-
/*-- Private helper methods for constructor: Drawing function modules --*/
|
116
|
-
// Reads this object's version field, and draws and marks all function modules.
|
117
|
-
drawFunctionPatterns() {
|
118
|
-
for (let s = 0; s < this.size; s++)
|
119
|
-
this.setFunctionModule(6, s, s % 2 == 0), this.setFunctionModule(s, 6, s % 2 == 0);
|
120
|
-
this.drawFinderPattern(3, 3), this.drawFinderPattern(this.size - 4, 3), this.drawFinderPattern(3, this.size - 4);
|
121
|
-
const t = this.getAlignmentPatternPositions(), e = t.length;
|
122
|
-
for (let s = 0; s < e; s++)
|
123
|
-
for (let n = 0; n < e; n++)
|
124
|
-
s == 0 && n == 0 || s == 0 && n == e - 1 || s == e - 1 && n == 0 || this.drawAlignmentPattern(t[s], t[n]);
|
125
|
-
this.drawFormatBits(0), this.drawVersion();
|
126
|
-
}
|
127
|
-
// Draws two copies of the format bits (with its own error correction code)
|
128
|
-
// based on the given mask and this object's error correction level field.
|
129
|
-
drawFormatBits(t) {
|
130
|
-
const e = this.errorCorrectionLevel.formatBits << 3 | t;
|
131
|
-
let s = e;
|
132
|
-
for (let o = 0; o < 10; o++) s = s << 1 ^ (s >>> 9) * 1335;
|
133
|
-
const n = (e << 10 | s) ^ 21522;
|
134
|
-
w(n >>> 15 == 0);
|
135
|
-
for (let o = 0; o <= 5; o++) this.setFunctionModule(8, o, N(n, o));
|
136
|
-
this.setFunctionModule(8, 7, N(n, 6)), this.setFunctionModule(8, 8, N(n, 7)), this.setFunctionModule(7, 8, N(n, 8));
|
137
|
-
for (let o = 9; o < 15; o++) this.setFunctionModule(14 - o, 8, N(n, o));
|
138
|
-
for (let o = 0; o < 8; o++) this.setFunctionModule(this.size - 1 - o, 8, N(n, o));
|
139
|
-
for (let o = 8; o < 15; o++) this.setFunctionModule(8, this.size - 15 + o, N(n, o));
|
140
|
-
this.setFunctionModule(8, this.size - 8, !0);
|
141
|
-
}
|
142
|
-
// Draws two copies of the version bits (with its own error correction code),
|
143
|
-
// based on this object's version field, iff 7 <= version <= 40.
|
144
|
-
drawVersion() {
|
145
|
-
if (this.version < 7) return;
|
146
|
-
let t = this.version;
|
147
|
-
for (let s = 0; s < 12; s++) t = t << 1 ^ (t >>> 11) * 7973;
|
148
|
-
const e = this.version << 12 | t;
|
149
|
-
w(e >>> 18 == 0);
|
150
|
-
for (let s = 0; s < 18; s++) {
|
151
|
-
const n = N(e, s), o = this.size - 11 + s % 3, r = Math.floor(s / 3);
|
152
|
-
this.setFunctionModule(o, r, n), this.setFunctionModule(r, o, n);
|
153
|
-
}
|
154
|
-
}
|
155
|
-
// Draws a 9*9 finder pattern including the border separator,
|
156
|
-
// with the center module at (x, y). Modules can be out of bounds.
|
157
|
-
drawFinderPattern(t, e) {
|
158
|
-
for (let s = -4; s <= 4; s++)
|
159
|
-
for (let n = -4; n <= 4; n++) {
|
160
|
-
const o = Math.max(Math.abs(n), Math.abs(s)), r = t + n, i = e + s;
|
161
|
-
0 <= r && r < this.size && 0 <= i && i < this.size && this.setFunctionModule(r, i, o != 2 && o != 4);
|
162
|
-
}
|
163
|
-
}
|
164
|
-
// Draws a 5*5 alignment pattern, with the center module
|
165
|
-
// at (x, y). All modules must be in bounds.
|
166
|
-
drawAlignmentPattern(t, e) {
|
167
|
-
for (let s = -2; s <= 2; s++)
|
168
|
-
for (let n = -2; n <= 2; n++) this.setFunctionModule(t + n, e + s, Math.max(Math.abs(n), Math.abs(s)) != 1);
|
169
|
-
}
|
170
|
-
// Sets the color of a module and marks it as a function module.
|
171
|
-
// Only used by the constructor. Coordinates must be in bounds.
|
172
|
-
setFunctionModule(t, e, s) {
|
173
|
-
this.modules[e][t] = s, this.isFunction[e][t] = !0;
|
174
|
-
}
|
175
|
-
/*-- Private helper methods for constructor: Codewords and masking --*/
|
176
|
-
// Returns a new byte string representing the given data with the appropriate error correction
|
177
|
-
// codewords appended to it, based on this object's version and error correction level.
|
178
|
-
addEccAndInterleave(t) {
|
179
|
-
const e = this.version, s = this.errorCorrectionLevel;
|
180
|
-
if (t.length != a.getNumDataCodewords(e, s)) throw new RangeError("Invalid argument");
|
181
|
-
const n = a.NUM_ERROR_CORRECTION_BLOCKS[s.ordinal][e], o = a.ECC_CODEWORDS_PER_BLOCK[s.ordinal][e], r = Math.floor(a.getNumRawDataModules(e) / 8), i = n - r % n, u = Math.floor(r / n), h = [], g = a.reedSolomonComputeDivisor(o);
|
182
|
-
for (let l = 0, m = 0; l < n; l++) {
|
183
|
-
const R = t.slice(m, m + u - o + (l < i ? 0 : 1));
|
184
|
-
m += R.length;
|
185
|
-
const L = a.reedSolomonComputeRemainder(R, g);
|
186
|
-
l < i && R.push(0), h.push(R.concat(L));
|
187
|
-
}
|
188
|
-
const E = [];
|
189
|
-
for (let l = 0; l < h[0].length; l++)
|
190
|
-
h.forEach((m, R) => {
|
191
|
-
(l != u - o || R >= i) && E.push(m[l]);
|
192
|
-
});
|
193
|
-
return w(E.length == r), E;
|
194
|
-
}
|
195
|
-
// Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
|
196
|
-
// data area of this QR Code. Function modules need to be marked off before this is called.
|
197
|
-
drawCodewords(t) {
|
198
|
-
if (t.length != Math.floor(a.getNumRawDataModules(this.version) / 8)) throw new RangeError("Invalid argument");
|
199
|
-
let e = 0;
|
200
|
-
for (let s = this.size - 1; s >= 1; s -= 2) {
|
201
|
-
s == 6 && (s = 5);
|
202
|
-
for (let n = 0; n < this.size; n++)
|
203
|
-
for (let o = 0; o < 2; o++) {
|
204
|
-
const r = s - o, i = s + 1 & 2 ? n : this.size - 1 - n;
|
205
|
-
!this.isFunction[i][r] && e < t.length * 8 && (this.modules[i][r] = N(t[e >>> 3], 7 - (e & 7)), e++);
|
206
|
-
}
|
207
|
-
}
|
208
|
-
w(e == t.length * 8);
|
209
|
-
}
|
210
|
-
// XORs the codeword modules in this QR Code with the given mask pattern.
|
211
|
-
// The function modules must be marked and the codeword bits must be drawn
|
212
|
-
// before masking. Due to the arithmetic of XOR, calling applyMask() with
|
213
|
-
// the same mask value a second time will undo the mask. A final well-formed
|
214
|
-
// QR Code needs exactly one (not zero, two, etc.) mask applied.
|
215
|
-
applyMask(t) {
|
216
|
-
if (t < 0 || t > 7) throw new RangeError("Mask value out of range");
|
217
|
-
for (let e = 0; e < this.size; e++)
|
218
|
-
for (let s = 0; s < this.size; s++) {
|
219
|
-
let n;
|
220
|
-
switch (t) {
|
221
|
-
case 0:
|
222
|
-
n = (s + e) % 2 == 0;
|
223
|
-
break;
|
224
|
-
case 1:
|
225
|
-
n = e % 2 == 0;
|
226
|
-
break;
|
227
|
-
case 2:
|
228
|
-
n = s % 3 == 0;
|
229
|
-
break;
|
230
|
-
case 3:
|
231
|
-
n = (s + e) % 3 == 0;
|
232
|
-
break;
|
233
|
-
case 4:
|
234
|
-
n = (Math.floor(s / 3) + Math.floor(e / 2)) % 2 == 0;
|
235
|
-
break;
|
236
|
-
case 5:
|
237
|
-
n = s * e % 2 + s * e % 3 == 0;
|
238
|
-
break;
|
239
|
-
case 6:
|
240
|
-
n = (s * e % 2 + s * e % 3) % 2 == 0;
|
241
|
-
break;
|
242
|
-
case 7:
|
243
|
-
n = ((s + e) % 2 + s * e % 3) % 2 == 0;
|
244
|
-
break;
|
245
|
-
default:
|
246
|
-
throw new Error("Unreachable");
|
247
|
-
}
|
248
|
-
!this.isFunction[e][s] && n && (this.modules[e][s] = !this.modules[e][s]);
|
249
|
-
}
|
250
|
-
}
|
251
|
-
// Calculates and returns the penalty score based on state of this QR Code's current modules.
|
252
|
-
// This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.
|
253
|
-
getPenaltyScore() {
|
254
|
-
let t = 0;
|
255
|
-
for (let o = 0; o < this.size; o++) {
|
256
|
-
let r = !1, i = 0;
|
257
|
-
const u = [0, 0, 0, 0, 0, 0, 0];
|
258
|
-
for (let h = 0; h < this.size; h++)
|
259
|
-
this.modules[o][h] == r ? (i++, i == 5 ? t += a.PENALTY_N1 : i > 5 && t++) : (this.finderPenaltyAddHistory(i, u), r || (t += this.finderPenaltyCountPatterns(u) * a.PENALTY_N3), r = this.modules[o][h], i = 1);
|
260
|
-
t += this.finderPenaltyTerminateAndCount(r, i, u) * a.PENALTY_N3;
|
261
|
-
}
|
262
|
-
for (let o = 0; o < this.size; o++) {
|
263
|
-
let r = !1, i = 0;
|
264
|
-
const u = [0, 0, 0, 0, 0, 0, 0];
|
265
|
-
for (let h = 0; h < this.size; h++)
|
266
|
-
this.modules[h][o] == r ? (i++, i == 5 ? t += a.PENALTY_N1 : i > 5 && t++) : (this.finderPenaltyAddHistory(i, u), r || (t += this.finderPenaltyCountPatterns(u) * a.PENALTY_N3), r = this.modules[h][o], i = 1);
|
267
|
-
t += this.finderPenaltyTerminateAndCount(r, i, u) * a.PENALTY_N3;
|
268
|
-
}
|
269
|
-
for (let o = 0; o < this.size - 1; o++)
|
270
|
-
for (let r = 0; r < this.size - 1; r++) {
|
271
|
-
const i = this.modules[o][r];
|
272
|
-
i == this.modules[o][r + 1] && i == this.modules[o + 1][r] && i == this.modules[o + 1][r + 1] && (t += a.PENALTY_N2);
|
273
|
-
}
|
274
|
-
let e = 0;
|
275
|
-
for (const o of this.modules) e = o.reduce((r, i) => r + (i ? 1 : 0), e);
|
276
|
-
const s = this.size * this.size, n = Math.ceil(Math.abs(e * 20 - s * 10) / s) - 1;
|
277
|
-
return w(0 <= n && n <= 9), t += n * a.PENALTY_N4, w(0 <= t && t <= 2568888), t;
|
278
|
-
}
|
279
|
-
/*-- Private helper functions --*/
|
280
|
-
// Returns an ascending list of positions of alignment patterns for this version number.
|
281
|
-
// Each position is in the range [0,177), and are used on both the x and y axes.
|
282
|
-
// This could be implemented as lookup table of 40 variable-length lists of integers.
|
283
|
-
getAlignmentPatternPositions() {
|
284
|
-
if (this.version == 1) return [];
|
285
|
-
{
|
286
|
-
const t = Math.floor(this.version / 7) + 2, e = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (t * 2 - 2)) * 2, s = [6];
|
287
|
-
for (let n = this.size - 7; s.length < t; n -= e) s.splice(1, 0, n);
|
288
|
-
return s;
|
289
|
-
}
|
290
|
-
}
|
291
|
-
// Returns the number of data bits that can be stored in a QR Code of the given version number, after
|
292
|
-
// all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
|
293
|
-
// The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
|
294
|
-
static getNumRawDataModules(t) {
|
295
|
-
if (t < a.MIN_VERSION || t > a.MAX_VERSION) throw new RangeError("Version number out of range");
|
296
|
-
let e = (16 * t + 128) * t + 64;
|
297
|
-
if (t >= 2) {
|
298
|
-
const s = Math.floor(t / 7) + 2;
|
299
|
-
e -= (25 * s - 10) * s - 55, t >= 7 && (e -= 36);
|
300
|
-
}
|
301
|
-
return w(208 <= e && e <= 29648), e;
|
302
|
-
}
|
303
|
-
// Returns the number of 8-bit data (i.e. not error correction) codewords contained in any
|
304
|
-
// QR Code of the given version number and error correction level, with remainder bits discarded.
|
305
|
-
// This stateless pure function could be implemented as a (40*4)-cell lookup table.
|
306
|
-
static getNumDataCodewords(t, e) {
|
307
|
-
return Math.floor(a.getNumRawDataModules(t) / 8) - a.ECC_CODEWORDS_PER_BLOCK[e.ordinal][t] * a.NUM_ERROR_CORRECTION_BLOCKS[e.ordinal][t];
|
308
|
-
}
|
309
|
-
// Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
|
310
|
-
// implemented as a lookup table over all possible parameter values, instead of as an algorithm.
|
311
|
-
static reedSolomonComputeDivisor(t) {
|
312
|
-
if (t < 1 || t > 255) throw new RangeError("Degree out of range");
|
313
|
-
const e = [];
|
314
|
-
for (let n = 0; n < t - 1; n++) e.push(0);
|
315
|
-
e.push(1);
|
316
|
-
let s = 1;
|
317
|
-
for (let n = 0; n < t; n++) {
|
318
|
-
for (let o = 0; o < e.length; o++)
|
319
|
-
e[o] = a.reedSolomonMultiply(e[o], s), o + 1 < e.length && (e[o] ^= e[o + 1]);
|
320
|
-
s = a.reedSolomonMultiply(s, 2);
|
321
|
-
}
|
322
|
-
return e;
|
323
|
-
}
|
324
|
-
// Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.
|
325
|
-
static reedSolomonComputeRemainder(t, e) {
|
326
|
-
const s = e.map((n) => 0);
|
327
|
-
for (const n of t) {
|
328
|
-
const o = n ^ s.shift();
|
329
|
-
s.push(0), e.forEach((r, i) => s[i] ^= a.reedSolomonMultiply(r, o));
|
330
|
-
}
|
331
|
-
return s;
|
332
|
-
}
|
333
|
-
// Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result
|
334
|
-
// are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.
|
335
|
-
static reedSolomonMultiply(t, e) {
|
336
|
-
if (t >>> 8 || e >>> 8) throw new RangeError("Byte out of range");
|
337
|
-
let s = 0;
|
338
|
-
for (let n = 7; n >= 0; n--)
|
339
|
-
s = s << 1 ^ (s >>> 7) * 285, s ^= (e >>> n & 1) * t;
|
340
|
-
return w(s >>> 8 == 0), s;
|
341
|
-
}
|
342
|
-
// Can only be called immediately after a light run is added, and
|
343
|
-
// returns either 0, 1, or 2. A helper function for getPenaltyScore().
|
344
|
-
finderPenaltyCountPatterns(t) {
|
345
|
-
const e = t[1];
|
346
|
-
w(e <= this.size * 3);
|
347
|
-
const s = e > 0 && t[2] == e && t[3] == e * 3 && t[4] == e && t[5] == e;
|
348
|
-
return (s && t[0] >= e * 4 && t[6] >= e ? 1 : 0) + (s && t[6] >= e * 4 && t[0] >= e ? 1 : 0);
|
349
|
-
}
|
350
|
-
// Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().
|
351
|
-
finderPenaltyTerminateAndCount(t, e, s) {
|
352
|
-
return t && (this.finderPenaltyAddHistory(e, s), e = 0), e += this.size, this.finderPenaltyAddHistory(e, s), this.finderPenaltyCountPatterns(s);
|
353
|
-
}
|
354
|
-
// Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().
|
355
|
-
finderPenaltyAddHistory(t, e) {
|
356
|
-
e[0] == 0 && (t += this.size), e.pop(), e.unshift(t);
|
357
|
-
}
|
358
|
-
};
|
359
|
-
/*-- Constants and tables --*/
|
360
|
-
// The minimum version number supported in the QR Code Model 2 standard.
|
361
|
-
f(a, "MIN_VERSION", 1), // The maximum version number supported in the QR Code Model 2 standard.
|
362
|
-
f(a, "MAX_VERSION", 40), // For use in getPenaltyScore(), when evaluating which mask is best.
|
363
|
-
f(a, "PENALTY_N1", 3), f(a, "PENALTY_N2", 3), f(a, "PENALTY_N3", 40), f(a, "PENALTY_N4", 10), f(a, "ECC_CODEWORDS_PER_BLOCK", [
|
364
|
-
// Version: (note that index 0 is for padding, and is set to an illegal value)
|
365
|
-
//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
|
366
|
-
[-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],
|
367
|
-
// Low
|
368
|
-
[-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],
|
369
|
-
// Medium
|
370
|
-
[-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],
|
371
|
-
// Quartile
|
372
|
-
[-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]
|
373
|
-
// High
|
374
|
-
]), f(a, "NUM_ERROR_CORRECTION_BLOCKS", [
|
375
|
-
// Version: (note that index 0 is for padding, and is set to an illegal value)
|
376
|
-
//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
|
377
|
-
[-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],
|
378
|
-
// Low
|
379
|
-
[-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],
|
380
|
-
// Medium
|
381
|
-
[-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],
|
382
|
-
// Quartile
|
383
|
-
[-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]
|
384
|
-
// High
|
385
|
-
]);
|
386
|
-
let B = a;
|
387
|
-
function M(c, t, e) {
|
388
|
-
if (t < 0 || t > 31 || c >>> t) throw new RangeError("Value out of range");
|
389
|
-
for (let s = t - 1; s >= 0; s--) e.push(c >>> s & 1);
|
390
|
-
}
|
391
|
-
function N(c, t) {
|
392
|
-
return (c >>> t & 1) != 0;
|
393
|
-
}
|
394
|
-
function w(c) {
|
395
|
-
if (!c) throw new Error("Assertion error");
|
396
|
-
}
|
397
|
-
const d = class d {
|
398
|
-
/*-- Static factory functions (mid level) --*/
|
399
|
-
// Returns a segment representing the given binary data encoded in
|
400
|
-
// byte mode. All input byte arrays are acceptable. Any text string
|
401
|
-
// can be converted to UTF-8 bytes and encoded as a byte mode segment.
|
402
|
-
static makeBytes(t) {
|
403
|
-
const e = [];
|
404
|
-
for (const s of t) M(s, 8, e);
|
405
|
-
return new d(I.BYTE, t.length, e);
|
406
|
-
}
|
407
|
-
// Returns a segment representing the given string of decimal digits encoded in numeric mode.
|
408
|
-
static makeNumeric(t) {
|
409
|
-
if (!d.isNumeric(t)) throw new RangeError("String contains non-numeric characters");
|
410
|
-
const e = [];
|
411
|
-
for (let s = 0; s < t.length; ) {
|
412
|
-
const n = Math.min(t.length - s, 3);
|
413
|
-
M(parseInt(t.substring(s, s + n), 10), n * 3 + 1, e), s += n;
|
414
|
-
}
|
415
|
-
return new d(I.NUMERIC, t.length, e);
|
416
|
-
}
|
417
|
-
// Returns a segment representing the given text string encoded in alphanumeric mode.
|
418
|
-
// The characters allowed are: 0 to 9, A to Z (uppercase only), space,
|
419
|
-
// dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
420
|
-
static makeAlphanumeric(t) {
|
421
|
-
if (!d.isAlphanumeric(t)) throw new RangeError("String contains unencodable characters in alphanumeric mode");
|
422
|
-
const e = [];
|
423
|
-
let s;
|
424
|
-
for (s = 0; s + 2 <= t.length; s += 2) {
|
425
|
-
let n = d.ALPHANUMERIC_CHARSET.indexOf(t.charAt(s)) * 45;
|
426
|
-
n += d.ALPHANUMERIC_CHARSET.indexOf(t.charAt(s + 1)), M(n, 11, e);
|
427
|
-
}
|
428
|
-
return s < t.length && M(d.ALPHANUMERIC_CHARSET.indexOf(t.charAt(s)), 6, e), new d(I.ALPHANUMERIC, t.length, e);
|
429
|
-
}
|
430
|
-
// Returns a new mutable list of zero or more segments to represent the given Unicode text string.
|
431
|
-
// The result may use various segment modes and switch modes to optimize the length of the bit stream.
|
432
|
-
static makeSegments(t) {
|
433
|
-
return t == "" ? [] : d.isNumeric(t) ? [d.makeNumeric(t)] : d.isAlphanumeric(t) ? [d.makeAlphanumeric(t)] : [d.makeBytes(d.toUtf8ByteArray(t))];
|
434
|
-
}
|
435
|
-
// Returns a segment representing an Extended Channel Interpretation
|
436
|
-
// (ECI) designator with the given assignment value.
|
437
|
-
static makeEci(t) {
|
438
|
-
const e = [];
|
439
|
-
if (t < 0) throw new RangeError("ECI assignment value out of range");
|
440
|
-
if (t < 128) M(t, 8, e);
|
441
|
-
else if (t < 16384)
|
442
|
-
M(2, 2, e), M(t, 14, e);
|
443
|
-
else if (t < 1e6)
|
444
|
-
M(6, 3, e), M(t, 21, e);
|
445
|
-
else throw new RangeError("ECI assignment value out of range");
|
446
|
-
return new d(I.ECI, 0, e);
|
447
|
-
}
|
448
|
-
// Tests whether the given string can be encoded as a segment in numeric mode.
|
449
|
-
// A string is encodable iff each character is in the range 0 to 9.
|
450
|
-
static isNumeric(t) {
|
451
|
-
return d.NUMERIC_REGEX.test(t);
|
452
|
-
}
|
453
|
-
// Tests whether the given string can be encoded as a segment in alphanumeric mode.
|
454
|
-
// A string is encodable iff each character is in the following set: 0 to 9, A to Z
|
455
|
-
// (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
456
|
-
static isAlphanumeric(t) {
|
457
|
-
return d.ALPHANUMERIC_REGEX.test(t);
|
458
|
-
}
|
459
|
-
/*-- Constructor (low level) and fields --*/
|
460
|
-
// Creates a new QR Code segment with the given attributes and data.
|
461
|
-
// The character count (numChars) must agree with the mode and the bit buffer length,
|
462
|
-
// but the constraint isn't checked. The given bit buffer is cloned and stored.
|
463
|
-
constructor(t, e, s) {
|
464
|
-
if (this.mode = t, this.numChars = e, this.bitData = s, e < 0) throw new RangeError("Invalid argument");
|
465
|
-
this.bitData = s.slice();
|
466
|
-
}
|
467
|
-
/*-- Methods --*/
|
468
|
-
// Returns a new copy of the data bits of this segment.
|
469
|
-
getData() {
|
470
|
-
return this.bitData.slice();
|
471
|
-
}
|
472
|
-
// (Package-private) Calculates and returns the number of bits needed to encode the given segments at
|
473
|
-
// the given version. The result is infinity if a segment has too many characters to fit its length field.
|
474
|
-
static getTotalBits(t, e) {
|
475
|
-
let s = 0;
|
476
|
-
for (const n of t) {
|
477
|
-
const o = n.mode.numCharCountBits(e);
|
478
|
-
if (n.numChars >= 1 << o) return 1 / 0;
|
479
|
-
s += 4 + o + n.bitData.length;
|
480
|
-
}
|
481
|
-
return s;
|
482
|
-
}
|
483
|
-
// Returns a new array of bytes representing the given string encoded in UTF-8.
|
484
|
-
static toUtf8ByteArray(t) {
|
485
|
-
t = encodeURI(t);
|
486
|
-
const e = [];
|
487
|
-
for (let s = 0; s < t.length; s++)
|
488
|
-
t.charAt(s) != "%" ? e.push(t.charCodeAt(s)) : (e.push(parseInt(t.substring(s + 1, s + 3), 16)), s += 2);
|
489
|
-
return e;
|
490
|
-
}
|
491
|
-
};
|
492
|
-
/*-- Constants --*/
|
493
|
-
// Describes precisely all strings that are encodable in numeric mode.
|
494
|
-
f(d, "NUMERIC_REGEX", /^[0-9]*$/), // Describes precisely all strings that are encodable in alphanumeric mode.
|
495
|
-
f(d, "ALPHANUMERIC_REGEX", /^[A-Z0-9 $%*+./:-]*$/), // The set of all legal characters in alphanumeric mode,
|
496
|
-
// where each character value maps to the index in the string.
|
497
|
-
f(d, "ALPHANUMERIC_CHARSET", "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:");
|
498
|
-
let P = d;
|
499
|
-
const A = class A {
|
500
|
-
// The QR Code can tolerate about 30% erroneous codewords
|
501
|
-
/*-- Constructor and fields --*/
|
502
|
-
constructor(t, e) {
|
503
|
-
this.ordinal = t, this.formatBits = e;
|
504
|
-
}
|
505
|
-
};
|
506
|
-
/*-- Constants --*/
|
507
|
-
f(A, "LOW", new A(0, 1)), // The QR Code can tolerate about 7% erroneous codewords
|
508
|
-
f(A, "MEDIUM", new A(1, 0)), // The QR Code can tolerate about 15% erroneous codewords
|
509
|
-
f(A, "QUARTILE", new A(2, 3)), // The QR Code can tolerate about 25% erroneous codewords
|
510
|
-
f(A, "HIGH", new A(3, 2));
|
511
|
-
let p = A;
|
512
|
-
const C = class C {
|
513
|
-
/*-- Constructor and fields --*/
|
514
|
-
constructor(t, e) {
|
515
|
-
this.modeBits = t, this.numBitsCharCount = e;
|
516
|
-
}
|
517
|
-
/*-- Method --*/
|
518
|
-
// (Package-private) Returns the bit width of the character count field for a segment in
|
519
|
-
// this mode in a QR Code at the given version number. The result is in the range [0, 16].
|
520
|
-
numCharCountBits(t) {
|
521
|
-
return this.numBitsCharCount[Math.floor((t + 7) / 17)];
|
522
|
-
}
|
523
|
-
};
|
524
|
-
/*-- Constants --*/
|
525
|
-
f(C, "NUMERIC", new C(1, [10, 12, 14])), f(C, "ALPHANUMERIC", new C(2, [9, 11, 13])), f(C, "BYTE", new C(4, [8, 16, 16])), f(C, "KANJI", new C(8, [8, 10, 12])), f(C, "ECI", new C(7, [0, 0, 0]));
|
526
|
-
let I = C;
|
527
|
-
const U = {
|
528
|
-
L: p.LOW,
|
529
|
-
M: p.MEDIUM,
|
530
|
-
Q: p.QUARTILE,
|
531
|
-
H: p.HIGH
|
532
|
-
}, z = 128, v = "L", k = "#000000", H = !1, Y = 1, $ = 4, G = 0;
|
533
|
-
function X(c, t = 0) {
|
534
|
-
const e = [];
|
535
|
-
return c.forEach(function(s, n) {
|
536
|
-
let o = null;
|
537
|
-
s.forEach(function(r, i) {
|
538
|
-
if (!r && o !== null) {
|
539
|
-
e.push(`M${o + t} ${n + t}h${i - o}v1H${o + t}z`), o = null;
|
540
|
-
return;
|
541
|
-
}
|
542
|
-
if (i === s.length - 1) {
|
543
|
-
if (!r)
|
544
|
-
return;
|
545
|
-
o === null ? e.push(`M${i + t},${n + t} h1v1H${i + t}z`) : e.push(`M${o + t},${n + t} h${i + 1 - o}v1H${o + t}z`);
|
546
|
-
return;
|
547
|
-
}
|
548
|
-
r && o === null && (o = i);
|
549
|
-
});
|
550
|
-
}), e.join("");
|
551
|
-
}
|
552
|
-
function V(c, t) {
|
553
|
-
return c.slice().map((e, s) => s < t.y || s >= t.y + t.h ? e : e.map((n, o) => o < t.x || o >= t.x + t.w ? n : !1));
|
554
|
-
}
|
555
|
-
function K(c, t, e, s) {
|
556
|
-
if (!s)
|
557
|
-
return null;
|
558
|
-
const n = (c.length + e * 2) / t, o = s * n, r = s * n, i = c.length / 2 - o / 2, u = c.length / 2 - r / 2, h = Math.floor(i), g = Math.floor(u), E = Math.ceil(o + i - h), l = Math.ceil(r + u - g);
|
559
|
-
return {
|
560
|
-
x: i,
|
561
|
-
y: u,
|
562
|
-
h: r,
|
563
|
-
w: o,
|
564
|
-
excavation: {
|
565
|
-
x: h,
|
566
|
-
y: g,
|
567
|
-
w: E,
|
568
|
-
h: l
|
569
|
-
}
|
570
|
-
};
|
571
|
-
}
|
572
|
-
function W(c, t) {
|
573
|
-
return t != null ? Math.max(Math.floor(t), 0) : c ? $ : G;
|
574
|
-
}
|
575
|
-
function j({
|
576
|
-
value: c,
|
577
|
-
level: t,
|
578
|
-
minVersion: e,
|
579
|
-
includeMargin: s,
|
580
|
-
marginSize: n,
|
581
|
-
logoSize: o,
|
582
|
-
size: r
|
583
|
-
}) {
|
584
|
-
const i = S(() => {
|
585
|
-
const l = P.makeSegments(c);
|
586
|
-
return B.encodeSegments(l, U[t], e);
|
587
|
-
}, [c, t, e]), {
|
588
|
-
cells: u,
|
589
|
-
margin: h,
|
590
|
-
numCells: g,
|
591
|
-
calculatedImageSettings: E
|
592
|
-
} = S(() => {
|
593
|
-
const l = i.getModules(), m = W(s, n), R = l.length + m * 2, L = K(l, r, m, o);
|
594
|
-
return {
|
595
|
-
cells: l,
|
596
|
-
margin: m,
|
597
|
-
numCells: R,
|
598
|
-
calculatedImageSettings: L
|
599
|
-
};
|
600
|
-
}, [i, r, o, s, n]);
|
601
|
-
return {
|
602
|
-
qrcode: i,
|
603
|
-
margin: h,
|
604
|
-
cells: u,
|
605
|
-
numCells: g,
|
606
|
-
calculatedImageSettings: E
|
607
|
-
};
|
608
|
-
}
|
609
|
-
function Z(c) {
|
610
|
-
const {
|
611
|
-
value: t,
|
612
|
-
size: e = z,
|
613
|
-
level: s = v,
|
614
|
-
color: n = k,
|
615
|
-
minVersion: o = Y,
|
616
|
-
title: r,
|
617
|
-
logoSize: i
|
618
|
-
} = c, u = void 0, {
|
619
|
-
margin: h,
|
620
|
-
cells: g,
|
621
|
-
numCells: E,
|
622
|
-
calculatedImageSettings: l
|
623
|
-
} = j({
|
624
|
-
value: t,
|
625
|
-
level: s,
|
626
|
-
minVersion: o,
|
627
|
-
includeMargin: H,
|
628
|
-
marginSize: u,
|
629
|
-
logoSize: i,
|
630
|
-
size: e
|
631
|
-
}), m = S(() => i && (l != null && l.excavation) ? V(g, l.excavation) : g, [l == null ? void 0 : l.excavation, g, i]), R = X(m, h);
|
632
|
-
return /* @__PURE__ */ O("svg", { height: e, width: e, viewBox: `0 0 ${E} ${E}`, role: "img", children: [
|
633
|
-
!!r && /* @__PURE__ */ b("title", { children: r }),
|
634
|
-
/* @__PURE__ */ b(D.path, { fill: n, d: R, shapeRendering: "crispEdges", initial: {
|
635
|
-
opacity: 0
|
636
|
-
}, animate: {
|
637
|
-
opacity: 2
|
638
|
-
}, exit: {
|
639
|
-
opacity: -1
|
640
|
-
} })
|
641
|
-
] });
|
642
|
-
}
|
643
|
-
const x = T(Z);
|
644
|
-
x.displayName = "Memo(QRCodeSVG)";
|
645
|
-
export {
|
646
|
-
x as default
|
647
|
-
};
|
648
|
-
//# sourceMappingURL=QRCodeSVG-D6VfGEbM.mjs.map
|