dsh-dock 0.6.0 → 0.7.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.
package/client.js CHANGED
@@ -11,6 +11,13 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11
11
  var __getOwnPropNames = Object.getOwnPropertyNames;
12
12
  var __getProtoOf = Object.getPrototypeOf;
13
13
  var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __commonJS = (cb, mod) => function __require() {
15
+ try {
16
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
17
+ } catch (e) {
18
+ throw mod = 0, e;
19
+ }
20
+ };
14
21
  var __export = (target, all) => {
15
22
  for (var name in all)
16
23
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -21,17 +28,2095 @@ var __copyProps = (to, from, except, desc) => {
21
28
  if (!__hasOwnProp.call(to, key) && key !== except)
22
29
  __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
30
  }
24
- return to;
25
- };
26
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
27
- // If the importer is in node compatibility mode or this is not an ESM
28
- // file that has been converted to a CommonJS file using a Babel-
29
- // compatible transform (i.e. "__esModule" has not been set), then set
30
- // "default" to the CommonJS "module.exports" for node compatibility.
31
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
32
- mod
33
- ));
34
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+ return to;
32
+ };
33
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
34
+ // If the importer is in node compatibility mode or this is not an ESM
35
+ // file that has been converted to a CommonJS file using a Babel-
36
+ // compatible transform (i.e. "__esModule" has not been set), then set
37
+ // "default" to the CommonJS "module.exports" for node compatibility.
38
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
39
+ mod
40
+ ));
41
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
42
+
43
+ // node_modules/qrcode/lib/can-promise.js
44
+ var require_can_promise = __commonJS({
45
+ "node_modules/qrcode/lib/can-promise.js"(exports, module2) {
46
+ module2.exports = function() {
47
+ return typeof Promise === "function" && Promise.prototype && Promise.prototype.then;
48
+ };
49
+ }
50
+ });
51
+
52
+ // node_modules/qrcode/lib/core/utils.js
53
+ var require_utils = __commonJS({
54
+ "node_modules/qrcode/lib/core/utils.js"(exports) {
55
+ var toSJISFunction;
56
+ var CODEWORDS_COUNT = [
57
+ 0,
58
+ // Not used
59
+ 26,
60
+ 44,
61
+ 70,
62
+ 100,
63
+ 134,
64
+ 172,
65
+ 196,
66
+ 242,
67
+ 292,
68
+ 346,
69
+ 404,
70
+ 466,
71
+ 532,
72
+ 581,
73
+ 655,
74
+ 733,
75
+ 815,
76
+ 901,
77
+ 991,
78
+ 1085,
79
+ 1156,
80
+ 1258,
81
+ 1364,
82
+ 1474,
83
+ 1588,
84
+ 1706,
85
+ 1828,
86
+ 1921,
87
+ 2051,
88
+ 2185,
89
+ 2323,
90
+ 2465,
91
+ 2611,
92
+ 2761,
93
+ 2876,
94
+ 3034,
95
+ 3196,
96
+ 3362,
97
+ 3532,
98
+ 3706
99
+ ];
100
+ exports.getSymbolSize = function getSymbolSize(version) {
101
+ if (!version) throw new Error('"version" cannot be null or undefined');
102
+ if (version < 1 || version > 40) throw new Error('"version" should be in range from 1 to 40');
103
+ return version * 4 + 17;
104
+ };
105
+ exports.getSymbolTotalCodewords = function getSymbolTotalCodewords(version) {
106
+ return CODEWORDS_COUNT[version];
107
+ };
108
+ exports.getBCHDigit = function(data) {
109
+ let digit = 0;
110
+ while (data !== 0) {
111
+ digit++;
112
+ data >>>= 1;
113
+ }
114
+ return digit;
115
+ };
116
+ exports.setToSJISFunction = function setToSJISFunction(f) {
117
+ if (typeof f !== "function") {
118
+ throw new Error('"toSJISFunc" is not a valid function.');
119
+ }
120
+ toSJISFunction = f;
121
+ };
122
+ exports.isKanjiModeEnabled = function() {
123
+ return typeof toSJISFunction !== "undefined";
124
+ };
125
+ exports.toSJIS = function toSJIS(kanji) {
126
+ return toSJISFunction(kanji);
127
+ };
128
+ }
129
+ });
130
+
131
+ // node_modules/qrcode/lib/core/error-correction-level.js
132
+ var require_error_correction_level = __commonJS({
133
+ "node_modules/qrcode/lib/core/error-correction-level.js"(exports) {
134
+ exports.L = { bit: 1 };
135
+ exports.M = { bit: 0 };
136
+ exports.Q = { bit: 3 };
137
+ exports.H = { bit: 2 };
138
+ function fromString(string) {
139
+ if (typeof string !== "string") {
140
+ throw new Error("Param is not a string");
141
+ }
142
+ const lcStr = string.toLowerCase();
143
+ switch (lcStr) {
144
+ case "l":
145
+ case "low":
146
+ return exports.L;
147
+ case "m":
148
+ case "medium":
149
+ return exports.M;
150
+ case "q":
151
+ case "quartile":
152
+ return exports.Q;
153
+ case "h":
154
+ case "high":
155
+ return exports.H;
156
+ default:
157
+ throw new Error("Unknown EC Level: " + string);
158
+ }
159
+ }
160
+ exports.isValid = function isValid(level) {
161
+ return level && typeof level.bit !== "undefined" && level.bit >= 0 && level.bit < 4;
162
+ };
163
+ exports.from = function from(value, defaultValue) {
164
+ if (exports.isValid(value)) {
165
+ return value;
166
+ }
167
+ try {
168
+ return fromString(value);
169
+ } catch (e) {
170
+ return defaultValue;
171
+ }
172
+ };
173
+ }
174
+ });
175
+
176
+ // node_modules/qrcode/lib/core/bit-buffer.js
177
+ var require_bit_buffer = __commonJS({
178
+ "node_modules/qrcode/lib/core/bit-buffer.js"(exports, module2) {
179
+ function BitBuffer() {
180
+ this.buffer = [];
181
+ this.length = 0;
182
+ }
183
+ BitBuffer.prototype = {
184
+ get: function(index) {
185
+ const bufIndex = Math.floor(index / 8);
186
+ return (this.buffer[bufIndex] >>> 7 - index % 8 & 1) === 1;
187
+ },
188
+ put: function(num, length) {
189
+ for (let i = 0; i < length; i++) {
190
+ this.putBit((num >>> length - i - 1 & 1) === 1);
191
+ }
192
+ },
193
+ getLengthInBits: function() {
194
+ return this.length;
195
+ },
196
+ putBit: function(bit) {
197
+ const bufIndex = Math.floor(this.length / 8);
198
+ if (this.buffer.length <= bufIndex) {
199
+ this.buffer.push(0);
200
+ }
201
+ if (bit) {
202
+ this.buffer[bufIndex] |= 128 >>> this.length % 8;
203
+ }
204
+ this.length++;
205
+ }
206
+ };
207
+ module2.exports = BitBuffer;
208
+ }
209
+ });
210
+
211
+ // node_modules/qrcode/lib/core/bit-matrix.js
212
+ var require_bit_matrix = __commonJS({
213
+ "node_modules/qrcode/lib/core/bit-matrix.js"(exports, module2) {
214
+ function BitMatrix(size) {
215
+ if (!size || size < 1) {
216
+ throw new Error("BitMatrix size must be defined and greater than 0");
217
+ }
218
+ this.size = size;
219
+ this.data = new Uint8Array(size * size);
220
+ this.reservedBit = new Uint8Array(size * size);
221
+ }
222
+ BitMatrix.prototype.set = function(row, col, value, reserved) {
223
+ const index = row * this.size + col;
224
+ this.data[index] = value;
225
+ if (reserved) this.reservedBit[index] = true;
226
+ };
227
+ BitMatrix.prototype.get = function(row, col) {
228
+ return this.data[row * this.size + col];
229
+ };
230
+ BitMatrix.prototype.xor = function(row, col, value) {
231
+ this.data[row * this.size + col] ^= value;
232
+ };
233
+ BitMatrix.prototype.isReserved = function(row, col) {
234
+ return this.reservedBit[row * this.size + col];
235
+ };
236
+ module2.exports = BitMatrix;
237
+ }
238
+ });
239
+
240
+ // node_modules/qrcode/lib/core/alignment-pattern.js
241
+ var require_alignment_pattern = __commonJS({
242
+ "node_modules/qrcode/lib/core/alignment-pattern.js"(exports) {
243
+ var getSymbolSize = require_utils().getSymbolSize;
244
+ exports.getRowColCoords = function getRowColCoords(version) {
245
+ if (version === 1) return [];
246
+ const posCount = Math.floor(version / 7) + 2;
247
+ const size = getSymbolSize(version);
248
+ const intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2;
249
+ const positions = [size - 7];
250
+ for (let i = 1; i < posCount - 1; i++) {
251
+ positions[i] = positions[i - 1] - intervals;
252
+ }
253
+ positions.push(6);
254
+ return positions.reverse();
255
+ };
256
+ exports.getPositions = function getPositions(version) {
257
+ const coords = [];
258
+ const pos = exports.getRowColCoords(version);
259
+ const posLength = pos.length;
260
+ for (let i = 0; i < posLength; i++) {
261
+ for (let j = 0; j < posLength; j++) {
262
+ if (i === 0 && j === 0 || // top-left
263
+ i === 0 && j === posLength - 1 || // bottom-left
264
+ i === posLength - 1 && j === 0) {
265
+ continue;
266
+ }
267
+ coords.push([pos[i], pos[j]]);
268
+ }
269
+ }
270
+ return coords;
271
+ };
272
+ }
273
+ });
274
+
275
+ // node_modules/qrcode/lib/core/finder-pattern.js
276
+ var require_finder_pattern = __commonJS({
277
+ "node_modules/qrcode/lib/core/finder-pattern.js"(exports) {
278
+ var getSymbolSize = require_utils().getSymbolSize;
279
+ var FINDER_PATTERN_SIZE = 7;
280
+ exports.getPositions = function getPositions(version) {
281
+ const size = getSymbolSize(version);
282
+ return [
283
+ // top-left
284
+ [0, 0],
285
+ // top-right
286
+ [size - FINDER_PATTERN_SIZE, 0],
287
+ // bottom-left
288
+ [0, size - FINDER_PATTERN_SIZE]
289
+ ];
290
+ };
291
+ }
292
+ });
293
+
294
+ // node_modules/qrcode/lib/core/mask-pattern.js
295
+ var require_mask_pattern = __commonJS({
296
+ "node_modules/qrcode/lib/core/mask-pattern.js"(exports) {
297
+ exports.Patterns = {
298
+ PATTERN000: 0,
299
+ PATTERN001: 1,
300
+ PATTERN010: 2,
301
+ PATTERN011: 3,
302
+ PATTERN100: 4,
303
+ PATTERN101: 5,
304
+ PATTERN110: 6,
305
+ PATTERN111: 7
306
+ };
307
+ var PenaltyScores = {
308
+ N1: 3,
309
+ N2: 3,
310
+ N3: 40,
311
+ N4: 10
312
+ };
313
+ exports.isValid = function isValid(mask) {
314
+ return mask != null && mask !== "" && !isNaN(mask) && mask >= 0 && mask <= 7;
315
+ };
316
+ exports.from = function from(value) {
317
+ return exports.isValid(value) ? parseInt(value, 10) : void 0;
318
+ };
319
+ exports.getPenaltyN1 = function getPenaltyN1(data) {
320
+ const size = data.size;
321
+ let points = 0;
322
+ let sameCountCol = 0;
323
+ let sameCountRow = 0;
324
+ let lastCol = null;
325
+ let lastRow = null;
326
+ for (let row = 0; row < size; row++) {
327
+ sameCountCol = sameCountRow = 0;
328
+ lastCol = lastRow = null;
329
+ for (let col = 0; col < size; col++) {
330
+ let module3 = data.get(row, col);
331
+ if (module3 === lastCol) {
332
+ sameCountCol++;
333
+ } else {
334
+ if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);
335
+ lastCol = module3;
336
+ sameCountCol = 1;
337
+ }
338
+ module3 = data.get(col, row);
339
+ if (module3 === lastRow) {
340
+ sameCountRow++;
341
+ } else {
342
+ if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);
343
+ lastRow = module3;
344
+ sameCountRow = 1;
345
+ }
346
+ }
347
+ if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);
348
+ if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);
349
+ }
350
+ return points;
351
+ };
352
+ exports.getPenaltyN2 = function getPenaltyN2(data) {
353
+ const size = data.size;
354
+ let points = 0;
355
+ for (let row = 0; row < size - 1; row++) {
356
+ for (let col = 0; col < size - 1; col++) {
357
+ const last = data.get(row, col) + data.get(row, col + 1) + data.get(row + 1, col) + data.get(row + 1, col + 1);
358
+ if (last === 4 || last === 0) points++;
359
+ }
360
+ }
361
+ return points * PenaltyScores.N2;
362
+ };
363
+ exports.getPenaltyN3 = function getPenaltyN3(data) {
364
+ const size = data.size;
365
+ let points = 0;
366
+ let bitsCol = 0;
367
+ let bitsRow = 0;
368
+ for (let row = 0; row < size; row++) {
369
+ bitsCol = bitsRow = 0;
370
+ for (let col = 0; col < size; col++) {
371
+ bitsCol = bitsCol << 1 & 2047 | data.get(row, col);
372
+ if (col >= 10 && (bitsCol === 1488 || bitsCol === 93)) points++;
373
+ bitsRow = bitsRow << 1 & 2047 | data.get(col, row);
374
+ if (col >= 10 && (bitsRow === 1488 || bitsRow === 93)) points++;
375
+ }
376
+ }
377
+ return points * PenaltyScores.N3;
378
+ };
379
+ exports.getPenaltyN4 = function getPenaltyN4(data) {
380
+ let darkCount = 0;
381
+ const modulesCount = data.data.length;
382
+ for (let i = 0; i < modulesCount; i++) darkCount += data.data[i];
383
+ const k = Math.abs(Math.ceil(darkCount * 100 / modulesCount / 5) - 10);
384
+ return k * PenaltyScores.N4;
385
+ };
386
+ function getMaskAt(maskPattern, i, j) {
387
+ switch (maskPattern) {
388
+ case exports.Patterns.PATTERN000:
389
+ return (i + j) % 2 === 0;
390
+ case exports.Patterns.PATTERN001:
391
+ return i % 2 === 0;
392
+ case exports.Patterns.PATTERN010:
393
+ return j % 3 === 0;
394
+ case exports.Patterns.PATTERN011:
395
+ return (i + j) % 3 === 0;
396
+ case exports.Patterns.PATTERN100:
397
+ return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0;
398
+ case exports.Patterns.PATTERN101:
399
+ return i * j % 2 + i * j % 3 === 0;
400
+ case exports.Patterns.PATTERN110:
401
+ return (i * j % 2 + i * j % 3) % 2 === 0;
402
+ case exports.Patterns.PATTERN111:
403
+ return (i * j % 3 + (i + j) % 2) % 2 === 0;
404
+ default:
405
+ throw new Error("bad maskPattern:" + maskPattern);
406
+ }
407
+ }
408
+ exports.applyMask = function applyMask(pattern, data) {
409
+ const size = data.size;
410
+ for (let col = 0; col < size; col++) {
411
+ for (let row = 0; row < size; row++) {
412
+ if (data.isReserved(row, col)) continue;
413
+ data.xor(row, col, getMaskAt(pattern, row, col));
414
+ }
415
+ }
416
+ };
417
+ exports.getBestMask = function getBestMask(data, setupFormatFunc) {
418
+ const numPatterns = Object.keys(exports.Patterns).length;
419
+ let bestPattern = 0;
420
+ let lowerPenalty = Infinity;
421
+ for (let p = 0; p < numPatterns; p++) {
422
+ setupFormatFunc(p);
423
+ exports.applyMask(p, data);
424
+ const penalty = exports.getPenaltyN1(data) + exports.getPenaltyN2(data) + exports.getPenaltyN3(data) + exports.getPenaltyN4(data);
425
+ exports.applyMask(p, data);
426
+ if (penalty < lowerPenalty) {
427
+ lowerPenalty = penalty;
428
+ bestPattern = p;
429
+ }
430
+ }
431
+ return bestPattern;
432
+ };
433
+ }
434
+ });
435
+
436
+ // node_modules/qrcode/lib/core/error-correction-code.js
437
+ var require_error_correction_code = __commonJS({
438
+ "node_modules/qrcode/lib/core/error-correction-code.js"(exports) {
439
+ var ECLevel = require_error_correction_level();
440
+ var EC_BLOCKS_TABLE = [
441
+ // L M Q H
442
+ 1,
443
+ 1,
444
+ 1,
445
+ 1,
446
+ 1,
447
+ 1,
448
+ 1,
449
+ 1,
450
+ 1,
451
+ 1,
452
+ 2,
453
+ 2,
454
+ 1,
455
+ 2,
456
+ 2,
457
+ 4,
458
+ 1,
459
+ 2,
460
+ 4,
461
+ 4,
462
+ 2,
463
+ 4,
464
+ 4,
465
+ 4,
466
+ 2,
467
+ 4,
468
+ 6,
469
+ 5,
470
+ 2,
471
+ 4,
472
+ 6,
473
+ 6,
474
+ 2,
475
+ 5,
476
+ 8,
477
+ 8,
478
+ 4,
479
+ 5,
480
+ 8,
481
+ 8,
482
+ 4,
483
+ 5,
484
+ 8,
485
+ 11,
486
+ 4,
487
+ 8,
488
+ 10,
489
+ 11,
490
+ 4,
491
+ 9,
492
+ 12,
493
+ 16,
494
+ 4,
495
+ 9,
496
+ 16,
497
+ 16,
498
+ 6,
499
+ 10,
500
+ 12,
501
+ 18,
502
+ 6,
503
+ 10,
504
+ 17,
505
+ 16,
506
+ 6,
507
+ 11,
508
+ 16,
509
+ 19,
510
+ 6,
511
+ 13,
512
+ 18,
513
+ 21,
514
+ 7,
515
+ 14,
516
+ 21,
517
+ 25,
518
+ 8,
519
+ 16,
520
+ 20,
521
+ 25,
522
+ 8,
523
+ 17,
524
+ 23,
525
+ 25,
526
+ 9,
527
+ 17,
528
+ 23,
529
+ 34,
530
+ 9,
531
+ 18,
532
+ 25,
533
+ 30,
534
+ 10,
535
+ 20,
536
+ 27,
537
+ 32,
538
+ 12,
539
+ 21,
540
+ 29,
541
+ 35,
542
+ 12,
543
+ 23,
544
+ 34,
545
+ 37,
546
+ 12,
547
+ 25,
548
+ 34,
549
+ 40,
550
+ 13,
551
+ 26,
552
+ 35,
553
+ 42,
554
+ 14,
555
+ 28,
556
+ 38,
557
+ 45,
558
+ 15,
559
+ 29,
560
+ 40,
561
+ 48,
562
+ 16,
563
+ 31,
564
+ 43,
565
+ 51,
566
+ 17,
567
+ 33,
568
+ 45,
569
+ 54,
570
+ 18,
571
+ 35,
572
+ 48,
573
+ 57,
574
+ 19,
575
+ 37,
576
+ 51,
577
+ 60,
578
+ 19,
579
+ 38,
580
+ 53,
581
+ 63,
582
+ 20,
583
+ 40,
584
+ 56,
585
+ 66,
586
+ 21,
587
+ 43,
588
+ 59,
589
+ 70,
590
+ 22,
591
+ 45,
592
+ 62,
593
+ 74,
594
+ 24,
595
+ 47,
596
+ 65,
597
+ 77,
598
+ 25,
599
+ 49,
600
+ 68,
601
+ 81
602
+ ];
603
+ var EC_CODEWORDS_TABLE = [
604
+ // L M Q H
605
+ 7,
606
+ 10,
607
+ 13,
608
+ 17,
609
+ 10,
610
+ 16,
611
+ 22,
612
+ 28,
613
+ 15,
614
+ 26,
615
+ 36,
616
+ 44,
617
+ 20,
618
+ 36,
619
+ 52,
620
+ 64,
621
+ 26,
622
+ 48,
623
+ 72,
624
+ 88,
625
+ 36,
626
+ 64,
627
+ 96,
628
+ 112,
629
+ 40,
630
+ 72,
631
+ 108,
632
+ 130,
633
+ 48,
634
+ 88,
635
+ 132,
636
+ 156,
637
+ 60,
638
+ 110,
639
+ 160,
640
+ 192,
641
+ 72,
642
+ 130,
643
+ 192,
644
+ 224,
645
+ 80,
646
+ 150,
647
+ 224,
648
+ 264,
649
+ 96,
650
+ 176,
651
+ 260,
652
+ 308,
653
+ 104,
654
+ 198,
655
+ 288,
656
+ 352,
657
+ 120,
658
+ 216,
659
+ 320,
660
+ 384,
661
+ 132,
662
+ 240,
663
+ 360,
664
+ 432,
665
+ 144,
666
+ 280,
667
+ 408,
668
+ 480,
669
+ 168,
670
+ 308,
671
+ 448,
672
+ 532,
673
+ 180,
674
+ 338,
675
+ 504,
676
+ 588,
677
+ 196,
678
+ 364,
679
+ 546,
680
+ 650,
681
+ 224,
682
+ 416,
683
+ 600,
684
+ 700,
685
+ 224,
686
+ 442,
687
+ 644,
688
+ 750,
689
+ 252,
690
+ 476,
691
+ 690,
692
+ 816,
693
+ 270,
694
+ 504,
695
+ 750,
696
+ 900,
697
+ 300,
698
+ 560,
699
+ 810,
700
+ 960,
701
+ 312,
702
+ 588,
703
+ 870,
704
+ 1050,
705
+ 336,
706
+ 644,
707
+ 952,
708
+ 1110,
709
+ 360,
710
+ 700,
711
+ 1020,
712
+ 1200,
713
+ 390,
714
+ 728,
715
+ 1050,
716
+ 1260,
717
+ 420,
718
+ 784,
719
+ 1140,
720
+ 1350,
721
+ 450,
722
+ 812,
723
+ 1200,
724
+ 1440,
725
+ 480,
726
+ 868,
727
+ 1290,
728
+ 1530,
729
+ 510,
730
+ 924,
731
+ 1350,
732
+ 1620,
733
+ 540,
734
+ 980,
735
+ 1440,
736
+ 1710,
737
+ 570,
738
+ 1036,
739
+ 1530,
740
+ 1800,
741
+ 570,
742
+ 1064,
743
+ 1590,
744
+ 1890,
745
+ 600,
746
+ 1120,
747
+ 1680,
748
+ 1980,
749
+ 630,
750
+ 1204,
751
+ 1770,
752
+ 2100,
753
+ 660,
754
+ 1260,
755
+ 1860,
756
+ 2220,
757
+ 720,
758
+ 1316,
759
+ 1950,
760
+ 2310,
761
+ 750,
762
+ 1372,
763
+ 2040,
764
+ 2430
765
+ ];
766
+ exports.getBlocksCount = function getBlocksCount(version, errorCorrectionLevel) {
767
+ switch (errorCorrectionLevel) {
768
+ case ECLevel.L:
769
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 0];
770
+ case ECLevel.M:
771
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 1];
772
+ case ECLevel.Q:
773
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 2];
774
+ case ECLevel.H:
775
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 3];
776
+ default:
777
+ return void 0;
778
+ }
779
+ };
780
+ exports.getTotalCodewordsCount = function getTotalCodewordsCount(version, errorCorrectionLevel) {
781
+ switch (errorCorrectionLevel) {
782
+ case ECLevel.L:
783
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0];
784
+ case ECLevel.M:
785
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1];
786
+ case ECLevel.Q:
787
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2];
788
+ case ECLevel.H:
789
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3];
790
+ default:
791
+ return void 0;
792
+ }
793
+ };
794
+ }
795
+ });
796
+
797
+ // node_modules/qrcode/lib/core/galois-field.js
798
+ var require_galois_field = __commonJS({
799
+ "node_modules/qrcode/lib/core/galois-field.js"(exports) {
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/qrcode/lib/core/polynomial.js
831
+ var require_polynomial = __commonJS({
832
+ "node_modules/qrcode/lib/core/polynomial.js"(exports) {
833
+ var GF = require_galois_field();
834
+ exports.mul = function mul(p1, p2) {
835
+ const coeff = new Uint8Array(p1.length + p2.length - 1);
836
+ for (let i = 0; i < p1.length; i++) {
837
+ for (let j = 0; j < p2.length; j++) {
838
+ coeff[i + j] ^= GF.mul(p1[i], p2[j]);
839
+ }
840
+ }
841
+ return coeff;
842
+ };
843
+ exports.mod = function mod(divident, divisor) {
844
+ let result = new Uint8Array(divident);
845
+ while (result.length - divisor.length >= 0) {
846
+ const coeff = result[0];
847
+ for (let i = 0; i < divisor.length; i++) {
848
+ result[i] ^= GF.mul(divisor[i], coeff);
849
+ }
850
+ let offset = 0;
851
+ while (offset < result.length && result[offset] === 0) offset++;
852
+ result = result.slice(offset);
853
+ }
854
+ return result;
855
+ };
856
+ exports.generateECPolynomial = function generateECPolynomial(degree) {
857
+ let poly = new Uint8Array([1]);
858
+ for (let i = 0; i < degree; i++) {
859
+ poly = exports.mul(poly, new Uint8Array([1, GF.exp(i)]));
860
+ }
861
+ return poly;
862
+ };
863
+ }
864
+ });
865
+
866
+ // node_modules/qrcode/lib/core/reed-solomon-encoder.js
867
+ var require_reed_solomon_encoder = __commonJS({
868
+ "node_modules/qrcode/lib/core/reed-solomon-encoder.js"(exports, module2) {
869
+ var Polynomial = require_polynomial();
870
+ function ReedSolomonEncoder(degree) {
871
+ this.genPoly = void 0;
872
+ this.degree = degree;
873
+ if (this.degree) this.initialize(this.degree);
874
+ }
875
+ ReedSolomonEncoder.prototype.initialize = function initialize(degree) {
876
+ this.degree = degree;
877
+ this.genPoly = Polynomial.generateECPolynomial(this.degree);
878
+ };
879
+ ReedSolomonEncoder.prototype.encode = function encode(data) {
880
+ if (!this.genPoly) {
881
+ throw new Error("Encoder not initialized");
882
+ }
883
+ const paddedData = new Uint8Array(data.length + this.degree);
884
+ paddedData.set(data);
885
+ const remainder = Polynomial.mod(paddedData, this.genPoly);
886
+ const start = this.degree - remainder.length;
887
+ if (start > 0) {
888
+ const buff = new Uint8Array(this.degree);
889
+ buff.set(remainder, start);
890
+ return buff;
891
+ }
892
+ return remainder;
893
+ };
894
+ module2.exports = ReedSolomonEncoder;
895
+ }
896
+ });
897
+
898
+ // node_modules/qrcode/lib/core/version-check.js
899
+ var require_version_check = __commonJS({
900
+ "node_modules/qrcode/lib/core/version-check.js"(exports) {
901
+ exports.isValid = function isValid(version) {
902
+ return !isNaN(version) && version >= 1 && version <= 40;
903
+ };
904
+ }
905
+ });
906
+
907
+ // node_modules/qrcode/lib/core/regex.js
908
+ var require_regex = __commonJS({
909
+ "node_modules/qrcode/lib/core/regex.js"(exports) {
910
+ var numeric = "[0-9]+";
911
+ var alphanumeric = "[A-Z $%*+\\-./:]+";
912
+ var kanji = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
913
+ kanji = kanji.replace(/u/g, "\\u");
914
+ var byte = "(?:(?![A-Z0-9 $%*+\\-./:]|" + kanji + ")(?:.|[\r\n]))+";
915
+ exports.KANJI = new RegExp(kanji, "g");
916
+ exports.BYTE_KANJI = new RegExp("[^A-Z0-9 $%*+\\-./:]+", "g");
917
+ exports.BYTE = new RegExp(byte, "g");
918
+ exports.NUMERIC = new RegExp(numeric, "g");
919
+ exports.ALPHANUMERIC = new RegExp(alphanumeric, "g");
920
+ var TEST_KANJI = new RegExp("^" + kanji + "$");
921
+ var TEST_NUMERIC = new RegExp("^" + numeric + "$");
922
+ var TEST_ALPHANUMERIC = new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
923
+ exports.testKanji = function testKanji(str) {
924
+ return TEST_KANJI.test(str);
925
+ };
926
+ exports.testNumeric = function testNumeric(str) {
927
+ return TEST_NUMERIC.test(str);
928
+ };
929
+ exports.testAlphanumeric = function testAlphanumeric(str) {
930
+ return TEST_ALPHANUMERIC.test(str);
931
+ };
932
+ }
933
+ });
934
+
935
+ // node_modules/qrcode/lib/core/mode.js
936
+ var require_mode = __commonJS({
937
+ "node_modules/qrcode/lib/core/mode.js"(exports) {
938
+ var VersionCheck = require_version_check();
939
+ var Regex = require_regex();
940
+ exports.NUMERIC = {
941
+ id: "Numeric",
942
+ bit: 1 << 0,
943
+ ccBits: [10, 12, 14]
944
+ };
945
+ exports.ALPHANUMERIC = {
946
+ id: "Alphanumeric",
947
+ bit: 1 << 1,
948
+ ccBits: [9, 11, 13]
949
+ };
950
+ exports.BYTE = {
951
+ id: "Byte",
952
+ bit: 1 << 2,
953
+ ccBits: [8, 16, 16]
954
+ };
955
+ exports.KANJI = {
956
+ id: "Kanji",
957
+ bit: 1 << 3,
958
+ ccBits: [8, 10, 12]
959
+ };
960
+ exports.MIXED = {
961
+ bit: -1
962
+ };
963
+ exports.getCharCountIndicator = function getCharCountIndicator(mode, version) {
964
+ if (!mode.ccBits) throw new Error("Invalid mode: " + mode);
965
+ if (!VersionCheck.isValid(version)) {
966
+ throw new Error("Invalid version: " + version);
967
+ }
968
+ if (version >= 1 && version < 10) return mode.ccBits[0];
969
+ else if (version < 27) return mode.ccBits[1];
970
+ return mode.ccBits[2];
971
+ };
972
+ exports.getBestModeForData = function getBestModeForData(dataStr) {
973
+ if (Regex.testNumeric(dataStr)) return exports.NUMERIC;
974
+ else if (Regex.testAlphanumeric(dataStr)) return exports.ALPHANUMERIC;
975
+ else if (Regex.testKanji(dataStr)) return exports.KANJI;
976
+ else return exports.BYTE;
977
+ };
978
+ exports.toString = function toString(mode) {
979
+ if (mode && mode.id) return mode.id;
980
+ throw new Error("Invalid mode");
981
+ };
982
+ exports.isValid = function isValid(mode) {
983
+ return mode && mode.bit && mode.ccBits;
984
+ };
985
+ function fromString(string) {
986
+ if (typeof string !== "string") {
987
+ throw new Error("Param is not a string");
988
+ }
989
+ const lcStr = string.toLowerCase();
990
+ switch (lcStr) {
991
+ case "numeric":
992
+ return exports.NUMERIC;
993
+ case "alphanumeric":
994
+ return exports.ALPHANUMERIC;
995
+ case "kanji":
996
+ return exports.KANJI;
997
+ case "byte":
998
+ return exports.BYTE;
999
+ default:
1000
+ throw new Error("Unknown mode: " + string);
1001
+ }
1002
+ }
1003
+ exports.from = function from(value, defaultValue) {
1004
+ if (exports.isValid(value)) {
1005
+ return value;
1006
+ }
1007
+ try {
1008
+ return fromString(value);
1009
+ } catch (e) {
1010
+ return defaultValue;
1011
+ }
1012
+ };
1013
+ }
1014
+ });
1015
+
1016
+ // node_modules/qrcode/lib/core/version.js
1017
+ var require_version = __commonJS({
1018
+ "node_modules/qrcode/lib/core/version.js"(exports) {
1019
+ var Utils = require_utils();
1020
+ var ECCode = require_error_correction_code();
1021
+ var ECLevel = require_error_correction_level();
1022
+ var Mode = require_mode();
1023
+ var VersionCheck = require_version_check();
1024
+ var G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
1025
+ var G18_BCH = Utils.getBCHDigit(G18);
1026
+ function getBestVersionForDataLength(mode, length, errorCorrectionLevel) {
1027
+ for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
1028
+ if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode)) {
1029
+ return currentVersion;
1030
+ }
1031
+ }
1032
+ return void 0;
1033
+ }
1034
+ function getReservedBitsCount(mode, version) {
1035
+ return Mode.getCharCountIndicator(mode, version) + 4;
1036
+ }
1037
+ function getTotalBitsFromDataArray(segments, version) {
1038
+ let totalBits = 0;
1039
+ segments.forEach(function(data) {
1040
+ const reservedBits = getReservedBitsCount(data.mode, version);
1041
+ totalBits += reservedBits + data.getBitsLength();
1042
+ });
1043
+ return totalBits;
1044
+ }
1045
+ function getBestVersionForMixedData(segments, errorCorrectionLevel) {
1046
+ for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
1047
+ const length = getTotalBitsFromDataArray(segments, currentVersion);
1048
+ if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, Mode.MIXED)) {
1049
+ return currentVersion;
1050
+ }
1051
+ }
1052
+ return void 0;
1053
+ }
1054
+ exports.from = function from(value, defaultValue) {
1055
+ if (VersionCheck.isValid(value)) {
1056
+ return parseInt(value, 10);
1057
+ }
1058
+ return defaultValue;
1059
+ };
1060
+ exports.getCapacity = function getCapacity(version, errorCorrectionLevel, mode) {
1061
+ if (!VersionCheck.isValid(version)) {
1062
+ throw new Error("Invalid QR Code version");
1063
+ }
1064
+ if (typeof mode === "undefined") mode = Mode.BYTE;
1065
+ const totalCodewords = Utils.getSymbolTotalCodewords(version);
1066
+ const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
1067
+ const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;
1068
+ if (mode === Mode.MIXED) return dataTotalCodewordsBits;
1069
+ const usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version);
1070
+ switch (mode) {
1071
+ case Mode.NUMERIC:
1072
+ return Math.floor(usableBits / 10 * 3);
1073
+ case Mode.ALPHANUMERIC:
1074
+ return Math.floor(usableBits / 11 * 2);
1075
+ case Mode.KANJI:
1076
+ return Math.floor(usableBits / 13);
1077
+ case Mode.BYTE:
1078
+ default:
1079
+ return Math.floor(usableBits / 8);
1080
+ }
1081
+ };
1082
+ exports.getBestVersionForData = function getBestVersionForData(data, errorCorrectionLevel) {
1083
+ let seg;
1084
+ const ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M);
1085
+ if (Array.isArray(data)) {
1086
+ if (data.length > 1) {
1087
+ return getBestVersionForMixedData(data, ecl);
1088
+ }
1089
+ if (data.length === 0) {
1090
+ return 1;
1091
+ }
1092
+ seg = data[0];
1093
+ } else {
1094
+ seg = data;
1095
+ }
1096
+ return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl);
1097
+ };
1098
+ exports.getEncodedBits = function getEncodedBits(version) {
1099
+ if (!VersionCheck.isValid(version) || version < 7) {
1100
+ throw new Error("Invalid QR Code version");
1101
+ }
1102
+ let d = version << 12;
1103
+ while (Utils.getBCHDigit(d) - G18_BCH >= 0) {
1104
+ d ^= G18 << Utils.getBCHDigit(d) - G18_BCH;
1105
+ }
1106
+ return version << 12 | d;
1107
+ };
1108
+ }
1109
+ });
1110
+
1111
+ // node_modules/qrcode/lib/core/format-info.js
1112
+ var require_format_info = __commonJS({
1113
+ "node_modules/qrcode/lib/core/format-info.js"(exports) {
1114
+ var Utils = require_utils();
1115
+ var G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
1116
+ var G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
1117
+ var G15_BCH = Utils.getBCHDigit(G15);
1118
+ exports.getEncodedBits = function getEncodedBits(errorCorrectionLevel, mask) {
1119
+ const data = errorCorrectionLevel.bit << 3 | mask;
1120
+ let d = data << 10;
1121
+ while (Utils.getBCHDigit(d) - G15_BCH >= 0) {
1122
+ d ^= G15 << Utils.getBCHDigit(d) - G15_BCH;
1123
+ }
1124
+ return (data << 10 | d) ^ G15_MASK;
1125
+ };
1126
+ }
1127
+ });
1128
+
1129
+ // node_modules/qrcode/lib/core/numeric-data.js
1130
+ var require_numeric_data = __commonJS({
1131
+ "node_modules/qrcode/lib/core/numeric-data.js"(exports, module2) {
1132
+ var Mode = require_mode();
1133
+ function NumericData(data) {
1134
+ this.mode = Mode.NUMERIC;
1135
+ this.data = data.toString();
1136
+ }
1137
+ NumericData.getBitsLength = function getBitsLength(length) {
1138
+ return 10 * Math.floor(length / 3) + (length % 3 ? length % 3 * 3 + 1 : 0);
1139
+ };
1140
+ NumericData.prototype.getLength = function getLength() {
1141
+ return this.data.length;
1142
+ };
1143
+ NumericData.prototype.getBitsLength = function getBitsLength() {
1144
+ return NumericData.getBitsLength(this.data.length);
1145
+ };
1146
+ NumericData.prototype.write = function write(bitBuffer) {
1147
+ let i, group, value;
1148
+ for (i = 0; i + 3 <= this.data.length; i += 3) {
1149
+ group = this.data.substr(i, 3);
1150
+ value = parseInt(group, 10);
1151
+ bitBuffer.put(value, 10);
1152
+ }
1153
+ const remainingNum = this.data.length - i;
1154
+ if (remainingNum > 0) {
1155
+ group = this.data.substr(i);
1156
+ value = parseInt(group, 10);
1157
+ bitBuffer.put(value, remainingNum * 3 + 1);
1158
+ }
1159
+ };
1160
+ module2.exports = NumericData;
1161
+ }
1162
+ });
1163
+
1164
+ // node_modules/qrcode/lib/core/alphanumeric-data.js
1165
+ var require_alphanumeric_data = __commonJS({
1166
+ "node_modules/qrcode/lib/core/alphanumeric-data.js"(exports, module2) {
1167
+ var Mode = require_mode();
1168
+ var ALPHA_NUM_CHARS = [
1169
+ "0",
1170
+ "1",
1171
+ "2",
1172
+ "3",
1173
+ "4",
1174
+ "5",
1175
+ "6",
1176
+ "7",
1177
+ "8",
1178
+ "9",
1179
+ "A",
1180
+ "B",
1181
+ "C",
1182
+ "D",
1183
+ "E",
1184
+ "F",
1185
+ "G",
1186
+ "H",
1187
+ "I",
1188
+ "J",
1189
+ "K",
1190
+ "L",
1191
+ "M",
1192
+ "N",
1193
+ "O",
1194
+ "P",
1195
+ "Q",
1196
+ "R",
1197
+ "S",
1198
+ "T",
1199
+ "U",
1200
+ "V",
1201
+ "W",
1202
+ "X",
1203
+ "Y",
1204
+ "Z",
1205
+ " ",
1206
+ "$",
1207
+ "%",
1208
+ "*",
1209
+ "+",
1210
+ "-",
1211
+ ".",
1212
+ "/",
1213
+ ":"
1214
+ ];
1215
+ function AlphanumericData(data) {
1216
+ this.mode = Mode.ALPHANUMERIC;
1217
+ this.data = data;
1218
+ }
1219
+ AlphanumericData.getBitsLength = function getBitsLength(length) {
1220
+ return 11 * Math.floor(length / 2) + 6 * (length % 2);
1221
+ };
1222
+ AlphanumericData.prototype.getLength = function getLength() {
1223
+ return this.data.length;
1224
+ };
1225
+ AlphanumericData.prototype.getBitsLength = function getBitsLength() {
1226
+ return AlphanumericData.getBitsLength(this.data.length);
1227
+ };
1228
+ AlphanumericData.prototype.write = function write(bitBuffer) {
1229
+ let i;
1230
+ for (i = 0; i + 2 <= this.data.length; i += 2) {
1231
+ let value = ALPHA_NUM_CHARS.indexOf(this.data[i]) * 45;
1232
+ value += ALPHA_NUM_CHARS.indexOf(this.data[i + 1]);
1233
+ bitBuffer.put(value, 11);
1234
+ }
1235
+ if (this.data.length % 2) {
1236
+ bitBuffer.put(ALPHA_NUM_CHARS.indexOf(this.data[i]), 6);
1237
+ }
1238
+ };
1239
+ module2.exports = AlphanumericData;
1240
+ }
1241
+ });
1242
+
1243
+ // node_modules/qrcode/lib/core/byte-data.js
1244
+ var require_byte_data = __commonJS({
1245
+ "node_modules/qrcode/lib/core/byte-data.js"(exports, module2) {
1246
+ var Mode = require_mode();
1247
+ function ByteData(data) {
1248
+ this.mode = Mode.BYTE;
1249
+ if (typeof data === "string") {
1250
+ this.data = new TextEncoder().encode(data);
1251
+ } else {
1252
+ this.data = new Uint8Array(data);
1253
+ }
1254
+ }
1255
+ ByteData.getBitsLength = function getBitsLength(length) {
1256
+ return length * 8;
1257
+ };
1258
+ ByteData.prototype.getLength = function getLength() {
1259
+ return this.data.length;
1260
+ };
1261
+ ByteData.prototype.getBitsLength = function getBitsLength() {
1262
+ return ByteData.getBitsLength(this.data.length);
1263
+ };
1264
+ ByteData.prototype.write = function(bitBuffer) {
1265
+ for (let i = 0, l = this.data.length; i < l; i++) {
1266
+ bitBuffer.put(this.data[i], 8);
1267
+ }
1268
+ };
1269
+ module2.exports = ByteData;
1270
+ }
1271
+ });
1272
+
1273
+ // node_modules/qrcode/lib/core/kanji-data.js
1274
+ var require_kanji_data = __commonJS({
1275
+ "node_modules/qrcode/lib/core/kanji-data.js"(exports, module2) {
1276
+ var Mode = require_mode();
1277
+ var Utils = require_utils();
1278
+ function KanjiData(data) {
1279
+ this.mode = Mode.KANJI;
1280
+ this.data = data;
1281
+ }
1282
+ KanjiData.getBitsLength = function getBitsLength(length) {
1283
+ return length * 13;
1284
+ };
1285
+ KanjiData.prototype.getLength = function getLength() {
1286
+ return this.data.length;
1287
+ };
1288
+ KanjiData.prototype.getBitsLength = function getBitsLength() {
1289
+ return KanjiData.getBitsLength(this.data.length);
1290
+ };
1291
+ KanjiData.prototype.write = function(bitBuffer) {
1292
+ let i;
1293
+ for (i = 0; i < this.data.length; i++) {
1294
+ let value = Utils.toSJIS(this.data[i]);
1295
+ if (value >= 33088 && value <= 40956) {
1296
+ value -= 33088;
1297
+ } else if (value >= 57408 && value <= 60351) {
1298
+ value -= 49472;
1299
+ } else {
1300
+ throw new Error(
1301
+ "Invalid SJIS character: " + this.data[i] + "\nMake sure your charset is UTF-8"
1302
+ );
1303
+ }
1304
+ value = (value >>> 8 & 255) * 192 + (value & 255);
1305
+ bitBuffer.put(value, 13);
1306
+ }
1307
+ };
1308
+ module2.exports = KanjiData;
1309
+ }
1310
+ });
1311
+
1312
+ // node_modules/dijkstrajs/dijkstra.js
1313
+ var require_dijkstra = __commonJS({
1314
+ "node_modules/dijkstrajs/dijkstra.js"(exports, module2) {
1315
+ "use strict";
1316
+ var dijkstra = {
1317
+ single_source_shortest_paths: function(graph, s, d) {
1318
+ var predecessors = {};
1319
+ var costs = {};
1320
+ costs[s] = 0;
1321
+ var open = dijkstra.PriorityQueue.make();
1322
+ open.push(s, 0);
1323
+ 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;
1324
+ while (!open.empty()) {
1325
+ closest = open.pop();
1326
+ u = closest.value;
1327
+ cost_of_s_to_u = closest.cost;
1328
+ adjacent_nodes = graph[u] || {};
1329
+ for (v in adjacent_nodes) {
1330
+ if (adjacent_nodes.hasOwnProperty(v)) {
1331
+ cost_of_e = adjacent_nodes[v];
1332
+ cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e;
1333
+ cost_of_s_to_v = costs[v];
1334
+ first_visit = typeof costs[v] === "undefined";
1335
+ if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {
1336
+ costs[v] = cost_of_s_to_u_plus_cost_of_e;
1337
+ open.push(v, cost_of_s_to_u_plus_cost_of_e);
1338
+ predecessors[v] = u;
1339
+ }
1340
+ }
1341
+ }
1342
+ }
1343
+ if (typeof d !== "undefined" && typeof costs[d] === "undefined") {
1344
+ var msg = ["Could not find a path from ", s, " to ", d, "."].join("");
1345
+ throw new Error(msg);
1346
+ }
1347
+ return predecessors;
1348
+ },
1349
+ extract_shortest_path_from_predecessor_list: function(predecessors, d) {
1350
+ var nodes = [];
1351
+ var u = d;
1352
+ var predecessor;
1353
+ while (u) {
1354
+ nodes.push(u);
1355
+ predecessor = predecessors[u];
1356
+ u = predecessors[u];
1357
+ }
1358
+ nodes.reverse();
1359
+ return nodes;
1360
+ },
1361
+ find_path: function(graph, s, d) {
1362
+ var predecessors = dijkstra.single_source_shortest_paths(graph, s, d);
1363
+ return dijkstra.extract_shortest_path_from_predecessor_list(
1364
+ predecessors,
1365
+ d
1366
+ );
1367
+ },
1368
+ /**
1369
+ * A very naive priority queue implementation.
1370
+ */
1371
+ PriorityQueue: {
1372
+ make: function(opts) {
1373
+ var T = dijkstra.PriorityQueue, t = {}, key;
1374
+ opts = opts || {};
1375
+ for (key in T) {
1376
+ if (T.hasOwnProperty(key)) {
1377
+ t[key] = T[key];
1378
+ }
1379
+ }
1380
+ t.queue = [];
1381
+ t.sorter = opts.sorter || T.default_sorter;
1382
+ return t;
1383
+ },
1384
+ default_sorter: function(a, b) {
1385
+ return a.cost - b.cost;
1386
+ },
1387
+ /**
1388
+ * Add a new item to the queue and ensure the highest priority element
1389
+ * is at the front of the queue.
1390
+ */
1391
+ push: function(value, cost) {
1392
+ var item = { value, cost };
1393
+ this.queue.push(item);
1394
+ this.queue.sort(this.sorter);
1395
+ },
1396
+ /**
1397
+ * Return the highest priority element in the queue.
1398
+ */
1399
+ pop: function() {
1400
+ return this.queue.shift();
1401
+ },
1402
+ empty: function() {
1403
+ return this.queue.length === 0;
1404
+ }
1405
+ }
1406
+ };
1407
+ if (typeof module2 !== "undefined") {
1408
+ module2.exports = dijkstra;
1409
+ }
1410
+ }
1411
+ });
1412
+
1413
+ // node_modules/qrcode/lib/core/segments.js
1414
+ var require_segments = __commonJS({
1415
+ "node_modules/qrcode/lib/core/segments.js"(exports) {
1416
+ var Mode = require_mode();
1417
+ var NumericData = require_numeric_data();
1418
+ var AlphanumericData = require_alphanumeric_data();
1419
+ var ByteData = require_byte_data();
1420
+ var KanjiData = require_kanji_data();
1421
+ var Regex = require_regex();
1422
+ var Utils = require_utils();
1423
+ var dijkstra = require_dijkstra();
1424
+ function getStringByteLength(str) {
1425
+ return unescape(encodeURIComponent(str)).length;
1426
+ }
1427
+ function getSegments(regex, mode, str) {
1428
+ const segments = [];
1429
+ let result;
1430
+ while ((result = regex.exec(str)) !== null) {
1431
+ segments.push({
1432
+ data: result[0],
1433
+ index: result.index,
1434
+ mode,
1435
+ length: result[0].length
1436
+ });
1437
+ }
1438
+ return segments;
1439
+ }
1440
+ function getSegmentsFromString(dataStr) {
1441
+ const numSegs = getSegments(Regex.NUMERIC, Mode.NUMERIC, dataStr);
1442
+ const alphaNumSegs = getSegments(Regex.ALPHANUMERIC, Mode.ALPHANUMERIC, dataStr);
1443
+ let byteSegs;
1444
+ let kanjiSegs;
1445
+ if (Utils.isKanjiModeEnabled()) {
1446
+ byteSegs = getSegments(Regex.BYTE, Mode.BYTE, dataStr);
1447
+ kanjiSegs = getSegments(Regex.KANJI, Mode.KANJI, dataStr);
1448
+ } else {
1449
+ byteSegs = getSegments(Regex.BYTE_KANJI, Mode.BYTE, dataStr);
1450
+ kanjiSegs = [];
1451
+ }
1452
+ const segs = numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs);
1453
+ return segs.sort(function(s1, s2) {
1454
+ return s1.index - s2.index;
1455
+ }).map(function(obj) {
1456
+ return {
1457
+ data: obj.data,
1458
+ mode: obj.mode,
1459
+ length: obj.length
1460
+ };
1461
+ });
1462
+ }
1463
+ function getSegmentBitsLength(length, mode) {
1464
+ switch (mode) {
1465
+ case Mode.NUMERIC:
1466
+ return NumericData.getBitsLength(length);
1467
+ case Mode.ALPHANUMERIC:
1468
+ return AlphanumericData.getBitsLength(length);
1469
+ case Mode.KANJI:
1470
+ return KanjiData.getBitsLength(length);
1471
+ case Mode.BYTE:
1472
+ return ByteData.getBitsLength(length);
1473
+ }
1474
+ }
1475
+ function mergeSegments(segs) {
1476
+ return segs.reduce(function(acc, curr) {
1477
+ const prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null;
1478
+ if (prevSeg && prevSeg.mode === curr.mode) {
1479
+ acc[acc.length - 1].data += curr.data;
1480
+ return acc;
1481
+ }
1482
+ acc.push(curr);
1483
+ return acc;
1484
+ }, []);
1485
+ }
1486
+ function buildNodes(segs) {
1487
+ const nodes = [];
1488
+ for (let i = 0; i < segs.length; i++) {
1489
+ const seg = segs[i];
1490
+ switch (seg.mode) {
1491
+ case Mode.NUMERIC:
1492
+ nodes.push([
1493
+ seg,
1494
+ { data: seg.data, mode: Mode.ALPHANUMERIC, length: seg.length },
1495
+ { data: seg.data, mode: Mode.BYTE, length: seg.length }
1496
+ ]);
1497
+ break;
1498
+ case Mode.ALPHANUMERIC:
1499
+ nodes.push([
1500
+ seg,
1501
+ { data: seg.data, mode: Mode.BYTE, length: seg.length }
1502
+ ]);
1503
+ break;
1504
+ case Mode.KANJI:
1505
+ nodes.push([
1506
+ seg,
1507
+ { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
1508
+ ]);
1509
+ break;
1510
+ case Mode.BYTE:
1511
+ nodes.push([
1512
+ { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
1513
+ ]);
1514
+ }
1515
+ }
1516
+ return nodes;
1517
+ }
1518
+ function buildGraph(nodes, version) {
1519
+ const table = {};
1520
+ const graph = { start: {} };
1521
+ let prevNodeIds = ["start"];
1522
+ for (let i = 0; i < nodes.length; i++) {
1523
+ const nodeGroup = nodes[i];
1524
+ const currentNodeIds = [];
1525
+ for (let j = 0; j < nodeGroup.length; j++) {
1526
+ const node = nodeGroup[j];
1527
+ const key = "" + i + j;
1528
+ currentNodeIds.push(key);
1529
+ table[key] = { node, lastCount: 0 };
1530
+ graph[key] = {};
1531
+ for (let n = 0; n < prevNodeIds.length; n++) {
1532
+ const prevNodeId = prevNodeIds[n];
1533
+ if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) {
1534
+ graph[prevNodeId][key] = getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) - getSegmentBitsLength(table[prevNodeId].lastCount, node.mode);
1535
+ table[prevNodeId].lastCount += node.length;
1536
+ } else {
1537
+ if (table[prevNodeId]) table[prevNodeId].lastCount = node.length;
1538
+ graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) + 4 + Mode.getCharCountIndicator(node.mode, version);
1539
+ }
1540
+ }
1541
+ }
1542
+ prevNodeIds = currentNodeIds;
1543
+ }
1544
+ for (let n = 0; n < prevNodeIds.length; n++) {
1545
+ graph[prevNodeIds[n]].end = 0;
1546
+ }
1547
+ return { map: graph, table };
1548
+ }
1549
+ function buildSingleSegment(data, modesHint) {
1550
+ let mode;
1551
+ const bestMode = Mode.getBestModeForData(data);
1552
+ mode = Mode.from(modesHint, bestMode);
1553
+ if (mode !== Mode.BYTE && mode.bit < bestMode.bit) {
1554
+ throw new Error('"' + data + '" cannot be encoded with mode ' + Mode.toString(mode) + ".\n Suggested mode is: " + Mode.toString(bestMode));
1555
+ }
1556
+ if (mode === Mode.KANJI && !Utils.isKanjiModeEnabled()) {
1557
+ mode = Mode.BYTE;
1558
+ }
1559
+ switch (mode) {
1560
+ case Mode.NUMERIC:
1561
+ return new NumericData(data);
1562
+ case Mode.ALPHANUMERIC:
1563
+ return new AlphanumericData(data);
1564
+ case Mode.KANJI:
1565
+ return new KanjiData(data);
1566
+ case Mode.BYTE:
1567
+ return new ByteData(data);
1568
+ }
1569
+ }
1570
+ exports.fromArray = function fromArray(array) {
1571
+ return array.reduce(function(acc, seg) {
1572
+ if (typeof seg === "string") {
1573
+ acc.push(buildSingleSegment(seg, null));
1574
+ } else if (seg.data) {
1575
+ acc.push(buildSingleSegment(seg.data, seg.mode));
1576
+ }
1577
+ return acc;
1578
+ }, []);
1579
+ };
1580
+ exports.fromString = function fromString(data, version) {
1581
+ const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled());
1582
+ const nodes = buildNodes(segs);
1583
+ const graph = buildGraph(nodes, version);
1584
+ const path = dijkstra.find_path(graph.map, "start", "end");
1585
+ const optimizedSegs = [];
1586
+ for (let i = 1; i < path.length - 1; i++) {
1587
+ optimizedSegs.push(graph.table[path[i]].node);
1588
+ }
1589
+ return exports.fromArray(mergeSegments(optimizedSegs));
1590
+ };
1591
+ exports.rawSplit = function rawSplit(data) {
1592
+ return exports.fromArray(
1593
+ getSegmentsFromString(data, Utils.isKanjiModeEnabled())
1594
+ );
1595
+ };
1596
+ }
1597
+ });
1598
+
1599
+ // node_modules/qrcode/lib/core/qrcode.js
1600
+ var require_qrcode = __commonJS({
1601
+ "node_modules/qrcode/lib/core/qrcode.js"(exports) {
1602
+ var Utils = require_utils();
1603
+ var ECLevel = require_error_correction_level();
1604
+ var BitBuffer = require_bit_buffer();
1605
+ var BitMatrix = require_bit_matrix();
1606
+ var AlignmentPattern = require_alignment_pattern();
1607
+ var FinderPattern = require_finder_pattern();
1608
+ var MaskPattern = require_mask_pattern();
1609
+ var ECCode = require_error_correction_code();
1610
+ var ReedSolomonEncoder = require_reed_solomon_encoder();
1611
+ var Version = require_version();
1612
+ var FormatInfo = require_format_info();
1613
+ var Mode = require_mode();
1614
+ var Segments = require_segments();
1615
+ function setupFinderPattern(matrix, version) {
1616
+ const size = matrix.size;
1617
+ const pos = FinderPattern.getPositions(version);
1618
+ for (let i = 0; i < pos.length; i++) {
1619
+ const row = pos[i][0];
1620
+ const col = pos[i][1];
1621
+ for (let r = -1; r <= 7; r++) {
1622
+ if (row + r <= -1 || size <= row + r) continue;
1623
+ for (let c = -1; c <= 7; c++) {
1624
+ if (col + c <= -1 || size <= col + c) continue;
1625
+ 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) {
1626
+ matrix.set(row + r, col + c, true, true);
1627
+ } else {
1628
+ matrix.set(row + r, col + c, false, true);
1629
+ }
1630
+ }
1631
+ }
1632
+ }
1633
+ }
1634
+ function setupTimingPattern(matrix) {
1635
+ const size = matrix.size;
1636
+ for (let r = 8; r < size - 8; r++) {
1637
+ const value = r % 2 === 0;
1638
+ matrix.set(r, 6, value, true);
1639
+ matrix.set(6, r, value, true);
1640
+ }
1641
+ }
1642
+ function setupAlignmentPattern(matrix, version) {
1643
+ const pos = AlignmentPattern.getPositions(version);
1644
+ for (let i = 0; i < pos.length; i++) {
1645
+ const row = pos[i][0];
1646
+ const col = pos[i][1];
1647
+ for (let r = -2; r <= 2; r++) {
1648
+ for (let c = -2; c <= 2; c++) {
1649
+ if (r === -2 || r === 2 || c === -2 || c === 2 || r === 0 && c === 0) {
1650
+ matrix.set(row + r, col + c, true, true);
1651
+ } else {
1652
+ matrix.set(row + r, col + c, false, true);
1653
+ }
1654
+ }
1655
+ }
1656
+ }
1657
+ }
1658
+ function setupVersionInfo(matrix, version) {
1659
+ const size = matrix.size;
1660
+ const bits = Version.getEncodedBits(version);
1661
+ let row, col, mod;
1662
+ for (let i = 0; i < 18; i++) {
1663
+ row = Math.floor(i / 3);
1664
+ col = i % 3 + size - 8 - 3;
1665
+ mod = (bits >> i & 1) === 1;
1666
+ matrix.set(row, col, mod, true);
1667
+ matrix.set(col, row, mod, true);
1668
+ }
1669
+ }
1670
+ function setupFormatInfo(matrix, errorCorrectionLevel, maskPattern) {
1671
+ const size = matrix.size;
1672
+ const bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern);
1673
+ let i, mod;
1674
+ for (i = 0; i < 15; i++) {
1675
+ mod = (bits >> i & 1) === 1;
1676
+ if (i < 6) {
1677
+ matrix.set(i, 8, mod, true);
1678
+ } else if (i < 8) {
1679
+ matrix.set(i + 1, 8, mod, true);
1680
+ } else {
1681
+ matrix.set(size - 15 + i, 8, mod, true);
1682
+ }
1683
+ if (i < 8) {
1684
+ matrix.set(8, size - i - 1, mod, true);
1685
+ } else if (i < 9) {
1686
+ matrix.set(8, 15 - i - 1 + 1, mod, true);
1687
+ } else {
1688
+ matrix.set(8, 15 - i - 1, mod, true);
1689
+ }
1690
+ }
1691
+ matrix.set(size - 8, 8, 1, true);
1692
+ }
1693
+ function setupData(matrix, data) {
1694
+ const size = matrix.size;
1695
+ let inc = -1;
1696
+ let row = size - 1;
1697
+ let bitIndex = 7;
1698
+ let byteIndex = 0;
1699
+ for (let col = size - 1; col > 0; col -= 2) {
1700
+ if (col === 6) col--;
1701
+ while (true) {
1702
+ for (let c = 0; c < 2; c++) {
1703
+ if (!matrix.isReserved(row, col - c)) {
1704
+ let dark = false;
1705
+ if (byteIndex < data.length) {
1706
+ dark = (data[byteIndex] >>> bitIndex & 1) === 1;
1707
+ }
1708
+ matrix.set(row, col - c, dark);
1709
+ bitIndex--;
1710
+ if (bitIndex === -1) {
1711
+ byteIndex++;
1712
+ bitIndex = 7;
1713
+ }
1714
+ }
1715
+ }
1716
+ row += inc;
1717
+ if (row < 0 || size <= row) {
1718
+ row -= inc;
1719
+ inc = -inc;
1720
+ break;
1721
+ }
1722
+ }
1723
+ }
1724
+ }
1725
+ function createData(version, errorCorrectionLevel, segments) {
1726
+ const buffer = new BitBuffer();
1727
+ segments.forEach(function(data) {
1728
+ buffer.put(data.mode.bit, 4);
1729
+ buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version));
1730
+ data.write(buffer);
1731
+ });
1732
+ const totalCodewords = Utils.getSymbolTotalCodewords(version);
1733
+ const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
1734
+ const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;
1735
+ if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) {
1736
+ buffer.put(0, 4);
1737
+ }
1738
+ while (buffer.getLengthInBits() % 8 !== 0) {
1739
+ buffer.putBit(0);
1740
+ }
1741
+ const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8;
1742
+ for (let i = 0; i < remainingByte; i++) {
1743
+ buffer.put(i % 2 ? 17 : 236, 8);
1744
+ }
1745
+ return createCodewords(buffer, version, errorCorrectionLevel);
1746
+ }
1747
+ function createCodewords(bitBuffer, version, errorCorrectionLevel) {
1748
+ const totalCodewords = Utils.getSymbolTotalCodewords(version);
1749
+ const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
1750
+ const dataTotalCodewords = totalCodewords - ecTotalCodewords;
1751
+ const ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel);
1752
+ const blocksInGroup2 = totalCodewords % ecTotalBlocks;
1753
+ const blocksInGroup1 = ecTotalBlocks - blocksInGroup2;
1754
+ const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks);
1755
+ const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks);
1756
+ const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1;
1757
+ const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1;
1758
+ const rs = new ReedSolomonEncoder(ecCount);
1759
+ let offset = 0;
1760
+ const dcData = new Array(ecTotalBlocks);
1761
+ const ecData = new Array(ecTotalBlocks);
1762
+ let maxDataSize = 0;
1763
+ const buffer = new Uint8Array(bitBuffer.buffer);
1764
+ for (let b = 0; b < ecTotalBlocks; b++) {
1765
+ const dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2;
1766
+ dcData[b] = buffer.slice(offset, offset + dataSize);
1767
+ ecData[b] = rs.encode(dcData[b]);
1768
+ offset += dataSize;
1769
+ maxDataSize = Math.max(maxDataSize, dataSize);
1770
+ }
1771
+ const data = new Uint8Array(totalCodewords);
1772
+ let index = 0;
1773
+ let i, r;
1774
+ for (i = 0; i < maxDataSize; i++) {
1775
+ for (r = 0; r < ecTotalBlocks; r++) {
1776
+ if (i < dcData[r].length) {
1777
+ data[index++] = dcData[r][i];
1778
+ }
1779
+ }
1780
+ }
1781
+ for (i = 0; i < ecCount; i++) {
1782
+ for (r = 0; r < ecTotalBlocks; r++) {
1783
+ data[index++] = ecData[r][i];
1784
+ }
1785
+ }
1786
+ return data;
1787
+ }
1788
+ function createSymbol(data, version, errorCorrectionLevel, maskPattern) {
1789
+ let segments;
1790
+ if (Array.isArray(data)) {
1791
+ segments = Segments.fromArray(data);
1792
+ } else if (typeof data === "string") {
1793
+ let estimatedVersion = version;
1794
+ if (!estimatedVersion) {
1795
+ const rawSegments = Segments.rawSplit(data);
1796
+ estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel);
1797
+ }
1798
+ segments = Segments.fromString(data, estimatedVersion || 40);
1799
+ } else {
1800
+ throw new Error("Invalid data");
1801
+ }
1802
+ const bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel);
1803
+ if (!bestVersion) {
1804
+ throw new Error("The amount of data is too big to be stored in a QR Code");
1805
+ }
1806
+ if (!version) {
1807
+ version = bestVersion;
1808
+ } else if (version < bestVersion) {
1809
+ throw new Error(
1810
+ "\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: " + bestVersion + ".\n"
1811
+ );
1812
+ }
1813
+ const dataBits = createData(version, errorCorrectionLevel, segments);
1814
+ const moduleCount = Utils.getSymbolSize(version);
1815
+ const modules = new BitMatrix(moduleCount);
1816
+ setupFinderPattern(modules, version);
1817
+ setupTimingPattern(modules);
1818
+ setupAlignmentPattern(modules, version);
1819
+ setupFormatInfo(modules, errorCorrectionLevel, 0);
1820
+ if (version >= 7) {
1821
+ setupVersionInfo(modules, version);
1822
+ }
1823
+ setupData(modules, dataBits);
1824
+ if (isNaN(maskPattern)) {
1825
+ maskPattern = MaskPattern.getBestMask(
1826
+ modules,
1827
+ setupFormatInfo.bind(null, modules, errorCorrectionLevel)
1828
+ );
1829
+ }
1830
+ MaskPattern.applyMask(maskPattern, modules);
1831
+ setupFormatInfo(modules, errorCorrectionLevel, maskPattern);
1832
+ return {
1833
+ modules,
1834
+ version,
1835
+ errorCorrectionLevel,
1836
+ maskPattern,
1837
+ segments
1838
+ };
1839
+ }
1840
+ exports.create = function create(data, options) {
1841
+ if (typeof data === "undefined" || data === "") {
1842
+ throw new Error("No input text");
1843
+ }
1844
+ let errorCorrectionLevel = ECLevel.M;
1845
+ let version;
1846
+ let mask;
1847
+ if (typeof options !== "undefined") {
1848
+ errorCorrectionLevel = ECLevel.from(options.errorCorrectionLevel, ECLevel.M);
1849
+ version = Version.from(options.version);
1850
+ mask = MaskPattern.from(options.maskPattern);
1851
+ if (options.toSJISFunc) {
1852
+ Utils.setToSJISFunction(options.toSJISFunc);
1853
+ }
1854
+ }
1855
+ return createSymbol(data, version, errorCorrectionLevel, mask);
1856
+ };
1857
+ }
1858
+ });
1859
+
1860
+ // node_modules/qrcode/lib/renderer/utils.js
1861
+ var require_utils2 = __commonJS({
1862
+ "node_modules/qrcode/lib/renderer/utils.js"(exports) {
1863
+ function hex2rgba(hex) {
1864
+ if (typeof hex === "number") {
1865
+ hex = hex.toString();
1866
+ }
1867
+ if (typeof hex !== "string") {
1868
+ throw new Error("Color should be defined as hex string");
1869
+ }
1870
+ let hexCode = hex.slice().replace("#", "").split("");
1871
+ if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) {
1872
+ throw new Error("Invalid hex color: " + hex);
1873
+ }
1874
+ if (hexCode.length === 3 || hexCode.length === 4) {
1875
+ hexCode = Array.prototype.concat.apply([], hexCode.map(function(c) {
1876
+ return [c, c];
1877
+ }));
1878
+ }
1879
+ if (hexCode.length === 6) hexCode.push("F", "F");
1880
+ const hexValue = parseInt(hexCode.join(""), 16);
1881
+ return {
1882
+ r: hexValue >> 24 & 255,
1883
+ g: hexValue >> 16 & 255,
1884
+ b: hexValue >> 8 & 255,
1885
+ a: hexValue & 255,
1886
+ hex: "#" + hexCode.slice(0, 6).join("")
1887
+ };
1888
+ }
1889
+ exports.getOptions = function getOptions(options) {
1890
+ if (!options) options = {};
1891
+ if (!options.color) options.color = {};
1892
+ const margin = typeof options.margin === "undefined" || options.margin === null || options.margin < 0 ? 4 : options.margin;
1893
+ const width = options.width && options.width >= 21 ? options.width : void 0;
1894
+ const scale = options.scale || 4;
1895
+ return {
1896
+ width,
1897
+ scale: width ? 4 : scale,
1898
+ margin,
1899
+ color: {
1900
+ dark: hex2rgba(options.color.dark || "#000000ff"),
1901
+ light: hex2rgba(options.color.light || "#ffffffff")
1902
+ },
1903
+ type: options.type,
1904
+ rendererOpts: options.rendererOpts || {}
1905
+ };
1906
+ };
1907
+ exports.getScale = function getScale(qrSize, opts) {
1908
+ return opts.width && opts.width >= qrSize + opts.margin * 2 ? opts.width / (qrSize + opts.margin * 2) : opts.scale;
1909
+ };
1910
+ exports.getImageWidth = function getImageWidth(qrSize, opts) {
1911
+ const scale = exports.getScale(qrSize, opts);
1912
+ return Math.floor((qrSize + opts.margin * 2) * scale);
1913
+ };
1914
+ exports.qrToImageData = function qrToImageData(imgData, qr, opts) {
1915
+ const size = qr.modules.size;
1916
+ const data = qr.modules.data;
1917
+ const scale = exports.getScale(size, opts);
1918
+ const symbolSize = Math.floor((size + opts.margin * 2) * scale);
1919
+ const scaledMargin = opts.margin * scale;
1920
+ const palette = [opts.color.light, opts.color.dark];
1921
+ for (let i = 0; i < symbolSize; i++) {
1922
+ for (let j = 0; j < symbolSize; j++) {
1923
+ let posDst = (i * symbolSize + j) * 4;
1924
+ let pxColor = opts.color.light;
1925
+ if (i >= scaledMargin && j >= scaledMargin && i < symbolSize - scaledMargin && j < symbolSize - scaledMargin) {
1926
+ const iSrc = Math.floor((i - scaledMargin) / scale);
1927
+ const jSrc = Math.floor((j - scaledMargin) / scale);
1928
+ pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0];
1929
+ }
1930
+ imgData[posDst++] = pxColor.r;
1931
+ imgData[posDst++] = pxColor.g;
1932
+ imgData[posDst++] = pxColor.b;
1933
+ imgData[posDst] = pxColor.a;
1934
+ }
1935
+ }
1936
+ };
1937
+ }
1938
+ });
1939
+
1940
+ // node_modules/qrcode/lib/renderer/canvas.js
1941
+ var require_canvas = __commonJS({
1942
+ "node_modules/qrcode/lib/renderer/canvas.js"(exports) {
1943
+ var Utils = require_utils2();
1944
+ function clearCanvas(ctx, canvas, size) {
1945
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
1946
+ if (!canvas.style) canvas.style = {};
1947
+ canvas.height = size;
1948
+ canvas.width = size;
1949
+ canvas.style.height = size + "px";
1950
+ canvas.style.width = size + "px";
1951
+ }
1952
+ function getCanvasElement() {
1953
+ try {
1954
+ return document.createElement("canvas");
1955
+ } catch (e) {
1956
+ throw new Error("You need to specify a canvas element");
1957
+ }
1958
+ }
1959
+ exports.render = function render(qrData, canvas, options) {
1960
+ let opts = options;
1961
+ let canvasEl = canvas;
1962
+ if (typeof opts === "undefined" && (!canvas || !canvas.getContext)) {
1963
+ opts = canvas;
1964
+ canvas = void 0;
1965
+ }
1966
+ if (!canvas) {
1967
+ canvasEl = getCanvasElement();
1968
+ }
1969
+ opts = Utils.getOptions(opts);
1970
+ const size = Utils.getImageWidth(qrData.modules.size, opts);
1971
+ const ctx = canvasEl.getContext("2d");
1972
+ const image = ctx.createImageData(size, size);
1973
+ Utils.qrToImageData(image.data, qrData, opts);
1974
+ clearCanvas(ctx, canvasEl, size);
1975
+ ctx.putImageData(image, 0, 0);
1976
+ return canvasEl;
1977
+ };
1978
+ exports.renderToDataURL = function renderToDataURL(qrData, canvas, options) {
1979
+ let opts = options;
1980
+ if (typeof opts === "undefined" && (!canvas || !canvas.getContext)) {
1981
+ opts = canvas;
1982
+ canvas = void 0;
1983
+ }
1984
+ if (!opts) opts = {};
1985
+ const canvasEl = exports.render(qrData, canvas, opts);
1986
+ const type = opts.type || "image/png";
1987
+ const rendererOpts = opts.rendererOpts || {};
1988
+ return canvasEl.toDataURL(type, rendererOpts.quality);
1989
+ };
1990
+ }
1991
+ });
1992
+
1993
+ // node_modules/qrcode/lib/renderer/svg-tag.js
1994
+ var require_svg_tag = __commonJS({
1995
+ "node_modules/qrcode/lib/renderer/svg-tag.js"(exports) {
1996
+ var Utils = require_utils2();
1997
+ function getColorAttrib(color, attrib) {
1998
+ const alpha = color.a / 255;
1999
+ const str = attrib + '="' + color.hex + '"';
2000
+ return alpha < 1 ? str + " " + attrib + '-opacity="' + alpha.toFixed(2).slice(1) + '"' : str;
2001
+ }
2002
+ function svgCmd(cmd, x, y) {
2003
+ let str = cmd + x;
2004
+ if (typeof y !== "undefined") str += " " + y;
2005
+ return str;
2006
+ }
2007
+ function qrToPath(data, size, margin) {
2008
+ let path = "";
2009
+ let moveBy = 0;
2010
+ let newRow = false;
2011
+ let lineLength = 0;
2012
+ for (let i = 0; i < data.length; i++) {
2013
+ const col = Math.floor(i % size);
2014
+ const row = Math.floor(i / size);
2015
+ if (!col && !newRow) newRow = true;
2016
+ if (data[i]) {
2017
+ lineLength++;
2018
+ if (!(i > 0 && col > 0 && data[i - 1])) {
2019
+ path += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
2020
+ moveBy = 0;
2021
+ newRow = false;
2022
+ }
2023
+ if (!(col + 1 < size && data[i + 1])) {
2024
+ path += svgCmd("h", lineLength);
2025
+ lineLength = 0;
2026
+ }
2027
+ } else {
2028
+ moveBy++;
2029
+ }
2030
+ }
2031
+ return path;
2032
+ }
2033
+ exports.render = function render(qrData, options, cb) {
2034
+ const opts = Utils.getOptions(options);
2035
+ const size = qrData.modules.size;
2036
+ const data = qrData.modules.data;
2037
+ const qrcodesize = size + opts.margin * 2;
2038
+ const bg = !opts.color.light.a ? "" : "<path " + getColorAttrib(opts.color.light, "fill") + ' d="M0 0h' + qrcodesize + "v" + qrcodesize + 'H0z"/>';
2039
+ const path = "<path " + getColorAttrib(opts.color.dark, "stroke") + ' d="' + qrToPath(data, size, opts.margin) + '"/>';
2040
+ const viewBox = 'viewBox="0 0 ' + qrcodesize + " " + qrcodesize + '"';
2041
+ const width = !opts.width ? "" : 'width="' + opts.width + '" height="' + opts.width + '" ';
2042
+ const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path + "</svg>\n";
2043
+ if (typeof cb === "function") {
2044
+ cb(null, svgTag);
2045
+ }
2046
+ return svgTag;
2047
+ };
2048
+ }
2049
+ });
2050
+
2051
+ // node_modules/qrcode/lib/browser.js
2052
+ var require_browser = __commonJS({
2053
+ "node_modules/qrcode/lib/browser.js"(exports) {
2054
+ var canPromise = require_can_promise();
2055
+ var QRCode2 = require_qrcode();
2056
+ var CanvasRenderer = require_canvas();
2057
+ var SvgRenderer = require_svg_tag();
2058
+ function renderCanvas(renderFunc, canvas, text, opts, cb) {
2059
+ const args = [].slice.call(arguments, 1);
2060
+ const argsNum = args.length;
2061
+ const isLastArgCb = typeof args[argsNum - 1] === "function";
2062
+ if (!isLastArgCb && !canPromise()) {
2063
+ throw new Error("Callback required as last argument");
2064
+ }
2065
+ if (isLastArgCb) {
2066
+ if (argsNum < 2) {
2067
+ throw new Error("Too few arguments provided");
2068
+ }
2069
+ if (argsNum === 2) {
2070
+ cb = text;
2071
+ text = canvas;
2072
+ canvas = opts = void 0;
2073
+ } else if (argsNum === 3) {
2074
+ if (canvas.getContext && typeof cb === "undefined") {
2075
+ cb = opts;
2076
+ opts = void 0;
2077
+ } else {
2078
+ cb = opts;
2079
+ opts = text;
2080
+ text = canvas;
2081
+ canvas = void 0;
2082
+ }
2083
+ }
2084
+ } else {
2085
+ if (argsNum < 1) {
2086
+ throw new Error("Too few arguments provided");
2087
+ }
2088
+ if (argsNum === 1) {
2089
+ text = canvas;
2090
+ canvas = opts = void 0;
2091
+ } else if (argsNum === 2 && !canvas.getContext) {
2092
+ opts = text;
2093
+ text = canvas;
2094
+ canvas = void 0;
2095
+ }
2096
+ return new Promise(function(resolve, reject) {
2097
+ try {
2098
+ const data = QRCode2.create(text, opts);
2099
+ resolve(renderFunc(data, canvas, opts));
2100
+ } catch (e) {
2101
+ reject(e);
2102
+ }
2103
+ });
2104
+ }
2105
+ try {
2106
+ const data = QRCode2.create(text, opts);
2107
+ cb(null, renderFunc(data, canvas, opts));
2108
+ } catch (e) {
2109
+ cb(e);
2110
+ }
2111
+ }
2112
+ exports.create = QRCode2.create;
2113
+ exports.toCanvas = renderCanvas.bind(null, CanvasRenderer.render);
2114
+ exports.toDataURL = renderCanvas.bind(null, CanvasRenderer.renderToDataURL);
2115
+ exports.toString = renderCanvas.bind(null, function(data, _, opts) {
2116
+ return SvgRenderer.render(data, opts);
2117
+ });
2118
+ }
2119
+ });
35
2120
 
36
2121
  // src/client.jsx
37
2122
  var client_exports = {};
@@ -41,7 +2126,7 @@ __export(client_exports, {
41
2126
  inject: () => inject
42
2127
  });
43
2128
  module.exports = __toCommonJS(client_exports);
44
- var import_react9 = __toESM(require("react"), 1);
2129
+ var import_react10 = __toESM(require("react"), 1);
45
2130
 
46
2131
  // src/shared.js
47
2132
  var import_react = __toESM(require("react"), 1);
@@ -3404,9 +5489,459 @@ var feature6 = {
3404
5489
  Overlay: AnimationOverlay
3405
5490
  };
3406
5491
 
5492
+ // features/mobile-relay/view.jsx
5493
+ var import_react9 = require("react");
5494
+ var import_qrcode = __toESM(require_browser(), 1);
5495
+ var import_jsx_runtime3 = require("react/jsx-runtime");
5496
+ var DEVICE_KEY = "dsh-dock/mobile-relay/device/v1";
5497
+ var SESSION_KEY = "dsh-dock/mobile-relay/session/v1";
5498
+ var LAUNCH_KEY = "dsh-dock/mobile-relay/launch/v1";
5499
+ function rpc(method, payload) {
5500
+ return fetch("/dsh-dock/mobile-relay/" + method, {
5501
+ method: "POST",
5502
+ headers: { "content-type": "application/json" },
5503
+ body: JSON.stringify(payload || {})
5504
+ }).then(async (res) => {
5505
+ const body = await res.json().catch(() => ({}));
5506
+ if (res.ok && body && body.ok) return body.data;
5507
+ if (res.status === 404 || res.status === 405) throw new Error("\u5BBF\u4E3B\u8FDB\u7A0B\u4ECD\u662F\u65E7\u7248\u672C\uFF0C\u8BF7\u91CD\u542F dsh web \u540E\u518D\u5F00\u542F\u5C40\u57DF\u7F51\u8FDE\u63A5");
5508
+ throw new Error(body && body.error && body.error.message || "\u8BF7\u6C42\u5931\u8D25\uFF08" + res.status + "\uFF09");
5509
+ });
5510
+ }
5511
+ function deviceId() {
5512
+ let id = "";
5513
+ try {
5514
+ id = localStorage.getItem(DEVICE_KEY) || "";
5515
+ } catch {
5516
+ }
5517
+ if (!id) {
5518
+ id = globalThis.crypto && crypto.randomUUID ? crypto.randomUUID() : Math.random().toString(36).slice(2);
5519
+ try {
5520
+ localStorage.setItem(DEVICE_KEY, id);
5521
+ } catch {
5522
+ }
5523
+ }
5524
+ return id;
5525
+ }
5526
+ function readSession() {
5527
+ try {
5528
+ const raw = sessionStorage.getItem(SESSION_KEY);
5529
+ return raw ? JSON.parse(raw) : null;
5530
+ } catch {
5531
+ return null;
5532
+ }
5533
+ }
5534
+ function saveSession(value) {
5535
+ try {
5536
+ sessionStorage.setItem(SESSION_KEY, JSON.stringify(value));
5537
+ } catch {
5538
+ }
5539
+ }
5540
+ function clearSession() {
5541
+ try {
5542
+ sessionStorage.removeItem(SESSION_KEY);
5543
+ } catch {
5544
+ }
5545
+ }
5546
+ function fmtDuration2(ms) {
5547
+ const sec = Math.max(0, Math.floor((ms || 0) / 1e3));
5548
+ const min = Math.floor(sec / 60);
5549
+ const rest = sec % 60;
5550
+ return min > 0 ? min + " \u5206 " + String(rest).padStart(2, "0") + " \u79D2" : rest + " \u79D2";
5551
+ }
5552
+ function fmtTime3(value) {
5553
+ return value ? new Date(value).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : "";
5554
+ }
5555
+ function phaseLabel2(phase) {
5556
+ return { think: "\u6B63\u5728\u601D\u8003", write: "\u6B63\u5728\u8F93\u51FA", code: "\u6B63\u5728\u5F00\u53D1", search: "\u6B63\u5728\u67E5\u8D44\u6599" }[phase] || "\u8FDB\u884C\u4E2D";
5557
+ }
5558
+ function copy(value) {
5559
+ if (navigator.clipboard && navigator.clipboard.writeText) return navigator.clipboard.writeText(value);
5560
+ return Promise.reject(new Error("\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u590D\u5236\uFF0C\u8BF7\u957F\u6309\u6216\u624B\u52A8\u590D\u5236"));
5561
+ }
5562
+ function RelayIcon({ name, size = 18 }) {
5563
+ const common = { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true };
5564
+ if (name === "phone") return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...common, children: [
5565
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "7", y: "2.5", width: "10", height: "19", rx: "2.2" }),
5566
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M10 18.5h4" })
5567
+ ] });
5568
+ if (name === "link") return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...common, children: [
5569
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M10.5 13.5a4 4 0 0 0 5.66.01l2-2a4 4 0 0 0-5.66-5.66l-1.15 1.14" }),
5570
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M13.5 10.5a4 4 0 0 0-5.66-.01l-2 2a4 4 0 0 0 5.66 5.66l1.15-1.14" })
5571
+ ] });
5572
+ if (name === "copy") return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...common, children: [
5573
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "8", y: "8", width: "11", height: "12", rx: "1.5" }),
5574
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M16 8V5.5A1.5 1.5 0 0 0 14.5 4h-9A1.5 1.5 0 0 0 4 5.5v9A1.5 1.5 0 0 0 5.5 16H8" })
5575
+ ] });
5576
+ if (name === "check") return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...common, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m5 12 4.2 4.2L19 6.5" }) });
5577
+ if (name === "arrow") return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...common, children: [
5578
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M5 12h13" }),
5579
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m14 7 5 5-5 5" })
5580
+ ] });
5581
+ if (name === "close") return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...common, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m6 6 12 12M18 6 6 18" }) });
5582
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...common, children: [
5583
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "12", cy: "12", r: "8" }),
5584
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 8v4l2.5 2" })
5585
+ ] });
5586
+ }
5587
+ function useCompact() {
5588
+ const [compact, setCompact] = (0, import_react9.useState)(() => typeof window !== "undefined" && window.matchMedia("(max-width: 680px)").matches);
5589
+ (0, import_react9.useEffect)(() => {
5590
+ const media = window.matchMedia("(max-width: 680px)");
5591
+ const update = () => setCompact(media.matches);
5592
+ update();
5593
+ media.addEventListener("change", update);
5594
+ return () => media.removeEventListener("change", update);
5595
+ }, []);
5596
+ return compact;
5597
+ }
5598
+ function MobileRelayView() {
5599
+ const compact = useCompact();
5600
+ const [session, setSession] = (0, import_react9.useState)(readSession);
5601
+ const [pair, setPair] = (0, import_react9.useState)(null);
5602
+ const [network, setNetwork] = (0, import_react9.useState)(null);
5603
+ const [port, setPort] = (0, import_react9.useState)(3081);
5604
+ const [selectedAddress, setSelectedAddress] = (0, import_react9.useState)("");
5605
+ const [qrDataUrl, setQrDataUrl] = (0, import_react9.useState)("");
5606
+ const [note, setNote] = (0, import_react9.useState)("");
5607
+ const [busy, setBusy] = (0, import_react9.useState)("");
5608
+ const [notice, setNotice] = (0, import_react9.useState)("");
5609
+ const [error, setError] = (0, import_react9.useState)("");
5610
+ const mobile = session && session.role === "mobile";
5611
+ const setCurrent = (0, import_react9.useCallback)((next) => {
5612
+ setSession(next);
5613
+ next ? saveSession(next) : clearSession();
5614
+ }, []);
5615
+ (0, import_react9.useEffect)(() => {
5616
+ if (session) return;
5617
+ rpc("network").then((data) => {
5618
+ setNetwork(data);
5619
+ if (data && data.defaultPort) setPort(data.defaultPort);
5620
+ const first = data && data.addresses && data.addresses[0];
5621
+ if (first) setSelectedAddress(first.address);
5622
+ }).catch((e) => setError(e && e.message ? e.message : String(e)));
5623
+ }, [session]);
5624
+ const refresh = (0, import_react9.useCallback)(async (candidate = session) => {
5625
+ if (!candidate) return;
5626
+ try {
5627
+ const result = await rpc("status", candidate);
5628
+ setPair(result.pair);
5629
+ setError("");
5630
+ } catch (e) {
5631
+ const message = e && e.message ? e.message : String(e);
5632
+ setError(message);
5633
+ if (/过期|未完成配对/.test(message)) setCurrent(null);
5634
+ }
5635
+ }, [session, setCurrent]);
5636
+ (0, import_react9.useEffect)(() => {
5637
+ if (session) refresh(session);
5638
+ }, [session, refresh]);
5639
+ (0, import_react9.useEffect)(() => {
5640
+ if (!session) return;
5641
+ const timer = setInterval(() => refresh(session), 2500);
5642
+ return () => clearInterval(timer);
5643
+ }, [session, refresh]);
5644
+ (0, import_react9.useEffect)(() => {
5645
+ if (session) return;
5646
+ let launch = "";
5647
+ try {
5648
+ launch = sessionStorage.getItem(LAUNCH_KEY) || "";
5649
+ } catch {
5650
+ }
5651
+ if (!launch) return;
5652
+ try {
5653
+ sessionStorage.removeItem(LAUNCH_KEY);
5654
+ } catch {
5655
+ }
5656
+ const [pairId, code] = launch.split(".");
5657
+ if (!pairId || !code) return;
5658
+ setBusy("join");
5659
+ rpc("join", { pairId, code, deviceId: deviceId(), label: "\u624B\u673A\u7AEF" }).then((data) => {
5660
+ setCurrent({ pairId, secret: data.secret, role: "mobile", deviceId: deviceId() });
5661
+ setPair(data.pair);
5662
+ setNotice("\u5DF2\u8FDE\u63A5\u5230\u7535\u8111\u7AEF\uFF0C\u4EFB\u52A1\u72B6\u6001\u4F1A\u6301\u7EED\u540C\u6B65\u3002");
5663
+ }).catch((e) => setError(e && e.message ? e.message : String(e))).finally(() => setBusy(""));
5664
+ }, [session, setCurrent]);
5665
+ const mobileLink = (0, import_react9.useMemo)(() => {
5666
+ if (!session || !session.gatewayToken || !session.gatewayAddress || !session.gatewayPort) return "";
5667
+ return "http://" + session.gatewayAddress + ":" + session.gatewayPort + "/__dsh_mobile/connect#" + session.gatewayToken;
5668
+ }, [session]);
5669
+ (0, import_react9.useEffect)(() => {
5670
+ let active = true;
5671
+ if (!mobileLink) {
5672
+ setQrDataUrl("");
5673
+ return () => {
5674
+ active = false;
5675
+ };
5676
+ }
5677
+ import_qrcode.default.toDataURL(mobileLink, {
5678
+ errorCorrectionLevel: "M",
5679
+ margin: 2,
5680
+ width: 260,
5681
+ color: { dark: "#111827", light: "#ffffff" }
5682
+ }).then((value) => {
5683
+ if (active) setQrDataUrl(value);
5684
+ }).catch((e) => {
5685
+ if (active) setError("\u4E8C\u7EF4\u7801\u751F\u6210\u5931\u8D25\uFF1A" + (e && e.message ? e.message : String(e)));
5686
+ });
5687
+ return () => {
5688
+ active = false;
5689
+ };
5690
+ }, [mobileLink]);
5691
+ async function start() {
5692
+ setError("");
5693
+ setNotice("");
5694
+ const numericPort = Number(port);
5695
+ if (!selectedAddress) {
5696
+ setError("\u6CA1\u6709\u68C0\u6D4B\u5230\u53EF\u7528\u7684\u5C40\u57DF\u7F51 IPv4 \u5730\u5740\uFF0C\u8BF7\u5148\u8FDE\u63A5 Wi-Fi \u6216\u6709\u7EBF\u7F51\u7EDC\u3002");
5697
+ return;
5698
+ }
5699
+ if (!Number.isInteger(numericPort) || numericPort < 1024 || numericPort > 65535) {
5700
+ setError("\u5C40\u57DF\u7F51\u7AEF\u53E3\u9700\u4E3A 1024 \u5230 65535 \u4E4B\u95F4\u7684\u6574\u6570\u3002");
5701
+ return;
5702
+ }
5703
+ setBusy("start");
5704
+ try {
5705
+ const data = await rpc("start", { deviceId: deviceId(), port: numericPort });
5706
+ const next = {
5707
+ pairId: data.pairId,
5708
+ secret: data.secret,
5709
+ code: data.code,
5710
+ role: "desktop",
5711
+ deviceId: deviceId(),
5712
+ gatewayToken: data.gatewayToken,
5713
+ gatewayPort: data.gateway.port,
5714
+ gatewayAddress: selectedAddress
5715
+ };
5716
+ setCurrent(next);
5717
+ setPair(data.pair);
5718
+ setNotice("\u53D7\u4FDD\u62A4\u7684\u5C40\u57DF\u7F51\u53CD\u5411\u4EE3\u7406\u5DF2\u5F00\u542F\u3002\u624B\u673A\u626B\u7801\u5373\u53EF\u8FDB\u5165\u540C\u4E00 DSH\u3002");
5719
+ } catch (e) {
5720
+ setError(e && e.message ? e.message : String(e));
5721
+ } finally {
5722
+ setBusy("");
5723
+ }
5724
+ }
5725
+ async function sendNote(event) {
5726
+ event.preventDefault();
5727
+ if (!session || !note.trim()) return;
5728
+ setBusy("note");
5729
+ setError("");
5730
+ try {
5731
+ const data = await rpc("note", Object.assign({}, session, { note }));
5732
+ setPair(data.pair);
5733
+ setNote("");
5734
+ setNotice("\u63A5\u529B\u5907\u6CE8\u5DF2\u540C\u6B65\u3002");
5735
+ } catch (e) {
5736
+ setError(e && e.message ? e.message : String(e));
5737
+ } finally {
5738
+ setBusy("");
5739
+ }
5740
+ }
5741
+ async function end() {
5742
+ if (!session) return;
5743
+ setBusy("end");
5744
+ try {
5745
+ await rpc("end", session);
5746
+ setCurrent(null);
5747
+ setPair(null);
5748
+ setNotice("\u624B\u673A\u8FDE\u63A5\u5DF2\u5173\u95ED\u3002");
5749
+ } catch (e) {
5750
+ setError(e && e.message ? e.message : String(e));
5751
+ } finally {
5752
+ setBusy("");
5753
+ }
5754
+ }
5755
+ function copyLink() {
5756
+ copy(mobileLink).then(() => setNotice("\u8FDE\u63A5\u94FE\u63A5\u5DF2\u590D\u5236\u3002")).catch((e) => setError(e.message));
5757
+ }
5758
+ if (!session) return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "dmr " + (compact ? "dmr-compact" : ""), children: [
5759
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dmr-hero", children: [
5760
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dmr-hero-icon", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RelayIcon, { name: "phone", size: 22 }) }),
5761
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
5762
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { children: "\u628A\u5F00\u53D1\u4EFB\u52A1\u63A5\u5230\u624B\u673A" }),
5763
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: "\u4E3B DSH \u7EE7\u7EED\u4EC5\u9650\u672C\u673A\uFF1B\u5F00\u542F\u5C40\u57DF\u7F51\u53CD\u5411\u4EE3\u7406\u540E\uFF0C\u901A\u8FC7\u4E00\u6B21\u6027\u4E8C\u7EF4\u7801\u5B89\u5168\u63A5\u5165\u3002" })
5764
+ ] })
5765
+ ] }),
5766
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("ol", { className: "dmr-steps", children: [
5767
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { children: [
5768
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "1" }),
5769
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
5770
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: "\u786E\u8BA4 IP \u4E0E\u7AEF\u53E3" }),
5771
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("small", { children: "\u81EA\u52A8\u8BC6\u522B\u7535\u8111\u5C40\u57DF\u7F51 IPv4\uFF0C\u9ED8\u8BA4\u4F7F\u7528\u72EC\u7ACB\u7AEF\u53E3 3081\u3002" })
5772
+ ] })
5773
+ ] }),
5774
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { children: [
5775
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "2" }),
5776
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
5777
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: "\u5F00\u542F\u53CD\u5411\u4EE3\u7406" }),
5778
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("small", { children: "\u4EE3\u7406 HTTP \u4E0E WebSocket\uFF0C\u672A\u8BA4\u8BC1\u8BBE\u5907\u65E0\u6CD5\u8BBF\u95EE\u3002" })
5779
+ ] })
5780
+ ] }),
5781
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { children: [
5782
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "3" }),
5783
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
5784
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: "\u624B\u673A\u626B\u7801\u63A5\u529B" }),
5785
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("small", { children: "\u626B\u7801\u8FDB\u5165\u539F\u4F1A\u8BDD\uFF0C\u7535\u8111\u7AEF\u540C\u6B65\u770B\u5230\u5F00\u53D1\u8FDB\u5EA6\u3002" })
5786
+ ] })
5787
+ ] })
5788
+ ] }),
5789
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dmr-network-grid", children: [
5790
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "dmr-field", children: [
5791
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "\u5C40\u57DF\u7F51 IP" }),
5792
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("select", { value: selectedAddress, onChange: (e) => setSelectedAddress(e.target.value), disabled: !network || !network.addresses || !network.addresses.length, children: network && network.addresses && network.addresses.length ? network.addresses.map((item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("option", { value: item.address, children: [
5793
+ item.address,
5794
+ " \xB7 ",
5795
+ item.interface
5796
+ ] }, item.interface + item.address)) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "", children: network ? "\u672A\u68C0\u6D4B\u5230\u5730\u5740" : "\u6B63\u5728\u68C0\u6D4B\u7F51\u7EDC\u2026" }) }),
5797
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("small", { children: "\u624B\u673A\u9700\u4E0E\u7535\u8111\u4F4D\u4E8E\u53EF\u4E92\u8BBF\u7684\u540C\u4E00\u5C40\u57DF\u7F51\u3002" })
5798
+ ] }),
5799
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "dmr-field", children: [
5800
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "\u76D1\u542C\u7AEF\u53E3" }),
5801
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { value: port, onChange: (e) => setPort(e.target.value), inputMode: "numeric", type: "number", min: "1024", max: "65535", "aria-describedby": "dmr-port-help" }),
5802
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("small", { id: "dmr-port-help", children: "\u4E3B\u670D\u52A1\u4ECD\u4E3A 127.0.0.1:3080\uFF1B\u624B\u673A\u5165\u53E3\u5EFA\u8BAE\u4F7F\u7528 3081\u3002" })
5803
+ ] })
5804
+ ] }),
5805
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dmr-security", children: [
5806
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: "\u5B89\u5168\u8BF4\u660E" }),
5807
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: "\u94FE\u63A5\u76F8\u5F53\u4E8E\u4E34\u65F6\u767B\u5F55\u51ED\u636E\uFF0C\u53EA\u53D1\u7ED9\u81EA\u5DF1\u7684\u624B\u673A\u3002\u9A8C\u8BC1\u4EE4\u724C 10 \u5206\u949F\u540E\u5931\u6548\uFF1B\u5173\u95ED\u8FDE\u63A5\u4F1A\u7ACB\u5373\u64A4\u9500\u624B\u673A\u4F1A\u8BDD\u5E76\u505C\u6B62\u7AEF\u53E3\u76D1\u542C\u3002" })
5808
+ ] }),
5809
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "dmr-primary", onClick: start, disabled: busy === "start" || !selectedAddress, children: busy === "start" ? "\u6B63\u5728\u5F00\u542F\u53CD\u5411\u4EE3\u7406\u2026" : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
5810
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RelayIcon, { name: "link" }),
5811
+ "\u5F00\u542F\u53CD\u5411\u4EE3\u7406\u5E76\u751F\u6210\u4E8C\u7EF4\u7801"
5812
+ ] }) }),
5813
+ error && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dmr-message error", role: "alert", children: error }),
5814
+ notice && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dmr-message success", "aria-live": "polite", children: [
5815
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RelayIcon, { name: "check" }),
5816
+ notice
5817
+ ] })
5818
+ ] });
5819
+ const onlineMobiles = pair && pair.devices ? pair.devices.filter((device) => device.role === "mobile") : [];
5820
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "dmr " + (compact ? "dmr-compact" : ""), children: [
5821
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dmr-status-head", children: [
5822
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
5823
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "dmr-eyebrow", children: [
5824
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("i", {}),
5825
+ " ",
5826
+ mobile ? "\u5DF2\u8FDE\u63A5\u5230\u7535\u8111" : "\u624B\u673A\u8FDE\u63A5\u5DF2\u5F00\u542F"
5827
+ ] }),
5828
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { children: mobile ? "\u53EF\u4EE5\u5728\u8FD9\u91CC\u7EE7\u7EED\u5F00\u53D1" : "\u7B49\u5F85\u624B\u673A\u63A5\u5165" }),
5829
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: mobile ? "\u4EFB\u52A1\u72B6\u6001\u548C\u63A5\u529B\u5907\u6CE8\u4F1A\u81EA\u52A8\u540C\u6B65\u3002\u7EE7\u7EED\u5F00\u53D1\u8BF7\u56DE\u5230\u5F53\u524D DSH \u4F1A\u8BDD\u8F93\u5165\u533A\u3002" : "\u5C06\u4E0B\u9762\u7684\u5B89\u5168\u94FE\u63A5\u53D1\u5230\u624B\u673A\uFF1B\u8FDE\u63A5\u5728 " + fmtTime3(pair && pair.expiresAt) + " \u524D\u6709\u6548\u3002" })
5830
+ ] }),
5831
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "dmr-icon-button", onClick: end, disabled: busy === "end", title: "\u5173\u95ED\u624B\u673A\u8FDE\u63A5", "aria-label": "\u5173\u95ED\u624B\u673A\u8FDE\u63A5", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RelayIcon, { name: "close" }) })
5832
+ ] }),
5833
+ !mobile && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dmr-share", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dmr-share-layout", children: [
5834
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dmr-qr-card", children: [
5835
+ qrDataUrl ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("img", { src: qrDataUrl, alt: "\u624B\u673A\u63A5\u529B\u4E00\u6B21\u6027\u8FDE\u63A5\u4E8C\u7EF4\u7801", width: "260", height: "260" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dmr-qr-loading", "aria-live": "polite", children: "\u6B63\u5728\u751F\u6210\u4E8C\u7EF4\u7801\u2026" }),
5836
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: "\u4F7F\u7528\u624B\u673A\u76F8\u673A\u626B\u7801" }),
5837
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("small", { children: "\u624B\u673A\u4E0E\u7535\u8111\u9700\u5728\u540C\u4E00\u5C40\u57DF\u7F51" })
5838
+ ] }),
5839
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dmr-share-detail", children: [
5840
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
5841
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "dmr-eyebrow", children: [
5842
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("i", {}),
5843
+ " \u53CD\u5411\u4EE3\u7406\u5DF2\u8FD0\u884C"
5844
+ ] }),
5845
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("h4", { children: [
5846
+ session.gatewayAddress,
5847
+ ":",
5848
+ session.gatewayPort,
5849
+ " \u2192 127.0.0.1:3080"
5850
+ ] })
5851
+ ] }),
5852
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dmr-link", title: mobileLink, children: mobileLink || "\u5C40\u57DF\u7F51\u5165\u53E3\u672A\u5C31\u7EEA" }),
5853
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dmr-share-actions", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("button", { type: "button", className: "dmr-primary", onClick: copyLink, disabled: !mobileLink, children: [
5854
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RelayIcon, { name: "copy" }),
5855
+ "\u590D\u5236\u8FDE\u63A5\u94FE\u63A5"
5856
+ ] }) }),
5857
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("small", { children: "\u4E8C\u7EF4\u7801\u548C\u94FE\u63A5\u53EA\u53EF\u6210\u529F\u9A8C\u8BC1\u4E00\u6B21\uFF0C10 \u5206\u949F\u540E\u5931\u6548\u3002\u5982\u9700\u53E6\u4E00\u53F0\u624B\u673A\uFF0C\u8BF7\u5173\u95ED\u540E\u91CD\u65B0\u5F00\u542F\u3002" })
5858
+ ] })
5859
+ ] }) }),
5860
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dmr-overview", children: [
5861
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dmr-overview-card", children: [
5862
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "\u8BBE\u5907\u72B6\u6001" }),
5863
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: mobile ? "\u624B\u673A\u5DF2\u63A5\u529B" : onlineMobiles.length ? onlineMobiles.length + " \u53F0\u624B\u673A\u5728\u7EBF" : "\u7B49\u5F85\u624B\u673A" }),
5864
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("small", { children: mobile ? "\u4FDD\u6301\u6B64\u9875\u9762\u6253\u5F00\u5373\u53EF\u540C\u6B65\u72B6\u6001" : onlineMobiles.length ? "\u72B6\u6001\u6BCF 2.5 \u79D2\u5237\u65B0" : "\u8FDE\u63A5\u7801\u4EC5\u5728\u5F53\u524D\u914D\u5BF9\u7A97\u53E3\u6709\u6548" })
5865
+ ] }),
5866
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dmr-overview-card", children: [
5867
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "\u8FDB\u884C\u4E2D\u7684\u4EFB\u52A1" }),
5868
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: pair && pair.tasks ? pair.tasks.length : "\u2014" }),
5869
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("small", { children: pair && pair.tasks && pair.tasks.length ? "\u4E0E DSH \u5F53\u524D\u4F1A\u8BDD\u5171\u7528\u540C\u4E00\u4EFB\u52A1" : "\u5F00\u59CB\u4EFB\u52A1\u540E\u4F1A\u81EA\u52A8\u663E\u793A\u5728\u8FD9\u91CC" })
5870
+ ] })
5871
+ ] }),
5872
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dmr-section", children: [
5873
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dmr-section-head", children: [
5874
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h4", { children: "\u5B9E\u65F6\u4EFB\u52A1" }),
5875
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "dmr-text-button", onClick: () => refresh(), disabled: busy, children: "\u5237\u65B0" })
5876
+ ] }),
5877
+ pair && pair.tasks && pair.tasks.length ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dmr-task-list", children: pair.tasks.map((task) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("article", { className: "dmr-task", children: [
5878
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dmr-phase " + task.phase, children: phaseLabel2(task.phase) }),
5879
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
5880
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: task.title }),
5881
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("small", { children: [
5882
+ "\u5DF2\u8FD0\u884C ",
5883
+ fmtDuration2(task.elapsed),
5884
+ " \xB7 \u6700\u8FD1\u6D3B\u52A8 ",
5885
+ fmtTime3(task.lastActivityAt)
5886
+ ] })
5887
+ ] })
5888
+ ] }, task.sessionId)) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dmr-empty", children: "\u5F53\u524D\u6CA1\u6709\u6B63\u5728\u8FD0\u884C\u7684\u4EFB\u52A1\u3002\u542F\u52A8\u4EFB\u52A1\u540E\uFF0C\u624B\u673A\u548C\u7535\u8111\u90FD\u4F1A\u770B\u5230\u540C\u4E00\u4EFD\u72B6\u6001\u3002" })
5889
+ ] }),
5890
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("form", { className: "dmr-note", onSubmit: sendNote, children: [
5891
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dmr-section-head", children: [
5892
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h4", { children: "\u63A5\u529B\u5907\u6CE8" }),
5893
+ pair && pair.noteAt ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("small", { children: [
5894
+ pair.noteFrom,
5895
+ " \xB7 ",
5896
+ fmtTime3(pair.noteAt)
5897
+ ] }) : null
5898
+ ] }),
5899
+ pair && pair.note ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("blockquote", { children: pair.note }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: "\u628A\u5F53\u524D\u8FDB\u5EA6\u3001\u4E0B\u4E00\u6B65\u6216\u9700\u8981\u6CE8\u610F\u7684\u4E8B\u9879\u7559\u7ED9\u53E6\u4E00\u53F0\u8BBE\u5907\u3002" }),
5900
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { children: [
5901
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "sr-only", children: "\u63A5\u529B\u5907\u6CE8" }),
5902
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("textarea", { value: note, onChange: (e) => setNote(e.target.value), maxLength: "1200", placeholder: mobile ? "\u4F8B\u5982\uFF1A\u6211\u5DF2\u5728\u624B\u673A\u67E5\u770B\u5230\u6784\u5EFA\u9519\u8BEF\uFF0C\u4E0B\u4E00\u6B65\u8BF7\u5728\u7535\u8111\u8FD0\u884C\u6D4B\u8BD5\u3002" : "\u4F8B\u5982\uFF1A\u5DF2\u7ECF\u5B8C\u6210\u63A5\u53E3\u4FEE\u6539\uFF0C\u624B\u673A\u7AEF\u7EE7\u7EED\u68C0\u67E5\u9875\u9762\u4EA4\u4E92\u3002" })
5903
+ ] }),
5904
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { className: "dmr-secondary", disabled: !note.trim() || busy === "note", children: busy === "note" ? "\u6B63\u5728\u540C\u6B65\u2026" : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
5905
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RelayIcon, { name: "arrow" }),
5906
+ "\u540C\u6B65\u5907\u6CE8"
5907
+ ] }) })
5908
+ ] }),
5909
+ error && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dmr-message error", role: "alert", children: error }),
5910
+ notice && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dmr-message success", "aria-live": "polite", children: [
5911
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RelayIcon, { name: "check" }),
5912
+ notice
5913
+ ] })
5914
+ ] });
5915
+ }
5916
+ function MobileRelayHomeStat() {
5917
+ const [summary, setSummary] = (0, import_react9.useState)("\u53EF\u5728\u624B\u673A\u7EE7\u7EED\u5F53\u524D\u4EFB\u52A1");
5918
+ (0, import_react9.useEffect)(() => {
5919
+ const session = readSession();
5920
+ if (!session) return;
5921
+ rpc("status", session).then((data) => {
5922
+ const p = data.pair;
5923
+ setSummary((p.tasks || []).length ? p.tasks.length + " \u4E2A\u4EFB\u52A1\u540C\u6B65\u4E2D" : "\u624B\u673A\u5DF2\u8FDE\u63A5\uFF0C\u7B49\u5F85\u4EFB\u52A1");
5924
+ }).catch(() => setSummary("\u8FDE\u63A5\u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0\u914D\u5BF9"));
5925
+ }, []);
5926
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: summary });
5927
+ }
5928
+ var feature7 = {
5929
+ id: "mobile-relay",
5930
+ name: "\u624B\u673A\u63A5\u529B",
5931
+ order: 80,
5932
+ accent: "#38bdf8",
5933
+ description: "\u5B89\u5168\u53CD\u5411\u4EE3\u7406\u4E0E\u626B\u7801\u63A5\u529B\uFF0C\u540C\u6B65\u5F53\u524D\u4EFB\u52A1\u72B6\u6001\u548C\u5907\u6CE8",
5934
+ defaultEnabled: true,
5935
+ css: `
5936
+ .dmr{--dmr-accent:#38bdf8;--dmr-accent-soft:color-mix(in srgb,var(--dmr-accent) 13%,transparent);display:flex;flex-direction:column;gap:16px;max-width:720px;color:var(--dsw-alias-label-primary);font-size:13px;line-height:1.5}.dmr h3,.dmr h4,.dmr p{margin:0}.dmr h3{font-size:17px;line-height:1.25;letter-spacing:-.01em}.dmr h4{font-size:13px}.dmr-hero,.dmr-status-head{display:flex;align-items:flex-start;gap:12px}.dmr-hero>div,.dmr-status-head>div{min-width:0;display:flex;flex-direction:column;gap:4px}.dmr-hero p,.dmr-status-head p,.dmr-field small,.dmr-share small,.dmr-overview-card small,.dmr-task small,.dmr-note p{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.55}.dmr-hero-icon{width:42px;height:42px;display:inline-flex;align-items:center;justify-content:center;flex:none;border-radius:14px;background:var(--dmr-accent-soft);color:var(--dmr-accent);border:1px solid color-mix(in srgb,var(--dmr-accent) 35%,var(--dsw-alias-border-l1))}.dmr-steps{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:0;padding:0;list-style:none}.dmr-steps li{display:flex;gap:9px;padding:11px;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:12px}.dmr-steps li>span{width:21px;height:21px;display:inline-flex;align-items:center;justify-content:center;flex:none;border-radius:50%;font-size:11px;font-weight:700;color:var(--dmr-accent);background:var(--dmr-accent-soft)}.dmr-steps div{display:flex;flex-direction:column;gap:3px;min-width:0}.dmr-steps strong{font-size:12px}.dmr-steps small{font-size:11px;color:var(--dsw-alias-label-secondary);line-height:1.45}.dmr-field{display:flex;flex-direction:column;gap:6px;font-weight:600}.dmr-field input,.dmr-field select,.dmr-note textarea{box-sizing:border-box;width:100%;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border-radius:10px;padding:10px 12px;min-height:44px;font:inherit;outline:none;transition:border-color .18s ease,box-shadow .18s ease}.dmr-field input:focus,.dmr-field select:focus,.dmr-note textarea:focus{border-color:var(--dmr-accent);box-shadow:0 0 0 3px var(--dmr-accent-soft)}.dmr-field small{font-weight:400}.dmr-network-grid{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(150px,.6fr);gap:12px}.dmr-security{padding:12px 13px;border:1px solid color-mix(in srgb,#f59e0b 38%,var(--dsw-alias-border-l1));border-radius:12px;background:color-mix(in srgb,#f59e0b 8%,transparent)}.dmr-security strong{display:block;margin-bottom:4px;color:#f59e0b;font-size:12px}.dmr-security p{font-size:12px;color:var(--dsw-alias-label-secondary);line-height:1.55}.dmr-primary,.dmr-secondary,.dmr-text-button,.dmr-icon-button{font:inherit;touch-action:manipulation;cursor:pointer;transition:transform .15s ease,background .18s ease,border-color .18s ease,opacity .18s ease}.dmr-primary,.dmr-secondary{min-height:44px;display:inline-flex;align-items:center;justify-content:center;gap:8px;border-radius:10px;padding:9px 13px;font-weight:600}.dmr-primary{align-self:flex-start;border:1px solid var(--dmr-accent);background:var(--dmr-accent);color:#062238}.dmr-primary:hover{filter:brightness(1.05)}.dmr-secondary{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary)}.dmr-secondary:hover{border-color:var(--dmr-accent);background:var(--dmr-accent-soft)}.dmr-primary:active,.dmr-secondary:active,.dmr-icon-button:active{transform:scale(.98)}.dmr-primary:disabled,.dmr-secondary:disabled,.dmr-text-button:disabled,.dmr-icon-button:disabled{cursor:not-allowed;opacity:.5}.dmr-message{display:flex;align-items:flex-start;gap:7px;padding:10px 12px;border-radius:10px;font-size:12px}.dmr-message.success{color:var(--dsw-alias-state-success-primary);background:color-mix(in srgb,var(--dsw-alias-state-success-primary) 10%,transparent)}.dmr-message.error{color:var(--dsw-alias-state-error-primary);background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 10%,transparent)}.dmr-status-head{justify-content:space-between}.dmr-eyebrow{display:inline-flex;align-items:center;gap:6px;font-size:11px;font-weight:600;color:var(--dmr-accent)}.dmr-eyebrow i{width:7px;height:7px;border-radius:50%;background:currentColor;box-shadow:0 0 0 4px var(--dmr-accent-soft)}.dmr-icon-button{display:inline-flex;align-items:center;justify-content:center;flex:none;width:44px;height:44px;border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:transparent;color:var(--dsw-alias-label-secondary)}.dmr-icon-button:hover{color:var(--dsw-alias-state-error-primary);border-color:currentColor}.dmr-share{display:flex;flex-direction:column;gap:9px;padding:13px;border:1px solid color-mix(in srgb,var(--dmr-accent) 32%,var(--dsw-alias-border-l1));border-radius:13px;background:var(--dmr-accent-soft)}.dmr-share-layout{display:grid;grid-template-columns:196px minmax(0,1fr);gap:16px;align-items:center}.dmr-qr-card{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;gap:5px;padding:10px;border-radius:12px;background:#fff;color:#111827;text-align:center}.dmr-qr-card img{display:block;width:176px;height:176px;max-width:100%;object-fit:contain}.dmr-qr-card strong{font-size:12px}.dmr-qr-card small{color:#4b5563;font-size:10px}.dmr-qr-loading{display:grid;place-items:center;width:176px;height:176px;color:#64748b;font-size:12px}.dmr-share-detail{min-width:0;display:flex;flex-direction:column;gap:10px}.dmr-share-detail>div:first-child{display:flex;flex-direction:column;gap:4px}.dmr-link{padding:10px 11px;border-radius:8px;background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l1);font:12px/1.4 ui-monospace,SFMono-Regular,Menlo,monospace;word-break:break-all;color:var(--dsw-alias-label-secondary)}.dmr-share-actions{display:flex;gap:8px;flex-wrap:wrap}.dmr-share-actions .dmr-primary{align-self:auto}.dmr-overview{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.dmr-overview-card{display:flex;flex-direction:column;gap:3px;padding:12px;border:1px solid var(--dsw-alias-border-l1);border-radius:12px;background:var(--dsw-alias-bg-layer-1)}.dmr-overview-card>span{font-size:11px;color:var(--dsw-alias-label-tertiary)}.dmr-overview-card strong{font-size:16px;letter-spacing:-.01em}.dmr-section{display:flex;flex-direction:column;gap:9px}.dmr-section-head{display:flex;align-items:center;justify-content:space-between;gap:10px}.dmr-section-head small{font-size:11px;color:var(--dsw-alias-label-tertiary)}.dmr-text-button{border:0;background:transparent;color:var(--dmr-accent);padding:8px;min-height:36px;font-weight:600}.dmr-task-list{display:flex;flex-direction:column;gap:8px}.dmr-task{display:flex;align-items:flex-start;gap:9px;padding:10px 11px;border:1px solid var(--dsw-alias-border-l1);border-radius:10px;background:var(--dsw-alias-bg-layer-1)}.dmr-task>div{display:flex;min-width:0;flex:1;flex-direction:column;gap:2px}.dmr-task strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dmr-phase{flex:none;border-radius:999px;padding:3px 8px;font-size:11px;background:var(--dmr-accent-soft);color:var(--dmr-accent)}.dmr-phase.write{color:var(--dsw-alias-state-success-primary)}.dmr-phase.code{color:#f59e0b}.dmr-phase.search{color:#14b8a6}.dmr-empty{padding:18px 12px;text-align:center;border:1px dashed var(--dsw-alias-border-l2);border-radius:10px;color:var(--dsw-alias-label-secondary);font-size:12px}.dmr-note{display:flex;flex-direction:column;gap:9px;padding-top:2px}.dmr-note blockquote{margin:0;padding:10px 12px;border-left:3px solid var(--dmr-accent);border-radius:0 9px 9px 0;background:var(--dmr-accent-soft);white-space:pre-wrap;font-size:12px}.dmr-note textarea{min-height:88px;resize:vertical;line-height:1.5}.dmr-note .dmr-secondary{align-self:flex-start}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@media (max-width:680px){.dmr{gap:14px;font-size:14px}.dmr h3{font-size:18px}.dmr-steps{grid-template-columns:1fr;gap:8px}.dmr-steps li{padding:10px}.dmr-steps small,.dmr-hero p,.dmr-status-head p,.dmr-field small,.dmr-share small,.dmr-overview-card small,.dmr-task small,.dmr-note p{font-size:12px}.dmr-network-grid{grid-template-columns:1fr;gap:10px}.dmr-field input,.dmr-field select{font-size:16px}.dmr-primary,.dmr-secondary{width:100%;font-size:14px}.dmr-share-layout{grid-template-columns:1fr;gap:12px}.dmr-qr-card{width:min(240px,100%);margin:0 auto}.dmr-qr-card img,.dmr-qr-loading{width:210px;height:210px}.dmr-share-actions{flex-direction:column}.dmr-share-actions .dmr-primary{width:100%}.dmr-overview{gap:8px}.dmr-overview-card{padding:11px}.dmr-status-head{gap:8px}.dmr-link{font-size:11px}.dmr-note textarea{font-size:16px;min-height:104px}.dmr-note .dmr-secondary{align-self:stretch}.dmr-compact .dmr-hero-icon{width:40px;height:40px;border-radius:13px}}@media (prefers-reduced-motion:reduce){.dmr-primary,.dmr-secondary,.dmr-text-button,.dmr-icon-button,.dmr-field input,.dmr-field select,.dmr-note textarea{transition:none}}
5937
+ `,
5938
+ View: MobileRelayView,
5939
+ HomeStat: MobileRelayHomeStat
5940
+ };
5941
+
3407
5942
  // src/client.jsx
3408
- var DOCK_VERSION = "0.5.0";
3409
- var BUILTIN_FEATURES = [feature, feature2, feature3, feature4, feature5, feature6];
5943
+ var DOCK_VERSION = "0.7.0";
5944
+ var BUILTIN_FEATURES = [feature, feature2, feature3, feature4, feature5, feature6, feature7];
3410
5945
  var PLANNED_FEATURES = [];
3411
5946
  var PLANNED_NOTES = {};
3412
5947
  var externalDefs = [];
@@ -3536,6 +6071,10 @@ var SHELL_CSS = [
3536
6071
  ".dockm-foot-sw{margin-left:auto;flex:none;display:inline-flex;align-items:center;gap:8px;}",
3537
6072
  ".dockm-foot-swlabel{font-size:11px;color:var(--dsw-alias-label-tertiary);}",
3538
6073
  ".dockm-foot-swlabel.on{color:var(--dsw-alias-state-success-primary);}",
6074
+ // 窄屏:功能坞是一级工作台而不是被压扁的桌面弹窗。全屏承接安全区,导航改横向,
6075
+ // 禁用桌面拖拽/缩放,所有导航和关闭动作保持至少 44px 的可点击面积。
6076
+ "@media (max-width:680px){.dockm-backdrop{align-items:stretch;justify-content:stretch;background:var(--dsw-alias-bg-layer-2);backdrop-filter:none}.dockm-dialog,.dockm-dialog.dockm-max{position:fixed!important;left:0!important;top:0!important;right:auto!important;bottom:auto!important;width:100dvw!important;height:100dvh!important;min-height:100dvh;border:0;border-radius:0;box-shadow:none}.dockm-dialog.dockm-min .dockm-body{display:flex}.dockm-head{min-height:60px;box-sizing:border-box;padding:calc(env(safe-area-inset-top) + 8px) 12px 8px;cursor:default;touch-action:manipulation}.dockm-sub,.dockm-win,.dockm-resize{display:none}.dockm-title{font-size:16px}.dockm-close{width:44px;height:44px;font-size:17px}.dockm-body{flex-direction:column;min-height:0}.dockm-nav{box-sizing:border-box;width:auto;max-width:100%;min-height:56px;flex-direction:row;gap:6px;padding:6px 10px;overflow-x:auto;overflow-y:hidden;border-right:0;border-bottom:1px solid var(--dsw-alias-border-l1);scrollbar-width:none;overscroll-behavior-x:contain}.dockm-nav::-webkit-scrollbar{display:none}.dockm-nav-item{flex:none;min-height:44px;padding:0 12px;font-size:13px;touch-action:manipulation}.dockm-nav-item .dockm-badge{display:none}.dockm-content{padding:16px max(16px,env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));gap:14px;overscroll-behavior:contain}.dockm-content-head{gap:5px}.dockm-name{font-size:16px}.dockm-desc{font-size:13px;line-height:1.55}.dockm-foot{padding-top:12px;font-size:11px}.dockm-foot-sw{width:100%;margin-left:0;justify-content:space-between}.dock-sw{width:44px;height:26px}.dock-sw::after{top:3px;left:3px;width:18px;height:18px}.dock-sw.on::after{transform:translateX(18px)}.dockh-grid{grid-template-columns:1fr;gap:10px}.dockh-card{padding:12px}.dockh-desc{font-size:13px}.dockh-go{font-size:12px}}",
6077
+ "@media (prefers-reduced-motion:reduce){.dockm-backdrop,.dockm-dialog{animation:none}.dockm-nav-item,.dockm-close,.dockm-win,.dock-sw{transition:none}}",
3539
6078
  ".dockh-desc{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.5;}",
3540
6079
  ".dockh-stat{color:var(--dsw-alias-label-tertiary);font-size:12px;border-top:1px solid var(--dsw-alias-border-l1);padding-top:6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}",
3541
6080
  ".dockh-foot{display:flex;align-items:center;gap:8px;}",
@@ -3579,8 +6118,8 @@ function ensureCss() {
3579
6118
  }
3580
6119
  }
3581
6120
  function useExternalVersion() {
3582
- const [, bump] = import_react9.default.useReducer((n) => n + 1, 0);
3583
- import_react9.default.useEffect(() => {
6121
+ const [, bump] = import_react10.default.useReducer((n) => n + 1, 0);
6122
+ import_react10.default.useEffect(() => {
3584
6123
  externalListeners.add(bump);
3585
6124
  return () => {
3586
6125
  externalListeners.delete(bump);
@@ -3590,40 +6129,40 @@ function useExternalVersion() {
3590
6129
  var lastGeom = { x: null, y: null, w: null, h: null };
3591
6130
  function DockIcon(props) {
3592
6131
  const size = props && props.size || 16;
3593
- return import_react9.default.createElement(
6132
+ return import_react10.default.createElement(
3594
6133
  "svg",
3595
6134
  { width: size, height: size, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.3, "aria-hidden": true },
3596
- import_react9.default.createElement("rect", { x: 2.5, y: 2.5, width: 4.4, height: 4.4, rx: 1.2 }),
3597
- import_react9.default.createElement("rect", { x: 9, y: 2.5, width: 4.4, height: 4.4, rx: 1.2 }),
3598
- import_react9.default.createElement("rect", { x: 2.5, y: 9, width: 4.4, height: 4.4, rx: 1.2 }),
3599
- import_react9.default.createElement("rect", { x: 9, y: 9, width: 4.4, height: 4.4, rx: 1.2 })
6135
+ import_react10.default.createElement("rect", { x: 2.5, y: 2.5, width: 4.4, height: 4.4, rx: 1.2 }),
6136
+ import_react10.default.createElement("rect", { x: 9, y: 2.5, width: 4.4, height: 4.4, rx: 1.2 }),
6137
+ import_react10.default.createElement("rect", { x: 2.5, y: 9, width: 4.4, height: 4.4, rx: 1.2 }),
6138
+ import_react10.default.createElement("rect", { x: 9, y: 9, width: 4.4, height: 4.4, rx: 1.2 })
3600
6139
  );
3601
6140
  }
3602
6141
  function DockEntry(props) {
3603
6142
  const wide = !!props.wide;
3604
- const [open, setOpen] = import_react9.default.useState(panelNav.open);
3605
- import_react9.default.useEffect(() => subscribePanel(() => setOpen(panelNav.open)), []);
3606
- return import_react9.default.createElement("button", {
6143
+ const [open, setOpen] = import_react10.default.useState(panelNav.open);
6144
+ import_react10.default.useEffect(() => subscribePanel(() => setOpen(panelNav.open)), []);
6145
+ return import_react10.default.createElement("button", {
3607
6146
  type: "button",
3608
6147
  className: "docke2-btn" + (open ? " docke2-on" : "") + (wide ? "" : " docke2-rail"),
3609
6148
  title: "\u529F\u80FD\u575E",
3610
6149
  "aria-label": "\u529F\u80FD\u575E",
3611
6150
  "aria-expanded": open,
3612
6151
  onClick: () => setPanelOpen(!open)
3613
- }, import_react9.default.createElement(DockIcon, { size: wide ? 16 : 18 }), wide ? import_react9.default.createElement("span", { className: "docke2-label" }, "\u529F\u80FD\u575E") : null);
6152
+ }, import_react10.default.createElement(DockIcon, { size: wide ? 16 : 18 }), wide ? import_react10.default.createElement("span", { className: "docke2-label" }, "\u529F\u80FD\u575E") : null);
3614
6153
  }
3615
6154
  function DockModal() {
3616
- const [nav, setNav] = import_react9.default.useState({ open: panelNav.open, active: panelNav.active, params: panelNav.params });
3617
- import_react9.default.useEffect(() => subscribePanel(() => setNav({ open: panelNav.open, active: panelNav.active, params: panelNav.params })), []);
6155
+ const [nav, setNav] = import_react10.default.useState({ open: panelNav.open, active: panelNav.active, params: panelNav.params });
6156
+ import_react10.default.useEffect(() => subscribePanel(() => setNav({ open: panelNav.open, active: panelNav.active, params: panelNav.params })), []);
3618
6157
  const open = nav.open || typeof document === "undefined";
3619
6158
  const active = nav.active;
3620
6159
  const setActive = navigatePanel;
3621
6160
  const navParams = nav.params;
3622
- const [, force] = import_react9.default.useReducer((n) => n + 1, 0);
6161
+ const [, force] = import_react10.default.useReducer((n) => n + 1, 0);
3623
6162
  useExternalVersion();
3624
- const [win, setWin] = import_react9.default.useState(() => ({ mode: "normal", x: null, y: null, w: null, h: null }));
3625
- const dlgRef = import_react9.default.useRef(null);
3626
- import_react9.default.useEffect(() => {
6163
+ const [win, setWin] = import_react10.default.useState(() => ({ mode: "normal", x: null, y: null, w: null, h: null }));
6164
+ const dlgRef = import_react10.default.useRef(null);
6165
+ import_react10.default.useEffect(() => {
3627
6166
  if (lastGeom.w) setWin({ mode: "normal", x: lastGeom.x, y: lastGeom.y, w: lastGeom.w, h: lastGeom.h });
3628
6167
  }, []);
3629
6168
  function beginDrag(e, type) {
@@ -3661,13 +6200,13 @@ function DockModal() {
3661
6200
  const mod = isHome ? null : MODULES.find((m) => m.id === active) || MODULES[0];
3662
6201
  const st = mod ? stateOf(mod.id) : null;
3663
6202
  const View = mod ? mod.View : null;
3664
- const viewNode = mod && View ? import_react9.default.createElement(
6203
+ const viewNode = mod && View ? import_react10.default.createElement(
3665
6204
  "div",
3666
6205
  { className: "dockm-view" },
3667
- import_react9.default.createElement(
3668
- mod.external ? FeatureBoundary : import_react9.default.Fragment,
6206
+ import_react10.default.createElement(
6207
+ mod.external ? FeatureBoundary : import_react10.default.Fragment,
3669
6208
  null,
3670
- import_react9.default.createElement(View, { ctx: ctxRef.current, feature: mod, params: navParams })
6209
+ import_react10.default.createElement(View, { ctx: ctxRef.current, feature: mod, params: navParams })
3671
6210
  )
3672
6211
  ) : null;
3673
6212
  const enabledCount = MODULES.filter((m) => {
@@ -3681,10 +6220,10 @@ function DockModal() {
3681
6220
  width: win.w != null ? win.w : void 0,
3682
6221
  height: win.mode === "min" ? "auto" : win.h != null ? win.h : void 0
3683
6222
  } : null;
3684
- return import_react9.default.createElement(
6223
+ return import_react10.default.createElement(
3685
6224
  "div",
3686
6225
  { className: "dockm-backdrop", onClick: () => setPanelOpen(false) },
3687
- import_react9.default.createElement(
6226
+ import_react10.default.createElement(
3688
6227
  "div",
3689
6228
  {
3690
6229
  className: "dockm-dialog" + (win.mode === "max" ? " dockm-max" : "") + (win.mode === "min" ? " dockm-min" : ""),
@@ -3692,41 +6231,41 @@ function DockModal() {
3692
6231
  ref: dlgRef,
3693
6232
  onClick: (e) => e.stopPropagation()
3694
6233
  },
3695
- import_react9.default.createElement(
6234
+ import_react10.default.createElement(
3696
6235
  "div",
3697
6236
  {
3698
6237
  className: "dockm-head",
3699
6238
  onPointerDown: (e) => beginDrag(e, "move"),
3700
6239
  onDoubleClick: () => setWin((s) => Object.assign({}, s, { mode: s.mode === "max" ? "normal" : "max" }))
3701
6240
  },
3702
- import_react9.default.createElement(DockIcon, null),
3703
- import_react9.default.createElement("span", { className: "dockm-title" }, "\u529F\u80FD\u575E"),
3704
- import_react9.default.createElement("span", { className: "dockm-sub" }, "dsh-dock \xB7 \u4E5F\u53EF\u5728 \u8BBE\u7F6E \u2192 \u529F\u80FD\u575E \u6253\u5F00\u7BA1\u7406\u9875"),
3705
- import_react9.default.createElement(
6241
+ import_react10.default.createElement(DockIcon, null),
6242
+ import_react10.default.createElement("span", { className: "dockm-title" }, "\u529F\u80FD\u575E"),
6243
+ import_react10.default.createElement("span", { className: "dockm-sub" }, "dsh-dock \xB7 \u4E5F\u53EF\u5728 \u8BBE\u7F6E \u2192 \u529F\u80FD\u575E \u6253\u5F00\u7BA1\u7406\u9875"),
6244
+ import_react10.default.createElement(
3706
6245
  "span",
3707
6246
  { className: "dockm-ctrls" },
3708
- import_react9.default.createElement("button", {
6247
+ import_react10.default.createElement("button", {
3709
6248
  type: "button",
3710
6249
  className: "dockm-win",
3711
6250
  title: win.mode === "min" ? "\u8FD8\u539F" : "\u6700\u5C0F\u5316",
3712
6251
  onClick: () => setWin((s) => Object.assign({}, s, { mode: s.mode === "min" ? "normal" : "min" }))
3713
6252
  }, "\u2581"),
3714
- import_react9.default.createElement("button", {
6253
+ import_react10.default.createElement("button", {
3715
6254
  type: "button",
3716
6255
  className: "dockm-win",
3717
6256
  title: win.mode === "max" ? "\u8FD8\u539F" : "\u6700\u5927\u5316",
3718
6257
  onClick: () => setWin((s) => Object.assign({}, s, { mode: s.mode === "max" ? "normal" : "max" }))
3719
6258
  }, win.mode === "max" ? "\u2750" : "\u25A2"),
3720
- import_react9.default.createElement("button", { type: "button", className: "dockm-close", "aria-label": "\u5173\u95ED", title: "\u5173\u95ED", onClick: () => setPanelOpen(false) }, "\u2715")
6259
+ import_react10.default.createElement("button", { type: "button", className: "dockm-close", "aria-label": "\u5173\u95ED", title: "\u5173\u95ED", onClick: () => setPanelOpen(false) }, "\u2715")
3721
6260
  )
3722
6261
  ),
3723
- import_react9.default.createElement(
6262
+ import_react10.default.createElement(
3724
6263
  "div",
3725
6264
  { className: "dockm-body" },
3726
- import_react9.default.createElement(
6265
+ import_react10.default.createElement(
3727
6266
  "nav",
3728
6267
  { className: "dockm-nav", "aria-label": "\u529F\u80FD\u6A21\u5757" },
3729
- import_react9.default.createElement(
6268
+ import_react10.default.createElement(
3730
6269
  "button",
3731
6270
  {
3732
6271
  type: "button",
@@ -3734,10 +6273,10 @@ function DockModal() {
3734
6273
  className: "dockm-nav-item" + (isHome ? " on" : ""),
3735
6274
  onClick: () => setActive("home")
3736
6275
  },
3737
- import_react9.default.createElement("span", { className: "dockm-navhome" }, import_react9.default.createElement(DockIcon, null)),
3738
- import_react9.default.createElement("span", null, "\u9996\u9875")
6276
+ import_react10.default.createElement("span", { className: "dockm-navhome" }, import_react10.default.createElement(DockIcon, null)),
6277
+ import_react10.default.createElement("span", null, "\u9996\u9875")
3739
6278
  ),
3740
- MODULES.map((m) => import_react9.default.createElement(
6279
+ MODULES.map((m) => import_react10.default.createElement(
3741
6280
  "button",
3742
6281
  {
3743
6282
  type: "button",
@@ -3745,42 +6284,42 @@ function DockModal() {
3745
6284
  className: "dockm-nav-item" + (m.id === active ? " on" : ""),
3746
6285
  onClick: () => setActive(m.id)
3747
6286
  },
3748
- import_react9.default.createElement("span", { className: "dockm-dot", style: { background: m.accent } }),
3749
- import_react9.default.createElement("span", null, m.name),
3750
- m.planned ? import_react9.default.createElement("span", { className: "dockm-badge" }, "\u89C4\u5212\u4E2D") : null,
3751
- m.external ? import_react9.default.createElement("span", { className: "dockm-badge" }, "\u5916\u90E8") : null
6287
+ import_react10.default.createElement("span", { className: "dockm-dot", style: { background: m.accent } }),
6288
+ import_react10.default.createElement("span", null, m.name),
6289
+ m.planned ? import_react10.default.createElement("span", { className: "dockm-badge" }, "\u89C4\u5212\u4E2D") : null,
6290
+ m.external ? import_react10.default.createElement("span", { className: "dockm-badge" }, "\u5916\u90E8") : null
3752
6291
  ))
3753
6292
  ),
3754
- import_react9.default.createElement(
6293
+ import_react10.default.createElement(
3755
6294
  "div",
3756
6295
  { className: "dockm-content" },
3757
- import_react9.default.createElement(
6296
+ import_react10.default.createElement(
3758
6297
  "div",
3759
6298
  { className: "dockm-content-head" },
3760
- import_react9.default.createElement(
6299
+ import_react10.default.createElement(
3761
6300
  "div",
3762
6301
  { className: "dockm-name" },
3763
- isHome ? import_react9.default.createElement("span", { className: "dockm-navhome" }, import_react9.default.createElement(DockIcon, null)) : import_react9.default.createElement("span", { className: "dockm-dot", style: { background: mod.accent } }),
6302
+ isHome ? import_react10.default.createElement("span", { className: "dockm-navhome" }, import_react10.default.createElement(DockIcon, null)) : import_react10.default.createElement("span", { className: "dockm-dot", style: { background: mod.accent } }),
3764
6303
  isHome ? "\u9996\u9875" : mod.name,
3765
- !isHome && mod.planned ? import_react9.default.createElement("span", { className: "dockm-badge" }, "\u89C4\u5212\u4E2D") : null,
3766
- !isHome && mod.external ? import_react9.default.createElement("span", { className: "dockm-badge" }, "\u5916\u90E8\u5305" + (mod.package ? " \xB7 " + mod.package : "")) : null
6304
+ !isHome && mod.planned ? import_react10.default.createElement("span", { className: "dockm-badge" }, "\u89C4\u5212\u4E2D") : null,
6305
+ !isHome && mod.external ? import_react10.default.createElement("span", { className: "dockm-badge" }, "\u5916\u90E8\u5305" + (mod.package ? " \xB7 " + mod.package : "")) : null
3767
6306
  ),
3768
- import_react9.default.createElement(
6307
+ import_react10.default.createElement(
3769
6308
  "div",
3770
6309
  { className: "dockm-desc" },
3771
6310
  isHome ? "\u6240\u6709\u5B50\u529F\u80FD\u603B\u63FD\uFF1A\u8FD0\u884C\u72B6\u6001\u3001\u6982\u8981\u4E0E\u5FEB\u6377\u5F00\u5173\uFF0C\u70B9\u51FB\u5361\u7247\u8FDB\u5165\u5BF9\u5E94\u529F\u80FD\u9875\u3002" : mod.description
3772
6311
  )
3773
6312
  ),
3774
- isHome ? import_react9.default.createElement("div", { className: "dockm-view" }, import_react9.default.createElement(HomeView, { ctx: ctxRef.current, onOpen: setActive, onToggle: force })) : mod.planned ? import_react9.default.createElement("div", { className: "dockm-note" }, PLANNED_NOTES[mod.id] || "\u5F85\u63A5\u5165\uFF1A\u89C1 README \u8DEF\u7EBF\u56FE") : st && st.enabled && viewNode ? viewNode : st && st.error ? import_react9.default.createElement("div", { className: "dockm-note dockm-err" }, "\u529F\u80FD\u51FA\u9519\uFF1A" + st.error) : import_react9.default.createElement("div", { className: "dockm-note" }, "\u8BE5\u529F\u80FD\u5F53\u524D\u4E3A\u505C\u7528\u72B6\u6001\uFF08\u5F00\u5173\u5DF2\u6301\u4E45\u5316\uFF0C\u91CD\u542F\u540E\u4FDD\u6301\uFF09"),
3775
- import_react9.default.createElement(
6313
+ isHome ? import_react10.default.createElement("div", { className: "dockm-view" }, import_react10.default.createElement(HomeView, { ctx: ctxRef.current, onOpen: setActive, onToggle: force })) : mod.planned ? import_react10.default.createElement("div", { className: "dockm-note" }, PLANNED_NOTES[mod.id] || "\u5F85\u63A5\u5165\uFF1A\u89C1 README \u8DEF\u7EBF\u56FE") : st && st.enabled && viewNode ? viewNode : st && st.error ? import_react10.default.createElement("div", { className: "dockm-note dockm-err" }, "\u529F\u80FD\u51FA\u9519\uFF1A" + st.error) : import_react10.default.createElement("div", { className: "dockm-note" }, "\u8BE5\u529F\u80FD\u5F53\u524D\u4E3A\u505C\u7528\u72B6\u6001\uFF08\u5F00\u5173\u5DF2\u6301\u4E45\u5316\uFF0C\u91CD\u542F\u540E\u4FDD\u6301\uFF09"),
6314
+ import_react10.default.createElement(
3776
6315
  "div",
3777
6316
  { className: "dockm-foot" },
3778
- import_react9.default.createElement("span", null, isHome ? "\u529F\u80FD\u575E v" + DOCK_VERSION + " \xB7 \u5171 " + MODULES.length + " \u4E2A\u529F\u80FD\u6A21\u5757\uFF0C" + enabledCount + " \u4E2A\u5DF2\u542F\u7528" : "\u529F\u80FD\u575E v" + DOCK_VERSION + " \xB7 \u65B0\u529F\u80FD\u6309\u8DEF\u7EBF\u56FE\u8FFD\u52A0"),
3779
- !isHome && mod && !mod.planned && st ? import_react9.default.createElement(
6317
+ import_react10.default.createElement("span", null, isHome ? "\u529F\u80FD\u575E v" + DOCK_VERSION + " \xB7 \u5171 " + MODULES.length + " \u4E2A\u529F\u80FD\u6A21\u5757\uFF0C" + enabledCount + " \u4E2A\u5DF2\u542F\u7528" : "\u529F\u80FD\u575E v" + DOCK_VERSION + " \xB7 \u65B0\u529F\u80FD\u6309\u8DEF\u7EBF\u56FE\u8FFD\u52A0"),
6318
+ !isHome && mod && !mod.planned && st ? import_react10.default.createElement(
3780
6319
  "span",
3781
6320
  { className: "dockm-foot-sw" },
3782
- import_react9.default.createElement("span", { className: "dockm-foot-swlabel" + (st.enabled ? " on" : "") }, st.enabled ? "\u5DF2\u542F\u7528" : "\u5DF2\u505C\u7528"),
3783
- import_react9.default.createElement("button", {
6321
+ import_react10.default.createElement("span", { className: "dockm-foot-swlabel" + (st.enabled ? " on" : "") }, st.enabled ? "\u5DF2\u542F\u7528" : "\u5DF2\u505C\u7528"),
6322
+ import_react10.default.createElement("button", {
3784
6323
  type: "button",
3785
6324
  className: "dock-sw" + (st.enabled ? " on" : ""),
3786
6325
  role: "switch",
@@ -3793,11 +6332,11 @@ function DockModal() {
3793
6332
  }
3794
6333
  })
3795
6334
  ) : null,
3796
- !isHome && mod && typeof mod.Chip === "function" ? import_react9.default.createElement(
6335
+ !isHome && mod && typeof mod.Chip === "function" ? import_react10.default.createElement(
3797
6336
  "span",
3798
6337
  { className: "dockm-foot-sw" },
3799
- import_react9.default.createElement("span", { className: "dockm-foot-swlabel" + (chipShown(mod.id) ? " on" : "") }, "\u4F1A\u8BDD\u9875\u5C0F\u63A7\u4EF6"),
3800
- import_react9.default.createElement("button", {
6338
+ import_react10.default.createElement("span", { className: "dockm-foot-swlabel" + (chipShown(mod.id) ? " on" : "") }, "\u4F1A\u8BDD\u9875\u5C0F\u63A7\u4EF6"),
6339
+ import_react10.default.createElement("button", {
3801
6340
  type: "button",
3802
6341
  className: "dock-sw" + (chipShown(mod.id) ? " on" : ""),
3803
6342
  role: "switch",
@@ -3813,30 +6352,30 @@ function DockModal() {
3813
6352
  )
3814
6353
  )
3815
6354
  ),
3816
- win.mode === "normal" ? import_react9.default.createElement("div", { className: "dockm-resize", onPointerDown: (e) => beginDrag(e, "size") }) : null
6355
+ win.mode === "normal" ? import_react10.default.createElement("div", { className: "dockm-resize", onPointerDown: (e) => beginDrag(e, "size") }) : null
3817
6356
  )
3818
6357
  );
3819
6358
  }
3820
6359
  function HomeView(props) {
3821
6360
  const ctx = props && props.ctx;
3822
- const [, force] = import_react9.default.useReducer((n) => n + 1, 0);
6361
+ const [, force] = import_react10.default.useReducer((n) => n + 1, 0);
3823
6362
  useExternalVersion();
3824
6363
  const open = (id) => {
3825
6364
  if (props && typeof props.onOpen === "function") props.onOpen(id);
3826
6365
  };
3827
- return import_react9.default.createElement(
6366
+ return import_react10.default.createElement(
3828
6367
  "div",
3829
6368
  { className: "dockh-grid" },
3830
6369
  allModules().map((m) => {
3831
6370
  const st = stateOf(m.id);
3832
6371
  const enabled = !!(st && st.enabled);
3833
6372
  const Stat = m.HomeStat;
3834
- const statNode = m.planned ? import_react9.default.createElement("span", null, PLANNED_NOTES[m.id] || "\u5F85\u63A5\u5165\uFF1A\u89C1 README \u8DEF\u7EBF\u56FE") : enabled && Stat ? import_react9.default.createElement(
3835
- m.external ? FeatureBoundary : import_react9.default.Fragment,
6373
+ const statNode = m.planned ? import_react10.default.createElement("span", null, PLANNED_NOTES[m.id] || "\u5F85\u63A5\u5165\uFF1A\u89C1 README \u8DEF\u7EBF\u56FE") : enabled && Stat ? import_react10.default.createElement(
6374
+ m.external ? FeatureBoundary : import_react10.default.Fragment,
3836
6375
  null,
3837
- import_react9.default.createElement(Stat, { ctx })
3838
- ) : import_react9.default.createElement("span", null, "\u5DF2\u505C\u7528\uFF0C\u542F\u7528\u540E\u5728\u6B64\u5C55\u793A\u8FD0\u884C\u6982\u8981");
3839
- return import_react9.default.createElement(
6376
+ import_react10.default.createElement(Stat, { ctx })
6377
+ ) : import_react10.default.createElement("span", null, "\u5DF2\u505C\u7528\uFF0C\u542F\u7528\u540E\u5728\u6B64\u5C55\u793A\u8FD0\u884C\u6982\u8981");
6378
+ return import_react10.default.createElement(
3840
6379
  "div",
3841
6380
  {
3842
6381
  key: m.id,
@@ -3851,21 +6390,21 @@ function HomeView(props) {
3851
6390
  }
3852
6391
  }
3853
6392
  },
3854
- import_react9.default.createElement(
6393
+ import_react10.default.createElement(
3855
6394
  "div",
3856
6395
  { className: "dockh-head" },
3857
- import_react9.default.createElement("span", { className: "dockm-dot", style: { background: m.accent } }),
3858
- import_react9.default.createElement("span", { className: "dockh-name" }, m.name),
3859
- m.external ? import_react9.default.createElement("span", { className: "dockh-badge", title: m.package || void 0 }, "\u5916\u90E8") : null,
6396
+ import_react10.default.createElement("span", { className: "dockm-dot", style: { background: m.accent } }),
6397
+ import_react10.default.createElement("span", { className: "dockh-name" }, m.name),
6398
+ m.external ? import_react10.default.createElement("span", { className: "dockh-badge", title: m.package || void 0 }, "\u5916\u90E8") : null,
3860
6399
  // 状态标识:圆点 + 文字(纯展示,与开关视觉区分)
3861
- import_react9.default.createElement(
6400
+ import_react10.default.createElement(
3862
6401
  "span",
3863
6402
  { className: "dockh-status" + (m.planned ? " plan" : enabled ? "" : " off") },
3864
- import_react9.default.createElement("span", { className: "dockh-sdot" }),
3865
- import_react9.default.createElement("span", null, m.planned ? "\u89C4\u5212\u4E2D" : enabled ? "\u8FD0\u884C\u4E2D" : "\u5DF2\u505C\u7528")
6403
+ import_react10.default.createElement("span", { className: "dockh-sdot" }),
6404
+ import_react10.default.createElement("span", null, m.planned ? "\u89C4\u5212\u4E2D" : enabled ? "\u8FD0\u884C\u4E2D" : "\u5DF2\u505C\u7528")
3866
6405
  ),
3867
6406
  // 启停开关(规划中的功能不显示)
3868
- m.planned ? null : import_react9.default.createElement("button", {
6407
+ m.planned ? null : import_react10.default.createElement("button", {
3869
6408
  type: "button",
3870
6409
  className: "dock-sw" + (enabled ? " on" : ""),
3871
6410
  role: "switch",
@@ -3880,12 +6419,12 @@ function HomeView(props) {
3880
6419
  }
3881
6420
  })
3882
6421
  ),
3883
- import_react9.default.createElement("div", { className: "dockh-desc" }, m.description),
3884
- import_react9.default.createElement("div", { className: "dockh-stat" }, statNode),
3885
- import_react9.default.createElement(
6422
+ import_react10.default.createElement("div", { className: "dockh-desc" }, m.description),
6423
+ import_react10.default.createElement("div", { className: "dockh-stat" }, statNode),
6424
+ import_react10.default.createElement(
3886
6425
  "div",
3887
6426
  { className: "dockh-foot" },
3888
- import_react9.default.createElement("span", { className: "dockh-go" }, "\u67E5\u770B\u8BE6\u60C5 \u2192")
6427
+ import_react10.default.createElement("span", { className: "dockh-go" }, "\u67E5\u770B\u8BE6\u60C5 \u2192")
3889
6428
  )
3890
6429
  );
3891
6430
  })
@@ -3893,16 +6432,16 @@ function HomeView(props) {
3893
6432
  }
3894
6433
  function DockPanel() {
3895
6434
  const ctx = ctxRef.current;
3896
- const [, force] = import_react9.default.useReducer((n) => n + 1, 0);
6435
+ const [, force] = import_react10.default.useReducer((n) => n + 1, 0);
3897
6436
  useExternalVersion();
3898
6437
  const toggle = (id) => {
3899
6438
  toggleFeature(id);
3900
6439
  force();
3901
6440
  };
3902
- return import_react9.default.createElement(
6441
+ return import_react10.default.createElement(
3903
6442
  "div",
3904
6443
  { className: "dock-root" },
3905
- import_react9.default.createElement(
6444
+ import_react10.default.createElement(
3906
6445
  "div",
3907
6446
  { className: "dock-intro" },
3908
6447
  "\u529F\u80FD\u575E\uFF08dsh-dock\uFF09\xB7 \u6240\u6709\u5C0F\u529F\u80FD\u96C6\u4E2D\u5728\u8FD9\u4E00\u4E2A\u9762\u677F\u91CC\u7BA1\u7406\u3002v0.4.0 \u8D77\u6BCF\u4E2A\u529F\u80FD\u662F\u72EC\u7ACB\u6A21\u5757\uFF08features/<id>/\uFF09\uFF0C",
@@ -3911,25 +6450,25 @@ function DockPanel() {
3911
6450
  allModules().map((f) => {
3912
6451
  const st = stateOf(f.id);
3913
6452
  const View = f.View;
3914
- const viewNode = !f.planned && st.enabled && View ? import_react9.default.createElement(
6453
+ const viewNode = !f.planned && st.enabled && View ? import_react10.default.createElement(
3915
6454
  "div",
3916
6455
  { className: "dock-body" },
3917
- import_react9.default.createElement(
3918
- f.external ? FeatureBoundary : import_react9.default.Fragment,
6456
+ import_react10.default.createElement(
6457
+ f.external ? FeatureBoundary : import_react10.default.Fragment,
3919
6458
  null,
3920
- import_react9.default.createElement(View, { ctx, feature: f })
6459
+ import_react10.default.createElement(View, { ctx, feature: f })
3921
6460
  )
3922
6461
  ) : null;
3923
- return import_react9.default.createElement(
6462
+ return import_react10.default.createElement(
3924
6463
  "div",
3925
6464
  { className: "dock-card", key: f.id },
3926
- import_react9.default.createElement(
6465
+ import_react10.default.createElement(
3927
6466
  "div",
3928
6467
  { className: "dock-card-head" },
3929
- import_react9.default.createElement("span", { className: "dock-dot" + (st.error ? " err" : st.enabled ? " on" : "") }),
3930
- import_react9.default.createElement("span", { className: "dock-name" }, f.name),
3931
- import_react9.default.createElement("span", { className: "dock-desc" }, f.description + (f.external ? "\uFF08\u6765\u81EA\u5916\u90E8\u5305" + (f.package ? " " + f.package : "") + "\uFF09" : "")),
3932
- f.planned ? import_react9.default.createElement("span", { className: "dock-badge" }, "\u89C4\u5212\u4E2D") : import_react9.default.createElement("button", {
6468
+ import_react10.default.createElement("span", { className: "dock-dot" + (st.error ? " err" : st.enabled ? " on" : "") }),
6469
+ import_react10.default.createElement("span", { className: "dock-name" }, f.name),
6470
+ import_react10.default.createElement("span", { className: "dock-desc" }, f.description + (f.external ? "\uFF08\u6765\u81EA\u5916\u90E8\u5305" + (f.package ? " " + f.package : "") + "\uFF09" : "")),
6471
+ f.planned ? import_react10.default.createElement("span", { className: "dock-badge" }, "\u89C4\u5212\u4E2D") : import_react10.default.createElement("button", {
3933
6472
  type: "button",
3934
6473
  className: "dock-sw" + (st.enabled ? " on" : ""),
3935
6474
  role: "switch",
@@ -3938,11 +6477,11 @@ function DockPanel() {
3938
6477
  title: st.enabled ? "\u505C\u7528\u300C" + f.name + "\u300D" : "\u542F\u7528\u300C" + f.name + "\u300D",
3939
6478
  onClick: () => toggle(f.id)
3940
6479
  }),
3941
- !f.planned && typeof f.Chip === "function" ? import_react9.default.createElement(
6480
+ !f.planned && typeof f.Chip === "function" ? import_react10.default.createElement(
3942
6481
  "span",
3943
6482
  { className: "dockm-foot-sw" },
3944
- import_react9.default.createElement("span", { className: "dockm-foot-swlabel" + (chipShown(f.id) ? " on" : "") }, "\u4F1A\u8BDD\u9875\u5C0F\u63A7\u4EF6"),
3945
- import_react9.default.createElement("button", {
6483
+ import_react10.default.createElement("span", { className: "dockm-foot-swlabel" + (chipShown(f.id) ? " on" : "") }, "\u4F1A\u8BDD\u9875\u5C0F\u63A7\u4EF6"),
6484
+ import_react10.default.createElement("button", {
3946
6485
  type: "button",
3947
6486
  className: "dock-sw" + (chipShown(f.id) ? " on" : ""),
3948
6487
  role: "switch",
@@ -3956,19 +6495,19 @@ function DockPanel() {
3956
6495
  })
3957
6496
  ) : null
3958
6497
  ),
3959
- f.planned ? import_react9.default.createElement("div", { className: "dock-body" }, PLANNED_NOTES[f.id] || "\u5F85\u63A5\u5165\uFF1A\u89C1 README \u8DEF\u7EBF\u56FE") : st.error ? import_react9.default.createElement("div", { className: "dock-body dockm-err" }, "\u529F\u80FD\u51FA\u9519\uFF1A" + st.error) : null,
6498
+ f.planned ? import_react10.default.createElement("div", { className: "dock-body" }, PLANNED_NOTES[f.id] || "\u5F85\u63A5\u5165\uFF1A\u89C1 README \u8DEF\u7EBF\u56FE") : st.error ? import_react10.default.createElement("div", { className: "dock-body dockm-err" }, "\u529F\u80FD\u51FA\u9519\uFF1A" + st.error) : null,
3960
6499
  viewNode
3961
6500
  );
3962
6501
  })
3963
6502
  );
3964
6503
  }
3965
6504
  function DockChips(props) {
3966
- const [, force] = import_react9.default.useReducer((n) => n + 1, 0);
3967
- import_react9.default.useEffect(() => subscribeFeatureState(() => force()), []);
6505
+ const [, force] = import_react10.default.useReducer((n) => n + 1, 0);
6506
+ import_react10.default.useEffect(() => subscribeFeatureState(() => force()), []);
3968
6507
  const items = [];
3969
6508
  for (const f of allModules()) {
3970
6509
  if (f.planned || !stateOf(f.id).enabled || !chipShown(f.id) || typeof f.Chip !== "function") continue;
3971
- items.push(import_react9.default.createElement(f.Chip, {
6510
+ items.push(import_react10.default.createElement(f.Chip, {
3972
6511
  key: f.id,
3973
6512
  ctx: props.ctx,
3974
6513
  feature: f,
@@ -3978,23 +6517,23 @@ function DockChips(props) {
3978
6517
  }));
3979
6518
  }
3980
6519
  if (items.length === 0) return null;
3981
- return import_react9.default.createElement("div", { className: "dockchip-row" }, items);
6520
+ return import_react10.default.createElement("div", { className: "dockchip-row" }, items);
3982
6521
  }
3983
6522
  function FeatureOverlays() {
3984
- const [, force] = import_react9.default.useReducer((n) => n + 1, 0);
6523
+ const [, force] = import_react10.default.useReducer((n) => n + 1, 0);
3985
6524
  useExternalVersion();
3986
- import_react9.default.useEffect(() => subscribeFeatureState(() => force()), []);
6525
+ import_react10.default.useEffect(() => subscribeFeatureState(() => force()), []);
3987
6526
  const items = [];
3988
6527
  for (const f of allModules()) {
3989
6528
  if (f.planned || !stateOf(f.id).enabled || typeof f.Overlay !== "function") continue;
3990
- items.push(import_react9.default.createElement(
6529
+ items.push(import_react10.default.createElement(
3991
6530
  FeatureBoundary,
3992
6531
  { key: f.id },
3993
- import_react9.default.createElement(f.Overlay, { ctx: ctxRef.current, feature: f })
6532
+ import_react10.default.createElement(f.Overlay, { ctx: ctxRef.current, feature: f })
3994
6533
  ));
3995
6534
  }
3996
6535
  if (items.length === 0) return null;
3997
- return import_react9.default.createElement(import_react9.default.Fragment, null, items);
6536
+ return import_react10.default.createElement(import_react10.default.Fragment, null, items);
3998
6537
  }
3999
6538
  var ctxRef = { current: null };
4000
6539
  function apply(ctx) {
@@ -4005,24 +6544,38 @@ function apply(ctx) {
4005
6544
  if (slots === void 0) return;
4006
6545
  slots.inject("sidebar.footer.action", () => slots.register(
4007
6546
  { name: "sidebar.footer.action", id: "dsh-dock", order: 1, label: "\u529F\u80FD\u575E" },
4008
- (props) => import_react9.default.createElement(DockEntry, props)
6547
+ (props) => import_react10.default.createElement(DockEntry, props)
4009
6548
  ));
4010
6549
  slots.inject("shell.overlay", () => slots.register(
4011
6550
  { name: "shell.overlay", id: "dsh-dock-panel", order: 21, label: "\u529F\u80FD\u575E\u9762\u677F" },
4012
- () => import_react9.default.createElement(DockModal, null)
6551
+ () => import_react10.default.createElement(DockModal, null)
4013
6552
  ));
4014
6553
  slots.inject("shell.overlay", () => slots.register(
4015
6554
  { name: "shell.overlay", id: "dsh-dock-feature-overlays", order: 22, label: "\u529F\u80FD\u575E\u5168\u5C40\u6D6E\u5C42" },
4016
- () => import_react9.default.createElement(FeatureOverlays, null)
6555
+ () => import_react10.default.createElement(FeatureOverlays, null)
4017
6556
  ));
4018
6557
  slots.inject("settings.section", () => slots.register(
4019
6558
  { name: "settings.section", id: "dsh-dock", order: 90, label: "\u529F\u80FD\u575E" },
4020
- () => import_react9.default.createElement(DockPanel, null)
6559
+ () => import_react10.default.createElement(DockPanel, null)
4021
6560
  ));
4022
6561
  slots.inject("conversation.input.left", () => slots.register(
4023
6562
  { name: "conversation.input.left", id: "dsh-dock-chips", order: 10, label: "\u529F\u80FD\u575E" },
4024
- (zone) => import_react9.default.createElement(DockChips, Object.assign({}, zone, { ctx: ctxRef.current }))
6563
+ (zone) => import_react10.default.createElement(DockChips, Object.assign({}, zone, { ctx: ctxRef.current }))
4025
6564
  ));
6565
+ try {
6566
+ if (typeof window !== "undefined") {
6567
+ const match = window.location.hash.match(/(?:^#|&)dsh-mobile-relay=([^&]+)/);
6568
+ if (match) {
6569
+ const launch = decodeURIComponent(match[1]);
6570
+ if (/^[A-Za-z0-9_-]+\.[A-F0-9]{10}$/i.test(launch)) {
6571
+ sessionStorage.setItem("dsh-dock/mobile-relay/launch/v1", launch);
6572
+ window.history.replaceState(null, "", window.location.pathname + window.location.search);
6573
+ setTimeout(() => openPanel("mobile-relay"), 0);
6574
+ }
6575
+ }
6576
+ }
6577
+ } catch {
6578
+ }
4026
6579
  }
4027
6580
  var inject = ["timer"];
4028
6581