dsh-dock 0.7.0 → 0.7.1

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,2112 +11,27 @@ 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
- };
21
- var __export = (target, all) => {
22
- for (var name in all)
23
- __defProp(target, name, { get: all[name], enumerable: true });
24
- };
25
- var __copyProps = (to, from, except, desc) => {
26
- if (from && typeof from === "object" || typeof from === "function") {
27
- for (let key of __getOwnPropNames(from))
28
- if (!__hasOwnProp.call(to, key) && key !== except)
29
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
30
- }
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
- });
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
2118
23
  }
2119
- });
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);
2120
35
 
2121
36
  // src/client.jsx
2122
37
  var client_exports = {};
@@ -2126,7 +41,7 @@ __export(client_exports, {
2126
41
  inject: () => inject
2127
42
  });
2128
43
  module.exports = __toCommonJS(client_exports);
2129
- var import_react10 = __toESM(require("react"), 1);
44
+ var import_react9 = __toESM(require("react"), 1);
2130
45
 
2131
46
  // src/shared.js
2132
47
  var import_react = __toESM(require("react"), 1);
@@ -2280,12 +195,6 @@ function fmtCompact(n) {
2280
195
  if (n >= 1e3) return (n / 1e3).toFixed(1) + "K";
2281
196
  return String(Math.round(n));
2282
197
  }
2283
- function fmtCost(n) {
2284
- const v = Number(n) || 0;
2285
- if (v >= 10) return "$" + v.toFixed(2);
2286
- if (v >= 0.01) return "$" + v.toFixed(4);
2287
- return "$" + v.toFixed(6);
2288
- }
2289
198
  function fmtCostCny(usd, rate) {
2290
199
  const v = (Number(usd) || 0) * (Number(rate) > 0 ? Number(rate) : 7.2);
2291
200
  if (v >= 1e4) return "\xA5" + (v / 1e4).toFixed(2) + "\u4E07";
@@ -2408,7 +317,7 @@ function Detail({ rec, onClose, rate }) {
2408
317
  ["\u8BA1\u8D39\u8F93\u5165", fmtNum(rec.billedInput)],
2409
318
  ["\u7F13\u5B58\u547D\u4E2D\u7387", rec.cacheHitPercent + "%"],
2410
319
  ["\u603B Token", fmtNum(rec.totalTokens)],
2411
- ["\u6D88\u8017\u91D1\u989D(\u4F30\u7B97)", fmtCost(rec.cost) + " \u2248 " + fmtCostCny(rec.cost, rateCny)],
320
+ ["\u6D88\u8017\u91D1\u989D(\u4F30\u7B97)", fmtCostCny(rec.cost, rateCny)],
2412
321
  ["\u63A8\u7406\u5F3A\u5EA6", rec.effort || "\u2014"],
2413
322
  ["\u8017\u65F6", fmtDuration(rec.llmMs)],
2414
323
  ["Turn / Step", rec.turn + " / " + rec.step]
@@ -2574,8 +483,7 @@ function TokenLogView(props) {
2574
483
  { v: fmtCompact(totals.cacheReadTokens), l: "\u7F13\u5B58\u547D\u4E2D" },
2575
484
  { v: totals.cacheHitPct + "%", l: "\u7F13\u5B58\u547D\u4E2D\u7387" },
2576
485
  { v: fmtCompact(totals.outputTokens), l: "\u8F93\u51FA" },
2577
- { v: fmtCost(totals.cost), l: "\u6D88\u8017\u91D1\u989D(\u4F30\u7B97)" },
2578
- { v: fmtCostCny(totals.cost, rateCny), l: "\u6D88\u8017\u91D1\u989D(\xA5)" },
486
+ { v: fmtCostCny(totals.cost, rateCny), l: "\u6D88\u8017\u91D1\u989D(\u4F30\u7B97\xB7\u4EBA\u6C11\u5E01)" },
2579
487
  { v: fmtDuration(totals.llmMs), l: "\u7D2F\u8BA1\u8017\u65F6" + (totals.timed ? " (" + totals.timed + "\u6B65)" : "") }
2580
488
  ] : [];
2581
489
  const opts = (arr) => (arr || []).map((x) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: x, children: x || "(\u7A7A)" }, x || "(none)"));
@@ -2588,7 +496,6 @@ function TokenLogView(props) {
2588
496
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: r.cacheHitPct + "%" }),
2589
497
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtCompact(r.outputTokens) }),
2590
498
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtCompact(r.totalTokens) }),
2591
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtCost(r.cost) }),
2592
499
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtCostCny(r.cost, rateCny) }),
2593
500
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtDuration(r.llmMs) })
2594
501
  ] }, r.key));
@@ -2612,7 +519,6 @@ function TokenLogView(props) {
2612
519
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtNum(r.outputTokens) }),
2613
520
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtNum(r.reasoningTokens) }),
2614
521
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtNum(r.totalTokens) }),
2615
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtCost(r.cost) }),
2616
522
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtCostCny(r.cost, rateCny) }),
2617
523
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: r.effort || "\u2014" }),
2618
524
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { children: [
@@ -2650,8 +556,7 @@ function TokenLogView(props) {
2650
556
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "\u547D\u4E2D\u7387" }),
2651
557
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "\u8F93\u51FA" }),
2652
558
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "\u603BToken" }),
2653
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "\u91D1\u989D" }),
2654
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "\u91D1\u989D(\xA5)" }),
559
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "\u91D1\u989D\uFF08\u4EBA\u6C11\u5E01\uFF09" }),
2655
560
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "\u8017\u65F6" })
2656
561
  ] }) }),
2657
562
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: summaryRows })
@@ -2695,8 +600,7 @@ function TokenLogView(props) {
2695
600
  sortTh("\u8F93\u51FA", "outputTokens"),
2696
601
  sortTh("\u63A8\u7406", "reasoningTokens"),
2697
602
  sortTh("\u603B\u989D", "totalTokens"),
2698
- sortTh("\u91D1\u989D", "cost"),
2699
- sortTh("\u91D1\u989D(\xA5)", "cost"),
603
+ sortTh("\u91D1\u989D\uFF08\u4EBA\u6C11\u5E01\uFF09", "cost"),
2700
604
  sortTh("\u5F3A\u5EA6", "effort"),
2701
605
  sortTh("\u72B6\u6001", "status"),
2702
606
  sortTh("\u8017\u65F6", "llmMs")
@@ -2781,22 +685,19 @@ function TokenLogHomeStat() {
2781
685
  " \u6B21\u8C03\u7528 \xB7 ",
2782
686
  fmtCompact(t.totalTokens),
2783
687
  " Token \xB7 ",
2784
- fmtCost(t.cost),
2785
- "\uFF08",
2786
- fmtCostCny(t.cost, snap.rate),
2787
- "\uFF09"
688
+ fmtCostCny(t.cost, snap.rate)
2788
689
  ] });
2789
690
  }
2790
691
  function TokenLogChip(props) {
2791
692
  const sid = props && props.sessionId || props && props.session && props.session.sessionId || null;
2792
- const [snap, setSnap] = (0, import_react2.useState)({ totals: null, err: "" });
693
+ const [snap, setSnap] = (0, import_react2.useState)({ totals: null, rate: 7.2, err: "" });
2793
694
  (0, import_react2.useEffect)(() => {
2794
695
  if (!sid) return;
2795
696
  let cancel = false;
2796
697
  const load = () => rpcCall("query", { sessionId: sid }).then((d) => {
2797
- if (!cancel) setSnap({ totals: d && d.totals, err: "" });
698
+ if (!cancel) setSnap({ totals: d && d.totals, rate: d && d.rateUsdCny || 7.2, err: "" });
2798
699
  }).catch((e) => {
2799
- if (!cancel) setSnap((s) => ({ totals: s.totals, err: String(e && e.message || e) }));
700
+ if (!cancel) setSnap((s) => ({ totals: s.totals, rate: s.rate, err: String(e && e.message || e) }));
2800
701
  });
2801
702
  load();
2802
703
  const timer = setInterval(load, 1e4);
@@ -2807,8 +708,8 @@ function TokenLogChip(props) {
2807
708
  }, [sid]);
2808
709
  if (!sid) return null;
2809
710
  const t = snap.totals;
2810
- const label = snap.err && !t ? snap.err.includes("\u91CD\u542F") ? "\u7528\u91CF\xB7\u9700\u91CD\u542F\u5BBF\u4E3B" : "\u7528\u91CF\xB7\u5931\u8D25" : t ? "\u26C1 " + fmtCompact(t.totalTokens) + (t.cost > 0 ? " \xB7 $" + t.cost.toFixed(2) : "") : "\u26C1 \u2026";
2811
- const title = t ? "\u672C\u4F1A\u8BDD " + fmtNum(t.calls) + " \u6B21\u8C03\u7528 \xB7 " + fmtNum(t.totalTokens) + " Token \xB7 " + fmtCost(t.cost) + "\uFF08\u4F30\u7B97\uFF09\n\u70B9\u51FB\u5728\u529F\u80FD\u575E\u67E5\u770B\u7528\u91CF\u8BB0\u5F55" : (snap.err ? snap.err + "\n" : "") + "\u70B9\u51FB\u5728\u529F\u80FD\u575E\u67E5\u770B\u7528\u91CF\u8BB0\u5F55";
711
+ const label = snap.err && !t ? snap.err.includes("\u91CD\u542F") ? "\u7528\u91CF\xB7\u9700\u91CD\u542F\u5BBF\u4E3B" : "\u7528\u91CF\xB7\u5931\u8D25" : t ? "\u26C1 " + fmtCompact(t.totalTokens) + (t.cost > 0 ? " \xB7 " + fmtCostCny(t.cost, snap.rate) : "") : "\u26C1 \u2026";
712
+ const title = t ? "\u672C\u4F1A\u8BDD " + fmtNum(t.calls) + " \u6B21\u8C03\u7528 \xB7 " + fmtNum(t.totalTokens) + " Token \xB7 " + fmtCostCny(t.cost, snap.rate) + "\uFF08\u4F30\u7B97\uFF09\n\u70B9\u51FB\u5728\u529F\u80FD\u575E\u67E5\u770B\u7528\u91CF\u8BB0\u5F55" : (snap.err ? snap.err + "\n" : "") + "\u70B9\u51FB\u5728\u529F\u80FD\u575E\u67E5\u770B\u7528\u91CF\u8BB0\u5F55";
2812
713
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
2813
714
  "button",
2814
715
  {
@@ -3482,6 +1383,7 @@ var CURATED_ACCENTS = {
3482
1383
  var C_GRANTED = "#22d3ee";
3483
1384
  var C_TOPUP = "#fbbf24";
3484
1385
  var C_ERR = "#f87171";
1386
+ var USD_CNY_RATE = 7.2;
3485
1387
  function accentOf(id) {
3486
1388
  if (CURATED_ACCENTS[id]) return CURATED_ACCENTS[id];
3487
1389
  let h = 0;
@@ -3490,6 +1392,22 @@ function accentOf(id) {
3490
1392
  return ACCENT_PALETTE[h % ACCENT_PALETTE.length];
3491
1393
  }
3492
1394
  var fmt = (v) => v == null || v === "" ? "\u2014" : String(v);
1395
+ function cnyBalanceInfo(info) {
1396
+ if (!info) return info;
1397
+ if (info.currency === "CNY") return Object.assign({}, info, { currency: "\u4EBA\u6C11\u5E01" });
1398
+ if (info.currency !== "USD") return info;
1399
+ const convert = (value) => {
1400
+ if (value == null) return value;
1401
+ const n = Number(value);
1402
+ return Number.isFinite(n) ? n * USD_CNY_RATE : value;
1403
+ };
1404
+ return Object.assign({}, info, {
1405
+ currency: "\u4EBA\u6C11\u5E01\uFF08\u4F30\u7B97\uFF09",
1406
+ totalBalance: convert(info.totalBalance),
1407
+ grantedBalance: convert(info.grantedBalance),
1408
+ toppedUpBalance: convert(info.toppedUpBalance)
1409
+ });
1410
+ }
3493
1411
  var balanceStore = {
3494
1412
  snap: { data: null, loading: false, error: null },
3495
1413
  listeners: /* @__PURE__ */ new Set(),
@@ -3605,18 +1523,21 @@ function BalanceView(props) {
3605
1523
  balBody = import_react7.default.createElement(
3606
1524
  "div",
3607
1525
  { className: "dkb-mains" },
3608
- infos.map((i, idx) => import_react7.default.createElement(
3609
- "div",
3610
- { key: idx, className: "dkb-main" },
3611
- import_react7.default.createElement("span", { className: "dkb-main-label", style: { color: accent } }, i.currency),
3612
- import_react7.default.createElement("span", { className: "dkb-main-value" }, fmt(i.totalBalance)),
3613
- import_react7.default.createElement(
3614
- "span",
3615
- { className: "dkb-main-parts" },
3616
- i.grantedBalance != null ? import_react7.default.createElement("span", { className: "dkb-main-part", style: { color: C_GRANTED } }, "\u8D60\u9001 " + fmt(i.grantedBalance)) : null,
3617
- i.toppedUpBalance != null ? import_react7.default.createElement("span", { className: "dkb-main-part", style: { color: C_TOPUP } }, "\u5145\u503C " + fmt(i.toppedUpBalance)) : null
3618
- )
3619
- ))
1526
+ infos.map((rawInfo, idx) => {
1527
+ const i = cnyBalanceInfo(rawInfo);
1528
+ return import_react7.default.createElement(
1529
+ "div",
1530
+ { key: idx, className: "dkb-main" },
1531
+ import_react7.default.createElement("span", { className: "dkb-main-label", style: { color: accent } }, i.currency),
1532
+ import_react7.default.createElement("span", { className: "dkb-main-value" }, fmt(i.totalBalance)),
1533
+ import_react7.default.createElement(
1534
+ "span",
1535
+ { className: "dkb-main-parts" },
1536
+ i.grantedBalance != null ? import_react7.default.createElement("span", { className: "dkb-main-part", style: { color: C_GRANTED } }, "\u8D60\u9001 " + fmt(i.grantedBalance)) : null,
1537
+ i.toppedUpBalance != null ? import_react7.default.createElement("span", { className: "dkb-main-part", style: { color: C_TOPUP } }, "\u5145\u503C " + fmt(i.toppedUpBalance)) : null
1538
+ )
1539
+ );
1540
+ })
3620
1541
  );
3621
1542
  } else if (b && b.status === "login-required" && b.consoleUrl) {
3622
1543
  balBody = import_react7.default.createElement(
@@ -3734,9 +1655,9 @@ function chipBalanceText(p) {
3734
1655
  const s2 = Number.isFinite(v2) ? v2 >= 1e4 ? (v2 / 1e4).toFixed(1) + "\u4E07" : String(Math.round(v2)) : fmt(b.remaining);
3735
1656
  return "\u4F59\u989D \u5269 " + s2 + (b.unit ? " " + b.unit : "");
3736
1657
  }
3737
- const info = Array.isArray(b.infos) && b.infos[0] ? b.infos[0] : null;
1658
+ const info = cnyBalanceInfo(Array.isArray(b.infos) && b.infos[0] ? b.infos[0] : null);
3738
1659
  if (!info) return "\u4F59\u989D \u2026";
3739
- const cur = info.currency === "USD" ? "$" : "\xA5";
1660
+ const cur = info.currency === "CNY" || info.currency === "\u4EBA\u6C11\u5E01\uFF08\u4F30\u7B97\uFF09" ? "\xA5" : "";
3740
1661
  const v = Number(info.totalBalance);
3741
1662
  const s = Number.isFinite(v) ? v >= 1e4 ? (v / 1e4).toFixed(2) + "\u4E07" : String(Math.round(v * 100) / 100) : fmt(info.totalBalance);
3742
1663
  return "\u4F59\u989D " + cur + s;
@@ -3848,8 +1769,20 @@ var EFFECT_MODES = [
3848
1769
  { id: "robot", name: "\u684C\u9762\u4F19\u4F34", desc: "\u771F\u4EBA\u5316\u53CC\u5DE5\u4F4D\uFF1A\u67E5\u8D44\u6599\u770B\u5DE6\u5C4F\u3001\u5199\u5165/\u6539\u4EE3\u7801\u79FB\u5230\u53F3\u5C4F\uFF1B\u5EA7\u6905\u548C\u8F6C\u5934\u968F\u5B9E\u65F6\u4EFB\u52A1\u8282\u594F\u52A0\u901F" },
3849
1770
  { id: "matrix", name: "\u4EE3\u7801\u96E8", desc: "\u5B57\u7B26\u6CBF\u5C4F\u5E55\u7F13\u843D\u5982\u6570\u636E\u6D41\uFF0C\u901F\u5EA6\u968F\u4EFB\u52A1\u541E\u5410\uFF0C\u514B\u5236\u7684\u4F4E\u900F\u660E\u5EA6" },
3850
1771
  { id: "stars", name: "\u661F\u91CE", desc: "\u7EC6\u788E\u661F\u70B9\u7F13\u6162\u98D8\u79FB\u95EA\u70C1\uFF0C\u5B89\u9759\u8010\u770B\u7684\u80CC\u666F\u6C1B\u56F4" },
3851
- { id: "aurora", name: "\u6781\u5149", desc: "\u5C4F\u5E55\u9876\u90E8\u67D4\u5149\u5E26\u7F13\u6162\u547C\u5438\u6D41\u52A8\uFF0C\u50CF\u6781\u5149\u62C2\u8FC7" }
1772
+ { id: "aurora", name: "\u6781\u5149", desc: "\u5C4F\u5E55\u9876\u90E8\u67D4\u5149\u5E26\u7F13\u6162\u547C\u5438\u6D41\u52A8\uFF0C\u50CF\u6781\u5149\u62C2\u8FC7" },
1773
+ { id: "space", name: "\u661F\u9645\u8FDC\u5F81", desc: "\u4EFB\u52A1\u4E2D\u661F\u7403\u4E0E\u98DE\u8239\u5DE1\u822A\uFF1B\u5B8C\u6210\u540E\u8D27\u8FD0\u65D7\u8230\u643A\u5B9E\u9645\u8F93\u51FA\u91CF\u505C\u9760\u8F93\u5165\u6846" },
1774
+ { id: "nebula", name: "\u661F\u4E91\u6F6E\u6C50", desc: "\u56DB\u56E2\u5F69\u8272\u661F\u4E91\u5728\u5C4F\u5E55\u8FB9\u7F18\u7F13\u6162\u6F6E\u6C50\uFF0C\u9636\u6BB5\u8272\u968F\u4EFB\u52A1\u6539\u53D8" },
1775
+ { id: "warp", name: "\u66F2\u901F\u822A\u9053", desc: "\u5149\u675F\u4ECE\u5C4F\u5E55\u4E2D\u5FC3\u5411\u5916\u62C9\u4F38\uFF0C\u541E\u5410\u8D8A\u9AD8\u66F2\u901F\u8D8A\u5FEB" },
1776
+ { id: "radar", name: "\u91CF\u5B50\u96F7\u8FBE", desc: "\u4E09\u5EA7\u8FB9\u7F18\u96F7\u8FBE\u6301\u7EED\u626B\u63CF\uFF0C\u4EFB\u52A1\u6D3B\u52A8\u5316\u4F5C\u8DF3\u52A8\u4FE1\u6807" },
1777
+ { id: "constellation", name: "\u661F\u5EA7\u7F51\u7EDC", desc: "\u8282\u70B9\u4E0E\u8FDE\u7EBF\u9010\u6BB5\u70B9\u4EAE\uFF0C\u50CF\u4EFB\u52A1\u77E5\u8BC6\u56FE\u8C31\u5728\u751F\u957F" },
1778
+ { id: "fireflies", name: "\u6570\u636E\u8424\u706B", desc: "\u8F7B\u76C8\u5149\u70B9\u5728\u7A7A\u767D\u533A\u6E38\u5F0B\uFF0C\u6D3B\u8DC3\u9636\u6BB5\u4F1A\u66F4\u660E\u4EAE" },
1779
+ { id: "ocean", name: "\u6DF1\u6D77\u8109\u52A8", desc: "\u4F4E\u900F\u660E\u5EA6\u6CE2\u5C42\u4E0E\u6C14\u6CE1\u7F13\u6162\u4E0A\u6D6E\uFF0C\u5B89\u9759\u4F46\u5BCC\u6709\u751F\u547D\u611F" },
1780
+ { id: "prism", name: "\u68F1\u955C\u5149\u8C31", desc: "\u5F69\u8272\u5149\u675F\u4ECE\u5C4F\u5E55\u8FB9\u7F18\u6298\u5C04\u7A7F\u884C\uFF0C\u5F62\u6210\u514B\u5236\u7684\u73BB\u7483\u5149\u611F" },
1781
+ { id: "circuit", name: "\u795E\u7ECF\u7535\u8DEF", desc: "\u7535\u8DEF\u8DEF\u5F84\u4F9D\u6B21\u901A\u7535\uFF0C\u8109\u51B2\u901F\u5EA6\u8DDF\u968F\u4EE3\u7801\u4E0E\u5DE5\u5177\u6D3B\u52A8" },
1782
+ { id: "gravity", name: "\u5F15\u529B\u6D9F\u6F2A", desc: "\u591A\u4E2A\u5F15\u529B\u6E90\u5411\u5916\u6269\u6563\u6CE2\u7EB9\uFF0C\u4EFB\u52A1\u8D8A\u5FEB\u6D9F\u6F2A\u8D8A\u7D27\u5BC6" },
1783
+ { id: "lantern", name: "\u7075\u611F\u5929\u706F", desc: "\u5FAE\u578B\u7075\u611F\u706F\u4ECE\u5C4F\u5E55\u5E95\u90E8\u7F13\u6162\u5347\u8D77\uFF0C\u7559\u4E0B\u6E29\u6696\u5149\u8FF9" }
3852
1784
  ];
1785
+ var AMBIENT_EFFECT_MODES = /* @__PURE__ */ new Set(["matrix", "stars", "aurora", "space", "nebula", "warp", "radar", "constellation", "fireflies", "ocean", "prism", "circuit", "gravity", "lantern"]);
3853
1786
  var PHASE_LABELS = { think: "\u601D\u8003\u4E2D", write: "\u8F93\u51FA\u4E2D", code: "\u7F16\u5199\u4EE3\u7801", search: "\u67E5\u8D44\u6599" };
3854
1787
  function phaseLabel(p) {
3855
1788
  return PHASE_LABELS[p] || "\u5DE5\u4F5C\u4E2D";
@@ -4187,29 +2120,69 @@ var MATRIX_CHARS = "01</>;{}=+*#";
4187
2120
  function AmbientLayer(props) {
4188
2121
  const mode = props.mode;
4189
2122
  const speed = props.speed;
4190
- const matrix = (0, import_react8.useMemo)(() => makeBits(34, () => ({
4191
- l: Math.random() * 100,
4192
- d: 4 + Math.random() * 6,
4193
- delay: -Math.random() * 8,
4194
- o: 0.28 + Math.random() * 0.34,
4195
- s: 11 + Math.round(Math.random() * 4),
4196
- c: MATRIX_CHARS[Math.floor(Math.random() * MATRIX_CHARS.length)] + MATRIX_CHARS[Math.floor(Math.random() * MATRIX_CHARS.length)] + MATRIX_CHARS[Math.floor(Math.random() * MATRIX_CHARS.length)]
4197
- })), []);
4198
- const stars = (0, import_react8.useMemo)(() => makeBits(80, () => ({
4199
- l: Math.random() * 100,
4200
- t: Math.random() * 100,
4201
- sz: 1.5 + Math.random() * 2,
4202
- d: 2 + Math.random() * 4,
4203
- delay: -Math.random() * 6,
4204
- dx: (Math.random() - 0.5) * 40,
4205
- dy: (Math.random() - 0.5) * 24
4206
- })), []);
2123
+ const particles = (0, import_react8.useMemo)(() => {
2124
+ if (mode === "matrix") return { matrix: makeBits(34, () => ({
2125
+ l: Math.random() * 100,
2126
+ d: 4 + Math.random() * 6,
2127
+ delay: -Math.random() * 8,
2128
+ o: 0.28 + Math.random() * 0.34,
2129
+ s: 11 + Math.round(Math.random() * 4),
2130
+ c: MATRIX_CHARS[Math.floor(Math.random() * MATRIX_CHARS.length)] + MATRIX_CHARS[Math.floor(Math.random() * MATRIX_CHARS.length)] + MATRIX_CHARS[Math.floor(Math.random() * MATRIX_CHARS.length)]
2131
+ })) };
2132
+ if (mode === "stars") return { stars: makeBits(80, () => ({
2133
+ l: Math.random() * 100,
2134
+ t: Math.random() * 100,
2135
+ sz: 1.5 + Math.random() * 2,
2136
+ d: 2 + Math.random() * 4,
2137
+ delay: -Math.random() * 6,
2138
+ dx: (Math.random() - 0.5) * 40,
2139
+ dy: (Math.random() - 0.5) * 24
2140
+ })) };
2141
+ if (mode === "space") return { dust: makeBits(22, () => ({
2142
+ l: Math.random() * 100,
2143
+ t: Math.random() * 82,
2144
+ sz: 1 + Math.random() * 2.2,
2145
+ d: 2.4 + Math.random() * 3.8,
2146
+ delay: -Math.random() * 6
2147
+ })) };
2148
+ if (mode === "warp") return { warp: makeBits(28, () => ({
2149
+ a: Math.random() * 360,
2150
+ len: 54 + Math.random() * 130,
2151
+ d: 1.8 + Math.random() * 2.4,
2152
+ delay: -Math.random() * 4
2153
+ })) };
2154
+ if (mode === "fireflies") return { fireflies: makeBits(28, () => ({
2155
+ l: 4 + Math.random() * 92,
2156
+ t: 8 + Math.random() * 78,
2157
+ sz: 3 + Math.random() * 5,
2158
+ dx: -42 + Math.random() * 84,
2159
+ dy: -32 + Math.random() * 64,
2160
+ d: 4.8 + Math.random() * 5.4,
2161
+ delay: -Math.random() * 8
2162
+ })) };
2163
+ if (mode === "ocean") return { bubbles: makeBits(18, () => ({
2164
+ l: 3 + Math.random() * 94,
2165
+ sz: 4 + Math.random() * 12,
2166
+ d: 5 + Math.random() * 6,
2167
+ delay: -Math.random() * 9,
2168
+ drift: -34 + Math.random() * 68
2169
+ })) };
2170
+ if (mode === "lantern") return { lanterns: makeBits(18, () => ({
2171
+ l: 4 + Math.random() * 92,
2172
+ sz: 8 + Math.random() * 9,
2173
+ d: 7 + Math.random() * 7,
2174
+ delay: -Math.random() * 12,
2175
+ drift: -48 + Math.random() * 96
2176
+ })) };
2177
+ return {};
2178
+ }, [mode]);
2179
+ const ambientStyle = { "--dkan-speed": speed, "--dkan-phase": phaseColor(props.phase) };
4207
2180
  if (mode === "matrix") {
4208
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dkan-amb dkan-matrix", style: { "--dkan-speed": speed }, "aria-hidden": "true", children: matrix.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { left: p.l + "%", animationDuration: "calc(" + p.d + "s / var(--dkan-speed,1))", animationDelay: p.delay + "s", opacity: p.o, fontSize: p.s }, children: p.c }, i)) });
2181
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dkan-amb dkan-matrix", style: { "--dkan-speed": speed }, "aria-hidden": "true", children: particles.matrix.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { left: p.l + "%", animationDuration: "calc(" + p.d + "s / var(--dkan-speed,1))", animationDelay: p.delay + "s", opacity: p.o, fontSize: p.s }, children: p.c }, i)) });
4209
2182
  }
4210
2183
  if (mode === "stars") {
4211
2184
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dkan-amb dkan-stars", style: { "--dkan-speed": speed }, "aria-hidden": "true", children: [
4212
- stars.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", { className: "dkan-star", style: { left: p.l + "%", top: p.t + "%", width: p.sz, height: p.sz, animationDuration: "calc(" + p.d + "s / var(--dkan-speed,1))", animationDelay: p.delay + "s", "--dx": p.dx + "px", "--dy": p.dy + "px" } }, i)),
2185
+ particles.stars.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", { className: "dkan-star", style: { left: p.l + "%", top: p.t + "%", width: p.sz, height: p.sz, animationDuration: "calc(" + p.d + "s / var(--dkan-speed,1))", animationDelay: p.delay + "s", "--dx": p.dx + "px", "--dy": p.dy + "px" } }, i)),
4213
2186
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dkan-moon" }),
4214
2187
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", { className: "dkan-meteor", style: { top: "12%", left: "72%", animationDelay: "0s" } }),
4215
2188
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", { className: "dkan-meteor", style: { top: "28%", left: "88%", animationDelay: "2.8s" } }),
@@ -4223,21 +2196,377 @@ function AmbientLayer(props) {
4223
2196
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", {})
4224
2197
  ] });
4225
2198
  }
2199
+ if (mode === "nebula") {
2200
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dkan-amb dkan-nebula", style: ambientStyle, "aria-hidden": "true", children: [
2201
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", {}),
2202
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", {}),
2203
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", {}),
2204
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", {})
2205
+ ] });
2206
+ }
2207
+ if (mode === "warp") {
2208
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dkan-amb dkan-warp", style: ambientStyle, "aria-hidden": "true", children: particles.warp.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", { style: { "--a": p.a + "deg", "--len": p.len + "px", animationDuration: "calc(" + p.d + "s / var(--dkan-speed,1))", animationDelay: p.delay + "s" } }, i)) });
2209
+ }
2210
+ if (mode === "radar") {
2211
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dkan-amb dkan-radar", style: ambientStyle, "aria-hidden": "true", children: ["a", "b", "c"].map((id) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "dkan-radar-station " + id, children: [
2212
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", {}),
2213
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", {})
2214
+ ] }, id)) });
2215
+ }
2216
+ if (mode === "constellation") {
2217
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dkan-amb dkan-constellation", style: ambientStyle, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { viewBox: "0 0 100 100", preserveAspectRatio: "none", children: [
2218
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { pathLength: "1", d: "M6 68 L18 30 L31 48 L45 18 L58 42 L73 25 L91 58 L78 78 L58 42 L31 48 L18 76 L6 68" }),
2219
+ [[6, 68], [18, 30], [31, 48], [45, 18], [58, 42], [73, 25], [91, 58], [78, 78], [18, 76]].map(([cx, cy], i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx, cy, r: i % 3 === 0 ? 1.1 : 0.7, style: { animationDelay: -i * 0.24 + "s" } }, i))
2220
+ ] }) });
2221
+ }
2222
+ if (mode === "fireflies") {
2223
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dkan-amb dkan-fireflies", style: ambientStyle, "aria-hidden": "true", children: particles.fireflies.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", { style: { left: p.l + "%", top: p.t + "%", width: p.sz, height: p.sz, "--dx": p.dx + "px", "--dy": p.dy + "px", animationDuration: "calc(" + p.d + "s / var(--dkan-speed,1))", animationDelay: p.delay + "s" } }, i)) });
2224
+ }
2225
+ if (mode === "ocean") {
2226
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dkan-amb dkan-ocean", style: ambientStyle, "aria-hidden": "true", children: [
2227
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dkan-ocean-waves", children: Array.from({ length: 5 }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", {}, i)) }),
2228
+ particles.bubbles.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", { style: { left: p.l + "%", width: p.sz, height: p.sz, "--drift": p.drift + "px", animationDuration: "calc(" + p.d + "s / var(--dkan-speed,1))", animationDelay: p.delay + "s" } }, i))
2229
+ ] });
2230
+ }
2231
+ if (mode === "prism") {
2232
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dkan-amb dkan-prism", style: ambientStyle, "aria-hidden": "true", children: Array.from({ length: 7 }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", {}, i)) });
2233
+ }
2234
+ if (mode === "circuit") {
2235
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dkan-amb dkan-circuit", style: ambientStyle, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { viewBox: "0 0 1000 600", preserveAspectRatio: "none", children: [
2236
+ ["M0 92 H180 V210 H390 V128 H610 V260 H820 V104 H1000", "M0 486 H144 V358 H334 V470 H520 V338 H748 V448 H1000", "M82 0 V126 H264 V286 H472 V196 H694 V320 H914 V600", "M936 0 V148 H776 V278 H566 V410 H350 V548 H112 V600"].map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { pathLength: "1", d, style: { animationDelay: -i * 0.7 + "s" } }, i)),
2237
+ [[180, 210], [390, 128], [610, 260], [144, 358], [520, 338], [264, 286], [694, 320], [566, 410]].map(([cx, cy], i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx, cy, r: "5" }, i))
2238
+ ] }) });
2239
+ }
2240
+ if (mode === "gravity") {
2241
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dkan-amb dkan-gravity", style: ambientStyle, "aria-hidden": "true", children: ["a", "b", "c"].map((id) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "dkan-gravity-source " + id, children: [
2242
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", {}),
2243
+ Array.from({ length: 4 }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", { style: { animationDelay: "calc(" + -i * 0.9 + "s / var(--dkan-speed,1))" } }, i))
2244
+ ] }, id)) });
2245
+ }
2246
+ if (mode === "lantern") {
2247
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dkan-amb dkan-lantern", style: ambientStyle, "aria-hidden": "true", children: particles.lanterns.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", { style: { left: p.l + "%", width: p.sz, height: p.sz * 1.28, "--drift": p.drift + "px", animationDuration: "calc(" + p.d + "s / var(--dkan-speed,1))", animationDelay: p.delay + "s" } }, i)) });
2248
+ }
2249
+ if (mode === "space") {
2250
+ const taskCount = Math.max(1, Math.min(3, Array.isArray(props.tasks) ? props.tasks.length : 1));
2251
+ const runnerCount = Math.max(6, Math.min(9, taskCount * 3));
2252
+ const galaxies = props.galaxies;
2253
+ if (!galaxies) return null;
2254
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dkan-amb dkan-space", style: {
2255
+ "--dkan-speed": speed,
2256
+ "--dkan-space-ships": taskCount,
2257
+ "--dkan-alpha-x": galaxies.alpha.cx + "px",
2258
+ "--dkan-alpha-y": galaxies.alpha.cy + "px",
2259
+ "--dkan-beta-x": galaxies.beta.cx + "px",
2260
+ "--dkan-beta-y": galaxies.beta.cy + "px",
2261
+ "--dkan-gamma-x": galaxies.gamma.cx + "px",
2262
+ "--dkan-gamma-y": galaxies.gamma.cy + "px"
2263
+ }, "aria-hidden": "true", children: [
2264
+ particles.dust.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", { className: "dkan-space-dust", style: { left: p.l + "%", top: p.t + "%", width: p.sz, height: p.sz, animationDuration: "calc(" + p.d + "s / var(--dkan-speed,1))", animationDelay: p.delay + "s" } }, i)),
2265
+ ["alpha", "beta", "gamma"].map((galaxy) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "dkan-space-system " + galaxy, style: { left: galaxies[galaxy].x, top: galaxies[galaxy].y, "--dkan-system-scale": galaxies[galaxy].scale }, children: [
2266
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", { className: "dkan-space-sun" }),
2267
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dkan-space-orbit a", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", {}) }),
2268
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dkan-space-orbit b", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", {}) }),
2269
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dkan-space-orbit c", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", {}) })
2270
+ ] }, galaxy)),
2271
+ Array.from({ length: runnerCount }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dkan-space-runner route-" + i % 3, style: { "--dkan-run-delay": -i * 1.8 + "s" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FreighterHull, { units: 1, empty: true }) }, i))
2272
+ ] });
2273
+ }
2274
+ return null;
2275
+ }
2276
+ function outputCargo(outputTokens) {
2277
+ const tokens = Math.max(0, Number(outputTokens) || 0);
2278
+ return { tokens, units: Math.max(1, Math.min(8, Math.ceil(tokens / 900))) };
2279
+ }
2280
+ function fallbackComposerDockPoint(side = "right") {
2281
+ const vw = typeof window === "undefined" ? 1280 : window.innerWidth;
2282
+ const vh = typeof window === "undefined" ? 900 : window.innerHeight;
2283
+ return {
2284
+ // 待命位贴近输入框右上;右侧远端只保留给旧的通用停靠计算。
2285
+ x: side === "left" ? Math.max(304, Math.min(520, Math.round(vw * 0.18))) : side === "ready" ? Math.max(316, vw - 640) : Math.max(16, vw - 232),
2286
+ y: Math.max(32, vh - 218)
2287
+ };
2288
+ }
2289
+ function visibleRect(el) {
2290
+ if (!el || typeof window === "undefined") return null;
2291
+ const r = el.getBoundingClientRect();
2292
+ return r.width > 0 && r.height > 0 && r.bottom > 0 && r.top < window.innerHeight ? r : null;
2293
+ }
2294
+ var COMPOSER_SEND_SELECTOR = 'button[aria-label="Send message"],button[aria-label*="\u53D1\u9001"],button[data-testid*="send"],button[data-testid*="submit"],button[type="submit"]';
2295
+ function conversationComposer() {
2296
+ if (typeof document === "undefined" || typeof window === "undefined") return null;
2297
+ const sendButtons = document.querySelectorAll(COMPOSER_SEND_SELECTOR);
2298
+ for (const button of sendButtons) {
2299
+ let el = button.parentElement;
2300
+ for (let depth = 0; el && depth < 9; depth += 1, el = el.parentElement) {
2301
+ const r = visibleRect(el);
2302
+ if (r && r.width >= 360 && r.height >= 72 && r.height <= 360 && r.top > window.innerHeight * 0.42) return { element: el, rect: r };
2303
+ }
2304
+ }
4226
2305
  return null;
4227
2306
  }
2307
+ function conversationComposerRect() {
2308
+ const composer = conversationComposer();
2309
+ return composer ? composer.rect : null;
2310
+ }
2311
+ function composerPointFromRect(composer, side) {
2312
+ return {
2313
+ x: side === "ready" ? Math.max(composer.left + 16, composer.right - 210) : fallbackComposerDockPoint(side).x,
2314
+ y: Math.max(22, composer.top - 92)
2315
+ };
2316
+ }
2317
+ function composerDockPoint(side = "right") {
2318
+ if (typeof document === "undefined" || typeof window === "undefined") return fallbackComposerDockPoint(side);
2319
+ const composer = conversationComposerRect();
2320
+ if (composer) return composerPointFromRect(composer, side);
2321
+ const selectors = [
2322
+ '[data-testid*="composer"]',
2323
+ '[data-testid*="conversation-input"]',
2324
+ '[data-slot*="conversation.input"]',
2325
+ 'textarea[placeholder*="Message"]',
2326
+ 'textarea[placeholder*="\u6D88\u606F"]',
2327
+ "textarea",
2328
+ '[contenteditable="true"][data-testid*="composer"]',
2329
+ '[contenteditable="true"][aria-label*="\u6D88\u606F"]',
2330
+ '[contenteditable="true"][data-slot*="conversation.input"]'
2331
+ ];
2332
+ const seen = /* @__PURE__ */ new Set();
2333
+ const candidates = [];
2334
+ for (const selector of selectors) {
2335
+ for (const el of document.querySelectorAll(selector)) {
2336
+ if (seen.has(el)) continue;
2337
+ seen.add(el);
2338
+ const r2 = el.getBoundingClientRect();
2339
+ if (r2.width > 80 && r2.height > 16 && r2.bottom > window.innerHeight * 0.48) candidates.push({ el, r: r2 });
2340
+ }
2341
+ }
2342
+ const best = candidates.sort((a, b) => b.r.bottom - a.r.bottom)[0];
2343
+ if (!best) return fallbackComposerDockPoint(side);
2344
+ const r = best.r;
2345
+ const x = side === "ready" ? Math.max(r.left + 16, r.right - 210) : fallbackComposerDockPoint(side).x;
2346
+ return {
2347
+ // 纵向以真实输入控件上沿停靠,飞船底部和输入框保留间隙。
2348
+ x,
2349
+ y: Math.max(22, r.top - 92)
2350
+ };
2351
+ }
2352
+ function useSpaceDocks(enabled) {
2353
+ const [docks, setDocks] = (0, import_react8.useState)(null);
2354
+ (0, import_react8.useEffect)(() => {
2355
+ if (!enabled || typeof window === "undefined") {
2356
+ setDocks(null);
2357
+ return void 0;
2358
+ }
2359
+ let disposed = false;
2360
+ let frame = 0;
2361
+ let idle = 0;
2362
+ let timer = 0;
2363
+ let pollTimer = 0;
2364
+ let retries = 0;
2365
+ let pending = false;
2366
+ let observedComposer = null;
2367
+ let resizeObserver = null;
2368
+ const samePoint = (a, b) => !!a && !!b && Math.abs(a.x - b.x) < 1 && Math.abs(a.y - b.y) < 1;
2369
+ const bindComposerResize = (element) => {
2370
+ if (!resizeObserver || observedComposer === element) return;
2371
+ if (observedComposer) resizeObserver.unobserve(observedComposer);
2372
+ observedComposer = element;
2373
+ if (observedComposer) resizeObserver.observe(observedComposer);
2374
+ };
2375
+ const measure = () => {
2376
+ if (disposed) return;
2377
+ const found = conversationComposer();
2378
+ if (!found) {
2379
+ bindComposerResize(null);
2380
+ setDocks(null);
2381
+ if (retries++ < 20) schedule(140);
2382
+ return;
2383
+ }
2384
+ retries = 0;
2385
+ bindComposerResize(found.element);
2386
+ const composer = found.rect;
2387
+ const right = composerPointFromRect(composer, "right");
2388
+ const next = {
2389
+ right,
2390
+ left: composerPointFromRect(composer, "left"),
2391
+ ready: composerPointFromRect(composer, "ready")
2392
+ };
2393
+ setDocks((current) => current && samePoint(current.right, next.right) && samePoint(current.left, next.left) && samePoint(current.ready, next.ready) ? current : next);
2394
+ };
2395
+ function schedule(delay = 0, deferUntilIdle = false) {
2396
+ if (disposed || pending) return;
2397
+ pending = true;
2398
+ const queueFrame = () => {
2399
+ frame = window.requestAnimationFrame(() => {
2400
+ pending = false;
2401
+ measure();
2402
+ });
2403
+ };
2404
+ if (delay > 0) timer = window.setTimeout(queueFrame, delay);
2405
+ else if (deferUntilIdle && typeof window.requestIdleCallback === "function") idle = window.requestIdleCallback(queueFrame, { timeout: 350 });
2406
+ else queueFrame();
2407
+ }
2408
+ ;
2409
+ if (typeof window.ResizeObserver === "function") resizeObserver = new window.ResizeObserver(() => schedule());
2410
+ const mutationObserver = typeof window.MutationObserver === "function" ? new window.MutationObserver((mutations) => {
2411
+ const hasComposerChange = mutations.some((mutation) => Array.from(mutation.addedNodes).concat(Array.from(mutation.removedNodes)).some((node) => {
2412
+ if (!node || node.nodeType !== 1) return false;
2413
+ return node.matches && node.matches(COMPOSER_SEND_SELECTOR) || node.querySelector && node.querySelector(COMPOSER_SEND_SELECTOR);
2414
+ }));
2415
+ if (hasComposerChange) schedule(40);
2416
+ }) : null;
2417
+ if (mutationObserver && document.body) mutationObserver.observe(document.body, { childList: true, subtree: true });
2418
+ schedule(0, true);
2419
+ pollTimer = window.setInterval(() => schedule(), 700);
2420
+ const onResize = () => {
2421
+ if (idle && typeof window.cancelIdleCallback === "function") window.cancelIdleCallback(idle);
2422
+ if (timer) window.clearTimeout(timer);
2423
+ pending = false;
2424
+ schedule();
2425
+ };
2426
+ window.addEventListener("resize", onResize, { passive: true });
2427
+ return () => {
2428
+ disposed = true;
2429
+ window.cancelAnimationFrame(frame);
2430
+ if (idle && typeof window.cancelIdleCallback === "function") window.cancelIdleCallback(idle);
2431
+ if (timer) window.clearTimeout(timer);
2432
+ if (pollTimer) window.clearInterval(pollTimer);
2433
+ if (mutationObserver) mutationObserver.disconnect();
2434
+ if (resizeObserver) resizeObserver.disconnect();
2435
+ window.removeEventListener("resize", onResize);
2436
+ };
2437
+ }, [enabled]);
2438
+ return docks;
2439
+ }
2440
+ function spaceGalaxyLayout() {
2441
+ const vw = typeof window === "undefined" ? 1280 : window.innerWidth;
2442
+ const vh = typeof window === "undefined" ? 900 : window.innerHeight;
2443
+ const contentLeft = 316;
2444
+ const make = (x, y, scale) => ({ x, y, scale, cx: x + 123, cy: y + 123 });
2445
+ return {
2446
+ alpha: make(Math.max(contentLeft + 420, vw - 360), 72, 0.5),
2447
+ beta: make(contentLeft, Math.max(142, Math.min(232, vh * 0.18)), 0.48),
2448
+ gamma: make(contentLeft + 18, Math.max(420, vh - 382), 0.48)
2449
+ };
2450
+ }
2451
+ function freighterAnchorAt(point) {
2452
+ return { x: Math.round(point.x - 88), y: Math.round(point.y - 32) };
2453
+ }
2454
+ function flightAngle(from, to) {
2455
+ return Math.round(Math.atan2(to.y - from.y, to.x - from.x) * 180 / Math.PI);
2456
+ }
2457
+ function FreighterHull(props) {
2458
+ const units = Math.max(1, Number(props.units) || 1);
2459
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "dkan-freighter", children: [
2460
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("i", { className: "dkan-freighter-engine", children: [
2461
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", {}),
2462
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", {})
2463
+ ] }),
2464
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", { className: "dkan-freighter-wing left" }),
2465
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", { className: "dkan-freighter-wing right" }),
2466
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", { className: "dkan-freighter-fin" }),
2467
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", { className: "dkan-freighter-hull" }),
2468
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", { className: "dkan-freighter-canopy" }),
2469
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", { className: "dkan-freighter-nose" }),
2470
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dkan-freighter-cargo" + (props.empty ? " empty" : ""), children: Array.from({ length: units }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", {}, i)) })
2471
+ ] });
2472
+ }
2473
+ function DeliveryFreighter(props) {
2474
+ const d = props.delivery;
2475
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dkan-delivery", style: {
2476
+ "--dkan-from-x": d.from.x + "px",
2477
+ "--dkan-from-y": d.from.y + "px",
2478
+ "--dkan-to-x": d.to.x + "px",
2479
+ "--dkan-to-y": d.to.y + "px",
2480
+ "--dkan-delivery-duration": d.duration + "ms"
2481
+ }, "aria-hidden": "true", children: [
2482
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dkan-delivery-trail" }),
2483
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FreighterHull, { units: d.units }),
2484
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "dkan-delivery-label", children: [
2485
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", { children: "\u5F52\u822A\u8D27\u8FD0\u8230" }),
2486
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { children: [
2487
+ "\u8F93\u51FA ",
2488
+ fmtCompact2(d.tokens),
2489
+ " Tokens \xB7 ",
2490
+ d.units,
2491
+ " \u8231"
2492
+ ] })
2493
+ ] })
2494
+ ] });
2495
+ }
2496
+ function ReadyFreighter(props) {
2497
+ const dock = props.dock || fallbackComposerDockPoint("ready");
2498
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dkan-ready-freighter", style: { left: dock.x, top: dock.y }, "aria-hidden": "true", children: [
2499
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FreighterHull, { units: 3, empty: true }),
2500
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u5F85\u547D \xB7 \u7B49\u5F85\u4E0B\u4E00\u6761\u4EFB\u52A1" })
2501
+ ] });
2502
+ }
2503
+ function MissionDeparture(props) {
2504
+ const d = props.departure;
2505
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dkan-departure", style: {
2506
+ "--dkan-from-x": d.from.x + "px",
2507
+ "--dkan-from-y": d.from.y + "px",
2508
+ "--dkan-to-x": d.to.x + "px",
2509
+ "--dkan-to-y": d.to.y + "px",
2510
+ "--dkan-flight-angle": d.angle + "deg",
2511
+ "--dkan-departure-duration": d.duration + "ms"
2512
+ }, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FreighterHull, { units: 3, empty: true }) });
2513
+ }
2514
+ function ProgrammingStuck(props) {
2515
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dkan-space-stuck", "aria-hidden": "true", children: [
2516
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FreighterHull, { units: 3, empty: true }),
2517
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "dkan-stuck-code", children: [
2518
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", {}),
2519
+ `{ }`
2520
+ ] }),
2521
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: "\u7F16\u7A0B\u7B49\u5F85\u4E2D" }),
2522
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("small", { children: truncate(props.task && props.task.title || "\u5DE5\u5177\u6682\u65E0\u65B0\u54CD\u5E94", 28) })
2523
+ ] });
2524
+ }
4228
2525
  function AnimationOverlay(props) {
4229
2526
  const ctx = props && props.ctx;
4230
2527
  const snap = useAnimation();
4231
2528
  const [toasts, setToasts] = (0, import_react8.useState)([]);
4232
2529
  const [flourish, setFlourish] = (0, import_react8.useState)(null);
4233
2530
  const [bursts, setBursts] = (0, import_react8.useState)([]);
2531
+ const [deliveries, setDeliveries] = (0, import_react8.useState)([]);
2532
+ const [departures, setDepartures] = (0, import_react8.useState)([]);
4234
2533
  const prevActiveRef = (0, import_react8.useRef)(null);
4235
2534
  const burstIdRef = (0, import_react8.useRef)(0);
2535
+ const deliveryIdRef = (0, import_react8.useRef)(0);
2536
+ const departureTimersRef = (0, import_react8.useRef)(/* @__PURE__ */ new Map());
2537
+ const lastImmediateDepartureRef = (0, import_react8.useRef)(0);
2538
+ (0, import_react8.useEffect)(() => () => {
2539
+ for (const timer of departureTimersRef.current.values()) clearTimeout(timer);
2540
+ departureTimersRef.current.clear();
2541
+ }, []);
4236
2542
  const pushBurst = (0, import_react8.useCallback)((type, x, y, bits) => {
4237
2543
  const id = ++burstIdRef.current;
4238
2544
  setBursts((prev) => prev.concat([{ id, type, x, y, bits }]).slice(-6));
4239
2545
  setTimeout(() => setBursts((prev) => prev.filter((b) => b.id !== id)), 2600);
4240
2546
  }, []);
2547
+ const launchMission = (0, import_react8.useCallback)(() => {
2548
+ const cfg2 = animationStore.snap.status && animationStore.snap.status.config;
2549
+ if (!cfg2 || !cfg2.animationEnabled || cfg2.effectMode !== "space") return false;
2550
+ const id = ++deliveryIdRef.current;
2551
+ const from = composerDockPoint("left");
2552
+ const targetGalaxy = spaceGalaxyLayout().alpha;
2553
+ const to = freighterAnchorAt({ x: targetGalaxy.cx, y: targetGalaxy.cy });
2554
+ const departure = {
2555
+ id,
2556
+ from,
2557
+ to,
2558
+ angle: flightAngle(from, to),
2559
+ duration: 8600
2560
+ };
2561
+ lastImmediateDepartureRef.current = Date.now();
2562
+ setDeliveries([]);
2563
+ setDepartures((prev) => prev.concat([departure]).slice(-3));
2564
+ departureTimersRef.current.set(id, setTimeout(() => {
2565
+ departureTimersRef.current.delete(id);
2566
+ setDepartures((prev) => prev.filter((item) => item.id !== id));
2567
+ }, departure.duration));
2568
+ return true;
2569
+ }, []);
4241
2570
  (0, import_react8.useEffect)(() => {
4242
2571
  if (typeof document === "undefined") return;
4243
2572
  const onClick = (e) => {
@@ -4249,6 +2578,7 @@ function AnimationOverlay(props) {
4249
2578
  const sessionItem = t.closest('[role="treeitem"]');
4250
2579
  if (sendBtn) {
4251
2580
  pushBurst("plane", e.clientX, e.clientY);
2581
+ launchMission();
4252
2582
  } else if (newSession) {
4253
2583
  pushBurst("spark", e.clientX, e.clientY, makeBits(10, () => ({
4254
2584
  dx: (Math.random() - 0.5) * 70,
@@ -4263,15 +2593,19 @@ function AnimationOverlay(props) {
4263
2593
  };
4264
2594
  document.addEventListener("click", onClick, true);
4265
2595
  return () => document.removeEventListener("click", onClick, true);
4266
- }, [pushBurst]);
2596
+ }, [pushBurst, launchMission]);
4267
2597
  const taskCountRef = (0, import_react8.useRef)(0);
4268
2598
  (0, import_react8.useEffect)(() => {
4269
2599
  const st2 = snap.status;
4270
2600
  if (!st2 || !st2.active) return;
4271
2601
  const n = st2.active.length;
4272
- if (n > taskCountRef.current) pushBurst("surge");
2602
+ if (n > taskCountRef.current) {
2603
+ pushBurst("surge");
2604
+ const cfg2 = st2.config || {};
2605
+ if (cfg2.animationEnabled && cfg2.effectMode === "space" && Date.now() - lastImmediateDepartureRef.current > 1e4) launchMission();
2606
+ }
4273
2607
  taskCountRef.current = n;
4274
- }, [snap.status, pushBurst]);
2608
+ }, [snap.status, pushBurst, launchMission]);
4275
2609
  (0, import_react8.useEffect)(() => {
4276
2610
  let stopped = false;
4277
2611
  let timer = null;
@@ -4312,6 +2646,18 @@ function AnimationOverlay(props) {
4312
2646
  const info = endInfo(reason);
4313
2647
  if (cfg2.animationEnabled) {
4314
2648
  setFlourish({ key: Date.now(), err: !success });
2649
+ if (cfg2.effectMode === "space") {
2650
+ const cargo = outputCargo(record && record.outputTokens || task.outputTokens);
2651
+ const id = ++deliveryIdRef.current;
2652
+ const taskSpeed = Math.max(0.9, Number(speed) || 1);
2653
+ const duration = Math.round(Math.max(8e3, Math.min(9400, 1e4 / Math.sqrt(taskSpeed))));
2654
+ const galaxies = spaceGalaxyLayout();
2655
+ const returnGalaxy = galaxies[["alpha", "beta", "gamma"][Math.floor(Math.random() * 3)]];
2656
+ const from = freighterAnchorAt({ x: returnGalaxy.cx, y: returnGalaxy.cy });
2657
+ const to = composerDockPoint("left");
2658
+ const delivery = Object.assign({ id, from, to, duration }, cargo);
2659
+ setDeliveries([delivery]);
2660
+ }
4315
2661
  if (success) {
4316
2662
  pushBurst("confetti", 0, 0, makeBits(18, (i) => ({
4317
2663
  l: 4 + i / 18 * 92 + Math.random() * 3,
@@ -4394,6 +2740,10 @@ function AnimationOverlay(props) {
4394
2740
  speedRef.current = { ticks, at: t };
4395
2741
  }, [snap.status]);
4396
2742
  const ambientOn = animOn && !panelOpen;
2743
+ const spaceModeOn = !!(cfg && cfg.animationEnabled && mode === "space" && !panelOpen);
2744
+ const spaceDocks = useSpaceDocks(spaceModeOn);
2745
+ const spaceGalaxies = spaceModeOn && spaceDocks ? spaceGalaxyLayout() : null;
2746
+ const stuckTask = active.find((task) => task.phase === "code" && now - (task.lastActivityAt || task.phaseAt || now) >= 18e3) || null;
4397
2747
  const robotScaleFromConfig = Math.max(0.85, Math.min(2.2, Number(cfg && cfg.robotScale) || 1.35));
4398
2748
  const speedStyle = { "--dkan-speed": Number(speed).toFixed(2) };
4399
2749
  const saveRobotScale = (0, import_react8.useCallback)((robotScale) => {
@@ -4506,7 +2856,10 @@ function AnimationOverlay(props) {
4506
2856
  if (!st) return null;
4507
2857
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
4508
2858
  ambientOn && mode === "flow" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dkan-line", style: speedStyle, "aria-hidden": "true" }) : null,
4509
- ambientOn && (mode === "matrix" || mode === "stars" || mode === "aurora") ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AmbientLayer, { mode, speed: Number(speed).toFixed(2) }) : null,
2859
+ ambientOn && AMBIENT_EFFECT_MODES.has(mode) && (mode !== "space" || spaceGalaxies) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AmbientLayer, { mode, phase, speed: Number(speed).toFixed(2), tasks: active, galaxies: spaceGalaxies }) : null,
2860
+ spaceModeOn && spaceDocks && active.length === 0 && deliveries.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ReadyFreighter, { dock: spaceDocks.ready }) : null,
2861
+ spaceModeOn && stuckTask ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ProgrammingStuck, { task: stuckTask }) : null,
2862
+ !panelOpen ? departures.map((departure) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MissionDeparture, { departure }, departure.id)) : null,
4510
2863
  ambientOn && mode === "orbit" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dkan-orbit", style: speedStyle, "aria-hidden": "true" }) : null,
4511
2864
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BurstLayer, { bursts }),
4512
2865
  ambientOn && mode === "robot" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
@@ -4594,6 +2947,7 @@ function AnimationOverlay(props) {
4594
2947
  },
4595
2948
  flourish.key
4596
2949
  ) : null,
2950
+ !panelOpen ? deliveries.map((delivery) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DeliveryFreighter, { delivery }, delivery.id)) : null,
4597
2951
  toasts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dkan-toasts", children: toasts.map((t) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Toast, { t, onClose: (id) => setToasts((prev) => prev.filter((x) => x.id !== id)) }, t.id)) }) : null
4598
2952
  ] });
4599
2953
  }
@@ -4627,12 +2981,22 @@ function ModePreview({ id }) {
4627
2981
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", {})
4628
2982
  ] });
4629
2983
  }
2984
+ if (id === "space") {
2985
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "dkan-prev dkan-prev-space", children: [
2986
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", {}),
2987
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", {}),
2988
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("em", {})
2989
+ ] });
2990
+ }
4630
2991
  if (id === "aurora") {
4631
2992
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "dkan-prev dkan-prev-aurora", children: [
4632
2993
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", {}),
4633
2994
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", {})
4634
2995
  ] });
4635
2996
  }
2997
+ if (["nebula", "warp", "radar", "constellation", "fireflies", "ocean", "prism", "circuit", "gravity", "lantern"].includes(id)) {
2998
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dkan-prev dkan-prev-new dkan-prev-" + id, children: Array.from({ length: id === "warp" ? 8 : 6 }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("i", {}, i)) });
2999
+ }
4636
3000
  if (id === "robot") {
4637
3001
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dkan-prev dkan-prev-bot", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RobotScene, { phase: "code" }) });
4638
3002
  }
@@ -5158,12 +3522,66 @@ var css2 = [
5158
3522
  ".dkan-meteor{position:absolute;width:110px;height:2px;border-radius:2px;background:linear-gradient(90deg,#fff,color-mix(in srgb,#8ab6ff 60%,transparent) 40%,transparent);transform:rotate(35deg);transform-origin:left center;opacity:0;animation:dkan-meteor 8.4s linear infinite;}",
5159
3523
  '.dkan-meteor::before{content:"";position:absolute;left:-2px;top:-2px;width:6px;height:6px;border-radius:50%;background:#fff;box-shadow:0 0 8px 2px color-mix(in srgb,#cfe3ff 70%,transparent);}',
5160
3524
  "@keyframes dkan-meteor{0%{opacity:0;transform:rotate(35deg) translateX(0)}3%{opacity:1}10%{opacity:0;transform:rotate(35deg) translateX(46vh)}100%{opacity:0;transform:rotate(35deg) translateX(46vh)}}",
3525
+ // 星际远征:星尘、行星轨道和任务飞船都只在任务运行时出现,统一由 --dkan-speed 加速。
3526
+ ".dkan-space{background:radial-gradient(ellipse 34% 28% at 84% 11%,color-mix(in srgb,#426aaf 15%,transparent),transparent 72%),radial-gradient(ellipse 26% 22% at 14% 58%,color-mix(in srgb,#7c4dff 10%,transparent),transparent 74%);}",
3527
+ ".dkan-space-dust{position:absolute;border-radius:50%;background:#dbeafe;box-shadow:0 0 5px color-mix(in srgb,#93c5fd 62%,transparent);opacity:.2;animation:dkan-space-dust ease-in-out infinite alternate;will-change:transform,opacity;}",
3528
+ "@keyframes dkan-space-dust{0%{opacity:.14;transform:translate3d(0,0,0) scale(.7)}55%{opacity:.78}100%{opacity:.26;transform:translate3d(22px,-8px,0) scale(1.15)}}",
3529
+ ".dkan-space-system{position:fixed;width:246px;height:246px;border-radius:50%;opacity:.78;transform:translateZ(0) scale(var(--dkan-system-scale,1));transform-origin:center;contain:layout paint style;}.dkan-space-system.alpha{opacity:.76}.dkan-space-system.beta{opacity:.68}.dkan-space-system.gamma{opacity:.64}",
3530
+ ".dkan-space-sun{position:absolute;left:50%;top:50%;width:34px;height:34px;border-radius:50%;transform:translate(-50%,-50%);background:radial-gradient(circle at 32% 28%,#fff7c2 0 9%,#ffc85a 30%,#e76f2e 74%);box-shadow:0 0 12px 4px color-mix(in srgb,#ffc85a 58%,transparent),0 0 36px 12px color-mix(in srgb,#f97316 20%,transparent);}",
3531
+ ".dkan-space-orbit{position:absolute;left:50%;top:50%;border:1px solid color-mix(in srgb,#93c5fd 28%,transparent);border-radius:50%;animation:dkan-space-orbit linear infinite;transform-origin:center;}",
3532
+ ".dkan-space-orbit i{position:absolute;top:50%;left:-5px;width:10px;height:10px;border-radius:50%;transform:translateY(-50%);box-shadow:0 0 9px 2px currentColor;}",
3533
+ ".dkan-space-orbit.a{width:82px;height:50px;margin:-25px 0 0 -41px;animation-duration:calc(5.4s / var(--dkan-speed,1));}.dkan-space-orbit.a i{color:#67e8f9;background:#22d3ee;}",
3534
+ ".dkan-space-orbit.b{width:142px;height:86px;margin:-43px 0 0 -71px;animation-duration:calc(9.2s / var(--dkan-speed,1));animation-direction:reverse;}.dkan-space-orbit.b i{width:15px;height:15px;color:#c4b5fd;background:radial-gradient(circle at 30% 28%,#ede9fe,#8b5cf6 72%);}",
3535
+ ".dkan-space-orbit.c{width:212px;height:130px;margin:-65px 0 0 -106px;animation-duration:calc(15.6s / var(--dkan-speed,1));}.dkan-space-orbit.c i{width:18px;height:18px;color:#fda4af;background:radial-gradient(circle at 32% 28%,#ffe4e6,#e11d48 74%);}",
3536
+ "@keyframes dkan-space-orbit{to{transform:rotate(360deg)}}",
3537
+ ".dkan-space-runner{position:fixed;left:0;top:0;width:108px;height:56px;opacity:0;animation-duration:calc(10.8s / var(--dkan-speed,1));animation-timing-function:linear;animation-iteration-count:infinite;animation-delay:var(--dkan-run-delay,0s);will-change:transform,opacity;contain:layout paint style;backface-visibility:hidden;}.dkan-space-runner .dkan-freighter{left:0;top:0;transform:translateZ(0) scale(.52);transform-origin:top left;filter:none}.dkan-space-runner .dkan-freighter-engine i{animation:none;opacity:.76;box-shadow:-6px 0 8px #22d3ee}.dkan-space-runner .dkan-freighter-nose{filter:none}.dkan-space-runner.route-0{animation-name:dkan-space-route-a}.dkan-space-runner.route-1{animation-name:dkan-space-route-b}.dkan-space-runner.route-2{animation-name:dkan-space-route-c}",
3538
+ "@keyframes dkan-space-route-a{0%{opacity:0;transform:translate3d(var(--dkan-alpha-x),var(--dkan-alpha-y),0) rotate(151deg)}7%,86%{opacity:.9}100%{opacity:0;transform:translate3d(var(--dkan-beta-x),var(--dkan-beta-y),0) rotate(151deg)}}@keyframes dkan-space-route-b{0%{opacity:0;transform:translate3d(var(--dkan-beta-x),var(--dkan-beta-y),0) rotate(-90deg)}7%,86%{opacity:.9}100%{opacity:0;transform:translate3d(var(--dkan-gamma-x),var(--dkan-gamma-y),0) rotate(-90deg)}}@keyframes dkan-space-route-c{0%{opacity:0;transform:translate3d(var(--dkan-gamma-x),var(--dkan-gamma-y),0) rotate(-18deg)}7%,86%{opacity:.9}100%{opacity:0;transform:translate3d(var(--dkan-alpha-x),var(--dkan-alpha-y),0) rotate(-18deg)}}",
3539
+ // 完成归航:一艘货运旗舰从航线飞到真实会话输入框上方,货舱逐格表达实际输出量。
3540
+ ".dkan-delivery{position:fixed;left:0;top:0;width:210px;height:88px;z-index:9994;pointer-events:none;will-change:transform,opacity;contain:layout paint style;isolation:isolate;animation:dkan-delivery-flight var(--dkan-delivery-duration,8600ms) cubic-bezier(.22,.61,.36,1) forwards;}",
3541
+ "@keyframes dkan-delivery-flight{0%{opacity:0;transform:translate3d(var(--dkan-from-x),var(--dkan-from-y),0) scale(.5) rotate(-12deg)}6%{opacity:1;transform:translate3d(var(--dkan-from-x),var(--dkan-from-y),0) scale(.56) rotate(-10deg)}100%{opacity:1;transform:translate3d(var(--dkan-to-x),var(--dkan-to-y),0) scale(1) rotate(0)}}",
3542
+ ".dkan-delivery-trail{position:absolute;left:-132px;top:26px;width:154px;height:4px;border-radius:999px;background:linear-gradient(90deg,transparent,#34d399 48%,#d9f99d 78%,transparent);opacity:.9;animation:dkan-delivery-trail var(--dkan-delivery-duration,8600ms) linear forwards;}@keyframes dkan-delivery-trail{0%,82%{opacity:.9}100%{opacity:0}}.dkan-freighter{position:absolute;left:10px;top:10px;width:176px;height:45px;display:block;filter:drop-shadow(0 0 9px color-mix(in srgb,#7dd3fc 62%,transparent));}.dkan-delivery .dkan-freighter,.dkan-departure .dkan-freighter{filter:none}.dkan-delivery .dkan-freighter-engine i,.dkan-departure .dkan-freighter-engine i{animation:none;opacity:.76;box-shadow:-6px 0 8px #22d3ee}.dkan-delivery .dkan-freighter-nose,.dkan-departure .dkan-freighter-nose{filter:none}.dkan-freighter-hull{position:absolute;z-index:3;left:21px;top:7px;width:126px;height:31px;background:linear-gradient(150deg,#f8fbff 0%,#9cc8ff 30%,#385d91 72%,#1d3150);clip-path:polygon(0 30%,43% 0,83% 17%,100% 50%,83% 83%,43% 100%,0 70%,12% 50%);box-shadow:inset 0 1px 0 rgb(255 255 255 / .7),inset -7px -5px 9px rgb(8 24 49 / .38);}.dkan-freighter-nose{position:absolute;z-index:4;right:10px;top:16px;width:28px;height:14px;background:linear-gradient(90deg,#a9d1ff,#e8f5ff);clip-path:polygon(0 0,100% 50%,0 100%,22% 50%);filter:drop-shadow(5px 0 5px color-mix(in srgb,#93c5fd 62%,transparent));}.dkan-freighter-canopy{position:absolute;z-index:5;left:77px;top:10px;width:39px;height:11px;border-radius:70% 48% 42% 32%;background:linear-gradient(135deg,#ecfeff 0%,#67e8f9 32%,#2563eb 75%);transform:skewX(-18deg);box-shadow:inset 0 2px 2px rgb(255 255 255 / .7),0 0 8px color-mix(in srgb,#67e8f9 42%,transparent);}.dkan-freighter-fin{position:absolute;z-index:2;left:48px;top:3px;width:24px;height:17px;background:linear-gradient(135deg,#31557f,#a7caf7);clip-path:polygon(0 100%,58% 0,100% 100%);}.dkan-freighter-wing{position:absolute;z-index:1;left:48px;width:60px;height:18px;background:linear-gradient(135deg,#24436d,#8ebaf4);}.dkan-freighter-wing.left{top:2px;clip-path:polygon(0 100%,100% 0,68% 100%)}.dkan-freighter-wing.right{top:26px;clip-path:polygon(0 0,68% 0,100% 100%)}",
3543
+ ".dkan-freighter-cargo{position:absolute;z-index:6;left:37px;top:31px;width:74px;height:7px;display:flex;align-items:center;gap:2px;padding:1px 3px;border-radius:4px;background:#172842;border:1px solid color-mix(in srgb,#b8d8ff 48%,transparent);box-shadow:inset 0 1px 0 rgb(255 255 255 / .2);}.dkan-freighter-cargo i{display:block;flex:1;min-width:4px;height:5px;border-radius:1px;background:linear-gradient(135deg,#fef3c7,#f59e0b 58%,#b45309);box-shadow:0 0 4px color-mix(in srgb,#fbbf24 58%,transparent);}.dkan-freighter-cargo.empty i{background:linear-gradient(135deg,#dbeafe,#38bdf8 58%,#1d4ed8);box-shadow:0 0 4px color-mix(in srgb,#38bdf8 55%,transparent);}.dkan-freighter-engine{position:absolute;z-index:0;left:5px;top:19px;display:flex;gap:3px;align-items:center;height:11px;}.dkan-freighter-engine i{width:18px;height:5px;border-radius:60% 0 0 60%;background:linear-gradient(90deg,transparent,#67e8f9);box-shadow:-9px 0 12px #22d3ee;animation:dkan-engine .34s ease-in-out infinite alternate;}.dkan-freighter-engine i:nth-child(2){animation-delay:-.14s}",
3544
+ "@keyframes dkan-engine{to{transform:scaleX(.55);opacity:.5}}",
3545
+ ".dkan-delivery-label{position:absolute;left:21px;top:58px;display:flex;align-items:baseline;gap:6px;padding:4px 8px;border:1px solid color-mix(in srgb,#93c5fd 30%,var(--dsw-alias-border-l1));border-radius:999px;background:color-mix(in srgb,var(--dsw-alias-bg-layer-2) 82%,transparent);backdrop-filter:blur(10px);color:var(--dsw-alias-label-secondary);font:10px/1.2 var(--ds-font-family,system-ui,sans-serif);white-space:nowrap;}.dkan-delivery-label b{color:var(--dsw-alias-label-primary);font-weight:650}.dkan-delivery-label span{color:#7dd3fc;}",
3546
+ "@media (max-width:1100px){.dkan-space-system,.dkan-space-runner{display:none}}",
3547
+ ".dkan-ready-freighter{position:fixed;width:210px;height:88px;z-index:9994;pointer-events:none;filter:drop-shadow(0 10px 14px rgb(0 0 0 / .18));}.dkan-ready-freighter>span:last-child{position:absolute;left:21px;top:58px;padding:4px 8px;border:1px solid color-mix(in srgb,#93c5fd 28%,var(--dsw-alias-border-l1));border-radius:999px;background:color-mix(in srgb,var(--dsw-alias-bg-layer-2) 80%,transparent);backdrop-filter:blur(10px);color:var(--dsw-alias-label-secondary);font:10px/1.2 var(--ds-font-family,system-ui,sans-serif);white-space:nowrap;}.dkan-departure{position:fixed;left:0;top:0;width:210px;height:88px;z-index:9994;pointer-events:none;will-change:transform,opacity;contain:layout paint style;isolation:isolate;animation:dkan-departure-flight var(--dkan-departure-duration,8600ms) cubic-bezier(.42,0,.85,.45) forwards;}@keyframes dkan-departure-flight{0%{opacity:0;transform:translate3d(var(--dkan-from-x),var(--dkan-from-y),0) scale(1) rotate(var(--dkan-flight-angle,0deg))}6%{opacity:1;transform:translate3d(var(--dkan-from-x),var(--dkan-from-y),0) scale(1) rotate(var(--dkan-flight-angle,0deg))}100%{opacity:0;transform:translate3d(var(--dkan-to-x),var(--dkan-to-y),0) scale(.24) rotate(var(--dkan-flight-angle,0deg))}}",
3548
+ ".dkan-space-stuck{position:fixed;left:50%;top:50%;width:244px;height:160px;z-index:9993;pointer-events:none;transform:translate(-50%,-50%);border:1px solid color-mix(in srgb,#f59e0b 48%,var(--dsw-alias-border-l1));border-radius:20px;background:color-mix(in srgb,var(--dsw-alias-bg-layer-2) 88%,transparent);backdrop-filter:blur(16px);box-shadow:0 18px 54px rgb(0 0 0 / .28),0 0 30px color-mix(in srgb,#f59e0b 15%,transparent);}.dkan-space-stuck .dkan-freighter{left:37px;top:11px;transform:scale(.9);transform-origin:top left;}.dkan-stuck-code{position:absolute;left:17px;right:17px;top:60px;height:36px;border-radius:7px;background:linear-gradient(90deg,color-mix(in srgb,#f59e0b 18%,transparent),transparent);color:#fbbf24;font:700 14px/36px var(--ds-font-family-code,monospace);letter-spacing:.12em;text-align:center;overflow:hidden;}.dkan-stuck-code::after{content:'';position:absolute;inset:0;background:linear-gradient(90deg,transparent,color-mix(in srgb,#fef3c7 70%,transparent),transparent);transform:translateX(-110%);animation:dkan-stuck-scan 1.25s linear infinite;}.dkan-stuck-code i{display:inline-block;width:7px;height:7px;margin-right:8px;border-radius:50%;background:#f59e0b;box-shadow:0 0 9px #f59e0b;animation:dkan-stuck-pulse .8s ease-in-out infinite alternate;}.dkan-space-stuck strong{position:absolute;left:0;right:0;top:108px;color:var(--dsw-alias-label-primary);font:650 13px/1.2 var(--ds-font-family,system-ui,sans-serif);text-align:center;}.dkan-space-stuck small{position:absolute;left:18px;right:18px;top:128px;color:var(--dsw-alias-label-secondary);font:11px/1.25 var(--ds-font-family,system-ui,sans-serif);text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}@keyframes dkan-stuck-scan{to{transform:translateX(110%)}}@keyframes dkan-stuck-pulse{to{transform:scale(.55);opacity:.45}}",
5161
3549
  // 极光:顶部柔光带呼吸流动(加浓)
5162
3550
  ".dkan-aurora i{position:absolute;top:-40%;left:-20%;width:70%;height:80%;border-radius:50%;filter:blur(50px);opacity:.32;animation:dkan-aurora ease-in-out infinite alternate;}",
5163
3551
  ".dkan-aurora i:nth-child(1){background:#4d9fff;}",
5164
3552
  ".dkan-aurora i:nth-child(2){background:#34d399;left:20%;animation-delay:-2s;}",
5165
3553
  ".dkan-aurora i:nth-child(3){background:#a78bfa;left:55%;animation-delay:-4s;}",
5166
3554
  "@keyframes dkan-aurora{0%{transform:translateX(-8%) scaleY(1)}100%{transform:translateX(10%) scaleY(1.3)}}",
3555
+ // 星云潮汐:无动态模糊,柔边由径向渐变生成,移动只发生在合成层。
3556
+ ".dkan-nebula{contain:strict}.dkan-nebula i{position:absolute;width:48vw;aspect-ratio:1;border-radius:50%;opacity:.22;background:radial-gradient(circle,color-mix(in srgb,var(--dkan-phase,#60a5fa) 48%,transparent),color-mix(in srgb,#8b5cf6 18%,transparent) 42%,transparent 70%);animation:dkan-nebula-drift calc(18s / var(--dkan-speed,1)) cubic-bezier(.45,0,.55,1) infinite alternate;will-change:transform,opacity}.dkan-nebula i:nth-child(1){left:-18%;top:-24%}.dkan-nebula i:nth-child(2){right:-18%;top:4%;background:radial-gradient(circle,color-mix(in srgb,#22d3ee 34%,transparent),color-mix(in srgb,#3b82f6 15%,transparent) 45%,transparent 72%);animation-delay:-5s}.dkan-nebula i:nth-child(3){left:4%;bottom:-34%;background:radial-gradient(circle,color-mix(in srgb,#f472b6 28%,transparent),color-mix(in srgb,#8b5cf6 14%,transparent) 48%,transparent 72%);animation-delay:-10s}.dkan-nebula i:nth-child(4){right:8%;bottom:-26%;width:36vw;animation-delay:-14s}",
3557
+ "@keyframes dkan-nebula-drift{0%{opacity:.14;transform:translate3d(-3vw,-2vh,0) scale(.92)}100%{opacity:.3;transform:translate3d(5vw,4vh,0) scale(1.12)}}",
3558
+ // 曲速航道:从视口中心放射的独立光束。
3559
+ ".dkan-warp{background:radial-gradient(circle at center,color-mix(in srgb,var(--dkan-phase,#60a5fa) 10%,transparent),transparent 34%);contain:strict}.dkan-warp i{position:absolute;left:50%;top:50%;width:var(--len);height:1px;border-radius:999px;transform-origin:left center;background:linear-gradient(90deg,transparent,color-mix(in srgb,var(--dkan-phase,#60a5fa) 48%,transparent),#e0f2fe);opacity:0;animation-name:dkan-warp-ray;animation-timing-function:cubic-bezier(.3,.1,.8,1);animation-iteration-count:infinite;will-change:transform,opacity}",
3560
+ "@keyframes dkan-warp-ray{0%{opacity:0;transform:rotate(var(--a)) translate3d(18px,0,0) scaleX(.05)}18%{opacity:.6}100%{opacity:0;transform:rotate(var(--a)) translate3d(58vw,0,0) scaleX(1.55)}}",
3561
+ // 量子雷达:三个边缘站点各自扫描,避免占据会话正文中心。
3562
+ ".dkan-radar{contain:strict}.dkan-radar-station{position:absolute;width:176px;height:176px;border-radius:50%;opacity:.44;background:repeating-radial-gradient(circle,color-mix(in srgb,var(--dkan-phase,#60a5fa) 28%,transparent) 0 1px,transparent 1px 29px);border:1px solid color-mix(in srgb,var(--dkan-phase,#60a5fa) 22%,transparent)}.dkan-radar-station.a{right:4%;top:8%}.dkan-radar-station.b{left:1%;top:38%;transform:scale(.72)}.dkan-radar-station.c{right:7%;bottom:9%;transform:scale(.58)}.dkan-radar-station i{position:absolute;inset:0;border-radius:50%;background:conic-gradient(from 0deg,transparent 0 76%,color-mix(in srgb,var(--dkan-phase,#60a5fa) 44%,transparent) 92%,transparent);animation:dkan-radar-sweep calc(4.8s / var(--dkan-speed,1)) linear infinite;will-change:transform}.dkan-radar-station b{position:absolute;left:67%;top:31%;width:7px;height:7px;border-radius:50%;background:var(--dkan-phase,#60a5fa);box-shadow:0 0 12px 4px color-mix(in srgb,var(--dkan-phase,#60a5fa) 58%,transparent);animation:dkan-radar-blip calc(2.4s / var(--dkan-speed,1)) ease-in-out infinite}",
3563
+ "@keyframes dkan-radar-sweep{to{transform:rotate(360deg)}}@keyframes dkan-radar-blip{0%,70%,100%{opacity:.15;transform:scale(.65)}78%{opacity:1;transform:scale(1.25)}}",
3564
+ // 星座网络:轻量 SVG 线网分段点亮。
3565
+ ".dkan-constellation svg{position:absolute;left:8%;top:7%;width:86%;height:78%;overflow:visible}.dkan-constellation path{fill:none;stroke:color-mix(in srgb,var(--dkan-phase,#60a5fa) 42%,transparent);stroke-width:.16;vector-effect:non-scaling-stroke;stroke-dasharray:.08 .025;animation:dkan-constellation-line calc(7s / var(--dkan-speed,1)) linear infinite}.dkan-constellation circle{fill:var(--dkan-phase,#60a5fa);filter:drop-shadow(0 0 2px var(--dkan-phase,#60a5fa));animation:dkan-constellation-star calc(2.8s / var(--dkan-speed,1)) ease-in-out infinite alternate;transform-box:fill-box;transform-origin:center}",
3566
+ "@keyframes dkan-constellation-line{to{stroke-dashoffset:-1}}@keyframes dkan-constellation-star{0%{opacity:.28;transform:scale(.68)}100%{opacity:.92;transform:scale(1.22)}}",
3567
+ // 数据萤火:二维漂移和明暗呼吸组合在同一个 transform 动画中。
3568
+ ".dkan-fireflies{contain:strict}.dkan-fireflies i{position:absolute;border-radius:50%;background:color-mix(in srgb,var(--dkan-phase,#60a5fa) 78%,#fff);box-shadow:0 0 8px 2px color-mix(in srgb,var(--dkan-phase,#60a5fa) 46%,transparent);opacity:.2;animation-name:dkan-firefly;animation-timing-function:cubic-bezier(.45,0,.55,1);animation-iteration-count:infinite;animation-direction:alternate;will-change:transform,opacity}",
3569
+ "@keyframes dkan-firefly{0%{opacity:.12;transform:translate3d(0,0,0) scale(.65)}48%{opacity:.86}100%{opacity:.26;transform:translate3d(var(--dx),var(--dy),0) scale(1.18)}}",
3570
+ // 深海脉动:波层在底部横向漂移,气泡只做向上合成位移。
3571
+ ".dkan-ocean{background:linear-gradient(0deg,color-mix(in srgb,#0284c7 12%,transparent),transparent 46%);contain:strict}.dkan-ocean-waves{position:absolute;left:-12%;right:-12%;bottom:0;height:42%}.dkan-ocean-waves i{position:absolute;left:0;width:112%;height:52%;border-top:1px solid color-mix(in srgb,#67e8f9 28%,transparent);border-radius:50%;animation:dkan-ocean-wave calc(9s / var(--dkan-speed,1)) ease-in-out infinite alternate;will-change:transform}.dkan-ocean-waves i:nth-child(1){top:2%}.dkan-ocean-waves i:nth-child(2){top:18%;animation-delay:-2s}.dkan-ocean-waves i:nth-child(3){top:34%;animation-delay:-4s}.dkan-ocean-waves i:nth-child(4){top:50%;animation-delay:-6s}.dkan-ocean-waves i:nth-child(5){top:66%;animation-delay:-8s}.dkan-ocean>b{position:absolute;bottom:-20px;border:1px solid color-mix(in srgb,#a5f3fc 54%,transparent);border-radius:50%;opacity:0;animation-name:dkan-ocean-bubble;animation-timing-function:linear;animation-iteration-count:infinite;will-change:transform,opacity}",
3572
+ "@keyframes dkan-ocean-wave{to{transform:translate3d(7%,5px,0) scaleY(1.08)}}@keyframes dkan-ocean-bubble{0%{opacity:0;transform:translate3d(0,0,0) scale(.7)}14%{opacity:.58}100%{opacity:0;transform:translate3d(var(--drift),-82vh,0) scale(1.18)}}",
3573
+ // 棱镜光谱:七条低透明度光带错峰穿过视口。
3574
+ ".dkan-prism{contain:strict}.dkan-prism i{position:absolute;left:-32vw;width:160vw;height:2px;border-radius:999px;opacity:0;background:linear-gradient(90deg,transparent,#ef4444,#f59e0b,#facc15,#22c55e,#22d3ee,#6366f1,#a855f7,transparent);animation:dkan-prism-ray calc(8s / var(--dkan-speed,1)) cubic-bezier(.45,0,.55,1) infinite;will-change:transform,opacity}.dkan-prism i:nth-child(1){top:12%;animation-delay:0s}.dkan-prism i:nth-child(2){top:25%;animation-delay:-1.1s}.dkan-prism i:nth-child(3){top:38%;animation-delay:-2.2s}.dkan-prism i:nth-child(4){top:51%;animation-delay:-3.3s}.dkan-prism i:nth-child(5){top:64%;animation-delay:-4.4s}.dkan-prism i:nth-child(6){top:77%;animation-delay:-5.5s}.dkan-prism i:nth-child(7){top:90%;animation-delay:-6.6s}",
3575
+ "@keyframes dkan-prism-ray{0%{opacity:0;transform:translate3d(-12vw,0,0) rotate(-7deg) scaleX(.7)}34%{opacity:.2}66%{opacity:.36}100%{opacity:0;transform:translate3d(20vw,0,0) rotate(-7deg) scaleX(1.05)}}",
3576
+ // 神经电路:少量 SVG 路径的虚线脉冲,节点保持低透明度。
3577
+ ".dkan-circuit svg{position:absolute;inset:5% 3% 9% 8%;width:89%;height:86%;overflow:visible}.dkan-circuit path{fill:none;stroke:color-mix(in srgb,var(--dkan-phase,#60a5fa) 40%,transparent);stroke-width:1.2;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:.045 .12;animation:dkan-circuit-pulse calc(5.6s / var(--dkan-speed,1)) linear infinite}.dkan-circuit circle{fill:var(--dkan-phase,#60a5fa);opacity:.58;filter:drop-shadow(0 0 4px var(--dkan-phase,#60a5fa));animation:dkan-circuit-node calc(2.2s / var(--dkan-speed,1)) ease-in-out infinite alternate}",
3578
+ "@keyframes dkan-circuit-pulse{to{stroke-dashoffset:-1}}@keyframes dkan-circuit-node{to{opacity:.16}}",
3579
+ // 引力涟漪:三个边缘引力源按错峰节奏扩散。
3580
+ ".dkan-gravity{contain:strict}.dkan-gravity-source{position:absolute;width:260px;height:260px}.dkan-gravity-source.a{right:2%;top:5%}.dkan-gravity-source.b{left:-4%;top:39%;transform:scale(.76)}.dkan-gravity-source.c{right:17%;bottom:-10%;transform:scale(.62)}.dkan-gravity-source b{position:absolute;left:50%;top:50%;width:12px;height:12px;margin:-6px;border-radius:50%;background:var(--dkan-phase,#60a5fa);box-shadow:0 0 16px 5px color-mix(in srgb,var(--dkan-phase,#60a5fa) 42%,transparent)}.dkan-gravity-source i{position:absolute;left:50%;top:50%;width:26px;height:26px;margin:-13px;border:1px solid color-mix(in srgb,var(--dkan-phase,#60a5fa) 42%,transparent);border-radius:50%;opacity:0;animation:dkan-gravity-wave calc(4.6s / var(--dkan-speed,1)) cubic-bezier(.2,.55,.35,1) infinite;will-change:transform,opacity}",
3581
+ "@keyframes dkan-gravity-wave{0%{opacity:.64;transform:scale(.3)}100%{opacity:0;transform:scale(9)}}",
3582
+ // 灵感天灯:暖色灯体从屏幕底部缓慢升起,尾迹由伪元素提供。
3583
+ ".dkan-lantern{contain:strict}.dkan-lantern i{position:absolute;bottom:-30px;border-radius:45% 45% 34% 34%;background:linear-gradient(150deg,#fff7c2 0%,#fbbf24 46%,#f97316 100%);box-shadow:0 0 10px 3px color-mix(in srgb,#fbbf24 36%,transparent);opacity:0;animation-name:dkan-lantern-rise;animation-timing-function:cubic-bezier(.34,.02,.6,1);animation-iteration-count:infinite;will-change:transform,opacity}.dkan-lantern i::after{content:'';position:absolute;left:42%;top:100%;width:16%;height:13px;background:linear-gradient(#f59e0b,transparent)}",
3584
+ "@keyframes dkan-lantern-rise{0%{opacity:0;transform:translate3d(0,0,0) rotate(-3deg) scale(.72)}12%{opacity:.72}78%{opacity:.48}100%{opacity:0;transform:translate3d(var(--drift),-104vh,0) rotate(4deg) scale(1.04)}}",
5167
3585
  // ===== 交互反馈层 =====
5168
3586
  ".dkan-fxwrap{position:fixed;inset:0;z-index:9992;pointer-events:none;overflow:hidden;}",
5169
3587
  ".dkan-fx{position:absolute;}",
@@ -5269,11 +3687,24 @@ var css2 = [
5269
3687
  ".dkan-prev-stars i:nth-child(5){left:28%;top:70%;animation-delay:-.6s;}",
5270
3688
  ".dkan-prev-stars i:nth-child(6){left:70%;top:75%;animation-delay:-1s;}",
5271
3689
  "@keyframes dkan-prev-star{0%{opacity:.2}100%{opacity:.9}}",
3690
+ // 预览:星际远征(行星、轨道与飞船)
3691
+ ".dkan-prev-space i{position:absolute;left:49%;top:50%;width:9px;height:9px;border-radius:50%;background:#fbbf24;box-shadow:0 0 6px #fbbf24;}.dkan-prev-space b{position:absolute;left:21%;top:23%;width:15px;height:8px;border:1px solid #93c5fd;border-radius:50%;animation:dkan-prev-space-orbit 2.4s linear infinite;}.dkan-prev-space b::after{content:'';position:absolute;left:-3px;top:0;width:5px;height:5px;border-radius:50%;background:#a78bfa;box-shadow:0 0 4px #a78bfa;}.dkan-prev-space em{position:absolute;left:5%;top:65%;width:19px;height:4px;border-radius:50% 0 0 50%;background:linear-gradient(90deg,#22d3ee,#dbeafe);animation:dkan-prev-space-ship 1.8s linear infinite;}.dkan-prev-space em::after{content:'';position:absolute;right:-7px;top:-3px;border-left:9px solid #93c5fd;border-top:5px solid transparent;border-bottom:5px solid transparent;}.dkan-prev-space{background:radial-gradient(ellipse at 78% 20%,color-mix(in srgb,#6366f1 18%,transparent),transparent 58%);}.dkan-prev-space i,.dkan-prev-space b,.dkan-prev-space em{font-style:normal;}.dkan-prev-space b{transform-origin:34px 11px;}@keyframes dkan-prev-space-orbit{to{transform:rotate(360deg)}}@keyframes dkan-prev-space-ship{to{transform:translateX(105px)}}",
5272
3692
  // 预览:极光(柔光带呼吸)
5273
3693
  ".dkan-prev-aurora i{position:absolute;top:-30%;width:60%;height:120%;border-radius:50%;filter:blur(8px);opacity:.35;animation:dkan-prev-aurora 2.4s ease-in-out infinite alternate;}",
5274
3694
  ".dkan-prev-aurora i:nth-child(1){left:5%;background:#4d9fff;}",
5275
3695
  ".dkan-prev-aurora i:nth-child(2){left:45%;background:#34d399;animation-delay:-1.2s;}",
5276
3696
  "@keyframes dkan-prev-aurora{0%{transform:translateX(-10%)}100%{transform:translateX(15%)}}",
3697
+ // 十种新增模式的缩微预览:复用主体运动语言,但把节点数和振幅压到卡片内。
3698
+ ".dkan-prev-new{--dkan-phase:var(--dsw-alias-accent,#4d9fff)}.dkan-prev-new i{position:absolute;display:block}",
3699
+ ".dkan-prev-nebula i{width:48px;height:48px;border-radius:50%;background:radial-gradient(circle,color-mix(in srgb,var(--dkan-phase) 48%,transparent),transparent 70%);animation:dkan-prev-nebula 3s ease-in-out infinite alternate}.dkan-prev-nebula i:nth-child(1){left:2%;top:-60%}.dkan-prev-nebula i:nth-child(2){right:4%;bottom:-65%;background:radial-gradient(circle,color-mix(in srgb,#a855f7 42%,transparent),transparent 70%);animation-delay:-1.4s}.dkan-prev-nebula i:nth-child(n+3){display:none}@keyframes dkan-prev-nebula{to{transform:translateX(24px) scale(1.18)}}",
3700
+ ".dkan-prev-warp i{left:50%;top:50%;width:36px;height:1px;transform-origin:left;background:linear-gradient(90deg,transparent,var(--dkan-phase),#fff);animation:dkan-prev-warp 1.8s linear infinite;opacity:0}.dkan-prev-warp i:nth-child(1){--a:0deg}.dkan-prev-warp i:nth-child(2){--a:45deg;animation-delay:-.2s}.dkan-prev-warp i:nth-child(3){--a:90deg;animation-delay:-.4s}.dkan-prev-warp i:nth-child(4){--a:135deg;animation-delay:-.6s}.dkan-prev-warp i:nth-child(5){--a:180deg;animation-delay:-.8s}.dkan-prev-warp i:nth-child(6){--a:225deg;animation-delay:-1s}.dkan-prev-warp i:nth-child(7){--a:270deg;animation-delay:-1.2s}.dkan-prev-warp i:nth-child(8){--a:315deg;animation-delay:-1.4s}@keyframes dkan-prev-warp{0%{opacity:0;transform:rotate(var(--a)) translateX(2px) scaleX(.1)}35%{opacity:.8}100%{opacity:0;transform:rotate(var(--a)) translateX(40px) scaleX(1.3)}}",
3701
+ ".dkan-prev-radar i{left:50%;top:50%;width:24px;height:24px;margin:-12px;border:1px solid color-mix(in srgb,var(--dkan-phase) 48%,transparent);border-radius:50%;animation:dkan-prev-radar 2.6s ease-out infinite;opacity:0}.dkan-prev-radar i:nth-child(2){animation-delay:-.85s}.dkan-prev-radar i:nth-child(3){animation-delay:-1.7s}.dkan-prev-radar i:nth-child(n+4){display:none}@keyframes dkan-prev-radar{0%{opacity:.8;transform:scale(.2)}100%{opacity:0;transform:scale(1.25)}}",
3702
+ ".dkan-prev-constellation::after{content:'';position:absolute;left:12%;right:12%;top:50%;height:1px;background:linear-gradient(90deg,transparent,var(--dkan-phase),transparent);transform:rotate(-9deg)}.dkan-prev-constellation i,.dkan-prev-fireflies i{width:4px;height:4px;border-radius:50%;background:var(--dkan-phase);box-shadow:0 0 5px var(--dkan-phase);animation:dkan-prev-twinkle 1.8s ease-in-out infinite alternate}.dkan-prev-constellation i:nth-child(1),.dkan-prev-fireflies i:nth-child(1){left:12%;top:62%}.dkan-prev-constellation i:nth-child(2),.dkan-prev-fireflies i:nth-child(2){left:28%;top:26%;animation-delay:-.3s}.dkan-prev-constellation i:nth-child(3),.dkan-prev-fireflies i:nth-child(3){left:45%;top:52%;animation-delay:-.6s}.dkan-prev-constellation i:nth-child(4),.dkan-prev-fireflies i:nth-child(4){left:61%;top:18%;animation-delay:-.9s}.dkan-prev-constellation i:nth-child(5),.dkan-prev-fireflies i:nth-child(5){left:76%;top:58%;animation-delay:-1.2s}.dkan-prev-constellation i:nth-child(6),.dkan-prev-fireflies i:nth-child(6){left:88%;top:34%;animation-delay:-1.5s}@keyframes dkan-prev-twinkle{to{opacity:.2;transform:translateY(4px) scale(.65)}}",
3703
+ ".dkan-prev-ocean i{left:-10%;width:120%;height:18px;border-top:1px solid color-mix(in srgb,#22d3ee 52%,transparent);border-radius:50%;animation:dkan-prev-wave 2.8s ease-in-out infinite alternate}.dkan-prev-ocean i:nth-child(1){top:15%}.dkan-prev-ocean i:nth-child(2){top:35%;animation-delay:-.5s}.dkan-prev-ocean i:nth-child(3){top:55%;animation-delay:-1s}.dkan-prev-ocean i:nth-child(4){top:75%;animation-delay:-1.5s}.dkan-prev-ocean i:nth-child(n+5){display:none}@keyframes dkan-prev-wave{to{transform:translateX(12px) scaleY(1.2)}}",
3704
+ ".dkan-prev-prism i{left:-10%;width:120%;height:1px;background:linear-gradient(90deg,transparent,#ef4444,#fbbf24,#22c55e,#22d3ee,#8b5cf6,transparent);transform:rotate(-6deg);animation:dkan-prev-prism 2.8s ease-in-out infinite}.dkan-prev-prism i:nth-child(1){top:18%}.dkan-prev-prism i:nth-child(2){top:34%;animation-delay:-.4s}.dkan-prev-prism i:nth-child(3){top:50%;animation-delay:-.8s}.dkan-prev-prism i:nth-child(4){top:66%;animation-delay:-1.2s}.dkan-prev-prism i:nth-child(5){top:82%;animation-delay:-1.6s}.dkan-prev-prism i:nth-child(n+6){display:none}@keyframes dkan-prev-prism{0%,100%{opacity:.12;transform:translateX(-8px) rotate(-6deg)}50%{opacity:.72;transform:translateX(10px) rotate(-6deg)}}",
3705
+ ".dkan-prev-circuit i{height:1px;background:var(--dkan-phase);box-shadow:0 0 4px var(--dkan-phase);animation:dkan-prev-circuit 2.4s linear infinite}.dkan-prev-circuit i:nth-child(1){left:5%;top:30%;width:42%}.dkan-prev-circuit i:nth-child(2){left:47%;top:30%;width:1px;height:45%}.dkan-prev-circuit i:nth-child(3){left:47%;top:74%;width:38%}.dkan-prev-circuit i:nth-child(4){left:68%;top:15%;width:1px;height:60%}.dkan-prev-circuit i:nth-child(5){left:68%;top:15%;width:26%}.dkan-prev-circuit i:nth-child(6){left:12%;top:62%;width:35%}@keyframes dkan-prev-circuit{0%,100%{opacity:.18}50%{opacity:.9}}",
3706
+ ".dkan-prev-gravity i{left:50%;top:50%;width:18px;height:18px;margin:-9px;border:1px solid var(--dkan-phase);border-radius:50%;opacity:0;animation:dkan-prev-gravity 2.6s ease-out infinite}.dkan-prev-gravity i:nth-child(2){animation-delay:-.65s}.dkan-prev-gravity i:nth-child(3){animation-delay:-1.3s}.dkan-prev-gravity i:nth-child(4){animation-delay:-1.95s}.dkan-prev-gravity i:nth-child(n+5){display:none}@keyframes dkan-prev-gravity{0%{opacity:.8;transform:scale(.15)}100%{opacity:0;transform:scale(2.4)}}",
3707
+ ".dkan-prev-lantern i{bottom:-8px;width:6px;height:8px;border-radius:3px;background:#fbbf24;box-shadow:0 0 5px #f59e0b;animation:dkan-prev-lantern 3.2s linear infinite}.dkan-prev-lantern i:nth-child(1){left:12%}.dkan-prev-lantern i:nth-child(2){left:27%;animation-delay:-.6s}.dkan-prev-lantern i:nth-child(3){left:43%;animation-delay:-1.2s}.dkan-prev-lantern i:nth-child(4){left:61%;animation-delay:-1.8s}.dkan-prev-lantern i:nth-child(5){left:76%;animation-delay:-2.4s}.dkan-prev-lantern i:nth-child(6){left:90%;animation-delay:-2.8s}@keyframes dkan-prev-lantern{0%{opacity:0;transform:translateY(0)}20%{opacity:.9}100%{opacity:0;transform:translateY(-38px)}}",
5277
3708
  ".dkan-prev-bot{height:92px;justify-content:center;}",
5278
3709
  ".dkan-prev-bot .dkan-bot-scene{--dkan-bot-scale:1;transform:scale(.56);transform-origin:center;}",
5279
3710
  // ===== 桌面伙伴:具象人物 + 紧凑双工位(尺寸可调,整卡可拖拽) =====
@@ -5437,7 +3868,7 @@ var css2 = [
5437
3868
  "@keyframes dkan-search-head{0%,28%{transform:var(--dk3-head-turn) rotateZ(1deg)}48%,68%{transform:var(--dk3-head-turn) rotateZ(6deg) translate(1px,1px)}88%,100%{transform:var(--dk3-head-turn) rotateZ(2deg)}}",
5438
3869
  "@keyframes dkan-search-wrist{0%,34%{transform:translateX(-1px)}62%,100%{transform:translateX(1.5px)}}",
5439
3870
  // 减少动态时停止空间位移,保留屏幕亮暗与思考状态的淡入反馈。
5440
- "@media (prefers-reduced-motion:reduce){.dk3-person,.dk3-upper3,.dk3-head3,.dk3-arm3,.dk3-elbow,.dk3-wrist3,.dk3-wheel,.dk3-code,.dk3-search-results{animation:none!important;transition:none!important}.dk3-screen,.dkan-bubble{transition:opacity .2s cubic-bezier(.23,1,.32,1)!important}}",
3871
+ "@media (prefers-reduced-motion:reduce){.dkan-amb *,.dkan-prev *,.dkan-space-system,.dkan-space-dust,.dkan-space-runner,.dkan-delivery,.dkan-departure,.dkan-freighter-engine i,.dkan-stuck-code::after,.dkan-stuck-code i{animation:none!important}.dkan-space-runner,.dkan-departure{display:none}.dkan-delivery{opacity:1;transform:translate3d(var(--dkan-to-x),var(--dkan-to-y),0)}.dkan-delivery-trail{display:none}.dk3-person,.dk3-upper3,.dk3-head3,.dk3-arm3,.dk3-elbow,.dk3-wrist3,.dk3-wheel,.dk3-code,.dk3-search-results{animation:none!important;transition:none!important}.dk3-screen,.dkan-bubble{transition:opacity .2s cubic-bezier(.23,1,.32,1)!important}}",
5441
3872
  // 通知子选项行
5442
3873
  ".dkan-rows-narrow{display:flex;flex-direction:column;gap:6px;}",
5443
3874
  ".dkan-row{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--dsw-alias-label-secondary);flex-wrap:wrap;}",
@@ -5482,466 +3913,16 @@ var feature6 = {
5482
3913
  name: "\u4EFB\u52A1\u52A8\u753B",
5483
3914
  order: 130,
5484
3915
  accent: "#f472b6",
5485
- description: "\u4EFB\u52A1\u8FD0\u884C\u52A8\u753B\uFF08\u6D41\u5149\u7EC6\u7EBF/\u547C\u5438\u5149\u70B9/\u8F68\u9053\u5149\u73AF\uFF09\u4E0E\u5B8C\u6210\u901A\u77E5\uFF0C\u4E24\u7EC4\u5F00\u5173\u72EC\u7ACB\u3001\u914D\u7F6E\u6301\u4E45\u5316",
3916
+ description: "19 \u79CD\u4EFB\u52A1\u8FD0\u884C\u52A8\u753B\u4E0E\u5B8C\u6210\u901A\u77E5\uFF1A\u901F\u5EA6\u968F\u4EFB\u52A1\u6D3B\u52A8\u8054\u52A8\uFF0C\u4E24\u7EC4\u5F00\u5173\u72EC\u7ACB\u3001\u914D\u7F6E\u6301\u4E45\u5316",
5486
3917
  css: css2,
5487
3918
  View: AnimationView,
5488
3919
  HomeStat: AnimationStat,
5489
3920
  Overlay: AnimationOverlay
5490
3921
  };
5491
3922
 
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
-
5942
3923
  // src/client.jsx
5943
- var DOCK_VERSION = "0.7.0";
5944
- var BUILTIN_FEATURES = [feature, feature2, feature3, feature4, feature5, feature6, feature7];
3924
+ var DOCK_VERSION = "0.7.1";
3925
+ var BUILTIN_FEATURES = [feature, feature2, feature3, feature4, feature5, feature6];
5945
3926
  var PLANNED_FEATURES = [];
5946
3927
  var PLANNED_NOTES = {};
5947
3928
  var externalDefs = [];
@@ -6083,17 +4064,29 @@ var SHELL_CSS = [
6083
4064
  // 溢出兼容(两层防护,缺一不可):
6084
4065
  // 1) 宽度上限:宿主 .row 是 flex-wrap:wrap 且换行优先于收缩,chips 一长 tools 整行变宽,
6085
4066
  // 右侧模型选择器/发送键被挤到第二行(左右错位)。宿主 .row 带 container-type:inline-size,
6086
- // 用容器单位 cqw 让上限随输入卡宽度自适应(窄卡少占、宽卡多占);不支持 cqw 的老内核退回固定 280px。
4067
+ // 用容器单位 cqw 让上限随输入卡宽度自适应(窄卡少占、宽卡多占);不支持 cqw 的老内核退回固定值。
4068
+ // 注意:旧上限 min(280px,36cqw) 仍偏宽——标准 780px 输入卡下(.row 内容约 762px),
4069
+ // add 钮(28)+工作区选择器(~214)+chips(280) 已与右侧模型选择器+发送键(~345px)合计超宽,
4070
+ // 即便 chips 未截断 .row 也会换行把模型选择器/发送键挤到第二行。实测把上限收到 189px
4071
+ // (≈25cqw)并使 chips 内距收紧(padding 2px 6px、gap 2px)后,实测 4~6M 用量 + 余额
4072
+ // 两 chip 可完整显示且不再换行;超限时仍被省略号截断,完整值在 title 悬浮提示里。
6087
4073
  // 2) 截断:超限部分用省略号截断(完整数值在 title 悬浮提示里),防 chips 凸出输入卡圆角(悬空)。
6088
- ".dockchip-row{display:inline-flex;align-items:center;gap:4px;min-width:0;flex:0 1 auto;overflow:hidden;max-width:280px;}",
6089
- "@supports (width:1cqw){.dockchip-row{max-width:min(280px,36cqw);}}",
6090
- ".dockchip{display:inline-flex;align-items:center;gap:5px;cursor:pointer;border:none;background:transparent;color:var(--dsw-alias-label-tertiary);border-radius:8px;padding:2px 8px;font-family:inherit;font-size:11px;line-height:18px;white-space:nowrap;min-width:0;overflow:hidden;transition:background .15s var(--ds-ease-in-out),color .15s var(--ds-ease-in-out);}",
4074
+ ".dockchip-row{display:inline-flex;align-items:center;gap:2px;min-width:0;flex:0 1 auto;overflow:hidden;max-width:189px;}",
4075
+ "@supports (width:1cqw){.dockchip-row{max-width:min(189px,25cqw);}}",
4076
+ ".dockchip{display:inline-flex;align-items:center;gap:5px;cursor:pointer;border:none;background:transparent;color:var(--dsw-alias-label-tertiary);border-radius:8px;padding:2px 6px;font-family:inherit;font-size:11px;line-height:18px;white-space:nowrap;min-width:0;overflow:hidden;transition:background .15s var(--ds-ease-in-out),color .15s var(--ds-ease-in-out);}",
6091
4077
  ".dockchip > span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;}",
6092
4078
  ".dockchip:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);}",
6093
4079
  ".dockchip .dockchip-dot{width:6px;height:6px;border-radius:50%;flex:none;}",
6094
4080
  ".dockchip.err{color:var(--dsw-alias-state-error-primary);}"
6095
4081
  ].join("\n");
6096
4082
  var dockCssTag = null;
4083
+ var initialCssSchedule = null;
4084
+ function cancelInitialCssSchedule() {
4085
+ if (!initialCssSchedule || typeof window === "undefined") return;
4086
+ if (initialCssSchedule.type === "idle" && typeof window.cancelIdleCallback === "function") window.cancelIdleCallback(initialCssSchedule.id);
4087
+ if (initialCssSchedule.type === "timer") window.clearTimeout(initialCssSchedule.id);
4088
+ initialCssSchedule = null;
4089
+ }
6097
4090
  function fullDockCss() {
6098
4091
  const parts = [SHELL_CSS];
6099
4092
  for (const f of BUILTIN_FEATURES) if (f.css) parts.push(f.css);
@@ -6102,6 +4095,7 @@ function fullDockCss() {
6102
4095
  }
6103
4096
  function ensureCss() {
6104
4097
  if (typeof document === "undefined") return;
4098
+ cancelInitialCssSchedule();
6105
4099
  try {
6106
4100
  if (!dockCssTag || !dockCssTag.isConnected) {
6107
4101
  if (document.querySelector('style[data-plugin-css="dsh-dock"]')) {
@@ -6117,9 +4111,21 @@ function ensureCss() {
6117
4111
  console.error("[dsh-dock] ensureCss failed:", e && e.message ? e.message : String(e));
6118
4112
  }
6119
4113
  }
4114
+ function scheduleInitialCss() {
4115
+ if (typeof document === "undefined" || initialCssSchedule || dockCssTag && dockCssTag.isConnected) return;
4116
+ const run = () => {
4117
+ initialCssSchedule = null;
4118
+ ensureCss();
4119
+ };
4120
+ if (typeof window !== "undefined" && typeof window.requestIdleCallback === "function") {
4121
+ initialCssSchedule = { type: "idle", id: window.requestIdleCallback(run, { timeout: 350 }) };
4122
+ } else {
4123
+ initialCssSchedule = { type: "timer", id: setTimeout(run, 48) };
4124
+ }
4125
+ }
6120
4126
  function useExternalVersion() {
6121
- const [, bump] = import_react10.default.useReducer((n) => n + 1, 0);
6122
- import_react10.default.useEffect(() => {
4127
+ const [, bump] = import_react9.default.useReducer((n) => n + 1, 0);
4128
+ import_react9.default.useEffect(() => {
6123
4129
  externalListeners.add(bump);
6124
4130
  return () => {
6125
4131
  externalListeners.delete(bump);
@@ -6129,42 +4135,46 @@ function useExternalVersion() {
6129
4135
  var lastGeom = { x: null, y: null, w: null, h: null };
6130
4136
  function DockIcon(props) {
6131
4137
  const size = props && props.size || 16;
6132
- return import_react10.default.createElement(
4138
+ return import_react9.default.createElement(
6133
4139
  "svg",
6134
4140
  { width: size, height: size, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.3, "aria-hidden": true },
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 })
4141
+ import_react9.default.createElement("rect", { x: 2.5, y: 2.5, width: 4.4, height: 4.4, rx: 1.2 }),
4142
+ import_react9.default.createElement("rect", { x: 9, y: 2.5, width: 4.4, height: 4.4, rx: 1.2 }),
4143
+ import_react9.default.createElement("rect", { x: 2.5, y: 9, width: 4.4, height: 4.4, rx: 1.2 }),
4144
+ import_react9.default.createElement("rect", { x: 9, y: 9, width: 4.4, height: 4.4, rx: 1.2 })
6139
4145
  );
6140
4146
  }
6141
4147
  function DockEntry(props) {
6142
4148
  const wide = !!props.wide;
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", {
4149
+ const [open, setOpen] = import_react9.default.useState(panelNav.open);
4150
+ import_react9.default.useEffect(() => subscribePanel(() => setOpen(panelNav.open)), []);
4151
+ return import_react9.default.createElement("button", {
6146
4152
  type: "button",
6147
4153
  className: "docke2-btn" + (open ? " docke2-on" : "") + (wide ? "" : " docke2-rail"),
6148
4154
  title: "\u529F\u80FD\u575E",
6149
4155
  "aria-label": "\u529F\u80FD\u575E",
6150
4156
  "aria-expanded": open,
6151
4157
  onClick: () => setPanelOpen(!open)
6152
- }, import_react10.default.createElement(DockIcon, { size: wide ? 16 : 18 }), wide ? import_react10.default.createElement("span", { className: "docke2-label" }, "\u529F\u80FD\u575E") : null);
4158
+ }, import_react9.default.createElement(DockIcon, { size: wide ? 16 : 18 }), wide ? import_react9.default.createElement("span", { className: "docke2-label" }, "\u529F\u80FD\u575E") : null);
6153
4159
  }
6154
4160
  function DockModal() {
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 })), []);
4161
+ const [nav, setNav] = import_react9.default.useState({ open: panelNav.open, active: panelNav.active, params: panelNav.params });
4162
+ import_react9.default.useEffect(() => subscribePanel(() => setNav({ open: panelNav.open, active: panelNav.active, params: panelNav.params })), []);
6157
4163
  const open = nav.open || typeof document === "undefined";
6158
4164
  const active = nav.active;
6159
4165
  const setActive = navigatePanel;
6160
4166
  const navParams = nav.params;
6161
- const [, force] = import_react10.default.useReducer((n) => n + 1, 0);
4167
+ const [, force] = import_react9.default.useReducer((n) => n + 1, 0);
6162
4168
  useExternalVersion();
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(() => {
4169
+ const [win, setWin] = import_react9.default.useState(() => ({ mode: "normal", x: null, y: null, w: null, h: null }));
4170
+ const dlgRef = import_react9.default.useRef(null);
4171
+ const contentRef = import_react9.default.useRef(null);
4172
+ import_react9.default.useEffect(() => {
6166
4173
  if (lastGeom.w) setWin({ mode: "normal", x: lastGeom.x, y: lastGeom.y, w: lastGeom.w, h: lastGeom.h });
6167
4174
  }, []);
4175
+ import_react9.default.useEffect(() => {
4176
+ if (open && contentRef.current) contentRef.current.scrollTop = 0;
4177
+ }, [active, open]);
6168
4178
  function beginDrag(e, type) {
6169
4179
  if (win.mode !== "normal" || e.button !== 0) return;
6170
4180
  if (type === "move" && e.target && e.target.closest && e.target.closest("button,select,input")) return;
@@ -6200,13 +4210,13 @@ function DockModal() {
6200
4210
  const mod = isHome ? null : MODULES.find((m) => m.id === active) || MODULES[0];
6201
4211
  const st = mod ? stateOf(mod.id) : null;
6202
4212
  const View = mod ? mod.View : null;
6203
- const viewNode = mod && View ? import_react10.default.createElement(
4213
+ const viewNode = mod && View ? import_react9.default.createElement(
6204
4214
  "div",
6205
4215
  { className: "dockm-view" },
6206
- import_react10.default.createElement(
6207
- mod.external ? FeatureBoundary : import_react10.default.Fragment,
4216
+ import_react9.default.createElement(
4217
+ mod.external ? FeatureBoundary : import_react9.default.Fragment,
6208
4218
  null,
6209
- import_react10.default.createElement(View, { ctx: ctxRef.current, feature: mod, params: navParams })
4219
+ import_react9.default.createElement(View, { ctx: ctxRef.current, feature: mod, params: navParams })
6210
4220
  )
6211
4221
  ) : null;
6212
4222
  const enabledCount = MODULES.filter((m) => {
@@ -6220,10 +4230,10 @@ function DockModal() {
6220
4230
  width: win.w != null ? win.w : void 0,
6221
4231
  height: win.mode === "min" ? "auto" : win.h != null ? win.h : void 0
6222
4232
  } : null;
6223
- return import_react10.default.createElement(
4233
+ return import_react9.default.createElement(
6224
4234
  "div",
6225
4235
  { className: "dockm-backdrop", onClick: () => setPanelOpen(false) },
6226
- import_react10.default.createElement(
4236
+ import_react9.default.createElement(
6227
4237
  "div",
6228
4238
  {
6229
4239
  className: "dockm-dialog" + (win.mode === "max" ? " dockm-max" : "") + (win.mode === "min" ? " dockm-min" : ""),
@@ -6231,41 +4241,41 @@ function DockModal() {
6231
4241
  ref: dlgRef,
6232
4242
  onClick: (e) => e.stopPropagation()
6233
4243
  },
6234
- import_react10.default.createElement(
4244
+ import_react9.default.createElement(
6235
4245
  "div",
6236
4246
  {
6237
4247
  className: "dockm-head",
6238
4248
  onPointerDown: (e) => beginDrag(e, "move"),
6239
4249
  onDoubleClick: () => setWin((s) => Object.assign({}, s, { mode: s.mode === "max" ? "normal" : "max" }))
6240
4250
  },
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(
4251
+ import_react9.default.createElement(DockIcon, null),
4252
+ import_react9.default.createElement("span", { className: "dockm-title" }, "\u529F\u80FD\u575E"),
4253
+ 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"),
4254
+ import_react9.default.createElement(
6245
4255
  "span",
6246
4256
  { className: "dockm-ctrls" },
6247
- import_react10.default.createElement("button", {
4257
+ import_react9.default.createElement("button", {
6248
4258
  type: "button",
6249
4259
  className: "dockm-win",
6250
4260
  title: win.mode === "min" ? "\u8FD8\u539F" : "\u6700\u5C0F\u5316",
6251
4261
  onClick: () => setWin((s) => Object.assign({}, s, { mode: s.mode === "min" ? "normal" : "min" }))
6252
4262
  }, "\u2581"),
6253
- import_react10.default.createElement("button", {
4263
+ import_react9.default.createElement("button", {
6254
4264
  type: "button",
6255
4265
  className: "dockm-win",
6256
4266
  title: win.mode === "max" ? "\u8FD8\u539F" : "\u6700\u5927\u5316",
6257
4267
  onClick: () => setWin((s) => Object.assign({}, s, { mode: s.mode === "max" ? "normal" : "max" }))
6258
4268
  }, win.mode === "max" ? "\u2750" : "\u25A2"),
6259
- import_react10.default.createElement("button", { type: "button", className: "dockm-close", "aria-label": "\u5173\u95ED", title: "\u5173\u95ED", onClick: () => setPanelOpen(false) }, "\u2715")
4269
+ import_react9.default.createElement("button", { type: "button", className: "dockm-close", "aria-label": "\u5173\u95ED", title: "\u5173\u95ED", onClick: () => setPanelOpen(false) }, "\u2715")
6260
4270
  )
6261
4271
  ),
6262
- import_react10.default.createElement(
4272
+ import_react9.default.createElement(
6263
4273
  "div",
6264
4274
  { className: "dockm-body" },
6265
- import_react10.default.createElement(
4275
+ import_react9.default.createElement(
6266
4276
  "nav",
6267
4277
  { className: "dockm-nav", "aria-label": "\u529F\u80FD\u6A21\u5757" },
6268
- import_react10.default.createElement(
4278
+ import_react9.default.createElement(
6269
4279
  "button",
6270
4280
  {
6271
4281
  type: "button",
@@ -6273,10 +4283,10 @@ function DockModal() {
6273
4283
  className: "dockm-nav-item" + (isHome ? " on" : ""),
6274
4284
  onClick: () => setActive("home")
6275
4285
  },
6276
- import_react10.default.createElement("span", { className: "dockm-navhome" }, import_react10.default.createElement(DockIcon, null)),
6277
- import_react10.default.createElement("span", null, "\u9996\u9875")
4286
+ import_react9.default.createElement("span", { className: "dockm-navhome" }, import_react9.default.createElement(DockIcon, null)),
4287
+ import_react9.default.createElement("span", null, "\u9996\u9875")
6278
4288
  ),
6279
- MODULES.map((m) => import_react10.default.createElement(
4289
+ MODULES.map((m) => import_react9.default.createElement(
6280
4290
  "button",
6281
4291
  {
6282
4292
  type: "button",
@@ -6284,42 +4294,42 @@ function DockModal() {
6284
4294
  className: "dockm-nav-item" + (m.id === active ? " on" : ""),
6285
4295
  onClick: () => setActive(m.id)
6286
4296
  },
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
4297
+ import_react9.default.createElement("span", { className: "dockm-dot", style: { background: m.accent } }),
4298
+ import_react9.default.createElement("span", null, m.name),
4299
+ m.planned ? import_react9.default.createElement("span", { className: "dockm-badge" }, "\u89C4\u5212\u4E2D") : null,
4300
+ m.external ? import_react9.default.createElement("span", { className: "dockm-badge" }, "\u5916\u90E8") : null
6291
4301
  ))
6292
4302
  ),
6293
- import_react10.default.createElement(
4303
+ import_react9.default.createElement(
6294
4304
  "div",
6295
- { className: "dockm-content" },
6296
- import_react10.default.createElement(
4305
+ { className: "dockm-content", ref: contentRef },
4306
+ import_react9.default.createElement(
6297
4307
  "div",
6298
4308
  { className: "dockm-content-head" },
6299
- import_react10.default.createElement(
4309
+ import_react9.default.createElement(
6300
4310
  "div",
6301
4311
  { className: "dockm-name" },
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 } }),
4312
+ 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 } }),
6303
4313
  isHome ? "\u9996\u9875" : mod.name,
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
4314
+ !isHome && mod.planned ? import_react9.default.createElement("span", { className: "dockm-badge" }, "\u89C4\u5212\u4E2D") : null,
4315
+ !isHome && mod.external ? import_react9.default.createElement("span", { className: "dockm-badge" }, "\u5916\u90E8\u5305" + (mod.package ? " \xB7 " + mod.package : "")) : null
6306
4316
  ),
6307
- import_react10.default.createElement(
4317
+ import_react9.default.createElement(
6308
4318
  "div",
6309
4319
  { className: "dockm-desc" },
6310
4320
  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
6311
4321
  )
6312
4322
  ),
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(
4323
+ 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"),
4324
+ import_react9.default.createElement(
6315
4325
  "div",
6316
4326
  { className: "dockm-foot" },
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(
4327
+ 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"),
4328
+ !isHome && mod && !mod.planned && st ? import_react9.default.createElement(
6319
4329
  "span",
6320
4330
  { className: "dockm-foot-sw" },
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", {
4331
+ import_react9.default.createElement("span", { className: "dockm-foot-swlabel" + (st.enabled ? " on" : "") }, st.enabled ? "\u5DF2\u542F\u7528" : "\u5DF2\u505C\u7528"),
4332
+ import_react9.default.createElement("button", {
6323
4333
  type: "button",
6324
4334
  className: "dock-sw" + (st.enabled ? " on" : ""),
6325
4335
  role: "switch",
@@ -6332,11 +4342,11 @@ function DockModal() {
6332
4342
  }
6333
4343
  })
6334
4344
  ) : null,
6335
- !isHome && mod && typeof mod.Chip === "function" ? import_react10.default.createElement(
4345
+ !isHome && mod && typeof mod.Chip === "function" ? import_react9.default.createElement(
6336
4346
  "span",
6337
4347
  { className: "dockm-foot-sw" },
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", {
4348
+ import_react9.default.createElement("span", { className: "dockm-foot-swlabel" + (chipShown(mod.id) ? " on" : "") }, "\u4F1A\u8BDD\u9875\u5C0F\u63A7\u4EF6"),
4349
+ import_react9.default.createElement("button", {
6340
4350
  type: "button",
6341
4351
  className: "dock-sw" + (chipShown(mod.id) ? " on" : ""),
6342
4352
  role: "switch",
@@ -6352,30 +4362,30 @@ function DockModal() {
6352
4362
  )
6353
4363
  )
6354
4364
  ),
6355
- win.mode === "normal" ? import_react10.default.createElement("div", { className: "dockm-resize", onPointerDown: (e) => beginDrag(e, "size") }) : null
4365
+ win.mode === "normal" ? import_react9.default.createElement("div", { className: "dockm-resize", onPointerDown: (e) => beginDrag(e, "size") }) : null
6356
4366
  )
6357
4367
  );
6358
4368
  }
6359
4369
  function HomeView(props) {
6360
4370
  const ctx = props && props.ctx;
6361
- const [, force] = import_react10.default.useReducer((n) => n + 1, 0);
4371
+ const [, force] = import_react9.default.useReducer((n) => n + 1, 0);
6362
4372
  useExternalVersion();
6363
4373
  const open = (id) => {
6364
4374
  if (props && typeof props.onOpen === "function") props.onOpen(id);
6365
4375
  };
6366
- return import_react10.default.createElement(
4376
+ return import_react9.default.createElement(
6367
4377
  "div",
6368
4378
  { className: "dockh-grid" },
6369
4379
  allModules().map((m) => {
6370
4380
  const st = stateOf(m.id);
6371
4381
  const enabled = !!(st && st.enabled);
6372
4382
  const Stat = m.HomeStat;
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,
4383
+ 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(
4384
+ m.external ? FeatureBoundary : import_react9.default.Fragment,
6375
4385
  null,
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(
4386
+ import_react9.default.createElement(Stat, { ctx })
4387
+ ) : import_react9.default.createElement("span", null, "\u5DF2\u505C\u7528\uFF0C\u542F\u7528\u540E\u5728\u6B64\u5C55\u793A\u8FD0\u884C\u6982\u8981");
4388
+ return import_react9.default.createElement(
6379
4389
  "div",
6380
4390
  {
6381
4391
  key: m.id,
@@ -6390,21 +4400,21 @@ function HomeView(props) {
6390
4400
  }
6391
4401
  }
6392
4402
  },
6393
- import_react10.default.createElement(
4403
+ import_react9.default.createElement(
6394
4404
  "div",
6395
4405
  { className: "dockh-head" },
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,
4406
+ import_react9.default.createElement("span", { className: "dockm-dot", style: { background: m.accent } }),
4407
+ import_react9.default.createElement("span", { className: "dockh-name" }, m.name),
4408
+ m.external ? import_react9.default.createElement("span", { className: "dockh-badge", title: m.package || void 0 }, "\u5916\u90E8") : null,
6399
4409
  // 状态标识:圆点 + 文字(纯展示,与开关视觉区分)
6400
- import_react10.default.createElement(
4410
+ import_react9.default.createElement(
6401
4411
  "span",
6402
4412
  { className: "dockh-status" + (m.planned ? " plan" : enabled ? "" : " off") },
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")
4413
+ import_react9.default.createElement("span", { className: "dockh-sdot" }),
4414
+ import_react9.default.createElement("span", null, m.planned ? "\u89C4\u5212\u4E2D" : enabled ? "\u8FD0\u884C\u4E2D" : "\u5DF2\u505C\u7528")
6405
4415
  ),
6406
4416
  // 启停开关(规划中的功能不显示)
6407
- m.planned ? null : import_react10.default.createElement("button", {
4417
+ m.planned ? null : import_react9.default.createElement("button", {
6408
4418
  type: "button",
6409
4419
  className: "dock-sw" + (enabled ? " on" : ""),
6410
4420
  role: "switch",
@@ -6419,12 +4429,12 @@ function HomeView(props) {
6419
4429
  }
6420
4430
  })
6421
4431
  ),
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(
4432
+ import_react9.default.createElement("div", { className: "dockh-desc" }, m.description),
4433
+ import_react9.default.createElement("div", { className: "dockh-stat" }, statNode),
4434
+ import_react9.default.createElement(
6425
4435
  "div",
6426
4436
  { className: "dockh-foot" },
6427
- import_react10.default.createElement("span", { className: "dockh-go" }, "\u67E5\u770B\u8BE6\u60C5 \u2192")
4437
+ import_react9.default.createElement("span", { className: "dockh-go" }, "\u67E5\u770B\u8BE6\u60C5 \u2192")
6428
4438
  )
6429
4439
  );
6430
4440
  })
@@ -6432,16 +4442,16 @@ function HomeView(props) {
6432
4442
  }
6433
4443
  function DockPanel() {
6434
4444
  const ctx = ctxRef.current;
6435
- const [, force] = import_react10.default.useReducer((n) => n + 1, 0);
4445
+ const [, force] = import_react9.default.useReducer((n) => n + 1, 0);
6436
4446
  useExternalVersion();
6437
4447
  const toggle = (id) => {
6438
4448
  toggleFeature(id);
6439
4449
  force();
6440
4450
  };
6441
- return import_react10.default.createElement(
4451
+ return import_react9.default.createElement(
6442
4452
  "div",
6443
4453
  { className: "dock-root" },
6444
- import_react10.default.createElement(
4454
+ import_react9.default.createElement(
6445
4455
  "div",
6446
4456
  { className: "dock-intro" },
6447
4457
  "\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",
@@ -6450,25 +4460,25 @@ function DockPanel() {
6450
4460
  allModules().map((f) => {
6451
4461
  const st = stateOf(f.id);
6452
4462
  const View = f.View;
6453
- const viewNode = !f.planned && st.enabled && View ? import_react10.default.createElement(
4463
+ const viewNode = !f.planned && st.enabled && View ? import_react9.default.createElement(
6454
4464
  "div",
6455
4465
  { className: "dock-body" },
6456
- import_react10.default.createElement(
6457
- f.external ? FeatureBoundary : import_react10.default.Fragment,
4466
+ import_react9.default.createElement(
4467
+ f.external ? FeatureBoundary : import_react9.default.Fragment,
6458
4468
  null,
6459
- import_react10.default.createElement(View, { ctx, feature: f })
4469
+ import_react9.default.createElement(View, { ctx, feature: f })
6460
4470
  )
6461
4471
  ) : null;
6462
- return import_react10.default.createElement(
4472
+ return import_react9.default.createElement(
6463
4473
  "div",
6464
4474
  { className: "dock-card", key: f.id },
6465
- import_react10.default.createElement(
4475
+ import_react9.default.createElement(
6466
4476
  "div",
6467
4477
  { className: "dock-card-head" },
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", {
4478
+ import_react9.default.createElement("span", { className: "dock-dot" + (st.error ? " err" : st.enabled ? " on" : "") }),
4479
+ import_react9.default.createElement("span", { className: "dock-name" }, f.name),
4480
+ import_react9.default.createElement("span", { className: "dock-desc" }, f.description + (f.external ? "\uFF08\u6765\u81EA\u5916\u90E8\u5305" + (f.package ? " " + f.package : "") + "\uFF09" : "")),
4481
+ f.planned ? import_react9.default.createElement("span", { className: "dock-badge" }, "\u89C4\u5212\u4E2D") : import_react9.default.createElement("button", {
6472
4482
  type: "button",
6473
4483
  className: "dock-sw" + (st.enabled ? " on" : ""),
6474
4484
  role: "switch",
@@ -6477,11 +4487,11 @@ function DockPanel() {
6477
4487
  title: st.enabled ? "\u505C\u7528\u300C" + f.name + "\u300D" : "\u542F\u7528\u300C" + f.name + "\u300D",
6478
4488
  onClick: () => toggle(f.id)
6479
4489
  }),
6480
- !f.planned && typeof f.Chip === "function" ? import_react10.default.createElement(
4490
+ !f.planned && typeof f.Chip === "function" ? import_react9.default.createElement(
6481
4491
  "span",
6482
4492
  { className: "dockm-foot-sw" },
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", {
4493
+ import_react9.default.createElement("span", { className: "dockm-foot-swlabel" + (chipShown(f.id) ? " on" : "") }, "\u4F1A\u8BDD\u9875\u5C0F\u63A7\u4EF6"),
4494
+ import_react9.default.createElement("button", {
6485
4495
  type: "button",
6486
4496
  className: "dock-sw" + (chipShown(f.id) ? " on" : ""),
6487
4497
  role: "switch",
@@ -6495,19 +4505,19 @@ function DockPanel() {
6495
4505
  })
6496
4506
  ) : null
6497
4507
  ),
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,
4508
+ 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,
6499
4509
  viewNode
6500
4510
  );
6501
4511
  })
6502
4512
  );
6503
4513
  }
6504
4514
  function DockChips(props) {
6505
- const [, force] = import_react10.default.useReducer((n) => n + 1, 0);
6506
- import_react10.default.useEffect(() => subscribeFeatureState(() => force()), []);
4515
+ const [, force] = import_react9.default.useReducer((n) => n + 1, 0);
4516
+ import_react9.default.useEffect(() => subscribeFeatureState(() => force()), []);
6507
4517
  const items = [];
6508
4518
  for (const f of allModules()) {
6509
4519
  if (f.planned || !stateOf(f.id).enabled || !chipShown(f.id) || typeof f.Chip !== "function") continue;
6510
- items.push(import_react10.default.createElement(f.Chip, {
4520
+ items.push(import_react9.default.createElement(f.Chip, {
6511
4521
  key: f.id,
6512
4522
  ctx: props.ctx,
6513
4523
  feature: f,
@@ -6517,65 +4527,51 @@ function DockChips(props) {
6517
4527
  }));
6518
4528
  }
6519
4529
  if (items.length === 0) return null;
6520
- return import_react10.default.createElement("div", { className: "dockchip-row" }, items);
4530
+ return import_react9.default.createElement("div", { className: "dockchip-row" }, items);
6521
4531
  }
6522
4532
  function FeatureOverlays() {
6523
- const [, force] = import_react10.default.useReducer((n) => n + 1, 0);
4533
+ const [, force] = import_react9.default.useReducer((n) => n + 1, 0);
6524
4534
  useExternalVersion();
6525
- import_react10.default.useEffect(() => subscribeFeatureState(() => force()), []);
4535
+ import_react9.default.useEffect(() => subscribeFeatureState(() => force()), []);
6526
4536
  const items = [];
6527
4537
  for (const f of allModules()) {
6528
4538
  if (f.planned || !stateOf(f.id).enabled || typeof f.Overlay !== "function") continue;
6529
- items.push(import_react10.default.createElement(
4539
+ items.push(import_react9.default.createElement(
6530
4540
  FeatureBoundary,
6531
4541
  { key: f.id },
6532
- import_react10.default.createElement(f.Overlay, { ctx: ctxRef.current, feature: f })
4542
+ import_react9.default.createElement(f.Overlay, { ctx: ctxRef.current, feature: f })
6533
4543
  ));
6534
4544
  }
6535
4545
  if (items.length === 0) return null;
6536
- return import_react10.default.createElement(import_react10.default.Fragment, null, items);
4546
+ return import_react9.default.createElement(import_react9.default.Fragment, null, items);
6537
4547
  }
6538
4548
  var ctxRef = { current: null };
6539
4549
  function apply(ctx) {
6540
4550
  ctxRef.current = ctx;
6541
- ensureCss();
4551
+ scheduleInitialCss();
6542
4552
  initFeatureState(BUILTIN_FEATURES.concat(PLANNED_FEATURES));
6543
4553
  const slots = ctx.get("slots");
6544
4554
  if (slots === void 0) return;
6545
4555
  slots.inject("sidebar.footer.action", () => slots.register(
6546
4556
  { name: "sidebar.footer.action", id: "dsh-dock", order: 1, label: "\u529F\u80FD\u575E" },
6547
- (props) => import_react10.default.createElement(DockEntry, props)
4557
+ (props) => import_react9.default.createElement(DockEntry, props)
6548
4558
  ));
6549
4559
  slots.inject("shell.overlay", () => slots.register(
6550
4560
  { name: "shell.overlay", id: "dsh-dock-panel", order: 21, label: "\u529F\u80FD\u575E\u9762\u677F" },
6551
- () => import_react10.default.createElement(DockModal, null)
4561
+ () => import_react9.default.createElement(DockModal, null)
6552
4562
  ));
6553
4563
  slots.inject("shell.overlay", () => slots.register(
6554
4564
  { name: "shell.overlay", id: "dsh-dock-feature-overlays", order: 22, label: "\u529F\u80FD\u575E\u5168\u5C40\u6D6E\u5C42" },
6555
- () => import_react10.default.createElement(FeatureOverlays, null)
4565
+ () => import_react9.default.createElement(FeatureOverlays, null)
6556
4566
  ));
6557
4567
  slots.inject("settings.section", () => slots.register(
6558
4568
  { name: "settings.section", id: "dsh-dock", order: 90, label: "\u529F\u80FD\u575E" },
6559
- () => import_react10.default.createElement(DockPanel, null)
4569
+ () => import_react9.default.createElement(DockPanel, null)
6560
4570
  ));
6561
4571
  slots.inject("conversation.input.left", () => slots.register(
6562
4572
  { name: "conversation.input.left", id: "dsh-dock-chips", order: 10, label: "\u529F\u80FD\u575E" },
6563
- (zone) => import_react10.default.createElement(DockChips, Object.assign({}, zone, { ctx: ctxRef.current }))
4573
+ (zone) => import_react9.default.createElement(DockChips, Object.assign({}, zone, { ctx: ctxRef.current }))
6564
4574
  ));
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
- }
6579
4575
  }
6580
4576
  var inject = ["timer"];
6581
4577