"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react"),r=require("react/jsx-runtime"),u=require("@mui/material/Box"),R=require("@mui/material/Typography"),C=require("@mui/material/IconButton"),W=require("@mui/material/Collapse"),w=require("react-icons/lu"),E=require("@mui/material/Stack"),P=require("@mui/material/Divider");function T(e,t){try{const n=localStorage.getItem(e);return n?Number(n):t}catch{return t}}function S(e,t){try{localStorage.setItem(e,String(t))}catch{}}function I({direction:e,defaultSize:t,minSize:n=0,maxSize:s=1/0,onResize:l,storageKey:o}){const[i,p]=v.useState(()=>o?T(o,t):t),[d,c]=v.useState(!1),a=v.useRef({pos:0,size:0}),h=v.useCallback(f=>Math.max(n,Math.min(s,f)),[n,s]),m=v.useCallback(f=>{f.preventDefault();const x=e==="horizontal"?f.clientX:f.clientY;a.current={pos:x,size:i},c(!0)},[e,i]);v.useEffect(()=>{if(!d)return;const f=b=>{const H=(e==="horizontal"?b.clientX:b.clientY)-a.current.pos,D=h(a.current.size+H);p(D),l?.(D)},x=()=>{c(!1),o&&S(o,i)};return document.addEventListener("mousemove",f),document.addEventListener("mouseup",x),()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",x)}},[d,e,h,l,o,i]);const y=v.useCallback(()=>{const x=h(i===n?t:n);p(x),l?.(x),o&&S(o,x)},[i,n,t,h,l,o]),j=v.useCallback(()=>{p(t),l?.(t),o&&S(o,t)},[t,l,o]);return{size:i,isDragging:d,handleProps:{onMouseDown:m,onDoubleClick:y},reset:j}}function k({direction:e="horizontal",defaultSize:t=300,minSize:n=100,maxSize:s,onResize:l,children:o,handleSize:i=4,id:p,sx:d}){const{size:c,isDragging:a,handleProps:h}=I({direction:e,defaultSize:t,minSize:n,maxSize:s,onResize:l,storageKey:p?`ov-split-${p}`:void 0}),m=e==="horizontal";return r.jsxs(u,{sx:{display:"flex",flexDirection:m?"row":"column",height:"100%",width:"100%",overflow:"hidden",userSelect:a?"none":void 0,...d},children:[r.jsx(u,{sx:{[m?"width":"height"]:c,flexShrink:0,overflow:"auto"},children:o[0]}),r.jsx(u,{...h,sx:{[m?"width":"height"]:i,flexShrink:0,cursor:m?"col-resize":"row-resize",bgcolor:a?"var(--ov-accent)":"transparent",transition:a?"none":"background-color 0.15s","&:hover":{bgcolor:"var(--ov-border-default)"}}}),r.jsx(u,{sx:{flex:1,overflow:"auto",minWidth:0,minHeight:0},children:o[1]})]})}k.displayName="ResizableSplitPane";function A({header:e,sidebar:t,footer:n,children:s,sidebarWidth:l=240,sidebarCollapsed:o=!1,headerHeight:i=48,footerHeight:p=32,sx:d}){const c=o?0:l,a=e?i:0,h=n?p:0;return r.jsxs(u,{sx:{display:"grid",gridTemplateAreas:`
          "header header"
          "sidebar main"
          "footer footer"
        `,gridTemplateColumns:t?`${typeof c=="number"?`${c}px`:c} 1fr`:"1fr",gridTemplateRows:`${typeof a=="number"?`${a}px`:a} 1fr ${typeof h=="number"?`${h}px`:h}`,height:"100vh",width:"100vw",overflow:"hidden","--ov-shell-sidebar-width":typeof c=="number"?`${c}px`:c,"--ov-shell-header-height":typeof a=="number"?`${a}px`:a,"--ov-shell-footer-height":typeof h=="number"?`${h}px`:h,...d},children:[e&&r.jsx(u,{sx:{gridArea:"header",overflow:"hidden"},children:e}),t&&r.jsx(u,{sx:{gridArea:"sidebar",overflow:"auto",transition:"width 0.2s ease"},children:t}),r.jsx(u,{sx:{gridArea:"main",overflow:"auto"},children:s}),n&&r.jsx(u,{sx:{gridArea:"footer",overflow:"hidden"},children:n})]})}A.displayName="AppShell";const B={flat:"none",raised:"0 1px 3px rgba(0,0,0,0.12)",overlay:"0 4px 12px rgba(0,0,0,0.2)"};function L({title:e,icon:t,toolbar:n,children:s,collapsible:l=!1,onClose:o,elevation:i="flat",sx:p}){const[d,c]=v.useState(!1);return r.jsxs(u,{sx:{display:"flex",flexDirection:"column",border:"1px solid var(--ov-border-default)",borderRadius:"6px",bgcolor:"var(--ov-bg-surface)",boxShadow:B[i],overflow:"hidden",...p},children:[(e||n||o)&&r.jsxs(u,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:.75,borderBottom:d?"none":"1px solid var(--ov-border-muted)",bgcolor:"var(--ov-bg-subtle)",minHeight:36},children:[l&&r.jsx(C,{size:"small",onClick:()=>c(a=>!a),sx:{p:.25},children:d?r.jsx(w.LuChevronRight,{size:14}):r.jsx(w.LuChevronDown,{size:14})}),t&&r.jsx(u,{sx:{display:"flex",color:"var(--ov-fg-muted)"},children:t}),e&&r.jsx(R,{variant:"body2",sx:{fontWeight:600,fontSize:"0.8125rem",color:"var(--ov-fg-base)",flex:1},children:e}),n&&r.jsx(u,{sx:{display:"flex",alignItems:"center",gap:.5},children:n}),o&&r.jsx(C,{size:"small",onClick:o,sx:{p:.25,ml:"auto"},children:r.jsx(w.LuX,{size:14})})]}),r.jsx(W,{in:!d,children:r.jsx(u,{sx:{flex:1,overflow:"auto"},children:s})})]})}L.displayName="Panel";function z({direction:e="column",gap:t,spacing:n,align:s,alignItems:l,justify:o,justifyContent:i,wrap:p,flexWrap:d,divider:c=!1,children:a,sx:h,...m}){const y=n??t??1,j=l??s,f=i??o,x=d??(p?"wrap":void 0),b=typeof c=="boolean"?c?r.jsx(P,{orientation:e==="row"?"vertical":"horizontal",flexItem:!0}):void 0:c;return r.jsx(E,{direction:e,spacing:y,alignItems:j,justifyContent:f,flexWrap:x,divider:b,sx:h,...m,children:a})}z.displayName="Stack";function $({gap:e=1,align:t="center",justify:n,divider:s=!1,children:l,sx:o}){return r.jsx(z,{direction:"row",gap:e,align:t,justify:n,wrap:!0,divider:s,sx:o,children:l})}$.displayName="Inline";function q({sx:e}){return r.jsx(u,{sx:{flex:1,...e}})}q.displayName="Spacer";function g(e,t){if(e.type==="leaf")return r.jsx(u,{sx:{flex:1,minWidth:0,minHeight:0,overflow:"auto"},children:t(e.id)});const n=e.type==="horizontal"?"horizontal":"vertical",s=e.children;return s.length===0?null:s.length===1?g(s[0],t):N(s,n,e.sizes,t)}function N(e,t,n,s){if(e.length===1)return g(e[0],s);const l=n?.[0]??50,o=e[0],i=e.slice(1),p=n?.slice(1),d=o.type==="leaf"?o.minSize??100:100;return r.jsxs(k,{direction:t,defaultSize:l,minSize:d,children:[g(o,s),i.length===1?g(i[0],s):N(i,t,p,s)]})}function M({layout:e,renderPanel:t,sx:n}){return r.jsx(u,{sx:{display:"flex",flex:1,minWidth:0,minHeight:0,overflow:"hidden",...typeof n=="object"&&!Array.isArray(n)?n:{}},children:g(e,t)})}M.displayName="DockLayout";exports.AppShell=A;exports.DockLayout=M;exports.Inline=$;exports.Panel=L;exports.ResizableSplitPane=k;exports.Spacer=q;exports.Stack=z;exports.useResizablePanel=I;
