tekivex-ui 2.5.11 → 2.5.12
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/dist/TkxForm-1KDzoniV.cjs +12 -0
- package/dist/TkxForm-9-W3Nl6m.js +314 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.js +543 -507
- package/dist/chunk-Bmb41Sf3.cjs +1 -0
- package/dist/headless.cjs +1 -1
- package/dist/headless.js +428 -447
- package/dist/hooks-6pRsPOyG.js +58 -0
- package/dist/hooks-mivgRljH.cjs +1 -0
- package/dist/i18n.cjs +1 -1
- package/dist/i18n.js +728 -752
- package/dist/index.cjs +26 -26
- package/dist/index.js +16102 -16619
- package/dist/quantum.cjs +14 -16
- package/dist/quantum.js +2473 -2279
- package/dist/realtime.cjs +4 -10
- package/dist/realtime.js +804 -958
- package/dist/src/components/TkxClock.d.ts.map +1 -1
- package/dist/src/components/TkxForm.d.ts.map +1 -1
- package/dist/src/components/TkxLiveFeed.d.ts +1 -1
- package/dist/src/components/TkxLiveLog.d.ts +1 -1
- package/dist/src/components/TkxRealTimeChart.d.ts +1 -1
- package/dist/src/components/TkxTooltip.d.ts.map +1 -1
- package/dist/src/components/TkxTypography.d.ts +5 -5
- package/dist/src/components/TkxTypography.d.ts.map +1 -1
- package/dist/tekivex-ui.css +2 -0
- package/dist/themes-BbJanqiC.js +498 -0
- package/dist/themes-CMq2vWXj.cjs +2 -0
- package/dist/tkx-0oAwZqgL.cjs +4 -0
- package/dist/tkx-DQkvHdE5.js +1172 -0
- package/package.json +16 -16
- package/src/components/TkxClock.tsx +2 -2
- package/src/components/TkxForm.tsx +4 -2
- package/src/components/TkxTooltip.tsx +7 -5
- package/src/components/TkxTypography.tsx +2 -2
- package/dist/TkxForm-2tGLCPH6.js +0 -326
- package/dist/TkxForm-C2VqR2wC.cjs +0 -12
- package/dist/index-BgHMZe4Z.js +0 -66
- package/dist/index-Bt5y50Qa.cjs +0 -1
- package/dist/index-DnqXtpwV.cjs +0 -2
- package/dist/index-iUUHRxqJ.js +0 -515
- package/dist/security-C-ZPGoyG.js +0 -97
- package/dist/security-Uf0mjv8o.cjs +0 -1
- package/dist/style.css +0 -1
- package/dist/tkx-BtHzWKTl.js +0 -1112
- package/dist/tkx-C7GvVUE9.cjs +0 -4
package/dist/quantum.js
CHANGED
|
@@ -1,2312 +1,2506 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
class
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
1
|
+
import { f as e } from "./themes-BbJanqiC.js";
|
|
2
|
+
import { a as t, m as n } from "./tkx-DQkvHdE5.js";
|
|
3
|
+
import r, { useCallback as i, useEffect as a, useRef as o, useState as s } from "react";
|
|
4
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
5
|
+
//#region src/engine/quantum-ai.ts
|
|
6
|
+
var d = class e {
|
|
7
|
+
constructor(e, t) {
|
|
8
|
+
this.re = e, this.im = t;
|
|
9
|
+
}
|
|
10
|
+
add(t) {
|
|
11
|
+
return new e(this.re + t.re, this.im + t.im);
|
|
12
|
+
}
|
|
13
|
+
sub(t) {
|
|
14
|
+
return new e(this.re - t.re, this.im - t.im);
|
|
15
|
+
}
|
|
16
|
+
mul(t) {
|
|
17
|
+
return new e(this.re * t.re - this.im * t.im, this.re * t.im + this.im * t.re);
|
|
18
|
+
}
|
|
19
|
+
scale(t) {
|
|
20
|
+
return new e(this.re * t, this.im * t);
|
|
21
|
+
}
|
|
22
|
+
conjugate() {
|
|
23
|
+
return new e(this.re, -this.im);
|
|
24
|
+
}
|
|
25
|
+
magnitudeSquared() {
|
|
26
|
+
return this.re * this.re + this.im * this.im;
|
|
27
|
+
}
|
|
28
|
+
magnitude() {
|
|
29
|
+
return Math.sqrt(this.magnitudeSquared());
|
|
30
|
+
}
|
|
31
|
+
static fromPolar(t, n) {
|
|
32
|
+
return new e(t * Math.cos(n), t * Math.sin(n));
|
|
33
|
+
}
|
|
34
|
+
static zero() {
|
|
35
|
+
return new e(0, 0);
|
|
36
|
+
}
|
|
37
|
+
static one() {
|
|
38
|
+
return new e(1, 0);
|
|
39
|
+
}
|
|
40
|
+
}, f = class e {
|
|
41
|
+
constructor(e = d.one(), t = d.zero()) {
|
|
42
|
+
this.alpha = e, this.beta = t, this.normalize();
|
|
43
|
+
}
|
|
44
|
+
normalize() {
|
|
45
|
+
let e = Math.sqrt(this.alpha.magnitudeSquared() + this.beta.magnitudeSquared());
|
|
46
|
+
e > 0 && (this.alpha = this.alpha.scale(1 / e), this.beta = this.beta.scale(1 / e));
|
|
47
|
+
}
|
|
48
|
+
hadamard() {
|
|
49
|
+
let t = 1 / Math.SQRT2;
|
|
50
|
+
return new e(this.alpha.add(this.beta).scale(t), this.alpha.sub(this.beta).scale(t));
|
|
51
|
+
}
|
|
52
|
+
ry(t) {
|
|
53
|
+
let n = Math.cos(t / 2), r = Math.sin(t / 2);
|
|
54
|
+
return new e(this.alpha.scale(n).sub(this.beta.scale(r)), this.alpha.scale(r).add(this.beta.scale(n)));
|
|
55
|
+
}
|
|
56
|
+
phase(t) {
|
|
57
|
+
let n = d.fromPolar(1, t);
|
|
58
|
+
return new e(this.alpha, this.beta.mul(n));
|
|
59
|
+
}
|
|
60
|
+
measure() {
|
|
61
|
+
let e = this.beta.magnitudeSquared();
|
|
62
|
+
return +(Math.random() < e);
|
|
63
|
+
}
|
|
64
|
+
expectation() {
|
|
65
|
+
return this.beta.magnitudeSquared();
|
|
66
|
+
}
|
|
67
|
+
getAlpha() {
|
|
68
|
+
return this.alpha;
|
|
69
|
+
}
|
|
70
|
+
getBeta() {
|
|
71
|
+
return this.beta;
|
|
72
|
+
}
|
|
73
|
+
}, p = class {
|
|
74
|
+
constructor(e) {
|
|
75
|
+
this.qubits = Array.from({ length: e }, () => new f());
|
|
76
|
+
}
|
|
77
|
+
get size() {
|
|
78
|
+
return this.qubits.length;
|
|
79
|
+
}
|
|
80
|
+
getQubit(e) {
|
|
81
|
+
return this.qubits[e];
|
|
82
|
+
}
|
|
83
|
+
superpose() {
|
|
84
|
+
this.qubits = this.qubits.map((e) => e.hadamard());
|
|
85
|
+
}
|
|
86
|
+
cnot(e, t) {
|
|
87
|
+
let n = this.qubits[e], r = this.qubits[t], i = n.expectation();
|
|
88
|
+
this.qubits[t] = r.ry(Math.PI * i);
|
|
89
|
+
}
|
|
90
|
+
rotate(e, t) {
|
|
91
|
+
this.qubits[e] = this.qubits[e].ry(t);
|
|
92
|
+
}
|
|
93
|
+
measure() {
|
|
94
|
+
return this.qubits.map((e) => e.measure());
|
|
95
|
+
}
|
|
96
|
+
probs() {
|
|
97
|
+
return this.qubits.map((e) => e.expectation());
|
|
98
|
+
}
|
|
99
|
+
}, m = class {
|
|
100
|
+
constructor(e = 1, t = .995, n = .3, r = 1e-6) {
|
|
101
|
+
this.temperature = e, this.coolingRate = t, this.tunnelingStrength = n, this.minTemp = r;
|
|
102
|
+
}
|
|
103
|
+
anneal(e, t, n, r = 1e3) {
|
|
104
|
+
let i = e, a = t(i), o = i, s = a, c = this.temperature, l = 0, u = 0;
|
|
105
|
+
for (let e = 0; e < r && c > this.minTemp; e++) {
|
|
106
|
+
let e = n(i), r = t(e), d = r - a, f = !1;
|
|
107
|
+
if (d <= 0) f = !0;
|
|
108
|
+
else {
|
|
109
|
+
let e = Math.exp(-d / c), t = Math.sqrt(2 * Math.abs(d)), n = Math.abs(d), r = Math.exp(-2 * t * Math.sqrt(n) * this.tunnelingStrength);
|
|
110
|
+
Math.random() < e + r && (f = !0, Math.random() < r / (e + r + 1e-10) && u++);
|
|
111
|
+
}
|
|
112
|
+
f && (i = e, a = r, l++, a < s && (o = i, s = a)), c *= this.coolingRate;
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
state: o,
|
|
116
|
+
energy: s,
|
|
117
|
+
iterations: r,
|
|
118
|
+
accepted: l,
|
|
119
|
+
tunnels: u
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}, h = class {
|
|
123
|
+
constructor(e, t) {
|
|
124
|
+
let n = Math.sqrt(2 / (e + t));
|
|
125
|
+
this.weights = Array.from({ length: e }, () => Array.from({ length: t }, () => (Math.random() * 2 - 1) * n)), this.visibleBias = Array.from({ length: e }, () => 0), this.hiddenBias = Array.from({ length: t }, () => 0);
|
|
126
|
+
}
|
|
127
|
+
sigmoid(e) {
|
|
128
|
+
let t = (Math.random() - .5) * .1;
|
|
129
|
+
return 1 / (1 + Math.exp(-(e + t)));
|
|
130
|
+
}
|
|
131
|
+
sample(e) {
|
|
132
|
+
return +(Math.random() < e);
|
|
133
|
+
}
|
|
134
|
+
energy(e, t) {
|
|
135
|
+
let n = this.visibleBias.reduce((t, n, r) => t + n * e[r], 0), r = this.hiddenBias.reduce((e, n, r) => e + n * t[r], 0), i = 0;
|
|
136
|
+
for (let n = 0; n < e.length; n++) for (let r = 0; r < t.length; r++) i += e[n] * this.weights[n][r] * t[r];
|
|
137
|
+
return -(n + r + i);
|
|
138
|
+
}
|
|
139
|
+
hiddenProbs(e) {
|
|
140
|
+
return this.hiddenBias.map((t, n) => {
|
|
141
|
+
let r = t + e.reduce((e, t, r) => e + this.weights[r][n] * t, 0);
|
|
142
|
+
return this.sigmoid(r);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
visibleProbs(e) {
|
|
146
|
+
return this.visibleBias.map((t, n) => {
|
|
147
|
+
let r = t + e.reduce((e, t, r) => e + this.weights[n][r] * t, 0);
|
|
148
|
+
return this.sigmoid(r);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
gibbs(e, t = 1) {
|
|
152
|
+
let n = [...e], r = [];
|
|
153
|
+
for (let e = 0; e < t; e++) r = this.hiddenProbs(n).map((e) => this.sample(e)), n = this.visibleProbs(r).map((e) => this.sample(e));
|
|
154
|
+
return {
|
|
155
|
+
visible: n,
|
|
156
|
+
hidden: r
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
trainCD1(e, t = .01) {
|
|
160
|
+
let n = this.visibleBias.length, r = this.hiddenBias.length, i = Array.from({ length: n }, () => Array(r).fill(0)), a = Array(n).fill(0), o = Array(r).fill(0);
|
|
161
|
+
for (let t of e) {
|
|
162
|
+
let e = this.hiddenProbs(t), s = e.map((e) => this.sample(e)), c = this.visibleProbs(s).map((e) => this.sample(e)), l = this.hiddenProbs(c);
|
|
163
|
+
for (let o = 0; o < n; o++) {
|
|
164
|
+
for (let n = 0; n < r; n++) i[o][n] += t[o] * e[n] - c[o] * l[n];
|
|
165
|
+
a[o] += t[o] - c[o];
|
|
166
|
+
}
|
|
167
|
+
for (let t = 0; t < r; t++) o[t] += e[t] - l[t];
|
|
168
|
+
}
|
|
169
|
+
let s = e.length;
|
|
170
|
+
for (let e = 0; e < n; e++) {
|
|
171
|
+
for (let n = 0; n < r; n++) this.weights[e][n] += t * i[e][n] / s;
|
|
172
|
+
this.visibleBias[e] += t * a[e] / s;
|
|
173
|
+
}
|
|
174
|
+
for (let e = 0; e < r; e++) this.hiddenBias[e] += t * o[e] / s;
|
|
175
|
+
}
|
|
176
|
+
infer(e) {
|
|
177
|
+
let t = this.hiddenProbs(e), n = t.map((e) => this.sample(e));
|
|
178
|
+
return {
|
|
179
|
+
hidden: t,
|
|
180
|
+
visible: this.visibleProbs(n),
|
|
181
|
+
energy: this.energy(e, n),
|
|
182
|
+
iterations: 1
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
}, g = class {
|
|
186
|
+
amplify(e, t, n = .5) {
|
|
187
|
+
let r = e.length;
|
|
188
|
+
if (r === 0) return [];
|
|
189
|
+
let i = e.map(t), a = i.filter((e) => e > n).length, o = Math.max(1, a), s = Array(r).fill(1 / Math.sqrt(r)), c = Math.max(1, Math.floor(Math.PI / 4 * Math.sqrt(r / o)));
|
|
190
|
+
for (let e = 0; e < c; e++) {
|
|
191
|
+
for (let e = 0; e < r; e++) i[e] > n && (s[e] = -s[e]);
|
|
192
|
+
let e = s.reduce((e, t) => e + t, 0) / r;
|
|
193
|
+
s = s.map((t) => 2 * e - t);
|
|
194
|
+
}
|
|
195
|
+
return e.map((e, t) => ({
|
|
196
|
+
index: t,
|
|
197
|
+
amplitude: s[t],
|
|
198
|
+
probability: s[t] * s[t],
|
|
199
|
+
classicalSimilarity: i[t],
|
|
200
|
+
combined: s[t] * s[t] * .6 + i[t] * .4
|
|
201
|
+
})).sort((e, t) => t.combined - e.combined);
|
|
202
|
+
}
|
|
203
|
+
}, _ = [
|
|
204
|
+
{
|
|
205
|
+
keywords: [
|
|
206
|
+
"email",
|
|
207
|
+
"e-mail",
|
|
208
|
+
"mail"
|
|
209
|
+
],
|
|
210
|
+
type: "email",
|
|
211
|
+
validations: [
|
|
212
|
+
{
|
|
213
|
+
rule: "required",
|
|
214
|
+
message: "Email is required"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
rule: "pattern",
|
|
218
|
+
value: "^[^@]+@[^@]+\\.[^@]+$",
|
|
219
|
+
message: "Enter a valid email address"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
rule: "maxLength",
|
|
223
|
+
value: 254,
|
|
224
|
+
message: "Email too long"
|
|
225
|
+
}
|
|
226
|
+
],
|
|
227
|
+
placeholder: "you@example.com",
|
|
228
|
+
label: "Email Address",
|
|
229
|
+
confidence: .98
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
keywords: [
|
|
233
|
+
"password",
|
|
234
|
+
"passwd",
|
|
235
|
+
"pwd",
|
|
236
|
+
"pass"
|
|
237
|
+
],
|
|
238
|
+
type: "password",
|
|
239
|
+
validations: [
|
|
240
|
+
{
|
|
241
|
+
rule: "required",
|
|
242
|
+
message: "Password is required"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
rule: "minLength",
|
|
246
|
+
value: 8,
|
|
247
|
+
message: "Password must be at least 8 characters"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
rule: "pattern",
|
|
251
|
+
value: "(?=.*[A-Z])(?=.*[0-9])",
|
|
252
|
+
message: "Include uppercase and a number"
|
|
253
|
+
}
|
|
254
|
+
],
|
|
255
|
+
placeholder: "••••••••",
|
|
256
|
+
label: "Password",
|
|
257
|
+
confidence: .97
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
keywords: [
|
|
261
|
+
"confirm_password",
|
|
262
|
+
"confirmpassword",
|
|
263
|
+
"confirm_pass",
|
|
264
|
+
"repassword",
|
|
265
|
+
"password2",
|
|
266
|
+
"repeat_password"
|
|
267
|
+
],
|
|
268
|
+
type: "password",
|
|
269
|
+
validations: [{
|
|
270
|
+
rule: "required",
|
|
271
|
+
message: "Please confirm your password"
|
|
272
|
+
}, {
|
|
273
|
+
rule: "match",
|
|
274
|
+
value: "password",
|
|
275
|
+
message: "Passwords do not match"
|
|
276
|
+
}],
|
|
277
|
+
placeholder: "••••••••",
|
|
278
|
+
label: "Confirm Password",
|
|
279
|
+
confidence: .95
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
keywords: [
|
|
283
|
+
"phone",
|
|
284
|
+
"mobile",
|
|
285
|
+
"cell",
|
|
286
|
+
"tel",
|
|
287
|
+
"telephone",
|
|
288
|
+
"contact_number"
|
|
289
|
+
],
|
|
290
|
+
type: "tel",
|
|
291
|
+
validations: [{
|
|
292
|
+
rule: "pattern",
|
|
293
|
+
value: "^[+]?[(]?[0-9]{3}[)]?[-\\s.]?[0-9]{3}[-\\s.]?[0-9]{4,6}$",
|
|
294
|
+
message: "Enter a valid phone number"
|
|
295
|
+
}],
|
|
296
|
+
placeholder: "+1 (555) 000-0000",
|
|
297
|
+
label: "Phone Number",
|
|
298
|
+
confidence: .93
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
keywords: ["age"],
|
|
302
|
+
type: "number",
|
|
303
|
+
validations: [
|
|
304
|
+
{
|
|
305
|
+
rule: "min",
|
|
306
|
+
value: 0,
|
|
307
|
+
message: "Age cannot be negative"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
rule: "max",
|
|
311
|
+
value: 150,
|
|
312
|
+
message: "Enter a valid age"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
rule: "integer",
|
|
316
|
+
message: "Age must be a whole number"
|
|
317
|
+
}
|
|
318
|
+
],
|
|
319
|
+
placeholder: "25",
|
|
320
|
+
label: "Age",
|
|
321
|
+
confidence: .9
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
keywords: [
|
|
325
|
+
"price",
|
|
326
|
+
"amount",
|
|
327
|
+
"cost",
|
|
328
|
+
"fee",
|
|
329
|
+
"payment",
|
|
330
|
+
"salary",
|
|
331
|
+
"wage",
|
|
332
|
+
"total"
|
|
333
|
+
],
|
|
334
|
+
type: "number",
|
|
335
|
+
validations: [{
|
|
336
|
+
rule: "min",
|
|
337
|
+
value: 0,
|
|
338
|
+
message: "Amount cannot be negative"
|
|
339
|
+
}, {
|
|
340
|
+
rule: "pattern",
|
|
341
|
+
value: "^\\d+(\\.\\d{1,2})?$",
|
|
342
|
+
message: "Enter a valid amount (e.g. 9.99)"
|
|
343
|
+
}],
|
|
344
|
+
placeholder: "0.00",
|
|
345
|
+
label: "Amount",
|
|
346
|
+
confidence: .88
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
keywords: [
|
|
350
|
+
"url",
|
|
351
|
+
"website",
|
|
352
|
+
"site",
|
|
353
|
+
"link",
|
|
354
|
+
"homepage",
|
|
355
|
+
"web"
|
|
356
|
+
],
|
|
357
|
+
type: "url",
|
|
358
|
+
validations: [{
|
|
359
|
+
rule: "pattern",
|
|
360
|
+
value: "https?://.+",
|
|
361
|
+
message: "Enter a valid URL starting with http:// or https://"
|
|
362
|
+
}],
|
|
363
|
+
placeholder: "https://example.com",
|
|
364
|
+
label: "Website URL",
|
|
365
|
+
confidence: .92
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
keywords: [
|
|
369
|
+
"zip",
|
|
370
|
+
"zipcode",
|
|
371
|
+
"postal",
|
|
372
|
+
"postcode",
|
|
373
|
+
"pin_code"
|
|
374
|
+
],
|
|
375
|
+
type: "text",
|
|
376
|
+
validations: [{
|
|
377
|
+
rule: "pattern",
|
|
378
|
+
value: "^[0-9]{5}(-[0-9]{4})?$",
|
|
379
|
+
message: "Enter a valid ZIP code (e.g. 12345)"
|
|
380
|
+
}],
|
|
381
|
+
placeholder: "12345",
|
|
382
|
+
label: "ZIP / Postal Code",
|
|
383
|
+
confidence: .91
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
keywords: [
|
|
387
|
+
"date",
|
|
388
|
+
"dob",
|
|
389
|
+
"birthday",
|
|
390
|
+
"birth_date",
|
|
391
|
+
"birthdate",
|
|
392
|
+
"born"
|
|
393
|
+
],
|
|
394
|
+
type: "date",
|
|
395
|
+
validations: [{
|
|
396
|
+
rule: "required",
|
|
397
|
+
message: "Date is required"
|
|
398
|
+
}],
|
|
399
|
+
placeholder: "YYYY-MM-DD",
|
|
400
|
+
label: "Date of Birth",
|
|
401
|
+
confidence: .89
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
keywords: [
|
|
405
|
+
"first_name",
|
|
406
|
+
"firstname",
|
|
407
|
+
"fname",
|
|
408
|
+
"given_name"
|
|
409
|
+
],
|
|
410
|
+
type: "text",
|
|
411
|
+
validations: [{
|
|
412
|
+
rule: "minLength",
|
|
413
|
+
value: 2,
|
|
414
|
+
message: "First name too short"
|
|
415
|
+
}, {
|
|
416
|
+
rule: "maxLength",
|
|
417
|
+
value: 50,
|
|
418
|
+
message: "First name too long"
|
|
419
|
+
}],
|
|
420
|
+
placeholder: "Jane",
|
|
421
|
+
label: "First Name",
|
|
422
|
+
confidence: .9
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
keywords: [
|
|
426
|
+
"last_name",
|
|
427
|
+
"lastname",
|
|
428
|
+
"lname",
|
|
429
|
+
"surname",
|
|
430
|
+
"family_name"
|
|
431
|
+
],
|
|
432
|
+
type: "text",
|
|
433
|
+
validations: [{
|
|
434
|
+
rule: "minLength",
|
|
435
|
+
value: 2,
|
|
436
|
+
message: "Last name too short"
|
|
437
|
+
}, {
|
|
438
|
+
rule: "maxLength",
|
|
439
|
+
value: 50,
|
|
440
|
+
message: "Last name too long"
|
|
441
|
+
}],
|
|
442
|
+
placeholder: "Doe",
|
|
443
|
+
label: "Last Name",
|
|
444
|
+
confidence: .9
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
keywords: [
|
|
448
|
+
"name",
|
|
449
|
+
"full_name",
|
|
450
|
+
"fullname",
|
|
451
|
+
"display_name"
|
|
452
|
+
],
|
|
453
|
+
type: "text",
|
|
454
|
+
validations: [{
|
|
455
|
+
rule: "minLength",
|
|
456
|
+
value: 2,
|
|
457
|
+
message: "Name too short"
|
|
458
|
+
}, {
|
|
459
|
+
rule: "maxLength",
|
|
460
|
+
value: 100,
|
|
461
|
+
message: "Name too long"
|
|
462
|
+
}],
|
|
463
|
+
placeholder: "Jane Doe",
|
|
464
|
+
label: "Full Name",
|
|
465
|
+
confidence: .85
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
keywords: [
|
|
469
|
+
"username",
|
|
470
|
+
"user_name",
|
|
471
|
+
"handle",
|
|
472
|
+
"login",
|
|
473
|
+
"loginname"
|
|
474
|
+
],
|
|
475
|
+
type: "text",
|
|
476
|
+
validations: [
|
|
477
|
+
{
|
|
478
|
+
rule: "minLength",
|
|
479
|
+
value: 3,
|
|
480
|
+
message: "Username must be at least 3 characters"
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
rule: "maxLength",
|
|
484
|
+
value: 32,
|
|
485
|
+
message: "Username too long"
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
rule: "pattern",
|
|
489
|
+
value: "^[a-zA-Z0-9_.-]+$",
|
|
490
|
+
message: "Only letters, numbers, _, - and . allowed"
|
|
491
|
+
}
|
|
492
|
+
],
|
|
493
|
+
placeholder: "cooluser42",
|
|
494
|
+
label: "Username",
|
|
495
|
+
confidence: .94
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
keywords: [
|
|
499
|
+
"bio",
|
|
500
|
+
"biography",
|
|
501
|
+
"about",
|
|
502
|
+
"description",
|
|
503
|
+
"summary",
|
|
504
|
+
"details"
|
|
505
|
+
],
|
|
506
|
+
type: "textarea",
|
|
507
|
+
validations: [{
|
|
508
|
+
rule: "maxLength",
|
|
509
|
+
value: 500,
|
|
510
|
+
message: "Bio must be under 500 characters"
|
|
511
|
+
}],
|
|
512
|
+
placeholder: "Tell us about yourself...",
|
|
513
|
+
label: "Bio",
|
|
514
|
+
confidence: .87
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
keywords: [
|
|
518
|
+
"message",
|
|
519
|
+
"comment",
|
|
520
|
+
"feedback",
|
|
521
|
+
"note",
|
|
522
|
+
"notes",
|
|
523
|
+
"remarks",
|
|
524
|
+
"body"
|
|
525
|
+
],
|
|
526
|
+
type: "textarea",
|
|
527
|
+
validations: [{
|
|
528
|
+
rule: "minLength",
|
|
529
|
+
value: 10,
|
|
530
|
+
message: "Message too short"
|
|
531
|
+
}, {
|
|
532
|
+
rule: "maxLength",
|
|
533
|
+
value: 2e3,
|
|
534
|
+
message: "Message too long"
|
|
535
|
+
}],
|
|
536
|
+
placeholder: "Write your message here...",
|
|
537
|
+
label: "Message",
|
|
538
|
+
confidence: .86
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
keywords: [
|
|
542
|
+
"search",
|
|
543
|
+
"query",
|
|
544
|
+
"q",
|
|
545
|
+
"keyword",
|
|
546
|
+
"find"
|
|
547
|
+
],
|
|
548
|
+
type: "search",
|
|
549
|
+
validations: [],
|
|
550
|
+
placeholder: "Search...",
|
|
551
|
+
label: "Search",
|
|
552
|
+
confidence: .9
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
keywords: [
|
|
556
|
+
"otp",
|
|
557
|
+
"one_time_password",
|
|
558
|
+
"verification_code",
|
|
559
|
+
"pin",
|
|
560
|
+
"code"
|
|
561
|
+
],
|
|
562
|
+
type: "text",
|
|
563
|
+
validations: [
|
|
564
|
+
{
|
|
565
|
+
rule: "minLength",
|
|
566
|
+
value: 4,
|
|
567
|
+
message: "Code too short"
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
rule: "maxLength",
|
|
571
|
+
value: 8,
|
|
572
|
+
message: "Code too long"
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
rule: "pattern",
|
|
576
|
+
value: "^[0-9]+$",
|
|
577
|
+
message: "Code must be numeric"
|
|
578
|
+
}
|
|
579
|
+
],
|
|
580
|
+
placeholder: "123456",
|
|
581
|
+
label: "Verification Code",
|
|
582
|
+
confidence: .92
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
keywords: [
|
|
586
|
+
"color",
|
|
587
|
+
"colour",
|
|
588
|
+
"hex_color",
|
|
589
|
+
"brand_color"
|
|
590
|
+
],
|
|
591
|
+
type: "color",
|
|
592
|
+
validations: [],
|
|
593
|
+
placeholder: "#3b82f6",
|
|
594
|
+
label: "Color",
|
|
595
|
+
confidence: .95
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
keywords: [
|
|
599
|
+
"address",
|
|
600
|
+
"street",
|
|
601
|
+
"street_address",
|
|
602
|
+
"addr"
|
|
603
|
+
],
|
|
604
|
+
type: "text",
|
|
605
|
+
validations: [{
|
|
606
|
+
rule: "maxLength",
|
|
607
|
+
value: 200,
|
|
608
|
+
message: "Address too long"
|
|
609
|
+
}],
|
|
610
|
+
placeholder: "123 Main Street",
|
|
611
|
+
label: "Street Address",
|
|
612
|
+
confidence: .87
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
keywords: [
|
|
616
|
+
"city",
|
|
617
|
+
"town",
|
|
618
|
+
"municipality"
|
|
619
|
+
],
|
|
620
|
+
type: "text",
|
|
621
|
+
validations: [{
|
|
622
|
+
rule: "maxLength",
|
|
623
|
+
value: 100,
|
|
624
|
+
message: "City name too long"
|
|
625
|
+
}],
|
|
626
|
+
placeholder: "San Francisco",
|
|
627
|
+
label: "City",
|
|
628
|
+
confidence: .89
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
keywords: [
|
|
632
|
+
"country",
|
|
633
|
+
"nation",
|
|
634
|
+
"country_code"
|
|
635
|
+
],
|
|
636
|
+
type: "text",
|
|
637
|
+
validations: [],
|
|
638
|
+
placeholder: "United States",
|
|
639
|
+
label: "Country",
|
|
640
|
+
confidence: .88
|
|
641
|
+
},
|
|
642
|
+
{
|
|
643
|
+
keywords: [
|
|
644
|
+
"company",
|
|
645
|
+
"organization",
|
|
646
|
+
"org",
|
|
647
|
+
"employer",
|
|
648
|
+
"company_name"
|
|
649
|
+
],
|
|
650
|
+
type: "text",
|
|
651
|
+
validations: [{
|
|
652
|
+
rule: "maxLength",
|
|
653
|
+
value: 200,
|
|
654
|
+
message: "Company name too long"
|
|
655
|
+
}],
|
|
656
|
+
placeholder: "Acme Inc.",
|
|
657
|
+
label: "Company",
|
|
658
|
+
confidence: .87
|
|
659
|
+
}
|
|
507
660
|
];
|
|
508
|
-
function
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
};
|
|
661
|
+
function v(e) {
|
|
662
|
+
let t = e.toLowerCase().replace(/[\s-]/g, "_"), n = new g().amplify(_, (e) => {
|
|
663
|
+
let n = 0;
|
|
664
|
+
for (let r of e.keywords) t === r ? n = Math.max(n, 1) : t.includes(r) || r.includes(t) ? n = Math.max(n, .8) : r.split("_").some((e) => t.includes(e)) && (n = Math.max(n, .5));
|
|
665
|
+
return n;
|
|
666
|
+
}, .3);
|
|
667
|
+
if (n.length > 0 && n[0].combined > .1) {
|
|
668
|
+
let e = _[n[0].index];
|
|
669
|
+
return {
|
|
670
|
+
type: e.type,
|
|
671
|
+
validations: e.validations,
|
|
672
|
+
placeholder: e.placeholder,
|
|
673
|
+
confidence: Math.min(e.confidence * n[0].combined * 2, .99),
|
|
674
|
+
label: e.label
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
return {
|
|
678
|
+
type: "text",
|
|
679
|
+
validations: [{
|
|
680
|
+
rule: "maxLength",
|
|
681
|
+
value: 255,
|
|
682
|
+
message: "Input too long"
|
|
683
|
+
}],
|
|
684
|
+
placeholder: e.replace(/_/g, " "),
|
|
685
|
+
confidence: .3,
|
|
686
|
+
label: e.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase())
|
|
687
|
+
};
|
|
536
688
|
}
|
|
537
|
-
function
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
689
|
+
function y(e, t, n) {
|
|
690
|
+
let r = t / 100, i = n / 100, a = r * Math.min(i, 1 - i), o = (t) => {
|
|
691
|
+
let n = (t + e / 30) % 12, r = i - a * Math.max(Math.min(n - 3, 9 - n, 1), -1);
|
|
692
|
+
return Math.round(255 * r).toString(16).padStart(2, "0");
|
|
693
|
+
};
|
|
694
|
+
return `#${o(0)}${o(8)}${o(4)}`;
|
|
543
695
|
}
|
|
544
|
-
function
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
696
|
+
function b(e) {
|
|
697
|
+
let t = e.replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t;
|
|
698
|
+
return [
|
|
699
|
+
parseInt(n.slice(0, 2), 16),
|
|
700
|
+
parseInt(n.slice(2, 4), 16),
|
|
701
|
+
parseInt(n.slice(4, 6), 16)
|
|
702
|
+
];
|
|
551
703
|
}
|
|
552
|
-
function
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
704
|
+
function x(e) {
|
|
705
|
+
let [t, n, r] = b(e).map((e) => {
|
|
706
|
+
let t = e / 255;
|
|
707
|
+
return t <= .03928 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
|
|
708
|
+
});
|
|
709
|
+
return .2126 * t + .7152 * n + .0722 * r;
|
|
558
710
|
}
|
|
559
|
-
function
|
|
560
|
-
|
|
561
|
-
|
|
711
|
+
function S(e, t) {
|
|
712
|
+
let n = x(e), r = x(t), i = Math.max(n, r), a = Math.min(n, r);
|
|
713
|
+
return (i + .05) / (a + .05);
|
|
562
714
|
}
|
|
563
|
-
function
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
warning: e ? "#fbbf24" : "#d97706",
|
|
579
|
-
success: e ? "#34d399" : "#059669",
|
|
580
|
-
accent: n(r.accent)
|
|
581
|
-
};
|
|
715
|
+
function C(e, t) {
|
|
716
|
+
let n = (e) => y(e.h, e.s, e.l), r = t ? e.text.l - 20 : e.text.l + 15;
|
|
717
|
+
return {
|
|
718
|
+
primary: n(e.primary),
|
|
719
|
+
secondary: n(e.secondary),
|
|
720
|
+
background: n(e.bg),
|
|
721
|
+
surface: n(e.surface),
|
|
722
|
+
text: n(e.text),
|
|
723
|
+
textMuted: y(e.text.h, Math.max(0, e.text.s - 10), Math.max(20, Math.min(85, r))),
|
|
724
|
+
border: n(e.border),
|
|
725
|
+
error: t ? "#f87171" : "#dc2626",
|
|
726
|
+
warning: t ? "#fbbf24" : "#d97706",
|
|
727
|
+
success: t ? "#34d399" : "#059669",
|
|
728
|
+
accent: n(e.accent)
|
|
729
|
+
};
|
|
582
730
|
}
|
|
583
|
-
function
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
return C < 2 && (n += (2 - C) * 2), C > 12 && (n += (C - 12) * 1), n;
|
|
731
|
+
function w(e, t) {
|
|
732
|
+
let n = 0, r = (e) => y(e.h, e.s, e.l), i = r(e.text), a = r(e.bg), o = r(e.surface), s = r(e.primary), c = S(i, a), l = S(i, o), u = S(s, a);
|
|
733
|
+
c < 4.5 && (n += (4.5 - c) * 10), l < 4.5 && (n += (4.5 - l) * 8), u < 3 && (n += (3 - u) * 5);
|
|
734
|
+
let d = Math.abs((e.secondary.h - e.primary.h + 360) % 360 - 137.508);
|
|
735
|
+
n += d * .05;
|
|
736
|
+
let f = Math.abs((e.accent.h - e.primary.h + 360) % 360 - 120);
|
|
737
|
+
n += f * .03;
|
|
738
|
+
let p = (e.primary.s + e.secondary.s) / 2;
|
|
739
|
+
p < 20 && (n += (20 - p) * .5), p > 90 && (n += (p - 90) * .5);
|
|
740
|
+
let m = e.bg.l;
|
|
741
|
+
t ? (m > 25 && (n += (m - 25) * 2), m < 3 && (n += (3 - m) * 2), e.text.l < 70 && (n += (70 - e.text.l) * 1.5)) : (m < 90 && (n += (90 - m) * 2), m > 100 && (n += (m - 100) * 2), e.text.l > 30 && (n += (e.text.l - 30) * 1.5));
|
|
742
|
+
let h = Math.abs(e.surface.l - e.bg.l);
|
|
743
|
+
return h < 2 && (n += (2 - h) * 2), h > 12 && (n += (h - 12) * 1), n;
|
|
597
744
|
}
|
|
598
|
-
function
|
|
599
|
-
|
|
745
|
+
function T(e, t, n) {
|
|
746
|
+
return Math.max(t, Math.min(n, e));
|
|
600
747
|
}
|
|
601
|
-
function
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
748
|
+
function E(e, t, n = 800) {
|
|
749
|
+
let r = t ? {
|
|
750
|
+
primary: {
|
|
751
|
+
h: e,
|
|
752
|
+
s: 70,
|
|
753
|
+
l: 55
|
|
754
|
+
},
|
|
755
|
+
secondary: {
|
|
756
|
+
h: (e + 137.5) % 360,
|
|
757
|
+
s: 65,
|
|
758
|
+
l: 50
|
|
759
|
+
},
|
|
760
|
+
bg: {
|
|
761
|
+
h: e,
|
|
762
|
+
s: 10,
|
|
763
|
+
l: 8
|
|
764
|
+
},
|
|
765
|
+
surface: {
|
|
766
|
+
h: e,
|
|
767
|
+
s: 10,
|
|
768
|
+
l: 13
|
|
769
|
+
},
|
|
770
|
+
text: {
|
|
771
|
+
h: e,
|
|
772
|
+
s: 15,
|
|
773
|
+
l: 90
|
|
774
|
+
},
|
|
775
|
+
border: {
|
|
776
|
+
h: e,
|
|
777
|
+
s: 15,
|
|
778
|
+
l: 22
|
|
779
|
+
},
|
|
780
|
+
accent: {
|
|
781
|
+
h: (e + 120) % 360,
|
|
782
|
+
s: 75,
|
|
783
|
+
l: 60
|
|
784
|
+
}
|
|
785
|
+
} : {
|
|
786
|
+
primary: {
|
|
787
|
+
h: e,
|
|
788
|
+
s: 65,
|
|
789
|
+
l: 40
|
|
790
|
+
},
|
|
791
|
+
secondary: {
|
|
792
|
+
h: (e + 137.5) % 360,
|
|
793
|
+
s: 55,
|
|
794
|
+
l: 38
|
|
795
|
+
},
|
|
796
|
+
bg: {
|
|
797
|
+
h: e,
|
|
798
|
+
s: 15,
|
|
799
|
+
l: 97
|
|
800
|
+
},
|
|
801
|
+
surface: {
|
|
802
|
+
h: e,
|
|
803
|
+
s: 12,
|
|
804
|
+
l: 100
|
|
805
|
+
},
|
|
806
|
+
text: {
|
|
807
|
+
h: e,
|
|
808
|
+
s: 15,
|
|
809
|
+
l: 12
|
|
810
|
+
},
|
|
811
|
+
border: {
|
|
812
|
+
h: e,
|
|
813
|
+
s: 12,
|
|
814
|
+
l: 85
|
|
815
|
+
},
|
|
816
|
+
accent: {
|
|
817
|
+
h: (e + 120) % 360,
|
|
818
|
+
s: 70,
|
|
819
|
+
l: 42
|
|
820
|
+
}
|
|
821
|
+
};
|
|
822
|
+
return C(new m(1.5, .994, .35, 1e-5).anneal(r, (e) => w(e, t), (e) => {
|
|
823
|
+
let t = [
|
|
824
|
+
"primary",
|
|
825
|
+
"secondary",
|
|
826
|
+
"bg",
|
|
827
|
+
"surface",
|
|
828
|
+
"text",
|
|
829
|
+
"border",
|
|
830
|
+
"accent"
|
|
831
|
+
], n = t[Math.floor(Math.random() * t.length)], r = [
|
|
832
|
+
"h",
|
|
833
|
+
"s",
|
|
834
|
+
"l"
|
|
835
|
+
], i = r[Math.floor(Math.random() * r.length)], a = (Math.random() - .5) * (i === "h" ? 30 : 15), o = {
|
|
836
|
+
...e,
|
|
837
|
+
[n]: { ...e[n] }
|
|
838
|
+
};
|
|
839
|
+
return i === "h" ? o[n] = {
|
|
840
|
+
...o[n],
|
|
841
|
+
h: (e[n].h + a + 360) % 360
|
|
842
|
+
} : i === "s" ? o[n] = {
|
|
843
|
+
...o[n],
|
|
844
|
+
s: T(e[n].s + a, 0, 100)
|
|
845
|
+
} : o[n] = {
|
|
846
|
+
...o[n],
|
|
847
|
+
l: T(e[n].l + a, 0, 100)
|
|
848
|
+
}, o;
|
|
849
|
+
}, n).state, t);
|
|
631
850
|
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
},
|
|
653
|
-
/** Infer field intelligence from a field name */
|
|
654
|
-
inferField: ce,
|
|
655
|
-
/** Optimize theme colors using quantum annealing */
|
|
656
|
-
optimizeTheme: ye,
|
|
657
|
-
/** Compute WCAG contrast ratio between two hex colors */
|
|
658
|
-
contrast: U,
|
|
659
|
-
/** Convert HSL to hex */
|
|
660
|
-
hslToHex: G
|
|
851
|
+
var D = {
|
|
852
|
+
qubit() {
|
|
853
|
+
return new f();
|
|
854
|
+
},
|
|
855
|
+
register(e) {
|
|
856
|
+
return new p(e);
|
|
857
|
+
},
|
|
858
|
+
annealer(e, t, n) {
|
|
859
|
+
return new m(e, t, n);
|
|
860
|
+
},
|
|
861
|
+
qbm(e, t) {
|
|
862
|
+
return new h(e, t);
|
|
863
|
+
},
|
|
864
|
+
amplifier() {
|
|
865
|
+
return new g();
|
|
866
|
+
},
|
|
867
|
+
inferField: v,
|
|
868
|
+
optimizeTheme: E,
|
|
869
|
+
contrast: S,
|
|
870
|
+
hslToHex: y
|
|
661
871
|
};
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
return t === "" || /^[a-zA-Z0-9]+$/.test(t);
|
|
694
|
-
case "match":
|
|
695
|
-
return t === (i[typeof e == "string" ? e : "password"] ?? "");
|
|
696
|
-
default:
|
|
697
|
-
return !0;
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
function be({ phase: r, collapsed: e, primaryColor: n, borderColor: i }) {
|
|
701
|
-
const d = e ? 0 : r, o = e ? 0 : r * 1.618, p = 12 + 10 * Math.sin(d) * Math.cos(o), f = 12 - 10 * Math.cos(d);
|
|
702
|
-
return /* @__PURE__ */ c(
|
|
703
|
-
"svg",
|
|
704
|
-
{
|
|
705
|
-
width: "24",
|
|
706
|
-
height: "24",
|
|
707
|
-
viewBox: "0 0 24 24",
|
|
708
|
-
"aria-hidden": "true",
|
|
709
|
-
style: { flexShrink: 0, opacity: e ? 0.4 : 1, transition: "opacity 0.6s" },
|
|
710
|
-
children: [
|
|
711
|
-
/* @__PURE__ */ a("circle", { cx: 12, cy: 12, r: 10, fill: "none", stroke: i, strokeWidth: "0.8" }),
|
|
712
|
-
/* @__PURE__ */ a("ellipse", { cx: 12, cy: 12, rx: 10, ry: 10 * 0.3, fill: "none", stroke: i, strokeWidth: "0.5", strokeDasharray: "2 2" }),
|
|
713
|
-
/* @__PURE__ */ a("line", { x1: 12, y1: 2, x2: 12, y2: 22, stroke: i, strokeWidth: "0.5" }),
|
|
714
|
-
/* @__PURE__ */ a(
|
|
715
|
-
"line",
|
|
716
|
-
{
|
|
717
|
-
x1: 12,
|
|
718
|
-
y1: 12,
|
|
719
|
-
x2: p,
|
|
720
|
-
y2: f,
|
|
721
|
-
stroke: n,
|
|
722
|
-
strokeWidth: "1.5",
|
|
723
|
-
style: { transition: e ? "all 0.6s ease-out" : "none" }
|
|
724
|
-
}
|
|
725
|
-
),
|
|
726
|
-
/* @__PURE__ */ a(
|
|
727
|
-
"circle",
|
|
728
|
-
{
|
|
729
|
-
cx: p,
|
|
730
|
-
cy: f,
|
|
731
|
-
r: "2",
|
|
732
|
-
fill: n,
|
|
733
|
-
style: { transition: e ? "all 0.6s ease-out" : "none" }
|
|
734
|
-
}
|
|
735
|
-
)
|
|
736
|
-
]
|
|
737
|
-
}
|
|
738
|
-
);
|
|
872
|
+
//#endregion
|
|
873
|
+
//#region src/components/TkxQuantumForm.tsx
|
|
874
|
+
function O(e, t, n, r) {
|
|
875
|
+
let i = n.trim();
|
|
876
|
+
switch (e) {
|
|
877
|
+
case "required": return i !== "";
|
|
878
|
+
case "email":
|
|
879
|
+
case "pattern":
|
|
880
|
+
if (typeof t == "string") try {
|
|
881
|
+
return i === "" || new RegExp(t).test(i);
|
|
882
|
+
} catch {
|
|
883
|
+
return !0;
|
|
884
|
+
}
|
|
885
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i);
|
|
886
|
+
case "phone": return i === "" || /^\+?[\d\s\-()]{7,15}$/.test(i);
|
|
887
|
+
case "url": return i === "" || /^https?:\/\/.+/.test(i);
|
|
888
|
+
case "minLength":
|
|
889
|
+
case "min": {
|
|
890
|
+
let e = Number(t ?? 0);
|
|
891
|
+
return i === "" || (isNaN(Number(i)) ? i.length >= e : Number(i) >= e);
|
|
892
|
+
}
|
|
893
|
+
case "maxLength":
|
|
894
|
+
case "max": {
|
|
895
|
+
let e = Number(t ?? Infinity);
|
|
896
|
+
return i === "" || (isNaN(Number(i)) ? i.length <= e : Number(i) <= e);
|
|
897
|
+
}
|
|
898
|
+
case "integer": return i === "" || /^\d+$/.test(i);
|
|
899
|
+
case "alphanumeric": return i === "" || /^[a-zA-Z0-9]+$/.test(i);
|
|
900
|
+
case "match": return i === (r[typeof t == "string" ? t : "password"] ?? "");
|
|
901
|
+
default: return !0;
|
|
902
|
+
}
|
|
739
903
|
}
|
|
740
|
-
function
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
904
|
+
function k({ phase: e, collapsed: t, primaryColor: n, borderColor: r }) {
|
|
905
|
+
let i = t ? 0 : e, a = t ? 0 : e * 1.618, o = 12 + 10 * Math.sin(i) * Math.cos(a), s = 12 - 10 * Math.cos(i);
|
|
906
|
+
return /* @__PURE__ */ u("svg", {
|
|
907
|
+
width: "24",
|
|
908
|
+
height: "24",
|
|
909
|
+
viewBox: "0 0 24 24",
|
|
910
|
+
"aria-hidden": "true",
|
|
911
|
+
style: {
|
|
912
|
+
flexShrink: 0,
|
|
913
|
+
opacity: t ? .4 : 1,
|
|
914
|
+
transition: "opacity 0.6s"
|
|
915
|
+
},
|
|
916
|
+
children: [
|
|
917
|
+
/* @__PURE__ */ l("circle", {
|
|
918
|
+
cx: 12,
|
|
919
|
+
cy: 12,
|
|
920
|
+
r: 10,
|
|
921
|
+
fill: "none",
|
|
922
|
+
stroke: r,
|
|
923
|
+
strokeWidth: "0.8"
|
|
924
|
+
}),
|
|
925
|
+
/* @__PURE__ */ l("ellipse", {
|
|
926
|
+
cx: 12,
|
|
927
|
+
cy: 12,
|
|
928
|
+
rx: 10,
|
|
929
|
+
ry: 10 * .3,
|
|
930
|
+
fill: "none",
|
|
931
|
+
stroke: r,
|
|
932
|
+
strokeWidth: "0.5",
|
|
933
|
+
strokeDasharray: "2 2"
|
|
934
|
+
}),
|
|
935
|
+
/* @__PURE__ */ l("line", {
|
|
936
|
+
x1: 12,
|
|
937
|
+
y1: 2,
|
|
938
|
+
x2: 12,
|
|
939
|
+
y2: 22,
|
|
940
|
+
stroke: r,
|
|
941
|
+
strokeWidth: "0.5"
|
|
942
|
+
}),
|
|
943
|
+
/* @__PURE__ */ l("line", {
|
|
944
|
+
x1: 12,
|
|
945
|
+
y1: 12,
|
|
946
|
+
x2: o,
|
|
947
|
+
y2: s,
|
|
948
|
+
stroke: n,
|
|
949
|
+
strokeWidth: "1.5",
|
|
950
|
+
style: { transition: t ? "all 0.6s ease-out" : "none" }
|
|
951
|
+
}),
|
|
952
|
+
/* @__PURE__ */ l("circle", {
|
|
953
|
+
cx: o,
|
|
954
|
+
cy: s,
|
|
955
|
+
r: "2",
|
|
956
|
+
fill: n,
|
|
957
|
+
style: { transition: t ? "all 0.6s ease-out" : "none" }
|
|
958
|
+
})
|
|
959
|
+
]
|
|
960
|
+
});
|
|
770
961
|
}
|
|
771
|
-
function
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
fontFamily: "inherit",
|
|
796
|
-
outline: "none",
|
|
797
|
-
boxSizing: "border-box",
|
|
798
|
-
transition: "border-color 0.15s, box-shadow 0.15s",
|
|
799
|
-
resize: F ? "vertical" : void 0,
|
|
800
|
-
minHeight: F ? "80px" : void 0
|
|
801
|
-
};
|
|
802
|
-
return /* @__PURE__ */ c(
|
|
803
|
-
"div",
|
|
804
|
-
{
|
|
805
|
-
style: {
|
|
806
|
-
display: "flex",
|
|
807
|
-
flexDirection: "column",
|
|
808
|
-
gap: "4px",
|
|
809
|
-
opacity: g ? 1 : 0,
|
|
810
|
-
transform: g ? "scaleY(1)" : "scaleY(0.92)",
|
|
811
|
-
transition: `opacity 0.35s ease ${b * 60}ms, transform 0.35s ease ${b * 60}ms`,
|
|
812
|
-
transformOrigin: "top"
|
|
813
|
-
},
|
|
814
|
-
children: [
|
|
815
|
-
/* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
816
|
-
d && /* @__PURE__ */ a(
|
|
817
|
-
be,
|
|
818
|
-
{
|
|
819
|
-
phase: n,
|
|
820
|
-
collapsed: o,
|
|
821
|
-
primaryColor: m.primary,
|
|
822
|
-
borderColor: m.border
|
|
823
|
-
}
|
|
824
|
-
),
|
|
825
|
-
/* @__PURE__ */ c(
|
|
826
|
-
"label",
|
|
827
|
-
{
|
|
828
|
-
htmlFor: $,
|
|
829
|
-
style: { fontSize: "13px", fontWeight: 500, color: m.text, cursor: "pointer" },
|
|
830
|
-
children: [
|
|
831
|
-
P,
|
|
832
|
-
k && /* @__PURE__ */ a("span", { "aria-hidden": "true", style: { color: m.danger, marginLeft: "3px" }, children: "*" })
|
|
833
|
-
]
|
|
834
|
-
}
|
|
835
|
-
),
|
|
836
|
-
s && /* @__PURE__ */ a(ve, { confidence: e.confidence, theme: m })
|
|
837
|
-
] }),
|
|
838
|
-
F ? /* @__PURE__ */ a(
|
|
839
|
-
"textarea",
|
|
840
|
-
{
|
|
841
|
-
id: $,
|
|
842
|
-
value: i,
|
|
843
|
-
onChange: (L) => p(L.target.value),
|
|
844
|
-
onBlur: f,
|
|
845
|
-
placeholder: C,
|
|
846
|
-
"aria-invalid": w,
|
|
847
|
-
"aria-required": k,
|
|
848
|
-
style: q
|
|
849
|
-
}
|
|
850
|
-
) : /* @__PURE__ */ a(
|
|
851
|
-
"input",
|
|
852
|
-
{
|
|
853
|
-
id: $,
|
|
854
|
-
type: h,
|
|
855
|
-
value: i,
|
|
856
|
-
onChange: (L) => p(L.target.value),
|
|
857
|
-
onBlur: f,
|
|
858
|
-
placeholder: C,
|
|
859
|
-
"aria-invalid": w,
|
|
860
|
-
"aria-required": k,
|
|
861
|
-
style: q
|
|
862
|
-
}
|
|
863
|
-
),
|
|
864
|
-
w && /* @__PURE__ */ c(
|
|
865
|
-
"span",
|
|
866
|
-
{
|
|
867
|
-
role: "alert",
|
|
868
|
-
style: {
|
|
869
|
-
fontSize: "12px",
|
|
870
|
-
color: m.danger,
|
|
871
|
-
display: "flex",
|
|
872
|
-
alignItems: "center",
|
|
873
|
-
gap: "4px"
|
|
874
|
-
},
|
|
875
|
-
children: [
|
|
876
|
-
/* @__PURE__ */ a("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ a("path", { d: "M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }) }),
|
|
877
|
-
J(t)
|
|
878
|
-
]
|
|
879
|
-
}
|
|
880
|
-
)
|
|
881
|
-
]
|
|
882
|
-
}
|
|
883
|
-
);
|
|
962
|
+
function A({ confidence: e, theme: t }) {
|
|
963
|
+
let n = Math.round(e * 100), r = n >= 80 ? t.success : n >= 60 ? t.warning : t.danger;
|
|
964
|
+
return /* @__PURE__ */ u("span", {
|
|
965
|
+
style: {
|
|
966
|
+
display: "inline-flex",
|
|
967
|
+
alignItems: "center",
|
|
968
|
+
gap: "2px",
|
|
969
|
+
fontSize: "10px",
|
|
970
|
+
fontWeight: 600,
|
|
971
|
+
padding: "1px 5px",
|
|
972
|
+
borderRadius: "999px",
|
|
973
|
+
backgroundColor: `${r}22`,
|
|
974
|
+
color: r,
|
|
975
|
+
border: `1px solid ${r}44`,
|
|
976
|
+
marginLeft: "6px",
|
|
977
|
+
verticalAlign: "middle",
|
|
978
|
+
letterSpacing: "0.03em"
|
|
979
|
+
},
|
|
980
|
+
children: [
|
|
981
|
+
"⚛ ",
|
|
982
|
+
n,
|
|
983
|
+
"%"
|
|
984
|
+
]
|
|
985
|
+
});
|
|
884
986
|
}
|
|
885
|
-
function
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
987
|
+
function j({ config: e, intel: t, qubitPhase: r, value: i, error: a, touched: o, showConfidence: s, showQuantumState: c, collapsed: d, onChange: f, onBlur: p, theme: m, mounted: h, index: g }) {
|
|
988
|
+
let _ = e.type ?? t.type, v = e.label ?? t.label, y = e.placeholder ?? t.placeholder, b = e.required === void 0 ? t.validations.some((e) => e.rule === "required") : e.required, x = n(v), S = _ === "textarea", C = o && a !== "", w = `qf-${e.name}`, T = {
|
|
989
|
+
width: "100%",
|
|
990
|
+
padding: "9px 12px",
|
|
991
|
+
border: `1.5px solid ${C ? m.danger : m.border}`,
|
|
992
|
+
borderRadius: "8px",
|
|
993
|
+
backgroundColor: m.surface,
|
|
994
|
+
color: m.text,
|
|
995
|
+
fontSize: "14px",
|
|
996
|
+
fontFamily: "inherit",
|
|
997
|
+
outline: "none",
|
|
998
|
+
boxSizing: "border-box",
|
|
999
|
+
transition: "border-color 0.15s, box-shadow 0.15s",
|
|
1000
|
+
resize: S ? "vertical" : void 0,
|
|
1001
|
+
minHeight: S ? "80px" : void 0
|
|
1002
|
+
};
|
|
1003
|
+
return /* @__PURE__ */ u("div", {
|
|
1004
|
+
style: {
|
|
1005
|
+
display: "flex",
|
|
1006
|
+
flexDirection: "column",
|
|
1007
|
+
gap: "4px",
|
|
1008
|
+
opacity: +!!h,
|
|
1009
|
+
transform: h ? "scaleY(1)" : "scaleY(0.92)",
|
|
1010
|
+
transition: `opacity 0.35s ease ${g * 60}ms, transform 0.35s ease ${g * 60}ms`,
|
|
1011
|
+
transformOrigin: "top"
|
|
1012
|
+
},
|
|
1013
|
+
children: [
|
|
1014
|
+
/* @__PURE__ */ u("div", {
|
|
1015
|
+
style: {
|
|
1016
|
+
display: "flex",
|
|
1017
|
+
alignItems: "center",
|
|
1018
|
+
gap: "4px"
|
|
1019
|
+
},
|
|
1020
|
+
children: [
|
|
1021
|
+
c && /* @__PURE__ */ l(k, {
|
|
1022
|
+
phase: r,
|
|
1023
|
+
collapsed: d,
|
|
1024
|
+
primaryColor: m.primary,
|
|
1025
|
+
borderColor: m.border
|
|
1026
|
+
}),
|
|
1027
|
+
/* @__PURE__ */ u("label", {
|
|
1028
|
+
htmlFor: w,
|
|
1029
|
+
style: {
|
|
1030
|
+
fontSize: "13px",
|
|
1031
|
+
fontWeight: 500,
|
|
1032
|
+
color: m.text,
|
|
1033
|
+
cursor: "pointer"
|
|
1034
|
+
},
|
|
1035
|
+
children: [x, b && /* @__PURE__ */ l("span", {
|
|
1036
|
+
"aria-hidden": "true",
|
|
1037
|
+
style: {
|
|
1038
|
+
color: m.danger,
|
|
1039
|
+
marginLeft: "3px"
|
|
1040
|
+
},
|
|
1041
|
+
children: "*"
|
|
1042
|
+
})]
|
|
1043
|
+
}),
|
|
1044
|
+
s && /* @__PURE__ */ l(A, {
|
|
1045
|
+
confidence: t.confidence,
|
|
1046
|
+
theme: m
|
|
1047
|
+
})
|
|
1048
|
+
]
|
|
1049
|
+
}),
|
|
1050
|
+
S ? /* @__PURE__ */ l("textarea", {
|
|
1051
|
+
id: w,
|
|
1052
|
+
value: i,
|
|
1053
|
+
onChange: (e) => f(e.target.value),
|
|
1054
|
+
onBlur: p,
|
|
1055
|
+
placeholder: y,
|
|
1056
|
+
"aria-invalid": C,
|
|
1057
|
+
"aria-required": b,
|
|
1058
|
+
style: T
|
|
1059
|
+
}) : /* @__PURE__ */ l("input", {
|
|
1060
|
+
id: w,
|
|
1061
|
+
type: _,
|
|
1062
|
+
value: i,
|
|
1063
|
+
onChange: (e) => f(e.target.value),
|
|
1064
|
+
onBlur: p,
|
|
1065
|
+
placeholder: y,
|
|
1066
|
+
"aria-invalid": C,
|
|
1067
|
+
"aria-required": b,
|
|
1068
|
+
style: T
|
|
1069
|
+
}),
|
|
1070
|
+
C && /* @__PURE__ */ u("span", {
|
|
1071
|
+
role: "alert",
|
|
1072
|
+
style: {
|
|
1073
|
+
fontSize: "12px",
|
|
1074
|
+
color: m.danger,
|
|
1075
|
+
display: "flex",
|
|
1076
|
+
alignItems: "center",
|
|
1077
|
+
gap: "4px"
|
|
1078
|
+
},
|
|
1079
|
+
children: [/* @__PURE__ */ l("svg", {
|
|
1080
|
+
width: "12",
|
|
1081
|
+
height: "12",
|
|
1082
|
+
viewBox: "0 0 24 24",
|
|
1083
|
+
fill: "currentColor",
|
|
1084
|
+
"aria-hidden": "true",
|
|
1085
|
+
children: /* @__PURE__ */ l("path", { d: "M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" })
|
|
1086
|
+
}), n(a)]
|
|
1087
|
+
})
|
|
1088
|
+
]
|
|
1089
|
+
});
|
|
890
1090
|
}
|
|
891
|
-
function
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
layout: i = "vertical",
|
|
896
|
-
showConfidence: t = !0,
|
|
897
|
-
showQuantumState: l = !1
|
|
898
|
-
}) {
|
|
899
|
-
const s = K(), d = r.map((y) => ce(y.name)), [o, p] = A(
|
|
900
|
-
() => Object.fromEntries(r.map((y) => [y.name, ""]))
|
|
901
|
-
), [f, m] = A({}), [g, b] = A({}), [h, v] = A(!1), [C, k] = A(!1), [P, F] = A(!1);
|
|
902
|
-
V(() => {
|
|
903
|
-
const y = requestAnimationFrame(() => k(!0));
|
|
904
|
-
return () => cancelAnimationFrame(y);
|
|
905
|
-
}, []);
|
|
906
|
-
const w = R(
|
|
907
|
-
(y, u) => {
|
|
908
|
-
const x = r.find((z) => z.name === y), M = d[r.findIndex((z) => z.name === y)];
|
|
909
|
-
if (!x || !M) return "";
|
|
910
|
-
const S = u[y] ?? "";
|
|
911
|
-
for (const { rule: z, value: N, message: O } of M.validations)
|
|
912
|
-
if (!(z === "required" && x.required === !1) && !xe(z, N, S, u))
|
|
913
|
-
return O;
|
|
914
|
-
return "";
|
|
915
|
-
},
|
|
916
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
917
|
-
[r]
|
|
918
|
-
), $ = R(
|
|
919
|
-
(y) => {
|
|
920
|
-
const u = {};
|
|
921
|
-
for (const x of r) {
|
|
922
|
-
const M = w(x.name, y);
|
|
923
|
-
M && (u[x.name] = M);
|
|
924
|
-
}
|
|
925
|
-
return u;
|
|
926
|
-
},
|
|
927
|
-
[r, w]
|
|
928
|
-
), q = R(
|
|
929
|
-
(y, u) => {
|
|
930
|
-
p((x) => {
|
|
931
|
-
var S;
|
|
932
|
-
const M = { ...x, [y]: u };
|
|
933
|
-
if (g[y] && (m((z) => ({ ...z, [y]: w(y, M) })), y === "password")) {
|
|
934
|
-
const z = (S = r.find(
|
|
935
|
-
(N) => ["confirmpassword", "confirm_password", "passwordconfirm"].includes(
|
|
936
|
-
N.name.toLowerCase().replace(/[\s_-]/g, "")
|
|
937
|
-
)
|
|
938
|
-
)) == null ? void 0 : S.name;
|
|
939
|
-
z && g[z] && m((N) => ({ ...N, [z]: w(z, M) }));
|
|
940
|
-
}
|
|
941
|
-
return M;
|
|
942
|
-
}), F(!0);
|
|
943
|
-
},
|
|
944
|
-
[r, g, w]
|
|
945
|
-
), L = R(
|
|
946
|
-
(y) => {
|
|
947
|
-
b((u) => ({ ...u, [y]: !0 })), m((u) => ({ ...u, [y]: w(y, o) }));
|
|
948
|
-
},
|
|
949
|
-
[o, w]
|
|
950
|
-
), D = R(
|
|
951
|
-
async (y) => {
|
|
952
|
-
y.preventDefault();
|
|
953
|
-
const u = Object.fromEntries(r.map((M) => [M.name, !0]));
|
|
954
|
-
b(u);
|
|
955
|
-
const x = $(o);
|
|
956
|
-
if (m(x), !(Object.keys(x).length > 0)) {
|
|
957
|
-
v(!0);
|
|
958
|
-
try {
|
|
959
|
-
await e(o);
|
|
960
|
-
} finally {
|
|
961
|
-
v(!1);
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
},
|
|
965
|
-
[r, o, $, e]
|
|
966
|
-
), E = d.length > 0 ? Math.round(
|
|
967
|
-
d.reduce((y, u) => y + u.confidence, 0) / d.length * 100
|
|
968
|
-
) : 0, I = E >= 80 ? s.success : E >= 60 ? s.warning : s.danger, j = i === "horizontal";
|
|
969
|
-
return /* @__PURE__ */ c(
|
|
970
|
-
"form",
|
|
971
|
-
{
|
|
972
|
-
onSubmit: D,
|
|
973
|
-
noValidate: !0,
|
|
974
|
-
className: le("w-full"),
|
|
975
|
-
style: {
|
|
976
|
-
backgroundColor: s.surface,
|
|
977
|
-
border: `1px solid ${s.border}`,
|
|
978
|
-
borderRadius: "12px",
|
|
979
|
-
padding: "24px",
|
|
980
|
-
position: "relative",
|
|
981
|
-
boxSizing: "border-box"
|
|
982
|
-
},
|
|
983
|
-
children: [
|
|
984
|
-
/* @__PURE__ */ a(
|
|
985
|
-
"span",
|
|
986
|
-
{
|
|
987
|
-
"aria-label": "Powered by Quantum AI",
|
|
988
|
-
style: {
|
|
989
|
-
position: "absolute",
|
|
990
|
-
top: "16px",
|
|
991
|
-
right: "16px",
|
|
992
|
-
fontSize: "10px",
|
|
993
|
-
fontWeight: 700,
|
|
994
|
-
padding: "3px 8px",
|
|
995
|
-
borderRadius: "999px",
|
|
996
|
-
backgroundColor: `${s.primary}20`,
|
|
997
|
-
color: s.primary,
|
|
998
|
-
border: `1px solid ${s.primary}44`,
|
|
999
|
-
letterSpacing: "0.04em",
|
|
1000
|
-
userSelect: "none"
|
|
1001
|
-
},
|
|
1002
|
-
children: "⚛ Quantum AI"
|
|
1003
|
-
}
|
|
1004
|
-
),
|
|
1005
|
-
t && /* @__PURE__ */ c("div", { style: { marginBottom: "20px", paddingRight: "100px" }, children: [
|
|
1006
|
-
/* @__PURE__ */ c(
|
|
1007
|
-
"div",
|
|
1008
|
-
{
|
|
1009
|
-
style: {
|
|
1010
|
-
display: "flex",
|
|
1011
|
-
alignItems: "center",
|
|
1012
|
-
justifyContent: "space-between",
|
|
1013
|
-
marginBottom: "4px"
|
|
1014
|
-
},
|
|
1015
|
-
children: [
|
|
1016
|
-
/* @__PURE__ */ a("span", { style: { fontSize: "11px", color: s.textMuted, fontWeight: 500 }, children: "Form Intelligence Confidence" }),
|
|
1017
|
-
/* @__PURE__ */ c("span", { style: { fontSize: "11px", fontWeight: 700, color: I }, children: [
|
|
1018
|
-
E,
|
|
1019
|
-
"%"
|
|
1020
|
-
] })
|
|
1021
|
-
]
|
|
1022
|
-
}
|
|
1023
|
-
),
|
|
1024
|
-
/* @__PURE__ */ a(
|
|
1025
|
-
"div",
|
|
1026
|
-
{
|
|
1027
|
-
style: {
|
|
1028
|
-
height: "4px",
|
|
1029
|
-
borderRadius: "4px",
|
|
1030
|
-
backgroundColor: s.border,
|
|
1031
|
-
overflow: "hidden"
|
|
1032
|
-
},
|
|
1033
|
-
children: /* @__PURE__ */ a(
|
|
1034
|
-
"div",
|
|
1035
|
-
{
|
|
1036
|
-
style: {
|
|
1037
|
-
height: "100%",
|
|
1038
|
-
width: `${E}%`,
|
|
1039
|
-
backgroundColor: I,
|
|
1040
|
-
borderRadius: "4px",
|
|
1041
|
-
transition: "width 0.8s ease"
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
)
|
|
1045
|
-
}
|
|
1046
|
-
)
|
|
1047
|
-
] }),
|
|
1048
|
-
/* @__PURE__ */ a(
|
|
1049
|
-
"div",
|
|
1050
|
-
{
|
|
1051
|
-
style: {
|
|
1052
|
-
display: "grid",
|
|
1053
|
-
gridTemplateColumns: j ? "repeat(auto-fill, minmax(260px, 1fr))" : "1fr",
|
|
1054
|
-
gap: "16px",
|
|
1055
|
-
marginBottom: "20px"
|
|
1056
|
-
},
|
|
1057
|
-
children: r.map((y, u) => /* @__PURE__ */ a(
|
|
1058
|
-
ke,
|
|
1059
|
-
{
|
|
1060
|
-
config: y,
|
|
1061
|
-
intel: d[u],
|
|
1062
|
-
qubitPhase: we(y.name),
|
|
1063
|
-
value: o[y.name] ?? "",
|
|
1064
|
-
error: f[y.name] ?? "",
|
|
1065
|
-
touched: g[y.name] ?? !1,
|
|
1066
|
-
showConfidence: t,
|
|
1067
|
-
showQuantumState: l,
|
|
1068
|
-
collapsed: P,
|
|
1069
|
-
onChange: (x) => q(y.name, x),
|
|
1070
|
-
onBlur: () => L(y.name),
|
|
1071
|
-
theme: s,
|
|
1072
|
-
mounted: C,
|
|
1073
|
-
index: u
|
|
1074
|
-
},
|
|
1075
|
-
y.name
|
|
1076
|
-
))
|
|
1077
|
-
}
|
|
1078
|
-
),
|
|
1079
|
-
/* @__PURE__ */ a(
|
|
1080
|
-
"button",
|
|
1081
|
-
{
|
|
1082
|
-
type: "submit",
|
|
1083
|
-
disabled: h,
|
|
1084
|
-
style: {
|
|
1085
|
-
width: "100%",
|
|
1086
|
-
padding: "10px 20px",
|
|
1087
|
-
borderRadius: "8px",
|
|
1088
|
-
border: "none",
|
|
1089
|
-
backgroundColor: h ? `${s.primary}88` : s.primary,
|
|
1090
|
-
color: s.bg,
|
|
1091
|
-
fontSize: "14px",
|
|
1092
|
-
fontWeight: 700,
|
|
1093
|
-
fontFamily: "inherit",
|
|
1094
|
-
cursor: h ? "not-allowed" : "pointer",
|
|
1095
|
-
transition: "background-color 0.15s, opacity 0.15s",
|
|
1096
|
-
display: "flex",
|
|
1097
|
-
alignItems: "center",
|
|
1098
|
-
justifyContent: "center",
|
|
1099
|
-
gap: "8px"
|
|
1100
|
-
},
|
|
1101
|
-
children: h ? /* @__PURE__ */ c(pe, { children: [
|
|
1102
|
-
/* @__PURE__ */ c(
|
|
1103
|
-
"svg",
|
|
1104
|
-
{
|
|
1105
|
-
width: "14",
|
|
1106
|
-
height: "14",
|
|
1107
|
-
viewBox: "0 0 24 24",
|
|
1108
|
-
fill: "none",
|
|
1109
|
-
stroke: "currentColor",
|
|
1110
|
-
strokeWidth: "2.5",
|
|
1111
|
-
style: { animation: "qf-spin 0.8s linear infinite" },
|
|
1112
|
-
"aria-hidden": "true",
|
|
1113
|
-
children: [
|
|
1114
|
-
/* @__PURE__ */ a("circle", { cx: "12", cy: "12", r: "10", strokeOpacity: "0.25" }),
|
|
1115
|
-
/* @__PURE__ */ a("path", { d: "M12 2a10 10 0 0 1 10 10" })
|
|
1116
|
-
]
|
|
1117
|
-
}
|
|
1118
|
-
),
|
|
1119
|
-
"Processing…"
|
|
1120
|
-
] }) : J(n)
|
|
1121
|
-
}
|
|
1122
|
-
),
|
|
1123
|
-
/* @__PURE__ */ a("style", { children: "@keyframes qf-spin { to { transform: rotate(360deg); } }" })
|
|
1124
|
-
]
|
|
1125
|
-
}
|
|
1126
|
-
);
|
|
1091
|
+
function M(e) {
|
|
1092
|
+
let t = 2166136261;
|
|
1093
|
+
for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619) >>> 0;
|
|
1094
|
+
return (t & 65535) / 65535 * Math.PI * 2;
|
|
1127
1095
|
}
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1096
|
+
function N({ fields: r, onSubmit: o, submitLabel: d = "Submit", layout: f = "vertical", showConfidence: p = !0, showQuantumState: m = !1 }) {
|
|
1097
|
+
let h = e(), g = r.map((e) => v(e.name)), [_, y] = s(() => Object.fromEntries(r.map((e) => [e.name, ""]))), [b, x] = s({}), [S, C] = s({}), [w, T] = s(!1), [E, D] = s(!1), [k, A] = s(!1);
|
|
1098
|
+
a(() => {
|
|
1099
|
+
let e = requestAnimationFrame(() => D(!0));
|
|
1100
|
+
return () => cancelAnimationFrame(e);
|
|
1101
|
+
}, []);
|
|
1102
|
+
let N = i((e, t) => {
|
|
1103
|
+
let n = r.find((t) => t.name === e), i = g[r.findIndex((t) => t.name === e)];
|
|
1104
|
+
if (!n || !i) return "";
|
|
1105
|
+
let a = t[e] ?? "";
|
|
1106
|
+
for (let { rule: e, value: r, message: o } of i.validations) if (!(e === "required" && n.required === !1) && !O(e, r, a, t)) return o;
|
|
1107
|
+
return "";
|
|
1108
|
+
}, [r]), P = i((e) => {
|
|
1109
|
+
let t = {};
|
|
1110
|
+
for (let n of r) {
|
|
1111
|
+
let r = N(n.name, e);
|
|
1112
|
+
r && (t[n.name] = r);
|
|
1113
|
+
}
|
|
1114
|
+
return t;
|
|
1115
|
+
}, [r, N]), F = i((e, t) => {
|
|
1116
|
+
y((n) => {
|
|
1117
|
+
let i = {
|
|
1118
|
+
...n,
|
|
1119
|
+
[e]: t
|
|
1120
|
+
};
|
|
1121
|
+
if (S[e] && (x((t) => ({
|
|
1122
|
+
...t,
|
|
1123
|
+
[e]: N(e, i)
|
|
1124
|
+
})), e === "password")) {
|
|
1125
|
+
let e = r.find((e) => [
|
|
1126
|
+
"confirmpassword",
|
|
1127
|
+
"confirm_password",
|
|
1128
|
+
"passwordconfirm"
|
|
1129
|
+
].includes(e.name.toLowerCase().replace(/[\s_-]/g, "")))?.name;
|
|
1130
|
+
e && S[e] && x((t) => ({
|
|
1131
|
+
...t,
|
|
1132
|
+
[e]: N(e, i)
|
|
1133
|
+
}));
|
|
1134
|
+
}
|
|
1135
|
+
return i;
|
|
1136
|
+
}), A(!0);
|
|
1137
|
+
}, [
|
|
1138
|
+
r,
|
|
1139
|
+
S,
|
|
1140
|
+
N
|
|
1141
|
+
]), I = i((e) => {
|
|
1142
|
+
C((t) => ({
|
|
1143
|
+
...t,
|
|
1144
|
+
[e]: !0
|
|
1145
|
+
})), x((t) => ({
|
|
1146
|
+
...t,
|
|
1147
|
+
[e]: N(e, _)
|
|
1148
|
+
}));
|
|
1149
|
+
}, [_, N]), L = i(async (e) => {
|
|
1150
|
+
e.preventDefault(), C(Object.fromEntries(r.map((e) => [e.name, !0])));
|
|
1151
|
+
let t = P(_);
|
|
1152
|
+
if (x(t), !(Object.keys(t).length > 0)) {
|
|
1153
|
+
T(!0);
|
|
1154
|
+
try {
|
|
1155
|
+
await o(_);
|
|
1156
|
+
} finally {
|
|
1157
|
+
T(!1);
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
}, [
|
|
1161
|
+
r,
|
|
1162
|
+
_,
|
|
1163
|
+
P,
|
|
1164
|
+
o
|
|
1165
|
+
]), R = g.length > 0 ? Math.round(g.reduce((e, t) => e + t.confidence, 0) / g.length * 100) : 0, z = R >= 80 ? h.success : R >= 60 ? h.warning : h.danger, B = f === "horizontal";
|
|
1166
|
+
return /* @__PURE__ */ u("form", {
|
|
1167
|
+
onSubmit: L,
|
|
1168
|
+
noValidate: !0,
|
|
1169
|
+
className: t("w-full"),
|
|
1170
|
+
style: {
|
|
1171
|
+
backgroundColor: h.surface,
|
|
1172
|
+
border: `1px solid ${h.border}`,
|
|
1173
|
+
borderRadius: "12px",
|
|
1174
|
+
padding: "24px",
|
|
1175
|
+
position: "relative",
|
|
1176
|
+
boxSizing: "border-box"
|
|
1177
|
+
},
|
|
1178
|
+
children: [
|
|
1179
|
+
/* @__PURE__ */ l("span", {
|
|
1180
|
+
"aria-label": "Powered by Quantum AI",
|
|
1181
|
+
style: {
|
|
1182
|
+
position: "absolute",
|
|
1183
|
+
top: "16px",
|
|
1184
|
+
right: "16px",
|
|
1185
|
+
fontSize: "10px",
|
|
1186
|
+
fontWeight: 700,
|
|
1187
|
+
padding: "3px 8px",
|
|
1188
|
+
borderRadius: "999px",
|
|
1189
|
+
backgroundColor: `${h.primary}20`,
|
|
1190
|
+
color: h.primary,
|
|
1191
|
+
border: `1px solid ${h.primary}44`,
|
|
1192
|
+
letterSpacing: "0.04em",
|
|
1193
|
+
userSelect: "none"
|
|
1194
|
+
},
|
|
1195
|
+
children: "⚛ Quantum AI"
|
|
1196
|
+
}),
|
|
1197
|
+
p && /* @__PURE__ */ u("div", {
|
|
1198
|
+
style: {
|
|
1199
|
+
marginBottom: "20px",
|
|
1200
|
+
paddingRight: "100px"
|
|
1201
|
+
},
|
|
1202
|
+
children: [/* @__PURE__ */ u("div", {
|
|
1203
|
+
style: {
|
|
1204
|
+
display: "flex",
|
|
1205
|
+
alignItems: "center",
|
|
1206
|
+
justifyContent: "space-between",
|
|
1207
|
+
marginBottom: "4px"
|
|
1208
|
+
},
|
|
1209
|
+
children: [/* @__PURE__ */ l("span", {
|
|
1210
|
+
style: {
|
|
1211
|
+
fontSize: "11px",
|
|
1212
|
+
color: h.textMuted,
|
|
1213
|
+
fontWeight: 500
|
|
1214
|
+
},
|
|
1215
|
+
children: "Form Intelligence Confidence"
|
|
1216
|
+
}), /* @__PURE__ */ u("span", {
|
|
1217
|
+
style: {
|
|
1218
|
+
fontSize: "11px",
|
|
1219
|
+
fontWeight: 700,
|
|
1220
|
+
color: z
|
|
1221
|
+
},
|
|
1222
|
+
children: [R, "%"]
|
|
1223
|
+
})]
|
|
1224
|
+
}), /* @__PURE__ */ l("div", {
|
|
1225
|
+
style: {
|
|
1226
|
+
height: "4px",
|
|
1227
|
+
borderRadius: "4px",
|
|
1228
|
+
backgroundColor: h.border,
|
|
1229
|
+
overflow: "hidden"
|
|
1230
|
+
},
|
|
1231
|
+
children: /* @__PURE__ */ l("div", { style: {
|
|
1232
|
+
height: "100%",
|
|
1233
|
+
width: `${R}%`,
|
|
1234
|
+
backgroundColor: z,
|
|
1235
|
+
borderRadius: "4px",
|
|
1236
|
+
transition: "width 0.8s ease"
|
|
1237
|
+
} })
|
|
1238
|
+
})]
|
|
1239
|
+
}),
|
|
1240
|
+
/* @__PURE__ */ l("div", {
|
|
1241
|
+
style: {
|
|
1242
|
+
display: "grid",
|
|
1243
|
+
gridTemplateColumns: B ? "repeat(auto-fill, minmax(260px, 1fr))" : "1fr",
|
|
1244
|
+
gap: "16px",
|
|
1245
|
+
marginBottom: "20px"
|
|
1246
|
+
},
|
|
1247
|
+
children: r.map((e, t) => /* @__PURE__ */ l(j, {
|
|
1248
|
+
config: e,
|
|
1249
|
+
intel: g[t],
|
|
1250
|
+
qubitPhase: M(e.name),
|
|
1251
|
+
value: _[e.name] ?? "",
|
|
1252
|
+
error: b[e.name] ?? "",
|
|
1253
|
+
touched: S[e.name] ?? !1,
|
|
1254
|
+
showConfidence: p,
|
|
1255
|
+
showQuantumState: m,
|
|
1256
|
+
collapsed: k,
|
|
1257
|
+
onChange: (t) => F(e.name, t),
|
|
1258
|
+
onBlur: () => I(e.name),
|
|
1259
|
+
theme: h,
|
|
1260
|
+
mounted: E,
|
|
1261
|
+
index: t
|
|
1262
|
+
}, e.name))
|
|
1263
|
+
}),
|
|
1264
|
+
/* @__PURE__ */ l("button", {
|
|
1265
|
+
type: "submit",
|
|
1266
|
+
disabled: w,
|
|
1267
|
+
style: {
|
|
1268
|
+
width: "100%",
|
|
1269
|
+
padding: "10px 20px",
|
|
1270
|
+
borderRadius: "8px",
|
|
1271
|
+
border: "none",
|
|
1272
|
+
backgroundColor: w ? `${h.primary}88` : h.primary,
|
|
1273
|
+
color: h.bg,
|
|
1274
|
+
fontSize: "14px",
|
|
1275
|
+
fontWeight: 700,
|
|
1276
|
+
fontFamily: "inherit",
|
|
1277
|
+
cursor: w ? "not-allowed" : "pointer",
|
|
1278
|
+
transition: "background-color 0.15s, opacity 0.15s",
|
|
1279
|
+
display: "flex",
|
|
1280
|
+
alignItems: "center",
|
|
1281
|
+
justifyContent: "center",
|
|
1282
|
+
gap: "8px"
|
|
1283
|
+
},
|
|
1284
|
+
children: w ? /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ u("svg", {
|
|
1285
|
+
width: "14",
|
|
1286
|
+
height: "14",
|
|
1287
|
+
viewBox: "0 0 24 24",
|
|
1288
|
+
fill: "none",
|
|
1289
|
+
stroke: "currentColor",
|
|
1290
|
+
strokeWidth: "2.5",
|
|
1291
|
+
style: { animation: "qf-spin 0.8s linear infinite" },
|
|
1292
|
+
"aria-hidden": "true",
|
|
1293
|
+
children: [/* @__PURE__ */ l("circle", {
|
|
1294
|
+
cx: "12",
|
|
1295
|
+
cy: "12",
|
|
1296
|
+
r: "10",
|
|
1297
|
+
strokeOpacity: "0.25"
|
|
1298
|
+
}), /* @__PURE__ */ l("path", { d: "M12 2a10 10 0 0 1 10 10" })]
|
|
1299
|
+
}), "Processing…"] }) : n(d)
|
|
1300
|
+
}),
|
|
1301
|
+
/* @__PURE__ */ l("style", { children: "@keyframes qf-spin { to { transform: rotate(360deg); } }" })
|
|
1302
|
+
]
|
|
1303
|
+
});
|
|
1155
1304
|
}
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1305
|
+
N.displayName = "TkxQuantumForm";
|
|
1306
|
+
//#endregion
|
|
1307
|
+
//#region src/components/TkxThemeBuilder.tsx
|
|
1308
|
+
function P(e) {
|
|
1309
|
+
return e ? {
|
|
1310
|
+
primary: "#00f5d4",
|
|
1311
|
+
secondary: "#7b2ff7",
|
|
1312
|
+
background: "#0a0a0f",
|
|
1313
|
+
surface: "#12121a",
|
|
1314
|
+
text: "#e8e8f4",
|
|
1315
|
+
textMuted: "#8888aa",
|
|
1316
|
+
border: "#2a2a3e",
|
|
1317
|
+
error: "#f87171",
|
|
1318
|
+
warning: "#fbbf24",
|
|
1319
|
+
success: "#34d399",
|
|
1320
|
+
accent: "#ff6b6b"
|
|
1321
|
+
} : {
|
|
1322
|
+
primary: "#0d7c5f",
|
|
1323
|
+
secondary: "#6930c3",
|
|
1324
|
+
background: "#f8f6f1",
|
|
1325
|
+
surface: "#ffffff",
|
|
1326
|
+
text: "#1a1815",
|
|
1327
|
+
textMuted: "#6b6560",
|
|
1328
|
+
border: "#ddd8cc",
|
|
1329
|
+
error: "#dc2626",
|
|
1330
|
+
warning: "#d97706",
|
|
1331
|
+
success: "#059669",
|
|
1332
|
+
accent: "#e05a00"
|
|
1333
|
+
};
|
|
1185
1334
|
}
|
|
1186
|
-
function
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1335
|
+
function F({ points: e, primary: t }) {
|
|
1336
|
+
if (e.length < 2) return /* @__PURE__ */ l("div", {
|
|
1337
|
+
style: {
|
|
1338
|
+
height: 48,
|
|
1339
|
+
display: "flex",
|
|
1340
|
+
alignItems: "center",
|
|
1341
|
+
justifyContent: "center",
|
|
1342
|
+
color: "#888",
|
|
1343
|
+
fontSize: 12
|
|
1344
|
+
},
|
|
1345
|
+
children: "Waiting for data..."
|
|
1346
|
+
});
|
|
1347
|
+
let n = Math.max(...e.map((e) => e.energy)), r = Math.min(...e.map((e) => e.energy)), i = n - r || 1, a = e[e.length - 1].iteration || 1;
|
|
1348
|
+
return /* @__PURE__ */ u("svg", {
|
|
1349
|
+
width: 280,
|
|
1350
|
+
height: 48,
|
|
1351
|
+
style: { display: "block" },
|
|
1352
|
+
children: [
|
|
1353
|
+
/* @__PURE__ */ l("polyline", {
|
|
1354
|
+
points: e.map((e) => {
|
|
1355
|
+
let t = e.iteration / a * 280, n = 48 - (e.energy - r) / i * 44 - 2;
|
|
1356
|
+
return `${t.toFixed(1)},${n.toFixed(1)}`;
|
|
1357
|
+
}).join(" "),
|
|
1358
|
+
fill: "none",
|
|
1359
|
+
stroke: t,
|
|
1360
|
+
strokeWidth: 1.5,
|
|
1361
|
+
strokeLinecap: "round",
|
|
1362
|
+
strokeLinejoin: "round",
|
|
1363
|
+
opacity: .9
|
|
1364
|
+
}),
|
|
1365
|
+
/* @__PURE__ */ u("text", {
|
|
1366
|
+
x: 2,
|
|
1367
|
+
y: 10,
|
|
1368
|
+
fontSize: 9,
|
|
1369
|
+
fill: "#888",
|
|
1370
|
+
children: ["E=", n.toFixed(1)]
|
|
1371
|
+
}),
|
|
1372
|
+
/* @__PURE__ */ u("text", {
|
|
1373
|
+
x: 2,
|
|
1374
|
+
y: 46,
|
|
1375
|
+
fontSize: 9,
|
|
1376
|
+
fill: "#888",
|
|
1377
|
+
children: ["E=", r.toFixed(1)]
|
|
1378
|
+
})
|
|
1379
|
+
]
|
|
1380
|
+
});
|
|
1220
1381
|
}
|
|
1221
|
-
function
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1382
|
+
function I({ label: e, value: t, onChange: n, text: r, border: i }) {
|
|
1383
|
+
return /* @__PURE__ */ u("div", {
|
|
1384
|
+
style: {
|
|
1385
|
+
display: "flex",
|
|
1386
|
+
alignItems: "center",
|
|
1387
|
+
gap: 8,
|
|
1388
|
+
marginBottom: 6
|
|
1389
|
+
},
|
|
1390
|
+
children: [
|
|
1391
|
+
/* @__PURE__ */ l("input", {
|
|
1392
|
+
type: "color",
|
|
1393
|
+
value: t,
|
|
1394
|
+
onChange: (e) => n(e.target.value),
|
|
1395
|
+
style: {
|
|
1396
|
+
width: 32,
|
|
1397
|
+
height: 32,
|
|
1398
|
+
border: `1px solid ${i}`,
|
|
1399
|
+
borderRadius: 6,
|
|
1400
|
+
padding: 2,
|
|
1401
|
+
cursor: "pointer",
|
|
1402
|
+
background: "transparent"
|
|
1403
|
+
}
|
|
1404
|
+
}),
|
|
1405
|
+
/* @__PURE__ */ l("div", { style: {
|
|
1406
|
+
width: 60,
|
|
1407
|
+
height: 28,
|
|
1408
|
+
borderRadius: 6,
|
|
1409
|
+
background: t,
|
|
1410
|
+
border: `1px solid ${i}`
|
|
1411
|
+
} }),
|
|
1412
|
+
/* @__PURE__ */ l("span", {
|
|
1413
|
+
style: {
|
|
1414
|
+
flex: 1,
|
|
1415
|
+
fontSize: 13,
|
|
1416
|
+
color: r,
|
|
1417
|
+
fontFamily: "monospace"
|
|
1418
|
+
},
|
|
1419
|
+
children: e
|
|
1420
|
+
}),
|
|
1421
|
+
/* @__PURE__ */ l("code", {
|
|
1422
|
+
style: {
|
|
1423
|
+
fontSize: 12,
|
|
1424
|
+
color: r,
|
|
1425
|
+
opacity: .7,
|
|
1426
|
+
fontFamily: "monospace"
|
|
1427
|
+
},
|
|
1428
|
+
children: t
|
|
1429
|
+
})
|
|
1430
|
+
]
|
|
1431
|
+
});
|
|
1233
1432
|
}
|
|
1234
|
-
function
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
{ label: "TextMuted on Background", fg: o.textMuted, bg: o.background }
|
|
1280
|
-
], L = "linear-gradient(to right," + [
|
|
1281
|
-
"hsl(0,80%,55%)",
|
|
1282
|
-
"hsl(30,80%,55%)",
|
|
1283
|
-
"hsl(60,80%,55%)",
|
|
1284
|
-
"hsl(90,80%,55%)",
|
|
1285
|
-
"hsl(120,80%,55%)",
|
|
1286
|
-
"hsl(150,80%,55%)",
|
|
1287
|
-
"hsl(180,80%,55%)",
|
|
1288
|
-
"hsl(210,80%,55%)",
|
|
1289
|
-
"hsl(240,80%,55%)",
|
|
1290
|
-
"hsl(270,80%,55%)",
|
|
1291
|
-
"hsl(300,80%,55%)",
|
|
1292
|
-
"hsl(330,80%,55%)",
|
|
1293
|
-
"hsl(360,80%,55%)"
|
|
1294
|
-
].join(",") + ")", D = {
|
|
1295
|
-
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
1296
|
-
background: o.background,
|
|
1297
|
-
color: o.text,
|
|
1298
|
-
border: `1px solid ${o.border}`,
|
|
1299
|
-
borderRadius: 12,
|
|
1300
|
-
padding: 20,
|
|
1301
|
-
maxWidth: 900,
|
|
1302
|
-
display: "grid",
|
|
1303
|
-
gridTemplateColumns: "1fr 1fr",
|
|
1304
|
-
gap: 20
|
|
1305
|
-
}, E = {
|
|
1306
|
-
background: o.surface,
|
|
1307
|
-
border: `1px solid ${o.border}`,
|
|
1308
|
-
borderRadius: 8,
|
|
1309
|
-
padding: 16
|
|
1310
|
-
}, I = {
|
|
1311
|
-
fontSize: 13,
|
|
1312
|
-
fontWeight: 700,
|
|
1313
|
-
textTransform: "uppercase",
|
|
1314
|
-
letterSpacing: "0.08em",
|
|
1315
|
-
color: o.primary,
|
|
1316
|
-
marginBottom: 12,
|
|
1317
|
-
marginTop: 0
|
|
1318
|
-
}, j = {
|
|
1319
|
-
padding: "8px 16px",
|
|
1320
|
-
borderRadius: 8,
|
|
1321
|
-
border: "none",
|
|
1322
|
-
cursor: "pointer",
|
|
1323
|
-
fontWeight: 600,
|
|
1324
|
-
fontSize: 13,
|
|
1325
|
-
transition: "opacity 0.15s"
|
|
1326
|
-
}, y = le;
|
|
1327
|
-
return /* @__PURE__ */ c("div", { style: D, children: [
|
|
1328
|
-
/* @__PURE__ */ c("div", { style: { display: "flex", flexDirection: "column", gap: 16 }, children: [
|
|
1329
|
-
/* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gridColumn: "1/-1" }, children: [
|
|
1330
|
-
/* @__PURE__ */ c("div", { children: [
|
|
1331
|
-
/* @__PURE__ */ a("h2", { style: { margin: 0, fontSize: 18, fontWeight: 700 }, children: "Theme Builder" }),
|
|
1332
|
-
/* @__PURE__ */ a("p", { style: { margin: "2px 0 0", fontSize: 12, color: o.textMuted }, children: "Quantum-powered color optimization" })
|
|
1333
|
-
] }),
|
|
1334
|
-
/* @__PURE__ */ a(
|
|
1335
|
-
"button",
|
|
1336
|
-
{
|
|
1337
|
-
onClick: w,
|
|
1338
|
-
style: {
|
|
1339
|
-
...j,
|
|
1340
|
-
background: o.surface,
|
|
1341
|
-
color: o.text,
|
|
1342
|
-
border: `1px solid ${o.border}`
|
|
1343
|
-
},
|
|
1344
|
-
children: k ? "☀ Light" : "🌙 Dark"
|
|
1345
|
-
}
|
|
1346
|
-
)
|
|
1347
|
-
] }),
|
|
1348
|
-
/* @__PURE__ */ c("div", { style: E, children: [
|
|
1349
|
-
/* @__PURE__ */ a("p", { style: I, children: "Base Hue" }),
|
|
1350
|
-
/* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
|
|
1351
|
-
/* @__PURE__ */ a(
|
|
1352
|
-
"div",
|
|
1353
|
-
{
|
|
1354
|
-
style: {
|
|
1355
|
-
width: 24,
|
|
1356
|
-
height: 24,
|
|
1357
|
-
borderRadius: "50%",
|
|
1358
|
-
background: `hsl(${s},70%,55%)`,
|
|
1359
|
-
border: `2px solid ${o.border}`,
|
|
1360
|
-
flexShrink: 0
|
|
1361
|
-
}
|
|
1362
|
-
}
|
|
1363
|
-
),
|
|
1364
|
-
/* @__PURE__ */ a(
|
|
1365
|
-
"input",
|
|
1366
|
-
{
|
|
1367
|
-
type: "range",
|
|
1368
|
-
min: 0,
|
|
1369
|
-
max: 360,
|
|
1370
|
-
value: s,
|
|
1371
|
-
onChange: (u) => d(Number(u.target.value)),
|
|
1372
|
-
style: {
|
|
1373
|
-
flex: 1,
|
|
1374
|
-
height: 16,
|
|
1375
|
-
borderRadius: 8,
|
|
1376
|
-
background: L,
|
|
1377
|
-
outline: "none",
|
|
1378
|
-
border: "none",
|
|
1379
|
-
cursor: "pointer",
|
|
1380
|
-
appearance: "none",
|
|
1381
|
-
WebkitAppearance: "none"
|
|
1382
|
-
}
|
|
1383
|
-
}
|
|
1384
|
-
),
|
|
1385
|
-
/* @__PURE__ */ c("span", { style: { fontSize: 13, fontFamily: "monospace", minWidth: 32 }, children: [
|
|
1386
|
-
s,
|
|
1387
|
-
"°"
|
|
1388
|
-
] })
|
|
1389
|
-
] })
|
|
1390
|
-
] }),
|
|
1391
|
-
/* @__PURE__ */ c("div", { style: E, children: [
|
|
1392
|
-
/* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 10 }, children: [
|
|
1393
|
-
/* @__PURE__ */ a(
|
|
1394
|
-
"button",
|
|
1395
|
-
{
|
|
1396
|
-
onClick: F,
|
|
1397
|
-
disabled: f,
|
|
1398
|
-
style: {
|
|
1399
|
-
...j,
|
|
1400
|
-
background: f ? o.border : o.primary,
|
|
1401
|
-
color: k ? "#000" : "#fff",
|
|
1402
|
-
opacity: f ? 0.7 : 1,
|
|
1403
|
-
flex: 1
|
|
1404
|
-
},
|
|
1405
|
-
children: f ? "⟳ Optimizing..." : "⚛ Generate with Quantum Annealing"
|
|
1406
|
-
}
|
|
1407
|
-
),
|
|
1408
|
-
/* @__PURE__ */ a(
|
|
1409
|
-
"div",
|
|
1410
|
-
{
|
|
1411
|
-
style: {
|
|
1412
|
-
padding: "3px 8px",
|
|
1413
|
-
background: o.primary + "22",
|
|
1414
|
-
border: `1px solid ${o.primary}44`,
|
|
1415
|
-
borderRadius: 20,
|
|
1416
|
-
fontSize: 10,
|
|
1417
|
-
color: o.primary,
|
|
1418
|
-
fontWeight: 700,
|
|
1419
|
-
whiteSpace: "nowrap"
|
|
1420
|
-
},
|
|
1421
|
-
children: "⚛ Quantum Annealing"
|
|
1422
|
-
}
|
|
1423
|
-
)
|
|
1424
|
-
] }),
|
|
1425
|
-
(f || g.length > 0) && /* @__PURE__ */ c("div", { children: [
|
|
1426
|
-
/* @__PURE__ */ a("p", { style: { fontSize: 11, color: o.textMuted, margin: "0 0 4px" }, children: "Energy landscape (lower = better palette)" }),
|
|
1427
|
-
/* @__PURE__ */ a(Ce, { points: g, primary: o.primary })
|
|
1428
|
-
] })
|
|
1429
|
-
] }),
|
|
1430
|
-
/* @__PURE__ */ c("div", { style: E, children: [
|
|
1431
|
-
/* @__PURE__ */ a("p", { style: I, children: "Color Tokens" }),
|
|
1432
|
-
Object.keys(o).map((u) => /* @__PURE__ */ a(
|
|
1433
|
-
Me,
|
|
1434
|
-
{
|
|
1435
|
-
label: u,
|
|
1436
|
-
value: o[u],
|
|
1437
|
-
onChange: (x) => P(u, x),
|
|
1438
|
-
text: o.text,
|
|
1439
|
-
border: o.border
|
|
1440
|
-
},
|
|
1441
|
-
u
|
|
1442
|
-
))
|
|
1443
|
-
] }),
|
|
1444
|
-
/* @__PURE__ */ a(
|
|
1445
|
-
"button",
|
|
1446
|
-
{
|
|
1447
|
-
onClick: $,
|
|
1448
|
-
style: {
|
|
1449
|
-
...j,
|
|
1450
|
-
background: o.accent,
|
|
1451
|
-
color: "#fff",
|
|
1452
|
-
width: "100%"
|
|
1453
|
-
},
|
|
1454
|
-
children: h ? "✓ Copied to Clipboard!" : "⬇ Export Theme"
|
|
1455
|
-
}
|
|
1456
|
-
)
|
|
1457
|
-
] }),
|
|
1458
|
-
/* @__PURE__ */ c("div", { style: { display: "flex", flexDirection: "column", gap: 16 }, children: [
|
|
1459
|
-
/* @__PURE__ */ c("div", { style: E, children: [
|
|
1460
|
-
/* @__PURE__ */ a("p", { style: I, children: "Live Preview" }),
|
|
1461
|
-
/* @__PURE__ */ c("div", { style: { marginBottom: 12 }, children: [
|
|
1462
|
-
/* @__PURE__ */ a("p", { style: { fontSize: 11, color: o.textMuted, margin: "0 0 6px" }, children: "Buttons" }),
|
|
1463
|
-
/* @__PURE__ */ c("div", { style: { display: "flex", gap: 8, flexWrap: "wrap" }, children: [
|
|
1464
|
-
/* @__PURE__ */ a(
|
|
1465
|
-
"button",
|
|
1466
|
-
{
|
|
1467
|
-
style: {
|
|
1468
|
-
padding: "8px 16px",
|
|
1469
|
-
borderRadius: 8,
|
|
1470
|
-
border: "none",
|
|
1471
|
-
background: o.primary,
|
|
1472
|
-
color: k ? "#000" : "#fff",
|
|
1473
|
-
fontWeight: 600,
|
|
1474
|
-
fontSize: 13,
|
|
1475
|
-
cursor: "pointer"
|
|
1476
|
-
},
|
|
1477
|
-
children: "Primary"
|
|
1478
|
-
}
|
|
1479
|
-
),
|
|
1480
|
-
/* @__PURE__ */ a(
|
|
1481
|
-
"button",
|
|
1482
|
-
{
|
|
1483
|
-
style: {
|
|
1484
|
-
padding: "8px 16px",
|
|
1485
|
-
borderRadius: 8,
|
|
1486
|
-
border: "none",
|
|
1487
|
-
background: o.secondary,
|
|
1488
|
-
color: "#fff",
|
|
1489
|
-
fontWeight: 600,
|
|
1490
|
-
fontSize: 13,
|
|
1491
|
-
cursor: "pointer"
|
|
1492
|
-
},
|
|
1493
|
-
children: "Secondary"
|
|
1494
|
-
}
|
|
1495
|
-
),
|
|
1496
|
-
/* @__PURE__ */ a(
|
|
1497
|
-
"button",
|
|
1498
|
-
{
|
|
1499
|
-
style: {
|
|
1500
|
-
padding: "8px 16px",
|
|
1501
|
-
borderRadius: 8,
|
|
1502
|
-
border: `1px solid ${o.border}`,
|
|
1503
|
-
background: "transparent",
|
|
1504
|
-
color: o.text,
|
|
1505
|
-
fontWeight: 600,
|
|
1506
|
-
fontSize: 13,
|
|
1507
|
-
cursor: "pointer"
|
|
1508
|
-
},
|
|
1509
|
-
children: "Outline"
|
|
1510
|
-
}
|
|
1511
|
-
)
|
|
1512
|
-
] })
|
|
1513
|
-
] }),
|
|
1514
|
-
/* @__PURE__ */ c("div", { style: { marginBottom: 12 }, children: [
|
|
1515
|
-
/* @__PURE__ */ a("p", { style: { fontSize: 11, color: o.textMuted, margin: "0 0 6px" }, children: "Card" }),
|
|
1516
|
-
/* @__PURE__ */ c(
|
|
1517
|
-
"div",
|
|
1518
|
-
{
|
|
1519
|
-
style: {
|
|
1520
|
-
background: o.surface,
|
|
1521
|
-
border: `1px solid ${o.border}`,
|
|
1522
|
-
borderRadius: 8,
|
|
1523
|
-
padding: 12
|
|
1524
|
-
},
|
|
1525
|
-
children: [
|
|
1526
|
-
/* @__PURE__ */ a("div", { style: { fontSize: 14, fontWeight: 700, marginBottom: 4 }, children: "Card Title" }),
|
|
1527
|
-
/* @__PURE__ */ a("div", { style: { fontSize: 12, color: o.textMuted, lineHeight: 1.4 }, children: "Sample card with surface background and muted text content." }),
|
|
1528
|
-
/* @__PURE__ */ c("div", { style: { marginTop: 8, display: "flex", gap: 6 }, children: [
|
|
1529
|
-
/* @__PURE__ */ a(
|
|
1530
|
-
"span",
|
|
1531
|
-
{
|
|
1532
|
-
style: {
|
|
1533
|
-
padding: "2px 8px",
|
|
1534
|
-
borderRadius: 20,
|
|
1535
|
-
background: o.primary + "33",
|
|
1536
|
-
color: o.primary,
|
|
1537
|
-
fontSize: 11,
|
|
1538
|
-
fontWeight: 600
|
|
1539
|
-
},
|
|
1540
|
-
children: "Tag"
|
|
1541
|
-
}
|
|
1542
|
-
),
|
|
1543
|
-
/* @__PURE__ */ a(
|
|
1544
|
-
"span",
|
|
1545
|
-
{
|
|
1546
|
-
style: {
|
|
1547
|
-
padding: "2px 8px",
|
|
1548
|
-
borderRadius: 20,
|
|
1549
|
-
background: o.accent + "33",
|
|
1550
|
-
color: o.accent,
|
|
1551
|
-
fontSize: 11,
|
|
1552
|
-
fontWeight: 600
|
|
1553
|
-
},
|
|
1554
|
-
children: "Accent"
|
|
1555
|
-
}
|
|
1556
|
-
)
|
|
1557
|
-
] })
|
|
1558
|
-
]
|
|
1559
|
-
}
|
|
1560
|
-
)
|
|
1561
|
-
] }),
|
|
1562
|
-
/* @__PURE__ */ c("div", { style: { marginBottom: 12 }, children: [
|
|
1563
|
-
/* @__PURE__ */ a("p", { style: { fontSize: 11, color: o.textMuted, margin: "0 0 6px" }, children: "Input" }),
|
|
1564
|
-
/* @__PURE__ */ a(
|
|
1565
|
-
"input",
|
|
1566
|
-
{
|
|
1567
|
-
type: "text",
|
|
1568
|
-
placeholder: "Type something...",
|
|
1569
|
-
readOnly: !0,
|
|
1570
|
-
style: {
|
|
1571
|
-
width: "100%",
|
|
1572
|
-
padding: "8px 12px",
|
|
1573
|
-
borderRadius: 8,
|
|
1574
|
-
border: `1px solid ${o.border}`,
|
|
1575
|
-
background: o.background,
|
|
1576
|
-
color: o.text,
|
|
1577
|
-
fontSize: 13,
|
|
1578
|
-
outline: "none",
|
|
1579
|
-
boxSizing: "border-box"
|
|
1580
|
-
}
|
|
1581
|
-
}
|
|
1582
|
-
)
|
|
1583
|
-
] }),
|
|
1584
|
-
/* @__PURE__ */ c("div", { style: { marginBottom: 12 }, children: [
|
|
1585
|
-
/* @__PURE__ */ a("p", { style: { fontSize: 11, color: o.textMuted, margin: "0 0 6px" }, children: "Progress" }),
|
|
1586
|
-
/* @__PURE__ */ a(
|
|
1587
|
-
"div",
|
|
1588
|
-
{
|
|
1589
|
-
style: {
|
|
1590
|
-
height: 8,
|
|
1591
|
-
borderRadius: 4,
|
|
1592
|
-
background: o.border,
|
|
1593
|
-
overflow: "hidden"
|
|
1594
|
-
},
|
|
1595
|
-
children: /* @__PURE__ */ a(
|
|
1596
|
-
"div",
|
|
1597
|
-
{
|
|
1598
|
-
style: {
|
|
1599
|
-
height: "100%",
|
|
1600
|
-
width: "68%",
|
|
1601
|
-
background: `linear-gradient(to right, ${o.primary}, ${o.accent})`,
|
|
1602
|
-
borderRadius: 4,
|
|
1603
|
-
transition: "width 0.4s ease"
|
|
1604
|
-
}
|
|
1605
|
-
}
|
|
1606
|
-
)
|
|
1607
|
-
}
|
|
1608
|
-
)
|
|
1609
|
-
] }),
|
|
1610
|
-
/* @__PURE__ */ c("div", { children: [
|
|
1611
|
-
/* @__PURE__ */ a("p", { style: { fontSize: 11, color: o.textMuted, margin: "0 0 6px" }, children: "Status Badges" }),
|
|
1612
|
-
/* @__PURE__ */ a("div", { style: { display: "flex", gap: 6, flexWrap: "wrap" }, children: [
|
|
1613
|
-
{ label: "Error", color: o.error },
|
|
1614
|
-
{ label: "Warning", color: o.warning },
|
|
1615
|
-
{ label: "Success", color: o.success }
|
|
1616
|
-
].map(({ label: u, color: x }) => /* @__PURE__ */ a(
|
|
1617
|
-
"span",
|
|
1618
|
-
{
|
|
1619
|
-
style: {
|
|
1620
|
-
padding: "3px 10px",
|
|
1621
|
-
borderRadius: 4,
|
|
1622
|
-
background: x + "22",
|
|
1623
|
-
color: x,
|
|
1624
|
-
border: `1px solid ${x}44`,
|
|
1625
|
-
fontSize: 11,
|
|
1626
|
-
fontWeight: 700
|
|
1627
|
-
},
|
|
1628
|
-
children: u
|
|
1629
|
-
},
|
|
1630
|
-
u
|
|
1631
|
-
)) })
|
|
1632
|
-
] })
|
|
1633
|
-
] }),
|
|
1634
|
-
/* @__PURE__ */ c("div", { style: E, children: [
|
|
1635
|
-
/* @__PURE__ */ a("p", { style: I, children: "WCAG Contrast Check" }),
|
|
1636
|
-
q.map((u) => /* @__PURE__ */ a(
|
|
1637
|
-
ze,
|
|
1638
|
-
{
|
|
1639
|
-
label: u.label,
|
|
1640
|
-
ratio: Y.contrast(u.fg, u.bg)
|
|
1641
|
-
},
|
|
1642
|
-
u.label
|
|
1643
|
-
)),
|
|
1644
|
-
/* @__PURE__ */ a("p", { style: { fontSize: 10, color: o.textMuted, marginTop: 8, marginBottom: 0 }, children: "AA requires 4.5:1 (normal text). AAA requires 7:1." })
|
|
1645
|
-
] }),
|
|
1646
|
-
/* @__PURE__ */ c("div", { style: E, children: [
|
|
1647
|
-
/* @__PURE__ */ a("p", { style: I, children: "Color Palette" }),
|
|
1648
|
-
/* @__PURE__ */ a("div", { style: { display: "flex", gap: 4, flexWrap: "wrap" }, children: Object.entries(o).map(([u, x]) => /* @__PURE__ */ a(
|
|
1649
|
-
"div",
|
|
1650
|
-
{
|
|
1651
|
-
title: `${u}: ${x}`,
|
|
1652
|
-
style: {
|
|
1653
|
-
width: 36,
|
|
1654
|
-
height: 36,
|
|
1655
|
-
borderRadius: 6,
|
|
1656
|
-
background: x,
|
|
1657
|
-
border: `2px solid ${o.border}`,
|
|
1658
|
-
cursor: "default",
|
|
1659
|
-
flexShrink: 0
|
|
1660
|
-
}
|
|
1661
|
-
},
|
|
1662
|
-
u
|
|
1663
|
-
)) })
|
|
1664
|
-
] })
|
|
1665
|
-
] }),
|
|
1666
|
-
typeof y == "function" && null,
|
|
1667
|
-
typeof i.bg == "string" && null
|
|
1668
|
-
] });
|
|
1433
|
+
function L({ label: e, ratio: t }) {
|
|
1434
|
+
let n = t >= 4.5, r = t >= 4.5, i = t >= 7;
|
|
1435
|
+
return /* @__PURE__ */ u("div", {
|
|
1436
|
+
style: {
|
|
1437
|
+
display: "flex",
|
|
1438
|
+
alignItems: "center",
|
|
1439
|
+
gap: 6,
|
|
1440
|
+
marginBottom: 4
|
|
1441
|
+
},
|
|
1442
|
+
children: [
|
|
1443
|
+
/* @__PURE__ */ l("span", {
|
|
1444
|
+
style: {
|
|
1445
|
+
fontSize: 11,
|
|
1446
|
+
opacity: .8,
|
|
1447
|
+
minWidth: 140
|
|
1448
|
+
},
|
|
1449
|
+
children: e
|
|
1450
|
+
}),
|
|
1451
|
+
/* @__PURE__ */ u("span", {
|
|
1452
|
+
style: {
|
|
1453
|
+
fontSize: 12,
|
|
1454
|
+
fontWeight: 600
|
|
1455
|
+
},
|
|
1456
|
+
children: [t.toFixed(2), ":1"]
|
|
1457
|
+
}),
|
|
1458
|
+
/* @__PURE__ */ l("span", {
|
|
1459
|
+
style: {
|
|
1460
|
+
fontSize: 11,
|
|
1461
|
+
color: r ? "#22c55e" : "#ef4444"
|
|
1462
|
+
},
|
|
1463
|
+
children: r ? "✓ AA" : "✗ AA"
|
|
1464
|
+
}),
|
|
1465
|
+
/* @__PURE__ */ l("span", {
|
|
1466
|
+
style: {
|
|
1467
|
+
fontSize: 11,
|
|
1468
|
+
color: i ? "#22c55e" : "#888"
|
|
1469
|
+
},
|
|
1470
|
+
children: i ? "✓ AAA" : "— AAA"
|
|
1471
|
+
}),
|
|
1472
|
+
/* @__PURE__ */ l("span", {
|
|
1473
|
+
style: { fontSize: 13 },
|
|
1474
|
+
children: n ? "✅" : "❌"
|
|
1475
|
+
})
|
|
1476
|
+
]
|
|
1477
|
+
});
|
|
1669
1478
|
}
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1479
|
+
function R({ onThemeChange: n, initialHue: r = 210, initialMode: a = "dark" }) {
|
|
1480
|
+
let c = e(), [d, f] = s(a), [p, m] = s(r), [h, g] = s(() => P(a === "dark")), [_, v] = s(!1), [y, b] = s([]), [x, S] = s(!1), C = o(null), w = d === "dark", T = i((e, t) => {
|
|
1481
|
+
g((r) => {
|
|
1482
|
+
let i = {
|
|
1483
|
+
...r,
|
|
1484
|
+
[e]: t
|
|
1485
|
+
};
|
|
1486
|
+
return n?.(i), i;
|
|
1487
|
+
});
|
|
1488
|
+
}, [n]), E = i(() => {
|
|
1489
|
+
if (_) return;
|
|
1490
|
+
v(!0), b([]);
|
|
1491
|
+
let e = 0, t = [], r = () => {
|
|
1492
|
+
e += 60, D.optimizeTheme(p, w, e);
|
|
1493
|
+
let i = e / 600, a = 50 * (1 - i) + 2, o = (Math.random() - .5) * 8 * (1 - i * .8);
|
|
1494
|
+
if (t.push({
|
|
1495
|
+
iteration: e,
|
|
1496
|
+
energy: Math.max(0, a + o)
|
|
1497
|
+
}), b([...t]), e < 600) C.current = window.setTimeout(r, 40);
|
|
1498
|
+
else {
|
|
1499
|
+
let e = D.optimizeTheme(p, w, 1e3);
|
|
1500
|
+
g(e), n?.(e), v(!1);
|
|
1501
|
+
}
|
|
1502
|
+
};
|
|
1503
|
+
C.current = window.setTimeout(r, 16);
|
|
1504
|
+
}, [
|
|
1505
|
+
p,
|
|
1506
|
+
w,
|
|
1507
|
+
_,
|
|
1508
|
+
n
|
|
1509
|
+
]), O = i(() => {
|
|
1510
|
+
let e = d === "dark" ? "light" : "dark";
|
|
1511
|
+
f(e);
|
|
1512
|
+
let t = P(e === "dark");
|
|
1513
|
+
g(t), n?.(t);
|
|
1514
|
+
}, [d, n]), k = i(() => {
|
|
1515
|
+
let e = `export const myTheme = {\n${Object.entries(h).map(([e, t]) => ` ${e}: '${t}',`).join("\n")}\n};`;
|
|
1516
|
+
typeof navigator < "u" && navigator.clipboard && navigator.clipboard.writeText(e).then(() => {
|
|
1517
|
+
S(!0), setTimeout(() => S(!1), 2e3);
|
|
1518
|
+
});
|
|
1519
|
+
}, [h]), A = [
|
|
1520
|
+
{
|
|
1521
|
+
label: "Text on Background",
|
|
1522
|
+
fg: h.text,
|
|
1523
|
+
bg: h.background
|
|
1524
|
+
},
|
|
1525
|
+
{
|
|
1526
|
+
label: "Text on Surface",
|
|
1527
|
+
fg: h.text,
|
|
1528
|
+
bg: h.surface
|
|
1529
|
+
},
|
|
1530
|
+
{
|
|
1531
|
+
label: "Primary on Background",
|
|
1532
|
+
fg: h.primary,
|
|
1533
|
+
bg: h.background
|
|
1534
|
+
},
|
|
1535
|
+
{
|
|
1536
|
+
label: "TextMuted on Background",
|
|
1537
|
+
fg: h.textMuted,
|
|
1538
|
+
bg: h.background
|
|
1539
|
+
}
|
|
1540
|
+
], j = "linear-gradient(to right," + [
|
|
1541
|
+
"hsl(0,80%,55%)",
|
|
1542
|
+
"hsl(30,80%,55%)",
|
|
1543
|
+
"hsl(60,80%,55%)",
|
|
1544
|
+
"hsl(90,80%,55%)",
|
|
1545
|
+
"hsl(120,80%,55%)",
|
|
1546
|
+
"hsl(150,80%,55%)",
|
|
1547
|
+
"hsl(180,80%,55%)",
|
|
1548
|
+
"hsl(210,80%,55%)",
|
|
1549
|
+
"hsl(240,80%,55%)",
|
|
1550
|
+
"hsl(270,80%,55%)",
|
|
1551
|
+
"hsl(300,80%,55%)",
|
|
1552
|
+
"hsl(330,80%,55%)",
|
|
1553
|
+
"hsl(360,80%,55%)"
|
|
1554
|
+
].join(",") + ")", M = {
|
|
1555
|
+
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
1556
|
+
background: h.background,
|
|
1557
|
+
color: h.text,
|
|
1558
|
+
border: `1px solid ${h.border}`,
|
|
1559
|
+
borderRadius: 12,
|
|
1560
|
+
padding: 20,
|
|
1561
|
+
maxWidth: 900,
|
|
1562
|
+
display: "grid",
|
|
1563
|
+
gridTemplateColumns: "1fr 1fr",
|
|
1564
|
+
gap: 20
|
|
1565
|
+
}, N = {
|
|
1566
|
+
background: h.surface,
|
|
1567
|
+
border: `1px solid ${h.border}`,
|
|
1568
|
+
borderRadius: 8,
|
|
1569
|
+
padding: 16
|
|
1570
|
+
}, R = {
|
|
1571
|
+
fontSize: 13,
|
|
1572
|
+
fontWeight: 700,
|
|
1573
|
+
textTransform: "uppercase",
|
|
1574
|
+
letterSpacing: "0.08em",
|
|
1575
|
+
color: h.primary,
|
|
1576
|
+
marginBottom: 12,
|
|
1577
|
+
marginTop: 0
|
|
1578
|
+
}, z = {
|
|
1579
|
+
padding: "8px 16px",
|
|
1580
|
+
borderRadius: 8,
|
|
1581
|
+
border: "none",
|
|
1582
|
+
cursor: "pointer",
|
|
1583
|
+
fontWeight: 600,
|
|
1584
|
+
fontSize: 13,
|
|
1585
|
+
transition: "opacity 0.15s"
|
|
1586
|
+
}, B = t;
|
|
1587
|
+
return /* @__PURE__ */ u("div", {
|
|
1588
|
+
style: M,
|
|
1589
|
+
children: [
|
|
1590
|
+
/* @__PURE__ */ u("div", {
|
|
1591
|
+
style: {
|
|
1592
|
+
display: "flex",
|
|
1593
|
+
flexDirection: "column",
|
|
1594
|
+
gap: 16
|
|
1595
|
+
},
|
|
1596
|
+
children: [
|
|
1597
|
+
/* @__PURE__ */ u("div", {
|
|
1598
|
+
style: {
|
|
1599
|
+
display: "flex",
|
|
1600
|
+
alignItems: "center",
|
|
1601
|
+
justifyContent: "space-between",
|
|
1602
|
+
gridColumn: "1/-1"
|
|
1603
|
+
},
|
|
1604
|
+
children: [/* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("h2", {
|
|
1605
|
+
style: {
|
|
1606
|
+
margin: 0,
|
|
1607
|
+
fontSize: 18,
|
|
1608
|
+
fontWeight: 700
|
|
1609
|
+
},
|
|
1610
|
+
children: "Theme Builder"
|
|
1611
|
+
}), /* @__PURE__ */ l("p", {
|
|
1612
|
+
style: {
|
|
1613
|
+
margin: "2px 0 0",
|
|
1614
|
+
fontSize: 12,
|
|
1615
|
+
color: h.textMuted
|
|
1616
|
+
},
|
|
1617
|
+
children: "Quantum-powered color optimization"
|
|
1618
|
+
})] }), /* @__PURE__ */ l("button", {
|
|
1619
|
+
onClick: O,
|
|
1620
|
+
style: {
|
|
1621
|
+
...z,
|
|
1622
|
+
background: h.surface,
|
|
1623
|
+
color: h.text,
|
|
1624
|
+
border: `1px solid ${h.border}`
|
|
1625
|
+
},
|
|
1626
|
+
children: w ? "☀ Light" : "🌙 Dark"
|
|
1627
|
+
})]
|
|
1628
|
+
}),
|
|
1629
|
+
/* @__PURE__ */ u("div", {
|
|
1630
|
+
style: N,
|
|
1631
|
+
children: [/* @__PURE__ */ l("p", {
|
|
1632
|
+
style: R,
|
|
1633
|
+
children: "Base Hue"
|
|
1634
|
+
}), /* @__PURE__ */ u("div", {
|
|
1635
|
+
style: {
|
|
1636
|
+
display: "flex",
|
|
1637
|
+
alignItems: "center",
|
|
1638
|
+
gap: 10
|
|
1639
|
+
},
|
|
1640
|
+
children: [
|
|
1641
|
+
/* @__PURE__ */ l("div", { style: {
|
|
1642
|
+
width: 24,
|
|
1643
|
+
height: 24,
|
|
1644
|
+
borderRadius: "50%",
|
|
1645
|
+
background: `hsl(${p},70%,55%)`,
|
|
1646
|
+
border: `2px solid ${h.border}`,
|
|
1647
|
+
flexShrink: 0
|
|
1648
|
+
} }),
|
|
1649
|
+
/* @__PURE__ */ l("input", {
|
|
1650
|
+
type: "range",
|
|
1651
|
+
min: 0,
|
|
1652
|
+
max: 360,
|
|
1653
|
+
value: p,
|
|
1654
|
+
onChange: (e) => m(Number(e.target.value)),
|
|
1655
|
+
style: {
|
|
1656
|
+
flex: 1,
|
|
1657
|
+
height: 16,
|
|
1658
|
+
borderRadius: 8,
|
|
1659
|
+
background: j,
|
|
1660
|
+
outline: "none",
|
|
1661
|
+
border: "none",
|
|
1662
|
+
cursor: "pointer",
|
|
1663
|
+
appearance: "none",
|
|
1664
|
+
WebkitAppearance: "none"
|
|
1665
|
+
}
|
|
1666
|
+
}),
|
|
1667
|
+
/* @__PURE__ */ u("span", {
|
|
1668
|
+
style: {
|
|
1669
|
+
fontSize: 13,
|
|
1670
|
+
fontFamily: "monospace",
|
|
1671
|
+
minWidth: 32
|
|
1672
|
+
},
|
|
1673
|
+
children: [p, "°"]
|
|
1674
|
+
})
|
|
1675
|
+
]
|
|
1676
|
+
})]
|
|
1677
|
+
}),
|
|
1678
|
+
/* @__PURE__ */ u("div", {
|
|
1679
|
+
style: N,
|
|
1680
|
+
children: [/* @__PURE__ */ u("div", {
|
|
1681
|
+
style: {
|
|
1682
|
+
display: "flex",
|
|
1683
|
+
alignItems: "center",
|
|
1684
|
+
gap: 8,
|
|
1685
|
+
marginBottom: 10
|
|
1686
|
+
},
|
|
1687
|
+
children: [/* @__PURE__ */ l("button", {
|
|
1688
|
+
onClick: E,
|
|
1689
|
+
disabled: _,
|
|
1690
|
+
style: {
|
|
1691
|
+
...z,
|
|
1692
|
+
background: _ ? h.border : h.primary,
|
|
1693
|
+
color: w ? "#000" : "#fff",
|
|
1694
|
+
opacity: _ ? .7 : 1,
|
|
1695
|
+
flex: 1
|
|
1696
|
+
},
|
|
1697
|
+
children: _ ? "⟳ Optimizing..." : "⚛ Generate with Quantum Annealing"
|
|
1698
|
+
}), /* @__PURE__ */ l("div", {
|
|
1699
|
+
style: {
|
|
1700
|
+
padding: "3px 8px",
|
|
1701
|
+
background: h.primary + "22",
|
|
1702
|
+
border: `1px solid ${h.primary}44`,
|
|
1703
|
+
borderRadius: 20,
|
|
1704
|
+
fontSize: 10,
|
|
1705
|
+
color: h.primary,
|
|
1706
|
+
fontWeight: 700,
|
|
1707
|
+
whiteSpace: "nowrap"
|
|
1708
|
+
},
|
|
1709
|
+
children: "⚛ Quantum Annealing"
|
|
1710
|
+
})]
|
|
1711
|
+
}), (_ || y.length > 0) && /* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("p", {
|
|
1712
|
+
style: {
|
|
1713
|
+
fontSize: 11,
|
|
1714
|
+
color: h.textMuted,
|
|
1715
|
+
margin: "0 0 4px"
|
|
1716
|
+
},
|
|
1717
|
+
children: "Energy landscape (lower = better palette)"
|
|
1718
|
+
}), /* @__PURE__ */ l(F, {
|
|
1719
|
+
points: y,
|
|
1720
|
+
primary: h.primary
|
|
1721
|
+
})] })]
|
|
1722
|
+
}),
|
|
1723
|
+
/* @__PURE__ */ u("div", {
|
|
1724
|
+
style: N,
|
|
1725
|
+
children: [/* @__PURE__ */ l("p", {
|
|
1726
|
+
style: R,
|
|
1727
|
+
children: "Color Tokens"
|
|
1728
|
+
}), Object.keys(h).map((e) => /* @__PURE__ */ l(I, {
|
|
1729
|
+
label: e,
|
|
1730
|
+
value: h[e],
|
|
1731
|
+
onChange: (t) => T(e, t),
|
|
1732
|
+
text: h.text,
|
|
1733
|
+
border: h.border
|
|
1734
|
+
}, e))]
|
|
1735
|
+
}),
|
|
1736
|
+
/* @__PURE__ */ l("button", {
|
|
1737
|
+
onClick: k,
|
|
1738
|
+
style: {
|
|
1739
|
+
...z,
|
|
1740
|
+
background: h.accent,
|
|
1741
|
+
color: "#fff",
|
|
1742
|
+
width: "100%"
|
|
1743
|
+
},
|
|
1744
|
+
children: x ? "✓ Copied to Clipboard!" : "⬇ Export Theme"
|
|
1745
|
+
})
|
|
1746
|
+
]
|
|
1747
|
+
}),
|
|
1748
|
+
/* @__PURE__ */ u("div", {
|
|
1749
|
+
style: {
|
|
1750
|
+
display: "flex",
|
|
1751
|
+
flexDirection: "column",
|
|
1752
|
+
gap: 16
|
|
1753
|
+
},
|
|
1754
|
+
children: [
|
|
1755
|
+
/* @__PURE__ */ u("div", {
|
|
1756
|
+
style: N,
|
|
1757
|
+
children: [
|
|
1758
|
+
/* @__PURE__ */ l("p", {
|
|
1759
|
+
style: R,
|
|
1760
|
+
children: "Live Preview"
|
|
1761
|
+
}),
|
|
1762
|
+
/* @__PURE__ */ u("div", {
|
|
1763
|
+
style: { marginBottom: 12 },
|
|
1764
|
+
children: [/* @__PURE__ */ l("p", {
|
|
1765
|
+
style: {
|
|
1766
|
+
fontSize: 11,
|
|
1767
|
+
color: h.textMuted,
|
|
1768
|
+
margin: "0 0 6px"
|
|
1769
|
+
},
|
|
1770
|
+
children: "Buttons"
|
|
1771
|
+
}), /* @__PURE__ */ u("div", {
|
|
1772
|
+
style: {
|
|
1773
|
+
display: "flex",
|
|
1774
|
+
gap: 8,
|
|
1775
|
+
flexWrap: "wrap"
|
|
1776
|
+
},
|
|
1777
|
+
children: [
|
|
1778
|
+
/* @__PURE__ */ l("button", {
|
|
1779
|
+
style: {
|
|
1780
|
+
padding: "8px 16px",
|
|
1781
|
+
borderRadius: 8,
|
|
1782
|
+
border: "none",
|
|
1783
|
+
background: h.primary,
|
|
1784
|
+
color: w ? "#000" : "#fff",
|
|
1785
|
+
fontWeight: 600,
|
|
1786
|
+
fontSize: 13,
|
|
1787
|
+
cursor: "pointer"
|
|
1788
|
+
},
|
|
1789
|
+
children: "Primary"
|
|
1790
|
+
}),
|
|
1791
|
+
/* @__PURE__ */ l("button", {
|
|
1792
|
+
style: {
|
|
1793
|
+
padding: "8px 16px",
|
|
1794
|
+
borderRadius: 8,
|
|
1795
|
+
border: "none",
|
|
1796
|
+
background: h.secondary,
|
|
1797
|
+
color: "#fff",
|
|
1798
|
+
fontWeight: 600,
|
|
1799
|
+
fontSize: 13,
|
|
1800
|
+
cursor: "pointer"
|
|
1801
|
+
},
|
|
1802
|
+
children: "Secondary"
|
|
1803
|
+
}),
|
|
1804
|
+
/* @__PURE__ */ l("button", {
|
|
1805
|
+
style: {
|
|
1806
|
+
padding: "8px 16px",
|
|
1807
|
+
borderRadius: 8,
|
|
1808
|
+
border: `1px solid ${h.border}`,
|
|
1809
|
+
background: "transparent",
|
|
1810
|
+
color: h.text,
|
|
1811
|
+
fontWeight: 600,
|
|
1812
|
+
fontSize: 13,
|
|
1813
|
+
cursor: "pointer"
|
|
1814
|
+
},
|
|
1815
|
+
children: "Outline"
|
|
1816
|
+
})
|
|
1817
|
+
]
|
|
1818
|
+
})]
|
|
1819
|
+
}),
|
|
1820
|
+
/* @__PURE__ */ u("div", {
|
|
1821
|
+
style: { marginBottom: 12 },
|
|
1822
|
+
children: [/* @__PURE__ */ l("p", {
|
|
1823
|
+
style: {
|
|
1824
|
+
fontSize: 11,
|
|
1825
|
+
color: h.textMuted,
|
|
1826
|
+
margin: "0 0 6px"
|
|
1827
|
+
},
|
|
1828
|
+
children: "Card"
|
|
1829
|
+
}), /* @__PURE__ */ u("div", {
|
|
1830
|
+
style: {
|
|
1831
|
+
background: h.surface,
|
|
1832
|
+
border: `1px solid ${h.border}`,
|
|
1833
|
+
borderRadius: 8,
|
|
1834
|
+
padding: 12
|
|
1835
|
+
},
|
|
1836
|
+
children: [
|
|
1837
|
+
/* @__PURE__ */ l("div", {
|
|
1838
|
+
style: {
|
|
1839
|
+
fontSize: 14,
|
|
1840
|
+
fontWeight: 700,
|
|
1841
|
+
marginBottom: 4
|
|
1842
|
+
},
|
|
1843
|
+
children: "Card Title"
|
|
1844
|
+
}),
|
|
1845
|
+
/* @__PURE__ */ l("div", {
|
|
1846
|
+
style: {
|
|
1847
|
+
fontSize: 12,
|
|
1848
|
+
color: h.textMuted,
|
|
1849
|
+
lineHeight: 1.4
|
|
1850
|
+
},
|
|
1851
|
+
children: "Sample card with surface background and muted text content."
|
|
1852
|
+
}),
|
|
1853
|
+
/* @__PURE__ */ u("div", {
|
|
1854
|
+
style: {
|
|
1855
|
+
marginTop: 8,
|
|
1856
|
+
display: "flex",
|
|
1857
|
+
gap: 6
|
|
1858
|
+
},
|
|
1859
|
+
children: [/* @__PURE__ */ l("span", {
|
|
1860
|
+
style: {
|
|
1861
|
+
padding: "2px 8px",
|
|
1862
|
+
borderRadius: 20,
|
|
1863
|
+
background: h.primary + "33",
|
|
1864
|
+
color: h.primary,
|
|
1865
|
+
fontSize: 11,
|
|
1866
|
+
fontWeight: 600
|
|
1867
|
+
},
|
|
1868
|
+
children: "Tag"
|
|
1869
|
+
}), /* @__PURE__ */ l("span", {
|
|
1870
|
+
style: {
|
|
1871
|
+
padding: "2px 8px",
|
|
1872
|
+
borderRadius: 20,
|
|
1873
|
+
background: h.accent + "33",
|
|
1874
|
+
color: h.accent,
|
|
1875
|
+
fontSize: 11,
|
|
1876
|
+
fontWeight: 600
|
|
1877
|
+
},
|
|
1878
|
+
children: "Accent"
|
|
1879
|
+
})]
|
|
1880
|
+
})
|
|
1881
|
+
]
|
|
1882
|
+
})]
|
|
1883
|
+
}),
|
|
1884
|
+
/* @__PURE__ */ u("div", {
|
|
1885
|
+
style: { marginBottom: 12 },
|
|
1886
|
+
children: [/* @__PURE__ */ l("p", {
|
|
1887
|
+
style: {
|
|
1888
|
+
fontSize: 11,
|
|
1889
|
+
color: h.textMuted,
|
|
1890
|
+
margin: "0 0 6px"
|
|
1891
|
+
},
|
|
1892
|
+
children: "Input"
|
|
1893
|
+
}), /* @__PURE__ */ l("input", {
|
|
1894
|
+
type: "text",
|
|
1895
|
+
placeholder: "Type something...",
|
|
1896
|
+
readOnly: !0,
|
|
1897
|
+
style: {
|
|
1898
|
+
width: "100%",
|
|
1899
|
+
padding: "8px 12px",
|
|
1900
|
+
borderRadius: 8,
|
|
1901
|
+
border: `1px solid ${h.border}`,
|
|
1902
|
+
background: h.background,
|
|
1903
|
+
color: h.text,
|
|
1904
|
+
fontSize: 13,
|
|
1905
|
+
outline: "none",
|
|
1906
|
+
boxSizing: "border-box"
|
|
1907
|
+
}
|
|
1908
|
+
})]
|
|
1909
|
+
}),
|
|
1910
|
+
/* @__PURE__ */ u("div", {
|
|
1911
|
+
style: { marginBottom: 12 },
|
|
1912
|
+
children: [/* @__PURE__ */ l("p", {
|
|
1913
|
+
style: {
|
|
1914
|
+
fontSize: 11,
|
|
1915
|
+
color: h.textMuted,
|
|
1916
|
+
margin: "0 0 6px"
|
|
1917
|
+
},
|
|
1918
|
+
children: "Progress"
|
|
1919
|
+
}), /* @__PURE__ */ l("div", {
|
|
1920
|
+
style: {
|
|
1921
|
+
height: 8,
|
|
1922
|
+
borderRadius: 4,
|
|
1923
|
+
background: h.border,
|
|
1924
|
+
overflow: "hidden"
|
|
1925
|
+
},
|
|
1926
|
+
children: /* @__PURE__ */ l("div", { style: {
|
|
1927
|
+
height: "100%",
|
|
1928
|
+
width: "68%",
|
|
1929
|
+
background: `linear-gradient(to right, ${h.primary}, ${h.accent})`,
|
|
1930
|
+
borderRadius: 4,
|
|
1931
|
+
transition: "width 0.4s ease"
|
|
1932
|
+
} })
|
|
1933
|
+
})]
|
|
1934
|
+
}),
|
|
1935
|
+
/* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("p", {
|
|
1936
|
+
style: {
|
|
1937
|
+
fontSize: 11,
|
|
1938
|
+
color: h.textMuted,
|
|
1939
|
+
margin: "0 0 6px"
|
|
1940
|
+
},
|
|
1941
|
+
children: "Status Badges"
|
|
1942
|
+
}), /* @__PURE__ */ l("div", {
|
|
1943
|
+
style: {
|
|
1944
|
+
display: "flex",
|
|
1945
|
+
gap: 6,
|
|
1946
|
+
flexWrap: "wrap"
|
|
1947
|
+
},
|
|
1948
|
+
children: [
|
|
1949
|
+
{
|
|
1950
|
+
label: "Error",
|
|
1951
|
+
color: h.error
|
|
1952
|
+
},
|
|
1953
|
+
{
|
|
1954
|
+
label: "Warning",
|
|
1955
|
+
color: h.warning
|
|
1956
|
+
},
|
|
1957
|
+
{
|
|
1958
|
+
label: "Success",
|
|
1959
|
+
color: h.success
|
|
1960
|
+
}
|
|
1961
|
+
].map(({ label: e, color: t }) => /* @__PURE__ */ l("span", {
|
|
1962
|
+
style: {
|
|
1963
|
+
padding: "3px 10px",
|
|
1964
|
+
borderRadius: 4,
|
|
1965
|
+
background: t + "22",
|
|
1966
|
+
color: t,
|
|
1967
|
+
border: `1px solid ${t}44`,
|
|
1968
|
+
fontSize: 11,
|
|
1969
|
+
fontWeight: 700
|
|
1970
|
+
},
|
|
1971
|
+
children: e
|
|
1972
|
+
}, e))
|
|
1973
|
+
})] })
|
|
1974
|
+
]
|
|
1975
|
+
}),
|
|
1976
|
+
/* @__PURE__ */ u("div", {
|
|
1977
|
+
style: N,
|
|
1978
|
+
children: [
|
|
1979
|
+
/* @__PURE__ */ l("p", {
|
|
1980
|
+
style: R,
|
|
1981
|
+
children: "WCAG Contrast Check"
|
|
1982
|
+
}),
|
|
1983
|
+
A.map((e) => /* @__PURE__ */ l(L, {
|
|
1984
|
+
label: e.label,
|
|
1985
|
+
ratio: D.contrast(e.fg, e.bg)
|
|
1986
|
+
}, e.label)),
|
|
1987
|
+
/* @__PURE__ */ l("p", {
|
|
1988
|
+
style: {
|
|
1989
|
+
fontSize: 10,
|
|
1990
|
+
color: h.textMuted,
|
|
1991
|
+
marginTop: 8,
|
|
1992
|
+
marginBottom: 0
|
|
1993
|
+
},
|
|
1994
|
+
children: "AA requires 4.5:1 (normal text). AAA requires 7:1."
|
|
1995
|
+
})
|
|
1996
|
+
]
|
|
1997
|
+
}),
|
|
1998
|
+
/* @__PURE__ */ u("div", {
|
|
1999
|
+
style: N,
|
|
2000
|
+
children: [/* @__PURE__ */ l("p", {
|
|
2001
|
+
style: R,
|
|
2002
|
+
children: "Color Palette"
|
|
2003
|
+
}), /* @__PURE__ */ l("div", {
|
|
2004
|
+
style: {
|
|
2005
|
+
display: "flex",
|
|
2006
|
+
gap: 4,
|
|
2007
|
+
flexWrap: "wrap"
|
|
2008
|
+
},
|
|
2009
|
+
children: Object.entries(h).map(([e, t]) => /* @__PURE__ */ l("div", {
|
|
2010
|
+
title: `${e}: ${t}`,
|
|
2011
|
+
style: {
|
|
2012
|
+
width: 36,
|
|
2013
|
+
height: 36,
|
|
2014
|
+
borderRadius: 6,
|
|
2015
|
+
background: t,
|
|
2016
|
+
border: `2px solid ${h.border}`,
|
|
2017
|
+
cursor: "default",
|
|
2018
|
+
flexShrink: 0
|
|
2019
|
+
}
|
|
2020
|
+
}, e))
|
|
2021
|
+
})]
|
|
2022
|
+
})
|
|
2023
|
+
]
|
|
2024
|
+
}),
|
|
2025
|
+
typeof B == "function" && null,
|
|
2026
|
+
typeof c.bg == "string" && null
|
|
2027
|
+
]
|
|
2028
|
+
});
|
|
1784
2029
|
}
|
|
1785
|
-
|
|
1786
|
-
|
|
2030
|
+
//#endregion
|
|
2031
|
+
//#region src/components/TkxPlayground.tsx
|
|
2032
|
+
var z = [
|
|
2033
|
+
{
|
|
2034
|
+
label: "Hello World",
|
|
2035
|
+
code: "<div style={{ padding: 24, fontFamily: 'sans-serif', color: '#e8e8f4' }}>\n <h2 style={{ margin: 0 }}>👋 Hello, TkxPlayground!</h2>\n <p style={{ marginTop: 8, opacity: 0.7 }}>Edit the code on the left to see live updates.</p>\n</div>"
|
|
2036
|
+
},
|
|
2037
|
+
{
|
|
2038
|
+
label: "Button Styles",
|
|
2039
|
+
code: "<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', padding: 24 }}>\n {['primary', 'success', 'danger', 'warning', 'info'].map(color => (\n <button\n key={color}\n style={{\n padding: '8px 18px',\n borderRadius: 8,\n border: 'none',\n background: color === 'primary' ? '#00f5d4' : color === 'success' ? '#06d6a0' : color === 'danger' ? '#f72585' : color === 'warning' ? '#ffbe0b' : '#3a86ff',\n color: '#0a0a0f',\n fontWeight: 700,\n cursor: 'pointer',\n textTransform: 'capitalize',\n }}\n >\n {color}\n </button>\n ))}\n</div>"
|
|
2040
|
+
},
|
|
2041
|
+
{
|
|
2042
|
+
label: "Card Grid",
|
|
2043
|
+
code: "<div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 16, padding: 24 }}>\n {['Alpha', 'Beta', 'Gamma', 'Delta', 'Epsilon', 'Zeta'].map(name => (\n <div key={name} style={{\n background: '#1a1a2e',\n borderRadius: 10,\n border: '1px solid #2a2a3e',\n padding: '16px',\n }}>\n <div style={{ fontWeight: 700, color: '#00f5d4', marginBottom: 4 }}>{name}</div>\n <div style={{ fontSize: 12, color: '#8888aa' }}>Quantum module {name.toLowerCase()}</div>\n </div>\n ))}\n</div>"
|
|
2044
|
+
},
|
|
2045
|
+
{
|
|
2046
|
+
label: "Animated Counter",
|
|
2047
|
+
code: "(() => {\n const [count, setCount] = React.useState(0);\n return (\n <div style={{ padding: 32, textAlign: 'center', fontFamily: 'sans-serif' }}>\n <div style={{ fontSize: 64, fontWeight: 900, color: '#00f5d4', marginBottom: 16 }}>\n {count}\n </div>\n <div style={{ display: 'flex', gap: 12, justifyContent: 'center' }}>\n <button onClick={() => setCount(c => c - 1)} style={{ padding: '8px 20px', borderRadius: 8, border: '1px solid #2a2a3e', background: '#1a1a2e', color: '#e8e8f4', fontSize: 20, cursor: 'pointer' }}>−</button>\n <button onClick={() => setCount(0)} style={{ padding: '8px 20px', borderRadius: 8, border: '1px solid #2a2a3e', background: '#1a1a2e', color: '#8888aa', cursor: 'pointer' }}>Reset</button>\n <button onClick={() => setCount(c => c + 1)} style={{ padding: '8px 20px', borderRadius: 8, border: '1px solid #2a2a3e', background: '#1a1a2e', color: '#e8e8f4', fontSize: 20, cursor: 'pointer' }}>+</button>\n </div>\n </div>\n );\n})()"
|
|
2048
|
+
},
|
|
2049
|
+
{
|
|
2050
|
+
label: "Data Table",
|
|
2051
|
+
code: "(() => {\n const rows = [\n { id: 1, name: 'Hydrogen', symbol: 'H', mass: 1.008 },\n { id: 2, name: 'Helium', symbol: 'He', mass: 4.003 },\n { id: 3, name: 'Lithium', symbol: 'Li', mass: 6.941 },\n { id: 4, name: 'Carbon', symbol: 'C', mass: 12.011 },\n { id: 5, name: 'Nitrogen', symbol: 'N', mass: 14.007 },\n ];\n const cell = { padding: '8px 14px', borderBottom: '1px solid #2a2a3e', color: '#e8e8f4', fontSize: 13 };\n const hcell = { ...cell, color: '#8888aa', fontWeight: 600, fontSize: 11, textTransform: 'uppercase', letterSpacing: '0.06em' };\n return (\n <div style={{ padding: 16 }}>\n <table style={{ width: '100%', borderCollapse: 'collapse', fontFamily: 'sans-serif' }}>\n <thead>\n <tr>{['ID','Element','Symbol','Atomic Mass'].map(h => <th key={h} style={hcell}>{h}</th>)}</tr>\n </thead>\n <tbody>\n {rows.map(r => (\n <tr key={r.id} style={{ transition: 'background 0.15s' }}>\n <td style={cell}>{r.id}</td>\n <td style={cell}>{r.name}</td>\n <td style={{ ...cell, color: '#00f5d4', fontWeight: 700 }}>{r.symbol}</td>\n <td style={cell}>{r.mass}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n})()"
|
|
2052
|
+
}
|
|
2053
|
+
], B = class extends r.Component {
|
|
2054
|
+
constructor(e) {
|
|
2055
|
+
super(e), this.state = { hasError: !1 };
|
|
2056
|
+
}
|
|
2057
|
+
static getDerivedStateFromError() {
|
|
2058
|
+
return { hasError: !0 };
|
|
2059
|
+
}
|
|
2060
|
+
componentDidCatch(e) {
|
|
2061
|
+
this.props.onError(e.message);
|
|
2062
|
+
}
|
|
2063
|
+
componentDidUpdate(e) {
|
|
2064
|
+
e.children !== this.props.children && this.state.hasError && this.setState({ hasError: !1 });
|
|
2065
|
+
}
|
|
2066
|
+
render() {
|
|
2067
|
+
return this.state.hasError ? null : this.props.children;
|
|
2068
|
+
}
|
|
2069
|
+
};
|
|
2070
|
+
function V() {
|
|
2071
|
+
return typeof window > "u" ? null : window.Babel ?? null;
|
|
1787
2072
|
}
|
|
1788
|
-
function
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
let s = `
|
|
2073
|
+
function H(e, t) {
|
|
2074
|
+
let n = performance.now();
|
|
2075
|
+
try {
|
|
2076
|
+
let i = e.trim(), a = `
|
|
1793
2077
|
function PlaygroundRoot() {
|
|
1794
2078
|
${i.startsWith("<") || i.startsWith("(") ? `return (${i});` : i}
|
|
1795
2079
|
}
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
const p = new Function(
|
|
1803
|
-
"React",
|
|
1804
|
-
"imports",
|
|
1805
|
-
`
|
|
2080
|
+
`, o = V();
|
|
2081
|
+
o && (a = o.transform(a, {
|
|
2082
|
+
presets: ["react"],
|
|
2083
|
+
filename: "playground.jsx"
|
|
2084
|
+
}).code ?? a);
|
|
2085
|
+
let s = Function("React", "imports", `
|
|
1806
2086
|
"use strict";
|
|
1807
|
-
const { ${Object.keys(
|
|
1808
|
-
${
|
|
2087
|
+
const { ${Object.keys(t).join(", ")} } = imports;
|
|
2088
|
+
${a}
|
|
1809
2089
|
return PlaygroundRoot;
|
|
1810
|
-
`
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
2090
|
+
`)(r, t);
|
|
2091
|
+
return {
|
|
2092
|
+
element: r.createElement(s),
|
|
2093
|
+
error: null,
|
|
2094
|
+
renderMs: parseFloat((performance.now() - n).toFixed(2))
|
|
2095
|
+
};
|
|
2096
|
+
} catch (e) {
|
|
2097
|
+
let t = parseFloat((performance.now() - n).toFixed(2));
|
|
2098
|
+
return {
|
|
2099
|
+
element: null,
|
|
2100
|
+
error: e instanceof Error ? e.message : String(e),
|
|
2101
|
+
renderMs: t
|
|
2102
|
+
};
|
|
2103
|
+
}
|
|
1817
2104
|
}
|
|
1818
|
-
function
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
},
|
|
1841
|
-
children: n.map((i, t) => /* @__PURE__ */ a("div", { children: t + 1 }, t))
|
|
1842
|
-
}
|
|
1843
|
-
);
|
|
2105
|
+
function U({ code: e, lineHeight: t }) {
|
|
2106
|
+
let n = e.split("\n");
|
|
2107
|
+
return /* @__PURE__ */ l("div", {
|
|
2108
|
+
"aria-hidden": "true",
|
|
2109
|
+
style: {
|
|
2110
|
+
position: "absolute",
|
|
2111
|
+
top: 0,
|
|
2112
|
+
left: 0,
|
|
2113
|
+
width: "36px",
|
|
2114
|
+
padding: "12px 0",
|
|
2115
|
+
textAlign: "right",
|
|
2116
|
+
paddingRight: "8px",
|
|
2117
|
+
userSelect: "none",
|
|
2118
|
+
pointerEvents: "none",
|
|
2119
|
+
fontSize: "12px",
|
|
2120
|
+
lineHeight: `${t}px`,
|
|
2121
|
+
color: "#555577",
|
|
2122
|
+
fontFamily: "\"Fira Code\", \"Cascadia Code\", \"Consolas\", monospace",
|
|
2123
|
+
boxSizing: "border-box"
|
|
2124
|
+
},
|
|
2125
|
+
children: n.map((e, t) => /* @__PURE__ */ l("div", { children: t + 1 }, t))
|
|
2126
|
+
});
|
|
1844
2127
|
}
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
"TkxModal",
|
|
1850
|
-
"TkxTable",
|
|
1851
|
-
"TkxSelect",
|
|
1852
|
-
"TkxCheckbox",
|
|
1853
|
-
"TkxRadio",
|
|
1854
|
-
"TkxSwitch",
|
|
1855
|
-
"TkxSlider",
|
|
1856
|
-
"TkxBadge",
|
|
1857
|
-
"TkxAlert",
|
|
1858
|
-
"TkxToast",
|
|
1859
|
-
"TkxTooltip",
|
|
1860
|
-
"TkxPopover",
|
|
1861
|
-
"TkxTabs",
|
|
1862
|
-
"TkxAccordion",
|
|
1863
|
-
"TkxDrawer",
|
|
1864
|
-
"TkxDropdown",
|
|
1865
|
-
"TkxMenu",
|
|
1866
|
-
"TkxForm",
|
|
1867
|
-
"TkxDataGrid",
|
|
1868
|
-
"TkxChart",
|
|
1869
|
-
"TkxSpinner",
|
|
1870
|
-
"TkxSkeleton",
|
|
1871
|
-
"TkxAvatar",
|
|
1872
|
-
"TkxTag",
|
|
1873
|
-
"TkxDivider",
|
|
1874
|
-
"TkxProgress",
|
|
1875
|
-
"TkxStatistic",
|
|
1876
|
-
"TkxQuantumForm",
|
|
1877
|
-
"TkxPlayground"
|
|
1878
|
-
], $e = new ee();
|
|
1879
|
-
function se(r) {
|
|
1880
|
-
const e = r.match(/([A-Z][a-zA-Z0-9]*)$/);
|
|
1881
|
-
return e ? e[1] : "";
|
|
2128
|
+
var W = /* @__PURE__ */ "TkxButton.TkxInput.TkxCard.TkxModal.TkxTable.TkxSelect.TkxCheckbox.TkxRadio.TkxSwitch.TkxSlider.TkxBadge.TkxAlert.TkxToast.TkxTooltip.TkxPopover.TkxTabs.TkxAccordion.TkxDrawer.TkxDropdown.TkxMenu.TkxForm.TkxDataGrid.TkxChart.TkxSpinner.TkxSkeleton.TkxAvatar.TkxTag.TkxDivider.TkxProgress.TkxStatistic.TkxQuantumForm.TkxPlayground".split("."), G = new g();
|
|
2129
|
+
function K(e) {
|
|
2130
|
+
let t = e.match(/([A-Z][a-zA-Z0-9]*)$/);
|
|
2131
|
+
return t ? t[1] : "";
|
|
1882
2132
|
}
|
|
1883
|
-
function
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
0.1
|
|
1898
|
-
).slice(0, e).map((t) => ({
|
|
1899
|
-
name: ae[t.index] ?? "",
|
|
1900
|
-
amplitude: parseFloat(t.combined.toFixed(3))
|
|
1901
|
-
})).filter((t) => t.name !== "");
|
|
2133
|
+
function q(e, t = 4) {
|
|
2134
|
+
if (!e || e.length < 2) return [];
|
|
2135
|
+
let n = e.toLowerCase();
|
|
2136
|
+
return G.amplify(W, (e) => {
|
|
2137
|
+
let t = e.toLowerCase();
|
|
2138
|
+
if (t.startsWith(n)) return 1;
|
|
2139
|
+
if (t.includes(n)) return .7;
|
|
2140
|
+
let r = 0;
|
|
2141
|
+
for (let e = 0; e < n.length - 1; e++) t.includes(n.slice(e, e + 2)) && (r += .15);
|
|
2142
|
+
return Math.min(r, .5);
|
|
2143
|
+
}, .1).slice(0, t).map((e) => ({
|
|
2144
|
+
name: W[e.index] ?? "",
|
|
2145
|
+
amplitude: parseFloat(e.combined.toFixed(3))
|
|
2146
|
+
})).filter((e) => e.name !== "");
|
|
1902
2147
|
}
|
|
1903
|
-
function
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
}) {
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
style: {
|
|
2259
|
-
width: "6px",
|
|
2260
|
-
height: "6px",
|
|
2261
|
-
borderRadius: "50%",
|
|
2262
|
-
backgroundColor: y ? t.danger : t.success,
|
|
2263
|
-
display: "inline-block"
|
|
2264
|
-
}
|
|
2265
|
-
}
|
|
2266
|
-
),
|
|
2267
|
-
y ? "Error" : "OK"
|
|
2268
|
-
]
|
|
2269
|
-
}
|
|
2270
|
-
),
|
|
2271
|
-
/* @__PURE__ */ c("span", { children: [
|
|
2272
|
-
"⏱ ",
|
|
2273
|
-
p.renderMs,
|
|
2274
|
-
" ms"
|
|
2275
|
-
] }),
|
|
2276
|
-
/* @__PURE__ */ c("span", { children: [
|
|
2277
|
-
d.split(`
|
|
2278
|
-
`).length,
|
|
2279
|
-
" lines"
|
|
2280
|
-
] }),
|
|
2281
|
-
/* @__PURE__ */ c("span", { children: [
|
|
2282
|
-
d.length,
|
|
2283
|
-
" chars"
|
|
2284
|
-
] }),
|
|
2285
|
-
b.length > 0 && /* @__PURE__ */ c("span", { style: { marginLeft: "auto", color: t.primary, fontWeight: 600 }, children: [
|
|
2286
|
-
"⚛ ",
|
|
2287
|
-
b.length,
|
|
2288
|
-
" suggestion",
|
|
2289
|
-
b.length > 1 ? "s" : ""
|
|
2290
|
-
] })
|
|
2291
|
-
]
|
|
2292
|
-
}
|
|
2293
|
-
)
|
|
2294
|
-
]
|
|
2295
|
-
}
|
|
2296
|
-
);
|
|
2148
|
+
function J({ defaultCode: t, examples: n, height: r = 480, imports: c = {} }) {
|
|
2149
|
+
let d = e(), f = [...z, ...n ?? []], p = t ?? z[0].code, [m, h] = s(p), [g, _] = s({
|
|
2150
|
+
element: null,
|
|
2151
|
+
error: null,
|
|
2152
|
+
renderMs: 0
|
|
2153
|
+
}), [v, y] = s(null), [b, x] = s([]), [S, C] = s(!1), [w, T] = s(0), E = o(null), D = o(null), O = i((e) => {
|
|
2154
|
+
y(null), _(H(e, c));
|
|
2155
|
+
}, [c]);
|
|
2156
|
+
a(() => (D.current && clearTimeout(D.current), D.current = setTimeout(() => O(m), 300), () => {
|
|
2157
|
+
D.current && clearTimeout(D.current);
|
|
2158
|
+
}), [m, O]), a(() => {
|
|
2159
|
+
O(p);
|
|
2160
|
+
}, []);
|
|
2161
|
+
let k = i((e) => {
|
|
2162
|
+
let t = e.target.value;
|
|
2163
|
+
h(t);
|
|
2164
|
+
let n = K(t);
|
|
2165
|
+
n.length >= 2 ? x(q(n, 4)) : x([]);
|
|
2166
|
+
}, []), A = i((e) => {
|
|
2167
|
+
let t = f[e];
|
|
2168
|
+
t && (T(e), h(t.code), x([]));
|
|
2169
|
+
}, [f]), j = i(async () => {
|
|
2170
|
+
try {
|
|
2171
|
+
await navigator.clipboard.writeText(m), C(!0), setTimeout(() => C(!1), 1500);
|
|
2172
|
+
} catch {}
|
|
2173
|
+
}, [m]), M = i(() => {
|
|
2174
|
+
h(p), T(0), x([]);
|
|
2175
|
+
}, [p]), N = i((e) => {
|
|
2176
|
+
let t = K(m);
|
|
2177
|
+
t && h((n) => n.slice(0, n.lastIndexOf(t)) + e), x([]);
|
|
2178
|
+
}, [m]), P = g.error !== null || v !== null, F = g.error ?? v ?? "", I = d.bg, L = d.surfaceAlt, R = d.border, V = d.surface, W = {
|
|
2179
|
+
width: "50%",
|
|
2180
|
+
display: "flex",
|
|
2181
|
+
flexDirection: "column",
|
|
2182
|
+
borderRight: `1px solid ${R}`,
|
|
2183
|
+
position: "relative"
|
|
2184
|
+
}, G = {
|
|
2185
|
+
display: "flex",
|
|
2186
|
+
alignItems: "center",
|
|
2187
|
+
gap: "6px",
|
|
2188
|
+
padding: "6px 10px",
|
|
2189
|
+
borderBottom: `1px solid ${R}`,
|
|
2190
|
+
backgroundColor: d.surface,
|
|
2191
|
+
flexWrap: "wrap"
|
|
2192
|
+
}, J = {
|
|
2193
|
+
padding: "3px 10px",
|
|
2194
|
+
borderRadius: "6px",
|
|
2195
|
+
border: `1px solid ${R}`,
|
|
2196
|
+
backgroundColor: "transparent",
|
|
2197
|
+
color: d.textMuted,
|
|
2198
|
+
fontSize: "11px",
|
|
2199
|
+
fontWeight: 600,
|
|
2200
|
+
cursor: "pointer",
|
|
2201
|
+
fontFamily: "inherit",
|
|
2202
|
+
transition: "color 0.15s, border-color 0.15s"
|
|
2203
|
+
};
|
|
2204
|
+
return /* @__PURE__ */ u("div", {
|
|
2205
|
+
style: {
|
|
2206
|
+
display: "flex",
|
|
2207
|
+
flexDirection: "column",
|
|
2208
|
+
border: `1px solid ${R}`,
|
|
2209
|
+
borderRadius: "12px",
|
|
2210
|
+
overflow: "hidden",
|
|
2211
|
+
backgroundColor: I,
|
|
2212
|
+
fontFamily: "inherit",
|
|
2213
|
+
boxSizing: "border-box",
|
|
2214
|
+
position: "relative"
|
|
2215
|
+
},
|
|
2216
|
+
children: [
|
|
2217
|
+
/* @__PURE__ */ u("div", {
|
|
2218
|
+
style: {
|
|
2219
|
+
display: "flex",
|
|
2220
|
+
alignItems: "center",
|
|
2221
|
+
justifyContent: "space-between",
|
|
2222
|
+
padding: "8px 14px",
|
|
2223
|
+
borderBottom: `1px solid ${R}`,
|
|
2224
|
+
backgroundColor: d.surface
|
|
2225
|
+
},
|
|
2226
|
+
children: [/* @__PURE__ */ l("span", {
|
|
2227
|
+
style: {
|
|
2228
|
+
fontSize: "12px",
|
|
2229
|
+
fontWeight: 700,
|
|
2230
|
+
color: d.primary,
|
|
2231
|
+
letterSpacing: "0.05em"
|
|
2232
|
+
},
|
|
2233
|
+
children: "⚛ TkxPlayground"
|
|
2234
|
+
}), /* @__PURE__ */ l("span", {
|
|
2235
|
+
style: {
|
|
2236
|
+
fontSize: "10px",
|
|
2237
|
+
color: d.textMuted
|
|
2238
|
+
},
|
|
2239
|
+
children: "Live JSX Preview"
|
|
2240
|
+
})]
|
|
2241
|
+
}),
|
|
2242
|
+
/* @__PURE__ */ l("div", {
|
|
2243
|
+
style: {
|
|
2244
|
+
display: "flex",
|
|
2245
|
+
gap: "4px",
|
|
2246
|
+
padding: "6px 10px",
|
|
2247
|
+
borderBottom: `1px solid ${R}`,
|
|
2248
|
+
backgroundColor: d.surface,
|
|
2249
|
+
overflowX: "auto"
|
|
2250
|
+
},
|
|
2251
|
+
children: f.map((e, t) => /* @__PURE__ */ l("button", {
|
|
2252
|
+
onClick: () => A(t),
|
|
2253
|
+
style: {
|
|
2254
|
+
padding: "3px 10px",
|
|
2255
|
+
borderRadius: "6px",
|
|
2256
|
+
border: `1px solid ${t === w ? d.primary : R}`,
|
|
2257
|
+
backgroundColor: t === w ? `${d.primary}20` : "transparent",
|
|
2258
|
+
color: t === w ? d.primary : d.textMuted,
|
|
2259
|
+
fontSize: "11px",
|
|
2260
|
+
fontWeight: t === w ? 700 : 400,
|
|
2261
|
+
cursor: "pointer",
|
|
2262
|
+
whiteSpace: "nowrap",
|
|
2263
|
+
fontFamily: "inherit",
|
|
2264
|
+
transition: "all 0.15s"
|
|
2265
|
+
},
|
|
2266
|
+
children: e.label
|
|
2267
|
+
}, t))
|
|
2268
|
+
}),
|
|
2269
|
+
/* @__PURE__ */ u("div", {
|
|
2270
|
+
style: {
|
|
2271
|
+
display: "flex",
|
|
2272
|
+
height: `${r}px`
|
|
2273
|
+
},
|
|
2274
|
+
children: [/* @__PURE__ */ u("div", {
|
|
2275
|
+
style: W,
|
|
2276
|
+
children: [
|
|
2277
|
+
/* @__PURE__ */ u("div", {
|
|
2278
|
+
style: G,
|
|
2279
|
+
children: [
|
|
2280
|
+
/* @__PURE__ */ l("span", {
|
|
2281
|
+
style: {
|
|
2282
|
+
fontSize: "11px",
|
|
2283
|
+
color: d.textMuted,
|
|
2284
|
+
marginRight: "auto"
|
|
2285
|
+
},
|
|
2286
|
+
children: "editor.tsx"
|
|
2287
|
+
}),
|
|
2288
|
+
/* @__PURE__ */ l("button", {
|
|
2289
|
+
onClick: j,
|
|
2290
|
+
style: J,
|
|
2291
|
+
title: "Copy code",
|
|
2292
|
+
children: S ? "✓ Copied" : "⎘ Copy"
|
|
2293
|
+
}),
|
|
2294
|
+
/* @__PURE__ */ l("button", {
|
|
2295
|
+
onClick: M,
|
|
2296
|
+
style: J,
|
|
2297
|
+
title: "Reset to default",
|
|
2298
|
+
children: "↺ Reset"
|
|
2299
|
+
})
|
|
2300
|
+
]
|
|
2301
|
+
}),
|
|
2302
|
+
/* @__PURE__ */ u("div", {
|
|
2303
|
+
style: {
|
|
2304
|
+
position: "relative",
|
|
2305
|
+
flex: 1,
|
|
2306
|
+
overflow: "hidden"
|
|
2307
|
+
},
|
|
2308
|
+
children: [/* @__PURE__ */ l(U, {
|
|
2309
|
+
code: m,
|
|
2310
|
+
lineHeight: 18
|
|
2311
|
+
}), /* @__PURE__ */ l("textarea", {
|
|
2312
|
+
ref: E,
|
|
2313
|
+
value: m,
|
|
2314
|
+
onChange: k,
|
|
2315
|
+
spellCheck: !1,
|
|
2316
|
+
autoCorrect: "off",
|
|
2317
|
+
autoCapitalize: "off",
|
|
2318
|
+
style: {
|
|
2319
|
+
position: "absolute",
|
|
2320
|
+
top: 0,
|
|
2321
|
+
left: 0,
|
|
2322
|
+
width: "100%",
|
|
2323
|
+
height: "100%",
|
|
2324
|
+
padding: "12px 12px 12px 44px",
|
|
2325
|
+
margin: 0,
|
|
2326
|
+
border: "none",
|
|
2327
|
+
outline: "none",
|
|
2328
|
+
resize: "none",
|
|
2329
|
+
backgroundColor: I,
|
|
2330
|
+
color: d.text,
|
|
2331
|
+
fontSize: "12px",
|
|
2332
|
+
lineHeight: "18px",
|
|
2333
|
+
fontFamily: "\"Fira Code\", \"Cascadia Code\", \"Consolas\", \"Courier New\", monospace",
|
|
2334
|
+
boxSizing: "border-box",
|
|
2335
|
+
overflowY: "auto",
|
|
2336
|
+
tabSize: 2
|
|
2337
|
+
}
|
|
2338
|
+
})]
|
|
2339
|
+
}),
|
|
2340
|
+
b.length > 0 && /* @__PURE__ */ u("div", {
|
|
2341
|
+
style: {
|
|
2342
|
+
position: "absolute",
|
|
2343
|
+
bottom: "40px",
|
|
2344
|
+
left: "44px",
|
|
2345
|
+
zIndex: 10,
|
|
2346
|
+
backgroundColor: d.surface,
|
|
2347
|
+
border: `1px solid ${d.primary}44`,
|
|
2348
|
+
borderRadius: "8px",
|
|
2349
|
+
overflow: "hidden",
|
|
2350
|
+
boxShadow: "0 4px 16px rgba(0,0,0,0.3)",
|
|
2351
|
+
minWidth: "180px"
|
|
2352
|
+
},
|
|
2353
|
+
children: [/* @__PURE__ */ l("div", {
|
|
2354
|
+
style: {
|
|
2355
|
+
padding: "4px 10px 4px",
|
|
2356
|
+
fontSize: "10px",
|
|
2357
|
+
color: d.primary,
|
|
2358
|
+
fontWeight: 700,
|
|
2359
|
+
borderBottom: `1px solid ${R}`,
|
|
2360
|
+
letterSpacing: "0.05em"
|
|
2361
|
+
},
|
|
2362
|
+
children: "⚛ Quantum Suggestions"
|
|
2363
|
+
}), b.map((e) => /* @__PURE__ */ u("button", {
|
|
2364
|
+
onClick: () => N(e.name),
|
|
2365
|
+
style: {
|
|
2366
|
+
display: "flex",
|
|
2367
|
+
alignItems: "center",
|
|
2368
|
+
justifyContent: "space-between",
|
|
2369
|
+
width: "100%",
|
|
2370
|
+
padding: "6px 10px",
|
|
2371
|
+
border: "none",
|
|
2372
|
+
backgroundColor: "transparent",
|
|
2373
|
+
color: d.text,
|
|
2374
|
+
fontSize: "12px",
|
|
2375
|
+
fontFamily: "\"Fira Code\", monospace",
|
|
2376
|
+
cursor: "pointer",
|
|
2377
|
+
textAlign: "left",
|
|
2378
|
+
gap: "12px"
|
|
2379
|
+
},
|
|
2380
|
+
children: [/* @__PURE__ */ l("span", { children: e.name }), /* @__PURE__ */ u("span", {
|
|
2381
|
+
style: {
|
|
2382
|
+
fontSize: "10px",
|
|
2383
|
+
color: d.textMuted,
|
|
2384
|
+
flexShrink: 0
|
|
2385
|
+
},
|
|
2386
|
+
children: [Math.round(e.amplitude * 100), "%"]
|
|
2387
|
+
})]
|
|
2388
|
+
}, e.name))]
|
|
2389
|
+
})
|
|
2390
|
+
]
|
|
2391
|
+
}), /* @__PURE__ */ u("div", {
|
|
2392
|
+
style: {
|
|
2393
|
+
width: "50%",
|
|
2394
|
+
display: "flex",
|
|
2395
|
+
flexDirection: "column"
|
|
2396
|
+
},
|
|
2397
|
+
children: [/* @__PURE__ */ l("div", {
|
|
2398
|
+
style: {
|
|
2399
|
+
padding: "6px 10px",
|
|
2400
|
+
borderBottom: `1px solid ${R}`,
|
|
2401
|
+
backgroundColor: d.surface,
|
|
2402
|
+
fontSize: "11px",
|
|
2403
|
+
color: d.textMuted,
|
|
2404
|
+
fontWeight: 600
|
|
2405
|
+
},
|
|
2406
|
+
children: "Preview"
|
|
2407
|
+
}), /* @__PURE__ */ l("div", {
|
|
2408
|
+
style: {
|
|
2409
|
+
flex: 1,
|
|
2410
|
+
overflow: "auto",
|
|
2411
|
+
backgroundColor: L,
|
|
2412
|
+
position: "relative"
|
|
2413
|
+
},
|
|
2414
|
+
children: P ? /* @__PURE__ */ u("div", {
|
|
2415
|
+
style: {
|
|
2416
|
+
padding: "16px",
|
|
2417
|
+
color: d.danger,
|
|
2418
|
+
fontFamily: "\"Fira Code\", monospace",
|
|
2419
|
+
fontSize: "12px",
|
|
2420
|
+
lineHeight: 1.6,
|
|
2421
|
+
whiteSpace: "pre-wrap",
|
|
2422
|
+
wordBreak: "break-word"
|
|
2423
|
+
},
|
|
2424
|
+
children: [/* @__PURE__ */ u("div", {
|
|
2425
|
+
style: {
|
|
2426
|
+
marginBottom: "8px",
|
|
2427
|
+
fontWeight: 700,
|
|
2428
|
+
display: "flex",
|
|
2429
|
+
alignItems: "center",
|
|
2430
|
+
gap: "6px"
|
|
2431
|
+
},
|
|
2432
|
+
children: [/* @__PURE__ */ l("svg", {
|
|
2433
|
+
width: "14",
|
|
2434
|
+
height: "14",
|
|
2435
|
+
viewBox: "0 0 24 24",
|
|
2436
|
+
fill: "currentColor",
|
|
2437
|
+
"aria-hidden": "true",
|
|
2438
|
+
children: /* @__PURE__ */ l("path", { d: "M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" })
|
|
2439
|
+
}), "Runtime Error"]
|
|
2440
|
+
}), F]
|
|
2441
|
+
}) : /* @__PURE__ */ l(B, {
|
|
2442
|
+
onError: y,
|
|
2443
|
+
children: /* @__PURE__ */ l("div", {
|
|
2444
|
+
style: { minHeight: "100%" },
|
|
2445
|
+
children: g.element
|
|
2446
|
+
})
|
|
2447
|
+
})
|
|
2448
|
+
})]
|
|
2449
|
+
})]
|
|
2450
|
+
}),
|
|
2451
|
+
/* @__PURE__ */ u("div", {
|
|
2452
|
+
style: {
|
|
2453
|
+
display: "flex",
|
|
2454
|
+
alignItems: "center",
|
|
2455
|
+
gap: "16px",
|
|
2456
|
+
padding: "4px 12px",
|
|
2457
|
+
backgroundColor: V,
|
|
2458
|
+
borderTop: `1px solid ${R}`,
|
|
2459
|
+
fontSize: "11px",
|
|
2460
|
+
color: d.textMuted
|
|
2461
|
+
},
|
|
2462
|
+
children: [
|
|
2463
|
+
/* @__PURE__ */ u("span", {
|
|
2464
|
+
style: {
|
|
2465
|
+
display: "flex",
|
|
2466
|
+
alignItems: "center",
|
|
2467
|
+
gap: "4px",
|
|
2468
|
+
color: P ? d.danger : d.success,
|
|
2469
|
+
fontWeight: 600
|
|
2470
|
+
},
|
|
2471
|
+
children: [/* @__PURE__ */ l("span", { style: {
|
|
2472
|
+
width: "6px",
|
|
2473
|
+
height: "6px",
|
|
2474
|
+
borderRadius: "50%",
|
|
2475
|
+
backgroundColor: P ? d.danger : d.success,
|
|
2476
|
+
display: "inline-block"
|
|
2477
|
+
} }), P ? "Error" : "OK"]
|
|
2478
|
+
}),
|
|
2479
|
+
/* @__PURE__ */ u("span", { children: [
|
|
2480
|
+
"⏱ ",
|
|
2481
|
+
g.renderMs,
|
|
2482
|
+
" ms"
|
|
2483
|
+
] }),
|
|
2484
|
+
/* @__PURE__ */ u("span", { children: [m.split("\n").length, " lines"] }),
|
|
2485
|
+
/* @__PURE__ */ u("span", { children: [m.length, " chars"] }),
|
|
2486
|
+
b.length > 0 && /* @__PURE__ */ u("span", {
|
|
2487
|
+
style: {
|
|
2488
|
+
marginLeft: "auto",
|
|
2489
|
+
color: d.primary,
|
|
2490
|
+
fontWeight: 600
|
|
2491
|
+
},
|
|
2492
|
+
children: [
|
|
2493
|
+
"⚛ ",
|
|
2494
|
+
b.length,
|
|
2495
|
+
" suggestion",
|
|
2496
|
+
b.length > 1 ? "s" : ""
|
|
2497
|
+
]
|
|
2498
|
+
})
|
|
2499
|
+
]
|
|
2500
|
+
})
|
|
2501
|
+
]
|
|
2502
|
+
});
|
|
2297
2503
|
}
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
Y as QuantumAI,
|
|
2302
|
-
de as QuantumAnnealer,
|
|
2303
|
-
he as QuantumBoltzmannMachine,
|
|
2304
|
-
ue as QuantumRegister,
|
|
2305
|
-
_ as Qubit,
|
|
2306
|
-
We as TkxPlayground,
|
|
2307
|
-
Se as TkxQuantumForm,
|
|
2308
|
-
Ne as TkxThemeBuilder,
|
|
2309
|
-
G as hslToHex,
|
|
2310
|
-
ce as inferFieldIntelligence,
|
|
2311
|
-
ye as optimizeThemeColors
|
|
2312
|
-
};
|
|
2504
|
+
J.displayName = "TkxPlayground";
|
|
2505
|
+
//#endregion
|
|
2506
|
+
export { g as AmplitudeAmplifier, D as QuantumAI, m as QuantumAnnealer, h as QuantumBoltzmannMachine, p as QuantumRegister, f as Qubit, J as TkxPlayground, N as TkxQuantumForm, R as TkxThemeBuilder, y as hslToHex, v as inferFieldIntelligence, E as optimizeThemeColors };
|