dsh-auth-remote 0.1.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 (94) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/CHANGELOG.zh-CN.md +16 -0
  3. package/CONTRIBUTING.md +23 -0
  4. package/CONTRIBUTING.zh-CN.md +23 -0
  5. package/LICENSE +21 -0
  6. package/README.md +65 -0
  7. package/README.zh-CN.md +65 -0
  8. package/cordis.patch.yml +45 -0
  9. package/dist/cli.js +1858 -0
  10. package/dist/cli.js.map +7 -0
  11. package/dist/client.js +3076 -0
  12. package/dist/client.js.map +7 -0
  13. package/dist/index.js +2473 -0
  14. package/dist/index.js.map +7 -0
  15. package/dist/login.css +230 -0
  16. package/dist/login.css.map +7 -0
  17. package/dist/login.js +2865 -0
  18. package/dist/login.js.map +7 -0
  19. package/dist/types/adapters/dsh/browser-auth.d.ts +8 -0
  20. package/dist/types/adapters/dsh/browser-auth.d.ts.map +1 -0
  21. package/dist/types/adapters/dsh/browser-capability.d.ts +8 -0
  22. package/dist/types/adapters/dsh/browser-capability.d.ts.map +1 -0
  23. package/dist/types/adapters/dsh/compatibility.d.ts +7 -0
  24. package/dist/types/adapters/dsh/compatibility.d.ts.map +1 -0
  25. package/dist/types/adapters/dsh/readiness.d.ts +22 -0
  26. package/dist/types/adapters/dsh/readiness.d.ts.map +1 -0
  27. package/dist/types/adapters/dsh/startup-urls.d.ts +4 -0
  28. package/dist/types/adapters/dsh/startup-urls.d.ts.map +1 -0
  29. package/dist/types/adapters/dsh/webserver.d.ts +36 -0
  30. package/dist/types/adapters/dsh/webserver.d.ts.map +1 -0
  31. package/dist/types/auth/password.d.ts +12 -0
  32. package/dist/types/auth/password.d.ts.map +1 -0
  33. package/dist/types/auth/service.d.ts +90 -0
  34. package/dist/types/auth/service.d.ts.map +1 -0
  35. package/dist/types/auth/sessions.d.ts +8 -0
  36. package/dist/types/auth/sessions.d.ts.map +1 -0
  37. package/dist/types/auth/totp.d.ts +10 -0
  38. package/dist/types/auth/totp.d.ts.map +1 -0
  39. package/dist/types/cli/index.d.ts +3 -0
  40. package/dist/types/cli/index.d.ts.map +1 -0
  41. package/dist/types/cli/ipc-client.d.ts +18 -0
  42. package/dist/types/cli/ipc-client.d.ts.map +1 -0
  43. package/dist/types/cli/language.d.ts +14 -0
  44. package/dist/types/cli/language.d.ts.map +1 -0
  45. package/dist/types/cli/profile.d.ts +10 -0
  46. package/dist/types/cli/profile.d.ts.map +1 -0
  47. package/dist/types/cli/prompt.d.ts +20 -0
  48. package/dist/types/cli/prompt.d.ts.map +1 -0
  49. package/dist/types/config.d.ts +27 -0
  50. package/dist/types/config.d.ts.map +1 -0
  51. package/dist/types/http/admin-socket.d.ts +18 -0
  52. package/dist/types/http/admin-socket.d.ts.map +1 -0
  53. package/dist/types/http/connections.d.ts +21 -0
  54. package/dist/types/http/connections.d.ts.map +1 -0
  55. package/dist/types/http/gate.d.ts +24 -0
  56. package/dist/types/http/gate.d.ts.map +1 -0
  57. package/dist/types/http/origin-policy.d.ts +35 -0
  58. package/dist/types/http/origin-policy.d.ts.map +1 -0
  59. package/dist/types/http/origin.d.ts +5 -0
  60. package/dist/types/http/origin.d.ts.map +1 -0
  61. package/dist/types/http/request-context.d.ts +5 -0
  62. package/dist/types/http/request-context.d.ts.map +1 -0
  63. package/dist/types/http/routes.d.ts +15 -0
  64. package/dist/types/http/routes.d.ts.map +1 -0
  65. package/dist/types/index.d.ts +33 -0
  66. package/dist/types/index.d.ts.map +1 -0
  67. package/dist/types/shared/admin-contract.d.ts +40 -0
  68. package/dist/types/shared/admin-contract.d.ts.map +1 -0
  69. package/dist/types/shared/auth-contract.d.ts +33 -0
  70. package/dist/types/shared/auth-contract.d.ts.map +1 -0
  71. package/dist/types/shared/i18n.d.ts +323 -0
  72. package/dist/types/shared/i18n.d.ts.map +1 -0
  73. package/dist/types/shared/locales/en.d.ts +151 -0
  74. package/dist/types/shared/locales/en.d.ts.map +1 -0
  75. package/dist/types/shared/locales/zh.d.ts +150 -0
  76. package/dist/types/shared/locales/zh.d.ts.map +1 -0
  77. package/dist/types/storage/lock.d.ts +17 -0
  78. package/dist/types/storage/lock.d.ts.map +1 -0
  79. package/dist/types/storage/state.d.ts +34 -0
  80. package/dist/types/storage/state.d.ts.map +1 -0
  81. package/dist/types/storage/store.d.ts +30 -0
  82. package/dist/types/storage/store.d.ts.map +1 -0
  83. package/docs/deployment.md +89 -0
  84. package/docs/deployment.zh-CN.md +89 -0
  85. package/docs/development.md +43 -0
  86. package/docs/development.zh-CN.md +43 -0
  87. package/docs/releasing.md +44 -0
  88. package/docs/releasing.zh-CN.md +44 -0
  89. package/docs/reverse-proxy.md +27 -0
  90. package/docs/reverse-proxy.zh-CN.md +27 -0
  91. package/examples/nginx.conf +27 -0
  92. package/examples/traefik-dsh.yml +20 -0
  93. package/examples/web-profile-auth-remote.patch.yml +14 -0
  94. package/package.json +112 -0
package/dist/login.js ADDED
@@ -0,0 +1,2865 @@
1
+ "use strict";
2
+ (() => {
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __commonJS = (cb, mod) => function __require() {
10
+ try {
11
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
+ } catch (e) {
13
+ throw mod = 0, e;
14
+ }
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from))
19
+ if (!__hasOwnProp.call(to, key) && key !== except)
20
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
+ mod
31
+ ));
32
+
33
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/can-promise.js
34
+ var require_can_promise = __commonJS({
35
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/can-promise.js"(exports, module) {
36
+ "use strict";
37
+ module.exports = function() {
38
+ return typeof Promise === "function" && Promise.prototype && Promise.prototype.then;
39
+ };
40
+ }
41
+ });
42
+
43
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js
44
+ var require_utils = __commonJS({
45
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js"(exports) {
46
+ "use strict";
47
+ var toSJISFunction;
48
+ var CODEWORDS_COUNT = [
49
+ 0,
50
+ // Not used
51
+ 26,
52
+ 44,
53
+ 70,
54
+ 100,
55
+ 134,
56
+ 172,
57
+ 196,
58
+ 242,
59
+ 292,
60
+ 346,
61
+ 404,
62
+ 466,
63
+ 532,
64
+ 581,
65
+ 655,
66
+ 733,
67
+ 815,
68
+ 901,
69
+ 991,
70
+ 1085,
71
+ 1156,
72
+ 1258,
73
+ 1364,
74
+ 1474,
75
+ 1588,
76
+ 1706,
77
+ 1828,
78
+ 1921,
79
+ 2051,
80
+ 2185,
81
+ 2323,
82
+ 2465,
83
+ 2611,
84
+ 2761,
85
+ 2876,
86
+ 3034,
87
+ 3196,
88
+ 3362,
89
+ 3532,
90
+ 3706
91
+ ];
92
+ exports.getSymbolSize = function getSymbolSize(version) {
93
+ if (!version) throw new Error('"version" cannot be null or undefined');
94
+ if (version < 1 || version > 40) throw new Error('"version" should be in range from 1 to 40');
95
+ return version * 4 + 17;
96
+ };
97
+ exports.getSymbolTotalCodewords = function getSymbolTotalCodewords(version) {
98
+ return CODEWORDS_COUNT[version];
99
+ };
100
+ exports.getBCHDigit = function(data) {
101
+ let digit = 0;
102
+ while (data !== 0) {
103
+ digit++;
104
+ data >>>= 1;
105
+ }
106
+ return digit;
107
+ };
108
+ exports.setToSJISFunction = function setToSJISFunction(f) {
109
+ if (typeof f !== "function") {
110
+ throw new Error('"toSJISFunc" is not a valid function.');
111
+ }
112
+ toSJISFunction = f;
113
+ };
114
+ exports.isKanjiModeEnabled = function() {
115
+ return typeof toSJISFunction !== "undefined";
116
+ };
117
+ exports.toSJIS = function toSJIS(kanji) {
118
+ return toSJISFunction(kanji);
119
+ };
120
+ }
121
+ });
122
+
123
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-level.js
124
+ var require_error_correction_level = __commonJS({
125
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-level.js"(exports) {
126
+ "use strict";
127
+ exports.L = { bit: 1 };
128
+ exports.M = { bit: 0 };
129
+ exports.Q = { bit: 3 };
130
+ exports.H = { bit: 2 };
131
+ function fromString(string) {
132
+ if (typeof string !== "string") {
133
+ throw new Error("Param is not a string");
134
+ }
135
+ const lcStr = string.toLowerCase();
136
+ switch (lcStr) {
137
+ case "l":
138
+ case "low":
139
+ return exports.L;
140
+ case "m":
141
+ case "medium":
142
+ return exports.M;
143
+ case "q":
144
+ case "quartile":
145
+ return exports.Q;
146
+ case "h":
147
+ case "high":
148
+ return exports.H;
149
+ default:
150
+ throw new Error("Unknown EC Level: " + string);
151
+ }
152
+ }
153
+ exports.isValid = function isValid(level) {
154
+ return level && typeof level.bit !== "undefined" && level.bit >= 0 && level.bit < 4;
155
+ };
156
+ exports.from = function from(value, defaultValue) {
157
+ if (exports.isValid(value)) {
158
+ return value;
159
+ }
160
+ try {
161
+ return fromString(value);
162
+ } catch (e) {
163
+ return defaultValue;
164
+ }
165
+ };
166
+ }
167
+ });
168
+
169
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-buffer.js
170
+ var require_bit_buffer = __commonJS({
171
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-buffer.js"(exports, module) {
172
+ "use strict";
173
+ function BitBuffer() {
174
+ this.buffer = [];
175
+ this.length = 0;
176
+ }
177
+ BitBuffer.prototype = {
178
+ get: function(index) {
179
+ const bufIndex = Math.floor(index / 8);
180
+ return (this.buffer[bufIndex] >>> 7 - index % 8 & 1) === 1;
181
+ },
182
+ put: function(num, length) {
183
+ for (let i = 0; i < length; i++) {
184
+ this.putBit((num >>> length - i - 1 & 1) === 1);
185
+ }
186
+ },
187
+ getLengthInBits: function() {
188
+ return this.length;
189
+ },
190
+ putBit: function(bit) {
191
+ const bufIndex = Math.floor(this.length / 8);
192
+ if (this.buffer.length <= bufIndex) {
193
+ this.buffer.push(0);
194
+ }
195
+ if (bit) {
196
+ this.buffer[bufIndex] |= 128 >>> this.length % 8;
197
+ }
198
+ this.length++;
199
+ }
200
+ };
201
+ module.exports = BitBuffer;
202
+ }
203
+ });
204
+
205
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-matrix.js
206
+ var require_bit_matrix = __commonJS({
207
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-matrix.js"(exports, module) {
208
+ "use strict";
209
+ function BitMatrix(size) {
210
+ if (!size || size < 1) {
211
+ throw new Error("BitMatrix size must be defined and greater than 0");
212
+ }
213
+ this.size = size;
214
+ this.data = new Uint8Array(size * size);
215
+ this.reservedBit = new Uint8Array(size * size);
216
+ }
217
+ BitMatrix.prototype.set = function(row, col, value, reserved) {
218
+ const index = row * this.size + col;
219
+ this.data[index] = value;
220
+ if (reserved) this.reservedBit[index] = true;
221
+ };
222
+ BitMatrix.prototype.get = function(row, col) {
223
+ return this.data[row * this.size + col];
224
+ };
225
+ BitMatrix.prototype.xor = function(row, col, value) {
226
+ this.data[row * this.size + col] ^= value;
227
+ };
228
+ BitMatrix.prototype.isReserved = function(row, col) {
229
+ return this.reservedBit[row * this.size + col];
230
+ };
231
+ module.exports = BitMatrix;
232
+ }
233
+ });
234
+
235
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alignment-pattern.js
236
+ var require_alignment_pattern = __commonJS({
237
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alignment-pattern.js"(exports) {
238
+ "use strict";
239
+ var getSymbolSize = require_utils().getSymbolSize;
240
+ exports.getRowColCoords = function getRowColCoords(version) {
241
+ if (version === 1) return [];
242
+ const posCount = Math.floor(version / 7) + 2;
243
+ const size = getSymbolSize(version);
244
+ const intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2;
245
+ const positions = [size - 7];
246
+ for (let i = 1; i < posCount - 1; i++) {
247
+ positions[i] = positions[i - 1] - intervals;
248
+ }
249
+ positions.push(6);
250
+ return positions.reverse();
251
+ };
252
+ exports.getPositions = function getPositions(version) {
253
+ const coords = [];
254
+ const pos = exports.getRowColCoords(version);
255
+ const posLength = pos.length;
256
+ for (let i = 0; i < posLength; i++) {
257
+ for (let j = 0; j < posLength; j++) {
258
+ if (i === 0 && j === 0 || // top-left
259
+ i === 0 && j === posLength - 1 || // bottom-left
260
+ i === posLength - 1 && j === 0) {
261
+ continue;
262
+ }
263
+ coords.push([pos[i], pos[j]]);
264
+ }
265
+ }
266
+ return coords;
267
+ };
268
+ }
269
+ });
270
+
271
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/finder-pattern.js
272
+ var require_finder_pattern = __commonJS({
273
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/finder-pattern.js"(exports) {
274
+ "use strict";
275
+ var getSymbolSize = require_utils().getSymbolSize;
276
+ var FINDER_PATTERN_SIZE = 7;
277
+ exports.getPositions = function getPositions(version) {
278
+ const size = getSymbolSize(version);
279
+ return [
280
+ // top-left
281
+ [0, 0],
282
+ // top-right
283
+ [size - FINDER_PATTERN_SIZE, 0],
284
+ // bottom-left
285
+ [0, size - FINDER_PATTERN_SIZE]
286
+ ];
287
+ };
288
+ }
289
+ });
290
+
291
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mask-pattern.js
292
+ var require_mask_pattern = __commonJS({
293
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mask-pattern.js"(exports) {
294
+ "use strict";
295
+ exports.Patterns = {
296
+ PATTERN000: 0,
297
+ PATTERN001: 1,
298
+ PATTERN010: 2,
299
+ PATTERN011: 3,
300
+ PATTERN100: 4,
301
+ PATTERN101: 5,
302
+ PATTERN110: 6,
303
+ PATTERN111: 7
304
+ };
305
+ var PenaltyScores = {
306
+ N1: 3,
307
+ N2: 3,
308
+ N3: 40,
309
+ N4: 10
310
+ };
311
+ exports.isValid = function isValid(mask) {
312
+ return mask != null && mask !== "" && !isNaN(mask) && mask >= 0 && mask <= 7;
313
+ };
314
+ exports.from = function from(value) {
315
+ return exports.isValid(value) ? parseInt(value, 10) : void 0;
316
+ };
317
+ exports.getPenaltyN1 = function getPenaltyN1(data) {
318
+ const size = data.size;
319
+ let points = 0;
320
+ let sameCountCol = 0;
321
+ let sameCountRow = 0;
322
+ let lastCol = null;
323
+ let lastRow = null;
324
+ for (let row = 0; row < size; row++) {
325
+ sameCountCol = sameCountRow = 0;
326
+ lastCol = lastRow = null;
327
+ for (let col = 0; col < size; col++) {
328
+ let module2 = data.get(row, col);
329
+ if (module2 === lastCol) {
330
+ sameCountCol++;
331
+ } else {
332
+ if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);
333
+ lastCol = module2;
334
+ sameCountCol = 1;
335
+ }
336
+ module2 = data.get(col, row);
337
+ if (module2 === lastRow) {
338
+ sameCountRow++;
339
+ } else {
340
+ if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);
341
+ lastRow = module2;
342
+ sameCountRow = 1;
343
+ }
344
+ }
345
+ if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);
346
+ if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);
347
+ }
348
+ return points;
349
+ };
350
+ exports.getPenaltyN2 = function getPenaltyN2(data) {
351
+ const size = data.size;
352
+ let points = 0;
353
+ for (let row = 0; row < size - 1; row++) {
354
+ for (let col = 0; col < size - 1; col++) {
355
+ const last = data.get(row, col) + data.get(row, col + 1) + data.get(row + 1, col) + data.get(row + 1, col + 1);
356
+ if (last === 4 || last === 0) points++;
357
+ }
358
+ }
359
+ return points * PenaltyScores.N2;
360
+ };
361
+ exports.getPenaltyN3 = function getPenaltyN3(data) {
362
+ const size = data.size;
363
+ let points = 0;
364
+ let bitsCol = 0;
365
+ let bitsRow = 0;
366
+ for (let row = 0; row < size; row++) {
367
+ bitsCol = bitsRow = 0;
368
+ for (let col = 0; col < size; col++) {
369
+ bitsCol = bitsCol << 1 & 2047 | data.get(row, col);
370
+ if (col >= 10 && (bitsCol === 1488 || bitsCol === 93)) points++;
371
+ bitsRow = bitsRow << 1 & 2047 | data.get(col, row);
372
+ if (col >= 10 && (bitsRow === 1488 || bitsRow === 93)) points++;
373
+ }
374
+ }
375
+ return points * PenaltyScores.N3;
376
+ };
377
+ exports.getPenaltyN4 = function getPenaltyN4(data) {
378
+ let darkCount = 0;
379
+ const modulesCount = data.data.length;
380
+ for (let i = 0; i < modulesCount; i++) darkCount += data.data[i];
381
+ const k = Math.abs(Math.ceil(darkCount * 100 / modulesCount / 5) - 10);
382
+ return k * PenaltyScores.N4;
383
+ };
384
+ function getMaskAt(maskPattern, i, j) {
385
+ switch (maskPattern) {
386
+ case exports.Patterns.PATTERN000:
387
+ return (i + j) % 2 === 0;
388
+ case exports.Patterns.PATTERN001:
389
+ return i % 2 === 0;
390
+ case exports.Patterns.PATTERN010:
391
+ return j % 3 === 0;
392
+ case exports.Patterns.PATTERN011:
393
+ return (i + j) % 3 === 0;
394
+ case exports.Patterns.PATTERN100:
395
+ return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0;
396
+ case exports.Patterns.PATTERN101:
397
+ return i * j % 2 + i * j % 3 === 0;
398
+ case exports.Patterns.PATTERN110:
399
+ return (i * j % 2 + i * j % 3) % 2 === 0;
400
+ case exports.Patterns.PATTERN111:
401
+ return (i * j % 3 + (i + j) % 2) % 2 === 0;
402
+ default:
403
+ throw new Error("bad maskPattern:" + maskPattern);
404
+ }
405
+ }
406
+ exports.applyMask = function applyMask(pattern, data) {
407
+ const size = data.size;
408
+ for (let col = 0; col < size; col++) {
409
+ for (let row = 0; row < size; row++) {
410
+ if (data.isReserved(row, col)) continue;
411
+ data.xor(row, col, getMaskAt(pattern, row, col));
412
+ }
413
+ }
414
+ };
415
+ exports.getBestMask = function getBestMask(data, setupFormatFunc) {
416
+ const numPatterns = Object.keys(exports.Patterns).length;
417
+ let bestPattern = 0;
418
+ let lowerPenalty = Infinity;
419
+ for (let p = 0; p < numPatterns; p++) {
420
+ setupFormatFunc(p);
421
+ exports.applyMask(p, data);
422
+ const penalty = exports.getPenaltyN1(data) + exports.getPenaltyN2(data) + exports.getPenaltyN3(data) + exports.getPenaltyN4(data);
423
+ exports.applyMask(p, data);
424
+ if (penalty < lowerPenalty) {
425
+ lowerPenalty = penalty;
426
+ bestPattern = p;
427
+ }
428
+ }
429
+ return bestPattern;
430
+ };
431
+ }
432
+ });
433
+
434
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-code.js
435
+ var require_error_correction_code = __commonJS({
436
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-code.js"(exports) {
437
+ "use strict";
438
+ var ECLevel = require_error_correction_level();
439
+ var EC_BLOCKS_TABLE = [
440
+ // L M Q H
441
+ 1,
442
+ 1,
443
+ 1,
444
+ 1,
445
+ 1,
446
+ 1,
447
+ 1,
448
+ 1,
449
+ 1,
450
+ 1,
451
+ 2,
452
+ 2,
453
+ 1,
454
+ 2,
455
+ 2,
456
+ 4,
457
+ 1,
458
+ 2,
459
+ 4,
460
+ 4,
461
+ 2,
462
+ 4,
463
+ 4,
464
+ 4,
465
+ 2,
466
+ 4,
467
+ 6,
468
+ 5,
469
+ 2,
470
+ 4,
471
+ 6,
472
+ 6,
473
+ 2,
474
+ 5,
475
+ 8,
476
+ 8,
477
+ 4,
478
+ 5,
479
+ 8,
480
+ 8,
481
+ 4,
482
+ 5,
483
+ 8,
484
+ 11,
485
+ 4,
486
+ 8,
487
+ 10,
488
+ 11,
489
+ 4,
490
+ 9,
491
+ 12,
492
+ 16,
493
+ 4,
494
+ 9,
495
+ 16,
496
+ 16,
497
+ 6,
498
+ 10,
499
+ 12,
500
+ 18,
501
+ 6,
502
+ 10,
503
+ 17,
504
+ 16,
505
+ 6,
506
+ 11,
507
+ 16,
508
+ 19,
509
+ 6,
510
+ 13,
511
+ 18,
512
+ 21,
513
+ 7,
514
+ 14,
515
+ 21,
516
+ 25,
517
+ 8,
518
+ 16,
519
+ 20,
520
+ 25,
521
+ 8,
522
+ 17,
523
+ 23,
524
+ 25,
525
+ 9,
526
+ 17,
527
+ 23,
528
+ 34,
529
+ 9,
530
+ 18,
531
+ 25,
532
+ 30,
533
+ 10,
534
+ 20,
535
+ 27,
536
+ 32,
537
+ 12,
538
+ 21,
539
+ 29,
540
+ 35,
541
+ 12,
542
+ 23,
543
+ 34,
544
+ 37,
545
+ 12,
546
+ 25,
547
+ 34,
548
+ 40,
549
+ 13,
550
+ 26,
551
+ 35,
552
+ 42,
553
+ 14,
554
+ 28,
555
+ 38,
556
+ 45,
557
+ 15,
558
+ 29,
559
+ 40,
560
+ 48,
561
+ 16,
562
+ 31,
563
+ 43,
564
+ 51,
565
+ 17,
566
+ 33,
567
+ 45,
568
+ 54,
569
+ 18,
570
+ 35,
571
+ 48,
572
+ 57,
573
+ 19,
574
+ 37,
575
+ 51,
576
+ 60,
577
+ 19,
578
+ 38,
579
+ 53,
580
+ 63,
581
+ 20,
582
+ 40,
583
+ 56,
584
+ 66,
585
+ 21,
586
+ 43,
587
+ 59,
588
+ 70,
589
+ 22,
590
+ 45,
591
+ 62,
592
+ 74,
593
+ 24,
594
+ 47,
595
+ 65,
596
+ 77,
597
+ 25,
598
+ 49,
599
+ 68,
600
+ 81
601
+ ];
602
+ var EC_CODEWORDS_TABLE = [
603
+ // L M Q H
604
+ 7,
605
+ 10,
606
+ 13,
607
+ 17,
608
+ 10,
609
+ 16,
610
+ 22,
611
+ 28,
612
+ 15,
613
+ 26,
614
+ 36,
615
+ 44,
616
+ 20,
617
+ 36,
618
+ 52,
619
+ 64,
620
+ 26,
621
+ 48,
622
+ 72,
623
+ 88,
624
+ 36,
625
+ 64,
626
+ 96,
627
+ 112,
628
+ 40,
629
+ 72,
630
+ 108,
631
+ 130,
632
+ 48,
633
+ 88,
634
+ 132,
635
+ 156,
636
+ 60,
637
+ 110,
638
+ 160,
639
+ 192,
640
+ 72,
641
+ 130,
642
+ 192,
643
+ 224,
644
+ 80,
645
+ 150,
646
+ 224,
647
+ 264,
648
+ 96,
649
+ 176,
650
+ 260,
651
+ 308,
652
+ 104,
653
+ 198,
654
+ 288,
655
+ 352,
656
+ 120,
657
+ 216,
658
+ 320,
659
+ 384,
660
+ 132,
661
+ 240,
662
+ 360,
663
+ 432,
664
+ 144,
665
+ 280,
666
+ 408,
667
+ 480,
668
+ 168,
669
+ 308,
670
+ 448,
671
+ 532,
672
+ 180,
673
+ 338,
674
+ 504,
675
+ 588,
676
+ 196,
677
+ 364,
678
+ 546,
679
+ 650,
680
+ 224,
681
+ 416,
682
+ 600,
683
+ 700,
684
+ 224,
685
+ 442,
686
+ 644,
687
+ 750,
688
+ 252,
689
+ 476,
690
+ 690,
691
+ 816,
692
+ 270,
693
+ 504,
694
+ 750,
695
+ 900,
696
+ 300,
697
+ 560,
698
+ 810,
699
+ 960,
700
+ 312,
701
+ 588,
702
+ 870,
703
+ 1050,
704
+ 336,
705
+ 644,
706
+ 952,
707
+ 1110,
708
+ 360,
709
+ 700,
710
+ 1020,
711
+ 1200,
712
+ 390,
713
+ 728,
714
+ 1050,
715
+ 1260,
716
+ 420,
717
+ 784,
718
+ 1140,
719
+ 1350,
720
+ 450,
721
+ 812,
722
+ 1200,
723
+ 1440,
724
+ 480,
725
+ 868,
726
+ 1290,
727
+ 1530,
728
+ 510,
729
+ 924,
730
+ 1350,
731
+ 1620,
732
+ 540,
733
+ 980,
734
+ 1440,
735
+ 1710,
736
+ 570,
737
+ 1036,
738
+ 1530,
739
+ 1800,
740
+ 570,
741
+ 1064,
742
+ 1590,
743
+ 1890,
744
+ 600,
745
+ 1120,
746
+ 1680,
747
+ 1980,
748
+ 630,
749
+ 1204,
750
+ 1770,
751
+ 2100,
752
+ 660,
753
+ 1260,
754
+ 1860,
755
+ 2220,
756
+ 720,
757
+ 1316,
758
+ 1950,
759
+ 2310,
760
+ 750,
761
+ 1372,
762
+ 2040,
763
+ 2430
764
+ ];
765
+ exports.getBlocksCount = function getBlocksCount(version, errorCorrectionLevel) {
766
+ switch (errorCorrectionLevel) {
767
+ case ECLevel.L:
768
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 0];
769
+ case ECLevel.M:
770
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 1];
771
+ case ECLevel.Q:
772
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 2];
773
+ case ECLevel.H:
774
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 3];
775
+ default:
776
+ return void 0;
777
+ }
778
+ };
779
+ exports.getTotalCodewordsCount = function getTotalCodewordsCount(version, errorCorrectionLevel) {
780
+ switch (errorCorrectionLevel) {
781
+ case ECLevel.L:
782
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0];
783
+ case ECLevel.M:
784
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1];
785
+ case ECLevel.Q:
786
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2];
787
+ case ECLevel.H:
788
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3];
789
+ default:
790
+ return void 0;
791
+ }
792
+ };
793
+ }
794
+ });
795
+
796
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/galois-field.js
797
+ var require_galois_field = __commonJS({
798
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/galois-field.js"(exports) {
799
+ "use strict";
800
+ var EXP_TABLE = new Uint8Array(512);
801
+ var LOG_TABLE = new Uint8Array(256);
802
+ (function initTables() {
803
+ let x = 1;
804
+ for (let i = 0; i < 255; i++) {
805
+ EXP_TABLE[i] = x;
806
+ LOG_TABLE[x] = i;
807
+ x <<= 1;
808
+ if (x & 256) {
809
+ x ^= 285;
810
+ }
811
+ }
812
+ for (let i = 255; i < 512; i++) {
813
+ EXP_TABLE[i] = EXP_TABLE[i - 255];
814
+ }
815
+ })();
816
+ exports.log = function log(n) {
817
+ if (n < 1) throw new Error("log(" + n + ")");
818
+ return LOG_TABLE[n];
819
+ };
820
+ exports.exp = function exp(n) {
821
+ return EXP_TABLE[n];
822
+ };
823
+ exports.mul = function mul(x, y) {
824
+ if (x === 0 || y === 0) return 0;
825
+ return EXP_TABLE[LOG_TABLE[x] + LOG_TABLE[y]];
826
+ };
827
+ }
828
+ });
829
+
830
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/polynomial.js
831
+ var require_polynomial = __commonJS({
832
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/polynomial.js"(exports) {
833
+ "use strict";
834
+ var GF = require_galois_field();
835
+ exports.mul = function mul(p1, p2) {
836
+ const coeff = new Uint8Array(p1.length + p2.length - 1);
837
+ for (let i = 0; i < p1.length; i++) {
838
+ for (let j = 0; j < p2.length; j++) {
839
+ coeff[i + j] ^= GF.mul(p1[i], p2[j]);
840
+ }
841
+ }
842
+ return coeff;
843
+ };
844
+ exports.mod = function mod(divident, divisor) {
845
+ let result = new Uint8Array(divident);
846
+ while (result.length - divisor.length >= 0) {
847
+ const coeff = result[0];
848
+ for (let i = 0; i < divisor.length; i++) {
849
+ result[i] ^= GF.mul(divisor[i], coeff);
850
+ }
851
+ let offset = 0;
852
+ while (offset < result.length && result[offset] === 0) offset++;
853
+ result = result.slice(offset);
854
+ }
855
+ return result;
856
+ };
857
+ exports.generateECPolynomial = function generateECPolynomial(degree) {
858
+ let poly = new Uint8Array([1]);
859
+ for (let i = 0; i < degree; i++) {
860
+ poly = exports.mul(poly, new Uint8Array([1, GF.exp(i)]));
861
+ }
862
+ return poly;
863
+ };
864
+ }
865
+ });
866
+
867
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/reed-solomon-encoder.js
868
+ var require_reed_solomon_encoder = __commonJS({
869
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/reed-solomon-encoder.js"(exports, module) {
870
+ "use strict";
871
+ var Polynomial = require_polynomial();
872
+ function ReedSolomonEncoder(degree) {
873
+ this.genPoly = void 0;
874
+ this.degree = degree;
875
+ if (this.degree) this.initialize(this.degree);
876
+ }
877
+ ReedSolomonEncoder.prototype.initialize = function initialize(degree) {
878
+ this.degree = degree;
879
+ this.genPoly = Polynomial.generateECPolynomial(this.degree);
880
+ };
881
+ ReedSolomonEncoder.prototype.encode = function encode(data) {
882
+ if (!this.genPoly) {
883
+ throw new Error("Encoder not initialized");
884
+ }
885
+ const paddedData = new Uint8Array(data.length + this.degree);
886
+ paddedData.set(data);
887
+ const remainder = Polynomial.mod(paddedData, this.genPoly);
888
+ const start2 = this.degree - remainder.length;
889
+ if (start2 > 0) {
890
+ const buff = new Uint8Array(this.degree);
891
+ buff.set(remainder, start2);
892
+ return buff;
893
+ }
894
+ return remainder;
895
+ };
896
+ module.exports = ReedSolomonEncoder;
897
+ }
898
+ });
899
+
900
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version-check.js
901
+ var require_version_check = __commonJS({
902
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version-check.js"(exports) {
903
+ "use strict";
904
+ exports.isValid = function isValid(version) {
905
+ return !isNaN(version) && version >= 1 && version <= 40;
906
+ };
907
+ }
908
+ });
909
+
910
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/regex.js
911
+ var require_regex = __commonJS({
912
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/regex.js"(exports) {
913
+ "use strict";
914
+ var numeric = "[0-9]+";
915
+ var alphanumeric = "[A-Z $%*+\\-./:]+";
916
+ var kanji = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
917
+ kanji = kanji.replace(/u/g, "\\u");
918
+ var byte = "(?:(?![A-Z0-9 $%*+\\-./:]|" + kanji + ")(?:.|[\r\n]))+";
919
+ exports.KANJI = new RegExp(kanji, "g");
920
+ exports.BYTE_KANJI = new RegExp("[^A-Z0-9 $%*+\\-./:]+", "g");
921
+ exports.BYTE = new RegExp(byte, "g");
922
+ exports.NUMERIC = new RegExp(numeric, "g");
923
+ exports.ALPHANUMERIC = new RegExp(alphanumeric, "g");
924
+ var TEST_KANJI = new RegExp("^" + kanji + "$");
925
+ var TEST_NUMERIC = new RegExp("^" + numeric + "$");
926
+ var TEST_ALPHANUMERIC = new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
927
+ exports.testKanji = function testKanji(str) {
928
+ return TEST_KANJI.test(str);
929
+ };
930
+ exports.testNumeric = function testNumeric(str) {
931
+ return TEST_NUMERIC.test(str);
932
+ };
933
+ exports.testAlphanumeric = function testAlphanumeric(str) {
934
+ return TEST_ALPHANUMERIC.test(str);
935
+ };
936
+ }
937
+ });
938
+
939
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js
940
+ var require_mode = __commonJS({
941
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js"(exports) {
942
+ "use strict";
943
+ var VersionCheck = require_version_check();
944
+ var Regex = require_regex();
945
+ exports.NUMERIC = {
946
+ id: "Numeric",
947
+ bit: 1 << 0,
948
+ ccBits: [10, 12, 14]
949
+ };
950
+ exports.ALPHANUMERIC = {
951
+ id: "Alphanumeric",
952
+ bit: 1 << 1,
953
+ ccBits: [9, 11, 13]
954
+ };
955
+ exports.BYTE = {
956
+ id: "Byte",
957
+ bit: 1 << 2,
958
+ ccBits: [8, 16, 16]
959
+ };
960
+ exports.KANJI = {
961
+ id: "Kanji",
962
+ bit: 1 << 3,
963
+ ccBits: [8, 10, 12]
964
+ };
965
+ exports.MIXED = {
966
+ bit: -1
967
+ };
968
+ exports.getCharCountIndicator = function getCharCountIndicator(mode, version) {
969
+ if (!mode.ccBits) throw new Error("Invalid mode: " + mode);
970
+ if (!VersionCheck.isValid(version)) {
971
+ throw new Error("Invalid version: " + version);
972
+ }
973
+ if (version >= 1 && version < 10) return mode.ccBits[0];
974
+ else if (version < 27) return mode.ccBits[1];
975
+ return mode.ccBits[2];
976
+ };
977
+ exports.getBestModeForData = function getBestModeForData(dataStr) {
978
+ if (Regex.testNumeric(dataStr)) return exports.NUMERIC;
979
+ else if (Regex.testAlphanumeric(dataStr)) return exports.ALPHANUMERIC;
980
+ else if (Regex.testKanji(dataStr)) return exports.KANJI;
981
+ else return exports.BYTE;
982
+ };
983
+ exports.toString = function toString(mode) {
984
+ if (mode && mode.id) return mode.id;
985
+ throw new Error("Invalid mode");
986
+ };
987
+ exports.isValid = function isValid(mode) {
988
+ return mode && mode.bit && mode.ccBits;
989
+ };
990
+ function fromString(string) {
991
+ if (typeof string !== "string") {
992
+ throw new Error("Param is not a string");
993
+ }
994
+ const lcStr = string.toLowerCase();
995
+ switch (lcStr) {
996
+ case "numeric":
997
+ return exports.NUMERIC;
998
+ case "alphanumeric":
999
+ return exports.ALPHANUMERIC;
1000
+ case "kanji":
1001
+ return exports.KANJI;
1002
+ case "byte":
1003
+ return exports.BYTE;
1004
+ default:
1005
+ throw new Error("Unknown mode: " + string);
1006
+ }
1007
+ }
1008
+ exports.from = function from(value, defaultValue) {
1009
+ if (exports.isValid(value)) {
1010
+ return value;
1011
+ }
1012
+ try {
1013
+ return fromString(value);
1014
+ } catch (e) {
1015
+ return defaultValue;
1016
+ }
1017
+ };
1018
+ }
1019
+ });
1020
+
1021
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version.js
1022
+ var require_version = __commonJS({
1023
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version.js"(exports) {
1024
+ "use strict";
1025
+ var Utils = require_utils();
1026
+ var ECCode = require_error_correction_code();
1027
+ var ECLevel = require_error_correction_level();
1028
+ var Mode = require_mode();
1029
+ var VersionCheck = require_version_check();
1030
+ var G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
1031
+ var G18_BCH = Utils.getBCHDigit(G18);
1032
+ function getBestVersionForDataLength(mode, length, errorCorrectionLevel) {
1033
+ for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
1034
+ if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode)) {
1035
+ return currentVersion;
1036
+ }
1037
+ }
1038
+ return void 0;
1039
+ }
1040
+ function getReservedBitsCount(mode, version) {
1041
+ return Mode.getCharCountIndicator(mode, version) + 4;
1042
+ }
1043
+ function getTotalBitsFromDataArray(segments, version) {
1044
+ let totalBits = 0;
1045
+ segments.forEach(function(data) {
1046
+ const reservedBits = getReservedBitsCount(data.mode, version);
1047
+ totalBits += reservedBits + data.getBitsLength();
1048
+ });
1049
+ return totalBits;
1050
+ }
1051
+ function getBestVersionForMixedData(segments, errorCorrectionLevel) {
1052
+ for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
1053
+ const length = getTotalBitsFromDataArray(segments, currentVersion);
1054
+ if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, Mode.MIXED)) {
1055
+ return currentVersion;
1056
+ }
1057
+ }
1058
+ return void 0;
1059
+ }
1060
+ exports.from = function from(value, defaultValue) {
1061
+ if (VersionCheck.isValid(value)) {
1062
+ return parseInt(value, 10);
1063
+ }
1064
+ return defaultValue;
1065
+ };
1066
+ exports.getCapacity = function getCapacity(version, errorCorrectionLevel, mode) {
1067
+ if (!VersionCheck.isValid(version)) {
1068
+ throw new Error("Invalid QR Code version");
1069
+ }
1070
+ if (typeof mode === "undefined") mode = Mode.BYTE;
1071
+ const totalCodewords = Utils.getSymbolTotalCodewords(version);
1072
+ const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
1073
+ const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;
1074
+ if (mode === Mode.MIXED) return dataTotalCodewordsBits;
1075
+ const usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version);
1076
+ switch (mode) {
1077
+ case Mode.NUMERIC:
1078
+ return Math.floor(usableBits / 10 * 3);
1079
+ case Mode.ALPHANUMERIC:
1080
+ return Math.floor(usableBits / 11 * 2);
1081
+ case Mode.KANJI:
1082
+ return Math.floor(usableBits / 13);
1083
+ case Mode.BYTE:
1084
+ default:
1085
+ return Math.floor(usableBits / 8);
1086
+ }
1087
+ };
1088
+ exports.getBestVersionForData = function getBestVersionForData(data, errorCorrectionLevel) {
1089
+ let seg;
1090
+ const ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M);
1091
+ if (Array.isArray(data)) {
1092
+ if (data.length > 1) {
1093
+ return getBestVersionForMixedData(data, ecl);
1094
+ }
1095
+ if (data.length === 0) {
1096
+ return 1;
1097
+ }
1098
+ seg = data[0];
1099
+ } else {
1100
+ seg = data;
1101
+ }
1102
+ return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl);
1103
+ };
1104
+ exports.getEncodedBits = function getEncodedBits(version) {
1105
+ if (!VersionCheck.isValid(version) || version < 7) {
1106
+ throw new Error("Invalid QR Code version");
1107
+ }
1108
+ let d = version << 12;
1109
+ while (Utils.getBCHDigit(d) - G18_BCH >= 0) {
1110
+ d ^= G18 << Utils.getBCHDigit(d) - G18_BCH;
1111
+ }
1112
+ return version << 12 | d;
1113
+ };
1114
+ }
1115
+ });
1116
+
1117
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/format-info.js
1118
+ var require_format_info = __commonJS({
1119
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/format-info.js"(exports) {
1120
+ "use strict";
1121
+ var Utils = require_utils();
1122
+ var G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
1123
+ var G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
1124
+ var G15_BCH = Utils.getBCHDigit(G15);
1125
+ exports.getEncodedBits = function getEncodedBits(errorCorrectionLevel, mask) {
1126
+ const data = errorCorrectionLevel.bit << 3 | mask;
1127
+ let d = data << 10;
1128
+ while (Utils.getBCHDigit(d) - G15_BCH >= 0) {
1129
+ d ^= G15 << Utils.getBCHDigit(d) - G15_BCH;
1130
+ }
1131
+ return (data << 10 | d) ^ G15_MASK;
1132
+ };
1133
+ }
1134
+ });
1135
+
1136
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/numeric-data.js
1137
+ var require_numeric_data = __commonJS({
1138
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/numeric-data.js"(exports, module) {
1139
+ "use strict";
1140
+ var Mode = require_mode();
1141
+ function NumericData(data) {
1142
+ this.mode = Mode.NUMERIC;
1143
+ this.data = data.toString();
1144
+ }
1145
+ NumericData.getBitsLength = function getBitsLength(length) {
1146
+ return 10 * Math.floor(length / 3) + (length % 3 ? length % 3 * 3 + 1 : 0);
1147
+ };
1148
+ NumericData.prototype.getLength = function getLength() {
1149
+ return this.data.length;
1150
+ };
1151
+ NumericData.prototype.getBitsLength = function getBitsLength() {
1152
+ return NumericData.getBitsLength(this.data.length);
1153
+ };
1154
+ NumericData.prototype.write = function write(bitBuffer) {
1155
+ let i, group, value;
1156
+ for (i = 0; i + 3 <= this.data.length; i += 3) {
1157
+ group = this.data.substr(i, 3);
1158
+ value = parseInt(group, 10);
1159
+ bitBuffer.put(value, 10);
1160
+ }
1161
+ const remainingNum = this.data.length - i;
1162
+ if (remainingNum > 0) {
1163
+ group = this.data.substr(i);
1164
+ value = parseInt(group, 10);
1165
+ bitBuffer.put(value, remainingNum * 3 + 1);
1166
+ }
1167
+ };
1168
+ module.exports = NumericData;
1169
+ }
1170
+ });
1171
+
1172
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alphanumeric-data.js
1173
+ var require_alphanumeric_data = __commonJS({
1174
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alphanumeric-data.js"(exports, module) {
1175
+ "use strict";
1176
+ var Mode = require_mode();
1177
+ var ALPHA_NUM_CHARS = [
1178
+ "0",
1179
+ "1",
1180
+ "2",
1181
+ "3",
1182
+ "4",
1183
+ "5",
1184
+ "6",
1185
+ "7",
1186
+ "8",
1187
+ "9",
1188
+ "A",
1189
+ "B",
1190
+ "C",
1191
+ "D",
1192
+ "E",
1193
+ "F",
1194
+ "G",
1195
+ "H",
1196
+ "I",
1197
+ "J",
1198
+ "K",
1199
+ "L",
1200
+ "M",
1201
+ "N",
1202
+ "O",
1203
+ "P",
1204
+ "Q",
1205
+ "R",
1206
+ "S",
1207
+ "T",
1208
+ "U",
1209
+ "V",
1210
+ "W",
1211
+ "X",
1212
+ "Y",
1213
+ "Z",
1214
+ " ",
1215
+ "$",
1216
+ "%",
1217
+ "*",
1218
+ "+",
1219
+ "-",
1220
+ ".",
1221
+ "/",
1222
+ ":"
1223
+ ];
1224
+ function AlphanumericData(data) {
1225
+ this.mode = Mode.ALPHANUMERIC;
1226
+ this.data = data;
1227
+ }
1228
+ AlphanumericData.getBitsLength = function getBitsLength(length) {
1229
+ return 11 * Math.floor(length / 2) + 6 * (length % 2);
1230
+ };
1231
+ AlphanumericData.prototype.getLength = function getLength() {
1232
+ return this.data.length;
1233
+ };
1234
+ AlphanumericData.prototype.getBitsLength = function getBitsLength() {
1235
+ return AlphanumericData.getBitsLength(this.data.length);
1236
+ };
1237
+ AlphanumericData.prototype.write = function write(bitBuffer) {
1238
+ let i;
1239
+ for (i = 0; i + 2 <= this.data.length; i += 2) {
1240
+ let value = ALPHA_NUM_CHARS.indexOf(this.data[i]) * 45;
1241
+ value += ALPHA_NUM_CHARS.indexOf(this.data[i + 1]);
1242
+ bitBuffer.put(value, 11);
1243
+ }
1244
+ if (this.data.length % 2) {
1245
+ bitBuffer.put(ALPHA_NUM_CHARS.indexOf(this.data[i]), 6);
1246
+ }
1247
+ };
1248
+ module.exports = AlphanumericData;
1249
+ }
1250
+ });
1251
+
1252
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/byte-data.js
1253
+ var require_byte_data = __commonJS({
1254
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/byte-data.js"(exports, module) {
1255
+ "use strict";
1256
+ var Mode = require_mode();
1257
+ function ByteData(data) {
1258
+ this.mode = Mode.BYTE;
1259
+ if (typeof data === "string") {
1260
+ this.data = new TextEncoder().encode(data);
1261
+ } else {
1262
+ this.data = new Uint8Array(data);
1263
+ }
1264
+ }
1265
+ ByteData.getBitsLength = function getBitsLength(length) {
1266
+ return length * 8;
1267
+ };
1268
+ ByteData.prototype.getLength = function getLength() {
1269
+ return this.data.length;
1270
+ };
1271
+ ByteData.prototype.getBitsLength = function getBitsLength() {
1272
+ return ByteData.getBitsLength(this.data.length);
1273
+ };
1274
+ ByteData.prototype.write = function(bitBuffer) {
1275
+ for (let i = 0, l = this.data.length; i < l; i++) {
1276
+ bitBuffer.put(this.data[i], 8);
1277
+ }
1278
+ };
1279
+ module.exports = ByteData;
1280
+ }
1281
+ });
1282
+
1283
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/kanji-data.js
1284
+ var require_kanji_data = __commonJS({
1285
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/kanji-data.js"(exports, module) {
1286
+ "use strict";
1287
+ var Mode = require_mode();
1288
+ var Utils = require_utils();
1289
+ function KanjiData(data) {
1290
+ this.mode = Mode.KANJI;
1291
+ this.data = data;
1292
+ }
1293
+ KanjiData.getBitsLength = function getBitsLength(length) {
1294
+ return length * 13;
1295
+ };
1296
+ KanjiData.prototype.getLength = function getLength() {
1297
+ return this.data.length;
1298
+ };
1299
+ KanjiData.prototype.getBitsLength = function getBitsLength() {
1300
+ return KanjiData.getBitsLength(this.data.length);
1301
+ };
1302
+ KanjiData.prototype.write = function(bitBuffer) {
1303
+ let i;
1304
+ for (i = 0; i < this.data.length; i++) {
1305
+ let value = Utils.toSJIS(this.data[i]);
1306
+ if (value >= 33088 && value <= 40956) {
1307
+ value -= 33088;
1308
+ } else if (value >= 57408 && value <= 60351) {
1309
+ value -= 49472;
1310
+ } else {
1311
+ throw new Error(
1312
+ "Invalid SJIS character: " + this.data[i] + "\nMake sure your charset is UTF-8"
1313
+ );
1314
+ }
1315
+ value = (value >>> 8 & 255) * 192 + (value & 255);
1316
+ bitBuffer.put(value, 13);
1317
+ }
1318
+ };
1319
+ module.exports = KanjiData;
1320
+ }
1321
+ });
1322
+
1323
+ // node_modules/.pnpm/dijkstrajs@1.0.3/node_modules/dijkstrajs/dijkstra.js
1324
+ var require_dijkstra = __commonJS({
1325
+ "node_modules/.pnpm/dijkstrajs@1.0.3/node_modules/dijkstrajs/dijkstra.js"(exports, module) {
1326
+ "use strict";
1327
+ var dijkstra = {
1328
+ single_source_shortest_paths: function(graph, s, d) {
1329
+ var predecessors = {};
1330
+ var costs = {};
1331
+ costs[s] = 0;
1332
+ var open = dijkstra.PriorityQueue.make();
1333
+ open.push(s, 0);
1334
+ var closest, u, v, cost_of_s_to_u, adjacent_nodes, cost_of_e, cost_of_s_to_u_plus_cost_of_e, cost_of_s_to_v, first_visit;
1335
+ while (!open.empty()) {
1336
+ closest = open.pop();
1337
+ u = closest.value;
1338
+ cost_of_s_to_u = closest.cost;
1339
+ adjacent_nodes = graph[u] || {};
1340
+ for (v in adjacent_nodes) {
1341
+ if (adjacent_nodes.hasOwnProperty(v)) {
1342
+ cost_of_e = adjacent_nodes[v];
1343
+ cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e;
1344
+ cost_of_s_to_v = costs[v];
1345
+ first_visit = typeof costs[v] === "undefined";
1346
+ if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {
1347
+ costs[v] = cost_of_s_to_u_plus_cost_of_e;
1348
+ open.push(v, cost_of_s_to_u_plus_cost_of_e);
1349
+ predecessors[v] = u;
1350
+ }
1351
+ }
1352
+ }
1353
+ }
1354
+ if (typeof d !== "undefined" && typeof costs[d] === "undefined") {
1355
+ var msg = ["Could not find a path from ", s, " to ", d, "."].join("");
1356
+ throw new Error(msg);
1357
+ }
1358
+ return predecessors;
1359
+ },
1360
+ extract_shortest_path_from_predecessor_list: function(predecessors, d) {
1361
+ var nodes = [];
1362
+ var u = d;
1363
+ var predecessor;
1364
+ while (u) {
1365
+ nodes.push(u);
1366
+ predecessor = predecessors[u];
1367
+ u = predecessors[u];
1368
+ }
1369
+ nodes.reverse();
1370
+ return nodes;
1371
+ },
1372
+ find_path: function(graph, s, d) {
1373
+ var predecessors = dijkstra.single_source_shortest_paths(graph, s, d);
1374
+ return dijkstra.extract_shortest_path_from_predecessor_list(
1375
+ predecessors,
1376
+ d
1377
+ );
1378
+ },
1379
+ /**
1380
+ * A very naive priority queue implementation.
1381
+ */
1382
+ PriorityQueue: {
1383
+ make: function(opts) {
1384
+ var T = dijkstra.PriorityQueue, t2 = {}, key;
1385
+ opts = opts || {};
1386
+ for (key in T) {
1387
+ if (T.hasOwnProperty(key)) {
1388
+ t2[key] = T[key];
1389
+ }
1390
+ }
1391
+ t2.queue = [];
1392
+ t2.sorter = opts.sorter || T.default_sorter;
1393
+ return t2;
1394
+ },
1395
+ default_sorter: function(a, b) {
1396
+ return a.cost - b.cost;
1397
+ },
1398
+ /**
1399
+ * Add a new item to the queue and ensure the highest priority element
1400
+ * is at the front of the queue.
1401
+ */
1402
+ push: function(value, cost) {
1403
+ var item = { value, cost };
1404
+ this.queue.push(item);
1405
+ this.queue.sort(this.sorter);
1406
+ },
1407
+ /**
1408
+ * Return the highest priority element in the queue.
1409
+ */
1410
+ pop: function() {
1411
+ return this.queue.shift();
1412
+ },
1413
+ empty: function() {
1414
+ return this.queue.length === 0;
1415
+ }
1416
+ }
1417
+ };
1418
+ if (typeof module !== "undefined") {
1419
+ module.exports = dijkstra;
1420
+ }
1421
+ }
1422
+ });
1423
+
1424
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/segments.js
1425
+ var require_segments = __commonJS({
1426
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/segments.js"(exports) {
1427
+ "use strict";
1428
+ var Mode = require_mode();
1429
+ var NumericData = require_numeric_data();
1430
+ var AlphanumericData = require_alphanumeric_data();
1431
+ var ByteData = require_byte_data();
1432
+ var KanjiData = require_kanji_data();
1433
+ var Regex = require_regex();
1434
+ var Utils = require_utils();
1435
+ var dijkstra = require_dijkstra();
1436
+ function getStringByteLength(str) {
1437
+ return unescape(encodeURIComponent(str)).length;
1438
+ }
1439
+ function getSegments(regex, mode, str) {
1440
+ const segments = [];
1441
+ let result;
1442
+ while ((result = regex.exec(str)) !== null) {
1443
+ segments.push({
1444
+ data: result[0],
1445
+ index: result.index,
1446
+ mode,
1447
+ length: result[0].length
1448
+ });
1449
+ }
1450
+ return segments;
1451
+ }
1452
+ function getSegmentsFromString(dataStr) {
1453
+ const numSegs = getSegments(Regex.NUMERIC, Mode.NUMERIC, dataStr);
1454
+ const alphaNumSegs = getSegments(Regex.ALPHANUMERIC, Mode.ALPHANUMERIC, dataStr);
1455
+ let byteSegs;
1456
+ let kanjiSegs;
1457
+ if (Utils.isKanjiModeEnabled()) {
1458
+ byteSegs = getSegments(Regex.BYTE, Mode.BYTE, dataStr);
1459
+ kanjiSegs = getSegments(Regex.KANJI, Mode.KANJI, dataStr);
1460
+ } else {
1461
+ byteSegs = getSegments(Regex.BYTE_KANJI, Mode.BYTE, dataStr);
1462
+ kanjiSegs = [];
1463
+ }
1464
+ const segs = numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs);
1465
+ return segs.sort(function(s1, s2) {
1466
+ return s1.index - s2.index;
1467
+ }).map(function(obj) {
1468
+ return {
1469
+ data: obj.data,
1470
+ mode: obj.mode,
1471
+ length: obj.length
1472
+ };
1473
+ });
1474
+ }
1475
+ function getSegmentBitsLength(length, mode) {
1476
+ switch (mode) {
1477
+ case Mode.NUMERIC:
1478
+ return NumericData.getBitsLength(length);
1479
+ case Mode.ALPHANUMERIC:
1480
+ return AlphanumericData.getBitsLength(length);
1481
+ case Mode.KANJI:
1482
+ return KanjiData.getBitsLength(length);
1483
+ case Mode.BYTE:
1484
+ return ByteData.getBitsLength(length);
1485
+ }
1486
+ }
1487
+ function mergeSegments(segs) {
1488
+ return segs.reduce(function(acc, curr) {
1489
+ const prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null;
1490
+ if (prevSeg && prevSeg.mode === curr.mode) {
1491
+ acc[acc.length - 1].data += curr.data;
1492
+ return acc;
1493
+ }
1494
+ acc.push(curr);
1495
+ return acc;
1496
+ }, []);
1497
+ }
1498
+ function buildNodes(segs) {
1499
+ const nodes = [];
1500
+ for (let i = 0; i < segs.length; i++) {
1501
+ const seg = segs[i];
1502
+ switch (seg.mode) {
1503
+ case Mode.NUMERIC:
1504
+ nodes.push([
1505
+ seg,
1506
+ { data: seg.data, mode: Mode.ALPHANUMERIC, length: seg.length },
1507
+ { data: seg.data, mode: Mode.BYTE, length: seg.length }
1508
+ ]);
1509
+ break;
1510
+ case Mode.ALPHANUMERIC:
1511
+ nodes.push([
1512
+ seg,
1513
+ { data: seg.data, mode: Mode.BYTE, length: seg.length }
1514
+ ]);
1515
+ break;
1516
+ case Mode.KANJI:
1517
+ nodes.push([
1518
+ seg,
1519
+ { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
1520
+ ]);
1521
+ break;
1522
+ case Mode.BYTE:
1523
+ nodes.push([
1524
+ { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
1525
+ ]);
1526
+ }
1527
+ }
1528
+ return nodes;
1529
+ }
1530
+ function buildGraph(nodes, version) {
1531
+ const table = {};
1532
+ const graph = { start: {} };
1533
+ let prevNodeIds = ["start"];
1534
+ for (let i = 0; i < nodes.length; i++) {
1535
+ const nodeGroup = nodes[i];
1536
+ const currentNodeIds = [];
1537
+ for (let j = 0; j < nodeGroup.length; j++) {
1538
+ const node = nodeGroup[j];
1539
+ const key = "" + i + j;
1540
+ currentNodeIds.push(key);
1541
+ table[key] = { node, lastCount: 0 };
1542
+ graph[key] = {};
1543
+ for (let n = 0; n < prevNodeIds.length; n++) {
1544
+ const prevNodeId = prevNodeIds[n];
1545
+ if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) {
1546
+ graph[prevNodeId][key] = getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) - getSegmentBitsLength(table[prevNodeId].lastCount, node.mode);
1547
+ table[prevNodeId].lastCount += node.length;
1548
+ } else {
1549
+ if (table[prevNodeId]) table[prevNodeId].lastCount = node.length;
1550
+ graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) + 4 + Mode.getCharCountIndicator(node.mode, version);
1551
+ }
1552
+ }
1553
+ }
1554
+ prevNodeIds = currentNodeIds;
1555
+ }
1556
+ for (let n = 0; n < prevNodeIds.length; n++) {
1557
+ graph[prevNodeIds[n]].end = 0;
1558
+ }
1559
+ return { map: graph, table };
1560
+ }
1561
+ function buildSingleSegment(data, modesHint) {
1562
+ let mode;
1563
+ const bestMode = Mode.getBestModeForData(data);
1564
+ mode = Mode.from(modesHint, bestMode);
1565
+ if (mode !== Mode.BYTE && mode.bit < bestMode.bit) {
1566
+ throw new Error('"' + data + '" cannot be encoded with mode ' + Mode.toString(mode) + ".\n Suggested mode is: " + Mode.toString(bestMode));
1567
+ }
1568
+ if (mode === Mode.KANJI && !Utils.isKanjiModeEnabled()) {
1569
+ mode = Mode.BYTE;
1570
+ }
1571
+ switch (mode) {
1572
+ case Mode.NUMERIC:
1573
+ return new NumericData(data);
1574
+ case Mode.ALPHANUMERIC:
1575
+ return new AlphanumericData(data);
1576
+ case Mode.KANJI:
1577
+ return new KanjiData(data);
1578
+ case Mode.BYTE:
1579
+ return new ByteData(data);
1580
+ }
1581
+ }
1582
+ exports.fromArray = function fromArray(array) {
1583
+ return array.reduce(function(acc, seg) {
1584
+ if (typeof seg === "string") {
1585
+ acc.push(buildSingleSegment(seg, null));
1586
+ } else if (seg.data) {
1587
+ acc.push(buildSingleSegment(seg.data, seg.mode));
1588
+ }
1589
+ return acc;
1590
+ }, []);
1591
+ };
1592
+ exports.fromString = function fromString(data, version) {
1593
+ const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled());
1594
+ const nodes = buildNodes(segs);
1595
+ const graph = buildGraph(nodes, version);
1596
+ const path = dijkstra.find_path(graph.map, "start", "end");
1597
+ const optimizedSegs = [];
1598
+ for (let i = 1; i < path.length - 1; i++) {
1599
+ optimizedSegs.push(graph.table[path[i]].node);
1600
+ }
1601
+ return exports.fromArray(mergeSegments(optimizedSegs));
1602
+ };
1603
+ exports.rawSplit = function rawSplit(data) {
1604
+ return exports.fromArray(
1605
+ getSegmentsFromString(data, Utils.isKanjiModeEnabled())
1606
+ );
1607
+ };
1608
+ }
1609
+ });
1610
+
1611
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/qrcode.js
1612
+ var require_qrcode = __commonJS({
1613
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/qrcode.js"(exports) {
1614
+ "use strict";
1615
+ var Utils = require_utils();
1616
+ var ECLevel = require_error_correction_level();
1617
+ var BitBuffer = require_bit_buffer();
1618
+ var BitMatrix = require_bit_matrix();
1619
+ var AlignmentPattern = require_alignment_pattern();
1620
+ var FinderPattern = require_finder_pattern();
1621
+ var MaskPattern = require_mask_pattern();
1622
+ var ECCode = require_error_correction_code();
1623
+ var ReedSolomonEncoder = require_reed_solomon_encoder();
1624
+ var Version = require_version();
1625
+ var FormatInfo = require_format_info();
1626
+ var Mode = require_mode();
1627
+ var Segments = require_segments();
1628
+ function setupFinderPattern(matrix, version) {
1629
+ const size = matrix.size;
1630
+ const pos = FinderPattern.getPositions(version);
1631
+ for (let i = 0; i < pos.length; i++) {
1632
+ const row = pos[i][0];
1633
+ const col = pos[i][1];
1634
+ for (let r = -1; r <= 7; r++) {
1635
+ if (row + r <= -1 || size <= row + r) continue;
1636
+ for (let c = -1; c <= 7; c++) {
1637
+ if (col + c <= -1 || size <= col + c) continue;
1638
+ if (r >= 0 && r <= 6 && (c === 0 || c === 6) || c >= 0 && c <= 6 && (r === 0 || r === 6) || r >= 2 && r <= 4 && c >= 2 && c <= 4) {
1639
+ matrix.set(row + r, col + c, true, true);
1640
+ } else {
1641
+ matrix.set(row + r, col + c, false, true);
1642
+ }
1643
+ }
1644
+ }
1645
+ }
1646
+ }
1647
+ function setupTimingPattern(matrix) {
1648
+ const size = matrix.size;
1649
+ for (let r = 8; r < size - 8; r++) {
1650
+ const value = r % 2 === 0;
1651
+ matrix.set(r, 6, value, true);
1652
+ matrix.set(6, r, value, true);
1653
+ }
1654
+ }
1655
+ function setupAlignmentPattern(matrix, version) {
1656
+ const pos = AlignmentPattern.getPositions(version);
1657
+ for (let i = 0; i < pos.length; i++) {
1658
+ const row = pos[i][0];
1659
+ const col = pos[i][1];
1660
+ for (let r = -2; r <= 2; r++) {
1661
+ for (let c = -2; c <= 2; c++) {
1662
+ if (r === -2 || r === 2 || c === -2 || c === 2 || r === 0 && c === 0) {
1663
+ matrix.set(row + r, col + c, true, true);
1664
+ } else {
1665
+ matrix.set(row + r, col + c, false, true);
1666
+ }
1667
+ }
1668
+ }
1669
+ }
1670
+ }
1671
+ function setupVersionInfo(matrix, version) {
1672
+ const size = matrix.size;
1673
+ const bits = Version.getEncodedBits(version);
1674
+ let row, col, mod;
1675
+ for (let i = 0; i < 18; i++) {
1676
+ row = Math.floor(i / 3);
1677
+ col = i % 3 + size - 8 - 3;
1678
+ mod = (bits >> i & 1) === 1;
1679
+ matrix.set(row, col, mod, true);
1680
+ matrix.set(col, row, mod, true);
1681
+ }
1682
+ }
1683
+ function setupFormatInfo(matrix, errorCorrectionLevel, maskPattern) {
1684
+ const size = matrix.size;
1685
+ const bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern);
1686
+ let i, mod;
1687
+ for (i = 0; i < 15; i++) {
1688
+ mod = (bits >> i & 1) === 1;
1689
+ if (i < 6) {
1690
+ matrix.set(i, 8, mod, true);
1691
+ } else if (i < 8) {
1692
+ matrix.set(i + 1, 8, mod, true);
1693
+ } else {
1694
+ matrix.set(size - 15 + i, 8, mod, true);
1695
+ }
1696
+ if (i < 8) {
1697
+ matrix.set(8, size - i - 1, mod, true);
1698
+ } else if (i < 9) {
1699
+ matrix.set(8, 15 - i - 1 + 1, mod, true);
1700
+ } else {
1701
+ matrix.set(8, 15 - i - 1, mod, true);
1702
+ }
1703
+ }
1704
+ matrix.set(size - 8, 8, 1, true);
1705
+ }
1706
+ function setupData(matrix, data) {
1707
+ const size = matrix.size;
1708
+ let inc = -1;
1709
+ let row = size - 1;
1710
+ let bitIndex = 7;
1711
+ let byteIndex = 0;
1712
+ for (let col = size - 1; col > 0; col -= 2) {
1713
+ if (col === 6) col--;
1714
+ while (true) {
1715
+ for (let c = 0; c < 2; c++) {
1716
+ if (!matrix.isReserved(row, col - c)) {
1717
+ let dark = false;
1718
+ if (byteIndex < data.length) {
1719
+ dark = (data[byteIndex] >>> bitIndex & 1) === 1;
1720
+ }
1721
+ matrix.set(row, col - c, dark);
1722
+ bitIndex--;
1723
+ if (bitIndex === -1) {
1724
+ byteIndex++;
1725
+ bitIndex = 7;
1726
+ }
1727
+ }
1728
+ }
1729
+ row += inc;
1730
+ if (row < 0 || size <= row) {
1731
+ row -= inc;
1732
+ inc = -inc;
1733
+ break;
1734
+ }
1735
+ }
1736
+ }
1737
+ }
1738
+ function createData(version, errorCorrectionLevel, segments) {
1739
+ const buffer = new BitBuffer();
1740
+ segments.forEach(function(data) {
1741
+ buffer.put(data.mode.bit, 4);
1742
+ buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version));
1743
+ data.write(buffer);
1744
+ });
1745
+ const totalCodewords = Utils.getSymbolTotalCodewords(version);
1746
+ const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
1747
+ const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;
1748
+ if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) {
1749
+ buffer.put(0, 4);
1750
+ }
1751
+ while (buffer.getLengthInBits() % 8 !== 0) {
1752
+ buffer.putBit(0);
1753
+ }
1754
+ const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8;
1755
+ for (let i = 0; i < remainingByte; i++) {
1756
+ buffer.put(i % 2 ? 17 : 236, 8);
1757
+ }
1758
+ return createCodewords(buffer, version, errorCorrectionLevel);
1759
+ }
1760
+ function createCodewords(bitBuffer, version, errorCorrectionLevel) {
1761
+ const totalCodewords = Utils.getSymbolTotalCodewords(version);
1762
+ const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
1763
+ const dataTotalCodewords = totalCodewords - ecTotalCodewords;
1764
+ const ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel);
1765
+ const blocksInGroup2 = totalCodewords % ecTotalBlocks;
1766
+ const blocksInGroup1 = ecTotalBlocks - blocksInGroup2;
1767
+ const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks);
1768
+ const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks);
1769
+ const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1;
1770
+ const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1;
1771
+ const rs = new ReedSolomonEncoder(ecCount);
1772
+ let offset = 0;
1773
+ const dcData = new Array(ecTotalBlocks);
1774
+ const ecData = new Array(ecTotalBlocks);
1775
+ let maxDataSize = 0;
1776
+ const buffer = new Uint8Array(bitBuffer.buffer);
1777
+ for (let b = 0; b < ecTotalBlocks; b++) {
1778
+ const dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2;
1779
+ dcData[b] = buffer.slice(offset, offset + dataSize);
1780
+ ecData[b] = rs.encode(dcData[b]);
1781
+ offset += dataSize;
1782
+ maxDataSize = Math.max(maxDataSize, dataSize);
1783
+ }
1784
+ const data = new Uint8Array(totalCodewords);
1785
+ let index = 0;
1786
+ let i, r;
1787
+ for (i = 0; i < maxDataSize; i++) {
1788
+ for (r = 0; r < ecTotalBlocks; r++) {
1789
+ if (i < dcData[r].length) {
1790
+ data[index++] = dcData[r][i];
1791
+ }
1792
+ }
1793
+ }
1794
+ for (i = 0; i < ecCount; i++) {
1795
+ for (r = 0; r < ecTotalBlocks; r++) {
1796
+ data[index++] = ecData[r][i];
1797
+ }
1798
+ }
1799
+ return data;
1800
+ }
1801
+ function createSymbol(data, version, errorCorrectionLevel, maskPattern) {
1802
+ let segments;
1803
+ if (Array.isArray(data)) {
1804
+ segments = Segments.fromArray(data);
1805
+ } else if (typeof data === "string") {
1806
+ let estimatedVersion = version;
1807
+ if (!estimatedVersion) {
1808
+ const rawSegments = Segments.rawSplit(data);
1809
+ estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel);
1810
+ }
1811
+ segments = Segments.fromString(data, estimatedVersion || 40);
1812
+ } else {
1813
+ throw new Error("Invalid data");
1814
+ }
1815
+ const bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel);
1816
+ if (!bestVersion) {
1817
+ throw new Error("The amount of data is too big to be stored in a QR Code");
1818
+ }
1819
+ if (!version) {
1820
+ version = bestVersion;
1821
+ } else if (version < bestVersion) {
1822
+ throw new Error(
1823
+ "\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: " + bestVersion + ".\n"
1824
+ );
1825
+ }
1826
+ const dataBits = createData(version, errorCorrectionLevel, segments);
1827
+ const moduleCount = Utils.getSymbolSize(version);
1828
+ const modules = new BitMatrix(moduleCount);
1829
+ setupFinderPattern(modules, version);
1830
+ setupTimingPattern(modules);
1831
+ setupAlignmentPattern(modules, version);
1832
+ setupFormatInfo(modules, errorCorrectionLevel, 0);
1833
+ if (version >= 7) {
1834
+ setupVersionInfo(modules, version);
1835
+ }
1836
+ setupData(modules, dataBits);
1837
+ if (isNaN(maskPattern)) {
1838
+ maskPattern = MaskPattern.getBestMask(
1839
+ modules,
1840
+ setupFormatInfo.bind(null, modules, errorCorrectionLevel)
1841
+ );
1842
+ }
1843
+ MaskPattern.applyMask(maskPattern, modules);
1844
+ setupFormatInfo(modules, errorCorrectionLevel, maskPattern);
1845
+ return {
1846
+ modules,
1847
+ version,
1848
+ errorCorrectionLevel,
1849
+ maskPattern,
1850
+ segments
1851
+ };
1852
+ }
1853
+ exports.create = function create(data, options) {
1854
+ if (typeof data === "undefined" || data === "") {
1855
+ throw new Error("No input text");
1856
+ }
1857
+ let errorCorrectionLevel = ECLevel.M;
1858
+ let version;
1859
+ let mask;
1860
+ if (typeof options !== "undefined") {
1861
+ errorCorrectionLevel = ECLevel.from(options.errorCorrectionLevel, ECLevel.M);
1862
+ version = Version.from(options.version);
1863
+ mask = MaskPattern.from(options.maskPattern);
1864
+ if (options.toSJISFunc) {
1865
+ Utils.setToSJISFunction(options.toSJISFunc);
1866
+ }
1867
+ }
1868
+ return createSymbol(data, version, errorCorrectionLevel, mask);
1869
+ };
1870
+ }
1871
+ });
1872
+
1873
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js
1874
+ var require_utils2 = __commonJS({
1875
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js"(exports) {
1876
+ "use strict";
1877
+ function hex2rgba(hex) {
1878
+ if (typeof hex === "number") {
1879
+ hex = hex.toString();
1880
+ }
1881
+ if (typeof hex !== "string") {
1882
+ throw new Error("Color should be defined as hex string");
1883
+ }
1884
+ let hexCode = hex.slice().replace("#", "").split("");
1885
+ if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) {
1886
+ throw new Error("Invalid hex color: " + hex);
1887
+ }
1888
+ if (hexCode.length === 3 || hexCode.length === 4) {
1889
+ hexCode = Array.prototype.concat.apply([], hexCode.map(function(c) {
1890
+ return [c, c];
1891
+ }));
1892
+ }
1893
+ if (hexCode.length === 6) hexCode.push("F", "F");
1894
+ const hexValue = parseInt(hexCode.join(""), 16);
1895
+ return {
1896
+ r: hexValue >> 24 & 255,
1897
+ g: hexValue >> 16 & 255,
1898
+ b: hexValue >> 8 & 255,
1899
+ a: hexValue & 255,
1900
+ hex: "#" + hexCode.slice(0, 6).join("")
1901
+ };
1902
+ }
1903
+ exports.getOptions = function getOptions(options) {
1904
+ if (!options) options = {};
1905
+ if (!options.color) options.color = {};
1906
+ const margin = typeof options.margin === "undefined" || options.margin === null || options.margin < 0 ? 4 : options.margin;
1907
+ const width = options.width && options.width >= 21 ? options.width : void 0;
1908
+ const scale = options.scale || 4;
1909
+ return {
1910
+ width,
1911
+ scale: width ? 4 : scale,
1912
+ margin,
1913
+ color: {
1914
+ dark: hex2rgba(options.color.dark || "#000000ff"),
1915
+ light: hex2rgba(options.color.light || "#ffffffff")
1916
+ },
1917
+ type: options.type,
1918
+ rendererOpts: options.rendererOpts || {}
1919
+ };
1920
+ };
1921
+ exports.getScale = function getScale(qrSize, opts) {
1922
+ return opts.width && opts.width >= qrSize + opts.margin * 2 ? opts.width / (qrSize + opts.margin * 2) : opts.scale;
1923
+ };
1924
+ exports.getImageWidth = function getImageWidth(qrSize, opts) {
1925
+ const scale = exports.getScale(qrSize, opts);
1926
+ return Math.floor((qrSize + opts.margin * 2) * scale);
1927
+ };
1928
+ exports.qrToImageData = function qrToImageData(imgData, qr, opts) {
1929
+ const size = qr.modules.size;
1930
+ const data = qr.modules.data;
1931
+ const scale = exports.getScale(size, opts);
1932
+ const symbolSize = Math.floor((size + opts.margin * 2) * scale);
1933
+ const scaledMargin = opts.margin * scale;
1934
+ const palette = [opts.color.light, opts.color.dark];
1935
+ for (let i = 0; i < symbolSize; i++) {
1936
+ for (let j = 0; j < symbolSize; j++) {
1937
+ let posDst = (i * symbolSize + j) * 4;
1938
+ let pxColor = opts.color.light;
1939
+ if (i >= scaledMargin && j >= scaledMargin && i < symbolSize - scaledMargin && j < symbolSize - scaledMargin) {
1940
+ const iSrc = Math.floor((i - scaledMargin) / scale);
1941
+ const jSrc = Math.floor((j - scaledMargin) / scale);
1942
+ pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0];
1943
+ }
1944
+ imgData[posDst++] = pxColor.r;
1945
+ imgData[posDst++] = pxColor.g;
1946
+ imgData[posDst++] = pxColor.b;
1947
+ imgData[posDst] = pxColor.a;
1948
+ }
1949
+ }
1950
+ };
1951
+ }
1952
+ });
1953
+
1954
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/canvas.js
1955
+ var require_canvas = __commonJS({
1956
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/canvas.js"(exports) {
1957
+ "use strict";
1958
+ var Utils = require_utils2();
1959
+ function clearCanvas(ctx, canvas, size) {
1960
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
1961
+ if (!canvas.style) canvas.style = {};
1962
+ canvas.height = size;
1963
+ canvas.width = size;
1964
+ canvas.style.height = size + "px";
1965
+ canvas.style.width = size + "px";
1966
+ }
1967
+ function getCanvasElement() {
1968
+ try {
1969
+ return document.createElement("canvas");
1970
+ } catch (e) {
1971
+ throw new Error("You need to specify a canvas element");
1972
+ }
1973
+ }
1974
+ exports.render = function render(qrData, canvas, options) {
1975
+ let opts = options;
1976
+ let canvasEl = canvas;
1977
+ if (typeof opts === "undefined" && (!canvas || !canvas.getContext)) {
1978
+ opts = canvas;
1979
+ canvas = void 0;
1980
+ }
1981
+ if (!canvas) {
1982
+ canvasEl = getCanvasElement();
1983
+ }
1984
+ opts = Utils.getOptions(opts);
1985
+ const size = Utils.getImageWidth(qrData.modules.size, opts);
1986
+ const ctx = canvasEl.getContext("2d");
1987
+ const image = ctx.createImageData(size, size);
1988
+ Utils.qrToImageData(image.data, qrData, opts);
1989
+ clearCanvas(ctx, canvasEl, size);
1990
+ ctx.putImageData(image, 0, 0);
1991
+ return canvasEl;
1992
+ };
1993
+ exports.renderToDataURL = function renderToDataURL(qrData, canvas, options) {
1994
+ let opts = options;
1995
+ if (typeof opts === "undefined" && (!canvas || !canvas.getContext)) {
1996
+ opts = canvas;
1997
+ canvas = void 0;
1998
+ }
1999
+ if (!opts) opts = {};
2000
+ const canvasEl = exports.render(qrData, canvas, opts);
2001
+ const type = opts.type || "image/png";
2002
+ const rendererOpts = opts.rendererOpts || {};
2003
+ return canvasEl.toDataURL(type, rendererOpts.quality);
2004
+ };
2005
+ }
2006
+ });
2007
+
2008
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg-tag.js
2009
+ var require_svg_tag = __commonJS({
2010
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg-tag.js"(exports) {
2011
+ "use strict";
2012
+ var Utils = require_utils2();
2013
+ function getColorAttrib(color, attrib) {
2014
+ const alpha = color.a / 255;
2015
+ const str = attrib + '="' + color.hex + '"';
2016
+ return alpha < 1 ? str + " " + attrib + '-opacity="' + alpha.toFixed(2).slice(1) + '"' : str;
2017
+ }
2018
+ function svgCmd(cmd, x, y) {
2019
+ let str = cmd + x;
2020
+ if (typeof y !== "undefined") str += " " + y;
2021
+ return str;
2022
+ }
2023
+ function qrToPath(data, size, margin) {
2024
+ let path = "";
2025
+ let moveBy = 0;
2026
+ let newRow = false;
2027
+ let lineLength = 0;
2028
+ for (let i = 0; i < data.length; i++) {
2029
+ const col = Math.floor(i % size);
2030
+ const row = Math.floor(i / size);
2031
+ if (!col && !newRow) newRow = true;
2032
+ if (data[i]) {
2033
+ lineLength++;
2034
+ if (!(i > 0 && col > 0 && data[i - 1])) {
2035
+ path += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
2036
+ moveBy = 0;
2037
+ newRow = false;
2038
+ }
2039
+ if (!(col + 1 < size && data[i + 1])) {
2040
+ path += svgCmd("h", lineLength);
2041
+ lineLength = 0;
2042
+ }
2043
+ } else {
2044
+ moveBy++;
2045
+ }
2046
+ }
2047
+ return path;
2048
+ }
2049
+ exports.render = function render(qrData, options, cb) {
2050
+ const opts = Utils.getOptions(options);
2051
+ const size = qrData.modules.size;
2052
+ const data = qrData.modules.data;
2053
+ const qrcodesize = size + opts.margin * 2;
2054
+ const bg = !opts.color.light.a ? "" : "<path " + getColorAttrib(opts.color.light, "fill") + ' d="M0 0h' + qrcodesize + "v" + qrcodesize + 'H0z"/>';
2055
+ const path = "<path " + getColorAttrib(opts.color.dark, "stroke") + ' d="' + qrToPath(data, size, opts.margin) + '"/>';
2056
+ const viewBox = 'viewBox="0 0 ' + qrcodesize + " " + qrcodesize + '"';
2057
+ const width = !opts.width ? "" : 'width="' + opts.width + '" height="' + opts.width + '" ';
2058
+ const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path + "</svg>\n";
2059
+ if (typeof cb === "function") {
2060
+ cb(null, svgTag);
2061
+ }
2062
+ return svgTag;
2063
+ };
2064
+ }
2065
+ });
2066
+
2067
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/browser.js
2068
+ var require_browser = __commonJS({
2069
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/browser.js"(exports) {
2070
+ "use strict";
2071
+ var canPromise = require_can_promise();
2072
+ var QRCode2 = require_qrcode();
2073
+ var CanvasRenderer = require_canvas();
2074
+ var SvgRenderer = require_svg_tag();
2075
+ function renderCanvas(renderFunc, canvas, text, opts, cb) {
2076
+ const args = [].slice.call(arguments, 1);
2077
+ const argsNum = args.length;
2078
+ const isLastArgCb = typeof args[argsNum - 1] === "function";
2079
+ if (!isLastArgCb && !canPromise()) {
2080
+ throw new Error("Callback required as last argument");
2081
+ }
2082
+ if (isLastArgCb) {
2083
+ if (argsNum < 2) {
2084
+ throw new Error("Too few arguments provided");
2085
+ }
2086
+ if (argsNum === 2) {
2087
+ cb = text;
2088
+ text = canvas;
2089
+ canvas = opts = void 0;
2090
+ } else if (argsNum === 3) {
2091
+ if (canvas.getContext && typeof cb === "undefined") {
2092
+ cb = opts;
2093
+ opts = void 0;
2094
+ } else {
2095
+ cb = opts;
2096
+ opts = text;
2097
+ text = canvas;
2098
+ canvas = void 0;
2099
+ }
2100
+ }
2101
+ } else {
2102
+ if (argsNum < 1) {
2103
+ throw new Error("Too few arguments provided");
2104
+ }
2105
+ if (argsNum === 1) {
2106
+ text = canvas;
2107
+ canvas = opts = void 0;
2108
+ } else if (argsNum === 2 && !canvas.getContext) {
2109
+ opts = text;
2110
+ text = canvas;
2111
+ canvas = void 0;
2112
+ }
2113
+ return new Promise(function(resolve, reject) {
2114
+ try {
2115
+ const data = QRCode2.create(text, opts);
2116
+ resolve(renderFunc(data, canvas, opts));
2117
+ } catch (e) {
2118
+ reject(e);
2119
+ }
2120
+ });
2121
+ }
2122
+ try {
2123
+ const data = QRCode2.create(text, opts);
2124
+ cb(null, renderFunc(data, canvas, opts));
2125
+ } catch (e) {
2126
+ cb(e);
2127
+ }
2128
+ }
2129
+ exports.create = QRCode2.create;
2130
+ exports.toCanvas = renderCanvas.bind(null, CanvasRenderer.render);
2131
+ exports.toDataURL = renderCanvas.bind(null, CanvasRenderer.renderToDataURL);
2132
+ exports.toString = renderCanvas.bind(null, function(data, _, opts) {
2133
+ return SvgRenderer.render(data, opts);
2134
+ });
2135
+ }
2136
+ });
2137
+
2138
+ // src/client/login/index.ts
2139
+ var import_qrcode = __toESM(require_browser(), 1);
2140
+
2141
+ // src/shared/locales/en.ts
2142
+ var en = {
2143
+ brand: "DSH \xB7 Remote sign-in",
2144
+ errorNetwork: "Connection failed. Check your network and try again.",
2145
+ errorRateLimited: "Too many attempts. Try again in about {seconds} seconds.",
2146
+ errorUnauthorized: "Your session has expired. Sign in again.",
2147
+ errorServiceUnavailable: "The service is temporarily unavailable. Try again later.",
2148
+ errorGeneric: "The operation could not be completed. Try again.",
2149
+ loginInitialTitle: "Sign in to DSH",
2150
+ loginInitialLoading: "Checking sign-in status\u2026",
2151
+ loginLanguageLabel: "Language",
2152
+ loginSetupTitle: "Set up your account first",
2153
+ loginSetupDescription: "Run this command in a terminal on the server running DSH, then create a username and password when prompted. The web page cannot create the account.",
2154
+ loginSetupCopy: "Copy command",
2155
+ loginSetupRecheck: "I finished setup",
2156
+ loginSetupCopied: "Command copied.",
2157
+ loginSetupCopyFallback: "Select and copy the command manually.",
2158
+ loginSetupNotFound: "No account was found. Check that the command used this profile, then try again.",
2159
+ loginTitle: "Sign in to DSH",
2160
+ loginDescription: "Enter the single-user account created in the server terminal.",
2161
+ loginUsername: "Username",
2162
+ loginPassword: "Password",
2163
+ loginContinue: "Continue",
2164
+ loginMfaTitle: "Verify your second factor",
2165
+ loginMfaDescription: "Enter the six-digit code from your authenticator or a one-time backup code. This challenge expires in five minutes.",
2166
+ loginMfaCode: "Verification or backup code",
2167
+ loginMfaSubmit: "Verify and sign in",
2168
+ loginBackToPassword: "Back to password sign-in",
2169
+ loginMfaExhausted: "This challenge is exhausted. Enter your password again.",
2170
+ loginBindingTitle: "Connect an authenticator",
2171
+ loginBindingDescription: "Scan the QR code with your authenticator, or enter the secret below. After confirmation, ten one-time backup codes will appear and you will need to sign in again.",
2172
+ loginBindingQrAlt: "Authenticator setup QR code",
2173
+ loginBindingManualSecret: "Manual secret",
2174
+ loginBindingCode: "Six-digit code from the authenticator",
2175
+ loginBindingConfirm: "Confirm setup",
2176
+ loginBindingRestart: "Sign in again",
2177
+ loginBindingQrUnavailable: "The QR code is unavailable. Use the manual secret above.",
2178
+ loginBindingExhausted: "This setup challenge is exhausted. Enter your password again.",
2179
+ loginBackupTitle: "Save your backup codes",
2180
+ loginBackupDescription: "These codes are shown only once. Store them safely; each code can be used only once. Sign in again after saving them.",
2181
+ loginBackupSaved: "I saved them; sign in again",
2182
+ loginOptionalTitle: "Protect your account",
2183
+ loginOptionalDescription: "This profile lets you connect an authenticator later. Connecting one now adds protection; you can also do it in Security settings.",
2184
+ loginOptionalBindNow: "Connect TOTP now",
2185
+ loginOptionalSkip: "Skip and enter DSH",
2186
+ loginOptionalVerifyTitle: "Verify again before setup",
2187
+ loginOptionalVerifyDescription: "Enter your current password to protect your account.",
2188
+ loginOptionalCurrentPassword: "Current password",
2189
+ loginOptionalStart: "Start setup",
2190
+ loginOptionalSkipLater: "Connect later and enter DSH",
2191
+ loginReasonExpired: "Your session has expired. Sign in again.",
2192
+ loginReasonUpdated: "Security settings changed. Sign in again.",
2193
+ loginReasonSignedOut: "You signed out of this device.",
2194
+ loginUnavailableTitle: "Sign-in is temporarily unavailable",
2195
+ loginUnavailableDescription: "The service status is unavailable. Check the connection and retry.",
2196
+ loginRetry: "Check again",
2197
+ loginErrorInvalidCredentials: "The username or password is incorrect. Try again.",
2198
+ loginErrorInvalidFactor: "The verification or backup code is incorrect. After five failed attempts, you must enter your password again.",
2199
+ loginErrorChallenge: "This verification expired. Enter your username and password again.",
2200
+ loginErrorUninitialized: "The account is not set up. Run the setup command in the server terminal.",
2201
+ settingsSectionLabel: "Security",
2202
+ settingsSectionAria: "Security settings",
2203
+ settingsTitle: "Account security",
2204
+ settingsAccountSummary: "Account: {username} \xB7 TOTP: {totp}",
2205
+ settingsTotpEnabled: "Enabled",
2206
+ settingsTotpNotBound: "Not connected",
2207
+ settingsLoading: "Loading account status\u2026",
2208
+ settingsChangePassword: "Change password",
2209
+ settingsBindTotp: "Connect TOTP",
2210
+ settingsRebindTotp: "Reconnect TOTP",
2211
+ settingsSessions: "Session management",
2212
+ settingsPasswordMismatch: "The new passwords do not match.",
2213
+ settingsPasswordDescription: "After this change, every device must sign in again.",
2214
+ settingsCurrentPassword: "Current password",
2215
+ settingsCurrentCode: "Current verification or backup code",
2216
+ settingsNewPassword: "New password",
2217
+ settingsConfirmPassword: "Confirm new password",
2218
+ settingsSavePassword: "Save new password",
2219
+ settingsBindDescription: "Enter your current credentials. After connecting the new authenticator, every device must sign in again.",
2220
+ settingsStartBinding: "Start setup",
2221
+ settingsDisableTotp: "Turn off TOTP",
2222
+ settingsDisableDescription: "After turning off TOTP, every device must sign in again.",
2223
+ settingsScanQr: "Scan the QR code",
2224
+ settingsQrAlt: "Authenticator setup QR code",
2225
+ settingsQrUnavailable: "The QR code is unavailable. Use the manual secret below.",
2226
+ settingsQrLoading: "Generating the QR code; you can use the manual secret below.",
2227
+ settingsManualSecret: "Manual secret:",
2228
+ settingsNewCode: "Six-digit code from the new authenticator",
2229
+ settingsConfirmBinding: "Confirm setup",
2230
+ settingsRestartBinding: "Start over",
2231
+ settingsSignOutCurrent: "Sign out this device",
2232
+ settingsSignOutAll: "Sign out every device",
2233
+ settingsSignOutAllDescription: "Enter your current credentials. All signed-in devices and open connections will be revoked.",
2234
+ settingsBackupTitle: "Save your backup codes",
2235
+ settingsBackupDescription: "These codes are shown only once. Store them safely; each code can be used only once.",
2236
+ settingsBackupSaved: "I saved them; sign in again",
2237
+ settingsErrorInvalidCredentials: "The current password is incorrect.",
2238
+ settingsErrorInvalidFactor: "The current verification or backup code is incorrect.",
2239
+ settingsErrorInvalidInput: "The input is invalid. Passwords must meet the server length rules.",
2240
+ settingsErrorChallenge: "The setup challenge expired. Start setup again.",
2241
+ settingsErrorTotpRequired: "This profile requires TOTP, so it cannot be turned off.",
2242
+ cliHelp: `dsh-auth-remote {version}
2243
+
2244
+ Usage:
2245
+ dsh plugin --profile web exec dsh-auth-remote [--lang en|zh] COMMAND
2246
+
2247
+ Commands:
2248
+ init Create the single account interactively
2249
+ status [--json] Show non-sensitive authentication status
2250
+ reset-password Reset the password and revoke all sessions
2251
+ reset-totp Clear TOTP, backup codes and all sessions
2252
+ revoke-sessions Sign out every device
2253
+
2254
+ Options:
2255
+ --lang en|zh Choose the language for human-readable output
2256
+ --help, -h Show this help
2257
+ --version, -v Show the package version
2258
+
2259
+ The command uses the profile selected by dsh plugin exec and the caller's DSH_HOME.
2260
+ `,
2261
+ cliPromptUsername: "Username: ",
2262
+ cliPromptPassword: "Password: ",
2263
+ cliPromptPasswordAgain: "Enter password again: ",
2264
+ cliPromptNewPassword: "New password: ",
2265
+ cliPromptNewPasswordAgain: "Enter new password again: ",
2266
+ cliPromptConfirmTarget: "Enter {profile} to confirm {command}: ",
2267
+ cliTargetProfile: "Target profile: {profile}",
2268
+ cliDataFile: "State file: {path}",
2269
+ cliStatusProfile: "Profile: {profile}",
2270
+ cliStatusAccount: "Account: {state}",
2271
+ cliStatusTotp: "TOTP: {state}",
2272
+ cliStatusSessions: "Active sessions: {count}",
2273
+ cliStatusService: "Service: {state}",
2274
+ cliInitialized: "Initialized",
2275
+ cliNotInitialized: "Not initialized",
2276
+ cliTotpEnabled: "Enabled",
2277
+ cliTotpDisabled: "Disabled",
2278
+ cliOnlineReady: "Online and ready",
2279
+ cliOnlineNotReady: "Online but not ready",
2280
+ cliOffline: "Offline",
2281
+ cliCompleted: "{command} completed; the change is durable and effective.",
2282
+ cliErrorInvalidArguments: "Invalid command or arguments. Use --help.",
2283
+ cliErrorInvalidLanguage: "Invalid --lang value. Use en or zh.",
2284
+ cliErrorDuplicateLanguage: "Specify --lang only once.",
2285
+ cliErrorMissingLanguage: "Missing value for --lang. Use en or zh.",
2286
+ cliErrorPasswordsMismatch: "The passwords do not match.",
2287
+ cliErrorConfirmationMismatch: "The confirmation did not match the target profile.",
2288
+ cliErrorPasswordLength: "Password must contain 12\u2013256 Unicode characters.",
2289
+ cliErrorTerminalRequired: "An interactive terminal is required.",
2290
+ cliErrorTerminalClosed: "Terminal input closed.",
2291
+ cliErrorCancelled: "Cancelled.",
2292
+ cliErrorProfileDirectory: "The current directory is not the selected DSH profile under DSH_HOME.",
2293
+ cliErrorProfileManifest: "The profile package.json is missing.",
2294
+ cliErrorUnsafeManagementDirectory: "The management directory has unsafe permissions.",
2295
+ cliErrorUnsafeManagementSocket: "The management socket has unsafe permissions.",
2296
+ cliErrorManagementUnavailable: "The management socket is unavailable.",
2297
+ cliErrorOutcomeUnknown: "The management request disconnected or timed out. Its result is unknown; check status before trying again.",
2298
+ cliErrorOfflineLock: "The management socket is unavailable while the service holds the profile lock. Offline access was refused.",
2299
+ cliErrorInvalidCredentials: "The current credentials are incorrect.",
2300
+ cliErrorAlreadyInitialized: "The account is already initialized.",
2301
+ cliErrorInvalidInput: "The input is invalid.",
2302
+ cliErrorInvalidFactor: "The verification or backup code is incorrect.",
2303
+ cliErrorUninitialized: "The account is not initialized.",
2304
+ cliErrorTotpRequired: "This profile requires TOTP.",
2305
+ cliErrorConflict: "The account state changed. Check status and retry.",
2306
+ cliErrorBusy: "The service is busy. Try again later.",
2307
+ cliErrorUnknown: "The operation failed. Check status before trying again."
2308
+ };
2309
+
2310
+ // src/shared/locales/zh.ts
2311
+ var zh = {
2312
+ brand: "DSH \xB7 \u8FDC\u7A0B\u767B\u5F55",
2313
+ errorNetwork: "\u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5\u3002",
2314
+ errorRateLimited: "\u5C1D\u8BD5\u8FC7\u4E8E\u9891\u7E41\uFF0C\u8BF7\u7EA6 {seconds} \u79D2\u540E\u91CD\u8BD5\u3002",
2315
+ errorUnauthorized: "\u4F1A\u8BDD\u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55\u3002",
2316
+ errorServiceUnavailable: "\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
2317
+ errorGeneric: "\u64CD\u4F5C\u672A\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5\u3002",
2318
+ loginInitialTitle: "\u767B\u5F55 DSH",
2319
+ loginInitialLoading: "\u6B63\u5728\u68C0\u67E5\u767B\u5F55\u72B6\u6001\u2026",
2320
+ loginLanguageLabel: "\u8BED\u8A00",
2321
+ loginSetupTitle: "\u5148\u521D\u59CB\u5316\u8D26\u53F7",
2322
+ loginSetupDescription: "\u8BF7\u5728\u8FD0\u884C DSH \u7684\u670D\u52A1\u5668\u7EC8\u7AEF\u8F93\u5165\u4E0B\u5217\u547D\u4EE4\uFF0C\u7136\u540E\u6309\u63D0\u793A\u521B\u5EFA\u7528\u6237\u540D\u548C\u5BC6\u7801\u3002\u7F51\u9875\u4E0D\u4F1A\u521B\u5EFA\u8D26\u53F7\u3002",
2323
+ loginSetupCopy: "\u590D\u5236\u547D\u4EE4",
2324
+ loginSetupRecheck: "\u6211\u5DF2\u5B8C\u6210\u521D\u59CB\u5316",
2325
+ loginSetupCopied: "\u547D\u4EE4\u5DF2\u590D\u5236\u3002",
2326
+ loginSetupCopyFallback: "\u8BF7\u624B\u52A8\u9009\u62E9\u5E76\u590D\u5236\u547D\u4EE4\u3002",
2327
+ loginSetupNotFound: "\u5C1A\u672A\u68C0\u6D4B\u5230\u8D26\u53F7\u3002\u8BF7\u786E\u8BA4\u547D\u4EE4\u4F7F\u7528\u4E86\u5F53\u524D profile\uFF0C\u518D\u91CD\u65B0\u68C0\u67E5\u3002",
2328
+ loginTitle: "\u767B\u5F55 DSH",
2329
+ loginDescription: "\u8F93\u5165\u670D\u52A1\u5668\u7EC8\u7AEF\u521B\u5EFA\u7684\u5355\u7528\u6237\u8D26\u53F7\u3002",
2330
+ loginUsername: "\u7528\u6237\u540D",
2331
+ loginPassword: "\u5BC6\u7801",
2332
+ loginContinue: "\u7EE7\u7EED",
2333
+ loginMfaTitle: "\u9A8C\u8BC1\u7B2C\u4E8C\u56E0\u7D20",
2334
+ loginMfaDescription: "\u8F93\u5165\u8EAB\u4EFD\u9A8C\u8BC1\u5668\u4E2D\u7684 6 \u4F4D\u6570\u5B57\uFF0C\u6216\u8F93\u5165\u4E00\u6B21\u6027\u5907\u7528\u7801\u3002\u6311\u6218 5 \u5206\u949F\u540E\u5931\u6548\u3002",
2335
+ loginMfaCode: "\u9A8C\u8BC1\u7801\u6216\u5907\u7528\u7801",
2336
+ loginMfaSubmit: "\u9A8C\u8BC1\u5E76\u767B\u5F55",
2337
+ loginBackToPassword: "\u8FD4\u56DE\u5BC6\u7801\u767B\u5F55",
2338
+ loginMfaExhausted: "\u672C\u6B21\u6311\u6218\u5DF2\u7528\u5C3D\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165\u5BC6\u7801\u3002",
2339
+ loginBindingTitle: "\u7ED1\u5B9A\u8EAB\u4EFD\u9A8C\u8BC1\u5668",
2340
+ loginBindingDescription: "\u4F7F\u7528\u8EAB\u4EFD\u9A8C\u8BC1\u5668\u626B\u63CF\u4E8C\u7EF4\u7801\uFF0C\u6216\u624B\u52A8\u8F93\u5165\u4E0B\u65B9\u5BC6\u94A5\u3002\u786E\u8BA4\u6210\u529F\u540E\u5C06\u663E\u793A 10 \u4E2A\u4E00\u6B21\u6027\u5907\u7528\u7801\uFF0C\u5E76\u8981\u6C42\u91CD\u65B0\u767B\u5F55\u3002",
2341
+ loginBindingQrAlt: "\u8EAB\u4EFD\u9A8C\u8BC1\u5668\u7ED1\u5B9A\u4E8C\u7EF4\u7801",
2342
+ loginBindingManualSecret: "\u624B\u5DE5\u5BC6\u94A5",
2343
+ loginBindingCode: "\u8EAB\u4EFD\u9A8C\u8BC1\u5668\u4E2D\u7684 6 \u4F4D\u9A8C\u8BC1\u7801",
2344
+ loginBindingConfirm: "\u786E\u8BA4\u7ED1\u5B9A",
2345
+ loginBindingRestart: "\u91CD\u65B0\u767B\u5F55",
2346
+ loginBindingQrUnavailable: "\u4E8C\u7EF4\u7801\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u4F7F\u7528\u4E0A\u65B9\u624B\u5DE5\u5BC6\u94A5\u3002",
2347
+ loginBindingExhausted: "\u7ED1\u5B9A\u6311\u6218\u5DF2\u7528\u5C3D\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165\u5BC6\u7801\u3002",
2348
+ loginBackupTitle: "\u4FDD\u5B58\u5907\u7528\u7801",
2349
+ loginBackupDescription: "\u8FD9\u4E9B\u5907\u7528\u7801\u53EA\u4F1A\u663E\u793A\u8FD9\u4E00\u6B21\u3002\u8BF7\u5B58\u653E\u5728\u5B89\u5168\u7684\u4F4D\u7F6E\uFF0C\u6BCF\u4E2A\u5907\u7528\u7801\u53EA\u80FD\u4F7F\u7528\u4E00\u6B21\u3002\u4FDD\u5B58\u540E\u91CD\u65B0\u767B\u5F55\u3002",
2350
+ loginBackupSaved: "\u6211\u5DF2\u4FDD\u5B58\uFF0C\u91CD\u65B0\u767B\u5F55",
2351
+ loginOptionalTitle: "\u4FDD\u62A4\u4F60\u7684\u8D26\u53F7",
2352
+ loginOptionalDescription: "\u5F53\u524D profile \u5141\u8BB8\u7A0D\u540E\u7ED1\u5B9A\u8EAB\u4EFD\u9A8C\u8BC1\u5668\u3002\u73B0\u5728\u7ED1\u5B9A\u53EF\u4EE5\u589E\u52A0\u4FDD\u62A4\uFF1B\u8DF3\u8FC7\u540E\u4E5F\u53EF\u5728\u5B89\u5168\u8BBE\u7F6E\u4E2D\u7ED1\u5B9A\u3002",
2353
+ loginOptionalBindNow: "\u73B0\u5728\u7ED1\u5B9A TOTP",
2354
+ loginOptionalSkip: "\u8DF3\u8FC7\uFF0C\u8FDB\u5165 DSH",
2355
+ loginOptionalVerifyTitle: "\u518D\u6B21\u9A8C\u8BC1\u540E\u7ED1\u5B9A",
2356
+ loginOptionalVerifyDescription: "\u4E3A\u4FDD\u62A4\u8D26\u53F7\uFF0C\u8BF7\u518D\u6B21\u8F93\u5165\u5F53\u524D\u5BC6\u7801\u3002",
2357
+ loginOptionalCurrentPassword: "\u5F53\u524D\u5BC6\u7801",
2358
+ loginOptionalStart: "\u5F00\u59CB\u7ED1\u5B9A",
2359
+ loginOptionalSkipLater: "\u7A0D\u540E\u7ED1\u5B9A\uFF0C\u8FDB\u5165 DSH",
2360
+ loginReasonExpired: "\u4F1A\u8BDD\u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55\u3002",
2361
+ loginReasonUpdated: "\u5B89\u5168\u8BBE\u7F6E\u5DF2\u66F4\u65B0\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55\u3002",
2362
+ loginReasonSignedOut: "\u5DF2\u9000\u51FA\u5F53\u524D\u8BBE\u5907\u3002",
2363
+ loginUnavailableTitle: "\u6682\u65F6\u65E0\u6CD5\u767B\u5F55",
2364
+ loginUnavailableDescription: "\u670D\u52A1\u72B6\u6001\u6682\u65F6\u65E0\u6CD5\u53D6\u5F97\uFF0C\u8BF7\u68C0\u67E5\u8FDE\u63A5\u5E76\u91CD\u8BD5\u3002",
2365
+ loginRetry: "\u91CD\u65B0\u68C0\u67E5",
2366
+ loginErrorInvalidCredentials: "\u7528\u6237\u540D\u6216\u5BC6\u7801\u4E0D\u6B63\u786E\uFF0C\u8BF7\u91CD\u8BD5\u3002",
2367
+ loginErrorInvalidFactor: "\u9A8C\u8BC1\u7801\u6216\u5907\u7528\u7801\u4E0D\u6B63\u786E\uFF1B\u8FDE\u7EED\u5931\u8D25 5 \u6B21\u540E\u9700\u91CD\u65B0\u8F93\u5165\u5BC6\u7801\u3002",
2368
+ loginErrorChallenge: "\u672C\u6B21\u9A8C\u8BC1\u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165\u7528\u6237\u540D\u548C\u5BC6\u7801\u3002",
2369
+ loginErrorUninitialized: "\u8D26\u53F7\u5C1A\u672A\u521D\u59CB\u5316\uFF0C\u8BF7\u5148\u5728\u670D\u52A1\u5668\u7EC8\u7AEF\u8FD0\u884C\u521D\u59CB\u5316\u547D\u4EE4\u3002",
2370
+ settingsSectionLabel: "\u5B89\u5168",
2371
+ settingsSectionAria: "\u5B89\u5168\u8BBE\u7F6E",
2372
+ settingsTitle: "\u8D26\u53F7\u5B89\u5168",
2373
+ settingsAccountSummary: "\u8D26\u53F7\uFF1A{username} \xB7 TOTP\uFF1A{totp}",
2374
+ settingsTotpEnabled: "\u5DF2\u542F\u7528",
2375
+ settingsTotpNotBound: "\u672A\u7ED1\u5B9A",
2376
+ settingsLoading: "\u6B63\u5728\u8BFB\u53D6\u8D26\u53F7\u72B6\u6001\u2026",
2377
+ settingsChangePassword: "\u4FEE\u6539\u5BC6\u7801",
2378
+ settingsBindTotp: "\u7ED1\u5B9A TOTP",
2379
+ settingsRebindTotp: "\u91CD\u65B0\u7ED1\u5B9A TOTP",
2380
+ settingsSessions: "\u4F1A\u8BDD\u7BA1\u7406",
2381
+ settingsPasswordMismatch: "\u4E24\u6B21\u8F93\u5165\u7684\u65B0\u5BC6\u7801\u4E0D\u4E00\u81F4\u3002",
2382
+ settingsPasswordDescription: "\u5B8C\u6210\u540E\u6240\u6709\u8BBE\u5907\u90FD\u9700\u8981\u91CD\u65B0\u767B\u5F55\u3002",
2383
+ settingsCurrentPassword: "\u5F53\u524D\u5BC6\u7801",
2384
+ settingsCurrentCode: "\u5F53\u524D\u9A8C\u8BC1\u7801\u6216\u5907\u7528\u7801",
2385
+ settingsNewPassword: "\u65B0\u5BC6\u7801",
2386
+ settingsConfirmPassword: "\u518D\u6B21\u8F93\u5165\u65B0\u5BC6\u7801",
2387
+ settingsSavePassword: "\u4FDD\u5B58\u65B0\u5BC6\u7801",
2388
+ settingsBindDescription: "\u8BF7\u8F93\u5165\u5F53\u524D\u51ED\u8BC1\uFF1B\u65B0\u7ED1\u5B9A\u5B8C\u6210\u540E\u6240\u6709\u8BBE\u5907\u90FD\u9700\u8981\u91CD\u65B0\u767B\u5F55\u3002",
2389
+ settingsStartBinding: "\u5F00\u59CB\u7ED1\u5B9A",
2390
+ settingsDisableTotp: "\u5173\u95ED TOTP",
2391
+ settingsDisableDescription: "\u5173\u95ED\u540E\u6240\u6709\u8BBE\u5907\u90FD\u9700\u8981\u91CD\u65B0\u767B\u5F55\u3002",
2392
+ settingsScanQr: "\u626B\u63CF\u4E8C\u7EF4\u7801",
2393
+ settingsQrAlt: "\u8EAB\u4EFD\u9A8C\u8BC1\u5668\u7ED1\u5B9A\u4E8C\u7EF4\u7801",
2394
+ settingsQrUnavailable: "\u4E8C\u7EF4\u7801\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u4F7F\u7528\u4E0B\u65B9\u624B\u5DE5\u5BC6\u94A5\u3002",
2395
+ settingsQrLoading: "\u4E8C\u7EF4\u7801\u751F\u6210\u4E2D\uFF1B\u4E5F\u53EF\u4EE5\u4F7F\u7528\u4E0B\u65B9\u624B\u5DE5\u5BC6\u94A5\u3002",
2396
+ settingsManualSecret: "\u624B\u5DE5\u5BC6\u94A5\uFF1A",
2397
+ settingsNewCode: "\u65B0\u8EAB\u4EFD\u9A8C\u8BC1\u5668\u7684 6 \u4F4D\u9A8C\u8BC1\u7801",
2398
+ settingsConfirmBinding: "\u786E\u8BA4\u7ED1\u5B9A",
2399
+ settingsRestartBinding: "\u91CD\u65B0\u5F00\u59CB",
2400
+ settingsSignOutCurrent: "\u9000\u51FA\u5F53\u524D\u8BBE\u5907",
2401
+ settingsSignOutAll: "\u9000\u51FA\u5168\u90E8\u8BBE\u5907",
2402
+ settingsSignOutAllDescription: "\u8BF7\u8F93\u5165\u5F53\u524D\u51ED\u8BC1\uFF1B\u63D0\u4EA4\u540E\u6240\u6709\u5DF2\u767B\u5F55\u8BBE\u5907\u548C\u957F\u8FDE\u63A5\u90FD\u4F1A\u5931\u6548\u3002",
2403
+ settingsBackupTitle: "\u4FDD\u5B58\u5907\u7528\u7801",
2404
+ settingsBackupDescription: "\u8FD9\u4E9B\u5907\u7528\u7801\u53EA\u4F1A\u663E\u793A\u8FD9\u4E00\u6B21\u3002\u8BF7\u5B58\u653E\u5728\u5B89\u5168\u7684\u4F4D\u7F6E\uFF0C\u6BCF\u4E2A\u5907\u7528\u7801\u53EA\u80FD\u4F7F\u7528\u4E00\u6B21\u3002",
2405
+ settingsBackupSaved: "\u6211\u5DF2\u4FDD\u5B58\uFF0C\u91CD\u65B0\u767B\u5F55",
2406
+ settingsErrorInvalidCredentials: "\u5F53\u524D\u5BC6\u7801\u4E0D\u6B63\u786E\u3002",
2407
+ settingsErrorInvalidFactor: "\u5F53\u524D\u9A8C\u8BC1\u7801\u6216\u5907\u7528\u7801\u4E0D\u6B63\u786E\u3002",
2408
+ settingsErrorInvalidInput: "\u8F93\u5165\u4E0D\u7B26\u5408\u8981\u6C42\uFF1B\u5BC6\u7801\u9700\u7B26\u5408\u670D\u52A1\u7AEF\u957F\u5EA6\u89C4\u5219\u3002",
2409
+ settingsErrorChallenge: "\u7ED1\u5B9A\u6311\u6218\u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0\u5F00\u59CB\u7ED1\u5B9A\u3002",
2410
+ settingsErrorTotpRequired: "\u5F53\u524D profile \u8981\u6C42 TOTP\uFF0C\u65E0\u6CD5\u5173\u95ED\u3002",
2411
+ cliHelp: `dsh-auth-remote {version}
2412
+
2413
+ \u7528\u6CD5\uFF1A
2414
+ dsh plugin --profile web exec dsh-auth-remote [--lang en|zh] COMMAND
2415
+
2416
+ \u547D\u4EE4\uFF1A
2417
+ init \u5728\u7EC8\u7AEF\u4EA4\u4E92\u521D\u59CB\u5316\u5355\u7528\u6237\u8D26\u53F7
2418
+ status [--json] \u67E5\u770B\u4E0D\u542B\u79D8\u5BC6\u7684\u8BA4\u8BC1\u72B6\u6001
2419
+ reset-password \u91CD\u7F6E\u5BC6\u7801\u5E76\u64A4\u9500\u5168\u90E8\u4F1A\u8BDD
2420
+ reset-totp \u6E05\u9664 TOTP\u3001\u5907\u7528\u7801\u53CA\u5168\u90E8\u4F1A\u8BDD
2421
+ revoke-sessions \u9000\u51FA\u6240\u6709\u8BBE\u5907
2422
+
2423
+ \u9009\u9879\uFF1A
2424
+ --lang en|zh \u9009\u62E9\u4EBA\u7C7B\u53EF\u8BFB\u8F93\u51FA\u7684\u8BED\u8A00
2425
+ --help, -h \u663E\u793A\u5E2E\u52A9
2426
+ --version, -v \u663E\u793A\u5305\u7248\u672C
2427
+
2428
+ \u547D\u4EE4\u4F7F\u7528 dsh plugin exec \u9009\u5B9A\u7684 profile \u548C\u8C03\u7528\u8005\u7684 DSH_HOME\u3002
2429
+ `,
2430
+ cliPromptUsername: "\u7528\u6237\u540D: ",
2431
+ cliPromptPassword: "\u5BC6\u7801: ",
2432
+ cliPromptPasswordAgain: "\u518D\u6B21\u8F93\u5165\u5BC6\u7801: ",
2433
+ cliPromptNewPassword: "\u65B0\u5BC6\u7801: ",
2434
+ cliPromptNewPasswordAgain: "\u518D\u6B21\u8F93\u5165\u65B0\u5BC6\u7801: ",
2435
+ cliPromptConfirmTarget: "\u8F93\u5165 {profile} \u4EE5\u786E\u8BA4 {command}: ",
2436
+ cliTargetProfile: "\u76EE\u6807 profile: {profile}",
2437
+ cliDataFile: "\u6570\u636E\u6587\u4EF6: {path}",
2438
+ cliStatusProfile: "profile: {profile}",
2439
+ cliStatusAccount: "\u8D26\u53F7: {state}",
2440
+ cliStatusTotp: "TOTP: {state}",
2441
+ cliStatusSessions: "\u6709\u6548\u4F1A\u8BDD: {count}",
2442
+ cliStatusService: "\u670D\u52A1: {state}",
2443
+ cliInitialized: "\u5DF2\u521D\u59CB\u5316",
2444
+ cliNotInitialized: "\u672A\u521D\u59CB\u5316",
2445
+ cliTotpEnabled: "\u5DF2\u542F\u7528",
2446
+ cliTotpDisabled: "\u672A\u542F\u7528",
2447
+ cliOnlineReady: "\u5728\u7EBF\u4E14\u5C31\u7EEA",
2448
+ cliOnlineNotReady: "\u5728\u7EBF\u4F46\u672A\u5C31\u7EEA",
2449
+ cliOffline: "\u79BB\u7EBF",
2450
+ cliCompleted: "{command} \u5DF2\u5B8C\u6210\uFF1B\u53D8\u66F4\u5DF2\u6301\u4E45\u5316\u5E76\u751F\u6548\u3002",
2451
+ cliErrorInvalidArguments: "\u547D\u4EE4\u6216\u53C2\u6570\u65E0\u6548\uFF0C\u8BF7\u4F7F\u7528 --help\u3002",
2452
+ cliErrorInvalidLanguage: "--lang \u7684\u503C\u65E0\u6548\uFF0C\u8BF7\u4F7F\u7528 en \u6216 zh\u3002",
2453
+ cliErrorDuplicateLanguage: "--lang \u53EA\u80FD\u6307\u5B9A\u4E00\u6B21\u3002",
2454
+ cliErrorMissingLanguage: "--lang \u7F3A\u5C11\u503C\uFF0C\u8BF7\u4F7F\u7528 en \u6216 zh\u3002",
2455
+ cliErrorPasswordsMismatch: "\u4E24\u6B21\u8F93\u5165\u7684\u5BC6\u7801\u4E0D\u4E00\u81F4\u3002",
2456
+ cliErrorConfirmationMismatch: "\u786E\u8BA4\u8F93\u5165\u4E0E\u76EE\u6807 profile \u4E0D\u4E00\u81F4\u3002",
2457
+ cliErrorPasswordLength: "\u5BC6\u7801\u987B\u5305\u542B 12\u2013256 \u4E2A Unicode \u5B57\u7B26\u3002",
2458
+ cliErrorTerminalRequired: "\u6B64\u64CD\u4F5C\u9700\u8981\u4EA4\u4E92\u7EC8\u7AEF\u3002",
2459
+ cliErrorTerminalClosed: "\u7EC8\u7AEF\u8F93\u5165\u5DF2\u5173\u95ED\u3002",
2460
+ cliErrorCancelled: "\u5DF2\u53D6\u6D88\u3002",
2461
+ cliErrorProfileDirectory: "\u5F53\u524D\u76EE\u5F55\u4E0D\u662F DSH_HOME \u4E0B\u9009\u5B9A\u7684 DSH profile\u3002",
2462
+ cliErrorProfileManifest: "\u7F3A\u5C11 profile \u7684 package.json\u3002",
2463
+ cliErrorUnsafeManagementDirectory: "\u7BA1\u7406\u76EE\u5F55\u6743\u9650\u4E0D\u5B89\u5168\u3002",
2464
+ cliErrorUnsafeManagementSocket: "\u7BA1\u7406 socket \u6743\u9650\u4E0D\u5B89\u5168\u3002",
2465
+ cliErrorManagementUnavailable: "\u7BA1\u7406 socket \u4E0D\u53EF\u7528\u3002",
2466
+ cliErrorOutcomeUnknown: "\u7BA1\u7406\u8BF7\u6C42\u5DF2\u65AD\u5F00\u6216\u8D85\u65F6\uFF0C\u7ED3\u679C\u672A\u77E5\uFF1B\u518D\u6B21\u64CD\u4F5C\u524D\u8BF7\u5148\u68C0\u67E5\u72B6\u6001\u3002",
2467
+ cliErrorOfflineLock: "\u670D\u52A1\u4ECD\u6301\u6709 profile \u9501\u4E14\u7BA1\u7406 socket \u4E0D\u53EF\u7528\uFF0C\u5DF2\u62D2\u7EDD\u79BB\u7EBF\u64CD\u4F5C\u3002",
2468
+ cliErrorInvalidCredentials: "\u5F53\u524D\u51ED\u8BC1\u4E0D\u6B63\u786E\u3002",
2469
+ cliErrorAlreadyInitialized: "\u8D26\u53F7\u5DF2\u521D\u59CB\u5316\u3002",
2470
+ cliErrorInvalidInput: "\u8F93\u5165\u65E0\u6548\u3002",
2471
+ cliErrorInvalidFactor: "\u9A8C\u8BC1\u7801\u6216\u5907\u7528\u7801\u4E0D\u6B63\u786E\u3002",
2472
+ cliErrorUninitialized: "\u8D26\u53F7\u5C1A\u672A\u521D\u59CB\u5316\u3002",
2473
+ cliErrorTotpRequired: "\u6B64 profile \u8981\u6C42 TOTP\u3002",
2474
+ cliErrorConflict: "\u8D26\u53F7\u72B6\u6001\u5DF2\u53D8\u5316\uFF0C\u8BF7\u68C0\u67E5\u72B6\u6001\u540E\u91CD\u8BD5\u3002",
2475
+ cliErrorBusy: "\u670D\u52A1\u6B63\u5FD9\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
2476
+ cliErrorUnknown: "\u64CD\u4F5C\u5931\u8D25\uFF1B\u518D\u6B21\u64CD\u4F5C\u524D\u8BF7\u5148\u68C0\u67E5\u72B6\u6001\u3002"
2477
+ };
2478
+
2479
+ // src/shared/i18n.ts
2480
+ var dictionaries = { en, zh };
2481
+ function parseExactLocale(value) {
2482
+ return value === "en" || value === "zh" ? value : null;
2483
+ }
2484
+ function normalizeLocale(value) {
2485
+ return parseExactLocale(value) ?? "en";
2486
+ }
2487
+ function formatMessage(locale2, key, ...args) {
2488
+ const template = dictionaries[normalizeLocale(locale2)][key];
2489
+ const values = args[0] ?? {};
2490
+ return template.replace(/\{([A-Za-z][A-Za-z0-9]*)\}/gu, (_match, name) => {
2491
+ if (!Object.hasOwn(values, name)) throw new Error(`Missing i18n parameter ${name} for ${key}`);
2492
+ return String(values[name]);
2493
+ });
2494
+ }
2495
+
2496
+ // src/client/login/index.ts
2497
+ var root = document.getElementById("login-root");
2498
+ if (!root) throw new Error("Missing login root");
2499
+ var RequestFailure = class extends Error {
2500
+ constructor(status, code, retryAfter) {
2501
+ super(code);
2502
+ this.status = status;
2503
+ this.code = code;
2504
+ this.retryAfter = retryAfter;
2505
+ }
2506
+ status;
2507
+ code;
2508
+ retryAfter;
2509
+ };
2510
+ var state;
2511
+ var busy = false;
2512
+ var lastUsername = "";
2513
+ var localeKey = "dsh-auth-remote.locale";
2514
+ var locale = readLocale();
2515
+ var titleKey = "loginInitialTitle";
2516
+ var currentMessage = null;
2517
+ function readLocale() {
2518
+ try {
2519
+ return parseExactLocale(localStorage.getItem(localeKey)) ?? "en";
2520
+ } catch {
2521
+ return "en";
2522
+ }
2523
+ }
2524
+ function setLocale(value) {
2525
+ const next = parseExactLocale(value);
2526
+ if (!next) return;
2527
+ locale = next;
2528
+ try {
2529
+ localStorage.setItem(localeKey, next);
2530
+ } catch {
2531
+ }
2532
+ localize();
2533
+ }
2534
+ function t(key, params) {
2535
+ return formatMessage(locale, key, params ?? {});
2536
+ }
2537
+ function localize() {
2538
+ document.documentElement.lang = locale;
2539
+ document.title = t(titleKey);
2540
+ for (const node of root.querySelectorAll("[data-i18n]")) {
2541
+ node.textContent = t(node.dataset.i18n);
2542
+ }
2543
+ for (const node of root.querySelectorAll("[data-i18n-aria-label]")) {
2544
+ node.setAttribute("aria-label", t(node.dataset.i18nAriaLabel));
2545
+ }
2546
+ const select = document.getElementById("language");
2547
+ if (select) select.value = locale;
2548
+ paintMessage();
2549
+ }
2550
+ function element(id) {
2551
+ const found = document.getElementById(id);
2552
+ if (!found) throw new Error(`Missing login element ${id}`);
2553
+ return found;
2554
+ }
2555
+ function returnPath() {
2556
+ const raw = new URLSearchParams(location.search).get("return");
2557
+ if (!raw || !raw.startsWith("/") || raw.startsWith("//") || raw.includes("\\")) return "/";
2558
+ try {
2559
+ const target = new URL(raw, location.origin);
2560
+ if (target.origin !== location.origin || target.pathname.startsWith("/auth-remote")) return "/";
2561
+ if (target.pathname === "/") target.searchParams.delete("token");
2562
+ return target.pathname + target.search + target.hash;
2563
+ } catch {
2564
+ return "/";
2565
+ }
2566
+ }
2567
+ function enterDsh() {
2568
+ location.assign(returnPath());
2569
+ }
2570
+ async function api(path, body) {
2571
+ const response = await fetch(path, {
2572
+ method: body === void 0 ? "GET" : "POST",
2573
+ ...body === void 0 ? {} : { headers: { "content-type": "application/json" }, body: JSON.stringify(body) },
2574
+ cache: "no-store",
2575
+ credentials: "same-origin"
2576
+ });
2577
+ const result = await response.json().catch(() => ({}));
2578
+ if (!response.ok) {
2579
+ const failure = result;
2580
+ const seconds = Number(response.headers.get("retry-after"));
2581
+ throw new RequestFailure(
2582
+ response.status,
2583
+ typeof failure.error === "string" ? failure.error : "service_unavailable",
2584
+ Number.isFinite(seconds) && seconds > 0 ? seconds : failure.retryAfter
2585
+ );
2586
+ }
2587
+ return result;
2588
+ }
2589
+ function errorMessage(error) {
2590
+ if (!(error instanceof RequestFailure)) return { key: "errorNetwork" };
2591
+ switch (error.code) {
2592
+ case "invalid_credentials":
2593
+ return { key: "loginErrorInvalidCredentials" };
2594
+ case "invalid_factor":
2595
+ return { key: "loginErrorInvalidFactor" };
2596
+ case "invalid_challenge":
2597
+ case "challenge_expired":
2598
+ case "conflict":
2599
+ return { key: "loginErrorChallenge" };
2600
+ case "rate_limited":
2601
+ case "busy":
2602
+ return { key: "errorRateLimited", params: { seconds: error.retryAfter ?? 1 } };
2603
+ case "uninitialized":
2604
+ return { key: "loginErrorUninitialized" };
2605
+ case "unauthorized":
2606
+ return { key: "errorUnauthorized" };
2607
+ default:
2608
+ return { key: error.status === 503 ? "errorServiceUnavailable" : "errorGeneric" };
2609
+ }
2610
+ }
2611
+ function paintMessage() {
2612
+ const target = document.getElementById("message");
2613
+ if (!target) return;
2614
+ target.textContent = currentMessage ? t(currentMessage.key, currentMessage.params) : "";
2615
+ target.className = currentMessage?.tone === "info" ? "message info" : "message error";
2616
+ }
2617
+ function showMessage(message) {
2618
+ currentMessage = message;
2619
+ paintMessage();
2620
+ }
2621
+ async function perform(action) {
2622
+ if (busy) return;
2623
+ busy = true;
2624
+ const buttons = [...root.querySelectorAll("button")];
2625
+ for (const button of buttons) button.disabled = true;
2626
+ try {
2627
+ await action();
2628
+ } catch (error) {
2629
+ showMessage(errorMessage(error));
2630
+ } finally {
2631
+ busy = false;
2632
+ for (const button of buttons) button.disabled = false;
2633
+ }
2634
+ }
2635
+ function shell(nextTitleKey, content) {
2636
+ titleKey = nextTitleKey;
2637
+ currentMessage = null;
2638
+ root.innerHTML = `<div class="login-page"><section class="login-card"><div class="login-header"><div class="brand" data-i18n="brand"></div><div class="language-control"><label for="language" data-i18n="loginLanguageLabel"></label><select id="language"><option value="en">English</option><option value="zh">\u4E2D\u6587</option></select></div></div><h1 data-i18n="${nextTitleKey}"></h1>${content}<p id="message" class="message" role="alert" aria-live="assertive"></p></section></div>`;
2639
+ element("language").addEventListener("change", (event) => {
2640
+ setLocale(event.currentTarget.value);
2641
+ });
2642
+ localize();
2643
+ }
2644
+ function copyText(value) {
2645
+ return (async () => {
2646
+ try {
2647
+ if (navigator.clipboard?.writeText) {
2648
+ await navigator.clipboard.writeText(value);
2649
+ return true;
2650
+ }
2651
+ } catch {
2652
+ }
2653
+ const field = document.createElement("textarea");
2654
+ field.value = value;
2655
+ field.setAttribute("readonly", "");
2656
+ field.style.position = "fixed";
2657
+ field.style.opacity = "0";
2658
+ document.body.append(field);
2659
+ field.select();
2660
+ const copied = document.execCommand("copy");
2661
+ field.remove();
2662
+ return copied;
2663
+ })();
2664
+ }
2665
+ function renderSetup() {
2666
+ const profile = state?.profileName ?? "web";
2667
+ const command = `dsh plugin --profile ${profile} exec dsh-auth-remote init`;
2668
+ shell(
2669
+ "loginSetupTitle",
2670
+ '<p data-i18n="loginSetupDescription"></p><div class="command"><code id="setup-command"></code><button id="copy-command" type="button" class="secondary" data-i18n="loginSetupCopy"></button></div><button id="recheck" type="button" data-i18n="loginSetupRecheck"></button>'
2671
+ );
2672
+ element("setup-command").textContent = command;
2673
+ element("copy-command").addEventListener("click", () => {
2674
+ void perform(async () => {
2675
+ const copied = await copyText(command);
2676
+ showMessage({ key: copied ? "loginSetupCopied" : "loginSetupCopyFallback", tone: "info" });
2677
+ });
2678
+ });
2679
+ element("recheck").addEventListener("click", () => {
2680
+ void perform(async () => {
2681
+ state = await api("/auth-remote/state");
2682
+ if (state.initialized) renderLogin();
2683
+ else showMessage({ key: "loginSetupNotFound" });
2684
+ });
2685
+ });
2686
+ }
2687
+ function renderLogin(message) {
2688
+ shell(
2689
+ "loginTitle",
2690
+ '<p data-i18n="loginDescription"></p><form id="login-form"><label for="username" data-i18n="loginUsername"></label><input id="username" name="username" autocomplete="username" required><label for="password" data-i18n="loginPassword"></label><input id="password" name="password" type="password" autocomplete="current-password" required><button type="submit" data-i18n="loginContinue"></button></form>'
2691
+ );
2692
+ element("username").value = lastUsername;
2693
+ if (message) showMessage(message);
2694
+ element("login-form").addEventListener("submit", (event) => {
2695
+ event.preventDefault();
2696
+ void perform(async () => {
2697
+ const username = element("username").value;
2698
+ const password = element("password").value;
2699
+ lastUsername = username;
2700
+ const result = await api("/auth-remote/login", { username, password });
2701
+ element("password").value = "";
2702
+ if (result.kind === "session") {
2703
+ if (state?.requireTotp === false) renderOptional();
2704
+ else enterDsh();
2705
+ } else if (result.kind === "mfa") renderMfa(result.challenge);
2706
+ else {
2707
+ const binding = await api(
2708
+ "/auth-remote/totp/start",
2709
+ {
2710
+ challenge: result.challenge
2711
+ }
2712
+ );
2713
+ await renderBinding(result.challenge, binding.secret);
2714
+ }
2715
+ });
2716
+ });
2717
+ }
2718
+ function renderMfa(challenge) {
2719
+ let failures = 0;
2720
+ shell(
2721
+ "loginMfaTitle",
2722
+ '<p data-i18n="loginMfaDescription"></p><form id="mfa-form"><label for="mfa-code" data-i18n="loginMfaCode"></label><input id="mfa-code" name="code" autocomplete="one-time-code" required><button type="submit" data-i18n="loginMfaSubmit"></button></form><button id="restart" type="button" class="link-button" data-i18n="loginBackToPassword"></button>'
2723
+ );
2724
+ element("restart").addEventListener("click", () => renderLogin());
2725
+ element("mfa-form").addEventListener("submit", (event) => {
2726
+ event.preventDefault();
2727
+ void perform(async () => {
2728
+ try {
2729
+ await api("/auth-remote/mfa/verify", {
2730
+ challenge,
2731
+ code: element("mfa-code").value.trim()
2732
+ });
2733
+ enterDsh();
2734
+ } catch (error) {
2735
+ if (error instanceof RequestFailure && error.code === "invalid_factor") {
2736
+ failures++;
2737
+ if (failures >= 5) {
2738
+ renderLogin({ key: "loginMfaExhausted" });
2739
+ return;
2740
+ }
2741
+ }
2742
+ if (error instanceof RequestFailure && ["invalid_challenge", "challenge_expired", "conflict"].includes(error.code)) {
2743
+ renderLogin(errorMessage(error));
2744
+ return;
2745
+ }
2746
+ throw error;
2747
+ }
2748
+ });
2749
+ });
2750
+ }
2751
+ async function renderBinding(challenge, secret) {
2752
+ let failures = 0;
2753
+ shell(
2754
+ "loginBindingTitle",
2755
+ '<p data-i18n="loginBindingDescription"></p><canvas id="totp-qr" width="220" height="220" data-i18n-aria-label="loginBindingQrAlt" role="img"></canvas><div class="secret"><span data-i18n="loginBindingManualSecret"></span><code id="totp-secret"></code></div><form id="bind-form"><label for="bind-code" data-i18n="loginBindingCode"></label><input id="bind-code" name="code" inputmode="numeric" autocomplete="one-time-code" pattern="[0-9]{6}" maxlength="6" required><button type="submit" data-i18n="loginBindingConfirm"></button></form><button id="restart" type="button" class="link-button" data-i18n="loginBindingRestart"></button>'
2756
+ );
2757
+ element("totp-secret").textContent = secret;
2758
+ const issuer = "DSH Auth Remote";
2759
+ const label = `${issuer}:${lastUsername}`;
2760
+ const uri = `otpauth://totp/${encodeURIComponent(label)}?secret=${secret}&issuer=${encodeURIComponent(issuer)}&algorithm=SHA1&digits=6&period=30`;
2761
+ try {
2762
+ await import_qrcode.default.toCanvas(element("totp-qr"), uri, {
2763
+ width: 220,
2764
+ margin: 2,
2765
+ errorCorrectionLevel: "M"
2766
+ });
2767
+ } catch {
2768
+ showMessage({ key: "loginBindingQrUnavailable" });
2769
+ }
2770
+ element("restart").addEventListener("click", () => renderLogin());
2771
+ element("bind-form").addEventListener("submit", (event) => {
2772
+ event.preventDefault();
2773
+ void perform(async () => {
2774
+ try {
2775
+ const result = await api("/auth-remote/totp/confirm", {
2776
+ challenge,
2777
+ code: element("bind-code").value.trim()
2778
+ });
2779
+ renderBackupCodes(result.backupCodes);
2780
+ } catch (error) {
2781
+ if (error instanceof RequestFailure && error.code === "invalid_factor") {
2782
+ failures++;
2783
+ if (failures >= 5) {
2784
+ renderLogin({ key: "loginBindingExhausted" });
2785
+ return;
2786
+ }
2787
+ }
2788
+ if (error instanceof RequestFailure && ["invalid_challenge", "challenge_expired", "conflict"].includes(error.code)) {
2789
+ renderLogin(errorMessage(error));
2790
+ return;
2791
+ }
2792
+ throw error;
2793
+ }
2794
+ });
2795
+ });
2796
+ }
2797
+ function renderBackupCodes(codes) {
2798
+ shell(
2799
+ "loginBackupTitle",
2800
+ '<p data-i18n="loginBackupDescription"></p><ol id="backup-codes" class="backup-codes"></ol><button id="relogin" type="button" data-i18n="loginBackupSaved"></button>'
2801
+ );
2802
+ const list = element("backup-codes");
2803
+ for (const code of codes) {
2804
+ const item = document.createElement("li");
2805
+ item.textContent = code;
2806
+ list.append(item);
2807
+ }
2808
+ element("relogin").addEventListener("click", () => renderLogin());
2809
+ }
2810
+ function renderOptional() {
2811
+ shell(
2812
+ "loginOptionalTitle",
2813
+ '<p data-i18n="loginOptionalDescription"></p><div class="actions"><button id="bind-now" type="button" data-i18n="loginOptionalBindNow"></button><button id="skip-binding" type="button" class="secondary" data-i18n="loginOptionalSkip"></button></div>'
2814
+ );
2815
+ element("skip-binding").addEventListener("click", enterDsh);
2816
+ element("bind-now").addEventListener("click", () => {
2817
+ shell(
2818
+ "loginOptionalVerifyTitle",
2819
+ '<p data-i18n="loginOptionalVerifyDescription"></p><form id="optional-bind-form"><label for="bind-password" data-i18n="loginOptionalCurrentPassword"></label><input id="bind-password" type="password" autocomplete="current-password" required><button type="submit" data-i18n="loginOptionalStart"></button></form><button id="skip-binding" type="button" class="link-button" data-i18n="loginOptionalSkipLater"></button>'
2820
+ );
2821
+ element("skip-binding").addEventListener("click", enterDsh);
2822
+ element("optional-bind-form").addEventListener("submit", (event) => {
2823
+ event.preventDefault();
2824
+ void perform(async () => {
2825
+ const password = element("bind-password").value;
2826
+ const result = await api("/auth-remote/totp/start", {
2827
+ password
2828
+ });
2829
+ element("bind-password").value = "";
2830
+ await renderBinding(result.challenge, result.secret);
2831
+ });
2832
+ });
2833
+ });
2834
+ }
2835
+ async function start() {
2836
+ try {
2837
+ state = await api("/auth-remote/state");
2838
+ if (!state.initialized) {
2839
+ renderSetup();
2840
+ return;
2841
+ }
2842
+ const existing = await fetch("/auth-remote/me", {
2843
+ credentials: "same-origin",
2844
+ cache: "no-store"
2845
+ });
2846
+ if (existing.ok) {
2847
+ enterDsh();
2848
+ return;
2849
+ }
2850
+ const reason = new URLSearchParams(location.search).get("reason");
2851
+ renderLogin(
2852
+ reason === "expired" ? { key: "loginReasonExpired" } : reason === "updated" ? { key: "loginReasonUpdated" } : reason === "signed-out" ? { key: "loginReasonSignedOut" } : void 0
2853
+ );
2854
+ } catch (error) {
2855
+ shell(
2856
+ "loginUnavailableTitle",
2857
+ '<p data-i18n="loginUnavailableDescription"></p><button id="retry" type="button" data-i18n="loginRetry"></button>'
2858
+ );
2859
+ showMessage(errorMessage(error));
2860
+ element("retry").addEventListener("click", () => void start());
2861
+ }
2862
+ }
2863
+ void start();
2864
+ })();
2865
+ //# sourceMappingURL=login.js.map