@mickyballadelli/react-things 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -42,6 +42,7 @@ export function Example() {
42
42
  - SmartTooltip
43
43
  - ResizableFrame
44
44
  - InspectorPanel
45
+ - KanbanBoard
45
46
  - ColorPicker
46
47
  - TimelineScrubber
47
48
  - FileDropZone
@@ -0,0 +1,26 @@
1
+ import type { BoxProps } from '@mui/material/Box';
2
+ export type KanbanCard = {
3
+ id: string;
4
+ title: string;
5
+ description?: string;
6
+ tags?: string[];
7
+ color?: string;
8
+ data?: unknown;
9
+ };
10
+ export type KanbanColumn = {
11
+ id: string;
12
+ title: string;
13
+ cards: KanbanCard[];
14
+ color?: string;
15
+ };
16
+ export type KanbanBoardProps = Omit<BoxProps, 'onChange'> & {
17
+ columns?: KanbanColumn[];
18
+ defaultColumns?: KanbanColumn[];
19
+ title?: string;
20
+ subtitle?: string;
21
+ density?: 'comfortable' | 'compact';
22
+ allowColumnDrag?: boolean;
23
+ onChange?: (columns: KanbanColumn[]) => void;
24
+ onCardSelect?: (card: KanbanCard, column: KanbanColumn) => void;
25
+ };
26
+ export declare function KanbanBoard({ columns, defaultColumns, title, subtitle, density, allowColumnDrag, onChange, onCardSelect, sx, ...props }: KanbanBoardProps): import("react").JSX.Element;
package/dist/index.d.ts CHANGED
@@ -38,3 +38,5 @@ export type { SmartTooltipAction, SmartTooltipProps } from './components/SmartTo
38
38
  export { SmartTooltip } from './components/SmartTooltip';
39
39
  export type { DataCardGridMetric, DataCardGridProps, DataCardGridStatus } from './components/DataCardGrid';
40
40
  export { DataCardGrid } from './components/DataCardGrid';
41
+ export type { KanbanBoardProps, KanbanCard, KanbanColumn } from './components/KanbanBoard';
42
+ export { KanbanBoard } from './components/KanbanBoard';
@@ -1,24 +1,24 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),K=require("@mui/material"),y=require("react"),d=require("@mui/material/Box"),E=require("@mui/material/styles"),ne=require("@mui/material/Tooltip"),W=require("@mui/material/Typography"),De=require("@mui/material/Collapse"),Ee=require("@mui/material/InputBase"),Xe=require("@mui/material/List"),Se=require("@mui/material/ListItemButton"),qe=require("@mui/material/ListItemIcon"),Ie=require("@mui/material/ListItemText"),Fe=require("@mui/icons-material/AddBox"),Ye=require("@mui/icons-material/AddLink"),Ne=require("@mui/icons-material/Close"),Oe=require("@mui/icons-material/Delete"),He=require("@mui/icons-material/LinkOff"),ce=require("@mui/material/IconButton"),de=require("@mui/material/MenuItem"),O=require("@mui/material/Stack"),Z=require("@mui/material/TextField"),Ve=require("@mui/icons-material/DragIndicator"),oe=require("@mui/material/Button"),Ge=require("@mui/material/Checkbox"),be=require("@mui/material/Chip"),Ue=require("@mui/material/Divider"),Ze=require("@mui/material/FormControlLabel"),je=require("@mui/material/Paper"),Te=require("@mui/material/Slider"),_e=require("@mui/material/InputAdornment"),Qe=require("@mui/icons-material/ContentCopy"),Je=require("@mui/icons-material/PushPin"),Ke=require("@mui/icons-material/PushPinOutlined"),et=require("@mui/material/ClickAwayListener"),tt=require("@mui/material/Popper"),rt=require("@mui/material/LinearProgress");function nt({title:t="React Things",children:n}){return e.jsxs(K.Box,{sx:{border:1,borderColor:"divider",borderRadius:1,p:2,bgcolor:"background.paper"},children:[e.jsx(K.Typography,{variant:"subtitle1",fontWeight:700,children:t}),n?e.jsx(K.Box,{sx:{mt:1},children:n}):null]})}const ye="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",Me=12,ot={c:"#659ad2",cpp:"#00599c",cplusplus:"#00599c","c++":"#00599c",typescript:"#3178c6",ts:"#3178c6",tsx:"#3178c6",javascript:"#f7df1e",js:"#f7df1e",jsx:"#f7df1e",java:"#e76f00",powershell:"#5391fe",ps1:"#5391fe",rust:"#dea584",rs:"#dea584",go:"#00add8",golang:"#00add8",shell:"#89e051",sh:"#89e051",bash:"#89e051",zsh:"#89e051",python:"#3776ab",py:"#3776ab",csharp:"#9b4f96","c#":"#9b4f96",cs:"#9b4f96",php:"#777bb4",ruby:"#cc342d",rb:"#cc342d",swift:"#f05138",kotlin:"#a97bff",kt:"#a97bff",sql:"#336791",html:"#e34f26",css:"#1572b6",dart:"#0175c2"};function it(t){return t.trim().replace(/^\./,"").toLowerCase().replace(/\s+/g,"")}function at(t){return ot[it(t)]??"#93c5fd"}function st(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function lt(t){const n=st(t),s=/^(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/;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>`:s.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}function ct(t){return t.split(/(\s+|<\/?[A-Z][\w.]*|['"`][^'"`]*['"`]|\d*\.?\d+|[A-Za-z_$][\w$-]*|[{}()[\].,:;=<>/]+)/g).map(n=>lt(n)).join("")}function dt({label:t,language:n,value:s,onChange:l,minHeight:x=360}){const u=s??"",b=Math.max(u.split(`
2
- `).length,1),p=Array.from({length:b},(g,w)=>w+1).join(`
3
- `),i=ct(u),m=at(n);return e.jsxs(K.Box,{children:[e.jsxs(K.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:1.5,py:1,bgcolor:"#111827",color:"#d1d5db",borderTopLeftRadius:4,borderTopRightRadius:4},children:[e.jsx(K.Typography,{variant:"caption",fontWeight:800,children:t}),e.jsx(K.Typography,{variant:"caption",sx:{fontFamily:"monospace",color:m,textTransform:"lowercase"},children:n})]}),e.jsxs(K.Box,{sx:{display:"grid",gridTemplateColumns:"48px 1fr",minHeight:x,bgcolor:"#0f172a",borderBottomLeftRadius:4,borderBottomRightRadius:4,overflow:"hidden"},children:[e.jsx(K.Box,{component:"pre","aria-hidden":"true",sx:{m:0,px:1.5,py:1.5,color:"#64748b",bgcolor:"#111827",fontFamily:ye,fontSize:14,lineHeight:1.6,textAlign:"right",userSelect:"none"},children:p}),e.jsxs(K.Box,{sx:{position:"relative",minHeight:x,bgcolor:"#0f172a",overflow:"auto"},children:[e.jsx(K.Box,{component:"pre","aria-hidden":"true",dangerouslySetInnerHTML:{__html:i},sx:{position:"absolute",inset:0,m:0,p:`${Me}px`,boxSizing:"border-box",pointerEvents:"none",color:"#e5e7eb",fontFamily:ye,fontSize:14,lineHeight:1.6,tabSize:2,whiteSpace:"pre-wrap",overflowWrap:"normal"}}),e.jsx(K.Box,{component:"textarea","aria-label":`${t} code editor`,spellCheck:!1,value:u,onChange:g=>l(g.target.value),sx:{position:"relative",width:"100%",minWidth:0,minHeight:x,resize:"vertical",border:0,outline:0,p:`${Me}px`,boxSizing:"border-box",color:"transparent",WebkitTextFillColor:"transparent",bgcolor:"transparent",caretColor:"#60a5fa",fontFamily:ye,fontSize:14,lineHeight:1.6,tabSize:2,whiteSpace:"pre-wrap",overflow:"auto",textShadow:"none",MozOsxFontSmoothing:"auto","&::selection":{color:"transparent",WebkitTextFillColor:"transparent",bgcolor:"rgba(96, 165, 250, 0.35)"}}})]})]})]})}function ut({children:t,initialPosition:n={x:50,y:50},dragSx:s,onPositionChange:l,onDraggingChange:x,sx:u,...b}){const p=y.useRef(null),i=y.useRef(null),[m,g]=y.useState(n),[w,j]=y.useState({x:0,y:0}),[L,$]=y.useState(!1);y.useLayoutEffect(()=>{const h=p.current,S=i.current;if(!h||!S)return;const q=h.getBoundingClientRect(),D=S.getBoundingClientRect(),k=window.getComputedStyle(h),T=m.x/100*q.width,v=m.y/100*q.height;l?.(m,{containerWidth:q.width,containerHeight:q.height,draggableWidth:D.width,draggableHeight:D.height,draggableLeft:T-D.width/2,draggableTop:v-D.height/2,containerBackgroundImage:k.backgroundImage,containerBackgroundSize:k.backgroundSize,containerBackgroundPosition:k.backgroundPosition})},[]);function o(h,S){g(h),l?.(h,S)}function z(h,S,q=w){const D=p.current,k=i.current;if(!D||!k)return;const T=D.getBoundingClientRect(),v=k.getBoundingClientRect(),A=window.getComputedStyle(D),N=h-q.x+v.width/2,F=S-q.y+v.height/2,c=v.width/T.width*50,M=v.height/T.height*50,f=(N-T.left)/T.width*100,I=(F-T.top)/T.height*100,B={x:Math.min(Math.max(f,c),100-c),y:Math.min(Math.max(I,M),100-M)},a=B.x/100*T.width,P=B.y/100*T.height;o(B,{containerWidth:T.width,containerHeight:T.height,draggableWidth:v.width,draggableHeight:v.height,draggableLeft:a-v.width/2,draggableTop:P-v.height/2,containerBackgroundImage:A.backgroundImage,containerBackgroundSize:A.backgroundSize,containerBackgroundPosition:A.backgroundPosition})}return e.jsx(d,{...b,ref:p,sx:[{position:"relative",overflow:"hidden",touchAction:"none"},...Array.isArray(u)?u:u?[u]:[]],onPointerMove:h=>{L&&z(h.clientX,h.clientY)},onPointerUp:h=>{$(!1),x?.(!1),h.currentTarget.releasePointerCapture(h.pointerId)},onPointerCancel:()=>{$(!1),x?.(!1)},children:e.jsx(d,{ref:i,sx:[{position:"absolute",left:`${m.x}%`,top:`${m.y}%`,transform:"translate(-50%, -50%)",cursor:L?"grabbing":"grab",userSelect:"none"},...Array.isArray(s)?s:s?[s]:[]],onPointerDown:h=>{const S=h.currentTarget.getBoundingClientRect(),q={x:h.clientX-S.left,y:h.clientY-S.top};$(!0),x?.(!0),j(q),h.currentTarget.setPointerCapture(h.pointerId),z(h.clientX,h.clientY,q)},children:t})})}function Re(t){return Math.min(Math.max(t,0),1)}function pt({transparency:t=.36,fill:n=.72,liquidColor:s="#39b8ff",glassColor:l="#ffffff",motion:x=0,refractionActive:u=!0,children:b,sx:p,...i}){const g=`glass-liquid-${y.useId().replace(/:/g,"")}`,w=1-Re(t),j=Re(t),$=`${(1-Math.min(Math.max(n,0),1))*100}%`,o=Math.abs(Math.round(x*8))+1,z=.012+Math.abs(Math.sin(x/17))*.012,h=18+w*18,S=u;return e.jsxs(d,{...i,sx:[{position:"relative",overflow:"hidden",border:1,borderColor:E.alpha(l,.48),borderRadius:2,minHeight:160,p:3,color:"common.white",bgcolor:E.alpha(l,.08+j*.18),boxShadow:`
4
- inset 0 1px 0 ${E.alpha(l,.68)},
5
- inset 14px 0 34px ${E.alpha(l,.12)},
6
- inset -18px 0 32px ${E.alpha(s,w*.2)},
7
- 0 18px 48px ${E.alpha("#0b2030",.18)}
8
- `,backdropFilter:"blur(12px) saturate(170%) contrast(108%)",WebkitBackdropFilter:"blur(12px) saturate(170%) contrast(108%)","&::before":{content:'""',position:"absolute",left:0,right:0,top:$,bottom:0,background:`
9
- linear-gradient(160deg, ${E.alpha(l,w*.16)} 0%, ${E.alpha(s,w*.28)} 42%, ${E.alpha("#063451",w*.2)} 100%)
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),ie=require("@mui/material"),w=require("react"),u=require("@mui/material/Box"),N=require("@mui/material/styles"),ce=require("@mui/material/Tooltip"),q=require("@mui/material/Typography"),Ge=require("@mui/material/Collapse"),Ue=require("@mui/material/InputBase"),Ze=require("@mui/material/List"),Me=require("@mui/material/ListItemButton"),_e=require("@mui/material/ListItemIcon"),Re=require("@mui/material/ListItemText"),Ke=require("@mui/icons-material/AddBox"),Qe=require("@mui/icons-material/AddLink"),Je=require("@mui/icons-material/Close"),Ne=require("@mui/icons-material/Delete"),et=require("@mui/icons-material/LinkOff"),de=require("@mui/material/IconButton"),xe=require("@mui/material/MenuItem"),Y=require("@mui/material/Stack"),Z=require("@mui/material/TextField"),Oe=require("@mui/icons-material/DragIndicator"),oe=require("@mui/material/Button"),tt=require("@mui/material/Checkbox"),me=require("@mui/material/Chip"),rt=require("@mui/material/Divider"),nt=require("@mui/material/FormControlLabel"),we=require("@mui/material/Paper"),He=require("@mui/material/Slider"),ot=require("@mui/material/InputAdornment"),it=require("@mui/icons-material/ContentCopy"),at=require("@mui/icons-material/PushPin"),st=require("@mui/icons-material/PushPinOutlined"),lt=require("@mui/material/ClickAwayListener"),ct=require("@mui/material/Popper"),dt=require("@mui/material/LinearProgress"),ze=require("@mui/icons-material/Add"),Ae=require("@mui/icons-material/Edit"),ut=require("@mui/material/Dialog"),pt=require("@mui/material/DialogActions"),ht=require("@mui/material/DialogContent"),xt=require("@mui/material/DialogTitle");function ft({title:t="React Things",children:n}){return e.jsxs(ie.Box,{sx:{border:1,borderColor:"divider",borderRadius:1,p:2,bgcolor:"background.paper"},children:[e.jsx(ie.Typography,{variant:"subtitle1",fontWeight:700,children:t}),n?e.jsx(ie.Box,{sx:{mt:1},children:n}):null]})}const ke="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",Pe=12,gt={c:"#659ad2",cpp:"#00599c",cplusplus:"#00599c","c++":"#00599c",typescript:"#3178c6",ts:"#3178c6",tsx:"#3178c6",javascript:"#f7df1e",js:"#f7df1e",jsx:"#f7df1e",java:"#e76f00",powershell:"#5391fe",ps1:"#5391fe",rust:"#dea584",rs:"#dea584",go:"#00add8",golang:"#00add8",shell:"#89e051",sh:"#89e051",bash:"#89e051",zsh:"#89e051",python:"#3776ab",py:"#3776ab",csharp:"#9b4f96","c#":"#9b4f96",cs:"#9b4f96",php:"#777bb4",ruby:"#cc342d",rb:"#cc342d",swift:"#f05138",kotlin:"#a97bff",kt:"#a97bff",sql:"#336791",html:"#e34f26",css:"#1572b6",dart:"#0175c2"};function bt(t){return t.trim().replace(/^\./,"").toLowerCase().replace(/\s+/g,"")}function mt(t){return gt[bt(t)]??"#93c5fd"}function yt(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function jt(t){const n=yt(t),a=/^(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/;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>`:a.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}function wt(t){return t.split(/(\s+|<\/?[A-Z][\w.]*|['"`][^'"`]*['"`]|\d*\.?\d+|[A-Za-z_$][\w$-]*|[{}()[\].,:;=<>/]+)/g).map(n=>jt(n)).join("")}function vt({label:t,language:n,value:a,onChange:l,minHeight:h=360}){const c=a??"",j=Math.max(c.split(`
2
+ `).length,1),g=Array.from({length:j},(y,k)=>k+1).join(`
3
+ `),d=wt(c),C=mt(n);return e.jsxs(ie.Box,{children:[e.jsxs(ie.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:1.5,py:1,bgcolor:"#111827",color:"#d1d5db",borderTopLeftRadius:4,borderTopRightRadius:4},children:[e.jsx(ie.Typography,{variant:"caption",fontWeight:800,children:t}),e.jsx(ie.Typography,{variant:"caption",sx:{fontFamily:"monospace",color:C,textTransform:"lowercase"},children:n})]}),e.jsxs(ie.Box,{sx:{display:"grid",gridTemplateColumns:"48px 1fr",minHeight:h,bgcolor:"#0f172a",borderBottomLeftRadius:4,borderBottomRightRadius:4,overflow:"hidden"},children:[e.jsx(ie.Box,{component:"pre","aria-hidden":"true",sx:{m:0,px:1.5,py:1.5,color:"#64748b",bgcolor:"#111827",fontFamily:ke,fontSize:14,lineHeight:1.6,textAlign:"right",userSelect:"none"},children:g}),e.jsxs(ie.Box,{sx:{position:"relative",minHeight:h,bgcolor:"#0f172a",overflow:"auto"},children:[e.jsx(ie.Box,{component:"pre","aria-hidden":"true",dangerouslySetInnerHTML:{__html:d},sx:{position:"absolute",inset:0,m:0,p:`${Pe}px`,boxSizing:"border-box",pointerEvents:"none",color:"#e5e7eb",fontFamily:ke,fontSize:14,lineHeight:1.6,tabSize:2,whiteSpace:"pre-wrap",overflowWrap:"normal"}}),e.jsx(ie.Box,{component:"textarea","aria-label":`${t} code editor`,spellCheck:!1,value:c,onChange:y=>l(y.target.value),sx:{position:"relative",width:"100%",minWidth:0,minHeight:h,resize:"vertical",border:0,outline:0,p:`${Pe}px`,boxSizing:"border-box",color:"transparent",WebkitTextFillColor:"transparent",bgcolor:"transparent",caretColor:"#60a5fa",fontFamily:ke,fontSize:14,lineHeight:1.6,tabSize:2,whiteSpace:"pre-wrap",overflow:"auto",textShadow:"none",MozOsxFontSmoothing:"auto","&::selection":{color:"transparent",WebkitTextFillColor:"transparent",bgcolor:"rgba(96, 165, 250, 0.35)"}}})]})]})]})}function Ct({children:t,initialPosition:n={x:50,y:50},dragSx:a,onPositionChange:l,onDraggingChange:h,sx:c,...j}){const g=w.useRef(null),d=w.useRef(null),[C,y]=w.useState(n),[k,x]=w.useState({x:0,y:0}),[L,I]=w.useState(!1);w.useLayoutEffect(()=>{const f=g.current,M=d.current;if(!f||!M)return;const O=f.getBoundingClientRect(),F=M.getBoundingClientRect(),D=window.getComputedStyle(f),R=C.x/100*O.width,$=C.y/100*O.height;l?.(C,{containerWidth:O.width,containerHeight:O.height,draggableWidth:F.width,draggableHeight:F.height,draggableLeft:R-F.width/2,draggableTop:$-F.height/2,containerBackgroundImage:D.backgroundImage,containerBackgroundSize:D.backgroundSize,containerBackgroundPosition:D.backgroundPosition})},[]);function i(f,M){y(f),l?.(f,M)}function B(f,M,O=k){const F=g.current,D=d.current;if(!F||!D)return;const R=F.getBoundingClientRect(),$=D.getBoundingClientRect(),T=window.getComputedStyle(F),V=f-O.x+$.width/2,H=M-O.y+$.height/2,p=$.width/R.width*50,P=$.height/R.height*50,m=(V-R.left)/R.width*100,z=(H-R.top)/R.height*100,X={x:Math.min(Math.max(m,p),100-p),y:Math.min(Math.max(z,P),100-P)},o=X.x/100*R.width,W=X.y/100*R.height;i(X,{containerWidth:R.width,containerHeight:R.height,draggableWidth:$.width,draggableHeight:$.height,draggableLeft:o-$.width/2,draggableTop:W-$.height/2,containerBackgroundImage:T.backgroundImage,containerBackgroundSize:T.backgroundSize,containerBackgroundPosition:T.backgroundPosition})}return e.jsx(u,{...j,ref:g,sx:[{position:"relative",overflow:"hidden",touchAction:"none"},...Array.isArray(c)?c:c?[c]:[]],onPointerMove:f=>{L&&B(f.clientX,f.clientY)},onPointerUp:f=>{I(!1),h?.(!1),f.currentTarget.releasePointerCapture(f.pointerId)},onPointerCancel:()=>{I(!1),h?.(!1)},children:e.jsx(u,{ref:d,sx:[{position:"absolute",left:`${C.x}%`,top:`${C.y}%`,transform:"translate(-50%, -50%)",cursor:L?"grabbing":"grab",userSelect:"none"},...Array.isArray(a)?a:a?[a]:[]],onPointerDown:f=>{const M=f.currentTarget.getBoundingClientRect(),O={x:f.clientX-M.left,y:f.clientY-M.top};I(!0),h?.(!0),x(O),f.currentTarget.setPointerCapture(f.pointerId),B(f.clientX,f.clientY,O)},children:t})})}function Te(t){return Math.min(Math.max(t,0),1)}function kt({transparency:t=.36,fill:n=.72,liquidColor:a="#39b8ff",glassColor:l="#ffffff",motion:h=0,refractionActive:c=!0,children:j,sx:g,...d}){const y=`glass-liquid-${w.useId().replace(/:/g,"")}`,k=1-Te(t),x=Te(t),I=`${(1-Math.min(Math.max(n,0),1))*100}%`,i=Math.abs(Math.round(h*8))+1,B=.012+Math.abs(Math.sin(h/17))*.012,f=18+k*18,M=c;return e.jsxs(u,{...d,sx:[{position:"relative",overflow:"hidden",border:1,borderColor:N.alpha(l,.48),borderRadius:2,minHeight:160,p:3,color:"common.white",bgcolor:N.alpha(l,.08+x*.18),boxShadow:`
4
+ inset 0 1px 0 ${N.alpha(l,.68)},
5
+ inset 14px 0 34px ${N.alpha(l,.12)},
6
+ inset -18px 0 32px ${N.alpha(a,k*.2)},
7
+ 0 18px 48px ${N.alpha("#0b2030",.18)}
8
+ `,backdropFilter:"blur(12px) saturate(170%) contrast(108%)",WebkitBackdropFilter:"blur(12px) saturate(170%) contrast(108%)","&::before":{content:'""',position:"absolute",left:0,right:0,top:I,bottom:0,background:`
9
+ linear-gradient(160deg, ${N.alpha(l,k*.16)} 0%, ${N.alpha(a,k*.28)} 42%, ${N.alpha("#063451",k*.2)} 100%)
10
10
  `,opacity:.95,boxShadow:`
11
- inset 0 18px 28px ${E.alpha(l,.12+w*.16)},
12
- inset 0 -34px 44px ${E.alpha("#032536",w*.22)}
11
+ inset 0 18px 28px ${N.alpha(l,.12+k*.16)},
12
+ inset 0 -34px 44px ${N.alpha("#032536",k*.22)}
13
13
  `},"&::after":{content:'""',position:"absolute",inset:0,background:`
14
- linear-gradient(105deg, ${E.alpha(l,.34)} 0%, ${E.alpha(l,.08)} 18%, ${E.alpha(l,0)} 34%),
15
- radial-gradient(circle at 18% 18%, ${E.alpha(l,.38)} 0 3%, ${E.alpha(l,0)} 18%)
16
- `,pointerEvents:"none"},"& .GlassBox-liquidLens":{position:"absolute",inset:0,zIndex:1,pointerEvents:"none",backgroundImage:"var(--glassbox-refraction-background, none)",backgroundSize:"var(--glassbox-refraction-background-size, cover)",backgroundPosition:"var(--glassbox-refraction-background-position, center)",backgroundRepeat:"no-repeat",filter:`url(#${g}) saturate(150%) contrast(112%)`,opacity:S?.72:0,transition:"opacity 120ms ease-out",maskImage:`linear-gradient(to bottom, transparent 0, transparent calc(${$} + 10px), black calc(${$} + 28px), black 100%)`,WebkitMaskImage:`linear-gradient(to bottom, transparent 0, transparent calc(${$} + 10px), black calc(${$} + 28px), black 100%)`},"& .GlassBox-refractionOffset":{position:"absolute",inset:0,zIndex:2,pointerEvents:"none",opacity:S?.16+j*.16:0,backdropFilter:"blur(3px) saturate(190%)",WebkitBackdropFilter:"blur(3px) saturate(190%)",background:`
17
- linear-gradient(180deg, ${E.alpha(l,.2)} 0, ${E.alpha(l,0)} 20%),
18
- linear-gradient(90deg, ${E.alpha(l,0)} 0 18%, ${E.alpha(l,.14)} 26%, ${E.alpha(l,0)} 34% 58%, ${E.alpha(l,.1)} 68%, ${E.alpha(l,0)} 76% 100%)
19
- `,transition:"opacity 120ms ease-out",maskImage:`linear-gradient(to bottom, transparent 0, transparent ${$}, black calc(${$} + 18px), black 100%)`,WebkitMaskImage:`linear-gradient(to bottom, transparent 0, transparent ${$}, black calc(${$} + 18px), black 100%)`},"& .GlassBox-content":{position:"relative",zIndex:3,textShadow:`0 1px 10px ${E.alpha("#00121d",.36)}`},"& > *":{position:"relative",zIndex:3}},...Array.isArray(p)?p:p?[p]:[]],children:[e.jsx(d,{component:"svg","aria-hidden":"true",focusable:"false",sx:{position:"absolute",width:0,height:0,overflow:"hidden"},children:e.jsxs("filter",{id:g,children:[e.jsx("feTurbulence",{type:"fractalNoise",baseFrequency:`${z} ${z*2.6}`,numOctaves:"2",seed:o,result:"liquidNoise"}),e.jsx("feDisplacementMap",{in:"SourceGraphic",in2:"liquidNoise",scale:h,xChannelSelector:"R",yChannelSelector:"G"})]})}),e.jsx(d,{className:"GlassBox-liquidLens"}),e.jsx(d,{className:"GlassBox-refractionOffset"}),e.jsx(d,{className:"GlassBox-content",children:b})]})}function ht(t,n,s){return Math.min(Math.max(t,n),s)}function xt({items:t,iconSize:n=52,magnification:s=1.7,gap:l=10,tooltip:x=!0,sx:u,...b}){const[p,i]=y.useState(null);return e.jsx(d,{...b,role:"toolbar",sx:[{display:"inline-flex",alignItems:"flex-end",gap:`${l}px`,p:1,border:1,borderColor:"rgba(255,255,255,0.5)",borderRadius:3,bgcolor:"rgba(255,255,255,0.34)",boxShadow:"0 18px 44px rgba(15, 23, 42, 0.22)",backdropFilter:"blur(18px) saturate(150%)",WebkitBackdropFilter:"blur(18px) saturate(150%)"},...Array.isArray(u)?u:u?[u]:[]],onMouseLeave:()=>i(null),children:t.map((m,g)=>{const w=p===null?4:Math.abs(g-p),j=ht(1-w/3,0,1),L=1+(s-1)*j,$=-18*j,o=e.jsx(d,{component:"button",type:"button","aria-label":m.label,onClick:m.onClick,onMouseEnter:()=>i(g),sx:{width:n,height:n,display:"grid",placeItems:"center",flex:"0 0 auto",border:0,borderRadius:2,p:0,color:"inherit",bgcolor:"rgba(255,255,255,0.72)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.85), 0 8px 18px rgba(15, 23, 42, 0.18)",cursor:"pointer",transform:`translateY(${$}px) scale(${L})`,transformOrigin:"bottom center",transition:"transform 130ms ease-out, background-color 130ms ease-out","&:focus-visible":{outline:"2px solid #2563eb",outlineOffset:3},"&:active":{bgcolor:"rgba(255,255,255,0.9)"}},children:e.jsx(W,{component:"span","aria-hidden":"true",sx:{display:"grid",placeItems:"center",fontSize:Math.round(n*.52),lineHeight:1},children:m.icon})},m.id);return x?e.jsx(ne,{title:m.label,placement:"top",arrow:!0,children:o},m.id):o})})}function Be(t){return t.toLowerCase().trim()}function gt(t){return Be([t.label,t.description,t.group,t.parentId,...t.keywords??[]].filter(Boolean).join(" "))}function ze(t){return Array.from(new Set(t.map(n=>n.group).filter(Boolean)))}function ft({items:t,variant:n="list",selectedId:s,placeholder:l="Search",emptyText:x="No items found",maxResults:u,showSearch:b=!0,dense:p=!1,expandedGroups:i,defaultExpandedGroups:m,onExpandedGroupsChange:g,onSelect:w,sx:j,...L}){const $=m??ze(t),[o,z]=y.useState(""),[h,S]=y.useState(0),[q,D]=y.useState($),k=Be(o),T=i??q,v=y.useMemo(()=>{const a=k?t.filter(P=>gt(P).includes(k)):t;return typeof u=="number"?a.slice(0,u):a},[t,u,k]),A=ze(v),N=v;function F(a){a.onSelect?.(),w?.(a),z(""),S(0)}function c(a){i===void 0&&D(a),g?.(a)}function M(a){c(T.includes(a)?T.filter(P=>P!==a):[...T,a])}function f(a,P=0){const _=a.id===s;return e.jsxs(Se,{selected:_,dense:p,onClick:()=>F(a),sx:{borderRadius:1,pl:1.25+P*2,"&.Mui-selected":{bgcolor:"action.selected",color:"primary.main"},"&.Mui-selected:hover, &:hover":{bgcolor:"action.hover"}},children:[a.icon?e.jsx(qe,{sx:{minWidth:34,color:"inherit"},children:a.icon}):null,e.jsx(Ie,{primary:a.label,secondary:a.description,primaryTypographyProps:{fontWeight:_?850:700},secondaryTypographyProps:{color:"text.secondary"}})]},a.id)}function I(){return v.length?A.length?A.map(a=>e.jsxs(d,{children:[e.jsx(W,{variant:"caption",fontWeight:900,color:"text.secondary",sx:{display:"block",px:1.25,pt:1.5,pb:.5},children:a}),v.filter(P=>P.group===a).map(P=>f(P))]},a)):v.map(a=>f(a)):e.jsx(d,{sx:{px:2,py:4,textAlign:"center",color:"text.secondary"},children:x})}function B(){return v.length?A.length?A.map(a=>{const P=k||T.includes(a);return e.jsxs(d,{children:[e.jsxs(Se,{dense:p,onClick:()=>M(a),sx:{borderRadius:1,px:1.25},children:[e.jsx(W,{component:"span","aria-hidden":"true",sx:{mr:1,width:16,color:"text.secondary"},children:P?"▾":"▸"}),e.jsx(Ie,{primary:a,primaryTypographyProps:{fontWeight:900}})]}),e.jsx(De,{in:!!P,timeout:"auto",unmountOnExit:!0,children:v.filter(_=>_.group===a).map(_=>f(_,1))})]},a)}):v.map(a=>f(a)):e.jsx(d,{sx:{px:2,py:4,textAlign:"center",color:"text.secondary"},children:x})}return e.jsxs(d,{...L,sx:[{display:"flex",flexDirection:"column",gap:1,minWidth:0},...Array.isArray(j)?j:j?[j]:[]],children:[b?e.jsx(d,{sx:{px:1.25,py:.75,border:1,borderColor:"divider",borderRadius:1,bgcolor:"background.paper"},children:e.jsx(Ee,{fullWidth:!0,value:o,placeholder:l,onChange:a=>{z(a.target.value),S(0)},onKeyDown:a=>{a.key==="ArrowDown"&&(a.preventDefault(),S(P=>Math.min(P+1,N.length-1))),a.key==="ArrowUp"&&(a.preventDefault(),S(P=>Math.max(P-1,0))),a.key==="Enter"&&N[h]&&(a.preventDefault(),F(N[h]))},sx:{fontSize:14}})}):null,e.jsx(Xe,{disablePadding:!0,dense:p,sx:{overflow:"auto"},children:n==="tree"?B():I()})]})}function Ae(t,n,s){return Math.min(Math.max(t,n),s)}function bt(t){if(!t||typeof window>"u")return null;const n=window.localStorage.getItem(t),s=n===null?Number.NaN:Number(n);return Number.isFinite(s)?s:null}function mt({first:t,second:n,orientation:s="horizontal",initialSize:l=50,size:x,defaultSize:u,minSize:b=20,maxSize:p=80,dividerSize:i=8,snapPoints:m=[],snapThreshold:g=4,resetSize:w=u??l,collapsed:j,defaultCollapsed:L=null,collapsedSize:$=0,persistKey:o,keyboardStep:z=5,onSizeChange:h,onCollapsedChange:S,onDraggingChange:q,dividerLabel:D="Resize panels",sx:k,...T}){const v=y.useRef(null),[A,N]=y.useState(()=>bt(o)??u??l),[F,c]=y.useState(L),[M,f]=y.useState(!1),I=s==="horizontal",a=Ae(x??A,b,p),P=j??F,_=P==="first"?$:P==="second"?100-$:a,ie=P==="first"&&$<=0,ae=P==="second"&&$<=0;y.useEffect(()=>{o&&window.localStorage.setItem(o,String(a))},[o,a]),y.useEffect(()=>{q?.(M)},[M,q]);function V(C){const te=m.reduce((se,xe)=>{const ge=Math.abs(se-C);return Math.abs(xe-C)<ge?xe:se},C),re=Math.abs(te-C)<=g,Q=Ae(re?te:C,b,p);x===void 0&&N(Q),h?.(Q),he(null)}function ee(C,te){const re=v.current;if(!re)return;const Q=re.getBoundingClientRect(),se=I?(C-Q.left)/Q.width*100:(te-Q.top)/Q.height*100;V(se)}function G(C){V(a+C)}function J(){V(w)}function ue(C){he(P===C?null:C)}function he(C){j===void 0&&c(C),S?.(C)}return e.jsxs(d,{...T,ref:v,sx:[{display:"grid",gridTemplateColumns:I?`${_}% ${i}px 1fr`:"1fr",gridTemplateRows:I?"1fr":`${_}% ${i}px 1fr`,minHeight:280,overflow:"hidden",userSelect:M?"none":void 0},...Array.isArray(k)?k:k?[k]:[]],onPointerMove:C=>{M&&ee(C.clientX,C.clientY)},onPointerUp:()=>{f(!1)},onPointerCancel:()=>f(!1),children:[e.jsx(d,{sx:{minWidth:0,minHeight:0,overflow:"auto",display:ie?"none":void 0},children:t}),e.jsx(d,{role:"separator","aria-label":D,"aria-orientation":I?"vertical":"horizontal","aria-valuemin":b,"aria-valuemax":p,"aria-valuenow":Math.round(a),tabIndex:0,onPointerDown:C=>{f(!0),C.currentTarget.setPointerCapture(C.pointerId),ee(C.clientX,C.clientY)},onPointerUp:C=>{f(!1),C.currentTarget.releasePointerCapture(C.pointerId)},onDoubleClick:J,onKeyDown:C=>{C.key==="Enter"&&(J(),C.preventDefault()),C.key==="Home"&&(ue("first"),C.preventDefault()),C.key==="End"&&(ue("second"),C.preventDefault()),(C.key==="ArrowLeft"||C.key==="ArrowUp")&&(G(-z),C.preventDefault()),(C.key==="ArrowRight"||C.key==="ArrowDown")&&(G(z),C.preventDefault())},sx:{position:"relative",bgcolor:M?"primary.main":"divider",cursor:I?"col-resize":"row-resize",touchAction:"none",transition:"background-color 120ms ease","&:hover":{bgcolor:"primary.main"},"&:focus-visible":{outline:"2px solid",outlineColor:"primary.main",outlineOffset:-2},"&::after":{content:'""',position:"absolute",inset:I?"30% -4px":"-4px 30%",borderRadius:999,bgcolor:M?"primary.contrastText":"text.disabled",opacity:.55}}}),e.jsx(d,{sx:{minWidth:0,minHeight:0,overflow:"auto",display:ae?"none":void 0},children:n})]})}function yt(t,n){return n??t?.getBoundingClientRect()??null}function wt({open:t,children:n,anchorEl:s,anchorRect:l,containerRef:x,placement:u="top",offset:b=8,boundaryPadding:p=8,autoUpdate:i=!0,arrow:m=!0,sx:g,...w}){const j=y.useRef(null),[L,$]=y.useState({left:-9999,top:-9999}),o=y.useCallback(()=>{if(!t)return;const z=yt(s,l),h=j.current;if(!z||!h)return;const S=x?.current?.getBoundingClientRect(),q=S?.left??0,D=S?.top??0,k=S?.width??window.innerWidth,T=S?.height??window.innerHeight,v=h.offsetWidth/2,A=h.offsetHeight,N=z.left-q+z.width/2,F=u==="top"?z.top-D-b:z.bottom-D+b,c=Math.min(Math.max(N,v+p),k-v-p),M=u==="top"?Math.max(F,A+p):Math.min(F,T-A-p);$({left:c,top:M})},[s,l,p,x,b,t,u]);return y.useLayoutEffect(()=>{o()},[o]),y.useEffect(()=>{if(!(!t||!i))return window.addEventListener("resize",o),window.addEventListener("scroll",o,!0),()=>{window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0)}},[i,t,o]),t?e.jsx(d,{...w,ref:j,role:"toolbar",sx:[{position:x?"absolute":"fixed",left:L.left,top:L.top,zIndex:1300,display:"inline-flex",alignItems:"center",gap:.5,p:.5,borderRadius:1.5,bgcolor:"rgba(15,23,42,0.96)",color:"#e5e7eb",boxShadow:"0 16px 40px rgba(15, 23, 42, 0.34)",transform:u==="top"?"translate(-50%, -100%)":"translate(-50%, 0)",backdropFilter:"blur(12px)","&::after":m?{content:'""',position:"absolute",left:"50%",width:10,height:10,bgcolor:"rgba(15,23,42,0.96)",transform:"translateX(-50%) rotate(45deg)",bottom:u==="top"?-5:void 0,top:u==="bottom"?-5:void 0}:void 0},...Array.isArray(g)?g:g?[g]:[]],children:n}):null}function jt({strength:t=18,tilt:n=10,lift:s=10,glare:l=!0,perspective:x=900,sx:u,children:b,...p}){const[i,m]=y.useState({x:0,y:0,rotateX:0,rotateY:0,glareX:50,glareY:50,active:!1});return e.jsx(d,{...p,onMouseMove:g=>{const w=g.currentTarget.getBoundingClientRect(),j=(g.clientX-w.left)/w.width,L=(g.clientY-w.top)/w.height,$=(j-.5)*t,o=(L-.5)*t;m({x:$,y:o,rotateX:(.5-L)*n,rotateY:(j-.5)*n,glareX:j*100,glareY:L*100,active:!0})},onMouseLeave:()=>m({x:0,y:0,rotateX:0,rotateY:0,glareX:50,glareY:50,active:!1}),sx:[{position:"relative",overflow:"hidden",transform:`
20
- perspective(${x}px)
21
- translate3d(${i.x}px, ${i.y}px, ${i.active?-s:0}px)
22
- rotateX(${i.rotateX}deg)
23
- rotateY(${i.rotateY}deg)
24
- `,transformStyle:"preserve-3d",transition:i.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",willChange:"transform",boxShadow:i.active?"0 28px 70px rgba(15, 23, 42, 0.24)":"0 14px 34px rgba(15, 23, 42, 0.12)","&::before":l?{content:'""',position:"absolute",inset:0,pointerEvents:"none",opacity:i.active?.78:0,transition:"opacity 160ms ease",background:`radial-gradient(circle at ${i.glareX}% ${i.glareY}%, rgba(255,255,255,0.55), rgba(255,255,255,0.16) 22%, transparent 48%)`,mixBlendMode:"screen"}:void 0,"& > *":{position:"relative",zIndex:1,transform:i.active?"translateZ(24px)":"translateZ(0)",transition:"transform 180ms ease"}},...Array.isArray(u)?u:u?[u]:[]],children:b})}function vt({radius:t=160,dim:n=.72,sx:s,children:l,...x}){const[u,b]=y.useState({x:50,y:50});return e.jsx(d,{...x,onMouseMove:p=>{const i=p.currentTarget.getBoundingClientRect();b({x:(p.clientX-i.left)/i.width*100,y:(p.clientY-i.top)/i.height*100})},sx:[{position:"relative",overflow:"hidden","&::after":{content:'""',position:"absolute",inset:0,pointerEvents:"none",background:`radial-gradient(circle ${t}px at ${u.x}% ${u.y}%, transparent 0, transparent 45%, rgba(0,0,0,${n}) 100%)`}},...Array.isArray(s)?s:s?[s]:[]],children:l})}function Le(t,n){return Math.round(t/n)*n}function kt(t,n,s,l,x){const u=t.x+s/2,b=t.y+l/2,p=n.x+s/2,i=n.y+l/2,m=(u+p)/2;if(x==="ellipse"){const g=Math.max(Math.abs(p-u)/2,24),w=Math.max(Math.abs(i-b)/2,24);return`M ${u} ${b} A ${g} ${w} 0 0 1 ${p} ${i}`}return x==="curved"?`M ${u} ${b} C ${m} ${b}, ${m} ${i}, ${p} ${i}`:x==="step"?`M ${u} ${b} L ${m} ${b} L ${m} ${i} L ${p} ${i}`:`M ${u} ${b} L ${p} ${i}`}function $t({nodes:t,connections:n=[],nodeWidth:s=132,nodeHeight:l=52,mode:x="edit",snapToGrid:u=!1,gridSize:b=24,showGrid:p=!1,selectedNodeId:i,connectionStyle:m="line",editableTools:g=!1,linkTypes:w=["line","curved","step","ellipse"],renderNode:j,onNodesChange:L,onConnectionsChange:$,onNodeMove:o,onNodeSelect:z,sx:h,...S}){const[q,D]=y.useState(t),[k,T]=y.useState(n),v=g?q:t,A=g?k:n,[N,F]=y.useState(Object.fromEntries(v.map(r=>[r.id,{x:r.x,y:r.y}]))),[c,M]=y.useState(i??null),[f,I]=y.useState(!1),[B,a]=y.useState(""),[P,_]=y.useState(w[0]??"line"),[ie,ae]=y.useState(""),[V,ee]=y.useState(null),G=i??c,J=v.find(r=>r.id===G)??null,ue=A.map((r,R)=>({connection:r,index:R})).filter(({connection:r})=>r.from===G||r.to===G),he=t.map(r=>`${r.id}:${r.label}:${r.x}:${r.y}:${r.color??""}`).join("|"),C=n.map(r=>`${r.from}:${r.to}:${r.type??""}:${r.label??""}:${r.color??""}`).join("|");y.useEffect(()=>{g||D(t),F(r=>({...Object.fromEntries(t.map(R=>[R.id,r[R.id]??{x:R.x,y:R.y}]))}))},[g,he]),y.useEffect(()=>{g||T(n)},[C,g]);function te(r){D(r),L?.(r)}function re(r){T(r),$?.(r)}function Q(r,R){const Y=u?{x:Le(R.x,b),y:Le(R.y,b)}:R;F(X=>({...X,[r]:Y})),g&&te(v.map(X=>X.id===r?{...X,...Y}:X)),o?.(r,Y)}function se(){const r=v.length+1,R={id:`node-${Date.now()}`,label:`Box ${r}`,x:48+r*18,y:48+r*18,color:"#ffffff"};te([...v,R]),F(Y=>({...Y,[R.id]:{x:R.x,y:R.y}})),M(R.id)}function xe(){G&&(te(v.filter(r=>r.id!==G)),re(A.filter(r=>r.from!==G&&r.to!==G)),M(null),I(!1))}function ge(r){G&&te(v.map(R=>R.id===G?{...R,...r}:R))}function ve(){if(!G||!B||G===B)return;const r={from:G,to:B,type:P,label:ie,color:P==="ellipse"?"#db2777":P==="step"?"#059669":"#2563eb"},R=[...A.filter(Y=>!(Y.from===G&&Y.to===B)),r];re(R),a(""),ae(""),ee(R.indexOf(r))}function fe(r,R){const Y=A[r];if(!Y)return;const X={...Y,...R},U=A.map((H,le)=>le===r?X:H).filter((H,le)=>le===r||H.from!==X.from||H.to!==X.to);re(U)}function We(r){re(A.filter((R,Y)=>Y!==r)),ee(null)}return e.jsxs(d,{...S,sx:[{position:"relative",minHeight:360,overflow:"hidden",bgcolor:"#f8fafc",backgroundImage:p?"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,backgroundSize:p?`${b}px ${b}px`:void 0},...Array.isArray(h)?h:h?[h]:[]],children:[e.jsx(d,{component:"svg",sx:{position:"absolute",inset:0,width:"100%",height:"100%"},children:A.map(r=>{const R=N[r.from],Y=N[r.to];if(!R||!Y)return null;const X=kt(R,Y,s,l,r.type??m),U=(R.x+Y.x+s)/2,H=(R.y+Y.y+l)/2;return e.jsxs("g",{children:[e.jsx("path",{d:X,fill:"none",stroke:r.color??"#94a3b8",strokeWidth:"2.5"}),r.label?e.jsx("text",{x:U,y:H-8,textAnchor:"middle",fill:r.color??"#64748b",fontSize:"11",fontWeight:"700",children:r.label}):null]},`${r.from}-${r.to}-${r.type??r.label??"link"}`)})}),v.map(r=>{const R=N[r.id],Y=r.id===G;return e.jsx(d,{role:"button",tabIndex:0,sx:{position:"absolute",left:R.x,top:R.y,width:s,height:l,display:"grid",placeItems:"center",border:Y?2:1,borderColor:Y?"primary.main":"divider",borderRadius:1,bgcolor:r.color??"background.paper",cursor:x==="edit"?"grab":"pointer",userSelect:"none",boxShadow:Y?"0 18px 34px rgba(37,99,235,0.22)":"0 12px 28px rgba(15,23,42,0.12)",touchAction:"none"},onPointerDown:X=>{if(M(r.id),ee(null),g&&I(!0),z?.(r),x==="readonly")return;const U=X.clientX,H=X.clientY,le=N[r.id];X.currentTarget.setPointerCapture(X.pointerId);function ke(Ce){Q(r.id,{x:le.x+Ce.clientX-U,y:le.y+Ce.clientY-H})}function $e(){window.removeEventListener("pointermove",ke),window.removeEventListener("pointerup",$e)}window.addEventListener("pointermove",ke),window.addEventListener("pointerup",$e)},onKeyDown:X=>{if(x==="readonly")return;const U=u?b:8,H=N[r.id];X.key==="ArrowLeft"&&(Q(r.id,{x:H.x-U,y:H.y}),X.preventDefault()),X.key==="ArrowRight"&&(Q(r.id,{x:H.x+U,y:H.y}),X.preventDefault()),X.key==="ArrowUp"&&(Q(r.id,{x:H.x,y:H.y-U}),X.preventDefault()),X.key==="ArrowDown"&&(Q(r.id,{x:H.x,y:H.y+U}),X.preventDefault())},children:j?j(r,Y):e.jsx(W,{fontWeight:800,children:r.label})},r.id)}),g&&J&&f?e.jsx(d,{sx:{position:"absolute",right:12,top:12,zIndex:20,width:340,maxWidth:"calc(100% - 24px)",maxHeight:"calc(100% - 24px)",overflow:"auto",border:1,borderColor:"divider",borderRadius:1,bgcolor:"background.paper",boxShadow:"0 20px 48px rgba(15,23,42,0.22)"},children:e.jsxs(O,{spacing:1.25,sx:{p:1.5},children:[e.jsxs(O,{direction:"row",spacing:.75,alignItems:"center",children:[e.jsx(W,{variant:"subtitle2",fontWeight:900,sx:{flex:1},children:"Box editor"}),e.jsx(ne,{title:"Add box",children:e.jsx(ce,{size:"small",color:"primary",onClick:se,children:e.jsx(Fe,{fontSize:"small"})})}),e.jsx(ne,{title:"Remove box",children:e.jsx("span",{children:e.jsx(ce,{size:"small",color:"error",onClick:xe,disabled:!J,children:e.jsx(Oe,{fontSize:"small"})})})}),e.jsx(ne,{title:"Close editor",children:e.jsx(ce,{size:"small",onClick:()=>I(!1),children:e.jsx(Ne,{fontSize:"small"})})})]}),e.jsxs(d,{sx:{display:"grid",gridTemplateColumns:"1fr 96px",gap:1},children:[e.jsx(Z,{size:"small",label:"Label",value:J?.label??"",disabled:!J,onChange:r=>ge({label:r.target.value})}),e.jsx(Z,{size:"small",label:"Color",type:"color",value:J?.color??"#ffffff",disabled:!J,onChange:r=>ge({color:r.target.value})})]}),e.jsxs(d,{sx:{display:"grid",gridTemplateColumns:"1fr",gap:1.25},children:[e.jsxs(O,{spacing:1,children:[e.jsx(W,{variant:"caption",fontWeight:900,color:"text.secondary",children:"Links"}),e.jsxs(d,{sx:{display:"grid",gridTemplateColumns:"1fr 32px",gap:.5,alignItems:"center"},children:[e.jsxs(Z,{select:!0,size:"small",label:"To",value:B,disabled:!J,onChange:r=>a(r.target.value),children:[e.jsx(de,{value:"",children:"Pick target"}),v.filter(r=>r.id!==G).map(r=>e.jsx(de,{value:r.id,children:r.label},r.id))]}),e.jsx(ne,{title:`Add link from ${J?.label??"box"}`,children:e.jsx("span",{children:e.jsx(ce,{size:"small",color:"primary",disabled:!J||!B,onClick:ve,sx:{width:32,height:32,border:1,borderColor:"divider",borderRadius:1},children:e.jsx(Ye,{fontSize:"small"})})})})]}),ue.length?ue.map(({connection:r,index:R})=>{const Y=v.find(H=>H.id===r.from),X=v.find(H=>H.id===r.to),U=V===R;return e.jsxs(d,{sx:{width:"100%",display:"grid",gridTemplateColumns:"1fr 32px",gap:.5,alignItems:"center"},children:[e.jsx(d,{component:"button",onClick:()=>ee(R),sx:{px:1,py:.75,minWidth:0,border:1,borderColor:U?"primary.main":"divider",borderRadius:1,bgcolor:U?"primary.main":"background.paper",color:U?"primary.contrastText":"text.primary",cursor:"pointer",font:"inherit",textAlign:"left"},children:(Y?.label??r.from)+" -> "+(X?.label??r.to)}),e.jsx(ne,{title:"Remove link",children:e.jsx(ce,{size:"small",color:"error",onClick:()=>We(R),sx:{width:32,height:32},children:e.jsx(He,{fontSize:"small"})})})]},`${r.from}-${r.to}-${R}`)}):e.jsx(W,{variant:"body2",color:"text.secondary",children:"No linked boxes."})]}),e.jsxs(O,{spacing:1,children:[e.jsx(W,{variant:"caption",fontWeight:900,color:"text.secondary",children:"Link details"}),V!==null&&A[V]?e.jsxs(e.Fragment,{children:[e.jsx(Z,{select:!0,size:"small",label:"From",value:A[V].from,onChange:r=>fe(V,{from:r.target.value}),children:v.filter(r=>r.id!==A[V].to).map(r=>e.jsx(de,{value:r.id,children:r.label},r.id))}),e.jsxs(d,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsx(Z,{select:!0,size:"small",label:"To",value:A[V].to,onChange:r=>fe(V,{to:r.target.value}),children:v.filter(r=>r.id!==A[V].from).map(r=>e.jsx(de,{value:r.id,children:r.label},r.id))}),e.jsx(Z,{select:!0,size:"small",label:"Shape",value:A[V].type??m,onChange:r=>fe(V,{type:r.target.value}),children:w.map(r=>e.jsx(de,{value:r,children:r},r))})]}),e.jsx(Z,{size:"small",label:"Label",value:A[V].label??"",onChange:r=>fe(V,{label:r.target.value})})]}):e.jsx(W,{variant:"body2",color:"text.secondary",children:"Pick a link."})]})]})]})}):null]})}function Ct({before:t,after:n,initialPosition:s=50,sx:l,...x}){const[u,b]=y.useState(s);return e.jsxs(d,{...x,sx:[{position:"relative",overflow:"hidden",minHeight:280},...Array.isArray(l)?l:l?[l]:[]],onPointerMove:p=>{if(p.buttons!==1)return;const i=p.currentTarget.getBoundingClientRect();b((p.clientX-i.left)/i.width*100)},children:[e.jsx(d,{sx:{position:"absolute",inset:0},children:n}),e.jsx(d,{sx:{position:"absolute",inset:0,width:`${u}%`,overflow:"hidden"},children:t}),e.jsx(d,{sx:{position:"absolute",top:0,bottom:0,left:`${u}%`,width:3,bgcolor:"#ffffff",boxShadow:"0 0 0 1px rgba(0,0,0,0.2)",cursor:"ew-resize"}})]})}function St({initialWidth:t=320,initialHeight:n=220,minWidth:s=160,minHeight:l=120,sx:x,children:u,...b}){const[p,i]=y.useState({width:t,height:n});return e.jsxs(d,{...b,sx:[{position:"relative",width:p.width,height:p.height,overflow:"auto",border:1,borderColor:"divider",borderRadius:1,bgcolor:"background.paper"},...Array.isArray(x)?x:x?[x]:[]],children:[u,e.jsx(d,{sx:{position:"absolute",right:4,bottom:4,width:28,height:28,display:"grid",placeItems:"center",cursor:"nwse-resize",color:"text.secondary",bgcolor:"background.paper",border:1,borderColor:"divider",borderRadius:1,boxShadow:"0 6px 16px rgba(15,23,42,0.14)"},onPointerDown:m=>{const g=m.clientX,w=m.clientY,j=p;function L(o){i({width:Math.max(s,j.width+o.clientX-g),height:Math.max(l,j.height+o.clientY-w)})}function $(){window.removeEventListener("pointermove",L),window.removeEventListener("pointerup",$)}window.addEventListener("pointermove",L),window.addEventListener("pointerup",$)},children:e.jsx(Ve,{fontSize:"small"})})]})}function It(t){return t.type==="boolean"?t.value?"On":"Off":`${t.value}${t.unit?` ${t.unit}`:""}`}function Mt(t){return t.reduce((n,s)=>{const l=s.group??"Settings";return{...n,[l]:[...n[l]??[],s]}},{})}function Rt({fields:t,onChange:n,title:s="Inspector",description:l,density:x="comfortable",showValueSummary:u=!0,showReset:b=!0,sx:p}){const i=Mt(t),m=x==="compact"?1.25:2,g=x==="compact"?"small":"medium";function w(j){j.defaultValue!==void 0&&n?.(j.id,j.defaultValue)}return e.jsx(je,{variant:"outlined",sx:[{p:x==="compact"?1.5:2,borderRadius:1},...Array.isArray(p)?p:[p]],children:e.jsxs(O,{spacing:m,children:[e.jsxs(d,{children:[e.jsxs(O,{direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,children:[e.jsx(W,{variant:"subtitle1",fontWeight:850,children:s}),u?e.jsx(be,{size:"small",label:`${t.length} fields`}):null]}),l?e.jsx(W,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:l}):null]}),Object.entries(i).map(([j,L],$)=>e.jsxs(O,{spacing:m,children:[$>0?e.jsx(Ue,{}):null,e.jsx(W,{variant:"caption",color:"text.secondary",fontWeight:850,sx:{textTransform:"uppercase"},children:j}),L.map(o=>{const z=b&&o.defaultValue!==void 0&&o.defaultValue!==o.value;return o.type==="boolean"?e.jsxs(d,{children:[e.jsxs(O,{direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,children:[e.jsx(Ze,{control:e.jsx(Ge,{checked:!!o.value,disabled:o.disabled,onChange:h=>n?.(o.id,h.target.checked)}),label:o.label}),z?e.jsx(oe,{size:"small",onClick:()=>w(o),children:"Reset"}):null]}),o.description?e.jsx(W,{variant:"caption",color:"text.secondary",children:o.description}):null]},o.id):o.type==="number"?e.jsxs(O,{spacing:1,children:[e.jsxs(O,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsx(Z,{fullWidth:!0,size:g,label:o.label,type:"number",value:o.value,helperText:o.description,disabled:o.disabled,inputProps:{min:o.min,max:o.max,step:o.step},onChange:h=>n?.(o.id,Number(h.target.value))}),o.unit?e.jsx(be,{label:o.unit,size:"small",sx:{mt:1}}):null,z?e.jsx(oe,{size:"small",onClick:()=>w(o),sx:{mt:.5},children:"Reset"}):null]}),o.min!==void 0||o.max!==void 0?e.jsx(Te,{value:Number(o.value),min:o.min??0,max:o.max??100,step:o.step??1,disabled:o.disabled,valueLabelDisplay:"auto",onChange:(h,S)=>n?.(o.id,Array.isArray(S)?S[0]:S)}):null]},o.id):o.type==="select"?e.jsxs(O,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsx(Z,{select:!0,fullWidth:!0,size:g,label:o.label,value:o.value,helperText:o.description,disabled:o.disabled,onChange:h=>n?.(o.id,h.target.value),children:(o.options??[]).map(h=>e.jsx(de,{value:h.value,children:h.label},h.value))}),z?e.jsx(oe,{size:"small",onClick:()=>w(o),sx:{mt:.5},children:"Reset"}):null]},o.id):o.type==="color"?e.jsxs(O,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsx(Z,{fullWidth:!0,size:g,label:o.label,value:o.value,helperText:o.description,disabled:o.disabled,onChange:h=>n?.(o.id,h.target.value),InputProps:{startAdornment:e.jsx(d,{component:"input",type:"color",value:String(o.value),disabled:o.disabled,onChange:h=>n?.(o.id,h.target.value),sx:{width:28,height:28,p:0,mr:1,border:0,bgcolor:"transparent",cursor:o.disabled?"default":"pointer"}})}}),z?e.jsx(oe,{size:"small",onClick:()=>w(o),sx:{mt:.5},children:"Reset"}):null]},o.id):e.jsxs(O,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsx(Z,{fullWidth:!0,size:g,label:o.label,value:o.value,helperText:o.description,disabled:o.disabled,onChange:h=>n?.(o.id,h.target.value)}),z?e.jsx(oe,{size:"small",onClick:()=>w(o),sx:{mt:.5},children:"Reset"}):null]},o.id)})]},j)),u?e.jsxs(d,{sx:{p:1.25,borderRadius:1,bgcolor:"action.hover"},children:[e.jsx(W,{variant:"caption",color:"text.secondary",fontWeight:850,children:"Current values"}),e.jsx(O,{direction:"row",flexWrap:"wrap",gap:.75,sx:{mt:1},children:t.map(j=>e.jsx(be,{size:"small",label:`${j.label}: ${It(j)}`},j.id))})]}):null]})})}function zt({value:t,alpha:n=1,swatches:s=["#2563eb","#7c3aed","#db2777","#dc2626","#f59e0b","#059669"],showValue:l=!0,onChange:x,onAlphaChange:u}){const b=Math.round(n*100),p=`${t}${Math.round(n*255).toString(16).padStart(2,"0")}`;return e.jsx(je,{variant:"outlined",sx:{p:2,borderRadius:1},children:e.jsxs(O,{spacing:2,children:[e.jsx(d,{sx:{height:96,borderRadius:1,border:1,borderColor:"divider",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%)",backgroundSize:"18px 18px",backgroundPosition:"0 0, 0 9px, 9px -9px, -9px 0"},children:e.jsx(d,{sx:{height:"100%",borderRadius:1,bgcolor:t,opacity:n}})}),e.jsxs(O,{direction:{xs:"column",sm:"row"},spacing:1.5,children:[e.jsx(Z,{label:"Color",type:"color",value:t,onChange:i=>x?.(i.target.value),sx:{width:{xs:"100%",sm:120}}}),e.jsx(Z,{label:"Hex",value:t,onChange:i=>x?.(i.target.value),fullWidth:!0})]}),e.jsxs(d,{children:[e.jsx(W,{variant:"caption",color:"text.secondary",fontWeight:800,children:"Alpha"}),e.jsx(Te,{min:0,max:1,step:.01,value:n,onChange:(i,m)=>u?.(Array.isArray(m)?m[0]:m),valueLabelDisplay:"auto",valueLabelFormat:i=>`${Math.round(i*100)}%`}),e.jsx(Z,{label:"Alpha",type:"number",value:b,onChange:i=>u?.(Math.min(Math.max(Number(i.target.value),0),100)/100),InputProps:{endAdornment:e.jsx(_e,{position:"end",children:"%"})},fullWidth:!0})]}),e.jsx(d,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:s.map(i=>e.jsx(d,{component:"button","aria-label":i,onClick:()=>x?.(i),sx:{width:32,height:32,borderRadius:"50%",border:2,borderColor:i.toLowerCase()===t.toLowerCase()?"text.primary":"divider",bgcolor:i,cursor:"pointer"}},i))}),l?e.jsxs(d,{sx:{p:1.5,borderRadius:1,bgcolor:"#0f172a",color:"#e5e7eb"},children:[e.jsx(W,{variant:"caption",color:"#94a3b8",children:"selected color"}),e.jsx(W,{fontFamily:"monospace",children:p})]}):null]})})}function At({onFiles:t,sx:n,...s}){const[l,x]=y.useState(!1);function u(b){b&&t?.(Array.from(b))}return e.jsxs(d,{...s,onDragOver:b=>{b.preventDefault(),x(!0)},onDragLeave:()=>x(!1),onDrop:b=>{b.preventDefault(),x(!1),u(b.dataTransfer.files)},sx:[{p:4,border:2,borderStyle:"dashed",borderColor:l?"primary.main":"divider",borderRadius:1,textAlign:"center",bgcolor:l?"primary.50":"background.paper"},...Array.isArray(n)?n:n?[n]:[]],children:[e.jsx(W,{fontWeight:800,children:"Drop files here"}),e.jsx(W,{variant:"body2",color:"text.secondary",children:"Drag files into this zone"})]})}function me(t,n,s){return Math.min(Math.max(t,n),s)}function Lt(t){const n=Math.floor(t/60),s=Math.floor(t%60);return`${n}:${String(s).padStart(2,"0")}`}function we(t,n){return n>0?me(t/n*100,0,100):0}function Pt(t,n){return n.reduce((s,l)=>s?Math.abs(l.time-t)<Math.abs(s.time-t)?l:s:l,null)}function Tt({duration:t,value:n,defaultValue:s=0,markers:l=[],thumbnails:x=[],disabled:u=!1,showTime:b=!0,preview:p=!0,step:i=1,formatTime:m=Lt,onChange:g,sx:w,...j}){const L=y.useRef(null),[$,o]=y.useState(s),[z,h]=y.useState(!1),[S,q]=y.useState(null),D=me(n??$,0,t),k=S===null?D:S,T=we(D,t),v=we(k,t),A=y.useMemo(()=>[...l].sort((f,I)=>f.time-I.time),[l]),N=Pt(k,x);function F(f,I){const B=i>0?Math.round(f/i)*i:f,a=me(B,0,t);n===void 0&&o(a),g?.(a,I)}function c(f){const I=L.current;if(!I)return D;const B=I.getBoundingClientRect();return me((f-B.left)/B.width,0,1)*t}function M(f){q(c(f))}return e.jsxs(d,{...j,sx:[{width:"100%",color:u?"text.disabled":"text.primary",userSelect:"none"},...Array.isArray(w)?w:w?[w]:[]],children:[b?e.jsxs(d,{sx:{display:"flex",justifyContent:"space-between",mb:1},children:[e.jsx(W,{variant:"caption",fontWeight:800,children:m(D)}),e.jsx(W,{variant:"caption",color:"text.secondary",children:m(t)})]}):null,e.jsxs(d,{ref:L,role:"slider",tabIndex:u?-1:0,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":Math.round(D),onPointerMove:f=>{u||(M(f.clientX),z&&F(c(f.clientX),"drag"))},onPointerLeave:()=>{z||q(null)},onPointerDown:f=>{u||(h(!0),f.currentTarget.setPointerCapture(f.pointerId),F(c(f.clientX),"click"))},onPointerUp:f=>{h(!1),f.currentTarget.releasePointerCapture(f.pointerId)},onPointerCancel:()=>h(!1),onKeyDown:f=>{u||(f.key==="ArrowLeft"&&(F(D-i,"keyboard"),f.preventDefault()),f.key==="ArrowRight"&&(F(D+i,"keyboard"),f.preventDefault()),f.key==="Home"&&(F(0,"keyboard"),f.preventDefault()),f.key==="End"&&(F(t,"keyboard"),f.preventDefault()))},sx:{position:"relative",height:86,cursor:u?"default":"pointer",outline:"none","&:focus-visible .TimelineScrubber-track":{boxShadow:"0 0 0 3px rgba(37,99,235,0.28)"}},children:[p&&S!==null?e.jsxs(d,{sx:{position:"absolute",left:`${v}%`,top:0,transform:"translateX(-50%)",width:116,p:.75,border:1,borderColor:"divider",borderRadius:1,bgcolor:"background.paper",boxShadow:"0 14px 34px rgba(15,23,42,0.18)",pointerEvents:"none",zIndex:2},children:[e.jsx(d,{sx:{height:56,borderRadius:.75,overflow:"hidden",bgcolor:"#e5e7eb"},children:N?.thumbnail??e.jsx(d,{sx:{height:"100%",display:"grid",placeItems:"center",bgcolor:"#0f172a",color:"#fff"},children:e.jsx(W,{variant:"caption",fontWeight:900,children:m(k)})})}),e.jsx(W,{variant:"caption",fontWeight:800,sx:{display:"block",mt:.5,textAlign:"center"},children:m(k)})]}):null,e.jsx(d,{className:"TimelineScrubber-track",sx:{position:"absolute",left:0,right:0,bottom:18,height:12,borderRadius:999,bgcolor:"#e5e7eb",overflow:"hidden",transition:"box-shadow 120ms ease"},children:e.jsx(d,{sx:{width:`${T}%`,height:"100%",borderRadius:999,background:"linear-gradient(90deg, #2563eb, #06b6d4)"}})}),A.map(f=>{const I=we(f.time,t);return e.jsx(ne,{title:f.label??m(f.time),arrow:!0,children:e.jsx(d,{onPointerDown:B=>{B.stopPropagation(),F(f.time,"marker")},sx:{position:"absolute",left:`${I}%`,bottom:11,width:12,height:26,borderRadius:999,transform:"translateX(-50%)",bgcolor:f.color??"#f59e0b",border:"2px solid",borderColor:"background.paper",boxShadow:"0 8px 18px rgba(15,23,42,0.2)",zIndex:1}})},f.id)}),e.jsx(d,{sx:{position:"absolute",left:`${T}%`,bottom:5,width:28,height:28,borderRadius:"50%",transform:"translateX(-50%)",bgcolor:"background.paper",border:3,borderColor:"#2563eb",boxShadow:z?"0 12px 30px rgba(37,99,235,0.36)":"0 8px 20px rgba(15,23,42,0.2)"}})]})]})}function Pe(t,n,s){return Math.min(Math.max(t,n),s)}function Bt({items:t=[],defaultViewport:n={x:0,y:0,zoom:1},viewport:s,minZoom:l=.3,maxZoom:x=2.5,showGrid:u=!0,showMinimap:b=!0,selectedItemId:p,renderItem:i,onViewportChange:m,onItemMove:g,onItemSelect:w,sx:j,...L}){const $=y.useRef(null),[o,z]=y.useState(n),[h,S]=y.useState(Object.fromEntries(t.map(c=>[c.id,{x:c.x,y:c.y}]))),[q,D]=y.useState(p??null),k=s??o,T=p??q,v=y.useMemo(()=>{const c=t.map(a=>({x:h[a.id]?.x??a.x,y:h[a.id]?.y??a.y,width:a.width??140,height:a.height??80}));if(!c.length)return{minX:-200,minY:-120,width:400,height:240};const M=Math.min(...c.map(a=>a.x))-80,f=Math.min(...c.map(a=>a.y))-80,I=Math.max(...c.map(a=>a.x+a.width))+80,B=Math.max(...c.map(a=>a.y+a.height))+80;return{minX:M,minY:f,width:I-M,height:B-f}},[h,t]);function A(c){const M={...c,zoom:Pe(c.zoom,l,x)};s===void 0&&z(M),m?.(M)}function N(c,M){const f=$.current?.getBoundingClientRect();return{x:(c-(f?.left??0)-k.x)/k.zoom,y:(M-(f?.top??0)-k.y)/k.zoom}}function F(c){D(c?.id??null),w?.(c)}return e.jsxs(d,{...L,ref:$,onWheel:c=>{c.preventDefault();const M=Pe(k.zoom*(c.deltaY>0?.92:1.08),l,x),f=N(c.clientX,c.clientY),I=$.current?.getBoundingClientRect(),B=c.clientX-(I?.left??0)-f.x*M,a=c.clientY-(I?.top??0)-f.y*M;A({x:B,y:a,zoom:M})},onPointerDown:c=>{if(c.target!==c.currentTarget)return;F(null);const M=c.clientX,f=c.clientY,I=k;c.currentTarget.setPointerCapture(c.pointerId);function B(P){A({...I,x:I.x+P.clientX-M,y:I.y+P.clientY-f})}function a(){window.removeEventListener("pointermove",B),window.removeEventListener("pointerup",a)}window.addEventListener("pointermove",B),window.addEventListener("pointerup",a)},sx:[{position:"relative",minHeight:420,overflow:"hidden",bgcolor:"#f8fafc",cursor:"grab",touchAction:"none"},...Array.isArray(j)?j:j?[j]:[]],children:[e.jsx(d,{sx:{position:"absolute",inset:0,pointerEvents:"none",backgroundImage:u?"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,backgroundSize:`${32*k.zoom}px ${32*k.zoom}px`,backgroundPosition:`${k.x}px ${k.y}px`}}),e.jsx(d,{sx:{position:"absolute",left:k.x,top:k.y,transform:`scale(${k.zoom})`,transformOrigin:"0 0"},children:t.map(c=>{const M=h[c.id]??{x:c.x,y:c.y},f=c.id===T;return e.jsx(d,{onPointerDown:I=>{I.stopPropagation(),F(c);const B=h[c.id]??{x:c.x,y:c.y},a=N(I.clientX,I.clientY);I.currentTarget.setPointerCapture(I.pointerId);function P(ie){const ae=N(ie.clientX,ie.clientY),V={x:B.x+ae.x-a.x,y:B.y+ae.y-a.y};S(ee=>({...ee,[c.id]:V})),g?.(c.id,V)}function _(){window.removeEventListener("pointermove",P),window.removeEventListener("pointerup",_)}window.addEventListener("pointermove",P),window.addEventListener("pointerup",_)},sx:{position:"absolute",left:M.x,top:M.y,width:c.width??140,height:c.height??80,display:"grid",placeItems:"center",border:f?2:1,borderColor:f?"primary.main":"divider",borderRadius:1,bgcolor:c.color??"background.paper",boxShadow:f?"0 18px 40px rgba(37,99,235,0.24)":"0 12px 28px rgba(15,23,42,0.13)",cursor:"grab",userSelect:"none"},children:i?i(c,f):e.jsx(W,{fontWeight:900,children:c.label??c.id})},c.id)})}),e.jsxs(d,{sx:{position:"absolute",left:12,bottom:12,display:"flex",gap:.75,alignItems:"center",px:1,py:.5,borderRadius:1,bgcolor:"rgba(255,255,255,0.92)",border:1,borderColor:"divider",fontSize:12,fontWeight:800},children:[Math.round(k.zoom*100),"%"]}),b?e.jsx(d,{sx:{position:"absolute",right:12,bottom:12,width:160,height:100,border:1,borderColor:"divider",borderRadius:1,bgcolor:"rgba(255,255,255,0.9)",overflow:"hidden"},children:t.map(c=>{const M=h[c.id]??{x:c.x,y:c.y},f=(M.x-v.minX)/v.width*100,I=(M.y-v.minY)/v.height*100,B=(c.width??140)/v.width*100,a=(c.height??80)/v.height*100;return e.jsx(d,{sx:{position:"absolute",left:`${f}%`,top:`${I}%`,width:`${B}%`,height:`${a}%`,minWidth:6,minHeight:4,borderRadius:.5,bgcolor:c.id===T?"primary.main":c.color??"#94a3b8"}},c.id)})}):null]})}function Wt({children:t,title:n,content:s,media:l,actions:x=[],copyText:u,placement:b="top",pinMode:p=!0,defaultPinned:i=!1,openDelay:m=120,sx:g,...w}){const j=y.useRef(null),L=y.useRef(null),$=y.useRef(null),[o,z]=y.useState(i),[h,S]=y.useState(i),[q,D]=y.useState(!1);function k(){$.current&&window.clearTimeout($.current),L.current&&window.clearTimeout(L.current)}function T(){k(),!o&&($.current=window.setTimeout(()=>z(!0),m))}function v(){k(),z(!0)}function A(){k(),h||(L.current=window.setTimeout(()=>z(!1),100))}function N(){const c=!h;S(c),z(c||o)}async function F(){u&&(await navigator.clipboard?.writeText(u),D(!0),window.setTimeout(()=>D(!1),1100))}return e.jsxs(e.Fragment,{children:[e.jsx(d,{component:"span",ref:j,onMouseEnter:T,onMouseLeave:A,onFocus:T,onBlur:A,onClick:()=>{p&&(z(!0),S(!0))},sx:{display:"inline-flex"},children:t}),e.jsx(tt,{open:o,anchorEl:j.current,placement:b,modifiers:[{name:"offset",options:{offset:[0,10]}},{name:"preventOverflow",options:{padding:12}}],sx:{zIndex:1500},children:e.jsx(et,{onClickAway:()=>{h&&(z(!1),S(!1))},children:e.jsx(d,{onMouseEnter:v,onMouseLeave:A,sx:{width:320,maxWidth:"calc(100vw - 24px)",borderRadius:1,overflow:"hidden",boxShadow:"0 24px 64px rgba(15,23,42,0.28)",bgcolor:"background.paper"},children:e.jsx(d,{...w,sx:[{p:1.25},...Array.isArray(g)?g:g?[g]:[]],children:e.jsxs(O,{spacing:1.25,children:[l?e.jsx(d,{sx:{borderRadius:1,overflow:"hidden",bgcolor:"#e5e7eb"},children:l}):null,e.jsxs(O,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsxs(d,{sx:{minWidth:0,flex:1},children:[n?e.jsx(W,{fontWeight:900,children:n}):null,s?e.jsx(W,{variant:"body2",color:"text.secondary",sx:{mt:n?.25:0},children:s}):null]}),p?e.jsx(ne,{title:h?"Unpin":"Pin",children:e.jsx(ce,{size:"small",onClick:N,children:h?e.jsx(Je,{fontSize:"small"}):e.jsx(Ke,{fontSize:"small"})})}):null]}),u||x.length?e.jsxs(O,{direction:"row",spacing:1,flexWrap:"wrap",children:[u?e.jsx(oe,{size:"small",variant:"outlined",startIcon:e.jsx(Qe,{}),onClick:F,children:q?"Copied":"Copy"}):null,x.map(c=>e.jsx(oe,{size:"small",variant:"contained",startIcon:c.icon,onClick:c.onClick,children:c.label},c.id))]}):null]})})})})})]})}const pe={neutral:"#64748b",good:"#059669",warning:"#d97706",danger:"#dc2626"};function Dt(t,n,s){return Math.min(Math.max(t,n),s)}function Et(t){return t.color??pe[t.status??"neutral"]}function Xt(t){return typeof t.delta=="number"?t.delta:typeof t.value=="number"&&typeof t.previousValue=="number"&&t.previousValue!==0?(t.value-t.previousValue)/Math.abs(t.previousValue)*100:null}function qt(t){return t.formatter?t.formatter(t.value):typeof t.value=="number"?new Intl.NumberFormat("en",{maximumFractionDigits:1}).format(t.value):t.value}function Ft(t,n,s){if(t.length<2)return"";const l=Math.min(...t),u=Math.max(...t)-l||1;return t.map((b,p)=>{const i=p/(t.length-1)*n,m=s-(b-l)/u*s;return`${p===0?"M":"L"} ${i.toFixed(2)} ${m.toFixed(2)}`}).join(" ")}function Yt({values:t,color:n}){const x=Ft(t,180,54),u=x?`${x} L 180 54 L 0 54 Z`:"";return e.jsxs(d,{component:"svg",viewBox:"0 0 180 54",sx:{display:"block",width:"100%",height:54},children:[e.jsx(d,{component:"path",d:u,sx:{fill:E.alpha(n,.14)}}),e.jsx(d,{component:"path",d:x,sx:{fill:"none",stroke:n,strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round"}}),t.length?e.jsx(d,{component:"circle",cx:180,cy:54-(t[t.length-1]-Math.min(...t))/(Math.max(...t)-Math.min(...t)||1)*54,r:4,sx:{fill:n}}):null]})}function Nt({metrics:t,title:n,subtitle:s,columns:l=3,density:x="comfortable",showSparklines:u=!0,showProgress:b=!0,sx:p,...i}){const m=x==="compact";return e.jsxs(d,{...i,sx:[{width:"100%"},...Array.isArray(p)?p:p?[p]:[]],children:[n||s?e.jsxs(d,{sx:{mb:2},children:[n?e.jsx(W,{variant:"h6",fontWeight:900,children:n}):null,s?e.jsx(W,{variant:"body2",color:"text.secondary",children:s}):null]}):null,e.jsx(d,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(2, minmax(0, 1fr))",lg:`repeat(${l}, minmax(0, 1fr))`},gap:m?1.25:2},children:t.map(g=>{const w=Et(g),j=Xt(g),L=(j??0)>=0;return e.jsx(je,{variant:"outlined",sx:{p:m?1.5:2,borderRadius:1,overflow:"hidden",position:"relative",borderColor:E.alpha(w,.32),background:`linear-gradient(180deg, ${E.alpha(w,.08)}, rgba(255,255,255,0) 42%)`},children:e.jsxs(O,{spacing:m?1:1.5,children:[e.jsxs(O,{direction:"row",spacing:1,alignItems:"flex-start",justifyContent:"space-between",children:[e.jsxs(d,{sx:{minWidth:0},children:[e.jsx(W,{variant:"caption",color:"text.secondary",fontWeight:850,sx:{textTransform:"uppercase"},children:g.label}),e.jsxs(O,{direction:"row",spacing:.75,alignItems:"baseline",sx:{mt:.5},children:[e.jsx(W,{variant:m?"h5":"h4",fontWeight:950,sx:{lineHeight:1},children:qt(g)}),g.unit?e.jsx(W,{variant:"body2",color:"text.secondary",fontWeight:800,children:g.unit}):null]})]}),g.icon?e.jsx(d,{sx:{color:w,display:"grid",placeItems:"center",mt:.25},children:g.icon}):null]}),e.jsxs(O,{direction:"row",spacing:1,alignItems:"center",justifyContent:"space-between",children:[j!==null?e.jsx(be,{size:"small",label:`${L?"+":""}${j.toFixed(1)}%`,sx:{color:L?pe.good:pe.danger,bgcolor:E.alpha(L?pe.good:pe.danger,.12),fontWeight:850}}):e.jsx(d,{}),g.helper?e.jsx(W,{variant:"caption",color:"text.secondary",textAlign:"right",children:g.helper}):null]}),u&&g.trend?.length?e.jsx(Yt,{values:g.trend,color:w}):null,b&&typeof g.progress=="number"?e.jsx(rt,{variant:"determinate",value:Dt(g.progress,0,100),sx:{height:8,borderRadius:999,bgcolor:E.alpha(w,.14),"& .MuiLinearProgress-bar":{bgcolor:w,borderRadius:999}}}):null]})},g.id)})})]})}exports.BeforeAfterSlider=Ct;exports.CodeViewer=dt;exports.ColorPicker=zt;exports.CommandPalette=ft;exports.ComponentExample=nt;exports.DataCardGrid=Nt;exports.DockBar=xt;exports.DraggableBox=ut;exports.FileDropZone=At;exports.FloatingToolbar=wt;exports.GlassBox=pt;exports.InfiniteCanvas=Bt;exports.InspectorPanel=Rt;exports.MagneticCard=jt;exports.NodeCanvas=$t;exports.ResizableFrame=St;exports.SmartTooltip=Wt;exports.SplitPane=mt;exports.SpotlightPanel=vt;exports.TimelineScrubber=Tt;
14
+ linear-gradient(105deg, ${N.alpha(l,.34)} 0%, ${N.alpha(l,.08)} 18%, ${N.alpha(l,0)} 34%),
15
+ radial-gradient(circle at 18% 18%, ${N.alpha(l,.38)} 0 3%, ${N.alpha(l,0)} 18%)
16
+ `,pointerEvents:"none"},"& .GlassBox-liquidLens":{position:"absolute",inset:0,zIndex:1,pointerEvents:"none",backgroundImage:"var(--glassbox-refraction-background, none)",backgroundSize:"var(--glassbox-refraction-background-size, cover)",backgroundPosition:"var(--glassbox-refraction-background-position, center)",backgroundRepeat:"no-repeat",filter:`url(#${y}) saturate(150%) contrast(112%)`,opacity:M?.72:0,transition:"opacity 120ms ease-out",maskImage:`linear-gradient(to bottom, transparent 0, transparent calc(${I} + 10px), black calc(${I} + 28px), black 100%)`,WebkitMaskImage:`linear-gradient(to bottom, transparent 0, transparent calc(${I} + 10px), black calc(${I} + 28px), black 100%)`},"& .GlassBox-refractionOffset":{position:"absolute",inset:0,zIndex:2,pointerEvents:"none",opacity:M?.16+x*.16:0,backdropFilter:"blur(3px) saturate(190%)",WebkitBackdropFilter:"blur(3px) saturate(190%)",background:`
17
+ linear-gradient(180deg, ${N.alpha(l,.2)} 0, ${N.alpha(l,0)} 20%),
18
+ linear-gradient(90deg, ${N.alpha(l,0)} 0 18%, ${N.alpha(l,.14)} 26%, ${N.alpha(l,0)} 34% 58%, ${N.alpha(l,.1)} 68%, ${N.alpha(l,0)} 76% 100%)
19
+ `,transition:"opacity 120ms ease-out",maskImage:`linear-gradient(to bottom, transparent 0, transparent ${I}, black calc(${I} + 18px), black 100%)`,WebkitMaskImage:`linear-gradient(to bottom, transparent 0, transparent ${I}, black calc(${I} + 18px), black 100%)`},"& .GlassBox-content":{position:"relative",zIndex:3,textShadow:`0 1px 10px ${N.alpha("#00121d",.36)}`},"& > *":{position:"relative",zIndex:3}},...Array.isArray(g)?g:g?[g]:[]],children:[e.jsx(u,{component:"svg","aria-hidden":"true",focusable:"false",sx:{position:"absolute",width:0,height:0,overflow:"hidden"},children:e.jsxs("filter",{id:y,children:[e.jsx("feTurbulence",{type:"fractalNoise",baseFrequency:`${B} ${B*2.6}`,numOctaves:"2",seed:i,result:"liquidNoise"}),e.jsx("feDisplacementMap",{in:"SourceGraphic",in2:"liquidNoise",scale:f,xChannelSelector:"R",yChannelSelector:"G"})]})}),e.jsx(u,{className:"GlassBox-liquidLens"}),e.jsx(u,{className:"GlassBox-refractionOffset"}),e.jsx(u,{className:"GlassBox-content",children:j})]})}function $t(t,n,a){return Math.min(Math.max(t,n),a)}function St({items:t,iconSize:n=52,magnification:a=1.7,gap:l=10,tooltip:h=!0,sx:c,...j}){const[g,d]=w.useState(null);return e.jsx(u,{...j,role:"toolbar",sx:[{display:"inline-flex",alignItems:"flex-end",gap:`${l}px`,p:1,border:1,borderColor:"rgba(255,255,255,0.5)",borderRadius:3,bgcolor:"rgba(255,255,255,0.34)",boxShadow:"0 18px 44px rgba(15, 23, 42, 0.22)",backdropFilter:"blur(18px) saturate(150%)",WebkitBackdropFilter:"blur(18px) saturate(150%)"},...Array.isArray(c)?c:c?[c]:[]],onMouseLeave:()=>d(null),children:t.map((C,y)=>{const k=g===null?4:Math.abs(y-g),x=$t(1-k/3,0,1),L=1+(a-1)*x,I=-18*x,i=e.jsx(u,{component:"button",type:"button","aria-label":C.label,onClick:C.onClick,onMouseEnter:()=>d(y),sx:{width:n,height:n,display:"grid",placeItems:"center",flex:"0 0 auto",border:0,borderRadius:2,p:0,color:"inherit",bgcolor:"rgba(255,255,255,0.72)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.85), 0 8px 18px rgba(15, 23, 42, 0.18)",cursor:"pointer",transform:`translateY(${I}px) scale(${L})`,transformOrigin:"bottom center",transition:"transform 130ms ease-out, background-color 130ms ease-out","&:focus-visible":{outline:"2px solid #2563eb",outlineOffset:3},"&:active":{bgcolor:"rgba(255,255,255,0.9)"}},children:e.jsx(q,{component:"span","aria-hidden":"true",sx:{display:"grid",placeItems:"center",fontSize:Math.round(n*.52),lineHeight:1},children:C.icon})},C.id);return h?e.jsx(ce,{title:C.label,placement:"top",arrow:!0,children:i},C.id):i})})}function Ve(t){return t.toLowerCase().trim()}function It(t){return Ve([t.label,t.description,t.group,t.parentId,...t.keywords??[]].filter(Boolean).join(" "))}function Le(t){return Array.from(new Set(t.map(n=>n.group).filter(Boolean)))}function Dt({items:t,variant:n="list",selectedId:a,placeholder:l="Search",emptyText:h="No items found",maxResults:c,showSearch:j=!0,dense:g=!1,expandedGroups:d,defaultExpandedGroups:C,onExpandedGroupsChange:y,onSelect:k,sx:x,...L}){const I=C??Le(t),[i,B]=w.useState(""),[f,M]=w.useState(0),[O,F]=w.useState(I),D=Ve(i),R=d??O,$=w.useMemo(()=>{const o=D?t.filter(W=>It(W).includes(D)):t;return typeof c=="number"?o.slice(0,c):o},[t,c,D]),T=Le($),V=$;function H(o){o.onSelect?.(),k?.(o),B(""),M(0)}function p(o){d===void 0&&F(o),y?.(o)}function P(o){p(R.includes(o)?R.filter(W=>W!==o):[...R,o])}function m(o,W=0){const J=o.id===a;return e.jsxs(Me,{selected:J,dense:g,onClick:()=>H(o),sx:{borderRadius:1,pl:1.25+W*2,"&.Mui-selected":{bgcolor:"action.selected",color:"primary.main"},"&.Mui-selected:hover, &:hover":{bgcolor:"action.hover"}},children:[o.icon?e.jsx(_e,{sx:{minWidth:34,color:"inherit"},children:o.icon}):null,e.jsx(Re,{primary:o.label,secondary:o.description,primaryTypographyProps:{fontWeight:J?850:700},secondaryTypographyProps:{color:"text.secondary"}})]},o.id)}function z(){return $.length?T.length?T.map(o=>e.jsxs(u,{children:[e.jsx(q,{variant:"caption",fontWeight:900,color:"text.secondary",sx:{display:"block",px:1.25,pt:1.5,pb:.5},children:o}),$.filter(W=>W.group===o).map(W=>m(W))]},o)):$.map(o=>m(o)):e.jsx(u,{sx:{px:2,py:4,textAlign:"center",color:"text.secondary"},children:h})}function X(){return $.length?T.length?T.map(o=>{const W=D||R.includes(o);return e.jsxs(u,{children:[e.jsxs(Me,{dense:g,onClick:()=>P(o),sx:{borderRadius:1,px:1.25},children:[e.jsx(q,{component:"span","aria-hidden":"true",sx:{mr:1,width:16,color:"text.secondary"},children:W?"▾":"▸"}),e.jsx(Re,{primary:o,primaryTypographyProps:{fontWeight:900}})]}),e.jsx(Ge,{in:!!W,timeout:"auto",unmountOnExit:!0,children:$.filter(J=>J.group===o).map(J=>m(J,1))})]},o)}):$.map(o=>m(o)):e.jsx(u,{sx:{px:2,py:4,textAlign:"center",color:"text.secondary"},children:h})}return e.jsxs(u,{...L,sx:[{display:"flex",flexDirection:"column",gap:1,minWidth:0},...Array.isArray(x)?x:x?[x]:[]],children:[j?e.jsx(u,{sx:{px:1.25,py:.75,border:1,borderColor:"divider",borderRadius:1,bgcolor:"background.paper"},children:e.jsx(Ue,{fullWidth:!0,value:i,placeholder:l,onChange:o=>{B(o.target.value),M(0)},onKeyDown:o=>{o.key==="ArrowDown"&&(o.preventDefault(),M(W=>Math.min(W+1,V.length-1))),o.key==="ArrowUp"&&(o.preventDefault(),M(W=>Math.max(W-1,0))),o.key==="Enter"&&V[f]&&(o.preventDefault(),H(V[f]))},sx:{fontSize:14}})}):null,e.jsx(Ze,{disablePadding:!0,dense:g,sx:{overflow:"auto"},children:n==="tree"?X():z()})]})}function Be(t,n,a){return Math.min(Math.max(t,n),a)}function Mt(t){if(!t||typeof window>"u")return null;const n=window.localStorage.getItem(t),a=n===null?Number.NaN:Number(n);return Number.isFinite(a)?a:null}function Rt({first:t,second:n,orientation:a="horizontal",initialSize:l=50,size:h,defaultSize:c,minSize:j=20,maxSize:g=80,dividerSize:d=8,snapPoints:C=[],snapThreshold:y=4,resetSize:k=c??l,collapsed:x,defaultCollapsed:L=null,collapsedSize:I=0,persistKey:i,keyboardStep:B=5,onSizeChange:f,onCollapsedChange:M,onDraggingChange:O,dividerLabel:F="Resize panels",sx:D,...R}){const $=w.useRef(null),[T,V]=w.useState(()=>Mt(i)??c??l),[H,p]=w.useState(L),[P,m]=w.useState(!1),z=a==="horizontal",o=Be(h??T,j,g),W=x??H,J=W==="first"?I:W==="second"?100-I:o,ue=W==="first"&&I<=0,ee=W==="second"&&I<=0;w.useEffect(()=>{i&&window.localStorage.setItem(i,String(o))},[i,o]),w.useEffect(()=>{O?.(P)},[P,O]);function G(A){const se=C.reduce((ne,fe)=>{const ge=Math.abs(ne-A);return Math.abs(fe-A)<ge?fe:ne},A),re=Math.abs(se-A)<=y,K=Be(re?se:A,j,g);h===void 0&&V(K),f?.(K),le(null)}function ae(A,se){const re=$.current;if(!re)return;const K=re.getBoundingClientRect(),ne=z?(A-K.left)/K.width*100:(se-K.top)/K.height*100;G(ne)}function _(A){G(o+A)}function te(){G(k)}function pe(A){le(W===A?null:A)}function le(A){x===void 0&&p(A),M?.(A)}return e.jsxs(u,{...R,ref:$,sx:[{display:"grid",gridTemplateColumns:z?`${J}% ${d}px 1fr`:"1fr",gridTemplateRows:z?"1fr":`${J}% ${d}px 1fr`,minHeight:280,overflow:"hidden",userSelect:P?"none":void 0},...Array.isArray(D)?D:D?[D]:[]],onPointerMove:A=>{P&&ae(A.clientX,A.clientY)},onPointerUp:()=>{m(!1)},onPointerCancel:()=>m(!1),children:[e.jsx(u,{sx:{minWidth:0,minHeight:0,overflow:"auto",display:ue?"none":void 0},children:t}),e.jsx(u,{role:"separator","aria-label":F,"aria-orientation":z?"vertical":"horizontal","aria-valuemin":j,"aria-valuemax":g,"aria-valuenow":Math.round(o),tabIndex:0,onPointerDown:A=>{m(!0),A.currentTarget.setPointerCapture(A.pointerId),ae(A.clientX,A.clientY)},onPointerUp:A=>{m(!1),A.currentTarget.releasePointerCapture(A.pointerId)},onDoubleClick:te,onKeyDown:A=>{A.key==="Enter"&&(te(),A.preventDefault()),A.key==="Home"&&(pe("first"),A.preventDefault()),A.key==="End"&&(pe("second"),A.preventDefault()),(A.key==="ArrowLeft"||A.key==="ArrowUp")&&(_(-B),A.preventDefault()),(A.key==="ArrowRight"||A.key==="ArrowDown")&&(_(B),A.preventDefault())},sx:{position:"relative",bgcolor:P?"primary.main":"divider",cursor:z?"col-resize":"row-resize",touchAction:"none",transition:"background-color 120ms ease","&:hover":{bgcolor:"primary.main"},"&:focus-visible":{outline:"2px solid",outlineColor:"primary.main",outlineOffset:-2},"&::after":{content:'""',position:"absolute",inset:z?"30% -4px":"-4px 30%",borderRadius:999,bgcolor:P?"primary.contrastText":"text.disabled",opacity:.55}}}),e.jsx(u,{sx:{minWidth:0,minHeight:0,overflow:"auto",display:ee?"none":void 0},children:n})]})}function zt(t,n){return n??t?.getBoundingClientRect()??null}function At({open:t,children:n,anchorEl:a,anchorRect:l,containerRef:h,placement:c="top",offset:j=8,boundaryPadding:g=8,autoUpdate:d=!0,arrow:C=!0,sx:y,...k}){const x=w.useRef(null),[L,I]=w.useState({left:-9999,top:-9999}),i=w.useCallback(()=>{if(!t)return;const B=zt(a,l),f=x.current;if(!B||!f)return;const M=h?.current?.getBoundingClientRect(),O=M?.left??0,F=M?.top??0,D=M?.width??window.innerWidth,R=M?.height??window.innerHeight,$=f.offsetWidth/2,T=f.offsetHeight,V=B.left-O+B.width/2,H=c==="top"?B.top-F-j:B.bottom-F+j,p=Math.min(Math.max(V,$+g),D-$-g),P=c==="top"?Math.max(H,T+g):Math.min(H,R-T-g);I({left:p,top:P})},[a,l,g,h,j,t,c]);return w.useLayoutEffect(()=>{i()},[i]),w.useEffect(()=>{if(!(!t||!d))return window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0)}},[d,t,i]),t?e.jsx(u,{...k,ref:x,role:"toolbar",sx:[{position:h?"absolute":"fixed",left:L.left,top:L.top,zIndex:1300,display:"inline-flex",alignItems:"center",gap:.5,p:.5,borderRadius:1.5,bgcolor:"rgba(15,23,42,0.96)",color:"#e5e7eb",boxShadow:"0 16px 40px rgba(15, 23, 42, 0.34)",transform:c==="top"?"translate(-50%, -100%)":"translate(-50%, 0)",backdropFilter:"blur(12px)","&::after":C?{content:'""',position:"absolute",left:"50%",width:10,height:10,bgcolor:"rgba(15,23,42,0.96)",transform:"translateX(-50%) rotate(45deg)",bottom:c==="top"?-5:void 0,top:c==="bottom"?-5:void 0}:void 0},...Array.isArray(y)?y:y?[y]:[]],children:n}):null}function Pt({strength:t=18,tilt:n=10,lift:a=10,glare:l=!0,perspective:h=900,sx:c,children:j,...g}){const[d,C]=w.useState({x:0,y:0,rotateX:0,rotateY:0,glareX:50,glareY:50,active:!1});return e.jsx(u,{...g,onMouseMove:y=>{const k=y.currentTarget.getBoundingClientRect(),x=(y.clientX-k.left)/k.width,L=(y.clientY-k.top)/k.height,I=(x-.5)*t,i=(L-.5)*t;C({x:I,y:i,rotateX:(.5-L)*n,rotateY:(x-.5)*n,glareX:x*100,glareY:L*100,active:!0})},onMouseLeave:()=>C({x:0,y:0,rotateX:0,rotateY:0,glareX:50,glareY:50,active:!1}),sx:[{position:"relative",overflow:"hidden",transform:`
20
+ perspective(${h}px)
21
+ translate3d(${d.x}px, ${d.y}px, ${d.active?-a:0}px)
22
+ rotateX(${d.rotateX}deg)
23
+ rotateY(${d.rotateY}deg)
24
+ `,transformStyle:"preserve-3d",transition:d.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",willChange:"transform",boxShadow:d.active?"0 28px 70px rgba(15, 23, 42, 0.24)":"0 14px 34px rgba(15, 23, 42, 0.12)","&::before":l?{content:'""',position:"absolute",inset:0,pointerEvents:"none",opacity:d.active?.78:0,transition:"opacity 160ms ease",background:`radial-gradient(circle at ${d.glareX}% ${d.glareY}%, rgba(255,255,255,0.55), rgba(255,255,255,0.16) 22%, transparent 48%)`,mixBlendMode:"screen"}:void 0,"& > *":{position:"relative",zIndex:1,transform:d.active?"translateZ(24px)":"translateZ(0)",transition:"transform 180ms ease"}},...Array.isArray(c)?c:c?[c]:[]],children:j})}function Tt({radius:t=160,dim:n=.72,sx:a,children:l,...h}){const[c,j]=w.useState({x:50,y:50});return e.jsx(u,{...h,onMouseMove:g=>{const d=g.currentTarget.getBoundingClientRect();j({x:(g.clientX-d.left)/d.width*100,y:(g.clientY-d.top)/d.height*100})},sx:[{position:"relative",overflow:"hidden","&::after":{content:'""',position:"absolute",inset:0,pointerEvents:"none",background:`radial-gradient(circle ${t}px at ${c.x}% ${c.y}%, transparent 0, transparent 45%, rgba(0,0,0,${n}) 100%)`}},...Array.isArray(a)?a:a?[a]:[]],children:l})}function We(t,n){return Math.round(t/n)*n}function Lt(t,n,a,l,h){const c=t.x+a/2,j=t.y+l/2,g=n.x+a/2,d=n.y+l/2,C=(c+g)/2;if(h==="ellipse"){const y=Math.max(Math.abs(g-c)/2,24),k=Math.max(Math.abs(d-j)/2,24);return`M ${c} ${j} A ${y} ${k} 0 0 1 ${g} ${d}`}return h==="curved"?`M ${c} ${j} C ${C} ${j}, ${C} ${d}, ${g} ${d}`:h==="step"?`M ${c} ${j} L ${C} ${j} L ${C} ${d} L ${g} ${d}`:`M ${c} ${j} L ${g} ${d}`}function Bt({nodes:t,connections:n=[],nodeWidth:a=132,nodeHeight:l=52,mode:h="edit",snapToGrid:c=!1,gridSize:j=24,showGrid:g=!1,selectedNodeId:d,connectionStyle:C="line",editableTools:y=!1,linkTypes:k=["line","curved","step","ellipse"],renderNode:x,onNodesChange:L,onConnectionsChange:I,onNodeMove:i,onNodeSelect:B,sx:f,...M}){const[O,F]=w.useState(t),[D,R]=w.useState(n),$=y?O:t,T=y?D:n,[V,H]=w.useState(Object.fromEntries($.map(r=>[r.id,{x:r.x,y:r.y}]))),[p,P]=w.useState(d??null),[m,z]=w.useState(!1),[X,o]=w.useState(""),[W,J]=w.useState(k[0]??"line"),[ue,ee]=w.useState(""),[G,ae]=w.useState(null),_=d??p,te=$.find(r=>r.id===_)??null,pe=T.map((r,v)=>({connection:r,index:v})).filter(({connection:r})=>r.from===_||r.to===_),le=t.map(r=>`${r.id}:${r.label}:${r.x}:${r.y}:${r.color??""}`).join("|"),A=n.map(r=>`${r.from}:${r.to}:${r.type??""}:${r.label??""}:${r.color??""}`).join("|");w.useEffect(()=>{y||F(t),H(r=>({...Object.fromEntries(t.map(v=>[v.id,r[v.id]??{x:v.x,y:v.y}]))}))},[y,le]),w.useEffect(()=>{y||R(n)},[A,y]);function se(r){F(r),L?.(r)}function re(r){R(r),I?.(r)}function K(r,v){const E=c?{x:We(v.x,j),y:We(v.y,j)}:v;H(S=>({...S,[r]:E})),y&&se($.map(S=>S.id===r?{...S,...E}:S)),i?.(r,E)}function ne(){const r=$.length+1,v={id:`node-${Date.now()}`,label:`Box ${r}`,x:48+r*18,y:48+r*18,color:"#ffffff"};se([...$,v]),H(E=>({...E,[v.id]:{x:v.x,y:v.y}})),P(v.id)}function fe(){_&&(se($.filter(r=>r.id!==_)),re(T.filter(r=>r.from!==_&&r.to!==_)),P(null),z(!1))}function ge(r){_&&se($.map(v=>v.id===_?{...v,...r}:v))}function ve(){if(!_||!X||_===X)return;const r={from:_,to:X,type:W,label:ue,color:W==="ellipse"?"#db2777":W==="step"?"#059669":"#2563eb"},v=[...T.filter(E=>!(E.from===_&&E.to===X)),r];re(v),o(""),ee(""),ae(v.indexOf(r))}function s(r,v){const E=T[r];if(!E)return;const S={...E,...v},Q=T.map((U,he)=>he===r?S:U).filter((U,he)=>he===r||U.from!==S.from||U.to!==S.to);re(Q)}function b(r){re(T.filter((v,E)=>E!==r)),ae(null)}return e.jsxs(u,{...M,sx:[{position:"relative",minHeight:360,overflow:"hidden",bgcolor:"#f8fafc",backgroundImage:g?"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,backgroundSize:g?`${j}px ${j}px`:void 0},...Array.isArray(f)?f:f?[f]:[]],children:[e.jsx(u,{component:"svg",sx:{position:"absolute",inset:0,width:"100%",height:"100%"},children:T.map(r=>{const v=V[r.from],E=V[r.to];if(!v||!E)return null;const S=Lt(v,E,a,l,r.type??C),Q=(v.x+E.x+a)/2,U=(v.y+E.y+l)/2;return e.jsxs("g",{children:[e.jsx("path",{d:S,fill:"none",stroke:r.color??"#94a3b8",strokeWidth:"2.5"}),r.label?e.jsx("text",{x:Q,y:U-8,textAnchor:"middle",fill:r.color??"#64748b",fontSize:"11",fontWeight:"700",children:r.label}):null]},`${r.from}-${r.to}-${r.type??r.label??"link"}`)})}),$.map(r=>{const v=V[r.id],E=r.id===_;return e.jsx(u,{role:"button",tabIndex:0,sx:{position:"absolute",left:v.x,top:v.y,width:a,height:l,display:"grid",placeItems:"center",border:E?2:1,borderColor:E?"primary.main":"divider",borderRadius:1,bgcolor:r.color??"background.paper",cursor:h==="edit"?"grab":"pointer",userSelect:"none",boxShadow:E?"0 18px 34px rgba(37,99,235,0.22)":"0 12px 28px rgba(15,23,42,0.12)",touchAction:"none"},onPointerDown:S=>{if(P(r.id),ae(null),y&&z(!0),B?.(r),h==="readonly")return;const Q=S.clientX,U=S.clientY,he=V[r.id];S.currentTarget.setPointerCapture(S.pointerId);function be(De){K(r.id,{x:he.x+De.clientX-Q,y:he.y+De.clientY-U})}function Ie(){window.removeEventListener("pointermove",be),window.removeEventListener("pointerup",Ie)}window.addEventListener("pointermove",be),window.addEventListener("pointerup",Ie)},onKeyDown:S=>{if(h==="readonly")return;const Q=c?j:8,U=V[r.id];S.key==="ArrowLeft"&&(K(r.id,{x:U.x-Q,y:U.y}),S.preventDefault()),S.key==="ArrowRight"&&(K(r.id,{x:U.x+Q,y:U.y}),S.preventDefault()),S.key==="ArrowUp"&&(K(r.id,{x:U.x,y:U.y-Q}),S.preventDefault()),S.key==="ArrowDown"&&(K(r.id,{x:U.x,y:U.y+Q}),S.preventDefault())},children:x?x(r,E):e.jsx(q,{fontWeight:800,children:r.label})},r.id)}),y&&te&&m?e.jsx(u,{sx:{position:"absolute",right:12,top:12,zIndex:20,width:340,maxWidth:"calc(100% - 24px)",maxHeight:"calc(100% - 24px)",overflow:"auto",border:1,borderColor:"divider",borderRadius:1,bgcolor:"background.paper",boxShadow:"0 20px 48px rgba(15,23,42,0.22)"},children:e.jsxs(Y,{spacing:1.25,sx:{p:1.5},children:[e.jsxs(Y,{direction:"row",spacing:.75,alignItems:"center",children:[e.jsx(q,{variant:"subtitle2",fontWeight:900,sx:{flex:1},children:"Box editor"}),e.jsx(ce,{title:"Add box",children:e.jsx(de,{size:"small",color:"primary",onClick:ne,children:e.jsx(Ke,{fontSize:"small"})})}),e.jsx(ce,{title:"Remove box",children:e.jsx("span",{children:e.jsx(de,{size:"small",color:"error",onClick:fe,disabled:!te,children:e.jsx(Ne,{fontSize:"small"})})})}),e.jsx(ce,{title:"Close editor",children:e.jsx(de,{size:"small",onClick:()=>z(!1),children:e.jsx(Je,{fontSize:"small"})})})]}),e.jsxs(u,{sx:{display:"grid",gridTemplateColumns:"1fr 96px",gap:1},children:[e.jsx(Z,{size:"small",label:"Label",value:te?.label??"",disabled:!te,onChange:r=>ge({label:r.target.value})}),e.jsx(Z,{size:"small",label:"Color",type:"color",value:te?.color??"#ffffff",disabled:!te,onChange:r=>ge({color:r.target.value})})]}),e.jsxs(u,{sx:{display:"grid",gridTemplateColumns:"1fr",gap:1.25},children:[e.jsxs(Y,{spacing:1,children:[e.jsx(q,{variant:"caption",fontWeight:900,color:"text.secondary",children:"Links"}),e.jsxs(u,{sx:{display:"grid",gridTemplateColumns:"1fr 32px",gap:.5,alignItems:"center"},children:[e.jsxs(Z,{select:!0,size:"small",label:"To",value:X,disabled:!te,onChange:r=>o(r.target.value),children:[e.jsx(xe,{value:"",children:"Pick target"}),$.filter(r=>r.id!==_).map(r=>e.jsx(xe,{value:r.id,children:r.label},r.id))]}),e.jsx(ce,{title:`Add link from ${te?.label??"box"}`,children:e.jsx("span",{children:e.jsx(de,{size:"small",color:"primary",disabled:!te||!X,onClick:ve,sx:{width:32,height:32,border:1,borderColor:"divider",borderRadius:1},children:e.jsx(Qe,{fontSize:"small"})})})})]}),pe.length?pe.map(({connection:r,index:v})=>{const E=$.find(U=>U.id===r.from),S=$.find(U=>U.id===r.to),Q=G===v;return e.jsxs(u,{sx:{width:"100%",display:"grid",gridTemplateColumns:"1fr 32px",gap:.5,alignItems:"center"},children:[e.jsx(u,{component:"button",onClick:()=>ae(v),sx:{px:1,py:.75,minWidth:0,border:1,borderColor:Q?"primary.main":"divider",borderRadius:1,bgcolor:Q?"primary.main":"background.paper",color:Q?"primary.contrastText":"text.primary",cursor:"pointer",font:"inherit",textAlign:"left"},children:(E?.label??r.from)+" -> "+(S?.label??r.to)}),e.jsx(ce,{title:"Remove link",children:e.jsx(de,{size:"small",color:"error",onClick:()=>b(v),sx:{width:32,height:32},children:e.jsx(et,{fontSize:"small"})})})]},`${r.from}-${r.to}-${v}`)}):e.jsx(q,{variant:"body2",color:"text.secondary",children:"No linked boxes."})]}),e.jsxs(Y,{spacing:1,children:[e.jsx(q,{variant:"caption",fontWeight:900,color:"text.secondary",children:"Link details"}),G!==null&&T[G]?e.jsxs(e.Fragment,{children:[e.jsx(Z,{select:!0,size:"small",label:"From",value:T[G].from,onChange:r=>s(G,{from:r.target.value}),children:$.filter(r=>r.id!==T[G].to).map(r=>e.jsx(xe,{value:r.id,children:r.label},r.id))}),e.jsxs(u,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsx(Z,{select:!0,size:"small",label:"To",value:T[G].to,onChange:r=>s(G,{to:r.target.value}),children:$.filter(r=>r.id!==T[G].from).map(r=>e.jsx(xe,{value:r.id,children:r.label},r.id))}),e.jsx(Z,{select:!0,size:"small",label:"Shape",value:T[G].type??C,onChange:r=>s(G,{type:r.target.value}),children:k.map(r=>e.jsx(xe,{value:r,children:r},r))})]}),e.jsx(Z,{size:"small",label:"Label",value:T[G].label??"",onChange:r=>s(G,{label:r.target.value})})]}):e.jsx(q,{variant:"body2",color:"text.secondary",children:"Pick a link."})]})]})]})}):null]})}function Wt({before:t,after:n,initialPosition:a=50,sx:l,...h}){const[c,j]=w.useState(a);return e.jsxs(u,{...h,sx:[{position:"relative",overflow:"hidden",minHeight:280},...Array.isArray(l)?l:l?[l]:[]],onPointerMove:g=>{if(g.buttons!==1)return;const d=g.currentTarget.getBoundingClientRect();j((g.clientX-d.left)/d.width*100)},children:[e.jsx(u,{sx:{position:"absolute",inset:0},children:n}),e.jsx(u,{sx:{position:"absolute",inset:0,width:`${c}%`,overflow:"hidden"},children:t}),e.jsx(u,{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"}})]})}function Et({initialWidth:t=320,initialHeight:n=220,minWidth:a=160,minHeight:l=120,sx:h,children:c,...j}){const[g,d]=w.useState({width:t,height:n});return e.jsxs(u,{...j,sx:[{position:"relative",width:g.width,height:g.height,overflow:"auto",border:1,borderColor:"divider",borderRadius:1,bgcolor:"background.paper"},...Array.isArray(h)?h:h?[h]:[]],children:[c,e.jsx(u,{sx:{position:"absolute",right:4,bottom:4,width:28,height:28,display:"grid",placeItems:"center",cursor:"nwse-resize",color:"text.secondary",bgcolor:"background.paper",border:1,borderColor:"divider",borderRadius:1,boxShadow:"0 6px 16px rgba(15,23,42,0.14)"},onPointerDown:C=>{const y=C.clientX,k=C.clientY,x=g;function L(i){d({width:Math.max(a,x.width+i.clientX-y),height:Math.max(l,x.height+i.clientY-k)})}function I(){window.removeEventListener("pointermove",L),window.removeEventListener("pointerup",I)}window.addEventListener("pointermove",L),window.addEventListener("pointerup",I)},children:e.jsx(Oe,{fontSize:"small"})})]})}function qt(t){return t.type==="boolean"?t.value?"On":"Off":`${t.value}${t.unit?` ${t.unit}`:""}`}function Xt(t){return t.reduce((n,a)=>{const l=a.group??"Settings";return{...n,[l]:[...n[l]??[],a]}},{})}function Ft({fields:t,onChange:n,title:a="Inspector",description:l,density:h="comfortable",showValueSummary:c=!0,showReset:j=!0,sx:g}){const d=Xt(t),C=h==="compact"?1.25:2,y=h==="compact"?"small":"medium";function k(x){x.defaultValue!==void 0&&n?.(x.id,x.defaultValue)}return e.jsx(we,{variant:"outlined",sx:[{p:h==="compact"?1.5:2,borderRadius:1},...Array.isArray(g)?g:[g]],children:e.jsxs(Y,{spacing:C,children:[e.jsxs(u,{children:[e.jsxs(Y,{direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,children:[e.jsx(q,{variant:"subtitle1",fontWeight:850,children:a}),c?e.jsx(me,{size:"small",label:`${t.length} fields`}):null]}),l?e.jsx(q,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:l}):null]}),Object.entries(d).map(([x,L],I)=>e.jsxs(Y,{spacing:C,children:[I>0?e.jsx(rt,{}):null,e.jsx(q,{variant:"caption",color:"text.secondary",fontWeight:850,sx:{textTransform:"uppercase"},children:x}),L.map(i=>{const B=j&&i.defaultValue!==void 0&&i.defaultValue!==i.value;return i.type==="boolean"?e.jsxs(u,{children:[e.jsxs(Y,{direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,children:[e.jsx(nt,{control:e.jsx(tt,{checked:!!i.value,disabled:i.disabled,onChange:f=>n?.(i.id,f.target.checked)}),label:i.label}),B?e.jsx(oe,{size:"small",onClick:()=>k(i),children:"Reset"}):null]}),i.description?e.jsx(q,{variant:"caption",color:"text.secondary",children:i.description}):null]},i.id):i.type==="number"?e.jsxs(Y,{spacing:1,children:[e.jsxs(Y,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsx(Z,{fullWidth:!0,size:y,label:i.label,type:"number",value:i.value,helperText:i.description,disabled:i.disabled,inputProps:{min:i.min,max:i.max,step:i.step},onChange:f=>n?.(i.id,Number(f.target.value))}),i.unit?e.jsx(me,{label:i.unit,size:"small",sx:{mt:1}}):null,B?e.jsx(oe,{size:"small",onClick:()=>k(i),sx:{mt:.5},children:"Reset"}):null]}),i.min!==void 0||i.max!==void 0?e.jsx(He,{value:Number(i.value),min:i.min??0,max:i.max??100,step:i.step??1,disabled:i.disabled,valueLabelDisplay:"auto",onChange:(f,M)=>n?.(i.id,Array.isArray(M)?M[0]:M)}):null]},i.id):i.type==="select"?e.jsxs(Y,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsx(Z,{select:!0,fullWidth:!0,size:y,label:i.label,value:i.value,helperText:i.description,disabled:i.disabled,onChange:f=>n?.(i.id,f.target.value),children:(i.options??[]).map(f=>e.jsx(xe,{value:f.value,children:f.label},f.value))}),B?e.jsx(oe,{size:"small",onClick:()=>k(i),sx:{mt:.5},children:"Reset"}):null]},i.id):i.type==="color"?e.jsxs(Y,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsx(Z,{fullWidth:!0,size:y,label:i.label,value:i.value,helperText:i.description,disabled:i.disabled,onChange:f=>n?.(i.id,f.target.value),InputProps:{startAdornment:e.jsx(u,{component:"input",type:"color",value:String(i.value),disabled:i.disabled,onChange:f=>n?.(i.id,f.target.value),sx:{width:28,height:28,p:0,mr:1,border:0,bgcolor:"transparent",cursor:i.disabled?"default":"pointer"}})}}),B?e.jsx(oe,{size:"small",onClick:()=>k(i),sx:{mt:.5},children:"Reset"}):null]},i.id):e.jsxs(Y,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsx(Z,{fullWidth:!0,size:y,label:i.label,value:i.value,helperText:i.description,disabled:i.disabled,onChange:f=>n?.(i.id,f.target.value)}),B?e.jsx(oe,{size:"small",onClick:()=>k(i),sx:{mt:.5},children:"Reset"}):null]},i.id)})]},x)),c?e.jsxs(u,{sx:{p:1.25,borderRadius:1,bgcolor:"action.hover"},children:[e.jsx(q,{variant:"caption",color:"text.secondary",fontWeight:850,children:"Current values"}),e.jsx(Y,{direction:"row",flexWrap:"wrap",gap:.75,sx:{mt:1},children:t.map(x=>e.jsx(me,{size:"small",label:`${x.label}: ${qt(x)}`},x.id))})]}):null]})})}function Yt({value:t,alpha:n=1,swatches:a=["#2563eb","#7c3aed","#db2777","#dc2626","#f59e0b","#059669"],showValue:l=!0,onChange:h,onAlphaChange:c}){const j=Math.round(n*100),g=`${t}${Math.round(n*255).toString(16).padStart(2,"0")}`;return e.jsx(we,{variant:"outlined",sx:{p:2,borderRadius:1},children:e.jsxs(Y,{spacing:2,children:[e.jsx(u,{sx:{height:96,borderRadius:1,border:1,borderColor:"divider",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%)",backgroundSize:"18px 18px",backgroundPosition:"0 0, 0 9px, 9px -9px, -9px 0"},children:e.jsx(u,{sx:{height:"100%",borderRadius:1,bgcolor:t,opacity:n}})}),e.jsxs(Y,{direction:{xs:"column",sm:"row"},spacing:1.5,children:[e.jsx(Z,{label:"Color",type:"color",value:t,onChange:d=>h?.(d.target.value),sx:{width:{xs:"100%",sm:120}}}),e.jsx(Z,{label:"Hex",value:t,onChange:d=>h?.(d.target.value),fullWidth:!0})]}),e.jsxs(u,{children:[e.jsx(q,{variant:"caption",color:"text.secondary",fontWeight:800,children:"Alpha"}),e.jsx(He,{min:0,max:1,step:.01,value:n,onChange:(d,C)=>c?.(Array.isArray(C)?C[0]:C),valueLabelDisplay:"auto",valueLabelFormat:d=>`${Math.round(d*100)}%`}),e.jsx(Z,{label:"Alpha",type:"number",value:j,onChange:d=>c?.(Math.min(Math.max(Number(d.target.value),0),100)/100),InputProps:{endAdornment:e.jsx(ot,{position:"end",children:"%"})},fullWidth:!0})]}),e.jsx(u,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:a.map(d=>e.jsx(u,{component:"button","aria-label":d,onClick:()=>h?.(d),sx:{width:32,height:32,borderRadius:"50%",border:2,borderColor:d.toLowerCase()===t.toLowerCase()?"text.primary":"divider",bgcolor:d,cursor:"pointer"}},d))}),l?e.jsxs(u,{sx:{p:1.5,borderRadius:1,bgcolor:"#0f172a",color:"#e5e7eb"},children:[e.jsx(q,{variant:"caption",color:"#94a3b8",children:"selected color"}),e.jsx(q,{fontFamily:"monospace",children:g})]}):null]})})}function Nt({onFiles:t,sx:n,...a}){const[l,h]=w.useState(!1);function c(j){j&&t?.(Array.from(j))}return e.jsxs(u,{...a,onDragOver:j=>{j.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:j=>{j.preventDefault(),h(!1),c(j.dataTransfer.files)},sx:[{p:4,border:2,borderStyle:"dashed",borderColor:l?"primary.main":"divider",borderRadius:1,textAlign:"center",bgcolor:l?"primary.50":"background.paper"},...Array.isArray(n)?n:n?[n]:[]],children:[e.jsx(q,{fontWeight:800,children:"Drop files here"}),e.jsx(q,{variant:"body2",color:"text.secondary",children:"Drag files into this zone"})]})}function Ce(t,n,a){return Math.min(Math.max(t,n),a)}function Ot(t){const n=Math.floor(t/60),a=Math.floor(t%60);return`${n}:${String(a).padStart(2,"0")}`}function $e(t,n){return n>0?Ce(t/n*100,0,100):0}function Ht(t,n){return n.reduce((a,l)=>a?Math.abs(l.time-t)<Math.abs(a.time-t)?l:a:l,null)}function Vt({duration:t,value:n,defaultValue:a=0,markers:l=[],thumbnails:h=[],disabled:c=!1,showTime:j=!0,preview:g=!0,step:d=1,formatTime:C=Ot,onChange:y,sx:k,...x}){const L=w.useRef(null),[I,i]=w.useState(a),[B,f]=w.useState(!1),[M,O]=w.useState(null),F=Ce(n??I,0,t),D=M===null?F:M,R=$e(F,t),$=$e(D,t),T=w.useMemo(()=>[...l].sort((m,z)=>m.time-z.time),[l]),V=Ht(D,h);function H(m,z){const X=d>0?Math.round(m/d)*d:m,o=Ce(X,0,t);n===void 0&&i(o),y?.(o,z)}function p(m){const z=L.current;if(!z)return F;const X=z.getBoundingClientRect();return Ce((m-X.left)/X.width,0,1)*t}function P(m){O(p(m))}return e.jsxs(u,{...x,sx:[{width:"100%",color:c?"text.disabled":"text.primary",userSelect:"none"},...Array.isArray(k)?k:k?[k]:[]],children:[j?e.jsxs(u,{sx:{display:"flex",justifyContent:"space-between",mb:1},children:[e.jsx(q,{variant:"caption",fontWeight:800,children:C(F)}),e.jsx(q,{variant:"caption",color:"text.secondary",children:C(t)})]}):null,e.jsxs(u,{ref:L,role:"slider",tabIndex:c?-1:0,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":Math.round(F),onPointerMove:m=>{c||(P(m.clientX),B&&H(p(m.clientX),"drag"))},onPointerLeave:()=>{B||O(null)},onPointerDown:m=>{c||(f(!0),m.currentTarget.setPointerCapture(m.pointerId),H(p(m.clientX),"click"))},onPointerUp:m=>{f(!1),m.currentTarget.releasePointerCapture(m.pointerId)},onPointerCancel:()=>f(!1),onKeyDown:m=>{c||(m.key==="ArrowLeft"&&(H(F-d,"keyboard"),m.preventDefault()),m.key==="ArrowRight"&&(H(F+d,"keyboard"),m.preventDefault()),m.key==="Home"&&(H(0,"keyboard"),m.preventDefault()),m.key==="End"&&(H(t,"keyboard"),m.preventDefault()))},sx:{position:"relative",height:86,cursor:c?"default":"pointer",outline:"none","&:focus-visible .TimelineScrubber-track":{boxShadow:"0 0 0 3px rgba(37,99,235,0.28)"}},children:[g&&M!==null?e.jsxs(u,{sx:{position:"absolute",left:`${$}%`,top:0,transform:"translateX(-50%)",width:116,p:.75,border:1,borderColor:"divider",borderRadius:1,bgcolor:"background.paper",boxShadow:"0 14px 34px rgba(15,23,42,0.18)",pointerEvents:"none",zIndex:2},children:[e.jsx(u,{sx:{height:56,borderRadius:.75,overflow:"hidden",bgcolor:"#e5e7eb"},children:V?.thumbnail??e.jsx(u,{sx:{height:"100%",display:"grid",placeItems:"center",bgcolor:"#0f172a",color:"#fff"},children:e.jsx(q,{variant:"caption",fontWeight:900,children:C(D)})})}),e.jsx(q,{variant:"caption",fontWeight:800,sx:{display:"block",mt:.5,textAlign:"center"},children:C(D)})]}):null,e.jsx(u,{className:"TimelineScrubber-track",sx:{position:"absolute",left:0,right:0,bottom:18,height:12,borderRadius:999,bgcolor:"#e5e7eb",overflow:"hidden",transition:"box-shadow 120ms ease"},children:e.jsx(u,{sx:{width:`${R}%`,height:"100%",borderRadius:999,background:"linear-gradient(90deg, #2563eb, #06b6d4)"}})}),T.map(m=>{const z=$e(m.time,t);return e.jsx(ce,{title:m.label??C(m.time),arrow:!0,children:e.jsx(u,{onPointerDown:X=>{X.stopPropagation(),H(m.time,"marker")},sx:{position:"absolute",left:`${z}%`,bottom:11,width:12,height:26,borderRadius:999,transform:"translateX(-50%)",bgcolor:m.color??"#f59e0b",border:"2px solid",borderColor:"background.paper",boxShadow:"0 8px 18px rgba(15,23,42,0.2)",zIndex:1}})},m.id)}),e.jsx(u,{sx:{position:"absolute",left:`${R}%`,bottom:5,width:28,height:28,borderRadius:"50%",transform:"translateX(-50%)",bgcolor:"background.paper",border:3,borderColor:"#2563eb",boxShadow:B?"0 12px 30px rgba(37,99,235,0.36)":"0 8px 20px rgba(15,23,42,0.2)"}})]})]})}function Ee(t,n,a){return Math.min(Math.max(t,n),a)}function Gt({items:t=[],defaultViewport:n={x:0,y:0,zoom:1},viewport:a,minZoom:l=.3,maxZoom:h=2.5,showGrid:c=!0,showMinimap:j=!0,selectedItemId:g,renderItem:d,onViewportChange:C,onItemMove:y,onItemSelect:k,sx:x,...L}){const I=w.useRef(null),[i,B]=w.useState(n),[f,M]=w.useState(Object.fromEntries(t.map(p=>[p.id,{x:p.x,y:p.y}]))),[O,F]=w.useState(g??null),D=a??i,R=g??O,$=w.useMemo(()=>{const p=t.map(o=>({x:f[o.id]?.x??o.x,y:f[o.id]?.y??o.y,width:o.width??140,height:o.height??80}));if(!p.length)return{minX:-200,minY:-120,width:400,height:240};const P=Math.min(...p.map(o=>o.x))-80,m=Math.min(...p.map(o=>o.y))-80,z=Math.max(...p.map(o=>o.x+o.width))+80,X=Math.max(...p.map(o=>o.y+o.height))+80;return{minX:P,minY:m,width:z-P,height:X-m}},[f,t]);function T(p){const P={...p,zoom:Ee(p.zoom,l,h)};a===void 0&&B(P),C?.(P)}function V(p,P){const m=I.current?.getBoundingClientRect();return{x:(p-(m?.left??0)-D.x)/D.zoom,y:(P-(m?.top??0)-D.y)/D.zoom}}function H(p){F(p?.id??null),k?.(p)}return e.jsxs(u,{...L,ref:I,onWheel:p=>{p.preventDefault();const P=Ee(D.zoom*(p.deltaY>0?.92:1.08),l,h),m=V(p.clientX,p.clientY),z=I.current?.getBoundingClientRect(),X=p.clientX-(z?.left??0)-m.x*P,o=p.clientY-(z?.top??0)-m.y*P;T({x:X,y:o,zoom:P})},onPointerDown:p=>{if(p.target!==p.currentTarget)return;H(null);const P=p.clientX,m=p.clientY,z=D;p.currentTarget.setPointerCapture(p.pointerId);function X(W){T({...z,x:z.x+W.clientX-P,y:z.y+W.clientY-m})}function o(){window.removeEventListener("pointermove",X),window.removeEventListener("pointerup",o)}window.addEventListener("pointermove",X),window.addEventListener("pointerup",o)},sx:[{position:"relative",minHeight:420,overflow:"hidden",bgcolor:"#f8fafc",cursor:"grab",touchAction:"none"},...Array.isArray(x)?x:x?[x]:[]],children:[e.jsx(u,{sx:{position:"absolute",inset:0,pointerEvents:"none",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,backgroundSize:`${32*D.zoom}px ${32*D.zoom}px`,backgroundPosition:`${D.x}px ${D.y}px`}}),e.jsx(u,{sx:{position:"absolute",left:D.x,top:D.y,transform:`scale(${D.zoom})`,transformOrigin:"0 0"},children:t.map(p=>{const P=f[p.id]??{x:p.x,y:p.y},m=p.id===R;return e.jsx(u,{onPointerDown:z=>{z.stopPropagation(),H(p);const X=f[p.id]??{x:p.x,y:p.y},o=V(z.clientX,z.clientY);z.currentTarget.setPointerCapture(z.pointerId);function W(ue){const ee=V(ue.clientX,ue.clientY),G={x:X.x+ee.x-o.x,y:X.y+ee.y-o.y};M(ae=>({...ae,[p.id]:G})),y?.(p.id,G)}function J(){window.removeEventListener("pointermove",W),window.removeEventListener("pointerup",J)}window.addEventListener("pointermove",W),window.addEventListener("pointerup",J)},sx:{position:"absolute",left:P.x,top:P.y,width:p.width??140,height:p.height??80,display:"grid",placeItems:"center",border:m?2:1,borderColor:m?"primary.main":"divider",borderRadius:1,bgcolor:p.color??"background.paper",boxShadow:m?"0 18px 40px rgba(37,99,235,0.24)":"0 12px 28px rgba(15,23,42,0.13)",cursor:"grab",userSelect:"none"},children:d?d(p,m):e.jsx(q,{fontWeight:900,children:p.label??p.id})},p.id)})}),e.jsxs(u,{sx:{position:"absolute",left:12,bottom:12,display:"flex",gap:.75,alignItems:"center",px:1,py:.5,borderRadius:1,bgcolor:"rgba(255,255,255,0.92)",border:1,borderColor:"divider",fontSize:12,fontWeight:800},children:[Math.round(D.zoom*100),"%"]}),j?e.jsx(u,{sx:{position:"absolute",right:12,bottom:12,width:160,height:100,border:1,borderColor:"divider",borderRadius:1,bgcolor:"rgba(255,255,255,0.9)",overflow:"hidden"},children:t.map(p=>{const P=f[p.id]??{x:p.x,y:p.y},m=(P.x-$.minX)/$.width*100,z=(P.y-$.minY)/$.height*100,X=(p.width??140)/$.width*100,o=(p.height??80)/$.height*100;return e.jsx(u,{sx:{position:"absolute",left:`${m}%`,top:`${z}%`,width:`${X}%`,height:`${o}%`,minWidth:6,minHeight:4,borderRadius:.5,bgcolor:p.id===R?"primary.main":p.color??"#94a3b8"}},p.id)})}):null]})}function Ut({children:t,title:n,content:a,media:l,actions:h=[],copyText:c,placement:j="top",pinMode:g=!0,defaultPinned:d=!1,openDelay:C=120,sx:y,...k}){const x=w.useRef(null),L=w.useRef(null),I=w.useRef(null),[i,B]=w.useState(d),[f,M]=w.useState(d),[O,F]=w.useState(!1);function D(){I.current&&window.clearTimeout(I.current),L.current&&window.clearTimeout(L.current)}function R(){D(),!i&&(I.current=window.setTimeout(()=>B(!0),C))}function $(){D(),B(!0)}function T(){D(),f||(L.current=window.setTimeout(()=>B(!1),100))}function V(){const p=!f;M(p),B(p||i)}async function H(){c&&(await navigator.clipboard?.writeText(c),F(!0),window.setTimeout(()=>F(!1),1100))}return e.jsxs(e.Fragment,{children:[e.jsx(u,{component:"span",ref:x,onMouseEnter:R,onMouseLeave:T,onFocus:R,onBlur:T,onClick:()=>{g&&(B(!0),M(!0))},sx:{display:"inline-flex"},children:t}),e.jsx(ct,{open:i,anchorEl:x.current,placement:j,modifiers:[{name:"offset",options:{offset:[0,10]}},{name:"preventOverflow",options:{padding:12}}],sx:{zIndex:1500},children:e.jsx(lt,{onClickAway:()=>{f&&(B(!1),M(!1))},children:e.jsx(u,{onMouseEnter:$,onMouseLeave:T,sx:{width:320,maxWidth:"calc(100vw - 24px)",borderRadius:1,overflow:"hidden",boxShadow:"0 24px 64px rgba(15,23,42,0.28)",bgcolor:"background.paper"},children:e.jsx(u,{...k,sx:[{p:1.25},...Array.isArray(y)?y:y?[y]:[]],children:e.jsxs(Y,{spacing:1.25,children:[l?e.jsx(u,{sx:{borderRadius:1,overflow:"hidden",bgcolor:"#e5e7eb"},children:l}):null,e.jsxs(Y,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsxs(u,{sx:{minWidth:0,flex:1},children:[n?e.jsx(q,{fontWeight:900,children:n}):null,a?e.jsx(q,{variant:"body2",color:"text.secondary",sx:{mt:n?.25:0},children:a}):null]}),g?e.jsx(ce,{title:f?"Unpin":"Pin",children:e.jsx(de,{size:"small",onClick:V,children:f?e.jsx(at,{fontSize:"small"}):e.jsx(st,{fontSize:"small"})})}):null]}),c||h.length?e.jsxs(Y,{direction:"row",spacing:1,flexWrap:"wrap",children:[c?e.jsx(oe,{size:"small",variant:"outlined",startIcon:e.jsx(it,{}),onClick:H,children:O?"Copied":"Copy"}):null,h.map(p=>e.jsx(oe,{size:"small",variant:"contained",startIcon:p.icon,onClick:p.onClick,children:p.label},p.id))]}):null]})})})})})]})}const je={neutral:"#64748b",good:"#059669",warning:"#d97706",danger:"#dc2626"};function Zt(t,n,a){return Math.min(Math.max(t,n),a)}function _t(t){return t.color??je[t.status??"neutral"]}function Kt(t){return typeof t.delta=="number"?t.delta:typeof t.value=="number"&&typeof t.previousValue=="number"&&t.previousValue!==0?(t.value-t.previousValue)/Math.abs(t.previousValue)*100:null}function Qt(t){return t.formatter?t.formatter(t.value):typeof t.value=="number"?new Intl.NumberFormat("en",{maximumFractionDigits:1}).format(t.value):t.value}function Jt(t,n,a){if(t.length<2)return"";const l=Math.min(...t),c=Math.max(...t)-l||1;return t.map((j,g)=>{const d=g/(t.length-1)*n,C=a-(j-l)/c*a;return`${g===0?"M":"L"} ${d.toFixed(2)} ${C.toFixed(2)}`}).join(" ")}function er({values:t,color:n}){const h=Jt(t,180,54),c=h?`${h} L 180 54 L 0 54 Z`:"";return e.jsxs(u,{component:"svg",viewBox:"0 0 180 54",sx:{display:"block",width:"100%",height:54},children:[e.jsx(u,{component:"path",d:c,sx:{fill:N.alpha(n,.14)}}),e.jsx(u,{component:"path",d:h,sx:{fill:"none",stroke:n,strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round"}}),t.length?e.jsx(u,{component:"circle",cx:180,cy:54-(t[t.length-1]-Math.min(...t))/(Math.max(...t)-Math.min(...t)||1)*54,r:4,sx:{fill:n}}):null]})}function tr({metrics:t,title:n,subtitle:a,columns:l=3,density:h="comfortable",showSparklines:c=!0,showProgress:j=!0,sx:g,...d}){const C=h==="compact";return e.jsxs(u,{...d,sx:[{width:"100%"},...Array.isArray(g)?g:g?[g]:[]],children:[n||a?e.jsxs(u,{sx:{mb:2},children:[n?e.jsx(q,{variant:"h6",fontWeight:900,children:n}):null,a?e.jsx(q,{variant:"body2",color:"text.secondary",children:a}):null]}):null,e.jsx(u,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(2, minmax(0, 1fr))",lg:`repeat(${l}, minmax(0, 1fr))`},gap:C?1.25:2},children:t.map(y=>{const k=_t(y),x=Kt(y),L=(x??0)>=0;return e.jsx(we,{variant:"outlined",sx:{p:C?1.5:2,borderRadius:1,overflow:"hidden",position:"relative",borderColor:N.alpha(k,.32),background:`linear-gradient(180deg, ${N.alpha(k,.08)}, rgba(255,255,255,0) 42%)`},children:e.jsxs(Y,{spacing:C?1:1.5,children:[e.jsxs(Y,{direction:"row",spacing:1,alignItems:"flex-start",justifyContent:"space-between",children:[e.jsxs(u,{sx:{minWidth:0},children:[e.jsx(q,{variant:"caption",color:"text.secondary",fontWeight:850,sx:{textTransform:"uppercase"},children:y.label}),e.jsxs(Y,{direction:"row",spacing:.75,alignItems:"baseline",sx:{mt:.5},children:[e.jsx(q,{variant:C?"h5":"h4",fontWeight:950,sx:{lineHeight:1},children:Qt(y)}),y.unit?e.jsx(q,{variant:"body2",color:"text.secondary",fontWeight:800,children:y.unit}):null]})]}),y.icon?e.jsx(u,{sx:{color:k,display:"grid",placeItems:"center",mt:.25},children:y.icon}):null]}),e.jsxs(Y,{direction:"row",spacing:1,alignItems:"center",justifyContent:"space-between",children:[x!==null?e.jsx(me,{size:"small",label:`${L?"+":""}${x.toFixed(1)}%`,sx:{color:L?je.good:je.danger,bgcolor:N.alpha(L?je.good:je.danger,.12),fontWeight:850}}):e.jsx(u,{}),y.helper?e.jsx(q,{variant:"caption",color:"text.secondary",textAlign:"right",children:y.helper}):null]}),c&&y.trend?.length?e.jsx(er,{values:y.trend,color:k}):null,j&&typeof y.progress=="number"?e.jsx(dt,{variant:"determinate",value:Zt(y.progress,0,100),sx:{height:8,borderRadius:999,bgcolor:N.alpha(k,.14),"& .MuiLinearProgress-bar":{bgcolor:k,borderRadius:999}}}):null]})},y.id)})})]})}const rr=[{id:"todo",title:"To do",color:"#2563eb",cards:[{id:"card-1",title:"Map user journey",description:"Find the rough edges before building.",tags:["Research"]},{id:"card-2",title:"Write API contract",description:"Lock the shape of the data.",tags:["Backend"]}]},{id:"doing",title:"Doing",color:"#d97706",cards:[{id:"card-3",title:"Build board interactions",description:"Drag between columns and reorder cards.",tags:["UI"],color:"#fef3c7"}]},{id:"done",title:"Done",color:"#059669",cards:[{id:"card-4",title:"Choose visual system",description:"Dense, clean, and readable.",tags:["Design"],color:"#dcfce7"}]}];function Se(t){return typeof crypto<"u"&&"randomUUID"in crypto?`${t}-${crypto.randomUUID()}`:`${t}-${Date.now()}-${Math.round(Math.random()*1e3)}`}function nr(t,n,a){const l=[...t],[h]=l.splice(n,1);return l.splice(a,0,h),l}function qe(t,n){for(const a of t){const l=a.cards.find(h=>h.id===n);if(l)return{card:l,column:a}}return null}function Xe(t,n){return t.map(a=>({...a,cards:a.cards.filter(l=>l.id!==n)}))}function or(t,n,a,l){return t.map(h=>{if(h.id!==n)return h;const c=[...h.cards];return c.splice(l,0,a),{...h,cards:c}})}function Fe(t,n){const a=t.currentTarget.getBoundingClientRect();return t.clientY>a.top+a.height/2?n+1:n}function ir(t){return t.split(",").map(n=>n.trim()).filter(Boolean)}function ye(t,n,a,l){if(!n||n.type!=="card"||n.fromColumnId!==a)return!1;const c=t.find(j=>j.id===a)?.cards.findIndex(j=>j.id===n.cardId)??-1;return l===c||l===c+1}function Ye({compact:t,onDragOver:n,onDrop:a}){return e.jsx(u,{onDragOver:n,onDrop:a,sx:{height:t?44:56,border:1,borderStyle:"dashed",borderColor:"primary.main",borderRadius:1,bgcolor:N.alpha("#2563eb",.08),transition:"height 120ms ease, background-color 120ms ease"}})}function ar({columns:t,defaultColumns:n=rr,title:a="Kanban",subtitle:l,density:h="comfortable",allowColumnDrag:c=!0,onChange:j,onCardSelect:g,sx:d,...C}){const[y,k]=w.useState(n),[x,L]=w.useState(null),[I,i]=w.useState(null),[B,f]=w.useState(null),[M,O]=w.useState(""),[F,D]=w.useState({}),[R,$]=w.useState(null),[T,V]=w.useState(""),[H,p]=w.useState(""),[P,m]=w.useState(""),[z,X]=w.useState("#ffffff"),o=t??y,W=h==="compact",J=R?.card?qe(o,R.card.id):null,ue=w.useMemo(()=>o.reduce((s,b)=>s+b.cards.length,0),[o]);function ee(s){t||k(s),j?.(s)}function G(){const s=M.trim();s&&(ee([...o,{id:Se("column"),title:s,cards:[],color:"#64748b"}]),O(""))}function ae(s,b){ee(o.map(r=>r.id===s?{...r,title:b}:r))}function _(s){ee(o.filter(b=>b.id!==s))}function te(s){const b=F[s]?.trim();if(!b)return;const r={id:Se("card"),title:b};ee(o.map(v=>v.id===s?{...v,cards:[...v.cards,r]}:v)),D(v=>({...v,[s]:""}))}function pe(s,b,r){$({columnId:s,mode:b,card:r}),V(r?.title??""),p(r?.description??""),m((r?.tags??[]).join(", ")),X(r?.color??"#ffffff")}function le(){$(null),V(""),p(""),m(""),X("#ffffff")}function A(){if(!R||!T.trim())return;const s={id:R.card?.id??Se("card"),title:T.trim(),description:H.trim()||void 0,tags:ir(P),color:z};if(R.mode==="add"){ee(o.map(b=>b.id===R.columnId?{...b,cards:[...b.cards,s]}:b)),le();return}ee(o.map(b=>({...b,cards:b.cards.map(r=>r.id===s.id?s:r)}))),le()}function se(s){ee(Xe(o,s)),le()}function re(s,b,r){const v=qe(o,s);if(!v)return;const E=v.column.cards.findIndex(be=>be.id===s),S=v.column.id===b&&E<r?r-1:r,Q=Xe(o,s),U=Q.find(be=>be.id===b),he=Math.min(Math.max(S,0),U?.cards.length??0);ee(or(Q,b,v.card,he))}function K(s,b){if(ye(o,x,s,b)){i(null);return}i(r=>r?.columnId===s&&r.index===b?r:{columnId:s,index:b})}function ne(){L(null),i(null)}function fe(s,b){const r=o.findIndex(E=>E.id===s),v=o.findIndex(E=>E.id===b);r<0||v<0||r===v||ee(nr(o,r,v))}function ge(s,b){if(s.preventDefault(),!x)return;if(x.type==="column"){fe(x.columnId,b),ne();return}const v=o.find(E=>E.id===b)?.cards.length??0;ye(o,x,b,v)||re(x.cardId,b,v),ne()}function ve(s,b,r){if(s.preventDefault(),s.stopPropagation(),!x||x.type!=="card")return;const v=Fe(s,r);ye(o,x,b,v)||re(x.cardId,b,v),ne()}return e.jsxs(u,{...C,sx:[{width:"100%",color:"text.primary"},...Array.isArray(d)?d:d?[d]:[]],children:[e.jsxs(Y,{direction:{xs:"column",sm:"row"},spacing:2,alignItems:{xs:"stretch",sm:"center"},justifyContent:"space-between",sx:{mb:2},children:[e.jsxs(u,{children:[e.jsx(q,{variant:"h6",fontWeight:900,children:a}),e.jsx(q,{variant:"body2",color:"text.secondary",children:l??`${o.length} columns, ${ue} cards`})]}),e.jsxs(Y,{direction:"row",spacing:1,children:[e.jsx(Z,{size:"small",label:"New column",value:M,onChange:s=>O(s.target.value),onKeyDown:s=>{s.key==="Enter"&&G()}}),e.jsx(oe,{variant:"contained",startIcon:e.jsx(ze,{}),onClick:G,children:"Column"})]})]}),e.jsx(u,{sx:{display:"grid",gridAutoFlow:{xs:"row",md:"column"},gridAutoColumns:{md:"minmax(280px, 1fr)"},gridTemplateColumns:{xs:"1fr",md:"none"},gap:2,overflowX:{xs:"visible",md:"auto"},pb:1},children:o.map(s=>e.jsx(we,{variant:"outlined",draggable:c&&x?.type!=="card",onDragStart:()=>{c&&L({type:"column",columnId:s.id})},onDragOver:b=>{b.preventDefault(),x?.type==="card"&&b.target===b.currentTarget&&K(s.id,s.cards.length)},onDrop:b=>ge(b,s.id),onDragEnd:ne,sx:{p:W?1.25:1.5,borderRadius:1,minHeight:260,bgcolor:N.alpha(s.color??"#64748b",.06),borderColor:N.alpha(s.color??"#64748b",.28)},children:e.jsxs(Y,{spacing:W?1:1.25,children:[e.jsxs(Y,{direction:"row",spacing:1,alignItems:"center",children:[c?e.jsx(Oe,{fontSize:"small",color:"disabled"}):null,B===s.id?e.jsx(Z,{autoFocus:!0,fullWidth:!0,size:"small",value:s.title,onChange:b=>ae(s.id,b.target.value),onBlur:()=>f(null),onKeyDown:b=>{b.key==="Enter"&&f(null)}}):e.jsx(q,{fontWeight:900,sx:{flex:1,minWidth:0},children:s.title}),e.jsx(me,{size:"small",label:s.cards.length}),e.jsx(ce,{title:"Rename column",children:e.jsx(de,{size:"small",onClick:()=>f(s.id),children:e.jsx(Ae,{fontSize:"small"})})}),e.jsx(ce,{title:"Delete column",children:e.jsx(de,{size:"small",onClick:()=>_(s.id),children:e.jsx(Ne,{fontSize:"small"})})})]}),e.jsxs(Y,{spacing:1,children:[s.cards.map((b,r)=>{const v=x?.type==="card"&&x.cardId!==b.id&&I?.columnId===s.id&&I.index===r,E=x?.type==="card"&&x.cardId===b.id;return e.jsxs(u,{children:[v?e.jsx(u,{sx:{mb:1},children:e.jsx(Ye,{compact:W,onDragOver:S=>{S.preventDefault(),S.stopPropagation(),K(s.id,r)},onDrop:S=>{S.preventDefault(),S.stopPropagation(),x?.type==="card"&&(ye(o,x,s.id,r)||re(x.cardId,s.id,r),ne())}})}):null,e.jsx(we,{variant:"outlined",draggable:!0,onDragStart:S=>{S.stopPropagation(),S.dataTransfer.effectAllowed="move",L({type:"card",cardId:b.id,fromColumnId:s.id}),K(s.id,r)},onDragOver:S=>{S.preventDefault(),S.stopPropagation(),K(s.id,Fe(S,r))},onDrop:S=>ve(S,s.id,r),onDragEnd:ne,onClick:()=>g?.(b,s),sx:{p:W?1.25:1.5,borderRadius:1,cursor:E?"grabbing":"grab",bgcolor:b.color??"background.paper",borderColor:E?"primary.main":"divider",opacity:E?.42:1,transform:E?"scale(0.98)":"scale(1)",transition:"transform 120ms ease, opacity 120ms ease, border-color 120ms ease",boxShadow:E?"0 18px 40px rgba(37,99,235,0.22)":void 0},children:e.jsxs(Y,{spacing:1,children:[e.jsxs(Y,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsxs(u,{sx:{flex:1,minWidth:0},children:[e.jsx(q,{fontWeight:850,children:b.title}),b.description?e.jsx(q,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:b.description}):null]}),e.jsx(de,{size:"small",onClick:S=>{S.stopPropagation(),pe(s.id,"edit",b)},children:e.jsx(Ae,{fontSize:"small"})})]}),b.tags?.length?e.jsx(Y,{direction:"row",flexWrap:"wrap",gap:.75,children:b.tags.map(S=>e.jsx(me,{size:"small",label:S},S))}):null]})})]},b.id)}),x?.type==="card"&&I?.columnId===s.id&&I.index===s.cards.length?e.jsx(Ye,{compact:W,onDragOver:b=>{b.preventDefault(),b.stopPropagation(),K(s.id,s.cards.length)},onDrop:b=>{b.preventDefault(),b.stopPropagation(),x?.type==="card"&&(ye(o,x,s.id,s.cards.length)||re(x.cardId,s.id,s.cards.length),ne())}}):null]}),e.jsxs(Y,{direction:"row",spacing:1,children:[e.jsx(Z,{fullWidth:!0,size:"small",label:"Quick card",value:F[s.id]??"",onChange:b=>D(r=>({...r,[s.id]:b.target.value})),onKeyDown:b=>{b.key==="Enter"&&te(s.id)}}),e.jsx(oe,{variant:"outlined",onClick:()=>te(s.id),children:"Add"})]}),e.jsx(oe,{startIcon:e.jsx(ze,{}),onClick:()=>pe(s.id,"add"),children:"Detailed card"})]})},s.id))}),e.jsxs(ut,{open:!!R,onClose:le,fullWidth:!0,maxWidth:"sm",children:[e.jsx(xt,{children:R?.mode==="add"?"Add card":"Edit card"}),e.jsx(ht,{children:e.jsxs(Y,{spacing:2,sx:{pt:1},children:[e.jsx(Z,{label:"Title",value:T,onChange:s=>V(s.target.value),autoFocus:!0}),e.jsx(Z,{label:"Description",value:H,onChange:s=>p(s.target.value),multiline:!0,minRows:3}),e.jsx(Z,{label:"Tags",helperText:"Comma separated",value:P,onChange:s=>m(s.target.value)}),e.jsx(Z,{label:"Color",value:z,onChange:s=>X(s.target.value),select:!0,children:[{label:"White",value:"#ffffff"},{label:"Blue",value:"#dbeafe"},{label:"Green",value:"#dcfce7"},{label:"Yellow",value:"#fef3c7"},{label:"Red",value:"#fee2e2"}].map(s=>e.jsx(xe,{value:s.value,children:s.label},s.value))})]})}),e.jsxs(pt,{children:[J?e.jsx(oe,{color:"error",onClick:()=>se(J.card.id),children:"Delete"}):null,e.jsx(oe,{onClick:le,children:"Cancel"}),e.jsx(oe,{variant:"contained",onClick:A,children:R?.mode==="add"?"Add":"Save"})]})]})]})}exports.BeforeAfterSlider=Wt;exports.CodeViewer=vt;exports.ColorPicker=Yt;exports.CommandPalette=Dt;exports.ComponentExample=ft;exports.DataCardGrid=tr;exports.DockBar=St;exports.DraggableBox=Ct;exports.FileDropZone=Nt;exports.FloatingToolbar=At;exports.GlassBox=kt;exports.InfiniteCanvas=Gt;exports.InspectorPanel=Ft;exports.KanbanBoard=ar;exports.MagneticCard=Pt;exports.NodeCanvas=Bt;exports.ResizableFrame=Et;exports.SmartTooltip=Ut;exports.SplitPane=Rt;exports.SpotlightPanel=Tt;exports.TimelineScrubber=Vt;