tekivex-ui 2.5.10 → 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.
Files changed (60) hide show
  1. package/dist/TkxForm-1KDzoniV.cjs +12 -0
  2. package/dist/TkxForm-9-W3Nl6m.js +314 -0
  3. package/dist/charts.cjs +1 -1
  4. package/dist/charts.js +543 -507
  5. package/dist/chunk-Bmb41Sf3.cjs +1 -0
  6. package/dist/headless.cjs +1 -1
  7. package/dist/headless.js +428 -447
  8. package/dist/hooks-6pRsPOyG.js +58 -0
  9. package/dist/hooks-mivgRljH.cjs +1 -0
  10. package/dist/i18n.cjs +1 -1
  11. package/dist/i18n.js +728 -752
  12. package/dist/index.cjs +46 -23
  13. package/dist/index.d.ts +6 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +16103 -16237
  16. package/dist/quantum.cjs +14 -16
  17. package/dist/quantum.js +2473 -2279
  18. package/dist/realtime.cjs +4 -10
  19. package/dist/realtime.js +804 -958
  20. package/dist/src/components/TkxAIChatBubble.d.ts +24 -0
  21. package/dist/src/components/TkxAIChatBubble.d.ts.map +1 -0
  22. package/dist/src/components/TkxAIConfidenceBar.d.ts +17 -0
  23. package/dist/src/components/TkxAIConfidenceBar.d.ts.map +1 -0
  24. package/dist/src/components/TkxAIThinking.d.ts +17 -0
  25. package/dist/src/components/TkxAIThinking.d.ts.map +1 -0
  26. package/dist/src/components/TkxClock.d.ts.map +1 -1
  27. package/dist/src/components/TkxForm.d.ts.map +1 -1
  28. package/dist/src/components/TkxLiveFeed.d.ts +1 -1
  29. package/dist/src/components/TkxLiveLog.d.ts +1 -1
  30. package/dist/src/components/TkxRealTimeChart.d.ts +1 -1
  31. package/dist/src/components/TkxTooltip.d.ts.map +1 -1
  32. package/dist/src/components/TkxTypography.d.ts +5 -5
  33. package/dist/src/components/TkxTypography.d.ts.map +1 -1
  34. package/dist/src/components/index.d.ts +3 -0
  35. package/dist/src/components/index.d.ts.map +1 -1
  36. package/dist/tekivex-ui.css +2 -0
  37. package/dist/themes-BbJanqiC.js +498 -0
  38. package/dist/themes-CMq2vWXj.cjs +2 -0
  39. package/dist/tkx-0oAwZqgL.cjs +4 -0
  40. package/dist/tkx-DQkvHdE5.js +1172 -0
  41. package/package.json +16 -16
  42. package/src/components/TkxAIChatBubble.tsx +209 -0
  43. package/src/components/TkxAIConfidenceBar.tsx +131 -0
  44. package/src/components/TkxAIThinking.tsx +191 -0
  45. package/src/components/TkxClock.tsx +2 -2
  46. package/src/components/TkxForm.tsx +4 -2
  47. package/src/components/TkxTooltip.tsx +7 -5
  48. package/src/components/TkxTypography.tsx +2 -2
  49. package/src/components/index.ts +5 -0
  50. package/dist/TkxForm-2tGLCPH6.js +0 -326
  51. package/dist/TkxForm-C2VqR2wC.cjs +0 -12
  52. package/dist/index-BgHMZe4Z.js +0 -66
  53. package/dist/index-Bt5y50Qa.cjs +0 -1
  54. package/dist/index-DnqXtpwV.cjs +0 -2
  55. package/dist/index-iUUHRxqJ.js +0 -515
  56. package/dist/security-C-ZPGoyG.js +0 -97
  57. package/dist/security-Uf0mjv8o.cjs +0 -1
  58. package/dist/style.css +0 -1
  59. package/dist/tkx-BtHzWKTl.js +0 -1112
  60. package/dist/tkx-C7GvVUE9.cjs +0 -4
package/dist/quantum.js CHANGED
@@ -1,2312 +1,2506 @@
1
- import { jsxs as c, jsx as a, Fragment as pe } from "react/jsx-runtime";
2
- import Z, { useState as A, useEffect as V, useCallback as R, useRef as X } from "react";
3
- import { u as K } from "./index-iUUHRxqJ.js";
4
- import { t as le } from "./tkx-BtHzWKTl.js";
5
- import { s as J } from "./security-C-ZPGoyG.js";
6
- class W {
7
- constructor(e, n) {
8
- this.re = e, this.im = n;
9
- }
10
- add(e) {
11
- return new W(this.re + e.re, this.im + e.im);
12
- }
13
- sub(e) {
14
- return new W(this.re - e.re, this.im - e.im);
15
- }
16
- mul(e) {
17
- return new W(
18
- this.re * e.re - this.im * e.im,
19
- this.re * e.im + this.im * e.re
20
- );
21
- }
22
- scale(e) {
23
- return new W(this.re * e, this.im * e);
24
- }
25
- conjugate() {
26
- return new W(this.re, -this.im);
27
- }
28
- /** |z|² */
29
- magnitudeSquared() {
30
- return this.re * this.re + this.im * this.im;
31
- }
32
- /** |z| */
33
- magnitude() {
34
- return Math.sqrt(this.magnitudeSquared());
35
- }
36
- static fromPolar(e, n) {
37
- return new W(e * Math.cos(n), e * Math.sin(n));
38
- }
39
- static zero() {
40
- return new W(0, 0);
41
- }
42
- static one() {
43
- return new W(1, 0);
44
- }
45
- }
46
- class _ {
47
- // amplitude of |1⟩
48
- constructor(e = W.one(), n = W.zero()) {
49
- this.alpha = e, this.beta = n, this.normalize();
50
- }
51
- /** Ensure |α|² + |β|² = 1 */
52
- normalize() {
53
- const e = Math.sqrt(
54
- this.alpha.magnitudeSquared() + this.beta.magnitudeSquared()
55
- );
56
- e > 0 && (this.alpha = this.alpha.scale(1 / e), this.beta = this.beta.scale(1 / e));
57
- }
58
- /** Hadamard gate: H|0⟩ = (|0⟩+|1⟩)/√2, H|1⟩ = (|0⟩−|1⟩)/√2 */
59
- hadamard() {
60
- const e = 1 / Math.SQRT2, n = this.alpha.add(this.beta).scale(e), i = this.alpha.sub(this.beta).scale(e);
61
- return new _(n, i);
62
- }
63
- /**
64
- * Ry(θ) rotation gate:
65
- * [[cos(θ/2), -sin(θ/2)],
66
- * [sin(θ/2), cos(θ/2)]]
67
- */
68
- ry(e) {
69
- const n = Math.cos(e / 2), i = Math.sin(e / 2), t = this.alpha.scale(n).sub(this.beta.scale(i)), l = this.alpha.scale(i).add(this.beta.scale(n));
70
- return new _(t, l);
71
- }
72
- /** Phase gate: |0⟩ → |0⟩, |1⟩ → e^(iφ)|1⟩ */
73
- phase(e) {
74
- const n = W.fromPolar(1, e);
75
- return new _(this.alpha, this.beta.mul(n));
76
- }
77
- /**
78
- * Measure the qubit. Returns 0 with probability |α|², 1 with probability |β|².
79
- * Collapses the state after measurement.
80
- */
81
- measure() {
82
- const e = this.beta.magnitudeSquared();
83
- return Math.random() < e ? 1 : 0;
84
- }
85
- /** Returns |β|² — probability of measuring 1 */
86
- expectation() {
87
- return this.beta.magnitudeSquared();
88
- }
89
- getAlpha() {
90
- return this.alpha;
91
- }
92
- getBeta() {
93
- return this.beta;
94
- }
95
- }
96
- class ue {
97
- constructor(e) {
98
- this.qubits = Array.from({ length: e }, () => new _());
99
- }
100
- get size() {
101
- return this.qubits.length;
102
- }
103
- getQubit(e) {
104
- return this.qubits[e];
105
- }
106
- /** Apply Hadamard to all qubits creates uniform superposition */
107
- superpose() {
108
- this.qubits = this.qubits.map((e) => e.hadamard());
109
- }
110
- /**
111
- * CNOT gate: if control qubit has high |1⟩ probability, flip target qubit.
112
- * Approximate classical simulation: probabilistic flip based on control expectation.
113
- */
114
- cnot(e, n) {
115
- const i = this.qubits[e], t = this.qubits[n], l = i.expectation();
116
- this.qubits[n] = t.ry(Math.PI * l);
117
- }
118
- /** Apply Ry rotation to a specific qubit */
119
- rotate(e, n) {
120
- this.qubits[e] = this.qubits[e].ry(n);
121
- }
122
- /** Measure all qubits; returns array of 0/1 */
123
- measure() {
124
- return this.qubits.map((e) => e.measure());
125
- }
126
- /** Returns probability of measuring 1 for each qubit */
127
- probs() {
128
- return this.qubits.map((e) => e.expectation());
129
- }
130
- }
131
- class de {
132
- constructor(e = 1, n = 0.995, i = 0.3, t = 1e-6) {
133
- this.temperature = e, this.coolingRate = n, this.tunnelingStrength = i, this.minTemp = t;
134
- }
135
- anneal(e, n, i, t = 1e3) {
136
- let l = e, s = n(l), d = l, o = s, p = this.temperature, f = 0, m = 0;
137
- for (let g = 0; g < t && p > this.minTemp; g++) {
138
- const b = i(l), h = n(b), v = h - s;
139
- let C = !1;
140
- if (v <= 0)
141
- C = !0;
142
- else {
143
- const k = Math.exp(-v / p), P = Math.sqrt(2 * Math.abs(v)), F = Math.abs(v), w = Math.exp(-2 * P * Math.sqrt(F) * this.tunnelingStrength);
144
- Math.random() < k + w && (C = !0, Math.random() < w / (k + w + 1e-10) && m++);
145
- }
146
- C && (l = b, s = h, f++, s < o && (d = l, o = s)), p *= this.coolingRate;
147
- }
148
- return {
149
- state: d,
150
- energy: o,
151
- iterations: t,
152
- accepted: f,
153
- tunnels: m
154
- };
155
- }
156
- }
157
- class he {
158
- constructor(e, n) {
159
- const i = Math.sqrt(2 / (e + n));
160
- this.weights = Array.from(
161
- { length: e },
162
- () => Array.from({ length: n }, () => (Math.random() * 2 - 1) * i)
163
- ), this.visibleBias = Array.from({ length: e }, () => 0), this.hiddenBias = Array.from({ length: n }, () => 0);
164
- }
165
- /** Sigmoid with tiny quantum noise */
166
- sigmoid(e) {
167
- const n = (Math.random() - 0.5) * 0.1;
168
- return 1 / (1 + Math.exp(-(e + n)));
169
- }
170
- /** Sample a binary value from a probability */
171
- sample(e) {
172
- return Math.random() < e ? 1 : 0;
173
- }
174
- /**
175
- * Energy: E(v,h) = -vBias·v - hBias·h - v^T W h
176
- */
177
- energy(e, n) {
178
- const i = this.visibleBias.reduce((s, d, o) => s + d * e[o], 0), t = this.hiddenBias.reduce((s, d, o) => s + d * n[o], 0);
179
- let l = 0;
180
- for (let s = 0; s < e.length; s++)
181
- for (let d = 0; d < n.length; d++)
182
- l += e[s] * this.weights[s][d] * n[d];
183
- return -(i + t + l);
184
- }
185
- /**
186
- * Compute P(h_j=1 | v) = sigmoid(hBias[j] + sum_i weights[i][j] * v[i])
187
- */
188
- hiddenProbs(e) {
189
- return this.hiddenBias.map((n, i) => {
190
- const t = n + e.reduce((l, s, d) => l + this.weights[d][i] * s, 0);
191
- return this.sigmoid(t);
192
- });
193
- }
194
- /**
195
- * Compute P(v_i=1 | h) = sigmoid(vBias[i] + sum_j weights[i][j] * h[j])
196
- */
197
- visibleProbs(e) {
198
- return this.visibleBias.map((n, i) => {
199
- const t = n + e.reduce((l, s, d) => l + this.weights[i][d] * s, 0);
200
- return this.sigmoid(t);
201
- });
202
- }
203
- /**
204
- * Gibbs sampling: run k steps of
205
- * h ← sample(hiddenProbs(v))
206
- * v ← sample(visibleProbs(h))
207
- */
208
- gibbs(e, n = 1) {
209
- let i = [...e], t = [];
210
- for (let l = 0; l < n; l++)
211
- t = this.hiddenProbs(i).map((s) => this.sample(s)), i = this.visibleProbs(t).map((s) => this.sample(s));
212
- return { visible: i, hidden: t };
213
- }
214
- /**
215
- * Contrastive Divergence-1 training step.
216
- */
217
- trainCD1(e, n = 0.01) {
218
- const i = this.visibleBias.length, t = this.hiddenBias.length, l = Array.from({ length: i }, () => Array(t).fill(0)), s = Array(i).fill(0), d = Array(t).fill(0);
219
- for (const p of e) {
220
- const f = this.hiddenProbs(p), m = f.map((h) => this.sample(h)), g = this.visibleProbs(m).map((h) => this.sample(h)), b = this.hiddenProbs(g);
221
- for (let h = 0; h < i; h++) {
222
- for (let v = 0; v < t; v++)
223
- l[h][v] += p[h] * f[v] - g[h] * b[v];
224
- s[h] += p[h] - g[h];
225
- }
226
- for (let h = 0; h < t; h++)
227
- d[h] += f[h] - b[h];
228
- }
229
- const o = e.length;
230
- for (let p = 0; p < i; p++) {
231
- for (let f = 0; f < t; f++)
232
- this.weights[p][f] += n * l[p][f] / o;
233
- this.visibleBias[p] += n * s[p] / o;
234
- }
235
- for (let p = 0; p < t; p++)
236
- this.hiddenBias[p] += n * d[p] / o;
237
- }
238
- /**
239
- * Infer hidden activations from partial visible input.
240
- */
241
- infer(e) {
242
- const n = this.hiddenProbs(e), i = n.map((l) => this.sample(l)), t = this.visibleProbs(i);
243
- return {
244
- hidden: n,
245
- visible: t,
246
- energy: this.energy(e, i),
247
- iterations: 1
248
- };
249
- }
250
- }
251
- class ee {
252
- /**
253
- * Amplify probabilities of "marked" items using Grover-inspired algorithm.
254
- */
255
- amplify(e, n, i = 0.5) {
256
- const t = e.length;
257
- if (t === 0) return [];
258
- const l = e.map(n), s = l.filter((m) => m > i).length, d = Math.max(1, s);
259
- let o = Array(t).fill(1 / Math.sqrt(t));
260
- const p = Math.max(1, Math.floor(Math.PI / 4 * Math.sqrt(t / d)));
261
- for (let m = 0; m < p; m++) {
262
- for (let b = 0; b < t; b++)
263
- l[b] > i && (o[b] = -o[b]);
264
- const g = o.reduce((b, h) => b + h, 0) / t;
265
- o = o.map((b) => 2 * g - b);
266
- }
267
- return e.map((m, g) => ({
268
- index: g,
269
- amplitude: o[g],
270
- probability: o[g] * o[g],
271
- classicalSimilarity: l[g],
272
- combined: o[g] * o[g] * 0.6 + l[g] * 0.4
273
- })).sort((m, g) => g.combined - m.combined);
274
- }
275
- }
276
- const te = [
277
- {
278
- keywords: ["email", "e-mail", "mail"],
279
- type: "email",
280
- validations: [
281
- { rule: "required", message: "Email is required" },
282
- { rule: "pattern", value: "^[^@]+@[^@]+\\.[^@]+$", message: "Enter a valid email address" },
283
- { rule: "maxLength", value: 254, message: "Email too long" }
284
- ],
285
- placeholder: "you@example.com",
286
- label: "Email Address",
287
- confidence: 0.98
288
- },
289
- {
290
- keywords: ["password", "passwd", "pwd", "pass"],
291
- type: "password",
292
- validations: [
293
- { rule: "required", message: "Password is required" },
294
- { rule: "minLength", value: 8, message: "Password must be at least 8 characters" },
295
- { rule: "pattern", value: "(?=.*[A-Z])(?=.*[0-9])", message: "Include uppercase and a number" }
296
- ],
297
- placeholder: "••••••••",
298
- label: "Password",
299
- confidence: 0.97
300
- },
301
- {
302
- keywords: ["confirm_password", "confirmpassword", "confirm_pass", "repassword", "password2", "repeat_password"],
303
- type: "password",
304
- validations: [
305
- { rule: "required", message: "Please confirm your password" },
306
- { rule: "match", value: "password", message: "Passwords do not match" }
307
- ],
308
- placeholder: "••••••••",
309
- label: "Confirm Password",
310
- confidence: 0.95
311
- },
312
- {
313
- keywords: ["phone", "mobile", "cell", "tel", "telephone", "contact_number"],
314
- type: "tel",
315
- validations: [
316
- { rule: "pattern", value: "^[+]?[(]?[0-9]{3}[)]?[-\\s.]?[0-9]{3}[-\\s.]?[0-9]{4,6}$", message: "Enter a valid phone number" }
317
- ],
318
- placeholder: "+1 (555) 000-0000",
319
- label: "Phone Number",
320
- confidence: 0.93
321
- },
322
- {
323
- keywords: ["age"],
324
- type: "number",
325
- validations: [
326
- { rule: "min", value: 0, message: "Age cannot be negative" },
327
- { rule: "max", value: 150, message: "Enter a valid age" },
328
- { rule: "integer", message: "Age must be a whole number" }
329
- ],
330
- placeholder: "25",
331
- label: "Age",
332
- confidence: 0.9
333
- },
334
- {
335
- keywords: ["price", "amount", "cost", "fee", "payment", "salary", "wage", "total"],
336
- type: "number",
337
- validations: [
338
- { rule: "min", value: 0, message: "Amount cannot be negative" },
339
- { rule: "pattern", value: "^\\d+(\\.\\d{1,2})?$", message: "Enter a valid amount (e.g. 9.99)" }
340
- ],
341
- placeholder: "0.00",
342
- label: "Amount",
343
- confidence: 0.88
344
- },
345
- {
346
- keywords: ["url", "website", "site", "link", "homepage", "web"],
347
- type: "url",
348
- validations: [
349
- { rule: "pattern", value: "https?://.+", message: "Enter a valid URL starting with http:// or https://" }
350
- ],
351
- placeholder: "https://example.com",
352
- label: "Website URL",
353
- confidence: 0.92
354
- },
355
- {
356
- keywords: ["zip", "zipcode", "postal", "postcode", "pin_code"],
357
- type: "text",
358
- validations: [
359
- { rule: "pattern", value: "^[0-9]{5}(-[0-9]{4})?$", message: "Enter a valid ZIP code (e.g. 12345)" }
360
- ],
361
- placeholder: "12345",
362
- label: "ZIP / Postal Code",
363
- confidence: 0.91
364
- },
365
- {
366
- keywords: ["date", "dob", "birthday", "birth_date", "birthdate", "born"],
367
- type: "date",
368
- validations: [
369
- { rule: "required", message: "Date is required" }
370
- ],
371
- placeholder: "YYYY-MM-DD",
372
- label: "Date of Birth",
373
- confidence: 0.89
374
- },
375
- {
376
- keywords: ["first_name", "firstname", "fname", "given_name"],
377
- type: "text",
378
- validations: [
379
- { rule: "minLength", value: 2, message: "First name too short" },
380
- { rule: "maxLength", value: 50, message: "First name too long" }
381
- ],
382
- placeholder: "Jane",
383
- label: "First Name",
384
- confidence: 0.9
385
- },
386
- {
387
- keywords: ["last_name", "lastname", "lname", "surname", "family_name"],
388
- type: "text",
389
- validations: [
390
- { rule: "minLength", value: 2, message: "Last name too short" },
391
- { rule: "maxLength", value: 50, message: "Last name too long" }
392
- ],
393
- placeholder: "Doe",
394
- label: "Last Name",
395
- confidence: 0.9
396
- },
397
- {
398
- keywords: ["name", "full_name", "fullname", "display_name"],
399
- type: "text",
400
- validations: [
401
- { rule: "minLength", value: 2, message: "Name too short" },
402
- { rule: "maxLength", value: 100, message: "Name too long" }
403
- ],
404
- placeholder: "Jane Doe",
405
- label: "Full Name",
406
- confidence: 0.85
407
- },
408
- {
409
- keywords: ["username", "user_name", "handle", "login", "loginname"],
410
- type: "text",
411
- validations: [
412
- { rule: "minLength", value: 3, message: "Username must be at least 3 characters" },
413
- { rule: "maxLength", value: 32, message: "Username too long" },
414
- { rule: "pattern", value: "^[a-zA-Z0-9_.-]+$", message: "Only letters, numbers, _, - and . allowed" }
415
- ],
416
- placeholder: "cooluser42",
417
- label: "Username",
418
- confidence: 0.94
419
- },
420
- {
421
- keywords: ["bio", "biography", "about", "description", "summary", "details"],
422
- type: "textarea",
423
- validations: [
424
- { rule: "maxLength", value: 500, message: "Bio must be under 500 characters" }
425
- ],
426
- placeholder: "Tell us about yourself...",
427
- label: "Bio",
428
- confidence: 0.87
429
- },
430
- {
431
- keywords: ["message", "comment", "feedback", "note", "notes", "remarks", "body"],
432
- type: "textarea",
433
- validations: [
434
- { rule: "minLength", value: 10, message: "Message too short" },
435
- { rule: "maxLength", value: 2e3, message: "Message too long" }
436
- ],
437
- placeholder: "Write your message here...",
438
- label: "Message",
439
- confidence: 0.86
440
- },
441
- {
442
- keywords: ["search", "query", "q", "keyword", "find"],
443
- type: "search",
444
- validations: [],
445
- placeholder: "Search...",
446
- label: "Search",
447
- confidence: 0.9
448
- },
449
- {
450
- keywords: ["otp", "one_time_password", "verification_code", "pin", "code"],
451
- type: "text",
452
- validations: [
453
- { rule: "minLength", value: 4, message: "Code too short" },
454
- { rule: "maxLength", value: 8, message: "Code too long" },
455
- { rule: "pattern", value: "^[0-9]+$", message: "Code must be numeric" }
456
- ],
457
- placeholder: "123456",
458
- label: "Verification Code",
459
- confidence: 0.92
460
- },
461
- {
462
- keywords: ["color", "colour", "hex_color", "brand_color"],
463
- type: "color",
464
- validations: [],
465
- placeholder: "#3b82f6",
466
- label: "Color",
467
- confidence: 0.95
468
- },
469
- {
470
- keywords: ["address", "street", "street_address", "addr"],
471
- type: "text",
472
- validations: [
473
- { rule: "maxLength", value: 200, message: "Address too long" }
474
- ],
475
- placeholder: "123 Main Street",
476
- label: "Street Address",
477
- confidence: 0.87
478
- },
479
- {
480
- keywords: ["city", "town", "municipality"],
481
- type: "text",
482
- validations: [
483
- { rule: "maxLength", value: 100, message: "City name too long" }
484
- ],
485
- placeholder: "San Francisco",
486
- label: "City",
487
- confidence: 0.89
488
- },
489
- {
490
- keywords: ["country", "nation", "country_code"],
491
- type: "text",
492
- validations: [],
493
- placeholder: "United States",
494
- label: "Country",
495
- confidence: 0.88
496
- },
497
- {
498
- keywords: ["company", "organization", "org", "employer", "company_name"],
499
- type: "text",
500
- validations: [
501
- { rule: "maxLength", value: 200, message: "Company name too long" }
502
- ],
503
- placeholder: "Acme Inc.",
504
- label: "Company",
505
- confidence: 0.87
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 ce(r) {
509
- const e = r.toLowerCase().replace(/[\s-]/g, "_"), i = new ee().amplify(
510
- te,
511
- (t) => {
512
- let l = 0;
513
- for (const s of t.keywords)
514
- e === s ? l = Math.max(l, 1) : e.includes(s) || s.includes(e) ? l = Math.max(l, 0.8) : s.split("_").some((d) => e.includes(d)) && (l = Math.max(l, 0.5));
515
- return l;
516
- },
517
- 0.3
518
- );
519
- if (i.length > 0 && i[0].combined > 0.1) {
520
- const t = te[i[0].index];
521
- return {
522
- type: t.type,
523
- validations: t.validations,
524
- placeholder: t.placeholder,
525
- confidence: Math.min(t.confidence * i[0].combined * 2, 0.99),
526
- label: t.label
527
- };
528
- }
529
- return {
530
- type: "text",
531
- validations: [{ rule: "maxLength", value: 255, message: "Input too long" }],
532
- placeholder: r.replace(/_/g, " "),
533
- confidence: 0.3,
534
- label: r.replace(/_/g, " ").replace(/\b\w/g, (t) => t.toUpperCase())
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 G(r, e, n) {
538
- const i = e / 100, t = n / 100, l = i * Math.min(t, 1 - t), s = (d) => {
539
- const o = (d + r / 30) % 12, p = t - l * Math.max(Math.min(o - 3, 9 - o, 1), -1);
540
- return Math.round(255 * p).toString(16).padStart(2, "0");
541
- };
542
- return `#${s(0)}${s(8)}${s(4)}`;
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 me(r) {
545
- const e = r.replace("#", ""), n = e.length === 3 ? e.split("").map((i) => i + i).join("") : e;
546
- return [
547
- parseInt(n.slice(0, 2), 16),
548
- parseInt(n.slice(2, 4), 16),
549
- parseInt(n.slice(4, 6), 16)
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 re(r) {
553
- const [e, n, i] = me(r).map((t) => {
554
- const l = t / 255;
555
- return l <= 0.03928 ? l / 12.92 : ((l + 0.055) / 1.055) ** 2.4;
556
- });
557
- return 0.2126 * e + 0.7152 * n + 0.0722 * i;
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 U(r, e) {
560
- const n = re(r), i = re(e), t = Math.max(n, i), l = Math.min(n, i);
561
- return (t + 0.05) / (l + 0.05);
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 ge(r, e) {
564
- const n = (t) => G(t.h, t.s, t.l), i = e ? r.text.l - 20 : r.text.l + 15;
565
- return {
566
- primary: n(r.primary),
567
- secondary: n(r.secondary),
568
- background: n(r.bg),
569
- surface: n(r.surface),
570
- text: n(r.text),
571
- textMuted: G(
572
- r.text.h,
573
- Math.max(0, r.text.s - 10),
574
- Math.max(20, Math.min(85, i))
575
- ),
576
- border: n(r.border),
577
- error: e ? "#f87171" : "#dc2626",
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 fe(r, e) {
584
- let n = 0;
585
- const i = (k) => G(k.h, k.s, k.l), t = i(r.text), l = i(r.bg), s = i(r.surface), d = i(r.primary), o = U(t, l), p = U(t, s), f = U(d, l);
586
- o < 4.5 && (n += (4.5 - o) * 10), p < 4.5 && (n += (4.5 - p) * 8), f < 3 && (n += (3 - f) * 5);
587
- const g = Math.abs((r.secondary.h - r.primary.h + 360) % 360 - 137.508);
588
- n += g * 0.05;
589
- const b = Math.abs((r.accent.h - r.primary.h + 360) % 360 - 120);
590
- n += b * 0.03;
591
- const h = (r.primary.s + r.secondary.s) / 2;
592
- h < 20 && (n += (20 - h) * 0.5), h > 90 && (n += (h - 90) * 0.5);
593
- const v = r.bg.l;
594
- e ? (v > 25 && (n += (v - 25) * 2), v < 3 && (n += (3 - v) * 2), r.text.l < 70 && (n += (70 - r.text.l) * 1.5)) : (v < 90 && (n += (90 - v) * 2), v > 100 && (n += (v - 100) * 2), r.text.l > 30 && (n += (r.text.l - 30) * 1.5));
595
- const C = Math.abs(r.surface.l - r.bg.l);
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 ne(r, e, n) {
599
- return Math.max(e, Math.min(n, r));
745
+ function T(e, t, n) {
746
+ return Math.max(t, Math.min(n, e));
600
747
  }
601
- function ye(r, e, n = 800) {
602
- const i = e ? {
603
- primary: { h: r, s: 70, l: 55 },
604
- secondary: { h: (r + 137.5) % 360, s: 65, l: 50 },
605
- bg: { h: r, s: 10, l: 8 },
606
- surface: { h: r, s: 10, l: 13 },
607
- text: { h: r, s: 15, l: 90 },
608
- border: { h: r, s: 15, l: 22 },
609
- accent: { h: (r + 120) % 360, s: 75, l: 60 }
610
- } : {
611
- primary: { h: r, s: 65, l: 40 },
612
- secondary: { h: (r + 137.5) % 360, s: 55, l: 38 },
613
- bg: { h: r, s: 15, l: 97 },
614
- surface: { h: r, s: 12, l: 100 },
615
- text: { h: r, s: 15, l: 12 },
616
- border: { h: r, s: 12, l: 85 },
617
- accent: { h: (r + 120) % 360, s: 70, l: 42 }
618
- }, l = new de(1.5, 0.994, 0.35, 1e-5).anneal(
619
- i,
620
- (s) => fe(s, e),
621
- (s) => {
622
- const d = ["primary", "secondary", "bg", "surface", "text", "border", "accent"], o = d[Math.floor(Math.random() * d.length)], p = ["h", "s", "l"], f = p[Math.floor(Math.random() * p.length)], m = (Math.random() - 0.5) * (f === "h" ? 30 : 15), g = {
623
- ...s,
624
- [o]: { ...s[o] }
625
- };
626
- return f === "h" ? g[o] = { ...g[o], h: (s[o].h + m + 360) % 360 } : f === "s" ? g[o] = { ...g[o], s: ne(s[o].s + m, 0, 100) } : g[o] = { ...g[o], l: ne(s[o].l + m, 0, 100) }, g;
627
- },
628
- n
629
- );
630
- return ge(l.state, e);
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
- const Y = {
633
- /** Create a single qubit in |0⟩ state */
634
- qubit() {
635
- return new _();
636
- },
637
- /** Create a quantum register of n qubits */
638
- register(r) {
639
- return new ue(r);
640
- },
641
- /** Create a quantum annealer */
642
- annealer(r, e, n) {
643
- return new de(r, e, n);
644
- },
645
- /** Create a Quantum Boltzmann Machine */
646
- qbm(r, e) {
647
- return new he(r, e);
648
- },
649
- /** Create an amplitude amplifier */
650
- amplifier() {
651
- return new ee();
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
- function xe(r, e, n, i) {
663
- const t = n.trim();
664
- switch (r) {
665
- case "required":
666
- return t !== "";
667
- case "email":
668
- case "pattern":
669
- if (typeof e == "string")
670
- try {
671
- return t === "" || new RegExp(e).test(t);
672
- } catch {
673
- return !0;
674
- }
675
- return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t);
676
- case "phone":
677
- return t === "" || /^\+?[\d\s\-()]{7,15}$/.test(t);
678
- case "url":
679
- return t === "" || /^https?:\/\/.+/.test(t);
680
- case "minLength":
681
- case "min": {
682
- const l = Number(e ?? 0);
683
- return t === "" || (isNaN(Number(t)) ? t.length >= l : Number(t) >= l);
684
- }
685
- case "maxLength":
686
- case "max": {
687
- const l = Number(e ?? 1 / 0);
688
- return t === "" || (isNaN(Number(t)) ? t.length <= l : Number(t) <= l);
689
- }
690
- case "integer":
691
- return t === "" || /^\d+$/.test(t);
692
- case "alphanumeric":
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 ve({
741
- confidence: r,
742
- theme: e
743
- }) {
744
- const n = Math.round(r * 100), i = n >= 80 ? e.success : n >= 60 ? e.warning : e.danger;
745
- return /* @__PURE__ */ c(
746
- "span",
747
- {
748
- style: {
749
- display: "inline-flex",
750
- alignItems: "center",
751
- gap: "2px",
752
- fontSize: "10px",
753
- fontWeight: 600,
754
- padding: "1px 5px",
755
- borderRadius: "999px",
756
- backgroundColor: `${i}22`,
757
- color: i,
758
- border: `1px solid ${i}44`,
759
- marginLeft: "6px",
760
- verticalAlign: "middle",
761
- letterSpacing: "0.03em"
762
- },
763
- children: [
764
- "⚛ ",
765
- n,
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 ke({
772
- config: r,
773
- intel: e,
774
- qubitPhase: n,
775
- value: i,
776
- error: t,
777
- touched: l,
778
- showConfidence: s,
779
- showQuantumState: d,
780
- collapsed: o,
781
- onChange: p,
782
- onBlur: f,
783
- theme: m,
784
- mounted: g,
785
- index: b
786
- }) {
787
- const h = r.type ?? e.type, v = r.label ?? e.label, C = r.placeholder ?? e.placeholder, k = r.required !== void 0 ? r.required : e.validations.some((L) => L.rule === "required"), P = J(v), F = h === "textarea", w = l && t !== "", $ = `qf-${r.name}`, q = {
788
- width: "100%",
789
- padding: "9px 12px",
790
- border: `1.5px solid ${w ? m.danger : m.border}`,
791
- borderRadius: "8px",
792
- backgroundColor: m.surface,
793
- color: m.text,
794
- fontSize: "14px",
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 we(r) {
886
- let e = 2166136261;
887
- for (let n = 0; n < r.length; n++)
888
- e ^= r.charCodeAt(n), e = Math.imul(e, 16777619) >>> 0;
889
- return (e & 65535) / 65535 * Math.PI * 2;
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 Se({
892
- fields: r,
893
- onSubmit: e,
894
- submitLabel: n = "Submit",
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
- Se.displayName = "TkxQuantumForm";
1129
- function oe(r) {
1130
- return r ? {
1131
- primary: "#00f5d4",
1132
- secondary: "#7b2ff7",
1133
- background: "#0a0a0f",
1134
- surface: "#12121a",
1135
- text: "#e8e8f4",
1136
- textMuted: "#8888aa",
1137
- border: "#2a2a3e",
1138
- error: "#f87171",
1139
- warning: "#fbbf24",
1140
- success: "#34d399",
1141
- accent: "#ff6b6b"
1142
- } : {
1143
- primary: "#0d7c5f",
1144
- secondary: "#6930c3",
1145
- background: "#f8f6f1",
1146
- surface: "#ffffff",
1147
- text: "#1a1815",
1148
- textMuted: "#6b6560",
1149
- border: "#ddd8cc",
1150
- error: "#dc2626",
1151
- warning: "#d97706",
1152
- success: "#059669",
1153
- accent: "#e05a00"
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
- function Ce({ points: r, primary: e }) {
1157
- if (r.length < 2)
1158
- return /* @__PURE__ */ a("div", { style: { height: 48, display: "flex", alignItems: "center", justifyContent: "center", color: "#888", fontSize: 12 }, children: "Waiting for data..." });
1159
- const n = 280, i = 48, t = Math.max(...r.map((p) => p.energy)), l = Math.min(...r.map((p) => p.energy)), s = t - l || 1, d = r[r.length - 1].iteration || 1, o = r.map((p) => {
1160
- const f = p.iteration / d * n, m = i - (p.energy - l) / s * (i - 4) - 2;
1161
- return `${f.toFixed(1)},${m.toFixed(1)}`;
1162
- }).join(" ");
1163
- return /* @__PURE__ */ c("svg", { width: n, height: i, style: { display: "block" }, children: [
1164
- /* @__PURE__ */ a(
1165
- "polyline",
1166
- {
1167
- points: o,
1168
- fill: "none",
1169
- stroke: e,
1170
- strokeWidth: 1.5,
1171
- strokeLinecap: "round",
1172
- strokeLinejoin: "round",
1173
- opacity: 0.9
1174
- }
1175
- ),
1176
- /* @__PURE__ */ c("text", { x: 2, y: 10, fontSize: 9, fill: "#888", children: [
1177
- "E=",
1178
- t.toFixed(1)
1179
- ] }),
1180
- /* @__PURE__ */ c("text", { x: 2, y: i - 2, fontSize: 9, fill: "#888", children: [
1181
- "E=",
1182
- l.toFixed(1)
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 Me({ label: r, value: e, onChange: n, text: i, border: t }) {
1187
- return /* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 6 }, children: [
1188
- /* @__PURE__ */ a(
1189
- "input",
1190
- {
1191
- type: "color",
1192
- value: e,
1193
- onChange: (l) => n(l.target.value),
1194
- style: {
1195
- width: 32,
1196
- height: 32,
1197
- border: `1px solid ${t}`,
1198
- borderRadius: 6,
1199
- padding: 2,
1200
- cursor: "pointer",
1201
- background: "transparent"
1202
- }
1203
- }
1204
- ),
1205
- /* @__PURE__ */ a(
1206
- "div",
1207
- {
1208
- style: {
1209
- width: 60,
1210
- height: 28,
1211
- borderRadius: 6,
1212
- background: e,
1213
- border: `1px solid ${t}`
1214
- }
1215
- }
1216
- ),
1217
- /* @__PURE__ */ a("span", { style: { flex: 1, fontSize: 13, color: i, fontFamily: "monospace" }, children: r }),
1218
- /* @__PURE__ */ a("code", { style: { fontSize: 12, color: i, opacity: 0.7, fontFamily: "monospace" }, children: e })
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 ze({ label: r, ratio: e }) {
1222
- const n = e >= 4.5, i = e >= 4.5, t = e >= 7;
1223
- return /* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 4 }, children: [
1224
- /* @__PURE__ */ a("span", { style: { fontSize: 11, opacity: 0.8, minWidth: 140 }, children: r }),
1225
- /* @__PURE__ */ c("span", { style: { fontSize: 12, fontWeight: 600 }, children: [
1226
- e.toFixed(2),
1227
- ":1"
1228
- ] }),
1229
- /* @__PURE__ */ a("span", { style: { fontSize: 11, color: i ? "#22c55e" : "#ef4444" }, children: i ? "✓ AA" : "✗ AA" }),
1230
- /* @__PURE__ */ a("span", { style: { fontSize: 11, color: t ? "#22c55e" : "#888" }, children: t ? "✓ AAA" : "— AAA" }),
1231
- /* @__PURE__ */ a("span", { style: { fontSize: 13 }, children: n ? "✅" : "❌" })
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 Ne({
1235
- onThemeChange: r,
1236
- initialHue: e = 210,
1237
- initialMode: n = "dark"
1238
- }) {
1239
- const i = K(), [t, l] = A(n), [s, d] = A(e), [o, p] = A(() => oe(n === "dark")), [f, m] = A(!1), [g, b] = A([]), [h, v] = A(!1), C = X(null), k = t === "dark", P = R(
1240
- (u, x) => {
1241
- p((M) => {
1242
- const S = { ...M, [u]: x };
1243
- return r == null || r(S), S;
1244
- });
1245
- },
1246
- [r]
1247
- ), F = R(() => {
1248
- if (f) return;
1249
- m(!0), b([]);
1250
- let u = 0;
1251
- const x = 600, M = 60, S = [], z = () => {
1252
- u += M, Y.optimizeTheme(s, k, u);
1253
- const N = u / x, O = 50 * (1 - N) + 2, Q = (Math.random() - 0.5) * 8 * (1 - N * 0.8);
1254
- if (S.push({ iteration: u, energy: Math.max(0, O + Q) }), b([...S]), u < x)
1255
- C.current = window.setTimeout(z, 40);
1256
- else {
1257
- const T = Y.optimizeTheme(s, k, 1e3);
1258
- p(T), r == null || r(T), m(!1);
1259
- }
1260
- };
1261
- C.current = window.setTimeout(z, 16);
1262
- }, [s, k, f, r]), w = R(() => {
1263
- const u = t === "dark" ? "light" : "dark";
1264
- l(u);
1265
- const x = oe(u === "dark");
1266
- p(x), r == null || r(x);
1267
- }, [t, r]), $ = R(() => {
1268
- const u = `export const myTheme = {
1269
- ${Object.entries(o).map(([x, M]) => ` ${x}: '${M}',`).join(`
1270
- `)}
1271
- };`;
1272
- typeof navigator < "u" && navigator.clipboard && navigator.clipboard.writeText(u).then(() => {
1273
- v(!0), setTimeout(() => v(!1), 2e3);
1274
- });
1275
- }, [o]), q = [
1276
- { label: "Text on Background", fg: o.text, bg: o.background },
1277
- { label: "Text on Surface", fg: o.text, bg: o.surface },
1278
- { label: "Primary on Background", fg: o.primary, bg: o.background },
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
- const ie = [
1671
- {
1672
- label: "Hello World",
1673
- code: `<div style={{ padding: 24, fontFamily: 'sans-serif', color: '#e8e8f4' }}>
1674
- <h2 style={{ margin: 0 }}>👋 Hello, TkxPlayground!</h2>
1675
- <p style={{ marginTop: 8, opacity: 0.7 }}>Edit the code on the left to see live updates.</p>
1676
- </div>`
1677
- },
1678
- {
1679
- label: "Button Styles",
1680
- code: `<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', padding: 24 }}>
1681
- {['primary', 'success', 'danger', 'warning', 'info'].map(color => (
1682
- <button
1683
- key={color}
1684
- style={{
1685
- padding: '8px 18px',
1686
- borderRadius: 8,
1687
- border: 'none',
1688
- background: color === 'primary' ? '#00f5d4' : color === 'success' ? '#06d6a0' : color === 'danger' ? '#f72585' : color === 'warning' ? '#ffbe0b' : '#3a86ff',
1689
- color: '#0a0a0f',
1690
- fontWeight: 700,
1691
- cursor: 'pointer',
1692
- textTransform: 'capitalize',
1693
- }}
1694
- >
1695
- {color}
1696
- </button>
1697
- ))}
1698
- </div>`
1699
- },
1700
- {
1701
- label: "Card Grid",
1702
- code: `<div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 16, padding: 24 }}>
1703
- {['Alpha', 'Beta', 'Gamma', 'Delta', 'Epsilon', 'Zeta'].map(name => (
1704
- <div key={name} style={{
1705
- background: '#1a1a2e',
1706
- borderRadius: 10,
1707
- border: '1px solid #2a2a3e',
1708
- padding: '16px',
1709
- }}>
1710
- <div style={{ fontWeight: 700, color: '#00f5d4', marginBottom: 4 }}>{name}</div>
1711
- <div style={{ fontSize: 12, color: '#8888aa' }}>Quantum module {name.toLowerCase()}</div>
1712
- </div>
1713
- ))}
1714
- </div>`
1715
- },
1716
- {
1717
- label: "Animated Counter",
1718
- code: `(() => {
1719
- const [count, setCount] = React.useState(0);
1720
- return (
1721
- <div style={{ padding: 32, textAlign: 'center', fontFamily: 'sans-serif' }}>
1722
- <div style={{ fontSize: 64, fontWeight: 900, color: '#00f5d4', marginBottom: 16 }}>
1723
- {count}
1724
- </div>
1725
- <div style={{ display: 'flex', gap: 12, justifyContent: 'center' }}>
1726
- <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>
1727
- <button onClick={() => setCount(0)} style={{ padding: '8px 20px', borderRadius: 8, border: '1px solid #2a2a3e', background: '#1a1a2e', color: '#8888aa', cursor: 'pointer' }}>Reset</button>
1728
- <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>
1729
- </div>
1730
- </div>
1731
- );
1732
- })()`
1733
- },
1734
- {
1735
- label: "Data Table",
1736
- code: `(() => {
1737
- const rows = [
1738
- { id: 1, name: 'Hydrogen', symbol: 'H', mass: 1.008 },
1739
- { id: 2, name: 'Helium', symbol: 'He', mass: 4.003 },
1740
- { id: 3, name: 'Lithium', symbol: 'Li', mass: 6.941 },
1741
- { id: 4, name: 'Carbon', symbol: 'C', mass: 12.011 },
1742
- { id: 5, name: 'Nitrogen', symbol: 'N', mass: 14.007 },
1743
- ];
1744
- const cell = { padding: '8px 14px', borderBottom: '1px solid #2a2a3e', color: '#e8e8f4', fontSize: 13 };
1745
- const hcell = { ...cell, color: '#8888aa', fontWeight: 600, fontSize: 11, textTransform: 'uppercase', letterSpacing: '0.06em' };
1746
- return (
1747
- <div style={{ padding: 16 }}>
1748
- <table style={{ width: '100%', borderCollapse: 'collapse', fontFamily: 'sans-serif' }}>
1749
- <thead>
1750
- <tr>{['ID','Element','Symbol','Atomic Mass'].map(h => <th key={h} style={hcell}>{h}</th>)}</tr>
1751
- </thead>
1752
- <tbody>
1753
- {rows.map(r => (
1754
- <tr key={r.id} style={{ transition: 'background 0.15s' }}>
1755
- <td style={cell}>{r.id}</td>
1756
- <td style={cell}>{r.name}</td>
1757
- <td style={{ ...cell, color: '#00f5d4', fontWeight: 700 }}>{r.symbol}</td>
1758
- <td style={cell}>{r.mass}</td>
1759
- </tr>
1760
- ))}
1761
- </tbody>
1762
- </table>
1763
- </div>
1764
- );
1765
- })()`
1766
- }
1767
- ];
1768
- class Te extends Z.Component {
1769
- constructor(e) {
1770
- super(e), this.state = { hasError: !1 };
1771
- }
1772
- static getDerivedStateFromError() {
1773
- return { hasError: !0 };
1774
- }
1775
- componentDidCatch(e) {
1776
- this.props.onError(e.message);
1777
- }
1778
- componentDidUpdate(e) {
1779
- e.children !== this.props.children && this.state.hasError && this.setState({ hasError: !1 });
1780
- }
1781
- render() {
1782
- return this.state.hasError ? null : this.props.children;
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
- function Ae() {
1786
- return typeof window > "u" ? null : window.Babel ?? null;
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 Be(r, e) {
1789
- const n = performance.now();
1790
- try {
1791
- const i = r.trim();
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
- const d = Ae();
1798
- d && (s = d.transform(s, {
1799
- presets: ["react"],
1800
- filename: "playground.jsx"
1801
- }).code ?? s);
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(e).join(", ")} } = imports;
1808
- ${s}
2087
+ const { ${Object.keys(t).join(", ")} } = imports;
2088
+ ${a}
1809
2089
  return PlaygroundRoot;
1810
- `
1811
- )(Z, e), f = Z.createElement(p), m = parseFloat((performance.now() - n).toFixed(2));
1812
- return { element: f, error: null, renderMs: m };
1813
- } catch (i) {
1814
- const t = parseFloat((performance.now() - n).toFixed(2));
1815
- return { element: null, error: i instanceof Error ? i.message : String(i), renderMs: t };
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 Re({ code: r, lineHeight: e }) {
1819
- const n = r.split(`
1820
- `);
1821
- return /* @__PURE__ */ a(
1822
- "div",
1823
- {
1824
- "aria-hidden": "true",
1825
- style: {
1826
- position: "absolute",
1827
- top: 0,
1828
- left: 0,
1829
- width: "36px",
1830
- padding: "12px 0",
1831
- textAlign: "right",
1832
- paddingRight: "8px",
1833
- userSelect: "none",
1834
- pointerEvents: "none",
1835
- fontSize: "12px",
1836
- lineHeight: `${e}px`,
1837
- color: "#555577",
1838
- fontFamily: '"Fira Code", "Cascadia Code", "Consolas", monospace',
1839
- boxSizing: "border-box"
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
- const ae = [
1846
- "TkxButton",
1847
- "TkxInput",
1848
- "TkxCard",
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 Ee(r, e = 4) {
1884
- if (!r || r.length < 2) return [];
1885
- const n = r.toLowerCase();
1886
- return $e.amplify(
1887
- ae,
1888
- (t) => {
1889
- const l = t.toLowerCase();
1890
- if (l.startsWith(n)) return 1;
1891
- if (l.includes(n)) return 0.7;
1892
- let s = 0;
1893
- for (let d = 0; d < n.length - 1; d++)
1894
- l.includes(n.slice(d, d + 2)) && (s += 0.15);
1895
- return Math.min(s, 0.5);
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 We({
1904
- defaultCode: r,
1905
- examples: e,
1906
- height: n = 480,
1907
- imports: i = {}
1908
- }) {
1909
- const t = K(), l = [...ie, ...e ?? []], s = r ?? ie[0].code, [d, o] = A(s), [p, f] = A({
1910
- element: null,
1911
- error: null,
1912
- renderMs: 0
1913
- }), [m, g] = A(null), [b, h] = A([]), [v, C] = A(!1), [k, P] = A(0), F = X(null), w = 18, $ = X(null), q = R(
1914
- (T) => {
1915
- g(null);
1916
- const B = Be(T, i);
1917
- f(B);
1918
- },
1919
- [i]
1920
- );
1921
- V(() => ($.current && clearTimeout($.current), $.current = setTimeout(() => q(d), 300), () => {
1922
- $.current && clearTimeout($.current);
1923
- }), [d, q]), V(() => {
1924
- q(s);
1925
- }, []);
1926
- const L = R(
1927
- (T) => {
1928
- const B = T.target.value;
1929
- o(B);
1930
- const H = se(B);
1931
- H.length >= 2 ? h(Ee(H, 4)) : h([]);
1932
- },
1933
- []
1934
- ), D = R(
1935
- (T) => {
1936
- const B = l[T];
1937
- B && (P(T), o(B.code), h([]));
1938
- },
1939
- [l]
1940
- ), E = R(async () => {
1941
- try {
1942
- await navigator.clipboard.writeText(d), C(!0), setTimeout(() => C(!1), 1500);
1943
- } catch {
1944
- }
1945
- }, [d]), I = R(() => {
1946
- o(s), P(0), h([]);
1947
- }, [s]), j = R(
1948
- (T) => {
1949
- const B = se(d);
1950
- B && o((H) => H.slice(0, H.lastIndexOf(B)) + T), h([]);
1951
- },
1952
- [d]
1953
- ), y = p.error !== null || m !== null, u = p.error ?? m ?? "", x = t.bg, M = t.surfaceAlt, S = t.border, z = t.surface, N = {
1954
- width: "50%",
1955
- display: "flex",
1956
- flexDirection: "column",
1957
- borderRight: `1px solid ${S}`,
1958
- position: "relative"
1959
- }, O = {
1960
- display: "flex",
1961
- alignItems: "center",
1962
- gap: "6px",
1963
- padding: "6px 10px",
1964
- borderBottom: `1px solid ${S}`,
1965
- backgroundColor: t.surface,
1966
- flexWrap: "wrap"
1967
- }, Q = {
1968
- padding: "3px 10px",
1969
- borderRadius: "6px",
1970
- border: `1px solid ${S}`,
1971
- backgroundColor: "transparent",
1972
- color: t.textMuted,
1973
- fontSize: "11px",
1974
- fontWeight: 600,
1975
- cursor: "pointer",
1976
- fontFamily: "inherit",
1977
- transition: "color 0.15s, border-color 0.15s"
1978
- };
1979
- return /* @__PURE__ */ c(
1980
- "div",
1981
- {
1982
- style: {
1983
- display: "flex",
1984
- flexDirection: "column",
1985
- border: `1px solid ${S}`,
1986
- borderRadius: "12px",
1987
- overflow: "hidden",
1988
- backgroundColor: x,
1989
- fontFamily: "inherit",
1990
- boxSizing: "border-box",
1991
- position: "relative"
1992
- },
1993
- children: [
1994
- /* @__PURE__ */ c(
1995
- "div",
1996
- {
1997
- style: {
1998
- display: "flex",
1999
- alignItems: "center",
2000
- justifyContent: "space-between",
2001
- padding: "8px 14px",
2002
- borderBottom: `1px solid ${S}`,
2003
- backgroundColor: t.surface
2004
- },
2005
- children: [
2006
- /* @__PURE__ */ a("span", { style: { fontSize: "12px", fontWeight: 700, color: t.primary, letterSpacing: "0.05em" }, children: "⚛ TkxPlayground" }),
2007
- /* @__PURE__ */ a("span", { style: { fontSize: "10px", color: t.textMuted }, children: "Live JSX Preview" })
2008
- ]
2009
- }
2010
- ),
2011
- /* @__PURE__ */ a(
2012
- "div",
2013
- {
2014
- style: {
2015
- display: "flex",
2016
- gap: "4px",
2017
- padding: "6px 10px",
2018
- borderBottom: `1px solid ${S}`,
2019
- backgroundColor: t.surface,
2020
- overflowX: "auto"
2021
- },
2022
- children: l.map((T, B) => /* @__PURE__ */ a(
2023
- "button",
2024
- {
2025
- onClick: () => D(B),
2026
- style: {
2027
- padding: "3px 10px",
2028
- borderRadius: "6px",
2029
- border: `1px solid ${B === k ? t.primary : S}`,
2030
- backgroundColor: B === k ? `${t.primary}20` : "transparent",
2031
- color: B === k ? t.primary : t.textMuted,
2032
- fontSize: "11px",
2033
- fontWeight: B === k ? 700 : 400,
2034
- cursor: "pointer",
2035
- whiteSpace: "nowrap",
2036
- fontFamily: "inherit",
2037
- transition: "all 0.15s"
2038
- },
2039
- children: T.label
2040
- },
2041
- B
2042
- ))
2043
- }
2044
- ),
2045
- /* @__PURE__ */ c("div", { style: { display: "flex", height: `${n}px` }, children: [
2046
- /* @__PURE__ */ c("div", { style: N, children: [
2047
- /* @__PURE__ */ c("div", { style: O, children: [
2048
- /* @__PURE__ */ a("span", { style: { fontSize: "11px", color: t.textMuted, marginRight: "auto" }, children: "editor.tsx" }),
2049
- /* @__PURE__ */ a("button", { onClick: E, style: Q, title: "Copy code", children: v ? "✓ Copied" : "⎘ Copy" }),
2050
- /* @__PURE__ */ a("button", { onClick: I, style: Q, title: "Reset to default", children: "↺ Reset" })
2051
- ] }),
2052
- /* @__PURE__ */ c("div", { style: { position: "relative", flex: 1, overflow: "hidden" }, children: [
2053
- /* @__PURE__ */ a(Re, { code: d, lineHeight: w }),
2054
- /* @__PURE__ */ a(
2055
- "textarea",
2056
- {
2057
- ref: F,
2058
- value: d,
2059
- onChange: L,
2060
- spellCheck: !1,
2061
- autoCorrect: "off",
2062
- autoCapitalize: "off",
2063
- style: {
2064
- position: "absolute",
2065
- top: 0,
2066
- left: 0,
2067
- width: "100%",
2068
- height: "100%",
2069
- padding: "12px 12px 12px 44px",
2070
- margin: 0,
2071
- border: "none",
2072
- outline: "none",
2073
- resize: "none",
2074
- backgroundColor: x,
2075
- color: t.text,
2076
- fontSize: "12px",
2077
- lineHeight: `${w}px`,
2078
- fontFamily: '"Fira Code", "Cascadia Code", "Consolas", "Courier New", monospace',
2079
- boxSizing: "border-box",
2080
- overflowY: "auto",
2081
- tabSize: 2
2082
- }
2083
- }
2084
- )
2085
- ] }),
2086
- b.length > 0 && /* @__PURE__ */ c(
2087
- "div",
2088
- {
2089
- style: {
2090
- position: "absolute",
2091
- bottom: "40px",
2092
- left: "44px",
2093
- zIndex: 10,
2094
- backgroundColor: t.surface,
2095
- border: `1px solid ${t.primary}44`,
2096
- borderRadius: "8px",
2097
- overflow: "hidden",
2098
- boxShadow: "0 4px 16px rgba(0,0,0,0.3)",
2099
- minWidth: "180px"
2100
- },
2101
- children: [
2102
- /* @__PURE__ */ a(
2103
- "div",
2104
- {
2105
- style: {
2106
- padding: "4px 10px 4px",
2107
- fontSize: "10px",
2108
- color: t.primary,
2109
- fontWeight: 700,
2110
- borderBottom: `1px solid ${S}`,
2111
- letterSpacing: "0.05em"
2112
- },
2113
- children: "⚛ Quantum Suggestions"
2114
- }
2115
- ),
2116
- b.map((T) => /* @__PURE__ */ c(
2117
- "button",
2118
- {
2119
- onClick: () => j(T.name),
2120
- style: {
2121
- display: "flex",
2122
- alignItems: "center",
2123
- justifyContent: "space-between",
2124
- width: "100%",
2125
- padding: "6px 10px",
2126
- border: "none",
2127
- backgroundColor: "transparent",
2128
- color: t.text,
2129
- fontSize: "12px",
2130
- fontFamily: '"Fira Code", monospace',
2131
- cursor: "pointer",
2132
- textAlign: "left",
2133
- gap: "12px"
2134
- },
2135
- children: [
2136
- /* @__PURE__ */ a("span", { children: T.name }),
2137
- /* @__PURE__ */ c(
2138
- "span",
2139
- {
2140
- style: {
2141
- fontSize: "10px",
2142
- color: t.textMuted,
2143
- flexShrink: 0
2144
- },
2145
- children: [
2146
- Math.round(T.amplitude * 100),
2147
- "%"
2148
- ]
2149
- }
2150
- )
2151
- ]
2152
- },
2153
- T.name
2154
- ))
2155
- ]
2156
- }
2157
- )
2158
- ] }),
2159
- /* @__PURE__ */ c(
2160
- "div",
2161
- {
2162
- style: {
2163
- width: "50%",
2164
- display: "flex",
2165
- flexDirection: "column"
2166
- },
2167
- children: [
2168
- /* @__PURE__ */ a(
2169
- "div",
2170
- {
2171
- style: {
2172
- padding: "6px 10px",
2173
- borderBottom: `1px solid ${S}`,
2174
- backgroundColor: t.surface,
2175
- fontSize: "11px",
2176
- color: t.textMuted,
2177
- fontWeight: 600
2178
- },
2179
- children: "Preview"
2180
- }
2181
- ),
2182
- /* @__PURE__ */ a(
2183
- "div",
2184
- {
2185
- style: {
2186
- flex: 1,
2187
- overflow: "auto",
2188
- backgroundColor: M,
2189
- position: "relative"
2190
- },
2191
- children: y ? /* @__PURE__ */ c(
2192
- "div",
2193
- {
2194
- style: {
2195
- padding: "16px",
2196
- color: t.danger,
2197
- fontFamily: '"Fira Code", monospace',
2198
- fontSize: "12px",
2199
- lineHeight: 1.6,
2200
- whiteSpace: "pre-wrap",
2201
- wordBreak: "break-word"
2202
- },
2203
- children: [
2204
- /* @__PURE__ */ c(
2205
- "div",
2206
- {
2207
- style: {
2208
- marginBottom: "8px",
2209
- fontWeight: 700,
2210
- display: "flex",
2211
- alignItems: "center",
2212
- gap: "6px"
2213
- },
2214
- children: [
2215
- /* @__PURE__ */ a("svg", { width: "14", height: "14", 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" }) }),
2216
- "Runtime Error"
2217
- ]
2218
- }
2219
- ),
2220
- u
2221
- ]
2222
- }
2223
- ) : /* @__PURE__ */ a(Te, { onError: g, children: /* @__PURE__ */ a("div", { style: { minHeight: "100%" }, children: p.element }) })
2224
- }
2225
- )
2226
- ]
2227
- }
2228
- )
2229
- ] }),
2230
- /* @__PURE__ */ c(
2231
- "div",
2232
- {
2233
- style: {
2234
- display: "flex",
2235
- alignItems: "center",
2236
- gap: "16px",
2237
- padding: "4px 12px",
2238
- backgroundColor: z,
2239
- borderTop: `1px solid ${S}`,
2240
- fontSize: "11px",
2241
- color: t.textMuted
2242
- },
2243
- children: [
2244
- /* @__PURE__ */ c(
2245
- "span",
2246
- {
2247
- style: {
2248
- display: "flex",
2249
- alignItems: "center",
2250
- gap: "4px",
2251
- color: y ? t.danger : t.success,
2252
- fontWeight: 600
2253
- },
2254
- children: [
2255
- /* @__PURE__ */ a(
2256
- "span",
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
- We.displayName = "TkxPlayground";
2299
- export {
2300
- ee as AmplitudeAmplifier,
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 };