@mickyballadelli/react-things 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2368 @@
1
+ import { jsxs as m, jsx as e, Fragment as Ee } from "react/jsx-runtime";
2
+ import { Box as ne, Typography as $e } from "@mui/material";
3
+ import { useRef as oe, useState as T, useLayoutEffect as Xe, useId as He, useMemo as Ce, useEffect as fe, useCallback as je } from "react";
4
+ import p from "@mui/material/Box";
5
+ import { alpha as H } from "@mui/material/styles";
6
+ import ie from "@mui/material/Tooltip";
7
+ import N from "@mui/material/Typography";
8
+ import Ge from "@mui/material/Collapse";
9
+ import Ve from "@mui/material/InputBase";
10
+ import qe from "@mui/material/List";
11
+ import Ae from "@mui/material/ListItemButton";
12
+ import Ue from "@mui/material/ListItemIcon";
13
+ import Re from "@mui/material/ListItemText";
14
+ import _e from "@mui/icons-material/AddBox";
15
+ import Ze from "@mui/icons-material/AddLink";
16
+ import Qe from "@mui/icons-material/Close";
17
+ import Je from "@mui/icons-material/Delete";
18
+ import Ke from "@mui/icons-material/LinkOff";
19
+ import ue from "@mui/material/IconButton";
20
+ import pe from "@mui/material/MenuItem";
21
+ import q from "@mui/material/Stack";
22
+ import Z from "@mui/material/TextField";
23
+ import et from "@mui/icons-material/DragIndicator";
24
+ import ae from "@mui/material/Button";
25
+ import tt from "@mui/material/Checkbox";
26
+ import we from "@mui/material/Chip";
27
+ import rt from "@mui/material/Divider";
28
+ import nt from "@mui/material/FormControlLabel";
29
+ import Ye from "@mui/material/Paper";
30
+ import Fe from "@mui/material/Slider";
31
+ import ot from "@mui/material/InputAdornment";
32
+ import it from "@mui/icons-material/ContentCopy";
33
+ import at from "@mui/icons-material/PushPin";
34
+ import lt from "@mui/icons-material/PushPinOutlined";
35
+ import st from "@mui/material/ClickAwayListener";
36
+ import ct from "@mui/material/Popper";
37
+ function lr({ title: t = "React Things", children: n }) {
38
+ return /* @__PURE__ */ m(
39
+ ne,
40
+ {
41
+ sx: {
42
+ border: 1,
43
+ borderColor: "divider",
44
+ borderRadius: 1,
45
+ p: 2,
46
+ bgcolor: "background.paper"
47
+ },
48
+ children: [
49
+ /* @__PURE__ */ e($e, { variant: "subtitle1", fontWeight: 700, children: t }),
50
+ n ? /* @__PURE__ */ e(ne, { sx: { mt: 1 }, children: n }) : null
51
+ ]
52
+ }
53
+ );
54
+ }
55
+ const ve = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace", Le = 12, dt = {
56
+ c: "#659ad2",
57
+ cpp: "#00599c",
58
+ cplusplus: "#00599c",
59
+ "c++": "#00599c",
60
+ typescript: "#3178c6",
61
+ ts: "#3178c6",
62
+ tsx: "#3178c6",
63
+ javascript: "#f7df1e",
64
+ js: "#f7df1e",
65
+ jsx: "#f7df1e",
66
+ java: "#e76f00",
67
+ powershell: "#5391fe",
68
+ ps1: "#5391fe",
69
+ rust: "#dea584",
70
+ rs: "#dea584",
71
+ go: "#00add8",
72
+ golang: "#00add8",
73
+ shell: "#89e051",
74
+ sh: "#89e051",
75
+ bash: "#89e051",
76
+ zsh: "#89e051",
77
+ python: "#3776ab",
78
+ py: "#3776ab",
79
+ csharp: "#9b4f96",
80
+ "c#": "#9b4f96",
81
+ cs: "#9b4f96",
82
+ php: "#777bb4",
83
+ ruby: "#cc342d",
84
+ rb: "#cc342d",
85
+ swift: "#f05138",
86
+ kotlin: "#a97bff",
87
+ kt: "#a97bff",
88
+ sql: "#336791",
89
+ html: "#e34f26",
90
+ css: "#1572b6",
91
+ dart: "#0175c2"
92
+ };
93
+ function ut(t) {
94
+ return t.trim().replace(/^\./, "").toLowerCase().replace(/\s+/g, "");
95
+ }
96
+ function pt(t) {
97
+ return dt[ut(t)] ?? "#93c5fd";
98
+ }
99
+ function ht(t) {
100
+ return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
101
+ }
102
+ function ft(t) {
103
+ const n = ht(t), d = /^(import|from|export|function|return|const|let|var|type|interface|class|extends|new|if|else|for|while|switch|case|break|continue|async|await|try|catch|finally|throw|fn|pub|use|mod|impl|trait|struct|enum|match|mut|let|where|package|func|defer|go|select|range|map|chan|SELECT|FROM|WHERE|AS|AND|OR|INSERT|UPDATE|DELETE|CREATE|TABLE|ORDER|BY|GROUP|LIMIT|select|from|where|as|and|or|insert|update|delete|create|table|order|by|group|limit)\b/;
104
+ return /^['"`]/.test(t) ? `<span style="color:#86efac">${n}</span>` : /^\d/.test(t) ? `<span style="color:#fbbf24">${n}</span>` : /^<\/?[A-Z][\w.]*/.test(t) ? `<span style="color:#67e8f9">${n}</span>` : d.test(t) ? `<span style="color:#c084fc">${n}</span>` : /^[$#][\w-]+$|^\.[\w-]+$/.test(t) ? `<span style="color:#f9a8d4">${n}</span>` : /^[A-Z][\w.]*$/.test(t) ? `<span style="color:#93c5fd">${n}</span>` : /^[a-z][\w-]*(?==|:)/.test(t) ? `<span style="color:#f9a8d4">${n}</span>` : /^[{}()[\].,:;=<>/]+$/.test(t) ? `<span style="color:#94a3b8">${n}</span>` : n;
105
+ }
106
+ function bt(t) {
107
+ return t.split(/(\s+|<\/?[A-Z][\w.]*|['"`][^'"`]*['"`]|\d*\.?\d+|[A-Za-z_$][\w$-]*|[{}()[\].,:;=<>/]+)/g).map((n) => ft(n)).join("");
108
+ }
109
+ function sr({ label: t, language: n, value: d, onChange: s, minHeight: b = 360 }) {
110
+ const c = d ?? "", g = Math.max(c.split(`
111
+ `).length, 1), f = Array.from({ length: g }, (y, k) => k + 1).join(`
112
+ `), a = bt(c), x = pt(n);
113
+ return /* @__PURE__ */ m(ne, { children: [
114
+ /* @__PURE__ */ m(
115
+ ne,
116
+ {
117
+ sx: {
118
+ display: "flex",
119
+ alignItems: "center",
120
+ justifyContent: "space-between",
121
+ px: 1.5,
122
+ py: 1,
123
+ bgcolor: "#111827",
124
+ color: "#d1d5db",
125
+ borderTopLeftRadius: 4,
126
+ borderTopRightRadius: 4
127
+ },
128
+ children: [
129
+ /* @__PURE__ */ e($e, { variant: "caption", fontWeight: 800, children: t }),
130
+ /* @__PURE__ */ e(
131
+ $e,
132
+ {
133
+ variant: "caption",
134
+ sx: {
135
+ fontFamily: "monospace",
136
+ color: x,
137
+ textTransform: "lowercase"
138
+ },
139
+ children: n
140
+ }
141
+ )
142
+ ]
143
+ }
144
+ ),
145
+ /* @__PURE__ */ m(
146
+ ne,
147
+ {
148
+ sx: {
149
+ display: "grid",
150
+ gridTemplateColumns: "48px 1fr",
151
+ minHeight: b,
152
+ bgcolor: "#0f172a",
153
+ borderBottomLeftRadius: 4,
154
+ borderBottomRightRadius: 4,
155
+ overflow: "hidden"
156
+ },
157
+ children: [
158
+ /* @__PURE__ */ e(
159
+ ne,
160
+ {
161
+ component: "pre",
162
+ "aria-hidden": "true",
163
+ sx: {
164
+ m: 0,
165
+ px: 1.5,
166
+ py: 1.5,
167
+ color: "#64748b",
168
+ bgcolor: "#111827",
169
+ fontFamily: ve,
170
+ fontSize: 14,
171
+ lineHeight: 1.6,
172
+ textAlign: "right",
173
+ userSelect: "none"
174
+ },
175
+ children: f
176
+ }
177
+ ),
178
+ /* @__PURE__ */ m(
179
+ ne,
180
+ {
181
+ sx: {
182
+ position: "relative",
183
+ minHeight: b,
184
+ bgcolor: "#0f172a",
185
+ overflow: "auto"
186
+ },
187
+ children: [
188
+ /* @__PURE__ */ e(
189
+ ne,
190
+ {
191
+ component: "pre",
192
+ "aria-hidden": "true",
193
+ dangerouslySetInnerHTML: { __html: a },
194
+ sx: {
195
+ position: "absolute",
196
+ inset: 0,
197
+ m: 0,
198
+ p: `${Le}px`,
199
+ boxSizing: "border-box",
200
+ pointerEvents: "none",
201
+ color: "#e5e7eb",
202
+ fontFamily: ve,
203
+ fontSize: 14,
204
+ lineHeight: 1.6,
205
+ tabSize: 2,
206
+ whiteSpace: "pre-wrap",
207
+ overflowWrap: "normal"
208
+ }
209
+ }
210
+ ),
211
+ /* @__PURE__ */ e(
212
+ ne,
213
+ {
214
+ component: "textarea",
215
+ "aria-label": `${t} code editor`,
216
+ spellCheck: !1,
217
+ value: c,
218
+ onChange: (y) => s(y.target.value),
219
+ sx: {
220
+ position: "relative",
221
+ width: "100%",
222
+ minWidth: 0,
223
+ minHeight: b,
224
+ resize: "vertical",
225
+ border: 0,
226
+ outline: 0,
227
+ p: `${Le}px`,
228
+ boxSizing: "border-box",
229
+ color: "transparent",
230
+ WebkitTextFillColor: "transparent",
231
+ bgcolor: "transparent",
232
+ caretColor: "#60a5fa",
233
+ fontFamily: ve,
234
+ fontSize: 14,
235
+ lineHeight: 1.6,
236
+ tabSize: 2,
237
+ whiteSpace: "pre-wrap",
238
+ overflow: "auto",
239
+ textShadow: "none",
240
+ MozOsxFontSmoothing: "auto",
241
+ "&::selection": {
242
+ color: "transparent",
243
+ WebkitTextFillColor: "transparent",
244
+ bgcolor: "rgba(96, 165, 250, 0.35)"
245
+ }
246
+ }
247
+ }
248
+ )
249
+ ]
250
+ }
251
+ )
252
+ ]
253
+ }
254
+ )
255
+ ] });
256
+ }
257
+ function cr({
258
+ children: t,
259
+ initialPosition: n = { x: 50, y: 50 },
260
+ dragSx: d,
261
+ onPositionChange: s,
262
+ onDraggingChange: b,
263
+ sx: c,
264
+ ...g
265
+ }) {
266
+ const f = oe(null), a = oe(null), [x, y] = T(n), [k, v] = T({ x: 0, y: 0 }), [B, C] = T(!1);
267
+ Xe(() => {
268
+ const u = f.current, z = a.current;
269
+ if (!u || !z)
270
+ return;
271
+ const Y = u.getBoundingClientRect(), E = z.getBoundingClientRect(), $ = window.getComputedStyle(u), W = x.x / 100 * Y.width, w = x.y / 100 * Y.height;
272
+ s?.(x, {
273
+ containerWidth: Y.width,
274
+ containerHeight: Y.height,
275
+ draggableWidth: E.width,
276
+ draggableHeight: E.height,
277
+ draggableLeft: W - E.width / 2,
278
+ draggableTop: w - E.height / 2,
279
+ containerBackgroundImage: $.backgroundImage,
280
+ containerBackgroundSize: $.backgroundSize,
281
+ containerBackgroundPosition: $.backgroundPosition
282
+ });
283
+ }, []);
284
+ function o(u, z) {
285
+ y(u), s?.(u, z);
286
+ }
287
+ function R(u, z, Y = k) {
288
+ const E = f.current, $ = a.current;
289
+ if (!E || !$)
290
+ return;
291
+ const W = E.getBoundingClientRect(), w = $.getBoundingClientRect(), L = window.getComputedStyle(E), j = u - Y.x + w.width / 2, F = z - Y.y + w.height / 2, l = w.width / W.width * 50, M = w.height / W.height * 50, h = (j - W.left) / W.width * 100, S = (F - W.top) / W.height * 100, D = {
292
+ x: Math.min(Math.max(h, l), 100 - l),
293
+ y: Math.min(Math.max(S, M), 100 - M)
294
+ }, i = D.x / 100 * W.width, P = D.y / 100 * W.height;
295
+ o(D, {
296
+ containerWidth: W.width,
297
+ containerHeight: W.height,
298
+ draggableWidth: w.width,
299
+ draggableHeight: w.height,
300
+ draggableLeft: i - w.width / 2,
301
+ draggableTop: P - w.height / 2,
302
+ containerBackgroundImage: L.backgroundImage,
303
+ containerBackgroundSize: L.backgroundSize,
304
+ containerBackgroundPosition: L.backgroundPosition
305
+ });
306
+ }
307
+ return /* @__PURE__ */ e(
308
+ p,
309
+ {
310
+ ...g,
311
+ ref: f,
312
+ sx: [
313
+ {
314
+ position: "relative",
315
+ overflow: "hidden",
316
+ touchAction: "none"
317
+ },
318
+ ...Array.isArray(c) ? c : c ? [c] : []
319
+ ],
320
+ onPointerMove: (u) => {
321
+ B && R(u.clientX, u.clientY);
322
+ },
323
+ onPointerUp: (u) => {
324
+ C(!1), b?.(!1), u.currentTarget.releasePointerCapture(u.pointerId);
325
+ },
326
+ onPointerCancel: () => {
327
+ C(!1), b?.(!1);
328
+ },
329
+ children: /* @__PURE__ */ e(
330
+ p,
331
+ {
332
+ ref: a,
333
+ sx: [
334
+ {
335
+ position: "absolute",
336
+ left: `${x.x}%`,
337
+ top: `${x.y}%`,
338
+ transform: "translate(-50%, -50%)",
339
+ cursor: B ? "grabbing" : "grab",
340
+ userSelect: "none"
341
+ },
342
+ ...Array.isArray(d) ? d : d ? [d] : []
343
+ ],
344
+ onPointerDown: (u) => {
345
+ const z = u.currentTarget.getBoundingClientRect(), Y = {
346
+ x: u.clientX - z.left,
347
+ y: u.clientY - z.top
348
+ };
349
+ C(!0), b?.(!0), v(Y), u.currentTarget.setPointerCapture(u.pointerId), R(u.clientX, u.clientY, Y);
350
+ },
351
+ children: t
352
+ }
353
+ )
354
+ }
355
+ );
356
+ }
357
+ function Pe(t) {
358
+ return Math.min(Math.max(t, 0), 1);
359
+ }
360
+ function dr({
361
+ transparency: t = 0.36,
362
+ fill: n = 0.72,
363
+ liquidColor: d = "#39b8ff",
364
+ glassColor: s = "#ffffff",
365
+ motion: b = 0,
366
+ refractionActive: c = !0,
367
+ children: g,
368
+ sx: f,
369
+ ...a
370
+ }) {
371
+ const y = `glass-liquid-${He().replace(/:/g, "")}`, k = 1 - Pe(t), v = Pe(t), C = `${(1 - Math.min(Math.max(n, 0), 1)) * 100}%`, o = Math.abs(Math.round(b * 8)) + 1, R = 0.012 + Math.abs(Math.sin(b / 17)) * 0.012, u = 18 + k * 18, z = c;
372
+ return /* @__PURE__ */ m(
373
+ p,
374
+ {
375
+ ...a,
376
+ sx: [
377
+ {
378
+ position: "relative",
379
+ overflow: "hidden",
380
+ border: 1,
381
+ borderColor: H(s, 0.48),
382
+ borderRadius: 2,
383
+ minHeight: 160,
384
+ p: 3,
385
+ color: "common.white",
386
+ bgcolor: H(s, 0.08 + v * 0.18),
387
+ boxShadow: `
388
+ inset 0 1px 0 ${H(s, 0.68)},
389
+ inset 14px 0 34px ${H(s, 0.12)},
390
+ inset -18px 0 32px ${H(d, k * 0.2)},
391
+ 0 18px 48px ${H("#0b2030", 0.18)}
392
+ `,
393
+ backdropFilter: "blur(12px) saturate(170%) contrast(108%)",
394
+ WebkitBackdropFilter: "blur(12px) saturate(170%) contrast(108%)",
395
+ "&::before": {
396
+ content: '""',
397
+ position: "absolute",
398
+ left: 0,
399
+ right: 0,
400
+ top: C,
401
+ bottom: 0,
402
+ background: `
403
+ linear-gradient(160deg, ${H(s, k * 0.16)} 0%, ${H(d, k * 0.28)} 42%, ${H("#063451", k * 0.2)} 100%)
404
+ `,
405
+ opacity: 0.95,
406
+ boxShadow: `
407
+ inset 0 18px 28px ${H(s, 0.12 + k * 0.16)},
408
+ inset 0 -34px 44px ${H("#032536", k * 0.22)}
409
+ `
410
+ },
411
+ "&::after": {
412
+ content: '""',
413
+ position: "absolute",
414
+ inset: 0,
415
+ background: `
416
+ linear-gradient(105deg, ${H(s, 0.34)} 0%, ${H(s, 0.08)} 18%, ${H(s, 0)} 34%),
417
+ radial-gradient(circle at 18% 18%, ${H(s, 0.38)} 0 3%, ${H(s, 0)} 18%)
418
+ `,
419
+ pointerEvents: "none"
420
+ },
421
+ "& .GlassBox-liquidLens": {
422
+ position: "absolute",
423
+ inset: 0,
424
+ zIndex: 1,
425
+ pointerEvents: "none",
426
+ backgroundImage: "var(--glassbox-refraction-background, none)",
427
+ backgroundSize: "var(--glassbox-refraction-background-size, cover)",
428
+ backgroundPosition: "var(--glassbox-refraction-background-position, center)",
429
+ backgroundRepeat: "no-repeat",
430
+ filter: `url(#${y}) saturate(150%) contrast(112%)`,
431
+ opacity: z ? 0.72 : 0,
432
+ transition: "opacity 120ms ease-out",
433
+ maskImage: `linear-gradient(to bottom, transparent 0, transparent calc(${C} + 10px), black calc(${C} + 28px), black 100%)`,
434
+ WebkitMaskImage: `linear-gradient(to bottom, transparent 0, transparent calc(${C} + 10px), black calc(${C} + 28px), black 100%)`
435
+ },
436
+ "& .GlassBox-refractionOffset": {
437
+ position: "absolute",
438
+ inset: 0,
439
+ zIndex: 2,
440
+ pointerEvents: "none",
441
+ opacity: z ? 0.16 + v * 0.16 : 0,
442
+ backdropFilter: "blur(3px) saturate(190%)",
443
+ WebkitBackdropFilter: "blur(3px) saturate(190%)",
444
+ background: `
445
+ linear-gradient(180deg, ${H(s, 0.2)} 0, ${H(s, 0)} 20%),
446
+ linear-gradient(90deg, ${H(s, 0)} 0 18%, ${H(s, 0.14)} 26%, ${H(s, 0)} 34% 58%, ${H(s, 0.1)} 68%, ${H(s, 0)} 76% 100%)
447
+ `,
448
+ transition: "opacity 120ms ease-out",
449
+ maskImage: `linear-gradient(to bottom, transparent 0, transparent ${C}, black calc(${C} + 18px), black 100%)`,
450
+ WebkitMaskImage: `linear-gradient(to bottom, transparent 0, transparent ${C}, black calc(${C} + 18px), black 100%)`
451
+ },
452
+ "& .GlassBox-content": {
453
+ position: "relative",
454
+ zIndex: 3,
455
+ textShadow: `0 1px 10px ${H("#00121d", 0.36)}`
456
+ },
457
+ "& > *": {
458
+ position: "relative",
459
+ zIndex: 3
460
+ }
461
+ },
462
+ ...Array.isArray(f) ? f : f ? [f] : []
463
+ ],
464
+ children: [
465
+ /* @__PURE__ */ e(
466
+ p,
467
+ {
468
+ component: "svg",
469
+ "aria-hidden": "true",
470
+ focusable: "false",
471
+ sx: { position: "absolute", width: 0, height: 0, overflow: "hidden" },
472
+ children: /* @__PURE__ */ m("filter", { id: y, children: [
473
+ /* @__PURE__ */ e(
474
+ "feTurbulence",
475
+ {
476
+ type: "fractalNoise",
477
+ baseFrequency: `${R} ${R * 2.6}`,
478
+ numOctaves: "2",
479
+ seed: o,
480
+ result: "liquidNoise"
481
+ }
482
+ ),
483
+ /* @__PURE__ */ e(
484
+ "feDisplacementMap",
485
+ {
486
+ in: "SourceGraphic",
487
+ in2: "liquidNoise",
488
+ scale: u,
489
+ xChannelSelector: "R",
490
+ yChannelSelector: "G"
491
+ }
492
+ )
493
+ ] })
494
+ }
495
+ ),
496
+ /* @__PURE__ */ e(p, { className: "GlassBox-liquidLens" }),
497
+ /* @__PURE__ */ e(p, { className: "GlassBox-refractionOffset" }),
498
+ /* @__PURE__ */ e(p, { className: "GlassBox-content", children: g })
499
+ ]
500
+ }
501
+ );
502
+ }
503
+ function gt(t, n, d) {
504
+ return Math.min(Math.max(t, n), d);
505
+ }
506
+ function ur({
507
+ items: t,
508
+ iconSize: n = 52,
509
+ magnification: d = 1.7,
510
+ gap: s = 10,
511
+ tooltip: b = !0,
512
+ sx: c,
513
+ ...g
514
+ }) {
515
+ const [f, a] = T(null);
516
+ return /* @__PURE__ */ e(
517
+ p,
518
+ {
519
+ ...g,
520
+ role: "toolbar",
521
+ sx: [
522
+ {
523
+ display: "inline-flex",
524
+ alignItems: "flex-end",
525
+ gap: `${s}px`,
526
+ p: 1,
527
+ border: 1,
528
+ borderColor: "rgba(255,255,255,0.5)",
529
+ borderRadius: 3,
530
+ bgcolor: "rgba(255,255,255,0.34)",
531
+ boxShadow: "0 18px 44px rgba(15, 23, 42, 0.22)",
532
+ backdropFilter: "blur(18px) saturate(150%)",
533
+ WebkitBackdropFilter: "blur(18px) saturate(150%)"
534
+ },
535
+ ...Array.isArray(c) ? c : c ? [c] : []
536
+ ],
537
+ onMouseLeave: () => a(null),
538
+ children: t.map((x, y) => {
539
+ const k = f === null ? 4 : Math.abs(y - f), v = gt(1 - k / 3, 0, 1), B = 1 + (d - 1) * v, C = -18 * v, o = /* @__PURE__ */ e(
540
+ p,
541
+ {
542
+ component: "button",
543
+ type: "button",
544
+ "aria-label": x.label,
545
+ onClick: x.onClick,
546
+ onMouseEnter: () => a(y),
547
+ sx: {
548
+ width: n,
549
+ height: n,
550
+ display: "grid",
551
+ placeItems: "center",
552
+ flex: "0 0 auto",
553
+ border: 0,
554
+ borderRadius: 2,
555
+ p: 0,
556
+ color: "inherit",
557
+ bgcolor: "rgba(255,255,255,0.72)",
558
+ boxShadow: "inset 0 1px 0 rgba(255,255,255,0.85), 0 8px 18px rgba(15, 23, 42, 0.18)",
559
+ cursor: "pointer",
560
+ transform: `translateY(${C}px) scale(${B})`,
561
+ transformOrigin: "bottom center",
562
+ transition: "transform 130ms ease-out, background-color 130ms ease-out",
563
+ "&:focus-visible": {
564
+ outline: "2px solid #2563eb",
565
+ outlineOffset: 3
566
+ },
567
+ "&:active": {
568
+ bgcolor: "rgba(255,255,255,0.9)"
569
+ }
570
+ },
571
+ children: /* @__PURE__ */ e(
572
+ N,
573
+ {
574
+ component: "span",
575
+ "aria-hidden": "true",
576
+ sx: {
577
+ display: "grid",
578
+ placeItems: "center",
579
+ fontSize: Math.round(n * 0.52),
580
+ lineHeight: 1
581
+ },
582
+ children: x.icon
583
+ }
584
+ )
585
+ },
586
+ x.id
587
+ );
588
+ return b ? /* @__PURE__ */ e(ie, { title: x.label, placement: "top", arrow: !0, children: o }, x.id) : o;
589
+ })
590
+ }
591
+ );
592
+ }
593
+ function Ne(t) {
594
+ return t.toLowerCase().trim();
595
+ }
596
+ function mt(t) {
597
+ return Ne([
598
+ t.label,
599
+ t.description,
600
+ t.group,
601
+ t.parentId,
602
+ ...t.keywords ?? []
603
+ ].filter(Boolean).join(" "));
604
+ }
605
+ function Te(t) {
606
+ return Array.from(new Set(t.map((n) => n.group).filter(Boolean)));
607
+ }
608
+ function pr({
609
+ items: t,
610
+ variant: n = "list",
611
+ selectedId: d,
612
+ placeholder: s = "Search",
613
+ emptyText: b = "No items found",
614
+ maxResults: c,
615
+ showSearch: g = !0,
616
+ dense: f = !1,
617
+ expandedGroups: a,
618
+ defaultExpandedGroups: x,
619
+ onExpandedGroupsChange: y,
620
+ onSelect: k,
621
+ sx: v,
622
+ ...B
623
+ }) {
624
+ const C = x ?? Te(t), [o, R] = T(""), [u, z] = T(0), [Y, E] = T(C), $ = Ne(o), W = a ?? Y, w = Ce(() => {
625
+ const i = $ ? t.filter((P) => mt(P).includes($)) : t;
626
+ return typeof c == "number" ? i.slice(0, c) : i;
627
+ }, [t, c, $]), L = Te(w), j = w;
628
+ function F(i) {
629
+ i.onSelect?.(), k?.(i), R(""), z(0);
630
+ }
631
+ function l(i) {
632
+ a === void 0 && E(i), y?.(i);
633
+ }
634
+ function M(i) {
635
+ l(W.includes(i) ? W.filter((P) => P !== i) : [...W, i]);
636
+ }
637
+ function h(i, P = 0) {
638
+ const Q = i.id === d;
639
+ return /* @__PURE__ */ m(
640
+ Ae,
641
+ {
642
+ selected: Q,
643
+ dense: f,
644
+ onClick: () => F(i),
645
+ sx: {
646
+ borderRadius: 1,
647
+ pl: 1.25 + P * 2,
648
+ "&.Mui-selected": {
649
+ bgcolor: "action.selected",
650
+ color: "primary.main"
651
+ },
652
+ "&.Mui-selected:hover, &:hover": {
653
+ bgcolor: "action.hover"
654
+ }
655
+ },
656
+ children: [
657
+ i.icon ? /* @__PURE__ */ e(Ue, { sx: { minWidth: 34, color: "inherit" }, children: i.icon }) : null,
658
+ /* @__PURE__ */ e(
659
+ Re,
660
+ {
661
+ primary: i.label,
662
+ secondary: i.description,
663
+ primaryTypographyProps: { fontWeight: Q ? 850 : 700 },
664
+ secondaryTypographyProps: { color: "text.secondary" }
665
+ }
666
+ )
667
+ ]
668
+ },
669
+ i.id
670
+ );
671
+ }
672
+ function S() {
673
+ return w.length ? L.length ? L.map((i) => /* @__PURE__ */ m(p, { children: [
674
+ /* @__PURE__ */ e(N, { variant: "caption", fontWeight: 900, color: "text.secondary", sx: { display: "block", px: 1.25, pt: 1.5, pb: 0.5 }, children: i }),
675
+ w.filter((P) => P.group === i).map((P) => h(P))
676
+ ] }, i)) : w.map((i) => h(i)) : /* @__PURE__ */ e(p, { sx: { px: 2, py: 4, textAlign: "center", color: "text.secondary" }, children: b });
677
+ }
678
+ function D() {
679
+ return w.length ? L.length ? L.map((i) => {
680
+ const P = $ || W.includes(i);
681
+ return /* @__PURE__ */ m(p, { children: [
682
+ /* @__PURE__ */ m(
683
+ Ae,
684
+ {
685
+ dense: f,
686
+ onClick: () => M(i),
687
+ sx: { borderRadius: 1, px: 1.25 },
688
+ children: [
689
+ /* @__PURE__ */ e(N, { component: "span", "aria-hidden": "true", sx: { mr: 1, width: 16, color: "text.secondary" }, children: P ? "▾" : "▸" }),
690
+ /* @__PURE__ */ e(
691
+ Re,
692
+ {
693
+ primary: i,
694
+ primaryTypographyProps: { fontWeight: 900 }
695
+ }
696
+ )
697
+ ]
698
+ }
699
+ ),
700
+ /* @__PURE__ */ e(Ge, { in: !!P, timeout: "auto", unmountOnExit: !0, children: w.filter((Q) => Q.group === i).map((Q) => h(Q, 1)) })
701
+ ] }, i);
702
+ }) : w.map((i) => h(i)) : /* @__PURE__ */ e(p, { sx: { px: 2, py: 4, textAlign: "center", color: "text.secondary" }, children: b });
703
+ }
704
+ return /* @__PURE__ */ m(
705
+ p,
706
+ {
707
+ ...B,
708
+ sx: [
709
+ {
710
+ display: "flex",
711
+ flexDirection: "column",
712
+ gap: 1,
713
+ minWidth: 0
714
+ },
715
+ ...Array.isArray(v) ? v : v ? [v] : []
716
+ ],
717
+ children: [
718
+ g ? /* @__PURE__ */ e(
719
+ p,
720
+ {
721
+ sx: {
722
+ px: 1.25,
723
+ py: 0.75,
724
+ border: 1,
725
+ borderColor: "divider",
726
+ borderRadius: 1,
727
+ bgcolor: "background.paper"
728
+ },
729
+ children: /* @__PURE__ */ e(
730
+ Ve,
731
+ {
732
+ fullWidth: !0,
733
+ value: o,
734
+ placeholder: s,
735
+ onChange: (i) => {
736
+ R(i.target.value), z(0);
737
+ },
738
+ onKeyDown: (i) => {
739
+ i.key === "ArrowDown" && (i.preventDefault(), z((P) => Math.min(P + 1, j.length - 1))), i.key === "ArrowUp" && (i.preventDefault(), z((P) => Math.max(P - 1, 0))), i.key === "Enter" && j[u] && (i.preventDefault(), F(j[u]));
740
+ },
741
+ sx: { fontSize: 14 }
742
+ }
743
+ )
744
+ }
745
+ ) : null,
746
+ /* @__PURE__ */ e(qe, { disablePadding: !0, dense: f, sx: { overflow: "auto" }, children: n === "tree" ? D() : S() })
747
+ ]
748
+ }
749
+ );
750
+ }
751
+ function We(t, n, d) {
752
+ return Math.min(Math.max(t, n), d);
753
+ }
754
+ function xt(t) {
755
+ if (!t || typeof window > "u")
756
+ return null;
757
+ const n = window.localStorage.getItem(t), d = n === null ? Number.NaN : Number(n);
758
+ return Number.isFinite(d) ? d : null;
759
+ }
760
+ function hr({
761
+ first: t,
762
+ second: n,
763
+ orientation: d = "horizontal",
764
+ initialSize: s = 50,
765
+ size: b,
766
+ defaultSize: c,
767
+ minSize: g = 20,
768
+ maxSize: f = 80,
769
+ dividerSize: a = 8,
770
+ snapPoints: x = [],
771
+ snapThreshold: y = 4,
772
+ resetSize: k = c ?? s,
773
+ collapsed: v,
774
+ defaultCollapsed: B = null,
775
+ collapsedSize: C = 0,
776
+ persistKey: o,
777
+ keyboardStep: R = 5,
778
+ onSizeChange: u,
779
+ onCollapsedChange: z,
780
+ onDraggingChange: Y,
781
+ dividerLabel: E = "Resize panels",
782
+ sx: $,
783
+ ...W
784
+ }) {
785
+ const w = oe(null), [L, j] = T(() => xt(o) ?? c ?? s), [F, l] = T(B), [M, h] = T(!1), S = d === "horizontal", i = We(b ?? L, g, f), P = v ?? F, Q = P === "first" ? C : P === "second" ? 100 - C : i, le = P === "first" && C <= 0, se = P === "second" && C <= 0;
786
+ fe(() => {
787
+ o && window.localStorage.setItem(o, String(i));
788
+ }, [o, i]), fe(() => {
789
+ Y?.(M);
790
+ }, [M, Y]);
791
+ function V(I) {
792
+ const te = x.reduce((ce, ge) => {
793
+ const me = Math.abs(ce - I);
794
+ return Math.abs(ge - I) < me ? ge : ce;
795
+ }, I), re = Math.abs(te - I) <= y, J = We(re ? te : I, g, f);
796
+ b === void 0 && j(J), u?.(J), be(null);
797
+ }
798
+ function ee(I, te) {
799
+ const re = w.current;
800
+ if (!re)
801
+ return;
802
+ const J = re.getBoundingClientRect(), ce = S ? (I - J.left) / J.width * 100 : (te - J.top) / J.height * 100;
803
+ V(ce);
804
+ }
805
+ function U(I) {
806
+ V(i + I);
807
+ }
808
+ function K() {
809
+ V(k);
810
+ }
811
+ function he(I) {
812
+ be(P === I ? null : I);
813
+ }
814
+ function be(I) {
815
+ v === void 0 && l(I), z?.(I);
816
+ }
817
+ return /* @__PURE__ */ m(
818
+ p,
819
+ {
820
+ ...W,
821
+ ref: w,
822
+ sx: [
823
+ {
824
+ display: "grid",
825
+ gridTemplateColumns: S ? `${Q}% ${a}px 1fr` : "1fr",
826
+ gridTemplateRows: S ? "1fr" : `${Q}% ${a}px 1fr`,
827
+ minHeight: 280,
828
+ overflow: "hidden",
829
+ userSelect: M ? "none" : void 0
830
+ },
831
+ ...Array.isArray($) ? $ : $ ? [$] : []
832
+ ],
833
+ onPointerMove: (I) => {
834
+ M && ee(I.clientX, I.clientY);
835
+ },
836
+ onPointerUp: () => {
837
+ h(!1);
838
+ },
839
+ onPointerCancel: () => h(!1),
840
+ children: [
841
+ /* @__PURE__ */ e(p, { sx: { minWidth: 0, minHeight: 0, overflow: "auto", display: le ? "none" : void 0 }, children: t }),
842
+ /* @__PURE__ */ e(
843
+ p,
844
+ {
845
+ role: "separator",
846
+ "aria-label": E,
847
+ "aria-orientation": S ? "vertical" : "horizontal",
848
+ "aria-valuemin": g,
849
+ "aria-valuemax": f,
850
+ "aria-valuenow": Math.round(i),
851
+ tabIndex: 0,
852
+ onPointerDown: (I) => {
853
+ h(!0), I.currentTarget.setPointerCapture(I.pointerId), ee(I.clientX, I.clientY);
854
+ },
855
+ onPointerUp: (I) => {
856
+ h(!1), I.currentTarget.releasePointerCapture(I.pointerId);
857
+ },
858
+ onDoubleClick: K,
859
+ onKeyDown: (I) => {
860
+ I.key === "Enter" && (K(), I.preventDefault()), I.key === "Home" && (he("first"), I.preventDefault()), I.key === "End" && (he("second"), I.preventDefault()), (I.key === "ArrowLeft" || I.key === "ArrowUp") && (U(-R), I.preventDefault()), (I.key === "ArrowRight" || I.key === "ArrowDown") && (U(R), I.preventDefault());
861
+ },
862
+ sx: {
863
+ position: "relative",
864
+ bgcolor: M ? "primary.main" : "divider",
865
+ cursor: S ? "col-resize" : "row-resize",
866
+ touchAction: "none",
867
+ transition: "background-color 120ms ease",
868
+ "&:hover": {
869
+ bgcolor: "primary.main"
870
+ },
871
+ "&:focus-visible": {
872
+ outline: "2px solid",
873
+ outlineColor: "primary.main",
874
+ outlineOffset: -2
875
+ },
876
+ "&::after": {
877
+ content: '""',
878
+ position: "absolute",
879
+ inset: S ? "30% -4px" : "-4px 30%",
880
+ borderRadius: 999,
881
+ bgcolor: M ? "primary.contrastText" : "text.disabled",
882
+ opacity: 0.55
883
+ }
884
+ }
885
+ }
886
+ ),
887
+ /* @__PURE__ */ e(p, { sx: { minWidth: 0, minHeight: 0, overflow: "auto", display: se ? "none" : void 0 }, children: n })
888
+ ]
889
+ }
890
+ );
891
+ }
892
+ function yt(t, n) {
893
+ return n ?? t?.getBoundingClientRect() ?? null;
894
+ }
895
+ function fr({
896
+ open: t,
897
+ children: n,
898
+ anchorEl: d,
899
+ anchorRect: s,
900
+ containerRef: b,
901
+ placement: c = "top",
902
+ offset: g = 8,
903
+ boundaryPadding: f = 8,
904
+ autoUpdate: a = !0,
905
+ arrow: x = !0,
906
+ sx: y,
907
+ ...k
908
+ }) {
909
+ const v = oe(null), [B, C] = T({ left: -9999, top: -9999 }), o = je(() => {
910
+ if (!t)
911
+ return;
912
+ const R = yt(d, s), u = v.current;
913
+ if (!R || !u)
914
+ return;
915
+ const z = b?.current?.getBoundingClientRect(), Y = z?.left ?? 0, E = z?.top ?? 0, $ = z?.width ?? window.innerWidth, W = z?.height ?? window.innerHeight, w = u.offsetWidth / 2, L = u.offsetHeight, j = R.left - Y + R.width / 2, F = c === "top" ? R.top - E - g : R.bottom - E + g, l = Math.min(Math.max(j, w + f), $ - w - f), M = c === "top" ? Math.max(F, L + f) : Math.min(F, W - L - f);
916
+ C({ left: l, top: M });
917
+ }, [d, s, f, b, g, t, c]);
918
+ return Xe(() => {
919
+ o();
920
+ }, [o]), fe(() => {
921
+ if (!(!t || !a))
922
+ return window.addEventListener("resize", o), window.addEventListener("scroll", o, !0), () => {
923
+ window.removeEventListener("resize", o), window.removeEventListener("scroll", o, !0);
924
+ };
925
+ }, [a, t, o]), t ? /* @__PURE__ */ e(
926
+ p,
927
+ {
928
+ ...k,
929
+ ref: v,
930
+ role: "toolbar",
931
+ sx: [
932
+ {
933
+ position: b ? "absolute" : "fixed",
934
+ left: B.left,
935
+ top: B.top,
936
+ zIndex: 1300,
937
+ display: "inline-flex",
938
+ alignItems: "center",
939
+ gap: 0.5,
940
+ p: 0.5,
941
+ borderRadius: 1.5,
942
+ bgcolor: "rgba(15,23,42,0.96)",
943
+ color: "#e5e7eb",
944
+ boxShadow: "0 16px 40px rgba(15, 23, 42, 0.34)",
945
+ transform: c === "top" ? "translate(-50%, -100%)" : "translate(-50%, 0)",
946
+ backdropFilter: "blur(12px)",
947
+ "&::after": x ? {
948
+ content: '""',
949
+ position: "absolute",
950
+ left: "50%",
951
+ width: 10,
952
+ height: 10,
953
+ bgcolor: "rgba(15,23,42,0.96)",
954
+ transform: "translateX(-50%) rotate(45deg)",
955
+ bottom: c === "top" ? -5 : void 0,
956
+ top: c === "bottom" ? -5 : void 0
957
+ } : void 0
958
+ },
959
+ ...Array.isArray(y) ? y : y ? [y] : []
960
+ ],
961
+ children: n
962
+ }
963
+ ) : null;
964
+ }
965
+ function br({
966
+ strength: t = 18,
967
+ tilt: n = 10,
968
+ lift: d = 10,
969
+ glare: s = !0,
970
+ perspective: b = 900,
971
+ sx: c,
972
+ children: g,
973
+ ...f
974
+ }) {
975
+ const [a, x] = T({
976
+ x: 0,
977
+ y: 0,
978
+ rotateX: 0,
979
+ rotateY: 0,
980
+ glareX: 50,
981
+ glareY: 50,
982
+ active: !1
983
+ });
984
+ return /* @__PURE__ */ e(
985
+ p,
986
+ {
987
+ ...f,
988
+ onMouseMove: (y) => {
989
+ const k = y.currentTarget.getBoundingClientRect(), v = (y.clientX - k.left) / k.width, B = (y.clientY - k.top) / k.height, C = (v - 0.5) * t, o = (B - 0.5) * t;
990
+ x({
991
+ x: C,
992
+ y: o,
993
+ rotateX: (0.5 - B) * n,
994
+ rotateY: (v - 0.5) * n,
995
+ glareX: v * 100,
996
+ glareY: B * 100,
997
+ active: !0
998
+ });
999
+ },
1000
+ onMouseLeave: () => x({
1001
+ x: 0,
1002
+ y: 0,
1003
+ rotateX: 0,
1004
+ rotateY: 0,
1005
+ glareX: 50,
1006
+ glareY: 50,
1007
+ active: !1
1008
+ }),
1009
+ sx: [
1010
+ {
1011
+ position: "relative",
1012
+ overflow: "hidden",
1013
+ transform: `
1014
+ perspective(${b}px)
1015
+ translate3d(${a.x}px, ${a.y}px, ${a.active ? -d : 0}px)
1016
+ rotateX(${a.rotateX}deg)
1017
+ rotateY(${a.rotateY}deg)
1018
+ `,
1019
+ transformStyle: "preserve-3d",
1020
+ transition: a.active ? "transform 80ms ease-out, box-shadow 120ms ease-out" : "transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 260ms ease",
1021
+ willChange: "transform",
1022
+ boxShadow: a.active ? "0 28px 70px rgba(15, 23, 42, 0.24)" : "0 14px 34px rgba(15, 23, 42, 0.12)",
1023
+ "&::before": s ? {
1024
+ content: '""',
1025
+ position: "absolute",
1026
+ inset: 0,
1027
+ pointerEvents: "none",
1028
+ opacity: a.active ? 0.78 : 0,
1029
+ transition: "opacity 160ms ease",
1030
+ background: `radial-gradient(circle at ${a.glareX}% ${a.glareY}%, rgba(255,255,255,0.55), rgba(255,255,255,0.16) 22%, transparent 48%)`,
1031
+ mixBlendMode: "screen"
1032
+ } : void 0,
1033
+ "& > *": {
1034
+ position: "relative",
1035
+ zIndex: 1,
1036
+ transform: a.active ? "translateZ(24px)" : "translateZ(0)",
1037
+ transition: "transform 180ms ease"
1038
+ }
1039
+ },
1040
+ ...Array.isArray(c) ? c : c ? [c] : []
1041
+ ],
1042
+ children: g
1043
+ }
1044
+ );
1045
+ }
1046
+ function gr({ radius: t = 160, dim: n = 0.72, sx: d, children: s, ...b }) {
1047
+ const [c, g] = T({ x: 50, y: 50 });
1048
+ return /* @__PURE__ */ e(
1049
+ p,
1050
+ {
1051
+ ...b,
1052
+ onMouseMove: (f) => {
1053
+ const a = f.currentTarget.getBoundingClientRect();
1054
+ g({
1055
+ x: (f.clientX - a.left) / a.width * 100,
1056
+ y: (f.clientY - a.top) / a.height * 100
1057
+ });
1058
+ },
1059
+ sx: [
1060
+ {
1061
+ position: "relative",
1062
+ overflow: "hidden",
1063
+ "&::after": {
1064
+ content: '""',
1065
+ position: "absolute",
1066
+ inset: 0,
1067
+ pointerEvents: "none",
1068
+ background: `radial-gradient(circle ${t}px at ${c.x}% ${c.y}%, transparent 0, transparent 45%, rgba(0,0,0,${n}) 100%)`
1069
+ }
1070
+ },
1071
+ ...Array.isArray(d) ? d : d ? [d] : []
1072
+ ],
1073
+ children: s
1074
+ }
1075
+ );
1076
+ }
1077
+ function Be(t, n) {
1078
+ return Math.round(t / n) * n;
1079
+ }
1080
+ function wt(t, n, d, s, b) {
1081
+ const c = t.x + d / 2, g = t.y + s / 2, f = n.x + d / 2, a = n.y + s / 2, x = (c + f) / 2;
1082
+ if (b === "ellipse") {
1083
+ const y = Math.max(Math.abs(f - c) / 2, 24), k = Math.max(Math.abs(a - g) / 2, 24);
1084
+ return `M ${c} ${g} A ${y} ${k} 0 0 1 ${f} ${a}`;
1085
+ }
1086
+ return b === "curved" ? `M ${c} ${g} C ${x} ${g}, ${x} ${a}, ${f} ${a}` : b === "step" ? `M ${c} ${g} L ${x} ${g} L ${x} ${a} L ${f} ${a}` : `M ${c} ${g} L ${f} ${a}`;
1087
+ }
1088
+ function mr({
1089
+ nodes: t,
1090
+ connections: n = [],
1091
+ nodeWidth: d = 132,
1092
+ nodeHeight: s = 52,
1093
+ mode: b = "edit",
1094
+ snapToGrid: c = !1,
1095
+ gridSize: g = 24,
1096
+ showGrid: f = !1,
1097
+ selectedNodeId: a,
1098
+ connectionStyle: x = "line",
1099
+ editableTools: y = !1,
1100
+ linkTypes: k = ["line", "curved", "step", "ellipse"],
1101
+ renderNode: v,
1102
+ onNodesChange: B,
1103
+ onConnectionsChange: C,
1104
+ onNodeMove: o,
1105
+ onNodeSelect: R,
1106
+ sx: u,
1107
+ ...z
1108
+ }) {
1109
+ const [Y, E] = T(t), [$, W] = T(n), w = y ? Y : t, L = y ? $ : n, [j, F] = T(
1110
+ Object.fromEntries(w.map((r) => [r.id, { x: r.x, y: r.y }]))
1111
+ ), [l, M] = T(a ?? null), [h, S] = T(!1), [D, i] = T(""), [P, Q] = T(k[0] ?? "line"), [le, se] = T(""), [V, ee] = T(null), U = a ?? l, K = w.find((r) => r.id === U) ?? null, he = L.map((r, A) => ({ connection: r, index: A })).filter(({ connection: r }) => r.from === U || r.to === U), be = t.map((r) => `${r.id}:${r.label}:${r.x}:${r.y}:${r.color ?? ""}`).join("|"), I = n.map((r) => `${r.from}:${r.to}:${r.type ?? ""}:${r.label ?? ""}:${r.color ?? ""}`).join("|");
1112
+ fe(() => {
1113
+ y || E(t), F((r) => ({
1114
+ ...Object.fromEntries(t.map((A) => [A.id, r[A.id] ?? { x: A.x, y: A.y }]))
1115
+ }));
1116
+ }, [y, be]), fe(() => {
1117
+ y || W(n);
1118
+ }, [I, y]);
1119
+ function te(r) {
1120
+ E(r), B?.(r);
1121
+ }
1122
+ function re(r) {
1123
+ W(r), C?.(r);
1124
+ }
1125
+ function J(r, A) {
1126
+ const O = c ? { x: Be(A.x, g), y: Be(A.y, g) } : A;
1127
+ F((X) => ({
1128
+ ...X,
1129
+ [r]: O
1130
+ })), y && te(w.map((X) => X.id === r ? { ...X, ...O } : X)), o?.(r, O);
1131
+ }
1132
+ function ce() {
1133
+ const r = w.length + 1, A = {
1134
+ id: `node-${Date.now()}`,
1135
+ label: `Box ${r}`,
1136
+ x: 48 + r * 18,
1137
+ y: 48 + r * 18,
1138
+ color: "#ffffff"
1139
+ };
1140
+ te([...w, A]), F((O) => ({
1141
+ ...O,
1142
+ [A.id]: { x: A.x, y: A.y }
1143
+ })), M(A.id);
1144
+ }
1145
+ function ge() {
1146
+ U && (te(w.filter((r) => r.id !== U)), re(L.filter((r) => r.from !== U && r.to !== U)), M(null), S(!1));
1147
+ }
1148
+ function me(r) {
1149
+ U && te(w.map((A) => A.id === U ? { ...A, ...r } : A));
1150
+ }
1151
+ function Ie() {
1152
+ if (!U || !D || U === D)
1153
+ return;
1154
+ const r = {
1155
+ from: U,
1156
+ to: D,
1157
+ type: P,
1158
+ label: le,
1159
+ color: P === "ellipse" ? "#db2777" : P === "step" ? "#059669" : "#2563eb"
1160
+ }, A = [
1161
+ ...L.filter((O) => !(O.from === U && O.to === D)),
1162
+ r
1163
+ ];
1164
+ re(A), i(""), se(""), ee(A.indexOf(r));
1165
+ }
1166
+ function xe(r, A) {
1167
+ const O = L[r];
1168
+ if (!O)
1169
+ return;
1170
+ const X = { ...O, ...A }, _ = L.map((G, de) => de === r ? X : G).filter((G, de) => de === r || G.from !== X.from || G.to !== X.to);
1171
+ re(_);
1172
+ }
1173
+ function Oe(r) {
1174
+ re(L.filter((A, O) => O !== r)), ee(null);
1175
+ }
1176
+ return /* @__PURE__ */ m(
1177
+ p,
1178
+ {
1179
+ ...z,
1180
+ sx: [
1181
+ {
1182
+ position: "relative",
1183
+ minHeight: 360,
1184
+ overflow: "hidden",
1185
+ bgcolor: "#f8fafc",
1186
+ backgroundImage: f ? "linear-gradient(rgba(148,163,184,0.24) 1px, transparent 1px), linear-gradient(90deg, rgba(148,163,184,0.24) 1px, transparent 1px)" : void 0,
1187
+ backgroundSize: f ? `${g}px ${g}px` : void 0
1188
+ },
1189
+ ...Array.isArray(u) ? u : u ? [u] : []
1190
+ ],
1191
+ children: [
1192
+ /* @__PURE__ */ e(p, { component: "svg", sx: { position: "absolute", inset: 0, width: "100%", height: "100%" }, children: L.map((r) => {
1193
+ const A = j[r.from], O = j[r.to];
1194
+ if (!A || !O)
1195
+ return null;
1196
+ const X = wt(A, O, d, s, r.type ?? x), _ = (A.x + O.x + d) / 2, G = (A.y + O.y + s) / 2;
1197
+ return /* @__PURE__ */ m("g", { children: [
1198
+ /* @__PURE__ */ e("path", { d: X, fill: "none", stroke: r.color ?? "#94a3b8", strokeWidth: "2.5" }),
1199
+ r.label ? /* @__PURE__ */ e("text", { x: _, y: G - 8, textAnchor: "middle", fill: r.color ?? "#64748b", fontSize: "11", fontWeight: "700", children: r.label }) : null
1200
+ ] }, `${r.from}-${r.to}-${r.type ?? r.label ?? "link"}`);
1201
+ }) }),
1202
+ w.map((r) => {
1203
+ const A = j[r.id], O = r.id === U;
1204
+ return /* @__PURE__ */ e(
1205
+ p,
1206
+ {
1207
+ role: "button",
1208
+ tabIndex: 0,
1209
+ sx: {
1210
+ position: "absolute",
1211
+ left: A.x,
1212
+ top: A.y,
1213
+ width: d,
1214
+ height: s,
1215
+ display: "grid",
1216
+ placeItems: "center",
1217
+ border: O ? 2 : 1,
1218
+ borderColor: O ? "primary.main" : "divider",
1219
+ borderRadius: 1,
1220
+ bgcolor: r.color ?? "background.paper",
1221
+ cursor: b === "edit" ? "grab" : "pointer",
1222
+ userSelect: "none",
1223
+ boxShadow: O ? "0 18px 34px rgba(37,99,235,0.22)" : "0 12px 28px rgba(15,23,42,0.12)",
1224
+ touchAction: "none"
1225
+ },
1226
+ onPointerDown: (X) => {
1227
+ if (M(r.id), ee(null), y && S(!0), R?.(r), b === "readonly")
1228
+ return;
1229
+ const _ = X.clientX, G = X.clientY, de = j[r.id];
1230
+ X.currentTarget.setPointerCapture(X.pointerId);
1231
+ function ze(Me) {
1232
+ J(r.id, {
1233
+ x: de.x + Me.clientX - _,
1234
+ y: de.y + Me.clientY - G
1235
+ });
1236
+ }
1237
+ function Se() {
1238
+ window.removeEventListener("pointermove", ze), window.removeEventListener("pointerup", Se);
1239
+ }
1240
+ window.addEventListener("pointermove", ze), window.addEventListener("pointerup", Se);
1241
+ },
1242
+ onKeyDown: (X) => {
1243
+ if (b === "readonly")
1244
+ return;
1245
+ const _ = c ? g : 8, G = j[r.id];
1246
+ X.key === "ArrowLeft" && (J(r.id, { x: G.x - _, y: G.y }), X.preventDefault()), X.key === "ArrowRight" && (J(r.id, { x: G.x + _, y: G.y }), X.preventDefault()), X.key === "ArrowUp" && (J(r.id, { x: G.x, y: G.y - _ }), X.preventDefault()), X.key === "ArrowDown" && (J(r.id, { x: G.x, y: G.y + _ }), X.preventDefault());
1247
+ },
1248
+ children: v ? v(r, O) : /* @__PURE__ */ e(N, { fontWeight: 800, children: r.label })
1249
+ },
1250
+ r.id
1251
+ );
1252
+ }),
1253
+ y && K && h ? /* @__PURE__ */ e(
1254
+ p,
1255
+ {
1256
+ sx: {
1257
+ position: "absolute",
1258
+ right: 12,
1259
+ top: 12,
1260
+ zIndex: 20,
1261
+ width: 340,
1262
+ maxWidth: "calc(100% - 24px)",
1263
+ maxHeight: "calc(100% - 24px)",
1264
+ overflow: "auto",
1265
+ border: 1,
1266
+ borderColor: "divider",
1267
+ borderRadius: 1,
1268
+ bgcolor: "background.paper",
1269
+ boxShadow: "0 20px 48px rgba(15,23,42,0.22)"
1270
+ },
1271
+ children: /* @__PURE__ */ m(q, { spacing: 1.25, sx: { p: 1.5 }, children: [
1272
+ /* @__PURE__ */ m(q, { direction: "row", spacing: 0.75, alignItems: "center", children: [
1273
+ /* @__PURE__ */ e(N, { variant: "subtitle2", fontWeight: 900, sx: { flex: 1 }, children: "Box editor" }),
1274
+ /* @__PURE__ */ e(ie, { title: "Add box", children: /* @__PURE__ */ e(ue, { size: "small", color: "primary", onClick: ce, children: /* @__PURE__ */ e(_e, { fontSize: "small" }) }) }),
1275
+ /* @__PURE__ */ e(ie, { title: "Remove box", children: /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(ue, { size: "small", color: "error", onClick: ge, disabled: !K, children: /* @__PURE__ */ e(Je, { fontSize: "small" }) }) }) }),
1276
+ /* @__PURE__ */ e(ie, { title: "Close editor", children: /* @__PURE__ */ e(ue, { size: "small", onClick: () => S(!1), children: /* @__PURE__ */ e(Qe, { fontSize: "small" }) }) })
1277
+ ] }),
1278
+ /* @__PURE__ */ m(p, { sx: { display: "grid", gridTemplateColumns: "1fr 96px", gap: 1 }, children: [
1279
+ /* @__PURE__ */ e(
1280
+ Z,
1281
+ {
1282
+ size: "small",
1283
+ label: "Label",
1284
+ value: K?.label ?? "",
1285
+ disabled: !K,
1286
+ onChange: (r) => me({ label: r.target.value })
1287
+ }
1288
+ ),
1289
+ /* @__PURE__ */ e(
1290
+ Z,
1291
+ {
1292
+ size: "small",
1293
+ label: "Color",
1294
+ type: "color",
1295
+ value: K?.color ?? "#ffffff",
1296
+ disabled: !K,
1297
+ onChange: (r) => me({ color: r.target.value })
1298
+ }
1299
+ )
1300
+ ] }),
1301
+ /* @__PURE__ */ m(p, { sx: { display: "grid", gridTemplateColumns: "1fr", gap: 1.25 }, children: [
1302
+ /* @__PURE__ */ m(q, { spacing: 1, children: [
1303
+ /* @__PURE__ */ e(N, { variant: "caption", fontWeight: 900, color: "text.secondary", children: "Links" }),
1304
+ /* @__PURE__ */ m(p, { sx: { display: "grid", gridTemplateColumns: "1fr 32px", gap: 0.5, alignItems: "center" }, children: [
1305
+ /* @__PURE__ */ m(
1306
+ Z,
1307
+ {
1308
+ select: !0,
1309
+ size: "small",
1310
+ label: "To",
1311
+ value: D,
1312
+ disabled: !K,
1313
+ onChange: (r) => i(r.target.value),
1314
+ children: [
1315
+ /* @__PURE__ */ e(pe, { value: "", children: "Pick target" }),
1316
+ w.filter((r) => r.id !== U).map((r) => /* @__PURE__ */ e(pe, { value: r.id, children: r.label }, r.id))
1317
+ ]
1318
+ }
1319
+ ),
1320
+ /* @__PURE__ */ e(ie, { title: `Add link from ${K?.label ?? "box"}`, children: /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
1321
+ ue,
1322
+ {
1323
+ size: "small",
1324
+ color: "primary",
1325
+ disabled: !K || !D,
1326
+ onClick: Ie,
1327
+ sx: { width: 32, height: 32, border: 1, borderColor: "divider", borderRadius: 1 },
1328
+ children: /* @__PURE__ */ e(Ze, { fontSize: "small" })
1329
+ }
1330
+ ) }) })
1331
+ ] }),
1332
+ he.length ? he.map(({ connection: r, index: A }) => {
1333
+ const O = w.find((G) => G.id === r.from), X = w.find((G) => G.id === r.to), _ = V === A;
1334
+ return /* @__PURE__ */ m(
1335
+ p,
1336
+ {
1337
+ sx: {
1338
+ width: "100%",
1339
+ display: "grid",
1340
+ gridTemplateColumns: "1fr 32px",
1341
+ gap: 0.5,
1342
+ alignItems: "center"
1343
+ },
1344
+ children: [
1345
+ /* @__PURE__ */ e(
1346
+ p,
1347
+ {
1348
+ component: "button",
1349
+ onClick: () => ee(A),
1350
+ sx: {
1351
+ px: 1,
1352
+ py: 0.75,
1353
+ minWidth: 0,
1354
+ border: 1,
1355
+ borderColor: _ ? "primary.main" : "divider",
1356
+ borderRadius: 1,
1357
+ bgcolor: _ ? "primary.main" : "background.paper",
1358
+ color: _ ? "primary.contrastText" : "text.primary",
1359
+ cursor: "pointer",
1360
+ font: "inherit",
1361
+ textAlign: "left"
1362
+ },
1363
+ children: (O?.label ?? r.from) + " -> " + (X?.label ?? r.to)
1364
+ }
1365
+ ),
1366
+ /* @__PURE__ */ e(ie, { title: "Remove link", children: /* @__PURE__ */ e(ue, { size: "small", color: "error", onClick: () => Oe(A), sx: { width: 32, height: 32 }, children: /* @__PURE__ */ e(Ke, { fontSize: "small" }) }) })
1367
+ ]
1368
+ },
1369
+ `${r.from}-${r.to}-${A}`
1370
+ );
1371
+ }) : /* @__PURE__ */ e(N, { variant: "body2", color: "text.secondary", children: "No linked boxes." })
1372
+ ] }),
1373
+ /* @__PURE__ */ m(q, { spacing: 1, children: [
1374
+ /* @__PURE__ */ e(N, { variant: "caption", fontWeight: 900, color: "text.secondary", children: "Link details" }),
1375
+ V !== null && L[V] ? /* @__PURE__ */ m(Ee, { children: [
1376
+ /* @__PURE__ */ e(
1377
+ Z,
1378
+ {
1379
+ select: !0,
1380
+ size: "small",
1381
+ label: "From",
1382
+ value: L[V].from,
1383
+ onChange: (r) => xe(V, { from: r.target.value }),
1384
+ children: w.filter((r) => r.id !== L[V].to).map((r) => /* @__PURE__ */ e(pe, { value: r.id, children: r.label }, r.id))
1385
+ }
1386
+ ),
1387
+ /* @__PURE__ */ m(p, { sx: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 1 }, children: [
1388
+ /* @__PURE__ */ e(
1389
+ Z,
1390
+ {
1391
+ select: !0,
1392
+ size: "small",
1393
+ label: "To",
1394
+ value: L[V].to,
1395
+ onChange: (r) => xe(V, { to: r.target.value }),
1396
+ children: w.filter((r) => r.id !== L[V].from).map((r) => /* @__PURE__ */ e(pe, { value: r.id, children: r.label }, r.id))
1397
+ }
1398
+ ),
1399
+ /* @__PURE__ */ e(
1400
+ Z,
1401
+ {
1402
+ select: !0,
1403
+ size: "small",
1404
+ label: "Shape",
1405
+ value: L[V].type ?? x,
1406
+ onChange: (r) => xe(V, { type: r.target.value }),
1407
+ children: k.map((r) => /* @__PURE__ */ e(pe, { value: r, children: r }, r))
1408
+ }
1409
+ )
1410
+ ] }),
1411
+ /* @__PURE__ */ e(
1412
+ Z,
1413
+ {
1414
+ size: "small",
1415
+ label: "Label",
1416
+ value: L[V].label ?? "",
1417
+ onChange: (r) => xe(V, { label: r.target.value })
1418
+ }
1419
+ )
1420
+ ] }) : /* @__PURE__ */ e(N, { variant: "body2", color: "text.secondary", children: "Pick a link." })
1421
+ ] })
1422
+ ] })
1423
+ ] })
1424
+ }
1425
+ ) : null
1426
+ ]
1427
+ }
1428
+ );
1429
+ }
1430
+ function xr({ before: t, after: n, initialPosition: d = 50, sx: s, ...b }) {
1431
+ const [c, g] = T(d);
1432
+ return /* @__PURE__ */ m(
1433
+ p,
1434
+ {
1435
+ ...b,
1436
+ sx: [
1437
+ { position: "relative", overflow: "hidden", minHeight: 280 },
1438
+ ...Array.isArray(s) ? s : s ? [s] : []
1439
+ ],
1440
+ onPointerMove: (f) => {
1441
+ if (f.buttons !== 1)
1442
+ return;
1443
+ const a = f.currentTarget.getBoundingClientRect();
1444
+ g((f.clientX - a.left) / a.width * 100);
1445
+ },
1446
+ children: [
1447
+ /* @__PURE__ */ e(p, { sx: { position: "absolute", inset: 0 }, children: n }),
1448
+ /* @__PURE__ */ e(p, { sx: { position: "absolute", inset: 0, width: `${c}%`, overflow: "hidden" }, children: t }),
1449
+ /* @__PURE__ */ e(p, { sx: { position: "absolute", top: 0, bottom: 0, left: `${c}%`, width: 3, bgcolor: "#ffffff", boxShadow: "0 0 0 1px rgba(0,0,0,0.2)", cursor: "ew-resize" } })
1450
+ ]
1451
+ }
1452
+ );
1453
+ }
1454
+ function yr({
1455
+ initialWidth: t = 320,
1456
+ initialHeight: n = 220,
1457
+ minWidth: d = 160,
1458
+ minHeight: s = 120,
1459
+ sx: b,
1460
+ children: c,
1461
+ ...g
1462
+ }) {
1463
+ const [f, a] = T({ width: t, height: n });
1464
+ return /* @__PURE__ */ m(
1465
+ p,
1466
+ {
1467
+ ...g,
1468
+ sx: [
1469
+ {
1470
+ position: "relative",
1471
+ width: f.width,
1472
+ height: f.height,
1473
+ overflow: "auto",
1474
+ border: 1,
1475
+ borderColor: "divider",
1476
+ borderRadius: 1,
1477
+ bgcolor: "background.paper"
1478
+ },
1479
+ ...Array.isArray(b) ? b : b ? [b] : []
1480
+ ],
1481
+ children: [
1482
+ c,
1483
+ /* @__PURE__ */ e(
1484
+ p,
1485
+ {
1486
+ sx: {
1487
+ position: "absolute",
1488
+ right: 4,
1489
+ bottom: 4,
1490
+ width: 28,
1491
+ height: 28,
1492
+ display: "grid",
1493
+ placeItems: "center",
1494
+ cursor: "nwse-resize",
1495
+ color: "text.secondary",
1496
+ bgcolor: "background.paper",
1497
+ border: 1,
1498
+ borderColor: "divider",
1499
+ borderRadius: 1,
1500
+ boxShadow: "0 6px 16px rgba(15,23,42,0.14)"
1501
+ },
1502
+ onPointerDown: (x) => {
1503
+ const y = x.clientX, k = x.clientY, v = f;
1504
+ function B(o) {
1505
+ a({
1506
+ width: Math.max(d, v.width + o.clientX - y),
1507
+ height: Math.max(s, v.height + o.clientY - k)
1508
+ });
1509
+ }
1510
+ function C() {
1511
+ window.removeEventListener("pointermove", B), window.removeEventListener("pointerup", C);
1512
+ }
1513
+ window.addEventListener("pointermove", B), window.addEventListener("pointerup", C);
1514
+ },
1515
+ children: /* @__PURE__ */ e(et, { fontSize: "small" })
1516
+ }
1517
+ )
1518
+ ]
1519
+ }
1520
+ );
1521
+ }
1522
+ function vt(t) {
1523
+ return t.type === "boolean" ? t.value ? "On" : "Off" : `${t.value}${t.unit ? ` ${t.unit}` : ""}`;
1524
+ }
1525
+ function kt(t) {
1526
+ return t.reduce((n, d) => {
1527
+ const s = d.group ?? "Settings";
1528
+ return {
1529
+ ...n,
1530
+ [s]: [...n[s] ?? [], d]
1531
+ };
1532
+ }, {});
1533
+ }
1534
+ function wr({
1535
+ fields: t,
1536
+ onChange: n,
1537
+ title: d = "Inspector",
1538
+ description: s,
1539
+ density: b = "comfortable",
1540
+ showValueSummary: c = !0,
1541
+ showReset: g = !0,
1542
+ sx: f
1543
+ }) {
1544
+ const a = kt(t), x = b === "compact" ? 1.25 : 2, y = b === "compact" ? "small" : "medium";
1545
+ function k(v) {
1546
+ v.defaultValue !== void 0 && n?.(v.id, v.defaultValue);
1547
+ }
1548
+ return /* @__PURE__ */ e(Ye, { variant: "outlined", sx: [{ p: b === "compact" ? 1.5 : 2, borderRadius: 1 }, ...Array.isArray(f) ? f : [f]], children: /* @__PURE__ */ m(q, { spacing: x, children: [
1549
+ /* @__PURE__ */ m(p, { children: [
1550
+ /* @__PURE__ */ m(q, { direction: "row", alignItems: "center", justifyContent: "space-between", spacing: 1, children: [
1551
+ /* @__PURE__ */ e(N, { variant: "subtitle1", fontWeight: 850, children: d }),
1552
+ c ? /* @__PURE__ */ e(we, { size: "small", label: `${t.length} fields` }) : null
1553
+ ] }),
1554
+ s ? /* @__PURE__ */ e(N, { variant: "body2", color: "text.secondary", sx: { mt: 0.5 }, children: s }) : null
1555
+ ] }),
1556
+ Object.entries(a).map(([v, B], C) => /* @__PURE__ */ m(q, { spacing: x, children: [
1557
+ C > 0 ? /* @__PURE__ */ e(rt, {}) : null,
1558
+ /* @__PURE__ */ e(N, { variant: "caption", color: "text.secondary", fontWeight: 850, sx: { textTransform: "uppercase" }, children: v }),
1559
+ B.map((o) => {
1560
+ const R = g && o.defaultValue !== void 0 && o.defaultValue !== o.value;
1561
+ return o.type === "boolean" ? /* @__PURE__ */ m(p, { children: [
1562
+ /* @__PURE__ */ m(q, { direction: "row", alignItems: "center", justifyContent: "space-between", spacing: 1, children: [
1563
+ /* @__PURE__ */ e(
1564
+ nt,
1565
+ {
1566
+ control: /* @__PURE__ */ e(
1567
+ tt,
1568
+ {
1569
+ checked: !!o.value,
1570
+ disabled: o.disabled,
1571
+ onChange: (u) => n?.(o.id, u.target.checked)
1572
+ }
1573
+ ),
1574
+ label: o.label
1575
+ }
1576
+ ),
1577
+ R ? /* @__PURE__ */ e(ae, { size: "small", onClick: () => k(o), children: "Reset" }) : null
1578
+ ] }),
1579
+ o.description ? /* @__PURE__ */ e(N, { variant: "caption", color: "text.secondary", children: o.description }) : null
1580
+ ] }, o.id) : o.type === "number" ? /* @__PURE__ */ m(q, { spacing: 1, children: [
1581
+ /* @__PURE__ */ m(q, { direction: "row", spacing: 1, alignItems: "flex-start", children: [
1582
+ /* @__PURE__ */ e(
1583
+ Z,
1584
+ {
1585
+ fullWidth: !0,
1586
+ size: y,
1587
+ label: o.label,
1588
+ type: "number",
1589
+ value: o.value,
1590
+ helperText: o.description,
1591
+ disabled: o.disabled,
1592
+ inputProps: {
1593
+ min: o.min,
1594
+ max: o.max,
1595
+ step: o.step
1596
+ },
1597
+ onChange: (u) => n?.(o.id, Number(u.target.value))
1598
+ }
1599
+ ),
1600
+ o.unit ? /* @__PURE__ */ e(we, { label: o.unit, size: "small", sx: { mt: 1 } }) : null,
1601
+ R ? /* @__PURE__ */ e(ae, { size: "small", onClick: () => k(o), sx: { mt: 0.5 }, children: "Reset" }) : null
1602
+ ] }),
1603
+ o.min !== void 0 || o.max !== void 0 ? /* @__PURE__ */ e(
1604
+ Fe,
1605
+ {
1606
+ value: Number(o.value),
1607
+ min: o.min ?? 0,
1608
+ max: o.max ?? 100,
1609
+ step: o.step ?? 1,
1610
+ disabled: o.disabled,
1611
+ valueLabelDisplay: "auto",
1612
+ onChange: (u, z) => n?.(o.id, Array.isArray(z) ? z[0] : z)
1613
+ }
1614
+ ) : null
1615
+ ] }, o.id) : o.type === "select" ? /* @__PURE__ */ m(q, { direction: "row", spacing: 1, alignItems: "flex-start", children: [
1616
+ /* @__PURE__ */ e(
1617
+ Z,
1618
+ {
1619
+ select: !0,
1620
+ fullWidth: !0,
1621
+ size: y,
1622
+ label: o.label,
1623
+ value: o.value,
1624
+ helperText: o.description,
1625
+ disabled: o.disabled,
1626
+ onChange: (u) => n?.(o.id, u.target.value),
1627
+ children: (o.options ?? []).map((u) => /* @__PURE__ */ e(pe, { value: u.value, children: u.label }, u.value))
1628
+ }
1629
+ ),
1630
+ R ? /* @__PURE__ */ e(ae, { size: "small", onClick: () => k(o), sx: { mt: 0.5 }, children: "Reset" }) : null
1631
+ ] }, o.id) : o.type === "color" ? /* @__PURE__ */ m(q, { direction: "row", spacing: 1, alignItems: "flex-start", children: [
1632
+ /* @__PURE__ */ e(
1633
+ Z,
1634
+ {
1635
+ fullWidth: !0,
1636
+ size: y,
1637
+ label: o.label,
1638
+ value: o.value,
1639
+ helperText: o.description,
1640
+ disabled: o.disabled,
1641
+ onChange: (u) => n?.(o.id, u.target.value),
1642
+ InputProps: {
1643
+ startAdornment: /* @__PURE__ */ e(
1644
+ p,
1645
+ {
1646
+ component: "input",
1647
+ type: "color",
1648
+ value: String(o.value),
1649
+ disabled: o.disabled,
1650
+ onChange: (u) => n?.(o.id, u.target.value),
1651
+ sx: {
1652
+ width: 28,
1653
+ height: 28,
1654
+ p: 0,
1655
+ mr: 1,
1656
+ border: 0,
1657
+ bgcolor: "transparent",
1658
+ cursor: o.disabled ? "default" : "pointer"
1659
+ }
1660
+ }
1661
+ )
1662
+ }
1663
+ }
1664
+ ),
1665
+ R ? /* @__PURE__ */ e(ae, { size: "small", onClick: () => k(o), sx: { mt: 0.5 }, children: "Reset" }) : null
1666
+ ] }, o.id) : /* @__PURE__ */ m(q, { direction: "row", spacing: 1, alignItems: "flex-start", children: [
1667
+ /* @__PURE__ */ e(
1668
+ Z,
1669
+ {
1670
+ fullWidth: !0,
1671
+ size: y,
1672
+ label: o.label,
1673
+ value: o.value,
1674
+ helperText: o.description,
1675
+ disabled: o.disabled,
1676
+ onChange: (u) => n?.(o.id, u.target.value)
1677
+ }
1678
+ ),
1679
+ R ? /* @__PURE__ */ e(ae, { size: "small", onClick: () => k(o), sx: { mt: 0.5 }, children: "Reset" }) : null
1680
+ ] }, o.id);
1681
+ })
1682
+ ] }, v)),
1683
+ c ? /* @__PURE__ */ m(p, { sx: { p: 1.25, borderRadius: 1, bgcolor: "action.hover" }, children: [
1684
+ /* @__PURE__ */ e(N, { variant: "caption", color: "text.secondary", fontWeight: 850, children: "Current values" }),
1685
+ /* @__PURE__ */ e(q, { direction: "row", flexWrap: "wrap", gap: 0.75, sx: { mt: 1 }, children: t.map((v) => /* @__PURE__ */ e(we, { size: "small", label: `${v.label}: ${vt(v)}` }, v.id)) })
1686
+ ] }) : null
1687
+ ] }) });
1688
+ }
1689
+ function vr({
1690
+ value: t,
1691
+ alpha: n = 1,
1692
+ swatches: d = ["#2563eb", "#7c3aed", "#db2777", "#dc2626", "#f59e0b", "#059669"],
1693
+ showValue: s = !0,
1694
+ onChange: b,
1695
+ onAlphaChange: c
1696
+ }) {
1697
+ const g = Math.round(n * 100), f = `${t}${Math.round(n * 255).toString(16).padStart(2, "0")}`;
1698
+ return /* @__PURE__ */ e(Ye, { variant: "outlined", sx: { p: 2, borderRadius: 1 }, children: /* @__PURE__ */ m(q, { spacing: 2, children: [
1699
+ /* @__PURE__ */ e(
1700
+ p,
1701
+ {
1702
+ sx: {
1703
+ height: 96,
1704
+ borderRadius: 1,
1705
+ border: 1,
1706
+ borderColor: "divider",
1707
+ backgroundImage: "linear-gradient(45deg, #e5e7eb 25%, transparent 25%), linear-gradient(-45deg, #e5e7eb 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e5e7eb 75%), linear-gradient(-45deg, transparent 75%, #e5e7eb 75%)",
1708
+ backgroundSize: "18px 18px",
1709
+ backgroundPosition: "0 0, 0 9px, 9px -9px, -9px 0"
1710
+ },
1711
+ children: /* @__PURE__ */ e(p, { sx: { height: "100%", borderRadius: 1, bgcolor: t, opacity: n } })
1712
+ }
1713
+ ),
1714
+ /* @__PURE__ */ m(q, { direction: { xs: "column", sm: "row" }, spacing: 1.5, children: [
1715
+ /* @__PURE__ */ e(
1716
+ Z,
1717
+ {
1718
+ label: "Color",
1719
+ type: "color",
1720
+ value: t,
1721
+ onChange: (a) => b?.(a.target.value),
1722
+ sx: { width: { xs: "100%", sm: 120 } }
1723
+ }
1724
+ ),
1725
+ /* @__PURE__ */ e(
1726
+ Z,
1727
+ {
1728
+ label: "Hex",
1729
+ value: t,
1730
+ onChange: (a) => b?.(a.target.value),
1731
+ fullWidth: !0
1732
+ }
1733
+ )
1734
+ ] }),
1735
+ /* @__PURE__ */ m(p, { children: [
1736
+ /* @__PURE__ */ e(N, { variant: "caption", color: "text.secondary", fontWeight: 800, children: "Alpha" }),
1737
+ /* @__PURE__ */ e(
1738
+ Fe,
1739
+ {
1740
+ min: 0,
1741
+ max: 1,
1742
+ step: 0.01,
1743
+ value: n,
1744
+ onChange: (a, x) => c?.(Array.isArray(x) ? x[0] : x),
1745
+ valueLabelDisplay: "auto",
1746
+ valueLabelFormat: (a) => `${Math.round(a * 100)}%`
1747
+ }
1748
+ ),
1749
+ /* @__PURE__ */ e(
1750
+ Z,
1751
+ {
1752
+ label: "Alpha",
1753
+ type: "number",
1754
+ value: g,
1755
+ onChange: (a) => c?.(Math.min(Math.max(Number(a.target.value), 0), 100) / 100),
1756
+ InputProps: {
1757
+ endAdornment: /* @__PURE__ */ e(ot, { position: "end", children: "%" })
1758
+ },
1759
+ fullWidth: !0
1760
+ }
1761
+ )
1762
+ ] }),
1763
+ /* @__PURE__ */ e(p, { sx: { display: "flex", gap: 1, flexWrap: "wrap" }, children: d.map((a) => /* @__PURE__ */ e(
1764
+ p,
1765
+ {
1766
+ component: "button",
1767
+ "aria-label": a,
1768
+ onClick: () => b?.(a),
1769
+ sx: {
1770
+ width: 32,
1771
+ height: 32,
1772
+ borderRadius: "50%",
1773
+ border: 2,
1774
+ borderColor: a.toLowerCase() === t.toLowerCase() ? "text.primary" : "divider",
1775
+ bgcolor: a,
1776
+ cursor: "pointer"
1777
+ }
1778
+ },
1779
+ a
1780
+ )) }),
1781
+ s ? /* @__PURE__ */ m(p, { sx: { p: 1.5, borderRadius: 1, bgcolor: "#0f172a", color: "#e5e7eb" }, children: [
1782
+ /* @__PURE__ */ e(N, { variant: "caption", color: "#94a3b8", children: "selected color" }),
1783
+ /* @__PURE__ */ e(N, { fontFamily: "monospace", children: f })
1784
+ ] }) : null
1785
+ ] }) });
1786
+ }
1787
+ function kr({ onFiles: t, sx: n, ...d }) {
1788
+ const [s, b] = T(!1);
1789
+ function c(g) {
1790
+ g && t?.(Array.from(g));
1791
+ }
1792
+ return /* @__PURE__ */ m(
1793
+ p,
1794
+ {
1795
+ ...d,
1796
+ onDragOver: (g) => {
1797
+ g.preventDefault(), b(!0);
1798
+ },
1799
+ onDragLeave: () => b(!1),
1800
+ onDrop: (g) => {
1801
+ g.preventDefault(), b(!1), c(g.dataTransfer.files);
1802
+ },
1803
+ sx: [
1804
+ {
1805
+ p: 4,
1806
+ border: 2,
1807
+ borderStyle: "dashed",
1808
+ borderColor: s ? "primary.main" : "divider",
1809
+ borderRadius: 1,
1810
+ textAlign: "center",
1811
+ bgcolor: s ? "primary.50" : "background.paper"
1812
+ },
1813
+ ...Array.isArray(n) ? n : n ? [n] : []
1814
+ ],
1815
+ children: [
1816
+ /* @__PURE__ */ e(N, { fontWeight: 800, children: "Drop files here" }),
1817
+ /* @__PURE__ */ e(N, { variant: "body2", color: "text.secondary", children: "Drag files into this zone" })
1818
+ ]
1819
+ }
1820
+ );
1821
+ }
1822
+ function ye(t, n, d) {
1823
+ return Math.min(Math.max(t, n), d);
1824
+ }
1825
+ function $t(t) {
1826
+ const n = Math.floor(t / 60), d = Math.floor(t % 60);
1827
+ return `${n}:${String(d).padStart(2, "0")}`;
1828
+ }
1829
+ function ke(t, n) {
1830
+ return n > 0 ? ye(t / n * 100, 0, 100) : 0;
1831
+ }
1832
+ function Ct(t, n) {
1833
+ return n.reduce((d, s) => d ? Math.abs(s.time - t) < Math.abs(d.time - t) ? s : d : s, null);
1834
+ }
1835
+ function $r({
1836
+ duration: t,
1837
+ value: n,
1838
+ defaultValue: d = 0,
1839
+ markers: s = [],
1840
+ thumbnails: b = [],
1841
+ disabled: c = !1,
1842
+ showTime: g = !0,
1843
+ preview: f = !0,
1844
+ step: a = 1,
1845
+ formatTime: x = $t,
1846
+ onChange: y,
1847
+ sx: k,
1848
+ ...v
1849
+ }) {
1850
+ const B = oe(null), [C, o] = T(d), [R, u] = T(!1), [z, Y] = T(null), E = ye(n ?? C, 0, t), $ = z === null ? E : z, W = ke(E, t), w = ke($, t), L = Ce(() => [...s].sort((h, S) => h.time - S.time), [s]), j = Ct($, b);
1851
+ function F(h, S) {
1852
+ const D = a > 0 ? Math.round(h / a) * a : h, i = ye(D, 0, t);
1853
+ n === void 0 && o(i), y?.(i, S);
1854
+ }
1855
+ function l(h) {
1856
+ const S = B.current;
1857
+ if (!S)
1858
+ return E;
1859
+ const D = S.getBoundingClientRect();
1860
+ return ye((h - D.left) / D.width, 0, 1) * t;
1861
+ }
1862
+ function M(h) {
1863
+ Y(l(h));
1864
+ }
1865
+ return /* @__PURE__ */ m(
1866
+ p,
1867
+ {
1868
+ ...v,
1869
+ sx: [
1870
+ {
1871
+ width: "100%",
1872
+ color: c ? "text.disabled" : "text.primary",
1873
+ userSelect: "none"
1874
+ },
1875
+ ...Array.isArray(k) ? k : k ? [k] : []
1876
+ ],
1877
+ children: [
1878
+ g ? /* @__PURE__ */ m(p, { sx: { display: "flex", justifyContent: "space-between", mb: 1 }, children: [
1879
+ /* @__PURE__ */ e(N, { variant: "caption", fontWeight: 800, children: x(E) }),
1880
+ /* @__PURE__ */ e(N, { variant: "caption", color: "text.secondary", children: x(t) })
1881
+ ] }) : null,
1882
+ /* @__PURE__ */ m(
1883
+ p,
1884
+ {
1885
+ ref: B,
1886
+ role: "slider",
1887
+ tabIndex: c ? -1 : 0,
1888
+ "aria-valuemin": 0,
1889
+ "aria-valuemax": t,
1890
+ "aria-valuenow": Math.round(E),
1891
+ onPointerMove: (h) => {
1892
+ c || (M(h.clientX), R && F(l(h.clientX), "drag"));
1893
+ },
1894
+ onPointerLeave: () => {
1895
+ R || Y(null);
1896
+ },
1897
+ onPointerDown: (h) => {
1898
+ c || (u(!0), h.currentTarget.setPointerCapture(h.pointerId), F(l(h.clientX), "click"));
1899
+ },
1900
+ onPointerUp: (h) => {
1901
+ u(!1), h.currentTarget.releasePointerCapture(h.pointerId);
1902
+ },
1903
+ onPointerCancel: () => u(!1),
1904
+ onKeyDown: (h) => {
1905
+ c || (h.key === "ArrowLeft" && (F(E - a, "keyboard"), h.preventDefault()), h.key === "ArrowRight" && (F(E + a, "keyboard"), h.preventDefault()), h.key === "Home" && (F(0, "keyboard"), h.preventDefault()), h.key === "End" && (F(t, "keyboard"), h.preventDefault()));
1906
+ },
1907
+ sx: {
1908
+ position: "relative",
1909
+ height: 86,
1910
+ cursor: c ? "default" : "pointer",
1911
+ outline: "none",
1912
+ "&:focus-visible .TimelineScrubber-track": {
1913
+ boxShadow: "0 0 0 3px rgba(37,99,235,0.28)"
1914
+ }
1915
+ },
1916
+ children: [
1917
+ f && z !== null ? /* @__PURE__ */ m(
1918
+ p,
1919
+ {
1920
+ sx: {
1921
+ position: "absolute",
1922
+ left: `${w}%`,
1923
+ top: 0,
1924
+ transform: "translateX(-50%)",
1925
+ width: 116,
1926
+ p: 0.75,
1927
+ border: 1,
1928
+ borderColor: "divider",
1929
+ borderRadius: 1,
1930
+ bgcolor: "background.paper",
1931
+ boxShadow: "0 14px 34px rgba(15,23,42,0.18)",
1932
+ pointerEvents: "none",
1933
+ zIndex: 2
1934
+ },
1935
+ children: [
1936
+ /* @__PURE__ */ e(p, { sx: { height: 56, borderRadius: 0.75, overflow: "hidden", bgcolor: "#e5e7eb" }, children: j?.thumbnail ?? /* @__PURE__ */ e(p, { sx: { height: "100%", display: "grid", placeItems: "center", bgcolor: "#0f172a", color: "#fff" }, children: /* @__PURE__ */ e(N, { variant: "caption", fontWeight: 900, children: x($) }) }) }),
1937
+ /* @__PURE__ */ e(N, { variant: "caption", fontWeight: 800, sx: { display: "block", mt: 0.5, textAlign: "center" }, children: x($) })
1938
+ ]
1939
+ }
1940
+ ) : null,
1941
+ /* @__PURE__ */ e(
1942
+ p,
1943
+ {
1944
+ className: "TimelineScrubber-track",
1945
+ sx: {
1946
+ position: "absolute",
1947
+ left: 0,
1948
+ right: 0,
1949
+ bottom: 18,
1950
+ height: 12,
1951
+ borderRadius: 999,
1952
+ bgcolor: "#e5e7eb",
1953
+ overflow: "hidden",
1954
+ transition: "box-shadow 120ms ease"
1955
+ },
1956
+ children: /* @__PURE__ */ e(
1957
+ p,
1958
+ {
1959
+ sx: {
1960
+ width: `${W}%`,
1961
+ height: "100%",
1962
+ borderRadius: 999,
1963
+ background: "linear-gradient(90deg, #2563eb, #06b6d4)"
1964
+ }
1965
+ }
1966
+ )
1967
+ }
1968
+ ),
1969
+ L.map((h) => {
1970
+ const S = ke(h.time, t);
1971
+ return /* @__PURE__ */ e(ie, { title: h.label ?? x(h.time), arrow: !0, children: /* @__PURE__ */ e(
1972
+ p,
1973
+ {
1974
+ onPointerDown: (D) => {
1975
+ D.stopPropagation(), F(h.time, "marker");
1976
+ },
1977
+ sx: {
1978
+ position: "absolute",
1979
+ left: `${S}%`,
1980
+ bottom: 11,
1981
+ width: 12,
1982
+ height: 26,
1983
+ borderRadius: 999,
1984
+ transform: "translateX(-50%)",
1985
+ bgcolor: h.color ?? "#f59e0b",
1986
+ border: "2px solid",
1987
+ borderColor: "background.paper",
1988
+ boxShadow: "0 8px 18px rgba(15,23,42,0.2)",
1989
+ zIndex: 1
1990
+ }
1991
+ }
1992
+ ) }, h.id);
1993
+ }),
1994
+ /* @__PURE__ */ e(
1995
+ p,
1996
+ {
1997
+ sx: {
1998
+ position: "absolute",
1999
+ left: `${W}%`,
2000
+ bottom: 5,
2001
+ width: 28,
2002
+ height: 28,
2003
+ borderRadius: "50%",
2004
+ transform: "translateX(-50%)",
2005
+ bgcolor: "background.paper",
2006
+ border: 3,
2007
+ borderColor: "#2563eb",
2008
+ boxShadow: R ? "0 12px 30px rgba(37,99,235,0.36)" : "0 8px 20px rgba(15,23,42,0.2)"
2009
+ }
2010
+ }
2011
+ )
2012
+ ]
2013
+ }
2014
+ )
2015
+ ]
2016
+ }
2017
+ );
2018
+ }
2019
+ function De(t, n, d) {
2020
+ return Math.min(Math.max(t, n), d);
2021
+ }
2022
+ function Cr({
2023
+ items: t = [],
2024
+ defaultViewport: n = { x: 0, y: 0, zoom: 1 },
2025
+ viewport: d,
2026
+ minZoom: s = 0.3,
2027
+ maxZoom: b = 2.5,
2028
+ showGrid: c = !0,
2029
+ showMinimap: g = !0,
2030
+ selectedItemId: f,
2031
+ renderItem: a,
2032
+ onViewportChange: x,
2033
+ onItemMove: y,
2034
+ onItemSelect: k,
2035
+ sx: v,
2036
+ ...B
2037
+ }) {
2038
+ const C = oe(null), [o, R] = T(n), [u, z] = T(
2039
+ Object.fromEntries(t.map((l) => [l.id, { x: l.x, y: l.y }]))
2040
+ ), [Y, E] = T(f ?? null), $ = d ?? o, W = f ?? Y, w = Ce(() => {
2041
+ const l = t.map((i) => ({
2042
+ x: u[i.id]?.x ?? i.x,
2043
+ y: u[i.id]?.y ?? i.y,
2044
+ width: i.width ?? 140,
2045
+ height: i.height ?? 80
2046
+ }));
2047
+ if (!l.length)
2048
+ return { minX: -200, minY: -120, width: 400, height: 240 };
2049
+ const M = Math.min(...l.map((i) => i.x)) - 80, h = Math.min(...l.map((i) => i.y)) - 80, S = Math.max(...l.map((i) => i.x + i.width)) + 80, D = Math.max(...l.map((i) => i.y + i.height)) + 80;
2050
+ return { minX: M, minY: h, width: S - M, height: D - h };
2051
+ }, [u, t]);
2052
+ function L(l) {
2053
+ const M = {
2054
+ ...l,
2055
+ zoom: De(l.zoom, s, b)
2056
+ };
2057
+ d === void 0 && R(M), x?.(M);
2058
+ }
2059
+ function j(l, M) {
2060
+ const h = C.current?.getBoundingClientRect();
2061
+ return {
2062
+ x: (l - (h?.left ?? 0) - $.x) / $.zoom,
2063
+ y: (M - (h?.top ?? 0) - $.y) / $.zoom
2064
+ };
2065
+ }
2066
+ function F(l) {
2067
+ E(l?.id ?? null), k?.(l);
2068
+ }
2069
+ return /* @__PURE__ */ m(
2070
+ p,
2071
+ {
2072
+ ...B,
2073
+ ref: C,
2074
+ onWheel: (l) => {
2075
+ l.preventDefault();
2076
+ const M = De($.zoom * (l.deltaY > 0 ? 0.92 : 1.08), s, b), h = j(l.clientX, l.clientY), S = C.current?.getBoundingClientRect(), D = l.clientX - (S?.left ?? 0) - h.x * M, i = l.clientY - (S?.top ?? 0) - h.y * M;
2077
+ L({ x: D, y: i, zoom: M });
2078
+ },
2079
+ onPointerDown: (l) => {
2080
+ if (l.target !== l.currentTarget)
2081
+ return;
2082
+ F(null);
2083
+ const M = l.clientX, h = l.clientY, S = $;
2084
+ l.currentTarget.setPointerCapture(l.pointerId);
2085
+ function D(P) {
2086
+ L({
2087
+ ...S,
2088
+ x: S.x + P.clientX - M,
2089
+ y: S.y + P.clientY - h
2090
+ });
2091
+ }
2092
+ function i() {
2093
+ window.removeEventListener("pointermove", D), window.removeEventListener("pointerup", i);
2094
+ }
2095
+ window.addEventListener("pointermove", D), window.addEventListener("pointerup", i);
2096
+ },
2097
+ sx: [
2098
+ {
2099
+ position: "relative",
2100
+ minHeight: 420,
2101
+ overflow: "hidden",
2102
+ bgcolor: "#f8fafc",
2103
+ cursor: "grab",
2104
+ touchAction: "none"
2105
+ },
2106
+ ...Array.isArray(v) ? v : v ? [v] : []
2107
+ ],
2108
+ children: [
2109
+ /* @__PURE__ */ e(
2110
+ p,
2111
+ {
2112
+ sx: {
2113
+ position: "absolute",
2114
+ inset: 0,
2115
+ pointerEvents: "none",
2116
+ backgroundImage: c ? "linear-gradient(rgba(148,163,184,0.25) 1px, transparent 1px), linear-gradient(90deg, rgba(148,163,184,0.25) 1px, transparent 1px)" : void 0,
2117
+ backgroundSize: `${32 * $.zoom}px ${32 * $.zoom}px`,
2118
+ backgroundPosition: `${$.x}px ${$.y}px`
2119
+ }
2120
+ }
2121
+ ),
2122
+ /* @__PURE__ */ e(
2123
+ p,
2124
+ {
2125
+ sx: {
2126
+ position: "absolute",
2127
+ left: $.x,
2128
+ top: $.y,
2129
+ transform: `scale(${$.zoom})`,
2130
+ transformOrigin: "0 0"
2131
+ },
2132
+ children: t.map((l) => {
2133
+ const M = u[l.id] ?? { x: l.x, y: l.y }, h = l.id === W;
2134
+ return /* @__PURE__ */ e(
2135
+ p,
2136
+ {
2137
+ onPointerDown: (S) => {
2138
+ S.stopPropagation(), F(l);
2139
+ const D = u[l.id] ?? { x: l.x, y: l.y }, i = j(S.clientX, S.clientY);
2140
+ S.currentTarget.setPointerCapture(S.pointerId);
2141
+ function P(le) {
2142
+ const se = j(le.clientX, le.clientY), V = {
2143
+ x: D.x + se.x - i.x,
2144
+ y: D.y + se.y - i.y
2145
+ };
2146
+ z((ee) => ({
2147
+ ...ee,
2148
+ [l.id]: V
2149
+ })), y?.(l.id, V);
2150
+ }
2151
+ function Q() {
2152
+ window.removeEventListener("pointermove", P), window.removeEventListener("pointerup", Q);
2153
+ }
2154
+ window.addEventListener("pointermove", P), window.addEventListener("pointerup", Q);
2155
+ },
2156
+ sx: {
2157
+ position: "absolute",
2158
+ left: M.x,
2159
+ top: M.y,
2160
+ width: l.width ?? 140,
2161
+ height: l.height ?? 80,
2162
+ display: "grid",
2163
+ placeItems: "center",
2164
+ border: h ? 2 : 1,
2165
+ borderColor: h ? "primary.main" : "divider",
2166
+ borderRadius: 1,
2167
+ bgcolor: l.color ?? "background.paper",
2168
+ boxShadow: h ? "0 18px 40px rgba(37,99,235,0.24)" : "0 12px 28px rgba(15,23,42,0.13)",
2169
+ cursor: "grab",
2170
+ userSelect: "none"
2171
+ },
2172
+ children: a ? a(l, h) : /* @__PURE__ */ e(N, { fontWeight: 900, children: l.label ?? l.id })
2173
+ },
2174
+ l.id
2175
+ );
2176
+ })
2177
+ }
2178
+ ),
2179
+ /* @__PURE__ */ m(
2180
+ p,
2181
+ {
2182
+ sx: {
2183
+ position: "absolute",
2184
+ left: 12,
2185
+ bottom: 12,
2186
+ display: "flex",
2187
+ gap: 0.75,
2188
+ alignItems: "center",
2189
+ px: 1,
2190
+ py: 0.5,
2191
+ borderRadius: 1,
2192
+ bgcolor: "rgba(255,255,255,0.92)",
2193
+ border: 1,
2194
+ borderColor: "divider",
2195
+ fontSize: 12,
2196
+ fontWeight: 800
2197
+ },
2198
+ children: [
2199
+ Math.round($.zoom * 100),
2200
+ "%"
2201
+ ]
2202
+ }
2203
+ ),
2204
+ g ? /* @__PURE__ */ e(
2205
+ p,
2206
+ {
2207
+ sx: {
2208
+ position: "absolute",
2209
+ right: 12,
2210
+ bottom: 12,
2211
+ width: 160,
2212
+ height: 100,
2213
+ border: 1,
2214
+ borderColor: "divider",
2215
+ borderRadius: 1,
2216
+ bgcolor: "rgba(255,255,255,0.9)",
2217
+ overflow: "hidden"
2218
+ },
2219
+ children: t.map((l) => {
2220
+ const M = u[l.id] ?? { x: l.x, y: l.y }, h = (M.x - w.minX) / w.width * 100, S = (M.y - w.minY) / w.height * 100, D = (l.width ?? 140) / w.width * 100, i = (l.height ?? 80) / w.height * 100;
2221
+ return /* @__PURE__ */ e(
2222
+ p,
2223
+ {
2224
+ sx: {
2225
+ position: "absolute",
2226
+ left: `${h}%`,
2227
+ top: `${S}%`,
2228
+ width: `${D}%`,
2229
+ height: `${i}%`,
2230
+ minWidth: 6,
2231
+ minHeight: 4,
2232
+ borderRadius: 0.5,
2233
+ bgcolor: l.id === W ? "primary.main" : l.color ?? "#94a3b8"
2234
+ }
2235
+ },
2236
+ l.id
2237
+ );
2238
+ })
2239
+ }
2240
+ ) : null
2241
+ ]
2242
+ }
2243
+ );
2244
+ }
2245
+ function Ir({
2246
+ children: t,
2247
+ title: n,
2248
+ content: d,
2249
+ media: s,
2250
+ actions: b = [],
2251
+ copyText: c,
2252
+ placement: g = "top",
2253
+ pinMode: f = !0,
2254
+ defaultPinned: a = !1,
2255
+ openDelay: x = 120,
2256
+ sx: y,
2257
+ ...k
2258
+ }) {
2259
+ const v = oe(null), B = oe(null), C = oe(null), [o, R] = T(a), [u, z] = T(a), [Y, E] = T(!1);
2260
+ function $() {
2261
+ C.current && window.clearTimeout(C.current), B.current && window.clearTimeout(B.current);
2262
+ }
2263
+ function W() {
2264
+ $(), !o && (C.current = window.setTimeout(() => R(!0), x));
2265
+ }
2266
+ function w() {
2267
+ $(), R(!0);
2268
+ }
2269
+ function L() {
2270
+ $(), u || (B.current = window.setTimeout(() => R(!1), 100));
2271
+ }
2272
+ function j() {
2273
+ const l = !u;
2274
+ z(l), R(l || o);
2275
+ }
2276
+ async function F() {
2277
+ c && (await navigator.clipboard?.writeText(c), E(!0), window.setTimeout(() => E(!1), 1100));
2278
+ }
2279
+ return /* @__PURE__ */ m(Ee, { children: [
2280
+ /* @__PURE__ */ e(
2281
+ p,
2282
+ {
2283
+ component: "span",
2284
+ ref: v,
2285
+ onMouseEnter: W,
2286
+ onMouseLeave: L,
2287
+ onFocus: W,
2288
+ onBlur: L,
2289
+ onClick: () => {
2290
+ f && (R(!0), z(!0));
2291
+ },
2292
+ sx: { display: "inline-flex" },
2293
+ children: t
2294
+ }
2295
+ ),
2296
+ /* @__PURE__ */ e(
2297
+ ct,
2298
+ {
2299
+ open: o,
2300
+ anchorEl: v.current,
2301
+ placement: g,
2302
+ modifiers: [
2303
+ { name: "offset", options: { offset: [0, 10] } },
2304
+ { name: "preventOverflow", options: { padding: 12 } }
2305
+ ],
2306
+ sx: { zIndex: 1500 },
2307
+ children: /* @__PURE__ */ e(
2308
+ st,
2309
+ {
2310
+ onClickAway: () => {
2311
+ u && (R(!1), z(!1));
2312
+ },
2313
+ children: /* @__PURE__ */ e(
2314
+ p,
2315
+ {
2316
+ onMouseEnter: w,
2317
+ onMouseLeave: L,
2318
+ sx: {
2319
+ width: 320,
2320
+ maxWidth: "calc(100vw - 24px)",
2321
+ borderRadius: 1,
2322
+ overflow: "hidden",
2323
+ boxShadow: "0 24px 64px rgba(15,23,42,0.28)",
2324
+ bgcolor: "background.paper"
2325
+ },
2326
+ children: /* @__PURE__ */ e(p, { ...k, sx: [{ p: 1.25 }, ...Array.isArray(y) ? y : y ? [y] : []], children: /* @__PURE__ */ m(q, { spacing: 1.25, children: [
2327
+ s ? /* @__PURE__ */ e(p, { sx: { borderRadius: 1, overflow: "hidden", bgcolor: "#e5e7eb" }, children: s }) : null,
2328
+ /* @__PURE__ */ m(q, { direction: "row", spacing: 1, alignItems: "flex-start", children: [
2329
+ /* @__PURE__ */ m(p, { sx: { minWidth: 0, flex: 1 }, children: [
2330
+ n ? /* @__PURE__ */ e(N, { fontWeight: 900, children: n }) : null,
2331
+ d ? /* @__PURE__ */ e(N, { variant: "body2", color: "text.secondary", sx: { mt: n ? 0.25 : 0 }, children: d }) : null
2332
+ ] }),
2333
+ f ? /* @__PURE__ */ e(ie, { title: u ? "Unpin" : "Pin", children: /* @__PURE__ */ e(ue, { size: "small", onClick: j, children: u ? /* @__PURE__ */ e(at, { fontSize: "small" }) : /* @__PURE__ */ e(lt, { fontSize: "small" }) }) }) : null
2334
+ ] }),
2335
+ c || b.length ? /* @__PURE__ */ m(q, { direction: "row", spacing: 1, flexWrap: "wrap", children: [
2336
+ c ? /* @__PURE__ */ e(ae, { size: "small", variant: "outlined", startIcon: /* @__PURE__ */ e(it, {}), onClick: F, children: Y ? "Copied" : "Copy" }) : null,
2337
+ b.map((l) => /* @__PURE__ */ e(ae, { size: "small", variant: "contained", startIcon: l.icon, onClick: l.onClick, children: l.label }, l.id))
2338
+ ] }) : null
2339
+ ] }) })
2340
+ }
2341
+ )
2342
+ }
2343
+ )
2344
+ }
2345
+ )
2346
+ ] });
2347
+ }
2348
+ export {
2349
+ xr as BeforeAfterSlider,
2350
+ sr as CodeViewer,
2351
+ vr as ColorPicker,
2352
+ pr as CommandPalette,
2353
+ lr as ComponentExample,
2354
+ ur as DockBar,
2355
+ cr as DraggableBox,
2356
+ kr as FileDropZone,
2357
+ fr as FloatingToolbar,
2358
+ dr as GlassBox,
2359
+ Cr as InfiniteCanvas,
2360
+ wr as InspectorPanel,
2361
+ br as MagneticCard,
2362
+ mr as NodeCanvas,
2363
+ yr as ResizableFrame,
2364
+ Ir as SmartTooltip,
2365
+ hr as SplitPane,
2366
+ gr as SpotlightPanel,
2367
+ $r as TimelineScrubber
2368
+ };