aoi-comp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +187 -0
- package/dist/BufferResource-CVU-ZRRz.js +273 -0
- package/dist/CanvasPool-C3aVgvEX.js +30 -0
- package/dist/CanvasRenderer-CVj7HTkL.js +3460 -0
- package/dist/Geometry-CN7W9DnD.js +3802 -0
- package/dist/RenderTargetSystem-D_FiZPnb.js +2572 -0
- package/dist/WebGLRenderer-CurPxJtF.js +2210 -0
- package/dist/WebGPURenderer-CfiYFIN2.js +1840 -0
- package/dist/browserAll-DqFkNC6q.js +977 -0
- package/dist/canvasUtils-D0KM_fKp.js +168 -0
- package/dist/comps.js +4459 -0
- package/dist/getTextureBatchBindGroup-CLFTP_Vc.js +19 -0
- package/dist/hooks-DByotZq7.js +452 -0
- package/dist/hooks.js +2 -0
- package/dist/index.js +2 -0
- package/dist/init-CIaGzij5.js +446 -0
- package/dist/init-DVXFVLyx.js +878 -0
- package/dist/packages-BbFWPD88.js +4002 -0
- package/dist/rolldown-runtime-CWhphoD1.js +23 -0
- package/dist/style.css +2 -0
- package/dist/utils.js +2 -0
- package/dist/webworkerAll-XSXRmCFC.js +2 -0
- package/package.json +65 -0
|
@@ -0,0 +1,4002 @@
|
|
|
1
|
+
import { i as e, t } from "./rolldown-runtime-CWhphoD1.js";
|
|
2
|
+
import { theme as n } from "antd";
|
|
3
|
+
//#region node_modules/.pnpm/color-name@2.1.1/node_modules/color-name/index.js
|
|
4
|
+
var r = {
|
|
5
|
+
aliceblue: [
|
|
6
|
+
240,
|
|
7
|
+
248,
|
|
8
|
+
255
|
|
9
|
+
],
|
|
10
|
+
antiquewhite: [
|
|
11
|
+
250,
|
|
12
|
+
235,
|
|
13
|
+
215
|
|
14
|
+
],
|
|
15
|
+
aqua: [
|
|
16
|
+
0,
|
|
17
|
+
255,
|
|
18
|
+
255
|
|
19
|
+
],
|
|
20
|
+
aquamarine: [
|
|
21
|
+
127,
|
|
22
|
+
255,
|
|
23
|
+
212
|
|
24
|
+
],
|
|
25
|
+
azure: [
|
|
26
|
+
240,
|
|
27
|
+
255,
|
|
28
|
+
255
|
|
29
|
+
],
|
|
30
|
+
beige: [
|
|
31
|
+
245,
|
|
32
|
+
245,
|
|
33
|
+
220
|
|
34
|
+
],
|
|
35
|
+
bisque: [
|
|
36
|
+
255,
|
|
37
|
+
228,
|
|
38
|
+
196
|
|
39
|
+
],
|
|
40
|
+
black: [
|
|
41
|
+
0,
|
|
42
|
+
0,
|
|
43
|
+
0
|
|
44
|
+
],
|
|
45
|
+
blanchedalmond: [
|
|
46
|
+
255,
|
|
47
|
+
235,
|
|
48
|
+
205
|
|
49
|
+
],
|
|
50
|
+
blue: [
|
|
51
|
+
0,
|
|
52
|
+
0,
|
|
53
|
+
255
|
|
54
|
+
],
|
|
55
|
+
blueviolet: [
|
|
56
|
+
138,
|
|
57
|
+
43,
|
|
58
|
+
226
|
|
59
|
+
],
|
|
60
|
+
brown: [
|
|
61
|
+
165,
|
|
62
|
+
42,
|
|
63
|
+
42
|
|
64
|
+
],
|
|
65
|
+
burlywood: [
|
|
66
|
+
222,
|
|
67
|
+
184,
|
|
68
|
+
135
|
|
69
|
+
],
|
|
70
|
+
cadetblue: [
|
|
71
|
+
95,
|
|
72
|
+
158,
|
|
73
|
+
160
|
|
74
|
+
],
|
|
75
|
+
chartreuse: [
|
|
76
|
+
127,
|
|
77
|
+
255,
|
|
78
|
+
0
|
|
79
|
+
],
|
|
80
|
+
chocolate: [
|
|
81
|
+
210,
|
|
82
|
+
105,
|
|
83
|
+
30
|
|
84
|
+
],
|
|
85
|
+
coral: [
|
|
86
|
+
255,
|
|
87
|
+
127,
|
|
88
|
+
80
|
|
89
|
+
],
|
|
90
|
+
cornflowerblue: [
|
|
91
|
+
100,
|
|
92
|
+
149,
|
|
93
|
+
237
|
|
94
|
+
],
|
|
95
|
+
cornsilk: [
|
|
96
|
+
255,
|
|
97
|
+
248,
|
|
98
|
+
220
|
|
99
|
+
],
|
|
100
|
+
crimson: [
|
|
101
|
+
220,
|
|
102
|
+
20,
|
|
103
|
+
60
|
|
104
|
+
],
|
|
105
|
+
cyan: [
|
|
106
|
+
0,
|
|
107
|
+
255,
|
|
108
|
+
255
|
|
109
|
+
],
|
|
110
|
+
darkblue: [
|
|
111
|
+
0,
|
|
112
|
+
0,
|
|
113
|
+
139
|
|
114
|
+
],
|
|
115
|
+
darkcyan: [
|
|
116
|
+
0,
|
|
117
|
+
139,
|
|
118
|
+
139
|
|
119
|
+
],
|
|
120
|
+
darkgoldenrod: [
|
|
121
|
+
184,
|
|
122
|
+
134,
|
|
123
|
+
11
|
|
124
|
+
],
|
|
125
|
+
darkgray: [
|
|
126
|
+
169,
|
|
127
|
+
169,
|
|
128
|
+
169
|
|
129
|
+
],
|
|
130
|
+
darkgreen: [
|
|
131
|
+
0,
|
|
132
|
+
100,
|
|
133
|
+
0
|
|
134
|
+
],
|
|
135
|
+
darkgrey: [
|
|
136
|
+
169,
|
|
137
|
+
169,
|
|
138
|
+
169
|
|
139
|
+
],
|
|
140
|
+
darkkhaki: [
|
|
141
|
+
189,
|
|
142
|
+
183,
|
|
143
|
+
107
|
|
144
|
+
],
|
|
145
|
+
darkmagenta: [
|
|
146
|
+
139,
|
|
147
|
+
0,
|
|
148
|
+
139
|
|
149
|
+
],
|
|
150
|
+
darkolivegreen: [
|
|
151
|
+
85,
|
|
152
|
+
107,
|
|
153
|
+
47
|
|
154
|
+
],
|
|
155
|
+
darkorange: [
|
|
156
|
+
255,
|
|
157
|
+
140,
|
|
158
|
+
0
|
|
159
|
+
],
|
|
160
|
+
darkorchid: [
|
|
161
|
+
153,
|
|
162
|
+
50,
|
|
163
|
+
204
|
|
164
|
+
],
|
|
165
|
+
darkred: [
|
|
166
|
+
139,
|
|
167
|
+
0,
|
|
168
|
+
0
|
|
169
|
+
],
|
|
170
|
+
darksalmon: [
|
|
171
|
+
233,
|
|
172
|
+
150,
|
|
173
|
+
122
|
|
174
|
+
],
|
|
175
|
+
darkseagreen: [
|
|
176
|
+
143,
|
|
177
|
+
188,
|
|
178
|
+
143
|
|
179
|
+
],
|
|
180
|
+
darkslateblue: [
|
|
181
|
+
72,
|
|
182
|
+
61,
|
|
183
|
+
139
|
|
184
|
+
],
|
|
185
|
+
darkslategray: [
|
|
186
|
+
47,
|
|
187
|
+
79,
|
|
188
|
+
79
|
|
189
|
+
],
|
|
190
|
+
darkslategrey: [
|
|
191
|
+
47,
|
|
192
|
+
79,
|
|
193
|
+
79
|
|
194
|
+
],
|
|
195
|
+
darkturquoise: [
|
|
196
|
+
0,
|
|
197
|
+
206,
|
|
198
|
+
209
|
|
199
|
+
],
|
|
200
|
+
darkviolet: [
|
|
201
|
+
148,
|
|
202
|
+
0,
|
|
203
|
+
211
|
|
204
|
+
],
|
|
205
|
+
deeppink: [
|
|
206
|
+
255,
|
|
207
|
+
20,
|
|
208
|
+
147
|
|
209
|
+
],
|
|
210
|
+
deepskyblue: [
|
|
211
|
+
0,
|
|
212
|
+
191,
|
|
213
|
+
255
|
|
214
|
+
],
|
|
215
|
+
dimgray: [
|
|
216
|
+
105,
|
|
217
|
+
105,
|
|
218
|
+
105
|
|
219
|
+
],
|
|
220
|
+
dimgrey: [
|
|
221
|
+
105,
|
|
222
|
+
105,
|
|
223
|
+
105
|
|
224
|
+
],
|
|
225
|
+
dodgerblue: [
|
|
226
|
+
30,
|
|
227
|
+
144,
|
|
228
|
+
255
|
|
229
|
+
],
|
|
230
|
+
firebrick: [
|
|
231
|
+
178,
|
|
232
|
+
34,
|
|
233
|
+
34
|
|
234
|
+
],
|
|
235
|
+
floralwhite: [
|
|
236
|
+
255,
|
|
237
|
+
250,
|
|
238
|
+
240
|
|
239
|
+
],
|
|
240
|
+
forestgreen: [
|
|
241
|
+
34,
|
|
242
|
+
139,
|
|
243
|
+
34
|
|
244
|
+
],
|
|
245
|
+
fuchsia: [
|
|
246
|
+
255,
|
|
247
|
+
0,
|
|
248
|
+
255
|
|
249
|
+
],
|
|
250
|
+
gainsboro: [
|
|
251
|
+
220,
|
|
252
|
+
220,
|
|
253
|
+
220
|
|
254
|
+
],
|
|
255
|
+
ghostwhite: [
|
|
256
|
+
248,
|
|
257
|
+
248,
|
|
258
|
+
255
|
|
259
|
+
],
|
|
260
|
+
gold: [
|
|
261
|
+
255,
|
|
262
|
+
215,
|
|
263
|
+
0
|
|
264
|
+
],
|
|
265
|
+
goldenrod: [
|
|
266
|
+
218,
|
|
267
|
+
165,
|
|
268
|
+
32
|
|
269
|
+
],
|
|
270
|
+
gray: [
|
|
271
|
+
128,
|
|
272
|
+
128,
|
|
273
|
+
128
|
|
274
|
+
],
|
|
275
|
+
green: [
|
|
276
|
+
0,
|
|
277
|
+
128,
|
|
278
|
+
0
|
|
279
|
+
],
|
|
280
|
+
greenyellow: [
|
|
281
|
+
173,
|
|
282
|
+
255,
|
|
283
|
+
47
|
|
284
|
+
],
|
|
285
|
+
grey: [
|
|
286
|
+
128,
|
|
287
|
+
128,
|
|
288
|
+
128
|
|
289
|
+
],
|
|
290
|
+
honeydew: [
|
|
291
|
+
240,
|
|
292
|
+
255,
|
|
293
|
+
240
|
|
294
|
+
],
|
|
295
|
+
hotpink: [
|
|
296
|
+
255,
|
|
297
|
+
105,
|
|
298
|
+
180
|
|
299
|
+
],
|
|
300
|
+
indianred: [
|
|
301
|
+
205,
|
|
302
|
+
92,
|
|
303
|
+
92
|
|
304
|
+
],
|
|
305
|
+
indigo: [
|
|
306
|
+
75,
|
|
307
|
+
0,
|
|
308
|
+
130
|
|
309
|
+
],
|
|
310
|
+
ivory: [
|
|
311
|
+
255,
|
|
312
|
+
255,
|
|
313
|
+
240
|
|
314
|
+
],
|
|
315
|
+
khaki: [
|
|
316
|
+
240,
|
|
317
|
+
230,
|
|
318
|
+
140
|
|
319
|
+
],
|
|
320
|
+
lavender: [
|
|
321
|
+
230,
|
|
322
|
+
230,
|
|
323
|
+
250
|
|
324
|
+
],
|
|
325
|
+
lavenderblush: [
|
|
326
|
+
255,
|
|
327
|
+
240,
|
|
328
|
+
245
|
|
329
|
+
],
|
|
330
|
+
lawngreen: [
|
|
331
|
+
124,
|
|
332
|
+
252,
|
|
333
|
+
0
|
|
334
|
+
],
|
|
335
|
+
lemonchiffon: [
|
|
336
|
+
255,
|
|
337
|
+
250,
|
|
338
|
+
205
|
|
339
|
+
],
|
|
340
|
+
lightblue: [
|
|
341
|
+
173,
|
|
342
|
+
216,
|
|
343
|
+
230
|
|
344
|
+
],
|
|
345
|
+
lightcoral: [
|
|
346
|
+
240,
|
|
347
|
+
128,
|
|
348
|
+
128
|
|
349
|
+
],
|
|
350
|
+
lightcyan: [
|
|
351
|
+
224,
|
|
352
|
+
255,
|
|
353
|
+
255
|
|
354
|
+
],
|
|
355
|
+
lightgoldenrodyellow: [
|
|
356
|
+
250,
|
|
357
|
+
250,
|
|
358
|
+
210
|
|
359
|
+
],
|
|
360
|
+
lightgray: [
|
|
361
|
+
211,
|
|
362
|
+
211,
|
|
363
|
+
211
|
|
364
|
+
],
|
|
365
|
+
lightgreen: [
|
|
366
|
+
144,
|
|
367
|
+
238,
|
|
368
|
+
144
|
|
369
|
+
],
|
|
370
|
+
lightgrey: [
|
|
371
|
+
211,
|
|
372
|
+
211,
|
|
373
|
+
211
|
|
374
|
+
],
|
|
375
|
+
lightpink: [
|
|
376
|
+
255,
|
|
377
|
+
182,
|
|
378
|
+
193
|
|
379
|
+
],
|
|
380
|
+
lightsalmon: [
|
|
381
|
+
255,
|
|
382
|
+
160,
|
|
383
|
+
122
|
|
384
|
+
],
|
|
385
|
+
lightseagreen: [
|
|
386
|
+
32,
|
|
387
|
+
178,
|
|
388
|
+
170
|
|
389
|
+
],
|
|
390
|
+
lightskyblue: [
|
|
391
|
+
135,
|
|
392
|
+
206,
|
|
393
|
+
250
|
|
394
|
+
],
|
|
395
|
+
lightslategray: [
|
|
396
|
+
119,
|
|
397
|
+
136,
|
|
398
|
+
153
|
|
399
|
+
],
|
|
400
|
+
lightslategrey: [
|
|
401
|
+
119,
|
|
402
|
+
136,
|
|
403
|
+
153
|
|
404
|
+
],
|
|
405
|
+
lightsteelblue: [
|
|
406
|
+
176,
|
|
407
|
+
196,
|
|
408
|
+
222
|
|
409
|
+
],
|
|
410
|
+
lightyellow: [
|
|
411
|
+
255,
|
|
412
|
+
255,
|
|
413
|
+
224
|
|
414
|
+
],
|
|
415
|
+
lime: [
|
|
416
|
+
0,
|
|
417
|
+
255,
|
|
418
|
+
0
|
|
419
|
+
],
|
|
420
|
+
limegreen: [
|
|
421
|
+
50,
|
|
422
|
+
205,
|
|
423
|
+
50
|
|
424
|
+
],
|
|
425
|
+
linen: [
|
|
426
|
+
250,
|
|
427
|
+
240,
|
|
428
|
+
230
|
|
429
|
+
],
|
|
430
|
+
magenta: [
|
|
431
|
+
255,
|
|
432
|
+
0,
|
|
433
|
+
255
|
|
434
|
+
],
|
|
435
|
+
maroon: [
|
|
436
|
+
128,
|
|
437
|
+
0,
|
|
438
|
+
0
|
|
439
|
+
],
|
|
440
|
+
mediumaquamarine: [
|
|
441
|
+
102,
|
|
442
|
+
205,
|
|
443
|
+
170
|
|
444
|
+
],
|
|
445
|
+
mediumblue: [
|
|
446
|
+
0,
|
|
447
|
+
0,
|
|
448
|
+
205
|
|
449
|
+
],
|
|
450
|
+
mediumorchid: [
|
|
451
|
+
186,
|
|
452
|
+
85,
|
|
453
|
+
211
|
|
454
|
+
],
|
|
455
|
+
mediumpurple: [
|
|
456
|
+
147,
|
|
457
|
+
112,
|
|
458
|
+
219
|
|
459
|
+
],
|
|
460
|
+
mediumseagreen: [
|
|
461
|
+
60,
|
|
462
|
+
179,
|
|
463
|
+
113
|
|
464
|
+
],
|
|
465
|
+
mediumslateblue: [
|
|
466
|
+
123,
|
|
467
|
+
104,
|
|
468
|
+
238
|
|
469
|
+
],
|
|
470
|
+
mediumspringgreen: [
|
|
471
|
+
0,
|
|
472
|
+
250,
|
|
473
|
+
154
|
|
474
|
+
],
|
|
475
|
+
mediumturquoise: [
|
|
476
|
+
72,
|
|
477
|
+
209,
|
|
478
|
+
204
|
|
479
|
+
],
|
|
480
|
+
mediumvioletred: [
|
|
481
|
+
199,
|
|
482
|
+
21,
|
|
483
|
+
133
|
|
484
|
+
],
|
|
485
|
+
midnightblue: [
|
|
486
|
+
25,
|
|
487
|
+
25,
|
|
488
|
+
112
|
|
489
|
+
],
|
|
490
|
+
mintcream: [
|
|
491
|
+
245,
|
|
492
|
+
255,
|
|
493
|
+
250
|
|
494
|
+
],
|
|
495
|
+
mistyrose: [
|
|
496
|
+
255,
|
|
497
|
+
228,
|
|
498
|
+
225
|
|
499
|
+
],
|
|
500
|
+
moccasin: [
|
|
501
|
+
255,
|
|
502
|
+
228,
|
|
503
|
+
181
|
|
504
|
+
],
|
|
505
|
+
navajowhite: [
|
|
506
|
+
255,
|
|
507
|
+
222,
|
|
508
|
+
173
|
|
509
|
+
],
|
|
510
|
+
navy: [
|
|
511
|
+
0,
|
|
512
|
+
0,
|
|
513
|
+
128
|
|
514
|
+
],
|
|
515
|
+
oldlace: [
|
|
516
|
+
253,
|
|
517
|
+
245,
|
|
518
|
+
230
|
|
519
|
+
],
|
|
520
|
+
olive: [
|
|
521
|
+
128,
|
|
522
|
+
128,
|
|
523
|
+
0
|
|
524
|
+
],
|
|
525
|
+
olivedrab: [
|
|
526
|
+
107,
|
|
527
|
+
142,
|
|
528
|
+
35
|
|
529
|
+
],
|
|
530
|
+
orange: [
|
|
531
|
+
255,
|
|
532
|
+
165,
|
|
533
|
+
0
|
|
534
|
+
],
|
|
535
|
+
orangered: [
|
|
536
|
+
255,
|
|
537
|
+
69,
|
|
538
|
+
0
|
|
539
|
+
],
|
|
540
|
+
orchid: [
|
|
541
|
+
218,
|
|
542
|
+
112,
|
|
543
|
+
214
|
|
544
|
+
],
|
|
545
|
+
palegoldenrod: [
|
|
546
|
+
238,
|
|
547
|
+
232,
|
|
548
|
+
170
|
|
549
|
+
],
|
|
550
|
+
palegreen: [
|
|
551
|
+
152,
|
|
552
|
+
251,
|
|
553
|
+
152
|
|
554
|
+
],
|
|
555
|
+
paleturquoise: [
|
|
556
|
+
175,
|
|
557
|
+
238,
|
|
558
|
+
238
|
|
559
|
+
],
|
|
560
|
+
palevioletred: [
|
|
561
|
+
219,
|
|
562
|
+
112,
|
|
563
|
+
147
|
|
564
|
+
],
|
|
565
|
+
papayawhip: [
|
|
566
|
+
255,
|
|
567
|
+
239,
|
|
568
|
+
213
|
|
569
|
+
],
|
|
570
|
+
peachpuff: [
|
|
571
|
+
255,
|
|
572
|
+
218,
|
|
573
|
+
185
|
|
574
|
+
],
|
|
575
|
+
peru: [
|
|
576
|
+
205,
|
|
577
|
+
133,
|
|
578
|
+
63
|
|
579
|
+
],
|
|
580
|
+
pink: [
|
|
581
|
+
255,
|
|
582
|
+
192,
|
|
583
|
+
203
|
|
584
|
+
],
|
|
585
|
+
plum: [
|
|
586
|
+
221,
|
|
587
|
+
160,
|
|
588
|
+
221
|
|
589
|
+
],
|
|
590
|
+
powderblue: [
|
|
591
|
+
176,
|
|
592
|
+
224,
|
|
593
|
+
230
|
|
594
|
+
],
|
|
595
|
+
purple: [
|
|
596
|
+
128,
|
|
597
|
+
0,
|
|
598
|
+
128
|
|
599
|
+
],
|
|
600
|
+
rebeccapurple: [
|
|
601
|
+
102,
|
|
602
|
+
51,
|
|
603
|
+
153
|
|
604
|
+
],
|
|
605
|
+
red: [
|
|
606
|
+
255,
|
|
607
|
+
0,
|
|
608
|
+
0
|
|
609
|
+
],
|
|
610
|
+
rosybrown: [
|
|
611
|
+
188,
|
|
612
|
+
143,
|
|
613
|
+
143
|
|
614
|
+
],
|
|
615
|
+
royalblue: [
|
|
616
|
+
65,
|
|
617
|
+
105,
|
|
618
|
+
225
|
|
619
|
+
],
|
|
620
|
+
saddlebrown: [
|
|
621
|
+
139,
|
|
622
|
+
69,
|
|
623
|
+
19
|
|
624
|
+
],
|
|
625
|
+
salmon: [
|
|
626
|
+
250,
|
|
627
|
+
128,
|
|
628
|
+
114
|
|
629
|
+
],
|
|
630
|
+
sandybrown: [
|
|
631
|
+
244,
|
|
632
|
+
164,
|
|
633
|
+
96
|
|
634
|
+
],
|
|
635
|
+
seagreen: [
|
|
636
|
+
46,
|
|
637
|
+
139,
|
|
638
|
+
87
|
|
639
|
+
],
|
|
640
|
+
seashell: [
|
|
641
|
+
255,
|
|
642
|
+
245,
|
|
643
|
+
238
|
|
644
|
+
],
|
|
645
|
+
sienna: [
|
|
646
|
+
160,
|
|
647
|
+
82,
|
|
648
|
+
45
|
|
649
|
+
],
|
|
650
|
+
silver: [
|
|
651
|
+
192,
|
|
652
|
+
192,
|
|
653
|
+
192
|
|
654
|
+
],
|
|
655
|
+
skyblue: [
|
|
656
|
+
135,
|
|
657
|
+
206,
|
|
658
|
+
235
|
|
659
|
+
],
|
|
660
|
+
slateblue: [
|
|
661
|
+
106,
|
|
662
|
+
90,
|
|
663
|
+
205
|
|
664
|
+
],
|
|
665
|
+
slategray: [
|
|
666
|
+
112,
|
|
667
|
+
128,
|
|
668
|
+
144
|
|
669
|
+
],
|
|
670
|
+
slategrey: [
|
|
671
|
+
112,
|
|
672
|
+
128,
|
|
673
|
+
144
|
|
674
|
+
],
|
|
675
|
+
snow: [
|
|
676
|
+
255,
|
|
677
|
+
250,
|
|
678
|
+
250
|
|
679
|
+
],
|
|
680
|
+
springgreen: [
|
|
681
|
+
0,
|
|
682
|
+
255,
|
|
683
|
+
127
|
|
684
|
+
],
|
|
685
|
+
steelblue: [
|
|
686
|
+
70,
|
|
687
|
+
130,
|
|
688
|
+
180
|
|
689
|
+
],
|
|
690
|
+
tan: [
|
|
691
|
+
210,
|
|
692
|
+
180,
|
|
693
|
+
140
|
|
694
|
+
],
|
|
695
|
+
teal: [
|
|
696
|
+
0,
|
|
697
|
+
128,
|
|
698
|
+
128
|
|
699
|
+
],
|
|
700
|
+
thistle: [
|
|
701
|
+
216,
|
|
702
|
+
191,
|
|
703
|
+
216
|
|
704
|
+
],
|
|
705
|
+
tomato: [
|
|
706
|
+
255,
|
|
707
|
+
99,
|
|
708
|
+
71
|
|
709
|
+
],
|
|
710
|
+
turquoise: [
|
|
711
|
+
64,
|
|
712
|
+
224,
|
|
713
|
+
208
|
|
714
|
+
],
|
|
715
|
+
violet: [
|
|
716
|
+
238,
|
|
717
|
+
130,
|
|
718
|
+
238
|
|
719
|
+
],
|
|
720
|
+
wheat: [
|
|
721
|
+
245,
|
|
722
|
+
222,
|
|
723
|
+
179
|
|
724
|
+
],
|
|
725
|
+
white: [
|
|
726
|
+
255,
|
|
727
|
+
255,
|
|
728
|
+
255
|
|
729
|
+
],
|
|
730
|
+
whitesmoke: [
|
|
731
|
+
245,
|
|
732
|
+
245,
|
|
733
|
+
245
|
|
734
|
+
],
|
|
735
|
+
yellow: [
|
|
736
|
+
255,
|
|
737
|
+
255,
|
|
738
|
+
0
|
|
739
|
+
],
|
|
740
|
+
yellowgreen: [
|
|
741
|
+
154,
|
|
742
|
+
205,
|
|
743
|
+
50
|
|
744
|
+
]
|
|
745
|
+
};
|
|
746
|
+
for (let e in r) Object.freeze(r[e]);
|
|
747
|
+
var i = Object.freeze(r), a = Object.create(null);
|
|
748
|
+
for (let e in i) Object.hasOwn(i, e) && (a[i[e]] = e);
|
|
749
|
+
var o = {
|
|
750
|
+
to: {},
|
|
751
|
+
get: {}
|
|
752
|
+
};
|
|
753
|
+
o.get = function(e) {
|
|
754
|
+
let t = e.slice(0, 3).toLowerCase(), n, r;
|
|
755
|
+
switch (t) {
|
|
756
|
+
case "hsl":
|
|
757
|
+
n = o.get.hsl(e), r = "hsl";
|
|
758
|
+
break;
|
|
759
|
+
case "hwb":
|
|
760
|
+
n = o.get.hwb(e), r = "hwb";
|
|
761
|
+
break;
|
|
762
|
+
default:
|
|
763
|
+
n = o.get.rgb(e), r = "rgb";
|
|
764
|
+
break;
|
|
765
|
+
}
|
|
766
|
+
return n ? {
|
|
767
|
+
model: r,
|
|
768
|
+
value: n
|
|
769
|
+
} : null;
|
|
770
|
+
}, o.get.rgb = function(e) {
|
|
771
|
+
if (!e) return null;
|
|
772
|
+
let t = /^#([a-f\d]{3,4})$/i, n = /^#([a-f\d]{6})([a-f\d]{2})?$/i, r = /^rgba?\(\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)\s*(?:[\s,|/]\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(%?)\s*)?\)$/i, a = /^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/i, o = /^(\w+)$/, c = [
|
|
773
|
+
0,
|
|
774
|
+
0,
|
|
775
|
+
0,
|
|
776
|
+
1
|
|
777
|
+
], l, u, d;
|
|
778
|
+
if (l = e.match(n)) {
|
|
779
|
+
for (d = l[2], l = l[1], u = 0; u < 3; u++) {
|
|
780
|
+
let e = u * 2;
|
|
781
|
+
c[u] = Number.parseInt(l.slice(e, e + 2), 16);
|
|
782
|
+
}
|
|
783
|
+
d && (c[3] = Number.parseInt(d, 16) / 255);
|
|
784
|
+
} else if (l = e.match(t)) {
|
|
785
|
+
for (l = l[1], d = l[3], u = 0; u < 3; u++) c[u] = Number.parseInt(l[u] + l[u], 16);
|
|
786
|
+
d && (c[3] = Number.parseInt(d + d, 16) / 255);
|
|
787
|
+
} else if (l = e.match(r)) {
|
|
788
|
+
for (u = 0; u < 3; u++) c[u] = Number.parseFloat(l[u + 1]);
|
|
789
|
+
l[4] && (c[3] = l[5] ? Number.parseFloat(l[4]) * .01 : Number.parseFloat(l[4]));
|
|
790
|
+
} else if (l = e.match(a)) {
|
|
791
|
+
for (u = 0; u < 3; u++) c[u] = Math.round(Number.parseFloat(l[u + 1]) * 2.55);
|
|
792
|
+
l[4] && (c[3] = l[5] ? Number.parseFloat(l[4]) * .01 : Number.parseFloat(l[4]));
|
|
793
|
+
} else if (l = e.toLowerCase().match(o)) return l[1] === "transparent" ? [
|
|
794
|
+
0,
|
|
795
|
+
0,
|
|
796
|
+
0,
|
|
797
|
+
0
|
|
798
|
+
] : Object.hasOwn(i, l[1]) ? (c = i[l[1]].slice(), c[3] = 1, c) : null;
|
|
799
|
+
else return null;
|
|
800
|
+
for (u = 0; u < 3; u++) c[u] = s(c[u], 0, 255);
|
|
801
|
+
return c[3] = s(c[3], 0, 1), c;
|
|
802
|
+
}, o.get.hsl = function(e) {
|
|
803
|
+
if (!e) return null;
|
|
804
|
+
let t = e.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i);
|
|
805
|
+
if (t) {
|
|
806
|
+
let e = Number.parseFloat(t[4]);
|
|
807
|
+
return [
|
|
808
|
+
(Number.parseFloat(t[1]) % 360 + 360) % 360,
|
|
809
|
+
s(Number.parseFloat(t[2]), 0, 100),
|
|
810
|
+
s(Number.parseFloat(t[3]), 0, 100),
|
|
811
|
+
s(Number.isNaN(e) ? 1 : e, 0, 1)
|
|
812
|
+
];
|
|
813
|
+
}
|
|
814
|
+
return null;
|
|
815
|
+
}, o.get.hwb = function(e) {
|
|
816
|
+
if (!e) return null;
|
|
817
|
+
let t = e.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i);
|
|
818
|
+
if (t) {
|
|
819
|
+
let e = Number.parseFloat(t[4]);
|
|
820
|
+
return [
|
|
821
|
+
(Number.parseFloat(t[1]) % 360 + 360) % 360,
|
|
822
|
+
s(Number.parseFloat(t[2]), 0, 100),
|
|
823
|
+
s(Number.parseFloat(t[3]), 0, 100),
|
|
824
|
+
s(Number.isNaN(e) ? 1 : e, 0, 1)
|
|
825
|
+
];
|
|
826
|
+
}
|
|
827
|
+
return null;
|
|
828
|
+
}, o.to.hex = function(...e) {
|
|
829
|
+
return "#" + c(e[0]) + c(e[1]) + c(e[2]) + (e[3] < 1 ? c(Math.round(e[3] * 255)) : "");
|
|
830
|
+
}, o.to.rgb = function(...e) {
|
|
831
|
+
return e.length < 4 || e[3] === 1 ? "rgb(" + Math.round(e[0]) + ", " + Math.round(e[1]) + ", " + Math.round(e[2]) + ")" : "rgba(" + Math.round(e[0]) + ", " + Math.round(e[1]) + ", " + Math.round(e[2]) + ", " + e[3] + ")";
|
|
832
|
+
}, o.to.rgb.percent = function(...e) {
|
|
833
|
+
let t = Math.round(e[0] / 255 * 100), n = Math.round(e[1] / 255 * 100), r = Math.round(e[2] / 255 * 100);
|
|
834
|
+
return e.length < 4 || e[3] === 1 ? "rgb(" + t + "%, " + n + "%, " + r + "%)" : "rgba(" + t + "%, " + n + "%, " + r + "%, " + e[3] + ")";
|
|
835
|
+
}, o.to.hsl = function(...e) {
|
|
836
|
+
return e.length < 4 || e[3] === 1 ? "hsl(" + e[0] + ", " + e[1] + "%, " + e[2] + "%)" : "hsla(" + e[0] + ", " + e[1] + "%, " + e[2] + "%, " + e[3] + ")";
|
|
837
|
+
}, o.to.hwb = function(...e) {
|
|
838
|
+
let t = "";
|
|
839
|
+
return e.length >= 4 && e[3] !== 1 && (t = ", " + e[3]), "hwb(" + e[0] + ", " + e[1] + "%, " + e[2] + "%" + t + ")";
|
|
840
|
+
}, o.to.keyword = function(...e) {
|
|
841
|
+
return a[e.slice(0, 3)];
|
|
842
|
+
};
|
|
843
|
+
function s(e, t, n) {
|
|
844
|
+
return Math.min(Math.max(t, e), n);
|
|
845
|
+
}
|
|
846
|
+
function c(e) {
|
|
847
|
+
let t = Math.round(e).toString(16).toUpperCase();
|
|
848
|
+
return t.length < 2 ? "0" + t : t;
|
|
849
|
+
}
|
|
850
|
+
//#endregion
|
|
851
|
+
//#region node_modules/.pnpm/color-convert@3.1.3/node_modules/color-convert/conversions.js
|
|
852
|
+
var l = {};
|
|
853
|
+
for (let e of Object.keys(i)) l[i[e]] = e;
|
|
854
|
+
var u = {
|
|
855
|
+
rgb: {
|
|
856
|
+
channels: 3,
|
|
857
|
+
labels: "rgb"
|
|
858
|
+
},
|
|
859
|
+
hsl: {
|
|
860
|
+
channels: 3,
|
|
861
|
+
labels: "hsl"
|
|
862
|
+
},
|
|
863
|
+
hsv: {
|
|
864
|
+
channels: 3,
|
|
865
|
+
labels: "hsv"
|
|
866
|
+
},
|
|
867
|
+
hwb: {
|
|
868
|
+
channels: 3,
|
|
869
|
+
labels: "hwb"
|
|
870
|
+
},
|
|
871
|
+
cmyk: {
|
|
872
|
+
channels: 4,
|
|
873
|
+
labels: "cmyk"
|
|
874
|
+
},
|
|
875
|
+
xyz: {
|
|
876
|
+
channels: 3,
|
|
877
|
+
labels: "xyz"
|
|
878
|
+
},
|
|
879
|
+
lab: {
|
|
880
|
+
channels: 3,
|
|
881
|
+
labels: "lab"
|
|
882
|
+
},
|
|
883
|
+
oklab: {
|
|
884
|
+
channels: 3,
|
|
885
|
+
labels: [
|
|
886
|
+
"okl",
|
|
887
|
+
"oka",
|
|
888
|
+
"okb"
|
|
889
|
+
]
|
|
890
|
+
},
|
|
891
|
+
lch: {
|
|
892
|
+
channels: 3,
|
|
893
|
+
labels: "lch"
|
|
894
|
+
},
|
|
895
|
+
oklch: {
|
|
896
|
+
channels: 3,
|
|
897
|
+
labels: [
|
|
898
|
+
"okl",
|
|
899
|
+
"okc",
|
|
900
|
+
"okh"
|
|
901
|
+
]
|
|
902
|
+
},
|
|
903
|
+
hex: {
|
|
904
|
+
channels: 1,
|
|
905
|
+
labels: ["hex"]
|
|
906
|
+
},
|
|
907
|
+
keyword: {
|
|
908
|
+
channels: 1,
|
|
909
|
+
labels: ["keyword"]
|
|
910
|
+
},
|
|
911
|
+
ansi16: {
|
|
912
|
+
channels: 1,
|
|
913
|
+
labels: ["ansi16"]
|
|
914
|
+
},
|
|
915
|
+
ansi256: {
|
|
916
|
+
channels: 1,
|
|
917
|
+
labels: ["ansi256"]
|
|
918
|
+
},
|
|
919
|
+
hcg: {
|
|
920
|
+
channels: 3,
|
|
921
|
+
labels: [
|
|
922
|
+
"h",
|
|
923
|
+
"c",
|
|
924
|
+
"g"
|
|
925
|
+
]
|
|
926
|
+
},
|
|
927
|
+
apple: {
|
|
928
|
+
channels: 3,
|
|
929
|
+
labels: [
|
|
930
|
+
"r16",
|
|
931
|
+
"g16",
|
|
932
|
+
"b16"
|
|
933
|
+
]
|
|
934
|
+
},
|
|
935
|
+
gray: {
|
|
936
|
+
channels: 1,
|
|
937
|
+
labels: ["gray"]
|
|
938
|
+
}
|
|
939
|
+
}, d = (6 / 29) ** 3;
|
|
940
|
+
function f(e) {
|
|
941
|
+
let t = e > .0031308 ? 1.055 * e ** (1 / 2.4) - .055 : e * 12.92;
|
|
942
|
+
return Math.min(Math.max(0, t), 1);
|
|
943
|
+
}
|
|
944
|
+
function p(e) {
|
|
945
|
+
return e > .04045 ? ((e + .055) / 1.055) ** 2.4 : e / 12.92;
|
|
946
|
+
}
|
|
947
|
+
for (let e of Object.keys(u)) {
|
|
948
|
+
if (!("channels" in u[e])) throw Error("missing channels property: " + e);
|
|
949
|
+
if (!("labels" in u[e])) throw Error("missing channel labels property: " + e);
|
|
950
|
+
if (u[e].labels.length !== u[e].channels) throw Error("channel and label counts mismatch: " + e);
|
|
951
|
+
let { channels: t, labels: n } = u[e];
|
|
952
|
+
delete u[e].channels, delete u[e].labels, Object.defineProperty(u[e], "channels", { value: t }), Object.defineProperty(u[e], "labels", { value: n });
|
|
953
|
+
}
|
|
954
|
+
u.rgb.hsl = function(e) {
|
|
955
|
+
let t = e[0] / 255, n = e[1] / 255, r = e[2] / 255, i = Math.min(t, n, r), a = Math.max(t, n, r), o = a - i, s, c;
|
|
956
|
+
switch (a) {
|
|
957
|
+
case i:
|
|
958
|
+
s = 0;
|
|
959
|
+
break;
|
|
960
|
+
case t:
|
|
961
|
+
s = (n - r) / o;
|
|
962
|
+
break;
|
|
963
|
+
case n:
|
|
964
|
+
s = 2 + (r - t) / o;
|
|
965
|
+
break;
|
|
966
|
+
case r:
|
|
967
|
+
s = 4 + (t - n) / o;
|
|
968
|
+
break;
|
|
969
|
+
}
|
|
970
|
+
s = Math.min(s * 60, 360), s < 0 && (s += 360);
|
|
971
|
+
let l = (i + a) / 2;
|
|
972
|
+
return c = a === i ? 0 : l <= .5 ? o / (a + i) : o / (2 - a - i), [
|
|
973
|
+
s,
|
|
974
|
+
c * 100,
|
|
975
|
+
l * 100
|
|
976
|
+
];
|
|
977
|
+
}, u.rgb.hsv = function(e) {
|
|
978
|
+
let t, n, r, i, a, o = e[0] / 255, s = e[1] / 255, c = e[2] / 255, l = Math.max(o, s, c), u = l - Math.min(o, s, c), d = function(e) {
|
|
979
|
+
return (l - e) / 6 / u + 1 / 2;
|
|
980
|
+
};
|
|
981
|
+
if (u === 0) i = 0, a = 0;
|
|
982
|
+
else {
|
|
983
|
+
switch (a = u / l, t = d(o), n = d(s), r = d(c), l) {
|
|
984
|
+
case o:
|
|
985
|
+
i = r - n;
|
|
986
|
+
break;
|
|
987
|
+
case s:
|
|
988
|
+
i = 1 / 3 + t - r;
|
|
989
|
+
break;
|
|
990
|
+
case c:
|
|
991
|
+
i = 2 / 3 + n - t;
|
|
992
|
+
break;
|
|
993
|
+
}
|
|
994
|
+
i < 0 ? i += 1 : i > 1 && --i;
|
|
995
|
+
}
|
|
996
|
+
return [
|
|
997
|
+
i * 360,
|
|
998
|
+
a * 100,
|
|
999
|
+
l * 100
|
|
1000
|
+
];
|
|
1001
|
+
}, u.rgb.hwb = function(e) {
|
|
1002
|
+
let t = e[0], n = e[1], r = e[2], i = u.rgb.hsl(e)[0], a = 1 / 255 * Math.min(t, Math.min(n, r));
|
|
1003
|
+
return r = 1 - 1 / 255 * Math.max(t, Math.max(n, r)), [
|
|
1004
|
+
i,
|
|
1005
|
+
a * 100,
|
|
1006
|
+
r * 100
|
|
1007
|
+
];
|
|
1008
|
+
}, u.rgb.oklab = function(e) {
|
|
1009
|
+
let t = p(e[0] / 255), n = p(e[1] / 255), r = p(e[2] / 255), i = Math.cbrt(.4122214708 * t + .5363325363 * n + .0514459929 * r), a = Math.cbrt(.2119034982 * t + .6806995451 * n + .1073969566 * r), o = Math.cbrt(.0883024619 * t + .2817188376 * n + .6299787005 * r), s = .2104542553 * i + .793617785 * a - .0040720468 * o, c = 1.9779984951 * i - 2.428592205 * a + .4505937099 * o, l = .0259040371 * i + .7827717662 * a - .808675766 * o;
|
|
1010
|
+
return [
|
|
1011
|
+
s * 100,
|
|
1012
|
+
c * 100,
|
|
1013
|
+
l * 100
|
|
1014
|
+
];
|
|
1015
|
+
}, u.rgb.cmyk = function(e) {
|
|
1016
|
+
let t = e[0] / 255, n = e[1] / 255, r = e[2] / 255, i = Math.min(1 - t, 1 - n, 1 - r), a = (1 - t - i) / (1 - i) || 0, o = (1 - n - i) / (1 - i) || 0, s = (1 - r - i) / (1 - i) || 0;
|
|
1017
|
+
return [
|
|
1018
|
+
a * 100,
|
|
1019
|
+
o * 100,
|
|
1020
|
+
s * 100,
|
|
1021
|
+
i * 100
|
|
1022
|
+
];
|
|
1023
|
+
};
|
|
1024
|
+
function m(e, t) {
|
|
1025
|
+
return (e[0] - t[0]) ** 2 + (e[1] - t[1]) ** 2 + (e[2] - t[2]) ** 2;
|
|
1026
|
+
}
|
|
1027
|
+
u.rgb.keyword = function(e) {
|
|
1028
|
+
let t = l[e];
|
|
1029
|
+
if (t) return t;
|
|
1030
|
+
let n = Infinity, r;
|
|
1031
|
+
for (let t of Object.keys(i)) {
|
|
1032
|
+
let a = i[t], o = m(e, a);
|
|
1033
|
+
o < n && (n = o, r = t);
|
|
1034
|
+
}
|
|
1035
|
+
return r;
|
|
1036
|
+
}, u.keyword.rgb = function(e) {
|
|
1037
|
+
return [...i[e]];
|
|
1038
|
+
}, u.rgb.xyz = function(e) {
|
|
1039
|
+
let t = p(e[0] / 255), n = p(e[1] / 255), r = p(e[2] / 255), i = t * .4124564 + n * .3575761 + r * .1804375, a = t * .2126729 + n * .7151522 + r * .072175, o = t * .0193339 + n * .119192 + r * .9503041;
|
|
1040
|
+
return [
|
|
1041
|
+
i * 100,
|
|
1042
|
+
a * 100,
|
|
1043
|
+
o * 100
|
|
1044
|
+
];
|
|
1045
|
+
}, u.rgb.lab = function(e) {
|
|
1046
|
+
let t = u.rgb.xyz(e), n = t[0], r = t[1], i = t[2];
|
|
1047
|
+
return n /= 95.047, r /= 100, i /= 108.883, n = n > d ? n ** (1 / 3) : 7.787 * n + 16 / 116, r = r > d ? r ** (1 / 3) : 7.787 * r + 16 / 116, i = i > d ? i ** (1 / 3) : 7.787 * i + 16 / 116, [
|
|
1048
|
+
116 * r - 16,
|
|
1049
|
+
500 * (n - r),
|
|
1050
|
+
200 * (r - i)
|
|
1051
|
+
];
|
|
1052
|
+
}, u.hsl.rgb = function(e) {
|
|
1053
|
+
let t = e[0] / 360, n = e[1] / 100, r = e[2] / 100, i, a;
|
|
1054
|
+
if (n === 0) return a = r * 255, [
|
|
1055
|
+
a,
|
|
1056
|
+
a,
|
|
1057
|
+
a
|
|
1058
|
+
];
|
|
1059
|
+
let o = r < .5 ? r * (1 + n) : r + n - r * n, s = 2 * r - o, c = [
|
|
1060
|
+
0,
|
|
1061
|
+
0,
|
|
1062
|
+
0
|
|
1063
|
+
];
|
|
1064
|
+
for (let e = 0; e < 3; e++) i = t + 1 / 3 * -(e - 1), i < 0 && i++, i > 1 && i--, a = 6 * i < 1 ? s + (o - s) * 6 * i : 2 * i < 1 ? o : 3 * i < 2 ? s + (o - s) * (2 / 3 - i) * 6 : s, c[e] = a * 255;
|
|
1065
|
+
return c;
|
|
1066
|
+
}, u.hsl.hsv = function(e) {
|
|
1067
|
+
let t = e[0], n = e[1] / 100, r = e[2] / 100, i = n, a = Math.max(r, .01);
|
|
1068
|
+
r *= 2, n *= r <= 1 ? r : 2 - r, i *= a <= 1 ? a : 2 - a;
|
|
1069
|
+
let o = (r + n) / 2;
|
|
1070
|
+
return [
|
|
1071
|
+
t,
|
|
1072
|
+
(r === 0 ? 2 * i / (a + i) : 2 * n / (r + n)) * 100,
|
|
1073
|
+
o * 100
|
|
1074
|
+
];
|
|
1075
|
+
}, u.hsv.rgb = function(e) {
|
|
1076
|
+
let t = e[0] / 60, n = e[1] / 100, r = e[2] / 100, i = Math.floor(t) % 6, a = t - Math.floor(t), o = 255 * r * (1 - n), s = 255 * r * (1 - n * a), c = 255 * r * (1 - n * (1 - a));
|
|
1077
|
+
switch (r *= 255, i) {
|
|
1078
|
+
case 0: return [
|
|
1079
|
+
r,
|
|
1080
|
+
c,
|
|
1081
|
+
o
|
|
1082
|
+
];
|
|
1083
|
+
case 1: return [
|
|
1084
|
+
s,
|
|
1085
|
+
r,
|
|
1086
|
+
o
|
|
1087
|
+
];
|
|
1088
|
+
case 2: return [
|
|
1089
|
+
o,
|
|
1090
|
+
r,
|
|
1091
|
+
c
|
|
1092
|
+
];
|
|
1093
|
+
case 3: return [
|
|
1094
|
+
o,
|
|
1095
|
+
s,
|
|
1096
|
+
r
|
|
1097
|
+
];
|
|
1098
|
+
case 4: return [
|
|
1099
|
+
c,
|
|
1100
|
+
o,
|
|
1101
|
+
r
|
|
1102
|
+
];
|
|
1103
|
+
case 5: return [
|
|
1104
|
+
r,
|
|
1105
|
+
o,
|
|
1106
|
+
s
|
|
1107
|
+
];
|
|
1108
|
+
}
|
|
1109
|
+
}, u.hsv.hsl = function(e) {
|
|
1110
|
+
let t = e[0], n = e[1] / 100, r = e[2] / 100, i = Math.max(r, .01), a, o;
|
|
1111
|
+
o = (2 - n) * r;
|
|
1112
|
+
let s = (2 - n) * i;
|
|
1113
|
+
return a = n * i, a /= s <= 1 ? s : 2 - s, a ||= 0, o /= 2, [
|
|
1114
|
+
t,
|
|
1115
|
+
a * 100,
|
|
1116
|
+
o * 100
|
|
1117
|
+
];
|
|
1118
|
+
}, u.hwb.rgb = function(e) {
|
|
1119
|
+
let t = e[0] / 360, n = e[1] / 100, r = e[2] / 100, i = n + r, a;
|
|
1120
|
+
i > 1 && (n /= i, r /= i);
|
|
1121
|
+
let o = Math.floor(6 * t), s = 1 - r;
|
|
1122
|
+
a = 6 * t - o, o & 1 && (a = 1 - a);
|
|
1123
|
+
let c = n + a * (s - n), l, u, d;
|
|
1124
|
+
switch (o) {
|
|
1125
|
+
default:
|
|
1126
|
+
case 6:
|
|
1127
|
+
case 0:
|
|
1128
|
+
l = s, u = c, d = n;
|
|
1129
|
+
break;
|
|
1130
|
+
case 1:
|
|
1131
|
+
l = c, u = s, d = n;
|
|
1132
|
+
break;
|
|
1133
|
+
case 2:
|
|
1134
|
+
l = n, u = s, d = c;
|
|
1135
|
+
break;
|
|
1136
|
+
case 3:
|
|
1137
|
+
l = n, u = c, d = s;
|
|
1138
|
+
break;
|
|
1139
|
+
case 4:
|
|
1140
|
+
l = c, u = n, d = s;
|
|
1141
|
+
break;
|
|
1142
|
+
case 5:
|
|
1143
|
+
l = s, u = n, d = c;
|
|
1144
|
+
break;
|
|
1145
|
+
}
|
|
1146
|
+
return [
|
|
1147
|
+
l * 255,
|
|
1148
|
+
u * 255,
|
|
1149
|
+
d * 255
|
|
1150
|
+
];
|
|
1151
|
+
}, u.cmyk.rgb = function(e) {
|
|
1152
|
+
let t = e[0] / 100, n = e[1] / 100, r = e[2] / 100, i = e[3] / 100, a = 1 - Math.min(1, t * (1 - i) + i), o = 1 - Math.min(1, n * (1 - i) + i), s = 1 - Math.min(1, r * (1 - i) + i);
|
|
1153
|
+
return [
|
|
1154
|
+
a * 255,
|
|
1155
|
+
o * 255,
|
|
1156
|
+
s * 255
|
|
1157
|
+
];
|
|
1158
|
+
}, u.xyz.rgb = function(e) {
|
|
1159
|
+
let t = e[0] / 100, n = e[1] / 100, r = e[2] / 100, i, a, o;
|
|
1160
|
+
return i = t * 3.2404542 + n * -1.5371385 + r * -.4985314, a = t * -.969266 + n * 1.8760108 + r * .041556, o = t * .0556434 + n * -.2040259 + r * 1.0572252, i = f(i), a = f(a), o = f(o), [
|
|
1161
|
+
i * 255,
|
|
1162
|
+
a * 255,
|
|
1163
|
+
o * 255
|
|
1164
|
+
];
|
|
1165
|
+
}, u.xyz.lab = function(e) {
|
|
1166
|
+
let t = e[0], n = e[1], r = e[2];
|
|
1167
|
+
return t /= 95.047, n /= 100, r /= 108.883, t = t > d ? t ** (1 / 3) : 7.787 * t + 16 / 116, n = n > d ? n ** (1 / 3) : 7.787 * n + 16 / 116, r = r > d ? r ** (1 / 3) : 7.787 * r + 16 / 116, [
|
|
1168
|
+
116 * n - 16,
|
|
1169
|
+
500 * (t - n),
|
|
1170
|
+
200 * (n - r)
|
|
1171
|
+
];
|
|
1172
|
+
}, u.xyz.oklab = function(e) {
|
|
1173
|
+
let t = e[0] / 100, n = e[1] / 100, r = e[2] / 100, i = Math.cbrt(.8189330101 * t + .3618667424 * n - .1288597137 * r), a = Math.cbrt(.0329845436 * t + .9293118715 * n + .0361456387 * r), o = Math.cbrt(.0482003018 * t + .2643662691 * n + .633851707 * r), s = .2104542553 * i + .793617785 * a - .0040720468 * o, c = 1.9779984951 * i - 2.428592205 * a + .4505937099 * o, l = .0259040371 * i + .7827717662 * a - .808675766 * o;
|
|
1174
|
+
return [
|
|
1175
|
+
s * 100,
|
|
1176
|
+
c * 100,
|
|
1177
|
+
l * 100
|
|
1178
|
+
];
|
|
1179
|
+
}, u.oklab.oklch = function(e) {
|
|
1180
|
+
return u.lab.lch(e);
|
|
1181
|
+
}, u.oklab.xyz = function(e) {
|
|
1182
|
+
let t = e[0] / 100, n = e[1] / 100, r = e[2] / 100, i = (.999999998 * t + .396337792 * n + .215803758 * r) ** 3, a = (1.000000008 * t - .105561342 * n - .063854175 * r) ** 3, o = (1.000000055 * t - .089484182 * n - 1.291485538 * r) ** 3, s = 1.227013851 * i - .55779998 * a + .281256149 * o, c = -.040580178 * i + 1.11225687 * a - .071676679 * o, l = -.076381285 * i - .421481978 * a + 1.58616322 * o;
|
|
1183
|
+
return [
|
|
1184
|
+
s * 100,
|
|
1185
|
+
c * 100,
|
|
1186
|
+
l * 100
|
|
1187
|
+
];
|
|
1188
|
+
}, u.oklab.rgb = function(e) {
|
|
1189
|
+
let t = e[0] / 100, n = e[1] / 100, r = e[2] / 100, i = (t + .3963377774 * n + .2158037573 * r) ** 3, a = (t - .1055613458 * n - .0638541728 * r) ** 3, o = (t - .0894841775 * n - 1.291485548 * r) ** 3, s = f(4.0767416621 * i - 3.3077115913 * a + .2309699292 * o), c = f(-1.2684380046 * i + 2.6097574011 * a - .3413193965 * o), l = f(-.0041960863 * i - .7034186147 * a + 1.707614701 * o);
|
|
1190
|
+
return [
|
|
1191
|
+
s * 255,
|
|
1192
|
+
c * 255,
|
|
1193
|
+
l * 255
|
|
1194
|
+
];
|
|
1195
|
+
}, u.oklch.oklab = function(e) {
|
|
1196
|
+
return u.lch.lab(e);
|
|
1197
|
+
}, u.lab.xyz = function(e) {
|
|
1198
|
+
let t = e[0], n = e[1], r = e[2], i, a, o;
|
|
1199
|
+
a = (t + 16) / 116, i = n / 500 + a, o = a - r / 200;
|
|
1200
|
+
let s = a ** 3, c = i ** 3, l = o ** 3;
|
|
1201
|
+
return a = s > d ? s : (a - 16 / 116) / 7.787, i = c > d ? c : (i - 16 / 116) / 7.787, o = l > d ? l : (o - 16 / 116) / 7.787, i *= 95.047, a *= 100, o *= 108.883, [
|
|
1202
|
+
i,
|
|
1203
|
+
a,
|
|
1204
|
+
o
|
|
1205
|
+
];
|
|
1206
|
+
}, u.lab.lch = function(e) {
|
|
1207
|
+
let t = e[0], n = e[1], r = e[2], i;
|
|
1208
|
+
return i = Math.atan2(r, n) * 360 / 2 / Math.PI, i < 0 && (i += 360), [
|
|
1209
|
+
t,
|
|
1210
|
+
Math.sqrt(n * n + r * r),
|
|
1211
|
+
i
|
|
1212
|
+
];
|
|
1213
|
+
}, u.lch.lab = function(e) {
|
|
1214
|
+
let t = e[0], n = e[1], r = e[2] / 360 * 2 * Math.PI;
|
|
1215
|
+
return [
|
|
1216
|
+
t,
|
|
1217
|
+
n * Math.cos(r),
|
|
1218
|
+
n * Math.sin(r)
|
|
1219
|
+
];
|
|
1220
|
+
}, u.rgb.ansi16 = function(e, t = null) {
|
|
1221
|
+
let [n, r, i] = e, a = t === null ? u.rgb.hsv(e)[2] : t;
|
|
1222
|
+
if (a = Math.round(a / 50), a === 0) return 30;
|
|
1223
|
+
let o = 30 + (Math.round(i / 255) << 2 | Math.round(r / 255) << 1 | Math.round(n / 255));
|
|
1224
|
+
return a === 2 && (o += 60), o;
|
|
1225
|
+
}, u.hsv.ansi16 = function(e) {
|
|
1226
|
+
return u.rgb.ansi16(u.hsv.rgb(e), e[2]);
|
|
1227
|
+
}, u.rgb.ansi256 = function(e) {
|
|
1228
|
+
let t = e[0], n = e[1], r = e[2];
|
|
1229
|
+
return t >> 4 == n >> 4 && n >> 4 == r >> 4 ? t < 8 ? 16 : t > 248 ? 231 : Math.round((t - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(t / 255 * 5) + 6 * Math.round(n / 255 * 5) + Math.round(r / 255 * 5);
|
|
1230
|
+
}, u.ansi16.rgb = function(e) {
|
|
1231
|
+
e = e[0];
|
|
1232
|
+
let t = e % 10;
|
|
1233
|
+
if (t === 0 || t === 7) return e > 50 && (t += 3.5), t = t / 10.5 * 255, [
|
|
1234
|
+
t,
|
|
1235
|
+
t,
|
|
1236
|
+
t
|
|
1237
|
+
];
|
|
1238
|
+
let n = (Math.trunc(e > 50) + 1) * .5;
|
|
1239
|
+
return [
|
|
1240
|
+
(t & 1) * n * 255,
|
|
1241
|
+
(t >> 1 & 1) * n * 255,
|
|
1242
|
+
(t >> 2 & 1) * n * 255
|
|
1243
|
+
];
|
|
1244
|
+
}, u.ansi256.rgb = function(e) {
|
|
1245
|
+
if (e = e[0], e >= 232) {
|
|
1246
|
+
let t = (e - 232) * 10 + 8;
|
|
1247
|
+
return [
|
|
1248
|
+
t,
|
|
1249
|
+
t,
|
|
1250
|
+
t
|
|
1251
|
+
];
|
|
1252
|
+
}
|
|
1253
|
+
e -= 16;
|
|
1254
|
+
let t;
|
|
1255
|
+
return [
|
|
1256
|
+
Math.floor(e / 36) / 5 * 255,
|
|
1257
|
+
Math.floor((t = e % 36) / 6) / 5 * 255,
|
|
1258
|
+
t % 6 / 5 * 255
|
|
1259
|
+
];
|
|
1260
|
+
}, u.rgb.hex = function(e) {
|
|
1261
|
+
let t = (((Math.round(e[0]) & 255) << 16) + ((Math.round(e[1]) & 255) << 8) + (Math.round(e[2]) & 255)).toString(16).toUpperCase();
|
|
1262
|
+
return "000000".slice(t.length) + t;
|
|
1263
|
+
}, u.hex.rgb = function(e) {
|
|
1264
|
+
let t = e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);
|
|
1265
|
+
if (!t) return [
|
|
1266
|
+
0,
|
|
1267
|
+
0,
|
|
1268
|
+
0
|
|
1269
|
+
];
|
|
1270
|
+
let n = t[0];
|
|
1271
|
+
t[0].length === 3 && (n = [...n].map((e) => e + e).join(""));
|
|
1272
|
+
let r = Number.parseInt(n, 16);
|
|
1273
|
+
return [
|
|
1274
|
+
r >> 16 & 255,
|
|
1275
|
+
r >> 8 & 255,
|
|
1276
|
+
r & 255
|
|
1277
|
+
];
|
|
1278
|
+
}, u.rgb.hcg = function(e) {
|
|
1279
|
+
let t = e[0] / 255, n = e[1] / 255, r = e[2] / 255, i = Math.max(Math.max(t, n), r), a = Math.min(Math.min(t, n), r), o = i - a, s, c = o < 1 ? a / (1 - o) : 0;
|
|
1280
|
+
return s = o <= 0 ? 0 : i === t ? (n - r) / o % 6 : i === n ? 2 + (r - t) / o : 4 + (t - n) / o, s /= 6, s %= 1, [
|
|
1281
|
+
s * 360,
|
|
1282
|
+
o * 100,
|
|
1283
|
+
c * 100
|
|
1284
|
+
];
|
|
1285
|
+
}, u.hsl.hcg = function(e) {
|
|
1286
|
+
let t = e[1] / 100, n = e[2] / 100, r = n < .5 ? 2 * t * n : 2 * t * (1 - n), i = 0;
|
|
1287
|
+
return r < 1 && (i = (n - .5 * r) / (1 - r)), [
|
|
1288
|
+
e[0],
|
|
1289
|
+
r * 100,
|
|
1290
|
+
i * 100
|
|
1291
|
+
];
|
|
1292
|
+
}, u.hsv.hcg = function(e) {
|
|
1293
|
+
let t = e[1] / 100, n = e[2] / 100, r = t * n, i = 0;
|
|
1294
|
+
return r < 1 && (i = (n - r) / (1 - r)), [
|
|
1295
|
+
e[0],
|
|
1296
|
+
r * 100,
|
|
1297
|
+
i * 100
|
|
1298
|
+
];
|
|
1299
|
+
}, u.hcg.rgb = function(e) {
|
|
1300
|
+
let t = e[0] / 360, n = e[1] / 100, r = e[2] / 100;
|
|
1301
|
+
if (n === 0) return [
|
|
1302
|
+
r * 255,
|
|
1303
|
+
r * 255,
|
|
1304
|
+
r * 255
|
|
1305
|
+
];
|
|
1306
|
+
let i = [
|
|
1307
|
+
0,
|
|
1308
|
+
0,
|
|
1309
|
+
0
|
|
1310
|
+
], a = t % 1 * 6, o = a % 1, s = 1 - o, c = 0;
|
|
1311
|
+
switch (Math.floor(a)) {
|
|
1312
|
+
case 0:
|
|
1313
|
+
i[0] = 1, i[1] = o, i[2] = 0;
|
|
1314
|
+
break;
|
|
1315
|
+
case 1:
|
|
1316
|
+
i[0] = s, i[1] = 1, i[2] = 0;
|
|
1317
|
+
break;
|
|
1318
|
+
case 2:
|
|
1319
|
+
i[0] = 0, i[1] = 1, i[2] = o;
|
|
1320
|
+
break;
|
|
1321
|
+
case 3:
|
|
1322
|
+
i[0] = 0, i[1] = s, i[2] = 1;
|
|
1323
|
+
break;
|
|
1324
|
+
case 4:
|
|
1325
|
+
i[0] = o, i[1] = 0, i[2] = 1;
|
|
1326
|
+
break;
|
|
1327
|
+
default: i[0] = 1, i[1] = 0, i[2] = s;
|
|
1328
|
+
}
|
|
1329
|
+
return c = (1 - n) * r, [
|
|
1330
|
+
(n * i[0] + c) * 255,
|
|
1331
|
+
(n * i[1] + c) * 255,
|
|
1332
|
+
(n * i[2] + c) * 255
|
|
1333
|
+
];
|
|
1334
|
+
}, u.hcg.hsv = function(e) {
|
|
1335
|
+
let t = e[1] / 100, n = t + e[2] / 100 * (1 - t), r = 0;
|
|
1336
|
+
return n > 0 && (r = t / n), [
|
|
1337
|
+
e[0],
|
|
1338
|
+
r * 100,
|
|
1339
|
+
n * 100
|
|
1340
|
+
];
|
|
1341
|
+
}, u.hcg.hsl = function(e) {
|
|
1342
|
+
let t = e[1] / 100, n = e[2] / 100 * (1 - t) + .5 * t, r = 0;
|
|
1343
|
+
return n > 0 && n < .5 ? r = t / (2 * n) : n >= .5 && n < 1 && (r = t / (2 * (1 - n))), [
|
|
1344
|
+
e[0],
|
|
1345
|
+
r * 100,
|
|
1346
|
+
n * 100
|
|
1347
|
+
];
|
|
1348
|
+
}, u.hcg.hwb = function(e) {
|
|
1349
|
+
let t = e[1] / 100, n = t + e[2] / 100 * (1 - t);
|
|
1350
|
+
return [
|
|
1351
|
+
e[0],
|
|
1352
|
+
(n - t) * 100,
|
|
1353
|
+
(1 - n) * 100
|
|
1354
|
+
];
|
|
1355
|
+
}, u.hwb.hcg = function(e) {
|
|
1356
|
+
let t = e[1] / 100, n = 1 - e[2] / 100, r = n - t, i = 0;
|
|
1357
|
+
return r < 1 && (i = (n - r) / (1 - r)), [
|
|
1358
|
+
e[0],
|
|
1359
|
+
r * 100,
|
|
1360
|
+
i * 100
|
|
1361
|
+
];
|
|
1362
|
+
}, u.apple.rgb = function(e) {
|
|
1363
|
+
return [
|
|
1364
|
+
e[0] / 65535 * 255,
|
|
1365
|
+
e[1] / 65535 * 255,
|
|
1366
|
+
e[2] / 65535 * 255
|
|
1367
|
+
];
|
|
1368
|
+
}, u.rgb.apple = function(e) {
|
|
1369
|
+
return [
|
|
1370
|
+
e[0] / 255 * 65535,
|
|
1371
|
+
e[1] / 255 * 65535,
|
|
1372
|
+
e[2] / 255 * 65535
|
|
1373
|
+
];
|
|
1374
|
+
}, u.gray.rgb = function(e) {
|
|
1375
|
+
return [
|
|
1376
|
+
e[0] / 100 * 255,
|
|
1377
|
+
e[0] / 100 * 255,
|
|
1378
|
+
e[0] / 100 * 255
|
|
1379
|
+
];
|
|
1380
|
+
}, u.gray.hsl = function(e) {
|
|
1381
|
+
return [
|
|
1382
|
+
0,
|
|
1383
|
+
0,
|
|
1384
|
+
e[0]
|
|
1385
|
+
];
|
|
1386
|
+
}, u.gray.hsv = u.gray.hsl, u.gray.hwb = function(e) {
|
|
1387
|
+
return [
|
|
1388
|
+
0,
|
|
1389
|
+
100,
|
|
1390
|
+
e[0]
|
|
1391
|
+
];
|
|
1392
|
+
}, u.gray.cmyk = function(e) {
|
|
1393
|
+
return [
|
|
1394
|
+
0,
|
|
1395
|
+
0,
|
|
1396
|
+
0,
|
|
1397
|
+
e[0]
|
|
1398
|
+
];
|
|
1399
|
+
}, u.gray.lab = function(e) {
|
|
1400
|
+
return [
|
|
1401
|
+
e[0],
|
|
1402
|
+
0,
|
|
1403
|
+
0
|
|
1404
|
+
];
|
|
1405
|
+
}, u.gray.hex = function(e) {
|
|
1406
|
+
let t = Math.round(e[0] / 100 * 255) & 255, n = ((t << 16) + (t << 8) + t).toString(16).toUpperCase();
|
|
1407
|
+
return "000000".slice(n.length) + n;
|
|
1408
|
+
}, u.rgb.gray = function(e) {
|
|
1409
|
+
return [(e[0] + e[1] + e[2]) / 3 / 255 * 100];
|
|
1410
|
+
};
|
|
1411
|
+
//#endregion
|
|
1412
|
+
//#region node_modules/.pnpm/color-convert@3.1.3/node_modules/color-convert/route.js
|
|
1413
|
+
function h() {
|
|
1414
|
+
let e = {}, t = Object.keys(u);
|
|
1415
|
+
for (let { length: n } = t, r = 0; r < n; r++) e[t[r]] = {
|
|
1416
|
+
distance: -1,
|
|
1417
|
+
parent: null
|
|
1418
|
+
};
|
|
1419
|
+
return e;
|
|
1420
|
+
}
|
|
1421
|
+
function g(e) {
|
|
1422
|
+
let t = h(), n = [e];
|
|
1423
|
+
for (t[e].distance = 0; n.length > 0;) {
|
|
1424
|
+
let e = n.pop(), r = Object.keys(u[e]);
|
|
1425
|
+
for (let { length: i } = r, a = 0; a < i; a++) {
|
|
1426
|
+
let i = r[a], o = t[i];
|
|
1427
|
+
o.distance === -1 && (o.distance = t[e].distance + 1, o.parent = e, n.unshift(i));
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
return t;
|
|
1431
|
+
}
|
|
1432
|
+
function _(e, t) {
|
|
1433
|
+
return function(n) {
|
|
1434
|
+
return t(e(n));
|
|
1435
|
+
};
|
|
1436
|
+
}
|
|
1437
|
+
function v(e, t) {
|
|
1438
|
+
let n = [t[e].parent, e], r = u[t[e].parent][e], i = t[e].parent;
|
|
1439
|
+
for (; t[i].parent;) n.unshift(t[i].parent), r = _(u[t[i].parent][i], r), i = t[i].parent;
|
|
1440
|
+
return r.conversion = n, r;
|
|
1441
|
+
}
|
|
1442
|
+
function y(e) {
|
|
1443
|
+
let t = g(e), n = {}, r = Object.keys(t);
|
|
1444
|
+
for (let { length: e } = r, i = 0; i < e; i++) {
|
|
1445
|
+
let e = r[i];
|
|
1446
|
+
t[e].parent !== null && (n[e] = v(e, t));
|
|
1447
|
+
}
|
|
1448
|
+
return n;
|
|
1449
|
+
}
|
|
1450
|
+
//#endregion
|
|
1451
|
+
//#region node_modules/.pnpm/color-convert@3.1.3/node_modules/color-convert/index.js
|
|
1452
|
+
var b = {}, x = Object.keys(u);
|
|
1453
|
+
function S(e) {
|
|
1454
|
+
let t = function(...t) {
|
|
1455
|
+
let n = t[0];
|
|
1456
|
+
return n == null ? n : (n.length > 1 && (t = n), e(t));
|
|
1457
|
+
};
|
|
1458
|
+
return "conversion" in e && (t.conversion = e.conversion), t;
|
|
1459
|
+
}
|
|
1460
|
+
function C(e) {
|
|
1461
|
+
let t = function(...t) {
|
|
1462
|
+
let n = t[0];
|
|
1463
|
+
if (n == null) return n;
|
|
1464
|
+
n.length > 1 && (t = n);
|
|
1465
|
+
let r = e(t);
|
|
1466
|
+
if (typeof r == "object") for (let { length: e } = r, t = 0; t < e; t++) r[t] = Math.round(r[t]);
|
|
1467
|
+
return r;
|
|
1468
|
+
};
|
|
1469
|
+
return "conversion" in e && (t.conversion = e.conversion), t;
|
|
1470
|
+
}
|
|
1471
|
+
for (let e of x) {
|
|
1472
|
+
b[e] = {}, Object.defineProperty(b[e], "channels", { value: u[e].channels }), Object.defineProperty(b[e], "labels", { value: u[e].labels });
|
|
1473
|
+
let t = y(e), n = Object.keys(t);
|
|
1474
|
+
for (let r of n) {
|
|
1475
|
+
let n = t[r];
|
|
1476
|
+
b[e][r] = C(n), b[e][r].raw = S(n);
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
//#endregion
|
|
1480
|
+
//#region node_modules/.pnpm/color@5.0.3/node_modules/color/index.js
|
|
1481
|
+
var w = [
|
|
1482
|
+
"keyword",
|
|
1483
|
+
"gray",
|
|
1484
|
+
"hex"
|
|
1485
|
+
], T = {};
|
|
1486
|
+
for (let e of Object.keys(b)) T[[...b[e].labels].sort().join("")] = e;
|
|
1487
|
+
var E = {};
|
|
1488
|
+
function D(e, t) {
|
|
1489
|
+
if (!(this instanceof D)) return new D(e, t);
|
|
1490
|
+
if (t && t in w && (t = null), t && !(t in b)) throw Error("Unknown model: " + t);
|
|
1491
|
+
let n, r;
|
|
1492
|
+
if (e == null) this.model = "rgb", this.color = [
|
|
1493
|
+
0,
|
|
1494
|
+
0,
|
|
1495
|
+
0
|
|
1496
|
+
], this.valpha = 1;
|
|
1497
|
+
else if (e instanceof D) this.model = e.model, this.color = [...e.color], this.valpha = e.valpha;
|
|
1498
|
+
else if (typeof e == "string") {
|
|
1499
|
+
let t = o.get(e);
|
|
1500
|
+
if (t === null) throw Error("Unable to parse color from string: " + e);
|
|
1501
|
+
this.model = t.model, r = b[this.model].channels, this.color = t.value.slice(0, r), this.valpha = typeof t.value[r] == "number" ? t.value[r] : 1;
|
|
1502
|
+
} else if (e.length > 0) {
|
|
1503
|
+
this.model = t || "rgb", r = b[this.model].channels;
|
|
1504
|
+
let n = Array.prototype.slice.call(e, 0, r);
|
|
1505
|
+
this.color = re(n, r), this.valpha = typeof e[r] == "number" ? e[r] : 1;
|
|
1506
|
+
} else if (typeof e == "number") this.model = "rgb", this.color = [
|
|
1507
|
+
e >> 16 & 255,
|
|
1508
|
+
e >> 8 & 255,
|
|
1509
|
+
e & 255
|
|
1510
|
+
], this.valpha = 1;
|
|
1511
|
+
else {
|
|
1512
|
+
this.valpha = 1;
|
|
1513
|
+
let t = Object.keys(e);
|
|
1514
|
+
"alpha" in e && (t.splice(t.indexOf("alpha"), 1), this.valpha = typeof e.alpha == "number" ? e.alpha : 0);
|
|
1515
|
+
let r = t.sort().join("");
|
|
1516
|
+
if (!(r in T)) throw Error("Unable to parse color from object: " + JSON.stringify(e));
|
|
1517
|
+
this.model = T[r];
|
|
1518
|
+
let { labels: i } = b[this.model], a = [];
|
|
1519
|
+
for (n = 0; n < i.length; n++) a.push(e[i[n]]);
|
|
1520
|
+
this.color = re(a);
|
|
1521
|
+
}
|
|
1522
|
+
if (E[this.model]) for (r = b[this.model].channels, n = 0; n < r; n++) {
|
|
1523
|
+
let e = E[this.model][n];
|
|
1524
|
+
e && (this.color[n] = e(this.color[n]));
|
|
1525
|
+
}
|
|
1526
|
+
this.valpha = Math.max(0, Math.min(1, this.valpha)), Object.freeze && Object.freeze(this);
|
|
1527
|
+
}
|
|
1528
|
+
D.prototype = {
|
|
1529
|
+
toString() {
|
|
1530
|
+
return this.string();
|
|
1531
|
+
},
|
|
1532
|
+
toJSON() {
|
|
1533
|
+
return this[this.model]();
|
|
1534
|
+
},
|
|
1535
|
+
string(e) {
|
|
1536
|
+
let t = this.model in o.to ? this : this.rgb();
|
|
1537
|
+
t = t.round(typeof e == "number" ? e : 1);
|
|
1538
|
+
let n = t.valpha === 1 ? t.color : [...t.color, this.valpha];
|
|
1539
|
+
return o.to[t.model](...n);
|
|
1540
|
+
},
|
|
1541
|
+
percentString(e) {
|
|
1542
|
+
let t = this.rgb().round(typeof e == "number" ? e : 1), n = t.valpha === 1 ? t.color : [...t.color, this.valpha];
|
|
1543
|
+
return o.to.rgb.percent(...n);
|
|
1544
|
+
},
|
|
1545
|
+
array() {
|
|
1546
|
+
return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];
|
|
1547
|
+
},
|
|
1548
|
+
object() {
|
|
1549
|
+
let e = {}, { channels: t } = b[this.model], { labels: n } = b[this.model];
|
|
1550
|
+
for (let r = 0; r < t; r++) e[n[r]] = this.color[r];
|
|
1551
|
+
return this.valpha !== 1 && (e.alpha = this.valpha), e;
|
|
1552
|
+
},
|
|
1553
|
+
unitArray() {
|
|
1554
|
+
let e = this.rgb().color;
|
|
1555
|
+
return e[0] /= 255, e[1] /= 255, e[2] /= 255, this.valpha !== 1 && e.push(this.valpha), e;
|
|
1556
|
+
},
|
|
1557
|
+
unitObject() {
|
|
1558
|
+
let e = this.rgb().object();
|
|
1559
|
+
return e.r /= 255, e.g /= 255, e.b /= 255, this.valpha !== 1 && (e.alpha = this.valpha), e;
|
|
1560
|
+
},
|
|
1561
|
+
round(e) {
|
|
1562
|
+
return e = Math.max(e || 0, 0), new D([...this.color.map(te(e)), this.valpha], this.model);
|
|
1563
|
+
},
|
|
1564
|
+
alpha(e) {
|
|
1565
|
+
return e === void 0 ? this.valpha : new D([...this.color, Math.max(0, Math.min(1, e))], this.model);
|
|
1566
|
+
},
|
|
1567
|
+
red: O("rgb", 0, k(255)),
|
|
1568
|
+
green: O("rgb", 1, k(255)),
|
|
1569
|
+
blue: O("rgb", 2, k(255)),
|
|
1570
|
+
hue: O([
|
|
1571
|
+
"hsl",
|
|
1572
|
+
"hsv",
|
|
1573
|
+
"hsl",
|
|
1574
|
+
"hwb",
|
|
1575
|
+
"hcg"
|
|
1576
|
+
], 0, (e) => (e % 360 + 360) % 360),
|
|
1577
|
+
saturationl: O("hsl", 1, k(100)),
|
|
1578
|
+
lightness: O("hsl", 2, k(100)),
|
|
1579
|
+
saturationv: O("hsv", 1, k(100)),
|
|
1580
|
+
value: O("hsv", 2, k(100)),
|
|
1581
|
+
chroma: O("hcg", 1, k(100)),
|
|
1582
|
+
gray: O("hcg", 2, k(100)),
|
|
1583
|
+
white: O("hwb", 1, k(100)),
|
|
1584
|
+
wblack: O("hwb", 2, k(100)),
|
|
1585
|
+
cyan: O("cmyk", 0, k(100)),
|
|
1586
|
+
magenta: O("cmyk", 1, k(100)),
|
|
1587
|
+
yellow: O("cmyk", 2, k(100)),
|
|
1588
|
+
black: O("cmyk", 3, k(100)),
|
|
1589
|
+
x: O("xyz", 0, k(95.047)),
|
|
1590
|
+
y: O("xyz", 1, k(100)),
|
|
1591
|
+
z: O("xyz", 2, k(108.833)),
|
|
1592
|
+
l: O("lab", 0, k(100)),
|
|
1593
|
+
a: O("lab", 1),
|
|
1594
|
+
b: O("lab", 2),
|
|
1595
|
+
keyword(e) {
|
|
1596
|
+
return e === void 0 ? b[this.model].keyword(this.color) : new D(e);
|
|
1597
|
+
},
|
|
1598
|
+
hex(e) {
|
|
1599
|
+
return e === void 0 ? o.to.hex(...this.rgb().round().color) : new D(e);
|
|
1600
|
+
},
|
|
1601
|
+
hexa(e) {
|
|
1602
|
+
if (e !== void 0) return new D(e);
|
|
1603
|
+
let t = this.rgb().round().color, n = Math.round(this.valpha * 255).toString(16).toUpperCase();
|
|
1604
|
+
return n.length === 1 && (n = "0" + n), o.to.hex(...t) + n;
|
|
1605
|
+
},
|
|
1606
|
+
rgbNumber() {
|
|
1607
|
+
let e = this.rgb().color;
|
|
1608
|
+
return (e[0] & 255) << 16 | (e[1] & 255) << 8 | e[2] & 255;
|
|
1609
|
+
},
|
|
1610
|
+
luminosity() {
|
|
1611
|
+
let e = this.rgb().color, t = [];
|
|
1612
|
+
for (let [n, r] of e.entries()) {
|
|
1613
|
+
let e = r / 255;
|
|
1614
|
+
t[n] = e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
|
|
1615
|
+
}
|
|
1616
|
+
return .2126 * t[0] + .7152 * t[1] + .0722 * t[2];
|
|
1617
|
+
},
|
|
1618
|
+
contrast(e) {
|
|
1619
|
+
let t = this.luminosity(), n = e.luminosity();
|
|
1620
|
+
return t > n ? (t + .05) / (n + .05) : (n + .05) / (t + .05);
|
|
1621
|
+
},
|
|
1622
|
+
level(e) {
|
|
1623
|
+
let t = this.contrast(e);
|
|
1624
|
+
return t >= 7 ? "AAA" : t >= 4.5 ? "AA" : "";
|
|
1625
|
+
},
|
|
1626
|
+
isDark() {
|
|
1627
|
+
let e = this.rgb().color;
|
|
1628
|
+
return (e[0] * 2126 + e[1] * 7152 + e[2] * 722) / 1e4 < 128;
|
|
1629
|
+
},
|
|
1630
|
+
isLight() {
|
|
1631
|
+
return !this.isDark();
|
|
1632
|
+
},
|
|
1633
|
+
negate() {
|
|
1634
|
+
let e = this.rgb();
|
|
1635
|
+
for (let t = 0; t < 3; t++) e.color[t] = 255 - e.color[t];
|
|
1636
|
+
return e;
|
|
1637
|
+
},
|
|
1638
|
+
lighten(e) {
|
|
1639
|
+
let t = this.hsl();
|
|
1640
|
+
return t.color[2] += t.color[2] * e, t;
|
|
1641
|
+
},
|
|
1642
|
+
darken(e) {
|
|
1643
|
+
let t = this.hsl();
|
|
1644
|
+
return t.color[2] -= t.color[2] * e, t;
|
|
1645
|
+
},
|
|
1646
|
+
saturate(e) {
|
|
1647
|
+
let t = this.hsl();
|
|
1648
|
+
return t.color[1] += t.color[1] * e, t;
|
|
1649
|
+
},
|
|
1650
|
+
desaturate(e) {
|
|
1651
|
+
let t = this.hsl();
|
|
1652
|
+
return t.color[1] -= t.color[1] * e, t;
|
|
1653
|
+
},
|
|
1654
|
+
whiten(e) {
|
|
1655
|
+
let t = this.hwb();
|
|
1656
|
+
return t.color[1] += t.color[1] * e, t;
|
|
1657
|
+
},
|
|
1658
|
+
blacken(e) {
|
|
1659
|
+
let t = this.hwb();
|
|
1660
|
+
return t.color[2] += t.color[2] * e, t;
|
|
1661
|
+
},
|
|
1662
|
+
grayscale() {
|
|
1663
|
+
let e = this.rgb().color, t = e[0] * .3 + e[1] * .59 + e[2] * .11;
|
|
1664
|
+
return D.rgb(t, t, t);
|
|
1665
|
+
},
|
|
1666
|
+
fade(e) {
|
|
1667
|
+
return this.alpha(this.valpha - this.valpha * e);
|
|
1668
|
+
},
|
|
1669
|
+
opaquer(e) {
|
|
1670
|
+
return this.alpha(this.valpha + this.valpha * e);
|
|
1671
|
+
},
|
|
1672
|
+
rotate(e) {
|
|
1673
|
+
let t = this.hsl(), n = t.color[0];
|
|
1674
|
+
return n = (n + e) % 360, n = n < 0 ? 360 + n : n, t.color[0] = n, t;
|
|
1675
|
+
},
|
|
1676
|
+
mix(e, t) {
|
|
1677
|
+
if (!e || !e.rgb) throw Error("Argument to \"mix\" was not a Color instance, but rather an instance of " + typeof e);
|
|
1678
|
+
let n = e.rgb(), r = this.rgb(), i = t === void 0 ? .5 : t, a = 2 * i - 1, o = n.alpha() - r.alpha(), s = ((a * o === -1 ? a : (a + o) / (1 + a * o)) + 1) / 2, c = 1 - s;
|
|
1679
|
+
return D.rgb(s * n.red() + c * r.red(), s * n.green() + c * r.green(), s * n.blue() + c * r.blue(), n.alpha() * i + r.alpha() * (1 - i));
|
|
1680
|
+
}
|
|
1681
|
+
};
|
|
1682
|
+
for (let e of Object.keys(b)) {
|
|
1683
|
+
if (w.includes(e)) continue;
|
|
1684
|
+
let { channels: t } = b[e];
|
|
1685
|
+
D.prototype[e] = function(...t) {
|
|
1686
|
+
return this.model === e ? new D(this) : t.length > 0 ? new D(t, e) : new D([...ne(b[this.model][e].raw(this.color)), this.valpha], e);
|
|
1687
|
+
}, D[e] = function(...n) {
|
|
1688
|
+
let r = n[0];
|
|
1689
|
+
return typeof r == "number" && (r = re(n, t)), new D(r, e);
|
|
1690
|
+
};
|
|
1691
|
+
}
|
|
1692
|
+
function ee(e, t) {
|
|
1693
|
+
return Number(e.toFixed(t));
|
|
1694
|
+
}
|
|
1695
|
+
function te(e) {
|
|
1696
|
+
return function(t) {
|
|
1697
|
+
return ee(t, e);
|
|
1698
|
+
};
|
|
1699
|
+
}
|
|
1700
|
+
function O(e, t, n) {
|
|
1701
|
+
e = Array.isArray(e) ? e : [e];
|
|
1702
|
+
for (let r of e) (E[r] ||= [])[t] = n;
|
|
1703
|
+
return e = e[0], function(r) {
|
|
1704
|
+
let i;
|
|
1705
|
+
return r === void 0 ? (i = this[e]().color[t], n && (i = n(i)), i) : (n && (r = n(r)), i = this[e](), i.color[t] = r, i);
|
|
1706
|
+
};
|
|
1707
|
+
}
|
|
1708
|
+
function k(e) {
|
|
1709
|
+
return function(t) {
|
|
1710
|
+
return Math.max(0, Math.min(e, t));
|
|
1711
|
+
};
|
|
1712
|
+
}
|
|
1713
|
+
function ne(e) {
|
|
1714
|
+
return Array.isArray(e) ? e : [e];
|
|
1715
|
+
}
|
|
1716
|
+
function re(e, t) {
|
|
1717
|
+
for (let n = 0; n < t; n++) typeof e[n] != "number" && (e[n] = 0);
|
|
1718
|
+
return e;
|
|
1719
|
+
}
|
|
1720
|
+
//#endregion
|
|
1721
|
+
//#region packages/themes/token.js
|
|
1722
|
+
var A = {
|
|
1723
|
+
colorPrimary: "#1677ff",
|
|
1724
|
+
colorWarning: "#ffaa00",
|
|
1725
|
+
colorError: "#ff4d4f",
|
|
1726
|
+
colorText: "#ffffff"
|
|
1727
|
+
}, j = {
|
|
1728
|
+
viewBgc: "#383838",
|
|
1729
|
+
compBgc: "#141414",
|
|
1730
|
+
borderColor: "#444444",
|
|
1731
|
+
scrollColor: "#898181",
|
|
1732
|
+
iconColor: "#f5f5f5",
|
|
1733
|
+
disabledColor: "#666666",
|
|
1734
|
+
infoColor: "#999999",
|
|
1735
|
+
hoverWhite: "#ececec",
|
|
1736
|
+
fontSize: 14,
|
|
1737
|
+
iconSize: 18
|
|
1738
|
+
}, ie = "os-theme-light", ae = D("os-theme-light".includes("light") ? "#ffffff" : "#000000").alpha(.44).string(), oe = D(A.colorText).alpha(.45).string(), se = D(A.colorPrimary).alpha(.3).string(), ce = D(A.colorPrimary).desaturate(.45).string(), le = D(j.borderColor).whiten(.25).string(), ue = D(j.compBgc).mix(D("white"), .1).string(), de = D(j.hoverWhite).alpha(.15).string(), M = {
|
|
1739
|
+
token: {
|
|
1740
|
+
colorPrimary: A.colorPrimary,
|
|
1741
|
+
colorWarning: A.colorWarning,
|
|
1742
|
+
colorError: A.colorError,
|
|
1743
|
+
borderRadiusLG: 4,
|
|
1744
|
+
colorText: A.colorText,
|
|
1745
|
+
colorTextDescription: oe,
|
|
1746
|
+
colorTextPlaceholder: oe,
|
|
1747
|
+
colorBgContainer: j.compBgc,
|
|
1748
|
+
colorBgElevated: j.compBgc,
|
|
1749
|
+
colorIcon: j.iconColor,
|
|
1750
|
+
colorBorder: j.borderColor,
|
|
1751
|
+
controlItemBgActive: se,
|
|
1752
|
+
colorTextDisabled: j.disabledColor,
|
|
1753
|
+
colorBgContainerDisabled: D(j.disabledColor).lighten(.8).alpha(.08).string(),
|
|
1754
|
+
controlOutlineWidth: 0,
|
|
1755
|
+
colorBorderDisabled: le,
|
|
1756
|
+
colorTextQuaternary: oe
|
|
1757
|
+
},
|
|
1758
|
+
components: {
|
|
1759
|
+
Badge: { colorBorderBg: A.colorError },
|
|
1760
|
+
Tooltip: { colorBgSpotlight: "#424242" },
|
|
1761
|
+
Button: {
|
|
1762
|
+
borderColorDisabled: le,
|
|
1763
|
+
primaryShadow: "none"
|
|
1764
|
+
},
|
|
1765
|
+
Select: {
|
|
1766
|
+
controlItemBgActiveHover: ce,
|
|
1767
|
+
optionActiveBg: de
|
|
1768
|
+
},
|
|
1769
|
+
Modal: {
|
|
1770
|
+
padding: "10px",
|
|
1771
|
+
contentPadding: 0,
|
|
1772
|
+
contentBg: j.compBgc,
|
|
1773
|
+
titleColor: A.colorPrimary,
|
|
1774
|
+
colorText: A.colorText,
|
|
1775
|
+
titleLineHeight: "44px",
|
|
1776
|
+
algorithm: !0,
|
|
1777
|
+
headerMarginBottom: 0,
|
|
1778
|
+
footerMarginTop: 0,
|
|
1779
|
+
colorIcon: j.iconColor,
|
|
1780
|
+
colorIconHover: A.colorError
|
|
1781
|
+
},
|
|
1782
|
+
Message: {
|
|
1783
|
+
colorTextHeading: "inherit",
|
|
1784
|
+
contentBg: j.infoColor
|
|
1785
|
+
},
|
|
1786
|
+
ColorPicker: {
|
|
1787
|
+
popoverInnerPadding: "8px",
|
|
1788
|
+
marginSm: "8px"
|
|
1789
|
+
},
|
|
1790
|
+
DatePicker: {
|
|
1791
|
+
colorIcon: j.iconColor,
|
|
1792
|
+
cellActiveWithRangeBg: se,
|
|
1793
|
+
cellHoverBg: de
|
|
1794
|
+
},
|
|
1795
|
+
Table: {
|
|
1796
|
+
borderColor: j.borderColor,
|
|
1797
|
+
footerBg: ue,
|
|
1798
|
+
headerBg: ue,
|
|
1799
|
+
rowHoverBg: de,
|
|
1800
|
+
rowSelectedHoverBg: ce,
|
|
1801
|
+
stickyScrollBarBg: ae,
|
|
1802
|
+
colorSplit: ae
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
}, fe = (e) => {
|
|
1806
|
+
let t = e.split("."), n = M.components;
|
|
1807
|
+
for (let e of t) n = n[e];
|
|
1808
|
+
return n === M.components ? null : n;
|
|
1809
|
+
}, { getDesignToken: pe } = n, me = pe(M), he = {
|
|
1810
|
+
...M.token,
|
|
1811
|
+
...j
|
|
1812
|
+
}, ge = {
|
|
1813
|
+
...me,
|
|
1814
|
+
...j
|
|
1815
|
+
}, N = (e) => typeof e == "string", P = () => {
|
|
1816
|
+
let e, t, n = new Promise((n, r) => {
|
|
1817
|
+
e = n, t = r;
|
|
1818
|
+
});
|
|
1819
|
+
return n.resolve = e, n.reject = t, n;
|
|
1820
|
+
}, _e = (e) => e == null ? "" : String(e), ve = (e, t, n) => {
|
|
1821
|
+
e.forEach((e) => {
|
|
1822
|
+
t[e] && (n[e] = t[e]);
|
|
1823
|
+
});
|
|
1824
|
+
}, ye = /###/g, be = (e) => e && e.includes("###") ? e.replace(ye, ".") : e, xe = (e) => !e || N(e), F = (e, t, n) => {
|
|
1825
|
+
let r = N(t) ? t.split(".") : t, i = 0;
|
|
1826
|
+
for (; i < r.length - 1;) {
|
|
1827
|
+
if (xe(e)) return {};
|
|
1828
|
+
let t = be(r[i]);
|
|
1829
|
+
!e[t] && n && (e[t] = new n()), e = Object.prototype.hasOwnProperty.call(e, t) ? e[t] : {}, ++i;
|
|
1830
|
+
}
|
|
1831
|
+
return xe(e) ? {} : {
|
|
1832
|
+
obj: e,
|
|
1833
|
+
k: be(r[i])
|
|
1834
|
+
};
|
|
1835
|
+
}, Se = (e, t, n) => {
|
|
1836
|
+
let { obj: r, k: i } = F(e, t, Object);
|
|
1837
|
+
if (r !== void 0 || t.length === 1) {
|
|
1838
|
+
r[i] = n;
|
|
1839
|
+
return;
|
|
1840
|
+
}
|
|
1841
|
+
let a = t[t.length - 1], o = t.slice(0, t.length - 1), s = F(e, o, Object);
|
|
1842
|
+
for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s = F(e, o, Object), s?.obj && s.obj[`${s.k}.${a}`] !== void 0 && (s.obj = void 0);
|
|
1843
|
+
s.obj[`${s.k}.${a}`] = n;
|
|
1844
|
+
}, Ce = (e, t, n, r) => {
|
|
1845
|
+
let { obj: i, k: a } = F(e, t, Object);
|
|
1846
|
+
i[a] = i[a] || [], i[a].push(n);
|
|
1847
|
+
}, I = (e, t) => {
|
|
1848
|
+
let { obj: n, k: r } = F(e, t);
|
|
1849
|
+
if (n && Object.prototype.hasOwnProperty.call(n, r)) return n[r];
|
|
1850
|
+
}, we = (e, t, n) => {
|
|
1851
|
+
let r = I(e, n);
|
|
1852
|
+
return r === void 0 ? I(t, n) : r;
|
|
1853
|
+
}, Te = (e, t, n) => {
|
|
1854
|
+
for (let r in t) r !== "__proto__" && r !== "constructor" && (Object.prototype.hasOwnProperty.call(e, r) ? N(e[r]) || e[r] instanceof String || N(t[r]) || t[r] instanceof String ? n && (e[r] = t[r]) : Te(e[r], t[r], n) : e[r] = t[r]);
|
|
1855
|
+
return e;
|
|
1856
|
+
}, L = (e) => e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), Ee = {
|
|
1857
|
+
"&": "&",
|
|
1858
|
+
"<": "<",
|
|
1859
|
+
">": ">",
|
|
1860
|
+
"\"": """,
|
|
1861
|
+
"'": "'",
|
|
1862
|
+
"/": "/"
|
|
1863
|
+
}, De = (e) => N(e) ? e.replace(/[&<>"'\/]/g, (e) => Ee[e]) : e, Oe = class {
|
|
1864
|
+
constructor(e) {
|
|
1865
|
+
this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
1866
|
+
}
|
|
1867
|
+
getRegExp(e) {
|
|
1868
|
+
let t = this.regExpMap.get(e);
|
|
1869
|
+
if (t !== void 0) return t;
|
|
1870
|
+
let n = new RegExp(e);
|
|
1871
|
+
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
|
|
1872
|
+
}
|
|
1873
|
+
}, ke = [
|
|
1874
|
+
" ",
|
|
1875
|
+
",",
|
|
1876
|
+
"?",
|
|
1877
|
+
"!",
|
|
1878
|
+
";"
|
|
1879
|
+
], Ae = new Oe(20), je = (e, t, n) => {
|
|
1880
|
+
t ||= "", n ||= "";
|
|
1881
|
+
let r = ke.filter((e) => !t.includes(e) && !n.includes(e));
|
|
1882
|
+
if (r.length === 0) return !0;
|
|
1883
|
+
let i = Ae.getRegExp(`(${r.map((e) => e === "?" ? "\\?" : e).join("|")})`), a = !i.test(e);
|
|
1884
|
+
if (!a) {
|
|
1885
|
+
let t = e.indexOf(n);
|
|
1886
|
+
t > 0 && !i.test(e.substring(0, t)) && (a = !0);
|
|
1887
|
+
}
|
|
1888
|
+
return a;
|
|
1889
|
+
}, Me = (e, t, n = ".") => {
|
|
1890
|
+
if (!e) return;
|
|
1891
|
+
if (e[t]) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
|
|
1892
|
+
let r = t.split(n), i = e;
|
|
1893
|
+
for (let e = 0; e < r.length;) {
|
|
1894
|
+
if (!i || typeof i != "object") return;
|
|
1895
|
+
let t, a = "";
|
|
1896
|
+
for (let o = e; o < r.length; ++o) if (o !== e && (a += n), a += r[o], t = i[a], t !== void 0) {
|
|
1897
|
+
if ([
|
|
1898
|
+
"string",
|
|
1899
|
+
"number",
|
|
1900
|
+
"boolean"
|
|
1901
|
+
].includes(typeof t) && o < r.length - 1) continue;
|
|
1902
|
+
e += o - e + 1;
|
|
1903
|
+
break;
|
|
1904
|
+
}
|
|
1905
|
+
i = t;
|
|
1906
|
+
}
|
|
1907
|
+
return i;
|
|
1908
|
+
}, R = (e) => e?.replace(/_/g, "-"), Ne = {
|
|
1909
|
+
type: "logger",
|
|
1910
|
+
log(e) {
|
|
1911
|
+
this.output("log", e);
|
|
1912
|
+
},
|
|
1913
|
+
warn(e) {
|
|
1914
|
+
this.output("warn", e);
|
|
1915
|
+
},
|
|
1916
|
+
error(e) {
|
|
1917
|
+
this.output("error", e);
|
|
1918
|
+
},
|
|
1919
|
+
output(e, t) {
|
|
1920
|
+
console?.[e]?.apply?.(console, t);
|
|
1921
|
+
}
|
|
1922
|
+
}, z = new class e {
|
|
1923
|
+
constructor(e, t = {}) {
|
|
1924
|
+
this.init(e, t);
|
|
1925
|
+
}
|
|
1926
|
+
init(e, t = {}) {
|
|
1927
|
+
this.prefix = t.prefix || "i18next:", this.logger = e || Ne, this.options = t, this.debug = t.debug;
|
|
1928
|
+
}
|
|
1929
|
+
log(...e) {
|
|
1930
|
+
return this.forward(e, "log", "", !0);
|
|
1931
|
+
}
|
|
1932
|
+
warn(...e) {
|
|
1933
|
+
return this.forward(e, "warn", "", !0);
|
|
1934
|
+
}
|
|
1935
|
+
error(...e) {
|
|
1936
|
+
return this.forward(e, "error", "");
|
|
1937
|
+
}
|
|
1938
|
+
deprecate(...e) {
|
|
1939
|
+
return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
|
|
1940
|
+
}
|
|
1941
|
+
forward(e, t, n, r) {
|
|
1942
|
+
return r && !this.debug ? null : (e = e.map((e) => N(e) ? e.replace(/[\r\n\x00-\x1F\x7F]/g, " ") : e), N(e[0]) && (e[0] = `${n}${this.prefix} ${e[0]}`), this.logger[t](e));
|
|
1943
|
+
}
|
|
1944
|
+
create(t) {
|
|
1945
|
+
return new e(this.logger, {
|
|
1946
|
+
prefix: `${this.prefix}:${t}:`,
|
|
1947
|
+
...this.options
|
|
1948
|
+
});
|
|
1949
|
+
}
|
|
1950
|
+
clone(t) {
|
|
1951
|
+
return t ||= this.options, t.prefix = t.prefix || this.prefix, new e(this.logger, t);
|
|
1952
|
+
}
|
|
1953
|
+
}(), B = class {
|
|
1954
|
+
constructor() {
|
|
1955
|
+
this.observers = {};
|
|
1956
|
+
}
|
|
1957
|
+
on(e, t) {
|
|
1958
|
+
return e.split(" ").forEach((e) => {
|
|
1959
|
+
this.observers[e] || (this.observers[e] = /* @__PURE__ */ new Map());
|
|
1960
|
+
let n = this.observers[e].get(t) || 0;
|
|
1961
|
+
this.observers[e].set(t, n + 1);
|
|
1962
|
+
}), this;
|
|
1963
|
+
}
|
|
1964
|
+
off(e, t) {
|
|
1965
|
+
if (this.observers[e]) {
|
|
1966
|
+
if (!t) {
|
|
1967
|
+
delete this.observers[e];
|
|
1968
|
+
return;
|
|
1969
|
+
}
|
|
1970
|
+
this.observers[e].delete(t);
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
once(e, t) {
|
|
1974
|
+
let n = (...r) => {
|
|
1975
|
+
t(...r), this.off(e, n);
|
|
1976
|
+
};
|
|
1977
|
+
return this.on(e, n), this;
|
|
1978
|
+
}
|
|
1979
|
+
emit(e, ...t) {
|
|
1980
|
+
this.observers[e] && Array.from(this.observers[e].entries()).forEach(([e, n]) => {
|
|
1981
|
+
for (let r = 0; r < n; r++) e(...t);
|
|
1982
|
+
}), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([n, r]) => {
|
|
1983
|
+
for (let i = 0; i < r; i++) n(e, ...t);
|
|
1984
|
+
});
|
|
1985
|
+
}
|
|
1986
|
+
}, Pe = class extends B {
|
|
1987
|
+
constructor(e, t = {
|
|
1988
|
+
ns: ["translation"],
|
|
1989
|
+
defaultNS: "translation"
|
|
1990
|
+
}) {
|
|
1991
|
+
super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
|
|
1992
|
+
}
|
|
1993
|
+
addNamespaces(e) {
|
|
1994
|
+
this.options.ns.includes(e) || this.options.ns.push(e);
|
|
1995
|
+
}
|
|
1996
|
+
removeNamespaces(e) {
|
|
1997
|
+
let t = this.options.ns.indexOf(e);
|
|
1998
|
+
t > -1 && this.options.ns.splice(t, 1);
|
|
1999
|
+
}
|
|
2000
|
+
getResource(e, t, n, r = {}) {
|
|
2001
|
+
let i = r.keySeparator === void 0 ? this.options.keySeparator : r.keySeparator, a = r.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r.ignoreJSONStructure, o;
|
|
2002
|
+
e.includes(".") ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) : N(n) && i ? o.push(...n.split(i)) : o.push(n)));
|
|
2003
|
+
let s = I(this.data, o);
|
|
2004
|
+
return !s && !t && !n && e.includes(".") && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !N(n) ? s : Me(this.data?.[e]?.[t], n, i);
|
|
2005
|
+
}
|
|
2006
|
+
addResource(e, t, n, r, i = { silent: !1 }) {
|
|
2007
|
+
let a = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, o = [e, t];
|
|
2008
|
+
n && (o = o.concat(a ? n.split(a) : n)), e.includes(".") && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t), Se(this.data, o, r), i.silent || this.emit("added", e, t, n, r);
|
|
2009
|
+
}
|
|
2010
|
+
addResources(e, t, n, r = { silent: !1 }) {
|
|
2011
|
+
for (let r in n) (N(n[r]) || Array.isArray(n[r])) && this.addResource(e, t, r, n[r], { silent: !0 });
|
|
2012
|
+
r.silent || this.emit("added", e, t, n);
|
|
2013
|
+
}
|
|
2014
|
+
addResourceBundle(e, t, n, r, i, a = {
|
|
2015
|
+
silent: !1,
|
|
2016
|
+
skipCopy: !1
|
|
2017
|
+
}) {
|
|
2018
|
+
let o = [e, t];
|
|
2019
|
+
e.includes(".") && (o = e.split("."), r = n, n = t, t = o[1]), this.addNamespaces(t);
|
|
2020
|
+
let s = I(this.data, o) || {};
|
|
2021
|
+
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ? Te(s, n, i) : s = {
|
|
2022
|
+
...s,
|
|
2023
|
+
...n
|
|
2024
|
+
}, Se(this.data, o, s), a.silent || this.emit("added", e, t, n);
|
|
2025
|
+
}
|
|
2026
|
+
removeResourceBundle(e, t) {
|
|
2027
|
+
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
2028
|
+
}
|
|
2029
|
+
hasResourceBundle(e, t) {
|
|
2030
|
+
return this.getResource(e, t) !== void 0;
|
|
2031
|
+
}
|
|
2032
|
+
getResourceBundle(e, t) {
|
|
2033
|
+
return t ||= this.options.defaultNS, this.getResource(e, t);
|
|
2034
|
+
}
|
|
2035
|
+
getDataByLanguage(e) {
|
|
2036
|
+
return this.data[e];
|
|
2037
|
+
}
|
|
2038
|
+
hasLanguageSomeTranslations(e) {
|
|
2039
|
+
let t = this.getDataByLanguage(e);
|
|
2040
|
+
return !!(t && Object.keys(t) || []).find((e) => t[e] && Object.keys(t[e]).length > 0);
|
|
2041
|
+
}
|
|
2042
|
+
toJSON() {
|
|
2043
|
+
return this.data;
|
|
2044
|
+
}
|
|
2045
|
+
}, Fe = {
|
|
2046
|
+
processors: {},
|
|
2047
|
+
addPostProcessor(e) {
|
|
2048
|
+
this.processors[e.name] = e;
|
|
2049
|
+
},
|
|
2050
|
+
handle(e, t, n, r, i) {
|
|
2051
|
+
return e.forEach((e) => {
|
|
2052
|
+
t = this.processors[e]?.process(t, n, r, i) ?? t;
|
|
2053
|
+
}), t;
|
|
2054
|
+
}
|
|
2055
|
+
}, Ie = Symbol("i18next/PATH_KEY");
|
|
2056
|
+
function Le() {
|
|
2057
|
+
let e = [], t = Object.create(null), n;
|
|
2058
|
+
return t.get = (r, i) => (n?.revoke?.(), i === Ie ? e : (e.push(i), n = Proxy.revocable(r, t), n.proxy)), Proxy.revocable(Object.create(null), t).proxy;
|
|
2059
|
+
}
|
|
2060
|
+
function V(e, t) {
|
|
2061
|
+
let { [Ie]: n } = e(Le()), r = t?.keySeparator ?? ".", i = t?.nsSeparator ?? ":", a = t?.enableSelector === "strict";
|
|
2062
|
+
if (n.length > 1 && i) {
|
|
2063
|
+
let e = t?.ns, o = a ? Array.isArray(e) ? e : e ? [e] : null : Array.isArray(e) ? e : null;
|
|
2064
|
+
if (o && (a ? o : o.length > 1 ? o.slice(1) : []).includes(n[0])) return `${n[0]}${i}${n.slice(1).join(r)}`;
|
|
2065
|
+
}
|
|
2066
|
+
return n.join(r);
|
|
2067
|
+
}
|
|
2068
|
+
var Re = (e) => !N(e) && typeof e != "boolean" && typeof e != "number", ze = class e extends B {
|
|
2069
|
+
constructor(e, t = {}) {
|
|
2070
|
+
super(), ve([
|
|
2071
|
+
"resourceStore",
|
|
2072
|
+
"languageUtils",
|
|
2073
|
+
"pluralResolver",
|
|
2074
|
+
"interpolator",
|
|
2075
|
+
"backendConnector",
|
|
2076
|
+
"i18nFormat",
|
|
2077
|
+
"utils"
|
|
2078
|
+
], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = z.create("translator"), this.checkedLoadedFor = {};
|
|
2079
|
+
}
|
|
2080
|
+
changeLanguage(e) {
|
|
2081
|
+
e && (this.language = e);
|
|
2082
|
+
}
|
|
2083
|
+
exists(e, t = { interpolation: {} }) {
|
|
2084
|
+
let n = { ...t };
|
|
2085
|
+
if (e == null) return !1;
|
|
2086
|
+
let r = this.resolve(e, n);
|
|
2087
|
+
if (r?.res === void 0) return !1;
|
|
2088
|
+
let i = Re(r.res);
|
|
2089
|
+
return !(n.returnObjects === !1 && i);
|
|
2090
|
+
}
|
|
2091
|
+
extractFromKey(e, t) {
|
|
2092
|
+
let n = t.nsSeparator === void 0 ? this.options.nsSeparator : t.nsSeparator;
|
|
2093
|
+
n === void 0 && (n = ":");
|
|
2094
|
+
let r = t.keySeparator === void 0 ? this.options.keySeparator : t.keySeparator, i = t.ns || this.options.defaultNS || [], a = n && e.includes(n), o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !je(e, n, r);
|
|
2095
|
+
if (a && !o) {
|
|
2096
|
+
let t = e.match(this.interpolator.nestingRegexp);
|
|
2097
|
+
if (t && t.length > 0) return {
|
|
2098
|
+
key: e,
|
|
2099
|
+
namespaces: N(i) ? [i] : i
|
|
2100
|
+
};
|
|
2101
|
+
let a = e.split(n);
|
|
2102
|
+
(n !== r || n === r && this.options.ns.includes(a[0])) && (i = a.shift()), e = a.join(r);
|
|
2103
|
+
}
|
|
2104
|
+
return {
|
|
2105
|
+
key: e,
|
|
2106
|
+
namespaces: N(i) ? [i] : i
|
|
2107
|
+
};
|
|
2108
|
+
}
|
|
2109
|
+
translate(t, n, r) {
|
|
2110
|
+
let i = typeof n == "object" ? { ...n } : n;
|
|
2111
|
+
if (typeof i != "object" && this.options.overloadTranslationOptionHandler && (i = this.options.overloadTranslationOptionHandler(arguments)), typeof i == "object" && (i = { ...i }), i ||= {}, t == null) return "";
|
|
2112
|
+
typeof t == "function" && (t = V(t, {
|
|
2113
|
+
...this.options,
|
|
2114
|
+
...i
|
|
2115
|
+
})), Array.isArray(t) || (t = [String(t)]), t = t.map((e) => typeof e == "function" ? V(e, {
|
|
2116
|
+
...this.options,
|
|
2117
|
+
...i
|
|
2118
|
+
}) : String(e));
|
|
2119
|
+
let a = i.returnDetails === void 0 ? this.options.returnDetails : i.returnDetails, o = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, { key: s, namespaces: c } = this.extractFromKey(t[t.length - 1], i), l = c[c.length - 1], u = i.nsSeparator === void 0 ? this.options.nsSeparator : i.nsSeparator;
|
|
2120
|
+
u === void 0 && (u = ":");
|
|
2121
|
+
let d = i.lng || this.language, f = i.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
2122
|
+
if (d?.toLowerCase() === "cimode") return f ? a ? {
|
|
2123
|
+
res: `${l}${u}${s}`,
|
|
2124
|
+
usedKey: s,
|
|
2125
|
+
exactUsedKey: s,
|
|
2126
|
+
usedLng: d,
|
|
2127
|
+
usedNS: l,
|
|
2128
|
+
usedParams: this.getUsedParamsDetails(i)
|
|
2129
|
+
} : `${l}${u}${s}` : a ? {
|
|
2130
|
+
res: s,
|
|
2131
|
+
usedKey: s,
|
|
2132
|
+
exactUsedKey: s,
|
|
2133
|
+
usedLng: d,
|
|
2134
|
+
usedNS: l,
|
|
2135
|
+
usedParams: this.getUsedParamsDetails(i)
|
|
2136
|
+
} : s;
|
|
2137
|
+
let p = this.resolve(t, i), m = p?.res, h = p?.usedKey || s, g = p?.exactUsedKey || s, _ = [
|
|
2138
|
+
"[object Number]",
|
|
2139
|
+
"[object Function]",
|
|
2140
|
+
"[object RegExp]"
|
|
2141
|
+
], v = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, y = !this.i18nFormat || this.i18nFormat.handleAsObject, b = i.count !== void 0 && !N(i.count), x = e.hasDefaultValue(i), S = b ? this.pluralResolver.getSuffix(d, i.count, i) : "", C = i.ordinal && b ? this.pluralResolver.getSuffix(d, i.count, { ordinal: !1 }) : "", w = b && !i.ordinal && i.count === 0, T = w && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${S}`] || i[`defaultValue${C}`] || i.defaultValue, E = m;
|
|
2142
|
+
y && !m && x && (E = T);
|
|
2143
|
+
let D = Re(E), ee = Object.prototype.toString.apply(E);
|
|
2144
|
+
if (y && E && D && !_.includes(ee) && !(N(v) && Array.isArray(E))) {
|
|
2145
|
+
if (!i.returnObjects && !this.options.returnObjects) {
|
|
2146
|
+
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
2147
|
+
let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(h, E, {
|
|
2148
|
+
...i,
|
|
2149
|
+
ns: c
|
|
2150
|
+
}) : `key '${s} (${this.language})' returned an object instead of string.`;
|
|
2151
|
+
return a ? (p.res = e, p.usedParams = this.getUsedParamsDetails(i), p) : e;
|
|
2152
|
+
}
|
|
2153
|
+
if (o) {
|
|
2154
|
+
let e = Array.isArray(E), t = e ? [] : {}, n = e ? g : h;
|
|
2155
|
+
for (let e in E) if (Object.prototype.hasOwnProperty.call(E, e)) {
|
|
2156
|
+
let r = `${n}${o}${e}`;
|
|
2157
|
+
x && !m ? t[e] = this.translate(r, {
|
|
2158
|
+
...i,
|
|
2159
|
+
defaultValue: Re(T) ? T[e] : void 0,
|
|
2160
|
+
joinArrays: !1,
|
|
2161
|
+
ns: c
|
|
2162
|
+
}) : t[e] = this.translate(r, {
|
|
2163
|
+
...i,
|
|
2164
|
+
joinArrays: !1,
|
|
2165
|
+
ns: c
|
|
2166
|
+
}), t[e] === r && (t[e] = E[e]);
|
|
2167
|
+
}
|
|
2168
|
+
m = t;
|
|
2169
|
+
}
|
|
2170
|
+
} else if (y && N(v) && Array.isArray(m)) m = m.join(v), m &&= this.extendTranslation(m, t, i, r);
|
|
2171
|
+
else {
|
|
2172
|
+
let e = !1, n = !1;
|
|
2173
|
+
!this.isValidLookup(m) && x && (e = !0, m = T), this.isValidLookup(m) || (n = !0, m = s);
|
|
2174
|
+
let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : m, c = x && T !== m && this.options.updateMissing;
|
|
2175
|
+
if (n || e || c) {
|
|
2176
|
+
if (this.logger.log(c ? "updateKey" : "missingKey", d, l, b && !c ? `${s}${this.pluralResolver.getSuffix(d, i.count, i)}` : s, c ? T : m), o) {
|
|
2177
|
+
let e = this.resolve(s, {
|
|
2178
|
+
...i,
|
|
2179
|
+
keySeparator: !1
|
|
2180
|
+
});
|
|
2181
|
+
e && e.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
|
|
2182
|
+
}
|
|
2183
|
+
let e = [], t = this.languageUtils.getFallbackCodes(this.options.fallbackLng, i.lng || this.language);
|
|
2184
|
+
if (this.options.saveMissingTo === "fallback" && t && t[0]) for (let n = 0; n < t.length; n++) e.push(t[n]);
|
|
2185
|
+
else this.options.saveMissingTo === "all" ? e = this.languageUtils.toResolveHierarchy(i.lng || this.language) : e.push(i.lng || this.language);
|
|
2186
|
+
let n = (e, t, n) => {
|
|
2187
|
+
let r = x && n !== m ? n : a;
|
|
2188
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(e, l, t, r, c, i) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(e, l, t, r, c, i), this.emit("missingKey", e, l, t, m);
|
|
2189
|
+
};
|
|
2190
|
+
this.options.saveMissing && (this.options.saveMissingPlurals && b ? e.forEach((e) => {
|
|
2191
|
+
let t = this.pluralResolver.getSuffixes(e, i);
|
|
2192
|
+
w && i[`defaultValue${this.options.pluralSeparator}zero`] && !t.includes(`${this.options.pluralSeparator}zero`) && t.push(`${this.options.pluralSeparator}zero`), t.forEach((t) => {
|
|
2193
|
+
n([e], s + t, i[`defaultValue${t}`] || T);
|
|
2194
|
+
});
|
|
2195
|
+
}) : n(e, s, T));
|
|
2196
|
+
}
|
|
2197
|
+
m = this.extendTranslation(m, t, i, p, r), n && m === s && this.options.appendNamespaceToMissingKey && (m = `${l}${u}${s}`), (n || e) && this.options.parseMissingKeyHandler && (m = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l}${u}${s}` : s, e ? m : void 0, i));
|
|
2198
|
+
}
|
|
2199
|
+
return a ? (p.res = m, p.usedParams = this.getUsedParamsDetails(i), p) : m;
|
|
2200
|
+
}
|
|
2201
|
+
extendTranslation(e, t, n, r, i) {
|
|
2202
|
+
if (this.i18nFormat?.parse) e = this.i18nFormat.parse(e, {
|
|
2203
|
+
...this.options.interpolation.defaultVariables,
|
|
2204
|
+
...n
|
|
2205
|
+
}, n.lng || this.language || r.usedLng, r.usedNS, r.usedKey, { resolved: r });
|
|
2206
|
+
else if (!n.skipInterpolation) {
|
|
2207
|
+
n.interpolation && this.interpolator.init({
|
|
2208
|
+
...n,
|
|
2209
|
+
interpolation: {
|
|
2210
|
+
...this.options.interpolation,
|
|
2211
|
+
...n.interpolation
|
|
2212
|
+
}
|
|
2213
|
+
});
|
|
2214
|
+
let a = N(e) && (n?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : n.interpolation.skipOnVariables), o;
|
|
2215
|
+
if (a) {
|
|
2216
|
+
let t = e.match(this.interpolator.nestingRegexp);
|
|
2217
|
+
o = t && t.length;
|
|
2218
|
+
}
|
|
2219
|
+
let s = n.replace && !N(n.replace) ? n.replace : n;
|
|
2220
|
+
if (this.options.interpolation.defaultVariables && (s = {
|
|
2221
|
+
...this.options.interpolation.defaultVariables,
|
|
2222
|
+
...s
|
|
2223
|
+
}), e = this.interpolator.interpolate(e, s, n.lng || this.language || r.usedLng, n), a) {
|
|
2224
|
+
let t = e.match(this.interpolator.nestingRegexp), r = t && t.length;
|
|
2225
|
+
o < r && (n.nest = !1);
|
|
2226
|
+
}
|
|
2227
|
+
!n.lng && r && r.res && (n.lng = this.language || r.usedLng), n.nest !== !1 && (e = this.interpolator.nest(e, (...e) => i?.[0] === e[0] && !n.context ? (this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`), null) : this.translate(...e, t), n)), n.interpolation && this.interpolator.reset();
|
|
2228
|
+
}
|
|
2229
|
+
let a = n.postProcess || this.options.postProcess, o = N(a) ? [a] : a;
|
|
2230
|
+
return e != null && o?.length && n.applyPostProcessor !== !1 && (e = Fe.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
|
|
2231
|
+
i18nResolved: {
|
|
2232
|
+
...r,
|
|
2233
|
+
usedParams: this.getUsedParamsDetails(n)
|
|
2234
|
+
},
|
|
2235
|
+
...n
|
|
2236
|
+
} : n, this)), e;
|
|
2237
|
+
}
|
|
2238
|
+
resolve(e, t = {}) {
|
|
2239
|
+
let n, r, i, a, o;
|
|
2240
|
+
return N(e) && (e = [e]), Array.isArray(e) && (e = e.map((e) => typeof e == "function" ? V(e, {
|
|
2241
|
+
...this.options,
|
|
2242
|
+
...t
|
|
2243
|
+
}) : e)), e.forEach((e) => {
|
|
2244
|
+
if (this.isValidLookup(n)) return;
|
|
2245
|
+
let s = this.extractFromKey(e, t), c = s.key;
|
|
2246
|
+
r = c;
|
|
2247
|
+
let l = s.namespaces;
|
|
2248
|
+
this.options.fallbackNS && (l = l.concat(this.options.fallbackNS));
|
|
2249
|
+
let u = t.count !== void 0 && !N(t.count), d = u && !t.ordinal && t.count === 0, f = t.context !== void 0 && (N(t.context) || typeof t.context == "number") && t.context !== "", p = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
|
|
2250
|
+
l.forEach((e) => {
|
|
2251
|
+
this.isValidLookup(n) || (o = e, !this.checkedLoadedFor[`${p[0]}-${e}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o) && (this.checkedLoadedFor[`${p[0]}-${e}`] = !0, this.logger.warn(`key "${r}" for languages "${p.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), p.forEach((r) => {
|
|
2252
|
+
if (this.isValidLookup(n)) return;
|
|
2253
|
+
a = r;
|
|
2254
|
+
let o = [c];
|
|
2255
|
+
if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(o, c, r, e, t);
|
|
2256
|
+
else {
|
|
2257
|
+
let e;
|
|
2258
|
+
u && (e = this.pluralResolver.getSuffix(r, t.count, t));
|
|
2259
|
+
let n = `${this.options.pluralSeparator}zero`, i = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
2260
|
+
if (u && (t.ordinal && e.startsWith(i) && o.push(c + e.replace(i, this.options.pluralSeparator)), o.push(c + e), d && o.push(c + n)), f) {
|
|
2261
|
+
let r = `${c}${this.options.contextSeparator || "_"}${t.context}`;
|
|
2262
|
+
o.push(r), u && (t.ordinal && e.startsWith(i) && o.push(r + e.replace(i, this.options.pluralSeparator)), o.push(r + e), d && o.push(r + n));
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
let s;
|
|
2266
|
+
for (; s = o.pop();) this.isValidLookup(n) || (i = s, n = this.getResource(r, e, s, t));
|
|
2267
|
+
}));
|
|
2268
|
+
});
|
|
2269
|
+
}), {
|
|
2270
|
+
res: n,
|
|
2271
|
+
usedKey: r,
|
|
2272
|
+
exactUsedKey: i,
|
|
2273
|
+
usedLng: a,
|
|
2274
|
+
usedNS: o
|
|
2275
|
+
};
|
|
2276
|
+
}
|
|
2277
|
+
isValidLookup(e) {
|
|
2278
|
+
return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
|
|
2279
|
+
}
|
|
2280
|
+
getResource(e, t, n, r = {}) {
|
|
2281
|
+
return this.i18nFormat?.getResource ? this.i18nFormat.getResource(e, t, n, r) : this.resourceStore.getResource(e, t, n, r);
|
|
2282
|
+
}
|
|
2283
|
+
getUsedParamsDetails(e = {}) {
|
|
2284
|
+
let t = [
|
|
2285
|
+
"defaultValue",
|
|
2286
|
+
"ordinal",
|
|
2287
|
+
"context",
|
|
2288
|
+
"replace",
|
|
2289
|
+
"lng",
|
|
2290
|
+
"lngs",
|
|
2291
|
+
"fallbackLng",
|
|
2292
|
+
"ns",
|
|
2293
|
+
"keySeparator",
|
|
2294
|
+
"nsSeparator",
|
|
2295
|
+
"returnObjects",
|
|
2296
|
+
"returnDetails",
|
|
2297
|
+
"joinArrays",
|
|
2298
|
+
"postProcess",
|
|
2299
|
+
"interpolation"
|
|
2300
|
+
], n = e.replace && !N(e.replace), r = n ? e.replace : e;
|
|
2301
|
+
if (n && e.count !== void 0 && (r = {
|
|
2302
|
+
...r,
|
|
2303
|
+
count: e.count
|
|
2304
|
+
}), this.options.interpolation.defaultVariables && (r = {
|
|
2305
|
+
...this.options.interpolation.defaultVariables,
|
|
2306
|
+
...r
|
|
2307
|
+
}), !n) {
|
|
2308
|
+
r = { ...r };
|
|
2309
|
+
for (let e of t) delete r[e];
|
|
2310
|
+
}
|
|
2311
|
+
return r;
|
|
2312
|
+
}
|
|
2313
|
+
static hasDefaultValue(e) {
|
|
2314
|
+
for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) && t.startsWith("defaultValue") && e[t] !== void 0) return !0;
|
|
2315
|
+
return !1;
|
|
2316
|
+
}
|
|
2317
|
+
}, Be = class {
|
|
2318
|
+
constructor(e) {
|
|
2319
|
+
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = z.create("languageUtils");
|
|
2320
|
+
}
|
|
2321
|
+
getScriptPartFromCode(e) {
|
|
2322
|
+
if (e = R(e), !e || !e.includes("-")) return null;
|
|
2323
|
+
let t = e.split("-");
|
|
2324
|
+
return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
|
|
2325
|
+
}
|
|
2326
|
+
getLanguagePartFromCode(e) {
|
|
2327
|
+
if (e = R(e), !e || !e.includes("-")) return e;
|
|
2328
|
+
let t = e.split("-");
|
|
2329
|
+
return this.formatLanguageCode(t[0]);
|
|
2330
|
+
}
|
|
2331
|
+
formatLanguageCode(e) {
|
|
2332
|
+
if (N(e) && e.includes("-")) {
|
|
2333
|
+
let t;
|
|
2334
|
+
try {
|
|
2335
|
+
t = Intl.getCanonicalLocales(e)[0];
|
|
2336
|
+
} catch {}
|
|
2337
|
+
return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
|
|
2338
|
+
}
|
|
2339
|
+
return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
|
|
2340
|
+
}
|
|
2341
|
+
isSupportedCode(e) {
|
|
2342
|
+
return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.includes(e);
|
|
2343
|
+
}
|
|
2344
|
+
getBestMatchFromCodes(e) {
|
|
2345
|
+
if (!e) return null;
|
|
2346
|
+
let t;
|
|
2347
|
+
return e.forEach((e) => {
|
|
2348
|
+
if (t) return;
|
|
2349
|
+
let n = this.formatLanguageCode(e);
|
|
2350
|
+
(!this.options.supportedLngs || this.isSupportedCode(n)) && (t = n);
|
|
2351
|
+
}), !t && this.options.supportedLngs && e.forEach((e) => {
|
|
2352
|
+
if (t) return;
|
|
2353
|
+
let n = this.getScriptPartFromCode(e);
|
|
2354
|
+
if (this.isSupportedCode(n)) return t = n;
|
|
2355
|
+
let r = this.getLanguagePartFromCode(e);
|
|
2356
|
+
if (this.isSupportedCode(r)) return t = r;
|
|
2357
|
+
t = this.options.supportedLngs.find((e) => e === r ? !0 : !e.includes("-") && !r.includes("-") ? !1 : !!(e.includes("-") && !r.includes("-") && e.slice(0, e.indexOf("-")) === r || e.startsWith(r) && r.length > 1));
|
|
2358
|
+
}), t ||= this.getFallbackCodes(this.options.fallbackLng)[0], t;
|
|
2359
|
+
}
|
|
2360
|
+
getFallbackCodes(e, t) {
|
|
2361
|
+
if (!e) return [];
|
|
2362
|
+
if (typeof e == "function" && (e = e(t)), N(e) && (e = [e]), Array.isArray(e)) return e;
|
|
2363
|
+
if (!t) return e.default || [];
|
|
2364
|
+
let n = e[t];
|
|
2365
|
+
return n ||= e[this.getScriptPartFromCode(t)], n ||= e[this.formatLanguageCode(t)], n ||= e[this.getLanguagePartFromCode(t)], n ||= e.default, n || [];
|
|
2366
|
+
}
|
|
2367
|
+
toResolveHierarchy(e, t) {
|
|
2368
|
+
let n = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), r = [], i = (e) => {
|
|
2369
|
+
e && (this.isSupportedCode(e) ? r.push(e) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`));
|
|
2370
|
+
};
|
|
2371
|
+
return N(e) && (e.includes("-") || e.includes("_")) ? (this.options.load !== "languageOnly" && i(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && i(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && i(this.getLanguagePartFromCode(e))) : N(e) && i(this.formatLanguageCode(e)), n.forEach((e) => {
|
|
2372
|
+
r.includes(e) || i(this.formatLanguageCode(e));
|
|
2373
|
+
}), r;
|
|
2374
|
+
}
|
|
2375
|
+
}, Ve = {
|
|
2376
|
+
zero: 0,
|
|
2377
|
+
one: 1,
|
|
2378
|
+
two: 2,
|
|
2379
|
+
few: 3,
|
|
2380
|
+
many: 4,
|
|
2381
|
+
other: 5
|
|
2382
|
+
}, He = {
|
|
2383
|
+
select: (e) => e === 1 ? "one" : "other",
|
|
2384
|
+
resolvedOptions: () => ({ pluralCategories: ["one", "other"] })
|
|
2385
|
+
}, Ue = class {
|
|
2386
|
+
constructor(e, t = {}) {
|
|
2387
|
+
this.languageUtils = e, this.options = t, this.logger = z.create("pluralResolver"), this.pluralRulesCache = {};
|
|
2388
|
+
}
|
|
2389
|
+
clearCache() {
|
|
2390
|
+
this.pluralRulesCache = {};
|
|
2391
|
+
}
|
|
2392
|
+
getRule(e, t = {}) {
|
|
2393
|
+
let n = R(e === "dev" ? "en" : e), r = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
|
|
2394
|
+
cleanedCode: n,
|
|
2395
|
+
type: r
|
|
2396
|
+
});
|
|
2397
|
+
if (i in this.pluralRulesCache) return this.pluralRulesCache[i];
|
|
2398
|
+
let a;
|
|
2399
|
+
try {
|
|
2400
|
+
a = new Intl.PluralRules(n, { type: r });
|
|
2401
|
+
} catch {
|
|
2402
|
+
if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"), He;
|
|
2403
|
+
if (!e.match(/-|_/)) return He;
|
|
2404
|
+
let n = this.languageUtils.getLanguagePartFromCode(e);
|
|
2405
|
+
a = this.getRule(n, t);
|
|
2406
|
+
}
|
|
2407
|
+
return this.pluralRulesCache[i] = a, a;
|
|
2408
|
+
}
|
|
2409
|
+
needsPlural(e, t = {}) {
|
|
2410
|
+
let n = this.getRule(e, t);
|
|
2411
|
+
return n ||= this.getRule("dev", t), n?.resolvedOptions().pluralCategories.length > 1;
|
|
2412
|
+
}
|
|
2413
|
+
getPluralFormsOfKey(e, t, n = {}) {
|
|
2414
|
+
return this.getSuffixes(e, n).map((e) => `${t}${e}`);
|
|
2415
|
+
}
|
|
2416
|
+
getSuffixes(e, t = {}) {
|
|
2417
|
+
let n = this.getRule(e, t);
|
|
2418
|
+
return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) => Ve[e] - Ve[t]).map((e) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${e}`) : [];
|
|
2419
|
+
}
|
|
2420
|
+
getSuffix(e, t, n = {}) {
|
|
2421
|
+
let r = this.getRule(e, n);
|
|
2422
|
+
return r ? `${this.options.prepend}${n.ordinal ? `ordinal${this.options.prepend}` : ""}${r.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, n));
|
|
2423
|
+
}
|
|
2424
|
+
}, We = (e, t, n, r = ".", i = !0) => {
|
|
2425
|
+
let a = we(e, t, n);
|
|
2426
|
+
return !a && i && N(n) && (a = Me(e, n, r), a === void 0 && (a = Me(t, n, r))), a;
|
|
2427
|
+
}, Ge = (e) => e.replace(/\$/g, "$$$$"), Ke = class {
|
|
2428
|
+
constructor(e = {}) {
|
|
2429
|
+
this.logger = z.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((e) => e), this.init(e);
|
|
2430
|
+
}
|
|
2431
|
+
init(e = {}) {
|
|
2432
|
+
e.interpolation ||= { escapeValue: !0 };
|
|
2433
|
+
let { escape: t, escapeValue: n, useRawValueToEscape: r, prefix: i, prefixEscaped: a, suffix: o, suffixEscaped: s, formatSeparator: c, unescapeSuffix: l, unescapePrefix: u, nestingPrefix: d, nestingPrefixEscaped: f, nestingSuffix: p, nestingSuffixEscaped: m, nestingOptionsSeparator: h, maxReplaces: g, alwaysFormat: _ } = e.interpolation;
|
|
2434
|
+
this.escape = t === void 0 ? De : t, this.escapeValue = n === void 0 || n, this.useRawValueToEscape = r !== void 0 && r, this.prefix = i ? L(i) : a || "{{", this.suffix = o ? L(o) : s || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : u ? L(u) : "-", this.unescapeSuffix = this.unescapePrefix ? "" : l ? L(l) : "", this.nestingPrefix = d ? L(d) : f || L("$t("), this.nestingSuffix = p ? L(p) : m || L(")"), this.nestingOptionsSeparator = h || ",", this.maxReplaces = g || 1e3, this.alwaysFormat = _ !== void 0 && _, this.resetRegExp();
|
|
2435
|
+
}
|
|
2436
|
+
reset() {
|
|
2437
|
+
this.options && this.init(this.options);
|
|
2438
|
+
}
|
|
2439
|
+
resetRegExp() {
|
|
2440
|
+
let e = (e, t) => e?.source === t ? (e.lastIndex = 0, e) : new RegExp(t, "g");
|
|
2441
|
+
this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
|
|
2442
|
+
}
|
|
2443
|
+
interpolate(e, t, n, r) {
|
|
2444
|
+
let i, a, o, s = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c = (e) => {
|
|
2445
|
+
if (!e.includes(this.formatSeparator)) {
|
|
2446
|
+
let i = We(t, s, e, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
2447
|
+
return this.alwaysFormat ? this.format(i, void 0, n, {
|
|
2448
|
+
...r,
|
|
2449
|
+
...t,
|
|
2450
|
+
interpolationkey: e
|
|
2451
|
+
}) : i;
|
|
2452
|
+
}
|
|
2453
|
+
let i = e.split(this.formatSeparator), a = i.shift().trim(), o = i.join(this.formatSeparator).trim();
|
|
2454
|
+
return this.format(We(t, s, a, this.options.keySeparator, this.options.ignoreJSONStructure), o, n, {
|
|
2455
|
+
...r,
|
|
2456
|
+
...t,
|
|
2457
|
+
interpolationkey: a
|
|
2458
|
+
});
|
|
2459
|
+
};
|
|
2460
|
+
this.resetRegExp(), !this.escapeValue && typeof e == "string" && /\$t\([^)]*\{[^}]*\{\{/.test(e) && this.logger.warn("nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");
|
|
2461
|
+
let l = r?.missingInterpolationHandler || this.options.missingInterpolationHandler, u = r?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r.interpolation.skipOnVariables;
|
|
2462
|
+
return [{
|
|
2463
|
+
regex: this.regexpUnescape,
|
|
2464
|
+
safeValue: (e) => e
|
|
2465
|
+
}, {
|
|
2466
|
+
regex: this.regexp,
|
|
2467
|
+
safeValue: (e) => this.escapeValue ? this.escape(e) : e
|
|
2468
|
+
}].forEach((t) => {
|
|
2469
|
+
for (o = 0; i = t.regex.exec(e);) {
|
|
2470
|
+
let n = i[1].trim();
|
|
2471
|
+
if (a = c(n), a === void 0) if (typeof l == "function") {
|
|
2472
|
+
let t = l(e, i, r);
|
|
2473
|
+
a = N(t) ? t : "";
|
|
2474
|
+
} else if (r && Object.prototype.hasOwnProperty.call(r, n)) a = "";
|
|
2475
|
+
else if (u) {
|
|
2476
|
+
a = i[0];
|
|
2477
|
+
continue;
|
|
2478
|
+
} else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`), a = "";
|
|
2479
|
+
else !N(a) && !this.useRawValueToEscape && (a = _e(a));
|
|
2480
|
+
let s = t.safeValue(a);
|
|
2481
|
+
if (e = e.replace(i[0], Ge(s)), u ? (t.regex.lastIndex += s.length, t.regex.lastIndex -= i[0].length) : t.regex.lastIndex = 0, o++, o >= this.maxReplaces) break;
|
|
2482
|
+
}
|
|
2483
|
+
}), e;
|
|
2484
|
+
}
|
|
2485
|
+
nest(e, t, n = {}) {
|
|
2486
|
+
let r, i, a, o = (e, t) => {
|
|
2487
|
+
let n = this.nestingOptionsSeparator;
|
|
2488
|
+
if (!e.includes(n)) return e;
|
|
2489
|
+
let r = e.split(RegExp(`${L(n)}[ ]*{`)), i = `{${r[1]}`;
|
|
2490
|
+
e = r[0], i = this.interpolate(i, a);
|
|
2491
|
+
let o = i.match(/'/g), s = i.match(/"/g);
|
|
2492
|
+
((o?.length ?? 0) % 2 == 0 && !s || (s?.length ?? 0) % 2 != 0) && (i = i.replace(/'/g, "\""));
|
|
2493
|
+
try {
|
|
2494
|
+
a = JSON.parse(i), t && (a = {
|
|
2495
|
+
...t,
|
|
2496
|
+
...a
|
|
2497
|
+
});
|
|
2498
|
+
} catch (t) {
|
|
2499
|
+
return this.logger.warn(`failed parsing options string in nesting for key ${e}`, t), `${e}${n}${i}`;
|
|
2500
|
+
}
|
|
2501
|
+
return a.defaultValue && a.defaultValue.includes(this.prefix) && delete a.defaultValue, e;
|
|
2502
|
+
};
|
|
2503
|
+
for (; r = this.nestingRegexp.exec(e);) {
|
|
2504
|
+
let s = [];
|
|
2505
|
+
a = { ...n }, a = a.replace && !N(a.replace) ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
|
|
2506
|
+
let c = /{.*}/s.test(r[1]) ? r[1].lastIndexOf("}") + 1 : r[1].indexOf(this.formatSeparator);
|
|
2507
|
+
if (c !== -1 && (s = r[1].slice(c).split(this.formatSeparator).map((e) => e.trim()).filter(Boolean), r[1] = r[1].slice(0, c)), i = t(o.call(this, r[1].trim(), a), a), i && r[0] === e && !N(i)) return i;
|
|
2508
|
+
N(i) || (i = _e(i)), i ||= (this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`), ""), s.length && (i = s.reduce((e, t) => this.format(e, t, n.lng, {
|
|
2509
|
+
...n,
|
|
2510
|
+
interpolationkey: r[1].trim()
|
|
2511
|
+
}), i.trim())), e = e.replace(r[0], i), this.regexp.lastIndex = 0;
|
|
2512
|
+
}
|
|
2513
|
+
return e;
|
|
2514
|
+
}
|
|
2515
|
+
}, qe = (e) => {
|
|
2516
|
+
let t = e.toLowerCase().trim(), n = {};
|
|
2517
|
+
if (e.includes("(")) {
|
|
2518
|
+
let r = e.split("(");
|
|
2519
|
+
t = r[0].toLowerCase().trim();
|
|
2520
|
+
let i = r[1].slice(0, -1);
|
|
2521
|
+
t === "currency" && !i.includes(":") ? n.currency ||= i.trim() : t === "relativetime" && !i.includes(":") ? n.range ||= i.trim() : i.split(";").forEach((e) => {
|
|
2522
|
+
if (e) {
|
|
2523
|
+
let [t, ...r] = e.split(":"), i = r.join(":").trim().replace(/^'+|'+$/g, ""), a = t.trim();
|
|
2524
|
+
n[a] || (n[a] = i), i === "false" && (n[a] = !1), i === "true" && (n[a] = !0), isNaN(i) || (n[a] = parseInt(i, 10));
|
|
2525
|
+
}
|
|
2526
|
+
});
|
|
2527
|
+
}
|
|
2528
|
+
return {
|
|
2529
|
+
formatName: t,
|
|
2530
|
+
formatOptions: n
|
|
2531
|
+
};
|
|
2532
|
+
}, Je = (e) => {
|
|
2533
|
+
let t = {};
|
|
2534
|
+
return (n, r, i) => {
|
|
2535
|
+
let a = i;
|
|
2536
|
+
i && i.interpolationkey && i.formatParams && i.formatParams[i.interpolationkey] && i[i.interpolationkey] && (a = {
|
|
2537
|
+
...a,
|
|
2538
|
+
[i.interpolationkey]: void 0
|
|
2539
|
+
});
|
|
2540
|
+
let o = r + JSON.stringify(a), s = t[o];
|
|
2541
|
+
return s || (s = e(R(r), i), t[o] = s), s(n);
|
|
2542
|
+
};
|
|
2543
|
+
}, Ye = (e) => (t, n, r) => e(R(n), r)(t), Xe = class {
|
|
2544
|
+
constructor(e = {}) {
|
|
2545
|
+
this.logger = z.create("formatter"), this.options = e, this.init(e);
|
|
2546
|
+
}
|
|
2547
|
+
init(e, t = { interpolation: {} }) {
|
|
2548
|
+
this.formatSeparator = t.interpolation.formatSeparator || ",";
|
|
2549
|
+
let n = t.cacheInBuiltFormats ? Je : Ye;
|
|
2550
|
+
this.formats = {
|
|
2551
|
+
number: n((e, t) => {
|
|
2552
|
+
let n = new Intl.NumberFormat(e, { ...t });
|
|
2553
|
+
return (e) => n.format(e);
|
|
2554
|
+
}),
|
|
2555
|
+
currency: n((e, t) => {
|
|
2556
|
+
let n = new Intl.NumberFormat(e, {
|
|
2557
|
+
...t,
|
|
2558
|
+
style: "currency"
|
|
2559
|
+
});
|
|
2560
|
+
return (e) => n.format(e);
|
|
2561
|
+
}),
|
|
2562
|
+
datetime: n((e, t) => {
|
|
2563
|
+
let n = new Intl.DateTimeFormat(e, { ...t });
|
|
2564
|
+
return (e) => n.format(e);
|
|
2565
|
+
}),
|
|
2566
|
+
relativetime: n((e, t) => {
|
|
2567
|
+
let n = new Intl.RelativeTimeFormat(e, { ...t });
|
|
2568
|
+
return (e) => n.format(e, t.range || "day");
|
|
2569
|
+
}),
|
|
2570
|
+
list: n((e, t) => {
|
|
2571
|
+
let n = new Intl.ListFormat(e, { ...t });
|
|
2572
|
+
return (e) => n.format(e);
|
|
2573
|
+
})
|
|
2574
|
+
};
|
|
2575
|
+
}
|
|
2576
|
+
add(e, t) {
|
|
2577
|
+
this.formats[e.toLowerCase().trim()] = t;
|
|
2578
|
+
}
|
|
2579
|
+
addCached(e, t) {
|
|
2580
|
+
this.formats[e.toLowerCase().trim()] = Je(t);
|
|
2581
|
+
}
|
|
2582
|
+
format(e, t, n, r = {}) {
|
|
2583
|
+
if (!t || e == null) return e;
|
|
2584
|
+
let i = t.split(this.formatSeparator), a = [];
|
|
2585
|
+
for (let e = 0; e < i.length; e++) {
|
|
2586
|
+
let t = i[e];
|
|
2587
|
+
for (; t.indexOf("(") > -1 && !t.includes(")") && e + 1 < i.length;) t = `${t}${this.formatSeparator}${i[++e]}`;
|
|
2588
|
+
a.push(t);
|
|
2589
|
+
}
|
|
2590
|
+
return a.reduce((e, t) => {
|
|
2591
|
+
let { formatName: i, formatOptions: a } = qe(t);
|
|
2592
|
+
if (this.formats[i]) {
|
|
2593
|
+
let t = e;
|
|
2594
|
+
try {
|
|
2595
|
+
let o = r?.formatParams?.[r.interpolationkey] || {}, s = o.locale || o.lng || r.locale || r.lng || n;
|
|
2596
|
+
t = this.formats[i](e, s, {
|
|
2597
|
+
...a,
|
|
2598
|
+
...r,
|
|
2599
|
+
...o
|
|
2600
|
+
});
|
|
2601
|
+
} catch (e) {
|
|
2602
|
+
this.logger.warn(e);
|
|
2603
|
+
}
|
|
2604
|
+
return t;
|
|
2605
|
+
} else this.logger.warn(`there was no format function for ${i}`);
|
|
2606
|
+
return e;
|
|
2607
|
+
}, e);
|
|
2608
|
+
}
|
|
2609
|
+
}, Ze = (e, t) => {
|
|
2610
|
+
e.pending[t] !== void 0 && (delete e.pending[t], e.pendingCount--);
|
|
2611
|
+
}, Qe = class extends B {
|
|
2612
|
+
constructor(e, t, n, r = {}) {
|
|
2613
|
+
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger = z.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = r.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = r.maxRetries >= 0 ? r.maxRetries : 5, this.retryTimeout = r.retryTimeout >= 1 ? r.retryTimeout : 350, this.state = {}, this.queue = [], this.backend?.init?.(n, r.backend, r);
|
|
2614
|
+
}
|
|
2615
|
+
queueLoad(e, t, n, r) {
|
|
2616
|
+
let i = {}, a = {}, o = {}, s = {};
|
|
2617
|
+
return e.forEach((e) => {
|
|
2618
|
+
let r = !0;
|
|
2619
|
+
t.forEach((t) => {
|
|
2620
|
+
let o = `${e}|${t}`;
|
|
2621
|
+
!n.reload && this.store.hasResourceBundle(e, t) ? this.state[o] = 2 : this.state[o] < 0 || (this.state[o] === 1 ? a[o] === void 0 && (a[o] = !0) : (this.state[o] = 1, r = !1, a[o] === void 0 && (a[o] = !0), i[o] === void 0 && (i[o] = !0), s[t] === void 0 && (s[t] = !0)));
|
|
2622
|
+
}), r || (o[e] = !0);
|
|
2623
|
+
}), (Object.keys(i).length || Object.keys(a).length) && this.queue.push({
|
|
2624
|
+
pending: a,
|
|
2625
|
+
pendingCount: Object.keys(a).length,
|
|
2626
|
+
loaded: {},
|
|
2627
|
+
errors: [],
|
|
2628
|
+
callback: r
|
|
2629
|
+
}), {
|
|
2630
|
+
toLoad: Object.keys(i),
|
|
2631
|
+
pending: Object.keys(a),
|
|
2632
|
+
toLoadLanguages: Object.keys(o),
|
|
2633
|
+
toLoadNamespaces: Object.keys(s)
|
|
2634
|
+
};
|
|
2635
|
+
}
|
|
2636
|
+
loaded(e, t, n) {
|
|
2637
|
+
let r = e.split("|"), i = r[0], a = r[1];
|
|
2638
|
+
t && this.emit("failedLoading", i, a, t), !t && n && this.store.addResourceBundle(i, a, n, void 0, void 0, { skipCopy: !0 }), this.state[e] = t ? -1 : 2, t && n && (this.state[e] = 0);
|
|
2639
|
+
let o = {};
|
|
2640
|
+
this.queue.forEach((n) => {
|
|
2641
|
+
Ce(n.loaded, [i], a), Ze(n, e), t && n.errors.push(t), n.pendingCount === 0 && !n.done && (Object.keys(n.loaded).forEach((e) => {
|
|
2642
|
+
o[e] || (o[e] = {});
|
|
2643
|
+
let t = n.loaded[e];
|
|
2644
|
+
t.length && t.forEach((t) => {
|
|
2645
|
+
o[e][t] === void 0 && (o[e][t] = !0);
|
|
2646
|
+
});
|
|
2647
|
+
}), n.done = !0, n.errors.length ? n.callback(n.errors) : n.callback());
|
|
2648
|
+
}), this.emit("loaded", o), this.queue = this.queue.filter((e) => !e.done);
|
|
2649
|
+
}
|
|
2650
|
+
read(e, t, n, r = 0, i = this.retryTimeout, a) {
|
|
2651
|
+
if (!e.length) return a(null, {});
|
|
2652
|
+
if (this.readingCalls >= this.maxParallelReads) {
|
|
2653
|
+
this.waitingReads.push({
|
|
2654
|
+
lng: e,
|
|
2655
|
+
ns: t,
|
|
2656
|
+
fcName: n,
|
|
2657
|
+
tried: r,
|
|
2658
|
+
wait: i,
|
|
2659
|
+
callback: a
|
|
2660
|
+
});
|
|
2661
|
+
return;
|
|
2662
|
+
}
|
|
2663
|
+
this.readingCalls++;
|
|
2664
|
+
let o = (o, s) => {
|
|
2665
|
+
if (this.readingCalls--, this.waitingReads.length > 0) {
|
|
2666
|
+
let e = this.waitingReads.shift();
|
|
2667
|
+
this.read(e.lng, e.ns, e.fcName, e.tried, e.wait, e.callback);
|
|
2668
|
+
}
|
|
2669
|
+
if (o && s && r < this.maxRetries) {
|
|
2670
|
+
setTimeout(() => {
|
|
2671
|
+
this.read(e, t, n, r + 1, i * 2, a);
|
|
2672
|
+
}, i);
|
|
2673
|
+
return;
|
|
2674
|
+
}
|
|
2675
|
+
a(o, s);
|
|
2676
|
+
}, s = this.backend[n].bind(this.backend);
|
|
2677
|
+
if (s.length === 2) {
|
|
2678
|
+
try {
|
|
2679
|
+
let n = s(e, t);
|
|
2680
|
+
n && typeof n.then == "function" ? n.then((e) => o(null, e)).catch(o) : o(null, n);
|
|
2681
|
+
} catch (e) {
|
|
2682
|
+
o(e);
|
|
2683
|
+
}
|
|
2684
|
+
return;
|
|
2685
|
+
}
|
|
2686
|
+
return s(e, t, o);
|
|
2687
|
+
}
|
|
2688
|
+
prepareLoading(e, t, n = {}, r) {
|
|
2689
|
+
if (!this.backend) return this.logger.warn("No backend was added via i18next.use. Will not load resources."), r && r();
|
|
2690
|
+
N(e) && (e = this.languageUtils.toResolveHierarchy(e)), N(t) && (t = [t]);
|
|
2691
|
+
let i = this.queueLoad(e, t, n, r);
|
|
2692
|
+
if (!i.toLoad.length) return i.pending.length || r(), null;
|
|
2693
|
+
i.toLoad.forEach((e) => {
|
|
2694
|
+
this.loadOne(e);
|
|
2695
|
+
});
|
|
2696
|
+
}
|
|
2697
|
+
load(e, t, n) {
|
|
2698
|
+
this.prepareLoading(e, t, {}, n);
|
|
2699
|
+
}
|
|
2700
|
+
reload(e, t, n) {
|
|
2701
|
+
this.prepareLoading(e, t, { reload: !0 }, n);
|
|
2702
|
+
}
|
|
2703
|
+
loadOne(e, t = "") {
|
|
2704
|
+
let n = e.split("|"), r = n[0], i = n[1];
|
|
2705
|
+
this.read(r, i, "read", void 0, void 0, (n, a) => {
|
|
2706
|
+
n && this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`, n), !n && a && this.logger.log(`${t}loaded namespace ${i} for language ${r}`, a), this.loaded(e, n, a);
|
|
2707
|
+
});
|
|
2708
|
+
}
|
|
2709
|
+
saveMissing(e, t, n, r, i, a = {}, o = () => {}) {
|
|
2710
|
+
if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(t)) {
|
|
2711
|
+
this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
|
|
2712
|
+
return;
|
|
2713
|
+
}
|
|
2714
|
+
if (!(n == null || n === "")) {
|
|
2715
|
+
if (this.backend?.create) {
|
|
2716
|
+
let s = {
|
|
2717
|
+
...a,
|
|
2718
|
+
isUpdate: i
|
|
2719
|
+
}, c = this.backend.create.bind(this.backend);
|
|
2720
|
+
if (c.length < 6) try {
|
|
2721
|
+
let i;
|
|
2722
|
+
i = c.length === 5 ? c(e, t, n, r, s) : c(e, t, n, r), i && typeof i.then == "function" ? i.then((e) => o(null, e)).catch(o) : o(null, i);
|
|
2723
|
+
} catch (e) {
|
|
2724
|
+
o(e);
|
|
2725
|
+
}
|
|
2726
|
+
else c(e, t, n, r, o, s);
|
|
2727
|
+
}
|
|
2728
|
+
!e || !e[0] || this.store.addResource(e[0], t, n, r);
|
|
2729
|
+
}
|
|
2730
|
+
}
|
|
2731
|
+
}, $e = () => ({
|
|
2732
|
+
debug: !1,
|
|
2733
|
+
initAsync: !0,
|
|
2734
|
+
ns: ["translation"],
|
|
2735
|
+
defaultNS: ["translation"],
|
|
2736
|
+
fallbackLng: ["dev"],
|
|
2737
|
+
fallbackNS: !1,
|
|
2738
|
+
supportedLngs: !1,
|
|
2739
|
+
nonExplicitSupportedLngs: !1,
|
|
2740
|
+
load: "all",
|
|
2741
|
+
preload: !1,
|
|
2742
|
+
keySeparator: ".",
|
|
2743
|
+
nsSeparator: ":",
|
|
2744
|
+
pluralSeparator: "_",
|
|
2745
|
+
contextSeparator: "_",
|
|
2746
|
+
enableSelector: !1,
|
|
2747
|
+
partialBundledLanguages: !1,
|
|
2748
|
+
saveMissing: !1,
|
|
2749
|
+
updateMissing: !1,
|
|
2750
|
+
saveMissingTo: "fallback",
|
|
2751
|
+
saveMissingPlurals: !0,
|
|
2752
|
+
missingKeyHandler: !1,
|
|
2753
|
+
missingInterpolationHandler: !1,
|
|
2754
|
+
postProcess: !1,
|
|
2755
|
+
postProcessPassResolved: !1,
|
|
2756
|
+
returnNull: !1,
|
|
2757
|
+
returnEmptyString: !0,
|
|
2758
|
+
returnObjects: !1,
|
|
2759
|
+
joinArrays: !1,
|
|
2760
|
+
returnedObjectHandler: !1,
|
|
2761
|
+
parseMissingKeyHandler: !1,
|
|
2762
|
+
appendNamespaceToMissingKey: !1,
|
|
2763
|
+
appendNamespaceToCIMode: !1,
|
|
2764
|
+
overloadTranslationOptionHandler: (e) => {
|
|
2765
|
+
let t = {};
|
|
2766
|
+
if (typeof e[1] == "object" && (t = e[1]), N(e[1]) && (t.defaultValue = e[1]), N(e[2]) && (t.tDescription = e[2]), typeof e[2] == "object" || typeof e[3] == "object") {
|
|
2767
|
+
let n = e[3] || e[2];
|
|
2768
|
+
Object.keys(n).forEach((e) => {
|
|
2769
|
+
t[e] = n[e];
|
|
2770
|
+
});
|
|
2771
|
+
}
|
|
2772
|
+
return t;
|
|
2773
|
+
},
|
|
2774
|
+
interpolation: {
|
|
2775
|
+
escapeValue: !0,
|
|
2776
|
+
prefix: "{{",
|
|
2777
|
+
suffix: "}}",
|
|
2778
|
+
formatSeparator: ",",
|
|
2779
|
+
unescapePrefix: "-",
|
|
2780
|
+
nestingPrefix: "$t(",
|
|
2781
|
+
nestingSuffix: ")",
|
|
2782
|
+
nestingOptionsSeparator: ",",
|
|
2783
|
+
maxReplaces: 1e3,
|
|
2784
|
+
skipOnVariables: !0
|
|
2785
|
+
},
|
|
2786
|
+
cacheInBuiltFormats: !0
|
|
2787
|
+
}), et = (e) => (N(e.ns) && (e.ns = [e.ns]), N(e.fallbackLng) && (e.fallbackLng = [e.fallbackLng]), N(e.fallbackNS) && (e.fallbackNS = [e.fallbackNS]), e.supportedLngs && !e.supportedLngs.includes("cimode") && (e.supportedLngs = e.supportedLngs.concat(["cimode"])), e), H = () => {}, tt = (e) => {
|
|
2788
|
+
Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((t) => {
|
|
2789
|
+
typeof e[t] == "function" && (e[t] = e[t].bind(e));
|
|
2790
|
+
});
|
|
2791
|
+
}, U = class e extends B {
|
|
2792
|
+
constructor(e = {}, t) {
|
|
2793
|
+
if (super(), this.options = et(e), this.services = {}, this.logger = z, this.modules = { external: [] }, tt(this), t && !this.isInitialized && !e.isClone) {
|
|
2794
|
+
if (!this.options.initAsync) return this.init(e, t), this;
|
|
2795
|
+
setTimeout(() => {
|
|
2796
|
+
this.init(e, t);
|
|
2797
|
+
}, 0);
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
init(e = {}, t) {
|
|
2801
|
+
this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (N(e.ns) ? e.defaultNS = e.ns : e.ns.includes("translation") || (e.defaultNS = e.ns[0]));
|
|
2802
|
+
let n = $e();
|
|
2803
|
+
this.options = {
|
|
2804
|
+
...n,
|
|
2805
|
+
...this.options,
|
|
2806
|
+
...et(e)
|
|
2807
|
+
}, this.options.interpolation = {
|
|
2808
|
+
...n.interpolation,
|
|
2809
|
+
...this.options.interpolation
|
|
2810
|
+
}, e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator), typeof this.options.overloadTranslationOptionHandler != "function" && (this.options.overloadTranslationOptionHandler = n.overloadTranslationOptionHandler);
|
|
2811
|
+
let r = (e) => e ? typeof e == "function" ? new e() : e : null;
|
|
2812
|
+
if (!this.options.isClone) {
|
|
2813
|
+
this.modules.logger ? z.init(r(this.modules.logger), this.options) : z.init(null, this.options);
|
|
2814
|
+
let e;
|
|
2815
|
+
e = this.modules.formatter ? this.modules.formatter : Xe;
|
|
2816
|
+
let t = new Be(this.options);
|
|
2817
|
+
this.store = new Pe(this.options.resources, this.options);
|
|
2818
|
+
let n = this.services;
|
|
2819
|
+
n.logger = z, n.resourceStore = this.store, n.languageUtils = t, n.pluralResolver = new Ue(t, { prepend: this.options.pluralSeparator }), e && (n.formatter = r(e), n.formatter.init && n.formatter.init(n, this.options), this.options.interpolation.format = n.formatter.format.bind(n.formatter)), n.interpolator = new Ke(this.options), n.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, n.backendConnector = new Qe(r(this.modules.backend), n.resourceStore, n, this.options), n.backendConnector.on("*", (e, ...t) => {
|
|
2820
|
+
this.emit(e, ...t);
|
|
2821
|
+
}), this.modules.languageDetector && (n.languageDetector = r(this.modules.languageDetector), n.languageDetector.init && n.languageDetector.init(n, this.options.detection, this.options)), this.modules.i18nFormat && (n.i18nFormat = r(this.modules.i18nFormat), n.i18nFormat.init && n.i18nFormat.init(this)), this.translator = new ze(this.services, this.options), this.translator.on("*", (e, ...t) => {
|
|
2822
|
+
this.emit(e, ...t);
|
|
2823
|
+
}), this.modules.external.forEach((e) => {
|
|
2824
|
+
e.init && e.init(this);
|
|
2825
|
+
});
|
|
2826
|
+
}
|
|
2827
|
+
if (this.format = this.options.interpolation.format, t ||= H, this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
2828
|
+
let e = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
2829
|
+
e.length > 0 && e[0] !== "dev" && (this.options.lng = e[0]);
|
|
2830
|
+
}
|
|
2831
|
+
!this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), [
|
|
2832
|
+
"getResource",
|
|
2833
|
+
"hasResourceBundle",
|
|
2834
|
+
"getResourceBundle",
|
|
2835
|
+
"getDataByLanguage"
|
|
2836
|
+
].forEach((e) => {
|
|
2837
|
+
this[e] = (...t) => this.store[e](...t);
|
|
2838
|
+
}), [
|
|
2839
|
+
"addResource",
|
|
2840
|
+
"addResources",
|
|
2841
|
+
"addResourceBundle",
|
|
2842
|
+
"removeResourceBundle"
|
|
2843
|
+
].forEach((e) => {
|
|
2844
|
+
this[e] = (...t) => (this.store[e](...t), this);
|
|
2845
|
+
});
|
|
2846
|
+
let i = P(), a = () => {
|
|
2847
|
+
let e = (e, n) => {
|
|
2848
|
+
this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), i.resolve(n), t(e, n);
|
|
2849
|
+
};
|
|
2850
|
+
if ((this.languages || this.isLanguageChangingTo) && !this.isInitialized) return e(null, this.t.bind(this));
|
|
2851
|
+
this.changeLanguage(this.options.lng, e);
|
|
2852
|
+
};
|
|
2853
|
+
return this.options.resources || !this.options.initAsync ? a() : setTimeout(a, 0), i;
|
|
2854
|
+
}
|
|
2855
|
+
loadResources(e, t = H) {
|
|
2856
|
+
let n = t, r = N(e) ? e : this.language;
|
|
2857
|
+
if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
2858
|
+
if (r?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
|
|
2859
|
+
let e = [], t = (t) => {
|
|
2860
|
+
t && t !== "cimode" && this.services.languageUtils.toResolveHierarchy(t).forEach((t) => {
|
|
2861
|
+
t !== "cimode" && (e.includes(t) || e.push(t));
|
|
2862
|
+
});
|
|
2863
|
+
};
|
|
2864
|
+
r ? t(r) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((e) => t(e)), this.options.preload?.forEach?.((e) => t(e)), this.services.backendConnector.load(e, this.options.ns, (e) => {
|
|
2865
|
+
!e && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), n(e);
|
|
2866
|
+
});
|
|
2867
|
+
} else n(null);
|
|
2868
|
+
}
|
|
2869
|
+
reloadResources(e, t, n) {
|
|
2870
|
+
let r = P();
|
|
2871
|
+
return typeof e == "function" && (n = e, e = void 0), typeof t == "function" && (n = t, t = void 0), e ||= this.languages, t ||= this.options.ns, n ||= H, this.services.backendConnector.reload(e, t, (e) => {
|
|
2872
|
+
r.resolve(), n(e);
|
|
2873
|
+
}), r;
|
|
2874
|
+
}
|
|
2875
|
+
use(e) {
|
|
2876
|
+
if (!e) throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
2877
|
+
if (!e.type) throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
2878
|
+
return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && Fe.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
2879
|
+
}
|
|
2880
|
+
setResolvedLanguage(e) {
|
|
2881
|
+
if (!(!e || !this.languages) && !["cimode", "dev"].includes(e)) {
|
|
2882
|
+
for (let e = 0; e < this.languages.length; e++) {
|
|
2883
|
+
let t = this.languages[e];
|
|
2884
|
+
if (!["cimode", "dev"].includes(t) && this.store.hasLanguageSomeTranslations(t)) {
|
|
2885
|
+
this.resolvedLanguage = t;
|
|
2886
|
+
break;
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
2889
|
+
!this.resolvedLanguage && !this.languages.includes(e) && this.store.hasLanguageSomeTranslations(e) && (this.resolvedLanguage = e, this.languages.unshift(e));
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
changeLanguage(e, t) {
|
|
2893
|
+
this.isLanguageChangingTo = e;
|
|
2894
|
+
let n = P();
|
|
2895
|
+
this.emit("languageChanging", e);
|
|
2896
|
+
let r = (e) => {
|
|
2897
|
+
this.language = e, this.languages = this.services.languageUtils.toResolveHierarchy(e), this.resolvedLanguage = void 0, this.setResolvedLanguage(e);
|
|
2898
|
+
}, i = (i, a) => {
|
|
2899
|
+
a ? this.isLanguageChangingTo === e && (r(a), this.translator.changeLanguage(a), this.isLanguageChangingTo = void 0, this.emit("languageChanged", a), this.logger.log("languageChanged", a)) : this.isLanguageChangingTo = void 0, n.resolve((...e) => this.t(...e)), t && t(i, (...e) => this.t(...e));
|
|
2900
|
+
}, a = (t) => {
|
|
2901
|
+
!e && !t && this.services.languageDetector && (t = []);
|
|
2902
|
+
let n = N(t) ? t : t && t[0], a = this.store.hasLanguageSomeTranslations(n) ? n : this.services.languageUtils.getBestMatchFromCodes(N(t) ? [t] : t);
|
|
2903
|
+
a && (this.language || r(a), this.translator.language || this.translator.changeLanguage(a), this.services.languageDetector?.cacheUserLanguage?.(a)), this.loadResources(a, (e) => {
|
|
2904
|
+
i(e, a);
|
|
2905
|
+
});
|
|
2906
|
+
};
|
|
2907
|
+
return !e && this.services.languageDetector && !this.services.languageDetector.async ? a(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(a) : this.services.languageDetector.detect(a) : a(e), n;
|
|
2908
|
+
}
|
|
2909
|
+
getFixedT(e, t, n, r) {
|
|
2910
|
+
let i = r?.scopeNs, a = (e, t, ...r) => {
|
|
2911
|
+
let o;
|
|
2912
|
+
o = typeof t == "object" ? { ...t } : this.options.overloadTranslationOptionHandler([e, t].concat(r)), o.lng = o.lng || a.lng, o.lngs = o.lngs || a.lngs;
|
|
2913
|
+
let s = o.ns !== void 0 && o.ns !== null;
|
|
2914
|
+
o.ns = o.ns || a.ns, o.keyPrefix !== "" && (o.keyPrefix = o.keyPrefix || n || a.keyPrefix);
|
|
2915
|
+
let c = {
|
|
2916
|
+
...this.options,
|
|
2917
|
+
...o
|
|
2918
|
+
};
|
|
2919
|
+
Array.isArray(i) && !s && (c.ns = i), typeof o.keyPrefix == "function" && (o.keyPrefix = V(o.keyPrefix, c));
|
|
2920
|
+
let l = this.options.keySeparator || ".", u;
|
|
2921
|
+
return o.keyPrefix && Array.isArray(e) ? u = e.map((e) => (typeof e == "function" && (e = V(e, c)), `${o.keyPrefix}${l}${e}`)) : (typeof e == "function" && (e = V(e, c)), u = o.keyPrefix ? `${o.keyPrefix}${l}${e}` : e), this.t(u, o);
|
|
2922
|
+
};
|
|
2923
|
+
return N(e) ? a.lng = e : a.lngs = e, a.ns = t, a.keyPrefix = n, a;
|
|
2924
|
+
}
|
|
2925
|
+
t(...e) {
|
|
2926
|
+
return this.translator?.translate(...e);
|
|
2927
|
+
}
|
|
2928
|
+
exists(...e) {
|
|
2929
|
+
return this.translator?.exists(...e);
|
|
2930
|
+
}
|
|
2931
|
+
setDefaultNamespace(e) {
|
|
2932
|
+
this.options.defaultNS = e;
|
|
2933
|
+
}
|
|
2934
|
+
hasLoadedNamespace(e, t = {}) {
|
|
2935
|
+
if (!this.isInitialized) return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
|
|
2936
|
+
if (!this.languages || !this.languages.length) return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
|
|
2937
|
+
let n = t.lng || this.resolvedLanguage || this.languages[0], r = this.options ? this.options.fallbackLng : !1, i = this.languages[this.languages.length - 1];
|
|
2938
|
+
if (n.toLowerCase() === "cimode") return !0;
|
|
2939
|
+
let a = (e, t) => {
|
|
2940
|
+
let n = this.services.backendConnector.state[`${e}|${t}`];
|
|
2941
|
+
return n === -1 || n === 0 || n === 2;
|
|
2942
|
+
};
|
|
2943
|
+
if (t.precheck) {
|
|
2944
|
+
let e = t.precheck(this, a);
|
|
2945
|
+
if (e !== void 0) return e;
|
|
2946
|
+
}
|
|
2947
|
+
return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(n, e) && (!r || a(i, e)));
|
|
2948
|
+
}
|
|
2949
|
+
loadNamespaces(e, t) {
|
|
2950
|
+
let n = P();
|
|
2951
|
+
return this.options.ns ? (N(e) && (e = [e]), e.forEach((e) => {
|
|
2952
|
+
this.options.ns.includes(e) || this.options.ns.push(e);
|
|
2953
|
+
}), this.loadResources((e) => {
|
|
2954
|
+
n.resolve(), t && t(e);
|
|
2955
|
+
}), n) : (t && t(), Promise.resolve());
|
|
2956
|
+
}
|
|
2957
|
+
loadLanguages(e, t) {
|
|
2958
|
+
let n = P();
|
|
2959
|
+
N(e) && (e = [e]);
|
|
2960
|
+
let r = this.options.preload || [], i = e.filter((e) => !r.includes(e) && this.services.languageUtils.isSupportedCode(e));
|
|
2961
|
+
return i.length ? (this.options.preload = r.concat(i), this.loadResources((e) => {
|
|
2962
|
+
n.resolve(), t && t(e);
|
|
2963
|
+
}), n) : (t && t(), Promise.resolve());
|
|
2964
|
+
}
|
|
2965
|
+
dir(e) {
|
|
2966
|
+
if (e ||= this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language), !e) return "rtl";
|
|
2967
|
+
try {
|
|
2968
|
+
let t = new Intl.Locale(e);
|
|
2969
|
+
if (t && t.getTextInfo) {
|
|
2970
|
+
let e = t.getTextInfo();
|
|
2971
|
+
if (e && e.direction) return e.direction;
|
|
2972
|
+
}
|
|
2973
|
+
} catch {}
|
|
2974
|
+
let t = /* @__PURE__ */ "ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb".split("."), n = this.services?.languageUtils || new Be($e());
|
|
2975
|
+
return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.includes(n.getLanguagePartFromCode(e)) || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
2976
|
+
}
|
|
2977
|
+
static createInstance(t = {}, n) {
|
|
2978
|
+
let r = new e(t, n);
|
|
2979
|
+
return r.createInstance = e.createInstance, r;
|
|
2980
|
+
}
|
|
2981
|
+
cloneInstance(t = {}, n = H) {
|
|
2982
|
+
let r = t.forkResourceStore;
|
|
2983
|
+
r && delete t.forkResourceStore;
|
|
2984
|
+
let i = {
|
|
2985
|
+
...this.options,
|
|
2986
|
+
...t,
|
|
2987
|
+
isClone: !0
|
|
2988
|
+
}, a = new e(i);
|
|
2989
|
+
if ((t.debug !== void 0 || t.prefix !== void 0) && (a.logger = a.logger.clone(t)), [
|
|
2990
|
+
"store",
|
|
2991
|
+
"services",
|
|
2992
|
+
"language"
|
|
2993
|
+
].forEach((e) => {
|
|
2994
|
+
a[e] = this[e];
|
|
2995
|
+
}), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new Pe(Object.keys(this.store.data).reduce((e, t) => (e[t] = { ...this.store.data[t] }, e[t] = Object.keys(e[t]).reduce((n, r) => (n[r] = { ...e[t][r] }, n), e[t]), e), {}), i), a.services.resourceStore = a.store), t.interpolation) {
|
|
2996
|
+
let e = {
|
|
2997
|
+
...$e().interpolation,
|
|
2998
|
+
...this.options.interpolation,
|
|
2999
|
+
...t.interpolation
|
|
3000
|
+
}, n = {
|
|
3001
|
+
...i,
|
|
3002
|
+
interpolation: e
|
|
3003
|
+
};
|
|
3004
|
+
a.services.interpolator = new Ke(n);
|
|
3005
|
+
}
|
|
3006
|
+
return a.translator = new ze(a.services, i), a.translator.on("*", (e, ...t) => {
|
|
3007
|
+
a.emit(e, ...t);
|
|
3008
|
+
}), a.init(i, n), a.translator.options = i, a.translator.backendConnector.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, a;
|
|
3009
|
+
}
|
|
3010
|
+
toJSON() {
|
|
3011
|
+
return {
|
|
3012
|
+
options: this.options,
|
|
3013
|
+
store: this.store,
|
|
3014
|
+
language: this.language,
|
|
3015
|
+
languages: this.languages,
|
|
3016
|
+
resolvedLanguage: this.resolvedLanguage
|
|
3017
|
+
};
|
|
3018
|
+
}
|
|
3019
|
+
}.createInstance();
|
|
3020
|
+
U.createInstance, U.dir, U.init, U.loadResources, U.reloadResources, U.use, U.changeLanguage, U.getFixedT, U.t, U.exists, U.setDefaultNamespace, U.hasLoadedNamespace, U.loadNamespaces, U.loadLanguages;
|
|
3021
|
+
//#endregion
|
|
3022
|
+
//#region node_modules/.pnpm/react-i18next@17.0.11_i18ne_00b880b3cd01c3819045f8a7994d0c96/node_modules/react-i18next/dist/es/unescape.js
|
|
3023
|
+
var nt = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, rt = {
|
|
3024
|
+
"&": "&",
|
|
3025
|
+
"&": "&",
|
|
3026
|
+
"<": "<",
|
|
3027
|
+
"<": "<",
|
|
3028
|
+
">": ">",
|
|
3029
|
+
">": ">",
|
|
3030
|
+
"'": "'",
|
|
3031
|
+
"'": "'",
|
|
3032
|
+
""": "\"",
|
|
3033
|
+
""": "\"",
|
|
3034
|
+
" ": " ",
|
|
3035
|
+
" ": " ",
|
|
3036
|
+
"©": "©",
|
|
3037
|
+
"©": "©",
|
|
3038
|
+
"®": "®",
|
|
3039
|
+
"®": "®",
|
|
3040
|
+
"…": "…",
|
|
3041
|
+
"…": "…",
|
|
3042
|
+
"/": "/",
|
|
3043
|
+
"/": "/"
|
|
3044
|
+
}, it = (e) => rt[e], at = (e) => e.replace(nt, it), ot = {
|
|
3045
|
+
bindI18n: "languageChanged",
|
|
3046
|
+
bindI18nStore: "",
|
|
3047
|
+
transEmptyNodeValue: "",
|
|
3048
|
+
transSupportBasicHtmlNodes: !0,
|
|
3049
|
+
transWrapTextNodes: "",
|
|
3050
|
+
transKeepBasicHtmlNodesFor: [
|
|
3051
|
+
"br",
|
|
3052
|
+
"strong",
|
|
3053
|
+
"i",
|
|
3054
|
+
"p"
|
|
3055
|
+
],
|
|
3056
|
+
useSuspense: !0,
|
|
3057
|
+
unescape: at,
|
|
3058
|
+
transDefaultProps: void 0
|
|
3059
|
+
}, st = (e = {}) => {
|
|
3060
|
+
ot = {
|
|
3061
|
+
...ot,
|
|
3062
|
+
...e
|
|
3063
|
+
};
|
|
3064
|
+
}, ct = () => ot, lt, ut = (e) => {
|
|
3065
|
+
lt = e;
|
|
3066
|
+
}, dt = () => lt, ft = {
|
|
3067
|
+
type: "3rdParty",
|
|
3068
|
+
init(e) {
|
|
3069
|
+
st(e.options.react), ut(e);
|
|
3070
|
+
}
|
|
3071
|
+
}, pt = { ui: {
|
|
3072
|
+
tool: {
|
|
3073
|
+
retry: "重试",
|
|
3074
|
+
error: "错误",
|
|
3075
|
+
warning: "警告",
|
|
3076
|
+
info: "提示",
|
|
3077
|
+
news: "消息",
|
|
3078
|
+
empty: "暂无数据",
|
|
3079
|
+
clear: "清空",
|
|
3080
|
+
close: "关闭",
|
|
3081
|
+
processing: "全部处理",
|
|
3082
|
+
expand: "展开",
|
|
3083
|
+
shrink: "收起",
|
|
3084
|
+
setOk: "设置成功"
|
|
3085
|
+
},
|
|
3086
|
+
use: {
|
|
3087
|
+
contextErr: "useAppContext 必须在 {{key}} provider 内使用",
|
|
3088
|
+
prefixErr: "usePrefixT 必须与前缀一起使用",
|
|
3089
|
+
patternErr: "useStore 不存在 {{pattern}} 模式",
|
|
3090
|
+
numberPlace: "请输入数字",
|
|
3091
|
+
inputPlace: "请输入内容",
|
|
3092
|
+
selectPlace: "请选择选项",
|
|
3093
|
+
total: "共 <bold>{{total}}</bold> 条",
|
|
3094
|
+
formatErr: "格式错误"
|
|
3095
|
+
},
|
|
3096
|
+
exe: {
|
|
3097
|
+
initErr: "exe 或 cv 未定义",
|
|
3098
|
+
canvasErr: "画布渲染失败",
|
|
3099
|
+
imgSpriteErr: "图片渲染失败"
|
|
3100
|
+
},
|
|
3101
|
+
sql: {
|
|
3102
|
+
initErr: "数据库未初始化",
|
|
3103
|
+
error: "SQL 错误",
|
|
3104
|
+
updateErr: "数据库更新失败",
|
|
3105
|
+
selectErr: "数据库查询失败",
|
|
3106
|
+
batchErr: "数据库批处理失败",
|
|
3107
|
+
execErr: "SQL 执行失败: {{error}}",
|
|
3108
|
+
tableErr: "数据表 \"{{tableName}}\" 不存在"
|
|
3109
|
+
},
|
|
3110
|
+
evt: {
|
|
3111
|
+
initErr: "事件未初始化",
|
|
3112
|
+
defectErr: "缺陷绘制容器创建失败"
|
|
3113
|
+
},
|
|
3114
|
+
lang: {
|
|
3115
|
+
initErr: "语言或 locale 未定义",
|
|
3116
|
+
dayErr: "dayjs 不支持语言 {{lang}}",
|
|
3117
|
+
i18nErr: "i18next 不支持语言 {{lang}}"
|
|
3118
|
+
},
|
|
3119
|
+
file: {
|
|
3120
|
+
readErr: "文件读取失败",
|
|
3121
|
+
writeErr: "文件写入失败",
|
|
3122
|
+
filePath: "文件路径: {{path}}"
|
|
3123
|
+
}
|
|
3124
|
+
} }, mt = { ui: {
|
|
3125
|
+
tool: {
|
|
3126
|
+
retry: "Retry",
|
|
3127
|
+
error: "Error",
|
|
3128
|
+
warning: "Warning",
|
|
3129
|
+
info: "Info",
|
|
3130
|
+
news: "News",
|
|
3131
|
+
empty: "No data",
|
|
3132
|
+
clear: "Clear",
|
|
3133
|
+
close: "Close",
|
|
3134
|
+
processing: "Processing",
|
|
3135
|
+
expand: "Expand",
|
|
3136
|
+
shrink: "Shrink",
|
|
3137
|
+
setOk: "Setting successful"
|
|
3138
|
+
},
|
|
3139
|
+
use: {
|
|
3140
|
+
contextErr: "useAppContext must be used within a {{key}} provider",
|
|
3141
|
+
prefixErr: "usePrefixT must be used with a prefix",
|
|
3142
|
+
patternErr: "useStore does not have a {{pattern}} mode",
|
|
3143
|
+
numberPlace: "Please enter a number",
|
|
3144
|
+
inputPlace: "Please enter content",
|
|
3145
|
+
selectPlace: "Please select an option",
|
|
3146
|
+
total: "Total <bold>{{total}}</bold> items",
|
|
3147
|
+
formatErr: "format error"
|
|
3148
|
+
},
|
|
3149
|
+
exe: {
|
|
3150
|
+
initErr: "exe or cv is not defined",
|
|
3151
|
+
canvasErr: "Canvas rendering failed",
|
|
3152
|
+
imgSpriteErr: "Image rendering failed"
|
|
3153
|
+
},
|
|
3154
|
+
sql: {
|
|
3155
|
+
initErr: "Database is not initialized",
|
|
3156
|
+
error: "SQL ERROR",
|
|
3157
|
+
updateErr: "Database update failed",
|
|
3158
|
+
selectErr: "Database query failed",
|
|
3159
|
+
batchErr: "Database batch failed",
|
|
3160
|
+
execErr: "SQL execution failed: {{error}}",
|
|
3161
|
+
tableErr: "The data table \"{{tableName}}\" does not exist"
|
|
3162
|
+
},
|
|
3163
|
+
evt: {
|
|
3164
|
+
initErr: "Event not initialized",
|
|
3165
|
+
defectErr: "Defect drawing container creation failed"
|
|
3166
|
+
},
|
|
3167
|
+
lang: {
|
|
3168
|
+
initErr: "Lang or locale is not defined",
|
|
3169
|
+
dayErr: "Lang {{lang}} is not supported by dayjs",
|
|
3170
|
+
i18nErr: "Lang {{lang}} is not supported by i18next"
|
|
3171
|
+
},
|
|
3172
|
+
file: {
|
|
3173
|
+
readErr: "File read failed",
|
|
3174
|
+
writeErr: "File write failed",
|
|
3175
|
+
filePath: "File path: {{path}}"
|
|
3176
|
+
}
|
|
3177
|
+
} }, ht = (e, t) => {
|
|
3178
|
+
let n = [], r = Object.assign(e, {
|
|
3179
|
+
zh: pt,
|
|
3180
|
+
en: mt
|
|
3181
|
+
}), i = Object.keys(r), a = i.reduce((e, t) => {
|
|
3182
|
+
let i = r[t];
|
|
3183
|
+
return e[t] = { translation: i }, i?.ui || n.push(t), e;
|
|
3184
|
+
}, {});
|
|
3185
|
+
return U.use(ft).init({
|
|
3186
|
+
lng: t,
|
|
3187
|
+
resources: a,
|
|
3188
|
+
interpolation: { escapeValue: !1 }
|
|
3189
|
+
}), n.length ? [] : i;
|
|
3190
|
+
}, gt = (e = "") => new Proxy((t) => U.t(e, t), { get(t, n) {
|
|
3191
|
+
return n === "toString" || typeof n == "symbol" ? void 0 : gt(e ? `${e}.${n}` : n);
|
|
3192
|
+
} }), W = gt("ui"), _t = /* @__PURE__ */ t(((e, t) => {
|
|
3193
|
+
(function(n, r) {
|
|
3194
|
+
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs = r();
|
|
3195
|
+
})(e, (function() {
|
|
3196
|
+
var e = 1e3, t = 6e4, n = 36e5, r = "millisecond", i = "second", a = "minute", o = "hour", s = "day", c = "week", l = "month", u = "quarter", d = "year", f = "date", p = "Invalid Date", m = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, h = /\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, g = {
|
|
3197
|
+
name: "en",
|
|
3198
|
+
weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
|
|
3199
|
+
months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
|
|
3200
|
+
ordinal: function(e) {
|
|
3201
|
+
var t = [
|
|
3202
|
+
"th",
|
|
3203
|
+
"st",
|
|
3204
|
+
"nd",
|
|
3205
|
+
"rd"
|
|
3206
|
+
], n = e % 100;
|
|
3207
|
+
return "[" + e + (t[(n - 20) % 10] || t[n] || t[0]) + "]";
|
|
3208
|
+
}
|
|
3209
|
+
}, _ = function(e, t, n) {
|
|
3210
|
+
var r = String(e);
|
|
3211
|
+
return !r || r.length >= t ? e : "" + Array(t + 1 - r.length).join(n) + e;
|
|
3212
|
+
}, v = {
|
|
3213
|
+
s: _,
|
|
3214
|
+
z: function(e) {
|
|
3215
|
+
var t = -e.utcOffset(), n = Math.abs(t), r = Math.floor(n / 60), i = n % 60;
|
|
3216
|
+
return (t <= 0 ? "+" : "-") + _(r, 2, "0") + ":" + _(i, 2, "0");
|
|
3217
|
+
},
|
|
3218
|
+
m: function e(t, n) {
|
|
3219
|
+
if (t.date() < n.date()) return -e(n, t);
|
|
3220
|
+
var r = 12 * (n.year() - t.year()) + (n.month() - t.month()), i = t.clone().add(r, l), a = n - i < 0, o = t.clone().add(r + (a ? -1 : 1), l);
|
|
3221
|
+
return +(-(r + (n - i) / (a ? i - o : o - i)) || 0);
|
|
3222
|
+
},
|
|
3223
|
+
a: function(e) {
|
|
3224
|
+
return e < 0 ? Math.ceil(e) || 0 : Math.floor(e);
|
|
3225
|
+
},
|
|
3226
|
+
p: function(e) {
|
|
3227
|
+
return {
|
|
3228
|
+
M: l,
|
|
3229
|
+
y: d,
|
|
3230
|
+
w: c,
|
|
3231
|
+
d: s,
|
|
3232
|
+
D: f,
|
|
3233
|
+
h: o,
|
|
3234
|
+
m: a,
|
|
3235
|
+
s: i,
|
|
3236
|
+
ms: r,
|
|
3237
|
+
Q: u
|
|
3238
|
+
}[e] || String(e || "").toLowerCase().replace(/s$/, "");
|
|
3239
|
+
},
|
|
3240
|
+
u: function(e) {
|
|
3241
|
+
return e === void 0;
|
|
3242
|
+
}
|
|
3243
|
+
}, y = "en", b = {};
|
|
3244
|
+
b[y] = g;
|
|
3245
|
+
var x = "$isDayjsObject", S = function(e) {
|
|
3246
|
+
return e instanceof E || !(!e || !e[x]);
|
|
3247
|
+
}, C = function e(t, n, r) {
|
|
3248
|
+
var i;
|
|
3249
|
+
if (!t) return y;
|
|
3250
|
+
if (typeof t == "string") {
|
|
3251
|
+
var a = t.toLowerCase();
|
|
3252
|
+
b[a] && (i = a), n && (b[a] = n, i = a);
|
|
3253
|
+
var o = t.split("-");
|
|
3254
|
+
if (!i && o.length > 1) return e(o[0]);
|
|
3255
|
+
} else {
|
|
3256
|
+
var s = t.name;
|
|
3257
|
+
b[s] = t, i = s;
|
|
3258
|
+
}
|
|
3259
|
+
return !r && i && (y = i), i || !r && y;
|
|
3260
|
+
}, w = function(e, t) {
|
|
3261
|
+
if (S(e)) return e.clone();
|
|
3262
|
+
var n = typeof t == "object" ? t : {};
|
|
3263
|
+
return n.date = e, n.args = arguments, new E(n);
|
|
3264
|
+
}, T = v;
|
|
3265
|
+
T.l = C, T.i = S, T.w = function(e, t) {
|
|
3266
|
+
return w(e, {
|
|
3267
|
+
locale: t.$L,
|
|
3268
|
+
utc: t.$u,
|
|
3269
|
+
x: t.$x,
|
|
3270
|
+
$offset: t.$offset
|
|
3271
|
+
});
|
|
3272
|
+
};
|
|
3273
|
+
var E = function() {
|
|
3274
|
+
function g(e) {
|
|
3275
|
+
this.$L = C(e.locale, null, !0), this.parse(e), this.$x = this.$x || e.x || {}, this[x] = !0;
|
|
3276
|
+
}
|
|
3277
|
+
var _ = g.prototype;
|
|
3278
|
+
return _.parse = function(e) {
|
|
3279
|
+
this.$d = function(e) {
|
|
3280
|
+
var t = e.date, n = e.utc;
|
|
3281
|
+
if (t === null) return /* @__PURE__ */ new Date(NaN);
|
|
3282
|
+
if (T.u(t)) return /* @__PURE__ */ new Date();
|
|
3283
|
+
if (t instanceof Date) return new Date(t);
|
|
3284
|
+
if (typeof t == "string" && !/Z$/i.test(t)) {
|
|
3285
|
+
var r = t.match(m);
|
|
3286
|
+
if (r) {
|
|
3287
|
+
var i = r[2] - 1 || 0, a = (r[7] || "0").substring(0, 3);
|
|
3288
|
+
return n ? new Date(Date.UTC(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, a)) : new Date(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, a);
|
|
3289
|
+
}
|
|
3290
|
+
}
|
|
3291
|
+
return new Date(t);
|
|
3292
|
+
}(e), this.init();
|
|
3293
|
+
}, _.init = function() {
|
|
3294
|
+
var e = this.$d;
|
|
3295
|
+
this.$y = e.getFullYear(), this.$M = e.getMonth(), this.$D = e.getDate(), this.$W = e.getDay(), this.$H = e.getHours(), this.$m = e.getMinutes(), this.$s = e.getSeconds(), this.$ms = e.getMilliseconds();
|
|
3296
|
+
}, _.$utils = function() {
|
|
3297
|
+
return T;
|
|
3298
|
+
}, _.isValid = function() {
|
|
3299
|
+
return this.$d.toString() !== p;
|
|
3300
|
+
}, _.isSame = function(e, t) {
|
|
3301
|
+
var n = w(e);
|
|
3302
|
+
return this.startOf(t) <= n && n <= this.endOf(t);
|
|
3303
|
+
}, _.isAfter = function(e, t) {
|
|
3304
|
+
return w(e) < this.startOf(t);
|
|
3305
|
+
}, _.isBefore = function(e, t) {
|
|
3306
|
+
return this.endOf(t) < w(e);
|
|
3307
|
+
}, _.$g = function(e, t, n) {
|
|
3308
|
+
return T.u(e) ? this[t] : this.set(n, e);
|
|
3309
|
+
}, _.unix = function() {
|
|
3310
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
3311
|
+
}, _.valueOf = function() {
|
|
3312
|
+
return this.$d.getTime();
|
|
3313
|
+
}, _.startOf = function(e, t) {
|
|
3314
|
+
var n = this, r = !!T.u(t) || t, u = T.p(e), p = function(e, t) {
|
|
3315
|
+
var i = T.w(n.$u ? Date.UTC(n.$y, t, e) : new Date(n.$y, t, e), n);
|
|
3316
|
+
return r ? i : i.endOf(s);
|
|
3317
|
+
}, m = function(e, t) {
|
|
3318
|
+
return T.w(n.toDate()[e].apply(n.toDate("s"), (r ? [
|
|
3319
|
+
0,
|
|
3320
|
+
0,
|
|
3321
|
+
0,
|
|
3322
|
+
0
|
|
3323
|
+
] : [
|
|
3324
|
+
23,
|
|
3325
|
+
59,
|
|
3326
|
+
59,
|
|
3327
|
+
999
|
|
3328
|
+
]).slice(t)), n);
|
|
3329
|
+
}, h = this.$W, g = this.$M, _ = this.$D, v = "set" + (this.$u ? "UTC" : "");
|
|
3330
|
+
switch (u) {
|
|
3331
|
+
case d: return r ? p(1, 0) : p(31, 11);
|
|
3332
|
+
case l: return r ? p(1, g) : p(0, g + 1);
|
|
3333
|
+
case c:
|
|
3334
|
+
var y = this.$locale().weekStart || 0, b = (h < y ? h + 7 : h) - y;
|
|
3335
|
+
return p(r ? _ - b : _ + (6 - b), g);
|
|
3336
|
+
case s:
|
|
3337
|
+
case f: return m(v + "Hours", 0);
|
|
3338
|
+
case o: return m(v + "Minutes", 1);
|
|
3339
|
+
case a: return m(v + "Seconds", 2);
|
|
3340
|
+
case i: return m(v + "Milliseconds", 3);
|
|
3341
|
+
default: return this.clone();
|
|
3342
|
+
}
|
|
3343
|
+
}, _.endOf = function(e) {
|
|
3344
|
+
return this.startOf(e, !1);
|
|
3345
|
+
}, _.$set = function(e, t) {
|
|
3346
|
+
var n, c = T.p(e), u = "set" + (this.$u ? "UTC" : ""), p = (n = {}, n[s] = u + "Date", n[f] = u + "Date", n[l] = u + "Month", n[d] = u + "FullYear", n[o] = u + "Hours", n[a] = u + "Minutes", n[i] = u + "Seconds", n[r] = u + "Milliseconds", n)[c], m = c === s ? this.$D + (t - this.$W) : t;
|
|
3347
|
+
if (c === l || c === d) {
|
|
3348
|
+
var h = this.clone().set(f, 1);
|
|
3349
|
+
h.$d[p](m), h.init(), this.$d = h.set(f, Math.min(this.$D, h.daysInMonth())).$d;
|
|
3350
|
+
} else p && this.$d[p](m);
|
|
3351
|
+
return this.init(), this;
|
|
3352
|
+
}, _.set = function(e, t) {
|
|
3353
|
+
return this.clone().$set(e, t);
|
|
3354
|
+
}, _.get = function(e) {
|
|
3355
|
+
return this[T.p(e)]();
|
|
3356
|
+
}, _.add = function(r, u) {
|
|
3357
|
+
var f, p = this;
|
|
3358
|
+
r = Number(r);
|
|
3359
|
+
var m = T.p(u), h = function(e) {
|
|
3360
|
+
var t = w(p);
|
|
3361
|
+
return T.w(t.date(t.date() + Math.round(e * r)), p);
|
|
3362
|
+
};
|
|
3363
|
+
if (m === l) return this.set(l, this.$M + r);
|
|
3364
|
+
if (m === d) return this.set(d, this.$y + r);
|
|
3365
|
+
if (m === s) return h(1);
|
|
3366
|
+
if (m === c) return h(7);
|
|
3367
|
+
var g = (f = {}, f[a] = t, f[o] = n, f[i] = e, f)[m] || 1, _ = this.$d.getTime() + r * g;
|
|
3368
|
+
return T.w(_, this);
|
|
3369
|
+
}, _.subtract = function(e, t) {
|
|
3370
|
+
return this.add(-1 * e, t);
|
|
3371
|
+
}, _.format = function(e) {
|
|
3372
|
+
var t = this, n = this.$locale();
|
|
3373
|
+
if (!this.isValid()) return n.invalidDate || p;
|
|
3374
|
+
var r = e || "YYYY-MM-DDTHH:mm:ssZ", i = T.z(this), a = this.$H, o = this.$m, s = this.$M, c = n.weekdays, l = n.months, u = n.meridiem, d = function(e, n, i, a) {
|
|
3375
|
+
return e && (e[n] || e(t, r)) || i[n].slice(0, a);
|
|
3376
|
+
}, f = function(e) {
|
|
3377
|
+
return T.s(a % 12 || 12, e, "0");
|
|
3378
|
+
}, m = u || function(e, t, n) {
|
|
3379
|
+
var r = e < 12 ? "AM" : "PM";
|
|
3380
|
+
return n ? r.toLowerCase() : r;
|
|
3381
|
+
};
|
|
3382
|
+
return r.replace(h, (function(e, r) {
|
|
3383
|
+
return r || function(e) {
|
|
3384
|
+
switch (e) {
|
|
3385
|
+
case "YY": return String(t.$y).slice(-2);
|
|
3386
|
+
case "YYYY": return T.s(t.$y, 4, "0");
|
|
3387
|
+
case "M": return s + 1;
|
|
3388
|
+
case "MM": return T.s(s + 1, 2, "0");
|
|
3389
|
+
case "MMM": return d(n.monthsShort, s, l, 3);
|
|
3390
|
+
case "MMMM": return d(l, s);
|
|
3391
|
+
case "D": return t.$D;
|
|
3392
|
+
case "DD": return T.s(t.$D, 2, "0");
|
|
3393
|
+
case "d": return String(t.$W);
|
|
3394
|
+
case "dd": return d(n.weekdaysMin, t.$W, c, 2);
|
|
3395
|
+
case "ddd": return d(n.weekdaysShort, t.$W, c, 3);
|
|
3396
|
+
case "dddd": return c[t.$W];
|
|
3397
|
+
case "H": return String(a);
|
|
3398
|
+
case "HH": return T.s(a, 2, "0");
|
|
3399
|
+
case "h": return f(1);
|
|
3400
|
+
case "hh": return f(2);
|
|
3401
|
+
case "a": return m(a, o, !0);
|
|
3402
|
+
case "A": return m(a, o, !1);
|
|
3403
|
+
case "m": return String(o);
|
|
3404
|
+
case "mm": return T.s(o, 2, "0");
|
|
3405
|
+
case "s": return String(t.$s);
|
|
3406
|
+
case "ss": return T.s(t.$s, 2, "0");
|
|
3407
|
+
case "SSS": return T.s(t.$ms, 3, "0");
|
|
3408
|
+
case "Z": return i;
|
|
3409
|
+
}
|
|
3410
|
+
return null;
|
|
3411
|
+
}(e) || i.replace(":", "");
|
|
3412
|
+
}));
|
|
3413
|
+
}, _.utcOffset = function() {
|
|
3414
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
3415
|
+
}, _.diff = function(r, f, p) {
|
|
3416
|
+
var m, h = this, g = T.p(f), _ = w(r), v = (_.utcOffset() - this.utcOffset()) * t, y = this - _, b = function() {
|
|
3417
|
+
return T.m(h, _);
|
|
3418
|
+
};
|
|
3419
|
+
switch (g) {
|
|
3420
|
+
case d:
|
|
3421
|
+
m = b() / 12;
|
|
3422
|
+
break;
|
|
3423
|
+
case l:
|
|
3424
|
+
m = b();
|
|
3425
|
+
break;
|
|
3426
|
+
case u:
|
|
3427
|
+
m = b() / 3;
|
|
3428
|
+
break;
|
|
3429
|
+
case c:
|
|
3430
|
+
m = (y - v) / 6048e5;
|
|
3431
|
+
break;
|
|
3432
|
+
case s:
|
|
3433
|
+
m = (y - v) / 864e5;
|
|
3434
|
+
break;
|
|
3435
|
+
case o:
|
|
3436
|
+
m = y / n;
|
|
3437
|
+
break;
|
|
3438
|
+
case a:
|
|
3439
|
+
m = y / t;
|
|
3440
|
+
break;
|
|
3441
|
+
case i:
|
|
3442
|
+
m = y / e;
|
|
3443
|
+
break;
|
|
3444
|
+
default: m = y;
|
|
3445
|
+
}
|
|
3446
|
+
return p ? m : T.a(m);
|
|
3447
|
+
}, _.daysInMonth = function() {
|
|
3448
|
+
return this.endOf(l).$D;
|
|
3449
|
+
}, _.$locale = function() {
|
|
3450
|
+
return b[this.$L];
|
|
3451
|
+
}, _.locale = function(e, t) {
|
|
3452
|
+
if (!e) return this.$L;
|
|
3453
|
+
var n = this.clone(), r = C(e, t, !0);
|
|
3454
|
+
return r && (n.$L = r), n;
|
|
3455
|
+
}, _.clone = function() {
|
|
3456
|
+
return T.w(this.$d, this);
|
|
3457
|
+
}, _.toDate = function() {
|
|
3458
|
+
return new Date(this.valueOf());
|
|
3459
|
+
}, _.toJSON = function() {
|
|
3460
|
+
return this.isValid() ? this.toISOString() : null;
|
|
3461
|
+
}, _.toISOString = function() {
|
|
3462
|
+
return this.$d.toISOString();
|
|
3463
|
+
}, _.toString = function() {
|
|
3464
|
+
return this.$d.toUTCString();
|
|
3465
|
+
}, g;
|
|
3466
|
+
}(), D = E.prototype;
|
|
3467
|
+
return w.prototype = D, [
|
|
3468
|
+
["$ms", r],
|
|
3469
|
+
["$s", i],
|
|
3470
|
+
["$m", a],
|
|
3471
|
+
["$H", o],
|
|
3472
|
+
["$W", s],
|
|
3473
|
+
["$M", l],
|
|
3474
|
+
["$y", d],
|
|
3475
|
+
["$D", f]
|
|
3476
|
+
].forEach((function(e) {
|
|
3477
|
+
D[e[1]] = function(t) {
|
|
3478
|
+
return this.$g(t, e[0], e[1]);
|
|
3479
|
+
};
|
|
3480
|
+
})), w.extend = function(e, t) {
|
|
3481
|
+
return e.$i ||= (e(t, E, w), !0), w;
|
|
3482
|
+
}, w.locale = C, w.isDayjs = S, w.unix = function(e) {
|
|
3483
|
+
return w(1e3 * e);
|
|
3484
|
+
}, w.en = b[y], w.Ls = b, w.p = {}, w;
|
|
3485
|
+
}));
|
|
3486
|
+
})), vt = class {
|
|
3487
|
+
#e = {};
|
|
3488
|
+
#t = new EventTarget();
|
|
3489
|
+
emit = (e, t) => (this.#t.dispatchEvent(new CustomEvent(e, { detail: t })), this);
|
|
3490
|
+
emitSync = (e, t) => this.#e[e].map((e) => e({ detail: t }));
|
|
3491
|
+
on = (e, t) => t ? (this.#e[e] ??= [], this.#e[e].push(t), this.#t.addEventListener(e, t), this) : this;
|
|
3492
|
+
off = (e, t) => {
|
|
3493
|
+
let n = this.#e[e];
|
|
3494
|
+
if (!n) return this;
|
|
3495
|
+
for (let r of t ? [t] : this.#e[e]) {
|
|
3496
|
+
let t = n.indexOf(r);
|
|
3497
|
+
n.splice(t, 1), this.#t.removeEventListener(e, r);
|
|
3498
|
+
}
|
|
3499
|
+
return this;
|
|
3500
|
+
};
|
|
3501
|
+
once = (e, t) => (this.#t.addEventListener(e, t, { once: !0 }), this);
|
|
3502
|
+
clear = () => {
|
|
3503
|
+
for (let [e, t] of Object.entries(this.#e)) {
|
|
3504
|
+
delete this.#e[e];
|
|
3505
|
+
for (let n of t) this.#t.removeEventListener(e, n);
|
|
3506
|
+
}
|
|
3507
|
+
return this;
|
|
3508
|
+
};
|
|
3509
|
+
}, yt = [
|
|
3510
|
+
"systemError",
|
|
3511
|
+
"messageUpdated",
|
|
3512
|
+
"defectUpdated"
|
|
3513
|
+
], G = {}, bt = (e = []) => {
|
|
3514
|
+
let t = [...yt, ...e];
|
|
3515
|
+
for (let e of t) G[e] = e.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
3516
|
+
return t.length === yt.length + e.length;
|
|
3517
|
+
}, { emit: xt, emitSync: St, on: Ct, off: wt, once: Tt, clear: Et } = new vt(), Dt = new class {
|
|
3518
|
+
#e = !1;
|
|
3519
|
+
#t = [];
|
|
3520
|
+
#n = "";
|
|
3521
|
+
get value() {
|
|
3522
|
+
return this.#t;
|
|
3523
|
+
}
|
|
3524
|
+
set value(e) {
|
|
3525
|
+
this.#t = e, this.#n = e ? K.workDefectPath : K.globalDefectPath;
|
|
3526
|
+
}
|
|
3527
|
+
get work() {
|
|
3528
|
+
return this.#e;
|
|
3529
|
+
}
|
|
3530
|
+
constructor() {
|
|
3531
|
+
this.#t.splice(0, this.#t.length);
|
|
3532
|
+
}
|
|
3533
|
+
#r() {
|
|
3534
|
+
xt(G.defectUpdated);
|
|
3535
|
+
}
|
|
3536
|
+
read(e, t = this.#e) {
|
|
3537
|
+
this.#n = e, this.#e = t, Y.access(this.#n, Y.constants.F_OK, (e) => {
|
|
3538
|
+
e ? Zt(this.#n, this.#t) : Xt(this.#n, (e) => {
|
|
3539
|
+
this.#t = e, this.#r();
|
|
3540
|
+
});
|
|
3541
|
+
});
|
|
3542
|
+
}
|
|
3543
|
+
write() {
|
|
3544
|
+
Zt(this.#n, this.#t);
|
|
3545
|
+
}
|
|
3546
|
+
get(e) {
|
|
3547
|
+
return this.#t.find((t) => t.type === e);
|
|
3548
|
+
}
|
|
3549
|
+
getName(e) {
|
|
3550
|
+
let t = this.get(e);
|
|
3551
|
+
if (t) return t.name;
|
|
3552
|
+
{
|
|
3553
|
+
let e = this.getElse();
|
|
3554
|
+
if (e) return e.name;
|
|
3555
|
+
}
|
|
3556
|
+
return null;
|
|
3557
|
+
}
|
|
3558
|
+
has(e) {
|
|
3559
|
+
return !!this.get(e);
|
|
3560
|
+
}
|
|
3561
|
+
else(e) {
|
|
3562
|
+
for (let t of this.#t) t.type === e ? t.else = !0 : t.else = !1;
|
|
3563
|
+
}
|
|
3564
|
+
getElse() {
|
|
3565
|
+
for (let e of this.#t) if (e?.else === !0) return e;
|
|
3566
|
+
return null;
|
|
3567
|
+
}
|
|
3568
|
+
add(e) {
|
|
3569
|
+
return this.has(e.type) ? !1 : (this.#t.push(e), this.write(), this.#r(), !0);
|
|
3570
|
+
}
|
|
3571
|
+
delete(e) {
|
|
3572
|
+
let t = this.#t.findIndex((t) => t.type === e);
|
|
3573
|
+
return t === -1 ? !1 : (this.#t.splice(t, 1), this.write(), this.#r(), !0);
|
|
3574
|
+
}
|
|
3575
|
+
clear() {
|
|
3576
|
+
this.#t.splice(0, this.#t.length), this.write(), this.#r();
|
|
3577
|
+
}
|
|
3578
|
+
statis() {
|
|
3579
|
+
return this.#t.reduce((e, t) => (e[t.type] = 0, e), {});
|
|
3580
|
+
}
|
|
3581
|
+
increase(e, t) {
|
|
3582
|
+
if (e[t] !== void 0) e[t]++;
|
|
3583
|
+
else {
|
|
3584
|
+
let t = this.getElse();
|
|
3585
|
+
t && e[t.type]++;
|
|
3586
|
+
}
|
|
3587
|
+
}
|
|
3588
|
+
}(), K = Z({
|
|
3589
|
+
workDir: "{workDir}",
|
|
3590
|
+
rootDir: "{rootDir}",
|
|
3591
|
+
dataDir: "{workDir}/Data",
|
|
3592
|
+
autoPath: "{workDir}/autoRun.json",
|
|
3593
|
+
userPath: "{rootDir}/Cache/user.json",
|
|
3594
|
+
settingPath: "{dataDir}/setting.json",
|
|
3595
|
+
ngImagesDir: "{dataDir}/NG_Images",
|
|
3596
|
+
productPath: "{dataDir}/productInfo.json",
|
|
3597
|
+
globalDefectPath: "{rootDir}/defectInfo.json",
|
|
3598
|
+
workDefectPath: "{dataDir}/defectInfo.json"
|
|
3599
|
+
}, ["workDir", "rootDir"], {
|
|
3600
|
+
enumerable: !1,
|
|
3601
|
+
writable: !0,
|
|
3602
|
+
configurable: !0
|
|
3603
|
+
}), Ot = {
|
|
3604
|
+
saveDir: "",
|
|
3605
|
+
mesSaveTime: 90,
|
|
3606
|
+
recordSaveTime: 30,
|
|
3607
|
+
ngImageSaveTime: 30,
|
|
3608
|
+
maxNgImageQuantity: 500,
|
|
3609
|
+
ngImgSuffix: "png",
|
|
3610
|
+
ngImgRatio: 1,
|
|
3611
|
+
dbType: 2,
|
|
3612
|
+
HostName: "127.0.0.1",
|
|
3613
|
+
Port: 3306,
|
|
3614
|
+
DatabaseName: "aoi",
|
|
3615
|
+
UserName: "root",
|
|
3616
|
+
Password: "123456"
|
|
3617
|
+
}, kt = () => {
|
|
3618
|
+
let e = JSON.stringify(q, void 0, 4);
|
|
3619
|
+
return Zt(K.settingPath, e), !0;
|
|
3620
|
+
}, At = async (e = !0) => {
|
|
3621
|
+
let t = await Xt(K.settingPath, e);
|
|
3622
|
+
return t && jt(t, !1), q.onChange?.(), !0;
|
|
3623
|
+
}, jt = (e = {}, t = !0) => {
|
|
3624
|
+
let n = !1;
|
|
3625
|
+
for (let t of Object.keys(q)) e[t] === void 0 ? (e[t] = Ot[t], n = !0) : q[t] !== e[t] && (q[t] = e[t], n = !0);
|
|
3626
|
+
t && n && kt();
|
|
3627
|
+
}, Mt = async (e = !0) => (Nt.level = (await Xt(K.userPath, e))?.UserLevel ?? 0, Nt.onChange?.(), !0), q = Z({
|
|
3628
|
+
...Ot,
|
|
3629
|
+
setConfig: jt,
|
|
3630
|
+
onChange: void 0
|
|
3631
|
+
}, ["setConfig", "onChange"], {
|
|
3632
|
+
enumerable: !1,
|
|
3633
|
+
writable: !0,
|
|
3634
|
+
configurable: !0
|
|
3635
|
+
}), Nt = Z({
|
|
3636
|
+
level: 0,
|
|
3637
|
+
onChange: void 0
|
|
3638
|
+
}, ["onChange"], {
|
|
3639
|
+
enumerable: !1,
|
|
3640
|
+
writable: !0,
|
|
3641
|
+
configurable: !0
|
|
3642
|
+
}), Pt = (e = {}) => {
|
|
3643
|
+
let { exe: t } = $, n = t.getWorkDir(), r = t.getCurrentPath();
|
|
3644
|
+
K.workDir = n, K.rootDir = r;
|
|
3645
|
+
for (let e in K) K[e] = K[e].replace(/\{(\w+)\}/g, (e, t) => K[t]);
|
|
3646
|
+
q.saveDir = K.dataDir, Object.assign(q, e);
|
|
3647
|
+
for (let e of ["dataDir", "ngImagesDir"]) Y.mkdir(K[e], { recursive: !0 }, () => {});
|
|
3648
|
+
Y.existsSync(K.settingPath) ? At(!1) : kt(), Y.existsSync(K.userPath) && Mt(!1);
|
|
3649
|
+
let i = Y.existsSync(K.workDefectPath), a = i ? K.workDefectPath : K.globalDefectPath;
|
|
3650
|
+
Dt.read(a, i), setTimeout(() => Qt(K.settingPath, At), 1e3), setTimeout(() => Qt(K.userPath, Mt), 1e3);
|
|
3651
|
+
}, Ft = {
|
|
3652
|
+
0: {
|
|
3653
|
+
editing: !0,
|
|
3654
|
+
visible: !0,
|
|
3655
|
+
operate: !0
|
|
3656
|
+
},
|
|
3657
|
+
1: {
|
|
3658
|
+
editing: !1,
|
|
3659
|
+
visible: !0,
|
|
3660
|
+
operate: !0
|
|
3661
|
+
},
|
|
3662
|
+
2: {
|
|
3663
|
+
editing: !1,
|
|
3664
|
+
visible: !1,
|
|
3665
|
+
operate: !1
|
|
3666
|
+
}
|
|
3667
|
+
}, J = new class {
|
|
3668
|
+
maxLength = 100;
|
|
3669
|
+
#e = [];
|
|
3670
|
+
get value() {
|
|
3671
|
+
return this.#e;
|
|
3672
|
+
}
|
|
3673
|
+
get unread() {
|
|
3674
|
+
return this.#e.filter((e) => !e.read).length;
|
|
3675
|
+
}
|
|
3676
|
+
constructor() {
|
|
3677
|
+
this.#e.splice(0, this.#e.length);
|
|
3678
|
+
}
|
|
3679
|
+
#t() {
|
|
3680
|
+
xt(G.messageUpdated);
|
|
3681
|
+
}
|
|
3682
|
+
#n(e, t, n, r = {}) {
|
|
3683
|
+
let i = Date.now();
|
|
3684
|
+
return this.#e.unshift({
|
|
3685
|
+
id: i,
|
|
3686
|
+
type: e,
|
|
3687
|
+
title: n,
|
|
3688
|
+
content: t,
|
|
3689
|
+
read: !1,
|
|
3690
|
+
...r
|
|
3691
|
+
}), this.#e.length > this.maxLength && this.#e.pop(), this.#t(), i;
|
|
3692
|
+
}
|
|
3693
|
+
error(e, t, n) {
|
|
3694
|
+
return this.#n("error", e, t ?? W.tool.error(), n);
|
|
3695
|
+
}
|
|
3696
|
+
warning(e, t, n) {
|
|
3697
|
+
return this.#n("warning", e, t ?? W.tool.warning(), n);
|
|
3698
|
+
}
|
|
3699
|
+
info(e, t, n) {
|
|
3700
|
+
return this.#n("info", e, t ?? W.tool.info(), n);
|
|
3701
|
+
}
|
|
3702
|
+
delete(e) {
|
|
3703
|
+
let t = this.#e.findIndex((t) => t.id === e);
|
|
3704
|
+
t !== -1 && this.#e.splice(t, 1), this.#t();
|
|
3705
|
+
}
|
|
3706
|
+
read(e) {
|
|
3707
|
+
let t = this.#e.findIndex((t) => t.id === e);
|
|
3708
|
+
t !== -1 && (this.#e[t].read = !0), this.#t();
|
|
3709
|
+
}
|
|
3710
|
+
processing() {
|
|
3711
|
+
for (let e of this.#e) e.read = !0;
|
|
3712
|
+
this.#t();
|
|
3713
|
+
}
|
|
3714
|
+
clear() {
|
|
3715
|
+
this.#e.splice(0, this.#e.length), this.#t();
|
|
3716
|
+
}
|
|
3717
|
+
}(), It = /* @__PURE__ */ e(_t(), 1), Y = typeof __non_webpack_require__ == "function" ? __non_webpack_require__("fs") : typeof globalThis.require == "function" ? globalThis.require("fs") : null, Lt = (e, t = 1500) => {
|
|
3718
|
+
let n = null;
|
|
3719
|
+
return function(...r) {
|
|
3720
|
+
n && clearTimeout(n), n = setTimeout(e.bind(this, ...r), t);
|
|
3721
|
+
};
|
|
3722
|
+
}, Rt = (e, t = 1500) => {
|
|
3723
|
+
let n = null;
|
|
3724
|
+
return function(...r) {
|
|
3725
|
+
n ||= setTimeout(() => {
|
|
3726
|
+
e.call(this, ...r), n = null;
|
|
3727
|
+
}, t);
|
|
3728
|
+
};
|
|
3729
|
+
}, zt = (e) => {
|
|
3730
|
+
if (!e || typeof e != "object") return e;
|
|
3731
|
+
let t = e.constructor();
|
|
3732
|
+
for (let n in e) Object.hasOwn(e, n) && (t[n] = zt(e[n]));
|
|
3733
|
+
return t;
|
|
3734
|
+
}, Bt = (e, t) => {
|
|
3735
|
+
if (e === t) return !0;
|
|
3736
|
+
if (typeof e != "object" || typeof t != "object" || e === null || t === null) return !1;
|
|
3737
|
+
let n = Object.keys(e), r = Object.keys(t);
|
|
3738
|
+
if (n.length !== r.length) return !1;
|
|
3739
|
+
for (let i of n) if (!r.includes(i) || !Bt(e[i], t[i])) return !1;
|
|
3740
|
+
return !0;
|
|
3741
|
+
}, Vt = (e = "_") => `${Date.now()}${e}${Math.floor(Math.random() * 1e4)}`, X = (e, t) => Wt(e).includes(t), Ht = (e) => e == null ? !1 : typeof e == "string" || Array.isArray(e) ? e.length > 0 : typeof e != "object" || Object.keys(e).length > 0, Ut = (e = Date.now(), t = "YYYY-MM-DD HH:mm:ss") => (0, It.default)(e).format(t), Wt = (e) => Object.prototype.toString.call(e).slice(8, -1).toLowerCase(), Gt = (e, t = {}) => {
|
|
3742
|
+
try {
|
|
3743
|
+
let n = D(e);
|
|
3744
|
+
for (let e in t) n = n[e]?.(t[e]);
|
|
3745
|
+
return n.hexa();
|
|
3746
|
+
} catch {
|
|
3747
|
+
return !1;
|
|
3748
|
+
}
|
|
3749
|
+
}, Kt = (e) => {
|
|
3750
|
+
let t = $.token?.[e];
|
|
3751
|
+
return Ht(t) ? t : getComputedStyle(document.getElementById("root")).getPropertyValue(`--aoi-${e}`).trim();
|
|
3752
|
+
}, qt = (e, t = 2) => {
|
|
3753
|
+
let n = Number(e);
|
|
3754
|
+
return Number.isNaN(n) ? 0 : Number(n.toFixed(t));
|
|
3755
|
+
}, Jt = (e, t = {}, n = {}) => {
|
|
3756
|
+
let r = e.constructor === String ? document.createElement(e) : e;
|
|
3757
|
+
for (let [e, n] of Object.entries(t)) n.constructor === Object ? Jt(r[e], n) : e.startsWith("--") ? r.setProperty(e, n) : r[e] = n;
|
|
3758
|
+
for (let [e, t] of Object.entries(n)) r.addEventListener(e, t);
|
|
3759
|
+
return r;
|
|
3760
|
+
}, Yt = (e) => {
|
|
3761
|
+
e?.stopPropagation(), e?.preventDefault(), e.cancelBubble = !0;
|
|
3762
|
+
}, Z = (e, t, n) => {
|
|
3763
|
+
for (let r of t) Reflect.defineProperty(e, r, {
|
|
3764
|
+
value: e[r],
|
|
3765
|
+
...n
|
|
3766
|
+
});
|
|
3767
|
+
return e;
|
|
3768
|
+
}, Xt = (e, t = !1) => {
|
|
3769
|
+
if (X(t, "function")) {
|
|
3770
|
+
Y.readFile(e, "utf-8", (n, r) => {
|
|
3771
|
+
if (n || !r) {
|
|
3772
|
+
n && $.dev && console.error(n);
|
|
3773
|
+
return;
|
|
3774
|
+
}
|
|
3775
|
+
let i = Q(r);
|
|
3776
|
+
if (!i) {
|
|
3777
|
+
J.error(W.file.filePath({ path: e }), W.file.readErr());
|
|
3778
|
+
return;
|
|
3779
|
+
}
|
|
3780
|
+
t(i);
|
|
3781
|
+
});
|
|
3782
|
+
return;
|
|
3783
|
+
}
|
|
3784
|
+
let { cv: n } = $;
|
|
3785
|
+
try {
|
|
3786
|
+
if (t) return new Promise((t, r) => {
|
|
3787
|
+
n.readTextFileSync(e, (e, n) => {
|
|
3788
|
+
t(n ? Q(n) : null);
|
|
3789
|
+
});
|
|
3790
|
+
});
|
|
3791
|
+
{
|
|
3792
|
+
let t = n.readTextFileSync(e);
|
|
3793
|
+
return t ? Q(t) : null;
|
|
3794
|
+
}
|
|
3795
|
+
} catch (t) {
|
|
3796
|
+
return J.error(W.file.filePath({ path: e }), W.file.readErr()), $.dev && console.error(t), null;
|
|
3797
|
+
}
|
|
3798
|
+
}, Zt = (e, t) => {
|
|
3799
|
+
Y.writeFile(e, $t(t), "utf-8", (t) => {
|
|
3800
|
+
t && (J.error(W.file.filePath({ path: e }), W.file.writeErr()), $.dev && console.error(t));
|
|
3801
|
+
});
|
|
3802
|
+
}, Qt = (e, t) => {
|
|
3803
|
+
X(t, "function") && Y.watch(e, (e) => {
|
|
3804
|
+
e === "change" && (clearTimeout(t?.timer), t.timer = setTimeout(t, 1e3));
|
|
3805
|
+
});
|
|
3806
|
+
}, Q = (e, t = null) => {
|
|
3807
|
+
if (typeof e == "object") return e;
|
|
3808
|
+
try {
|
|
3809
|
+
return JSON.parse(e);
|
|
3810
|
+
} catch {
|
|
3811
|
+
return t;
|
|
3812
|
+
}
|
|
3813
|
+
}, $t = (e, t = "") => {
|
|
3814
|
+
if (typeof e == "string") return e;
|
|
3815
|
+
try {
|
|
3816
|
+
return JSON.stringify(e);
|
|
3817
|
+
} catch {
|
|
3818
|
+
return t;
|
|
3819
|
+
}
|
|
3820
|
+
}, en = (e = {}, t = {}) => {
|
|
3821
|
+
for (let n of Object.keys(t)) {
|
|
3822
|
+
let r = t[n];
|
|
3823
|
+
X(r, "object") ? (e[n] || (e[n] = {}), en(e[n], r)) : e[n] = r;
|
|
3824
|
+
}
|
|
3825
|
+
return e;
|
|
3826
|
+
}, tn = (e, t = {}) => {
|
|
3827
|
+
let { x: n = 0, y: r = 0, w: i = 0, h: a = 0, fileName: o, prefixDir: s = K.ngImagesDir, ratio: c = q.ngImgRatio } = t;
|
|
3828
|
+
if (!e || n <= 0 || r <= 0 || i <= 0 || a <= 0 || !o) return {
|
|
3829
|
+
image: e,
|
|
3830
|
+
x: n,
|
|
3831
|
+
y: r,
|
|
3832
|
+
w: i,
|
|
3833
|
+
h: a,
|
|
3834
|
+
fileName: o,
|
|
3835
|
+
prefix
|
|
3836
|
+
};
|
|
3837
|
+
try {
|
|
3838
|
+
let t = `${s}/${o}`, l = t.split(".").pop().toLowerCase();
|
|
3839
|
+
[
|
|
3840
|
+
"jpg",
|
|
3841
|
+
"jpeg",
|
|
3842
|
+
"png",
|
|
3843
|
+
"bmp"
|
|
3844
|
+
].includes(l) || (t += `.${q.ngImgSuffix}`);
|
|
3845
|
+
let u = t.substring(0, t.lastIndexOf("/"));
|
|
3846
|
+
Y.existsSync(u) || Y.mkdirSync(u, { recursive: !0 });
|
|
3847
|
+
let { cv: d } = $, f = d.cropSharedMemImage(e, n, r, n + i, r + a);
|
|
3848
|
+
return !f || new Promise((e, n) => {
|
|
3849
|
+
d.imwriteWithRatio(t, f, c, (t) => {
|
|
3850
|
+
t ? ($.dev && console.error("error save image: ", t), e(!0)) : e(!1);
|
|
3851
|
+
});
|
|
3852
|
+
});
|
|
3853
|
+
} catch (e) {
|
|
3854
|
+
return $.dev && console.error(e), !0;
|
|
3855
|
+
}
|
|
3856
|
+
}, nn = (e = {}) => {
|
|
3857
|
+
let { fileName: t, prefixDir: n = K.ngImagesDir } = e;
|
|
3858
|
+
if (!t) return;
|
|
3859
|
+
let r = `${n}/${t}`, i = r.split(".").pop().toLowerCase();
|
|
3860
|
+
[
|
|
3861
|
+
"jpg",
|
|
3862
|
+
"jpeg",
|
|
3863
|
+
"png",
|
|
3864
|
+
"bmp"
|
|
3865
|
+
].includes(i) || (r += `.${q.ngImgSuffix}`);
|
|
3866
|
+
let { cv: a } = $;
|
|
3867
|
+
return new Promise((e, t) => {
|
|
3868
|
+
a.imread(r, (t, n) => {
|
|
3869
|
+
t ? ($.dev && console.error("error read image: ", t), e(!1)) : e(n);
|
|
3870
|
+
});
|
|
3871
|
+
});
|
|
3872
|
+
}, rn = async (e = {}) => {
|
|
3873
|
+
let { fileName: t, prefixDir: n = K.ngImagesDir } = e;
|
|
3874
|
+
if (!t) return;
|
|
3875
|
+
let r = n ? `${n}/${t}` : t;
|
|
3876
|
+
if (!Y.existsSync(r)) return;
|
|
3877
|
+
let { exe: i } = $;
|
|
3878
|
+
return await i.deletePath(r) === "delete successed";
|
|
3879
|
+
}, an = (e, ...t) => e.replace(/\?/g, () => {
|
|
3880
|
+
let e = t.shift();
|
|
3881
|
+
return e instanceof Object && (e = $t(e, void 0)), typeof e == "string" ? e.length ? `'${e}'` : "null" : e === void 0 ? "null" : e;
|
|
3882
|
+
}).replace(/[\n\r\s]+/g, " "), on = class {
|
|
3883
|
+
#e = [];
|
|
3884
|
+
#t = !1;
|
|
3885
|
+
get sqls() {
|
|
3886
|
+
return this.#e;
|
|
3887
|
+
}
|
|
3888
|
+
get error() {
|
|
3889
|
+
return this.#t;
|
|
3890
|
+
}
|
|
3891
|
+
constructor(e) {
|
|
3892
|
+
let { exe: t } = $;
|
|
3893
|
+
this.#e = e || [], this.#e.length ? this.#t = e.some((e) => t.verifyDatabase(e.tableName, $t(e.fields))) : this.#t = !0;
|
|
3894
|
+
}
|
|
3895
|
+
async #n({ tableName: e, sqlKey: t, typeErr: n, execFunc: r }, ...i) {
|
|
3896
|
+
let a = this.#e.find((t) => t.tableName === e);
|
|
3897
|
+
if (!a) return J.error(W.sql.tableErr({ tableName: e }), W.sql.error()), !1;
|
|
3898
|
+
let { exe: o } = $, s = an(a.sqls[t], ...i);
|
|
3899
|
+
try {
|
|
3900
|
+
let e = await r(o, s);
|
|
3901
|
+
if (e) return e;
|
|
3902
|
+
throw Error();
|
|
3903
|
+
} catch (e) {
|
|
3904
|
+
return J.error(W.sql.execErr({ error: s }), n), $.dev && console.error(e), !1;
|
|
3905
|
+
}
|
|
3906
|
+
}
|
|
3907
|
+
update(e, t, ...n) {
|
|
3908
|
+
return this.#n({
|
|
3909
|
+
tableName: e,
|
|
3910
|
+
sqlKey: t,
|
|
3911
|
+
typeErr: W.sql.updateErr(),
|
|
3912
|
+
execFunc: async (e, t) => await e.writeDataBase(t) === 0
|
|
3913
|
+
}, ...n);
|
|
3914
|
+
}
|
|
3915
|
+
select(e, t, ...n) {
|
|
3916
|
+
return this.#n({
|
|
3917
|
+
tableName: e,
|
|
3918
|
+
sqlKey: t,
|
|
3919
|
+
typeErr: W.sql.selectErr(),
|
|
3920
|
+
execFunc: async (e, t) => {
|
|
3921
|
+
let n = await e.findDataBaseData(t);
|
|
3922
|
+
return n?.length ? Q(n, []) : [];
|
|
3923
|
+
}
|
|
3924
|
+
}, ...n);
|
|
3925
|
+
}
|
|
3926
|
+
getter(e, t, ...n) {
|
|
3927
|
+
return this.#n({
|
|
3928
|
+
tableName: e,
|
|
3929
|
+
sqlKey: t,
|
|
3930
|
+
typeErr: W.sql.selectErr(),
|
|
3931
|
+
execFunc: async (e, t) => {
|
|
3932
|
+
let n = await e.findSingleDataBaseData(t);
|
|
3933
|
+
return n?.length ? Q(n) : null;
|
|
3934
|
+
}
|
|
3935
|
+
}, ...n);
|
|
3936
|
+
}
|
|
3937
|
+
async batch(...e) {
|
|
3938
|
+
let t = /* @__PURE__ */ new Set(), n = [];
|
|
3939
|
+
for (let r of e) {
|
|
3940
|
+
let e = this.#e.find((e) => e.tableName === r.name);
|
|
3941
|
+
e ? n.push(an(e.sqls[r.key], ...r?.params ?? [])) : t.add(r.name);
|
|
3942
|
+
}
|
|
3943
|
+
if (t.size) {
|
|
3944
|
+
let e = Array.from(t).join(", ");
|
|
3945
|
+
return J.error(W.sql.tableErr({ tableName: e }), W.sql.error()), !1;
|
|
3946
|
+
}
|
|
3947
|
+
let { exe: r } = $, i = n.join("&");
|
|
3948
|
+
try {
|
|
3949
|
+
if (await r.batchWriteDataBase(i)) return !0;
|
|
3950
|
+
throw Error();
|
|
3951
|
+
} catch (e) {
|
|
3952
|
+
return J.error(W.sql.execErr({ error: i }), W.sql.batchErr()), $.dev && console.error(e), !1;
|
|
3953
|
+
}
|
|
3954
|
+
}
|
|
3955
|
+
}, sn = (e) => {
|
|
3956
|
+
let t = new on(e);
|
|
3957
|
+
return !t.error && t;
|
|
3958
|
+
}, cn = new class {
|
|
3959
|
+
maxLength = 3;
|
|
3960
|
+
#e = [];
|
|
3961
|
+
get length() {
|
|
3962
|
+
return this.#e.length;
|
|
3963
|
+
}
|
|
3964
|
+
constructor() {
|
|
3965
|
+
this.#e.splice(0, this.#e.length);
|
|
3966
|
+
}
|
|
3967
|
+
add(e) {
|
|
3968
|
+
if (this.#e.length >= this.maxLength) {
|
|
3969
|
+
let { image: e } = this.#e.shift();
|
|
3970
|
+
e?.release?.();
|
|
3971
|
+
}
|
|
3972
|
+
this.#e.push(e);
|
|
3973
|
+
}
|
|
3974
|
+
get(e) {
|
|
3975
|
+
for (let t of this.#e) if (t?.id === e) return t;
|
|
3976
|
+
}
|
|
3977
|
+
contain(e) {
|
|
3978
|
+
for (let t of this.#e) if (t?.id === e) return !0;
|
|
3979
|
+
return !1;
|
|
3980
|
+
}
|
|
3981
|
+
clear() {
|
|
3982
|
+
for (let e of this.#e) {
|
|
3983
|
+
let { image: t } = e;
|
|
3984
|
+
t?.release?.();
|
|
3985
|
+
}
|
|
3986
|
+
this.#e.splice(0, this.#e.length);
|
|
3987
|
+
}
|
|
3988
|
+
}(), $ = {
|
|
3989
|
+
token: ge,
|
|
3990
|
+
langs: [],
|
|
3991
|
+
exe: null,
|
|
3992
|
+
cv: null,
|
|
3993
|
+
db: null,
|
|
3994
|
+
evt: !1,
|
|
3995
|
+
neat: !1,
|
|
3996
|
+
dev: !1,
|
|
3997
|
+
level: null
|
|
3998
|
+
}, ln = ({ exe: e = null, cv: t = null, neat: n = !1, dev: r = !1, resource: i = {}, lang: a = "zh", sqls: o = [], evt: s = [], level: c = {}, config: l = {}, imgQueueLen: u = 3, msgMaxLen: d = 100 } = {}) => {
|
|
3999
|
+
$.exe = e, $.cv = t, $.neat = n, $.dev = r, $.level = c, $.langs = ht(i, a), $.db = sn(o), $.evt = bt(s), J.maxLength = d, cn.maxLength = u, Pt(l);
|
|
4000
|
+
};
|
|
4001
|
+
//#endregion
|
|
4002
|
+
export { M as $, J as A, St as B, Gt as C, Vt as D, Kt as E, Nt as F, _t as G, wt as H, Dt as I, ct as J, W as K, G as L, K as M, Pt as N, Qt as O, q as P, he as Q, Et as R, Rt as S, Wt as T, Ct as U, bt as V, Tt as W, U as X, at as Y, V as Z, tn as _, en as a, Yt as b, Bt as c, Ht as d, fe as et, X as f, rn as g, nn as h, sn as i, Ft as j, Zt as k, Ut as l, Xt as m, ln as n, Lt as o, Q as p, dt as q, cn as r, zt as s, $ as t, ie as tt, Y as u, Jt as v, qt as w, $t as x, Z as y, xt as z };
|