@vuu-ui/vuu-layout 0.5.4 → 0.5.5
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 +1 -0
- package/cjs/index.js +4 -7379
- package/cjs/index.js.map +7 -0
- package/esm/index.js +20 -0
- package/esm/index.js.map +7 -0
- package/index.css +1 -951
- package/index.css.map +3 -3
- package/package.json +6 -9
- package/src/Component.css +0 -2
- package/src/Component.tsx +0 -20
- package/src/DraggableLayout.css +0 -18
- package/src/DraggableLayout.tsx +0 -29
- package/src/__tests__/flexbox-utils.spec.js +0 -90
- package/src/action-buttons/index.ts +0 -1
- package/src/chest-of-drawers/Chest.css +0 -36
- package/src/chest-of-drawers/Chest.tsx +0 -42
- package/src/chest-of-drawers/Drawer.css +0 -159
- package/src/chest-of-drawers/Drawer.tsx +0 -118
- package/src/chest-of-drawers/index.ts +0 -2
- package/src/common-types.ts +0 -9
- package/src/debug.ts +0 -16
- package/src/dialog/Dialog.css +0 -16
- package/src/dialog/Dialog.tsx +0 -59
- package/src/dialog/index.ts +0 -1
- package/src/drag-drop/BoxModel.ts +0 -546
- package/src/drag-drop/DragState.ts +0 -222
- package/src/drag-drop/Draggable.ts +0 -282
- package/src/drag-drop/DropMenu.css +0 -71
- package/src/drag-drop/DropMenu.tsx +0 -61
- package/src/drag-drop/DropTarget.ts +0 -392
- package/src/drag-drop/DropTargetRenderer.css +0 -40
- package/src/drag-drop/DropTargetRenderer.tsx +0 -279
- package/src/drag-drop/dragDropTypes.ts +0 -49
- package/src/drag-drop/index.ts +0 -4
- package/src/editable-label/EditableLabel.css +0 -28
- package/src/editable-label/EditableLabel.tsx +0 -99
- package/src/editable-label/index.ts +0 -1
- package/src/flexbox/Flexbox.css +0 -45
- package/src/flexbox/Flexbox.tsx +0 -70
- package/src/flexbox/FlexboxLayout.jsx +0 -26
- package/src/flexbox/FluidGrid.css +0 -134
- package/src/flexbox/FluidGrid.tsx +0 -84
- package/src/flexbox/FluidGridLayout.tsx +0 -10
- package/src/flexbox/Splitter.css +0 -140
- package/src/flexbox/Splitter.tsx +0 -135
- package/src/flexbox/flexbox-utils.ts +0 -128
- package/src/flexbox/flexboxTypes.ts +0 -63
- package/src/flexbox/index.ts +0 -4
- package/src/flexbox/useResponsiveSizing.ts +0 -85
- package/src/flexbox/useSplitterResizing.ts +0 -272
- package/src/index.ts +0 -21
- package/src/layout-action.ts +0 -21
- package/src/layout-header/ActionButton.tsx +0 -23
- package/src/layout-header/Header.css +0 -8
- package/src/layout-header/Header.tsx +0 -222
- package/src/layout-header/index.ts +0 -1
- package/src/layout-provider/LayoutProvider.tsx +0 -160
- package/src/layout-provider/LayoutProviderContext.ts +0 -17
- package/src/layout-provider/index.ts +0 -2
- package/src/layout-provider/useLayoutDragDrop.ts +0 -241
- package/src/layout-reducer/flexUtils.ts +0 -281
- package/src/layout-reducer/index.ts +0 -4
- package/src/layout-reducer/insert-layout-element.ts +0 -365
- package/src/layout-reducer/layout-reducer.ts +0 -255
- package/src/layout-reducer/layoutTypes.ts +0 -151
- package/src/layout-reducer/layoutUtils.ts +0 -302
- package/src/layout-reducer/remove-layout-element.ts +0 -240
- package/src/layout-reducer/replace-layout-element.ts +0 -118
- package/src/layout-reducer/resize-flex-children.ts +0 -56
- package/src/layout-reducer/wrap-layout-element.ts +0 -317
- package/src/layout-view/View.css +0 -61
- package/src/layout-view/View.tsx +0 -149
- package/src/layout-view/ViewContext.ts +0 -31
- package/src/layout-view/index.ts +0 -4
- package/src/layout-view/useView.tsx +0 -104
- package/src/layout-view/useViewActionDispatcher.ts +0 -133
- package/src/layout-view/useViewResize.ts +0 -53
- package/src/layout-view/viewTypes.ts +0 -37
- package/src/menu/ContextMenu.css +0 -22
- package/src/menu/ContextMenu.jsx +0 -121
- package/src/menu/MenuList.css +0 -150
- package/src/menu/MenuList.jsx +0 -179
- package/src/menu/aim/aim.js +0 -92
- package/src/menu/aim/corners.js +0 -114
- package/src/menu/aim/point-in-polygon.js +0 -25
- package/src/menu/aim/utils.js +0 -19
- package/src/menu/context-menu-provider.jsx +0 -135
- package/src/menu/index.js +0 -4
- package/src/menu/key-code.js +0 -61
- package/src/menu/list-dom-utils.js +0 -22
- package/src/menu/use-cascade.js +0 -292
- package/src/menu/use-click-away.js +0 -22
- package/src/menu/use-items-with-ids.js +0 -75
- package/src/menu/use-keyboard-navigation.js +0 -162
- package/src/menu/utils.js +0 -5
- package/src/palette/Palette.css +0 -37
- package/src/palette/Palette.tsx +0 -140
- package/src/palette/PaletteSalt.css +0 -9
- package/src/palette/PaletteSalt.tsx +0 -79
- package/src/palette/index.ts +0 -2
- package/src/placeholder/Placeholder.css +0 -10
- package/src/placeholder/Placeholder.tsx +0 -39
- package/src/placeholder/index.ts +0 -1
- package/src/popup/index.js +0 -2
- package/src/popup/popup-provider.js +0 -0
- package/src/popup/popup-service.css +0 -15
- package/src/popup/popup-service.js +0 -281
- package/src/portal/Portal.jsx +0 -50
- package/src/portal/index.ts +0 -3
- package/src/portal/render-portal.jsx +0 -68
- package/src/portal/utils.js +0 -16
- package/src/registry/ComponentRegistry.ts +0 -35
- package/src/registry/index.ts +0 -1
- package/src/responsive/OverflowMenu.css +0 -31
- package/src/responsive/OverflowMenu.jsx +0 -56
- package/src/responsive/breakpoints.ts +0 -62
- package/src/responsive/index.ts +0 -4
- package/src/responsive/measureMinimumNodeSize.ts +0 -23
- package/src/responsive/overflowUtils.js +0 -14
- package/src/responsive/use-breakpoints.ts +0 -100
- package/src/responsive/useOverflowObserver.ts +0 -606
- package/src/responsive/useResizeObserver.ts +0 -154
- package/src/responsive/utils.ts +0 -37
- package/src/stack/Stack.css +0 -39
- package/src/stack/Stack.tsx +0 -161
- package/src/stack/StackLayout.tsx +0 -137
- package/src/stack/index.ts +0 -3
- package/src/stack/stackTypes.ts +0 -19
- package/src/tabs/TabPanel.css +0 -12
- package/src/tabs/TabPanel.tsx +0 -17
- package/src/tabs/index.ts +0 -1
- package/src/tools/config-wrapper/ConfigWrapper.jsx +0 -53
- package/src/tools/config-wrapper/index.js +0 -1
- package/src/tools/devtools-box/layout-configurator.css +0 -112
- package/src/tools/devtools-box/layout-configurator.jsx +0 -369
- package/src/tools/devtools-tree/layout-tree-viewer.css +0 -15
- package/src/tools/devtools-tree/layout-tree-viewer.jsx +0 -36
- package/src/tools/index.js +0 -3
- package/src/use-persistent-state.ts +0 -115
- package/src/utils/apply-handlers.js +0 -15
- package/src/utils/componentFromLayout.tsx +0 -30
- package/src/utils/index.ts +0 -6
- package/src/utils/pathUtils.ts +0 -294
- package/src/utils/propUtils.ts +0 -24
- package/src/utils/refUtils.ts +0 -16
- package/src/utils/styleUtils.ts +0 -14
- package/src/utils/typeOf.ts +0 -22
package/esm/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Us from"classnames";import{useCallback as Fs}from"react";import Ko from"classnames";import{Button as Xo,useControlled as Vs}from"@salt-ds/core";import{jsx as ze,jsxs as _s}from"react/jsx-runtime";var ce="vuuDrawer",Yo=e=>typeof e=="string"?e:e+"px",Ws=(e,t,o)=>{let n=t!==void 0,r=o!==void 0;if(!(!e&&!r&&!n))return!r&&!n?e:{...e,"--drawer-size":n?Yo(t):void 0,"--drawer-peek-size":r?Yo(o):void 0}},Zo=({children:e,className:t,clickToOpen:o,defaultOpen:n,sizeOpen:r,sizeClosed:s,style:i,open:a,position:l="left",inline:c,onClick:u,peekaboo:d=!1,toggleButton:p,...m})=>{let[f,g]=Vs({controlled:a,default:n!=null?n:!1,name:"Drawer",state:"open"}),b=Ko(ce,t,`${ce}-${l}`,{[`${ce}-open`]:f,[`${ce}-inline`]:c,[`${ce}-over`]:!c,[`${ce}-peekaboo`]:d}),h=Fs(()=>{console.log("toggleDrawer"),g(!f)},[f,g]),S=Ws(i,r,s),R=o?h:u,y=()=>ze("div",{className:Ko("vuuToggleButton-container"),children:f?ze(Xo,{"aria-label":"close",onClick:h,"data-icon":"close",variant:"secondary"}):ze(Xo,{"aria-label":"open",onClick:h,"data-icon":"close",variant:"secondary"})});return _s("div",{...m,className:b,onClick:R,style:S,children:[p=="start"?y():null,ze("div",{className:`${ce}-liner`,children:ze("div",{className:`${ce}-content`,children:e})}),p=="end"?y():null]})};Zo.displayName="Drawer";var Wt=Zo;import{partition as Qo}from"@vuu-ui/vuu-utils";var qo={},Jo={},ne={};function F(e){return qo[e]===!0}function Gs(e){return Jo[e]===!0}var jo=e=>F(e)||Gs(e),Yu=e=>!!ne[e];function O(e,t,o="component"){ne[e]=t,o==="container"?qo[e]=!0:o==="view"&&(Jo[e]=!0)}import{jsx as Zs,jsxs as qs}from"react/jsx-runtime";var Ks=e=>e.type===Wt,Xs=({props:{position:e="left"}})=>e.match(/top|bottom/),_t=e=>{let{children:t,className:o,id:n,style:r}=e,s="hwChest",[i,a]=Qo(t,Ks),[l,c]=Qo(i,Xs),u=l.length===0?"horizontal":c.length===0?"vertical":"both",d=Us(s,o,`${s}-${u}`);return qs("div",{className:d,id:n,style:r,children:[i,Zs("div",{className:`${s}-content`,children:a})]})};_t.displayName="Chest";var Ys=_t;O("Chest",_t,"container");import{forwardRef as Js}from"react";import{jsx as js}from"react/jsx-runtime";var Gt=Js(function({resizeable:t,...o},n){return js("div",{...o,className:"Component",ref:n})});Gt.displayName="Component";var Ut=Gt;O("Component",Gt);import{useCallback as os,useRef as pc,useState as ns}from"react";import dc from"classnames";import{useForkRef as Di}from"@salt-ds/core";import Mi from"classnames";import{forwardRef as Li}from"react";import Ne,{useCallback as lt,useMemo as hn,useRef as ct,useState as Ri}from"react";import{getUniqueId as Ei}from"@vuu-ui/vuu-utils";import Qs,{useCallback as ke,useRef as ot,useState as ei}from"react";import ti from"classnames";import{jsx as en}from"react/jsx-runtime";var tn=Qs.memo(function({column:t,index:o,onDrag:n,onDragEnd:r,onDragStart:s,style:i}){let a=ot(),l=ot(null),c=ot(0),[u,d]=ei(!1),p=ke(({key:T,shiftKey:D})=>{let P=D?10:1;t&&T==="ArrowDown"?n(o,P):t&&T==="ArrowUp"||!t&&T==="ArrowLeft"?n(o,-P):!t&&T==="ArrowRight"&&n(o,P)},[t,o,n]),m=ke(T=>{let{key:D}=T;(t&&(D==="ArrowUp"||D==="ArrowDown")||!t&&(D==="ArrowLeft"||D==="ArrowRIght"))&&(s(o),p(T),f.current=p)},[t,p,o,s]),f=ot(m),g=T=>f.current(T),b=ke(T=>{a.current=!0;let D=T[t?"clientY":"clientX"],P=D-c.current;D&&D!==c.current&&n(o,P),c.current=D},[t,o,n]),h=ke(()=>{var T;window.removeEventListener("mousemove",b,!1),window.removeEventListener("mouseup",h,!1),r(),d(!1),(T=l.current)==null||T.focus()},[b,r,d]),S=ke(T=>{c.current=t?T.clientY:T.clientX,s(o),window.addEventListener("mousemove",b,!1),window.addEventListener("mouseup",h,!1),T.preventDefault(),d(!0)},[t,b,h,o,s,d]),R=()=>{},y=()=>{var T;a.current?a.current=!1:(T=l.current)==null||T.focus()},x=()=>{f.current=m},E=ti("Splitter","focusable",{active:u,column:t});return en("div",{className:E,"data-splitter":!0,ref:l,role:"separator",style:i,onBlur:x,onClick:y,onFocus:R,onKeyDown:g,onMouseDown:S,tabIndex:0,children:en("div",{className:"grab-zone"})})});import oi from"classnames";import{jsx as ni}from"react/jsx-runtime";var on="vuuPlaceholder",nt=({className:e,closeable:t,flexFill:o,resizeable:n,shim:r,...s})=>ni("div",{className:oi(on,e,{[`${on}-shim`]:r}),...s,"data-placeholder":!0,"data-resizeable":!0});nt.displayName="Placeholder";O("Placeholder",nt);var Kt=e=>{if(typeof e=="number")return{flexBasis:0,flexGrow:1,flexShrink:1};throw Error(`"no support yet for flex value ${e}`)};import fe from"react";var ri={},A=(e,t)=>{var n;let o=I(e);return(n=o[t])!=null?n:o[`data-${t}`]},I=e=>(e==null?void 0:e.props)||e||ri,nn=e=>{let t=I(e);if(t.children){let{children:[o,...n]}=t;return n.length>0&&console.warn(`getChild expected a single child, found ${n.length+1}`),o}};function z(e){var t;if(e){let o=e.type;if(typeof o=="function"||typeof o=="object"){let n=o.displayName||o.name||((t=o.type)==null?void 0:t.name);if(typeof n=="string")return n}else{if(typeof e.type=="string")return e.type;if(e.constructor)return e.constructor.displayName}throw Error("typeOf unable to determine type of element")}}var $p=(e,t)=>z(e)===t;var si=e=>{let t=e.lastIndexOf(".");return t===-1?e:e.slice(0,t)};function ie(e,t){let{"data-path":o,path:n=o}=I(e);return t==="0"||t===n?null:_(e,si(t),!0)}function ae(e,t){let{children:o,...n}=I(e);if(t(n))return e;if(fe.Children.count(o)>0){let r=fe.isValidElement(o)?[o]:o;for(let s of r){let i=ae(s,t);if(i)return i}}}function ii(e,t){if(t===e)return null;{let{path:o,children:n}=I(e),{idx:r,finalStep:s}=q(o,A(t,"path"));return s?e:n===void 0||n[r]===void 0?null:ii(n[r],t)}}var ai=(e,t)=>{if(fe.isValidElement(e)&&t==0)return e;if(Array.isArray(e))return e[t]};function rn(e,t){var o=t.split(".");let n=[e],r=s=>fe.isValidElement(s.props.children)?[s.props.children]:s.props.children;for(let s=0;s<o.length;s++){let i=parseInt(o[s]),a=n[i];if(s===o.length-1)return a;n=r(a)}}function _(e,t,o=!1){let{"data-path":n,path:r=n}=I(e);if(t.indexOf(r)!==0)throw Error(`pathUtils.followPath path ${t} is not within source path ${r}`);let s=t.slice(r.length+1);if(s==="")return e;let i=e,a=s.split(".");for(var l=0;l<a.length;l++){if(fe.Children.count(i.props.children)===0){let c=`element at 0.${a.slice(0,l).join(".")} has no children, so cannot fulfill rest of path ${a.slice(l).join(".")}`;if(o)throw Error(c);console.warn(c);return}if(i=ai(i.props.children,parseInt(a[l])),i===void 0){let c=`model at 0.${a.slice(0,l).join(".")} has no children that fulfill next step of path ${a.slice(l).join(".")}`;if(o)throw Error(c);console.warn(c)}}return i}function Gp(e,t){let o=ie(e,t),n=t.split(".").map(r=>parseInt(r,10));if(o){let r=n.pop(),{children:s}=o.props;if(s.length-1>r)return rt(s[r+1]);{let i=n.pop(),a=ie(e,A(o,"path"));if(a&&typeof i=="number"&&(n=a.props.path.split(".").map(l=>parseInt(l,10)),a.props.children.length-1>i)){let l=a.props.children[i+1];return F(z(l))?rt(l):l}}}return rt(e)}function Up(e,t){let o=t.split(".").map(s=>parseInt(s,10)),n=o.pop(),r=ie(e,t);if(r!=null&&typeof n=="number"){let{children:s}=r.props;if(n>0)return st(s[n-1]);for(;o.length>1;)if(n=o.pop(),r=ie(e,A(r,"path")),n>0){let i=r.props.children[n-1];return F(z(i))?st(i):i}}return st(e)}function rt(e){if(F(z(e))){let{children:t}=e.props||e;return rt(t[0])}else return e}function st(e){if(F(z(e))){let{children:t}=e.props||e;return st(t[t.length-1])}else return e}function q(e,t,o=!1){if(e===t)return{idx:-1,finalStep:!0};let n=`${e}.`;if(!t.startsWith(n))throw Error("pathUtils nextStep has strayed from the path");let r=o?0:1,s=t.replace(n,"").split(".").map(i=>parseInt(i,10));return{idx:s[0],finalStep:s.length===r}}function N(e,t,o){if(A(e,"path")===t)return e;let n=[];fe.Children.forEach(e.props.children,(s,i)=>{A(s,"path")?n.push(N(s,`${t}.${i}`)):n.push(s)});let r=e.props["data-path"]?"data-path":"path";return fe.cloneElement(e,{[r]:t,...o},n)}import{createElement as ci}from"react";function sn(e){let{id:t,type:o,props:n,children:r}=e,s=li(o),i=!r||r.length===0?null:r.length===1?sn(r[0]):r.map(sn);return ci(s,{...n,key:t},i)}function li(e){let t=ne[e];if(t===void 0)throw Error("componentFromLayout: unknown component type: "+e);return t}function qp(e,t){typeof e=="function"?e(t):e&&(e.current=t)}import an from"react";import{uuid as ln}from"@vuu-ui/vuu-utils";var ui={"data-placeholder":!0,"data-resizeable":!0},it={},ue="auto",Xt={flexBasis:0,flexGrow:1,flexShrink:1,height:ue,width:ue},cn={height:"width",width:"height"},un=(e="row")=>e==="row"?["width","height","column"]:["height","width","row"],pi=e=>typeof e=="string"&&e.endsWith("%"),K=e=>{let{style:{width:t=ue,height:o=ue}=it}=e.props,n=typeof o=="number",r=typeof t=="number";return n&&r?{height:o,width:t}:n?{height:o}:r?{width:t}:void 0};function Yt(e,t,o){let n=cn[t],{style:{[n]:r=ue,...s}=it}=e.props;return o&&o[t]?{...s,...Xt,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...s,...Xt,[n]:r}}function pn(e){let{style:{flex:t,flexGrow:o,flexShrink:n,flexBasis:r}=it}=e.props;return typeof t=="number"||r===0&&o===1&&n===1?!0:typeof r!="number"}function Zt(e,t,o){let n=cn[t],{style:{[t]:r=ue,[n]:s=ue,...i}=it}=e.props;return r!==ue?pi(r)?{flexBasis:0,flexGrow:1,flexShrink:1,[t]:void 0,[n]:s}:{flexBasis:r,flexGrow:0,flexShrink:0,[t]:r,[n]:s}:o&&o[t]?{...i,...Xt,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...i,[n]:s}}function Oe(e,t,o,n,r){let s=[],i=0,a;if(n&&r){let u,[d,p,m,f]=r;[u,a]=t==="column"?[p-n.top,n.bottom-f]:[d-n.left,n.right-m],u&&s.push(re(`${o}.${i++}`,u,{flexGrow:0,flexShrink:0}))}else a=!0;let{version:l=0,style:c}=I(e);return s.push(N(e,`${o}.${i++}`,{version:l+1,style:{...c,flexBasis:"auto",flexGrow:0,flexShrink:0}})),a&&s.push(re(`${o}.${i++}`,0,void 0,{[`data-${t}-placeholder`]:!0})),qt(t,{resizeable:!1,style:{flexBasis:"auto"}},s,o)}var di=(e,t)=>{if(!t)return e===0?1:0};function qt(e,t,o,n){let r=ln(),{flexFill:s,style:i,resizeable:a=!0}=t,{flexBasis:l=s?void 0:"auto"}=i,c=di(l,s);return an.createElement(ne.Flexbox,{id:r,key:r,path:n,flexFill:s,style:{...i,flexDirection:e,flexBasis:l,flexGrow:c,flexShrink:c},resizeable:a},o)}var mi={flexGrow:1,flexShrink:1};function re(e,t,o,n){let r=ln();return an.createElement("div",{...ui,...n,"data-path":e,id:r,key:r,style:{...mi,...o,flexBasis:t}})}var fi={},Be=1,$e=2,hi=e=>typeof e.intrinsicSize=="number",gi=(e,t)=>{let o={};return e.forEach(n=>{o[n]=A(t,n)}),o},at=(e,t,o)=>e.map((n,r)=>{var l;let s=A(n,"resizeable"),{[t]:i}=(l=K(n))!=null?l:fi,a=pn(n);return o?{index:r,flexOpen:a,intrinsicSize:i,resizeable:s,...gi(o,n)}:{index:r,flexOpen:a,intrinsicSize:i,resizeable:s}}),dn=e=>{let t=e.length,o=e.every(hi),n=Array(t).fill(0);if(o&&(n[0]=$e,n[t-1]=$e),t<2)return n;for(let r=0,s=0;r<t-1;r++)e[r].resizeable&&!s&&(s=Be),n[r]+=s;for(let r=t-1;r>0&&(n[r]&Be&&(n[r]-=Be),!e[r].resizeable);r--);return n},mn=(e,t)=>{let o=bi(e,t),n=xi(e,t),r=o!==-1&&n!==-1?[o,n]:void 0,s=yi(e,r);return[r,s]};function yi(e,t){if(t){let o=[];for(let n=0;n<e.length;n++)e[n].flexOpen&&!t.includes(n)&&o.push(n);return o}}function bi(e,t){let o=t,n=!1;for(;o>=1&&!n;)o=o-1,n=fn(e,o);return o}function xi(e,t){let o=t,n=!1,r=e.length;for(;o<r&&!n;)o=o+1,n=fn(e,o);return o===r?-1:o}function fn(e,t){let{placeholder:o,splitter:n,resizeable:r,intrinsicSize:s}=e[t];return Boolean(!n&&!s&&(o||r))}var wi=e=>!e.splitter&&!e.placeholder,yn=({children:e,onSplitterMoved:t,style:o})=>{let n=ct(),r=ct(),s=ct(),i=ct([]),[,a]=Ri({}),l=b=>{s.current=b,a({})},c=(o==null?void 0:o.flexDirection)==="column",u=c?"height":"width",d=hn(()=>Array.isArray(e)?e:Ne.isValidElement(e)?[e]:[],[e]),p=lt(b=>{let{current:h}=r;if(h){let[S,R]=mn(h,b);S&&(S.forEach(y=>{var E;let x=(E=n.current)==null?void 0:E.childNodes[y];if(x){let{size:T,minSize:D}=Pi(x,u);h[y].currentSize=T,h[y].minSize=D}}),R&&R.forEach(y=>{var E;let x=(E=n.current)==null?void 0:E.childNodes[y];if(x){let{[u]:T}=x.getBoundingClientRect();h[y].flexBasis=T}}))}},[u]),m=lt((b,h)=>{s.current&&r.current&&l(vi(s.current,r.current,h,u))},[u]),f=lt(()=>{let b=r.current;b&&(t==null||t(b.filter(wi))),b==null||b.forEach(h=>{h.currentSize=void 0,h.flexBasis=void 0,h.flexOpen=!1})},[t]),g=lt(b=>Ne.createElement(tn,{column:c,index:b,key:`splitter-${b}`,onDrag:m,onDragEnd:f,onDragStart:p}),[m,f,p,c]);return hn(()=>{let[b,h]=Si(d,u,g,i.current);r.current=h,s.current=b},[d,g,u]),{content:s.current||[],rootRef:n}};function Si(e,t,o,n){let r=at(e,t),s=dn(r),i=[],a=[];for(let l=0;l<e.length;l++){let c=e[l];if(l===0&&s[l]&$e&&(i.push(gn(l)),a.push({placeholder:!0,shim:!0})),c.key==null){let u=n[l]||(n[l]=Ei());i.push(Ne.cloneElement(c,{key:u}))}else i.push(c);a.push(r[l]),l>0&&s[l]&$e?(i.push(gn(l)),a.push({placeholder:!0})):s[l]&Be&&(i.push(o(i.length)),a.push({splitter:!0}))}return[i,a]}function vi(e,t,o,n){return Ti(t,o)?e.map((s,i)=>{let a=t[i],{currentSize:l,flexOpen:c,flexBasis:u}=a,d=l!==void 0;if(d||c){let{flexBasis:p}=s.props.style||{},m=d?a.currentSize:u;return m!==p?Ne.cloneElement(s,{style:{...s.props.style,flexBasis:m,[n]:"auto"}}):s}else return s}):e}function Ti(e,t){let o=[];e.forEach((u,d)=>{u.currentSize!==void 0&&o.push(d)});let n=t<0?o[0]:o[1],{currentSize:r=0,minSize:s=0}=e[n];if(r===s)return!1;if(Math.abs(t)>r-s){let u=t<0?-1:1;t=Math.max(0,r-s)*u}let i=e[o[0]],{currentSize:a=0}=i;i.currentSize=a+t;let l=e[o[1]],{currentSize:c=0}=l;return l.currentSize=c-t,!0}function gn(e){return Ne.createElement(nt,{shim:e===0,key:`placeholder-${e}`})}function Pi(e,t){let{[t]:o}=e.getBoundingClientRect(),r=getComputedStyle(e).getPropertyValue(`min-${t}`),s=r.endsWith("px")?parseInt(r,10):0;return{size:o,minSize:s}}import{jsx as Ci}from"react/jsx-runtime";var Jt="hwFlexbox",bn=Li(function(t,o){let{breakPoints:n,children:r,column:s,className:i,flexFill:a,gap:l,fullPage:c,id:u,onSplitterMoved:d,resizeable:p,row:m,spacing:f,splitterSize:g,style:b,...h}=t,{content:S,rootRef:R}=yn({children:r,onSplitterMoved:d,style:b}),y=Mi(Jt,i,{[`${Jt}-column`]:s,[`${Jt}-row`]:m,"flex-fill":a,"full-page":c});return Ci("div",{...h,className:y,"data-resizeable":p||void 0,id:u,ref:Di(R,o),style:{...b,gap:l,"--spacing":f},children:S})});bn.displayName="Flexbox";var He=bn;import{useCallback as sl}from"react";var Se={ADD:"add",BLUR:"blur",BLUR_SPLITTER:"blur-splitter",DRAG_START:"drag-start",DRAG_STARTED:"drag-started",DRAG_DROP:"drag-drop",FOCUS:"focus",FOCUS_SPLITTER:"focus-splitter",INITIALIZE:"initialize",MAXIMIZE:"maximize",MINIMIZE:"minimize",REMOVE:"remove",REPLACE:"replace",RESTORE:"restore",SAVE:"save",SET_TITLE:"set-title",SPLITTER_RESIZE:"splitter-resize",SWITCH_TAB:"switch-tab",TEAR_OUT:"tear-out"};import{useCallback as go,useContext as vr,useEffect as tl,useRef as wr,useState as ol}from"react";import _n from"react";import We from"react";import{uuid as Pn}from"@vuu-ui/vuu-utils";import{uuid as wn}from"@vuu-ui/vuu-utils";import Fe,{cloneElement as Ii}from"react";import{useCallback as ve}from"react";var V=new Map,X=new Map,xn=e=>V.get(e),Rn=e=>V.has(e),En=(e,t)=>V.set(e,t),Te=()=>{let e=ve((i,a)=>{let l=X.get(i);if(l)return a!==void 0&&l[a]!==void 0?l[a]:a!==void 0?void 0:l},[]),t=ve((i,a,l)=>{if(a===void 0)X.set(i,l);else if(X.has(i)){let c=X.get(i);X.set(i,{...c,[a]:l})}else X.set(i,{[a]:l})},[]),o=ve((i,a)=>{if(X.has(i)){if(a===void 0)X.delete(i);else if(X.get(i)[a]){let{[a]:c,...u}=X.get(i);Object.keys(u).length>0?X.set(i,u):X.delete(i)}}},[]),n=ve((i,a)=>{let l=V.get(i);if(l)return a!==void 0?l[a]:l},[]),r=ve((i,a,l)=>{if(a===void 0)V.set(i,l);else if(V.has(i)){let c=V.get(i);V.set(i,{...c,[a]:l})}else V.set(i,{[a]:l})},[]),s=ve((i,a)=>{if(V.has(i)){if(a===void 0)V.delete(i);else if(V.get(i)[a]){let{[a]:c,...u}=V.get(i);Object.keys(u).length>0?V.set(i,u):V.delete(i)}}},[]);return{loadSessionState:e,loadState:n,saveSessionState:t,saveState:r,purgeState:s,purgeSessionState:o}};var Sn=e=>e.flexDirection==="column"?["height","width"]:["width","height"],Ai={},Ve=(e,t="0")=>{let[o,n]=eo(z(e),e.props,t);return Fe.cloneElement(e,o,n)},Qt=(e,t)=>{let o=z(e),[n,r]=eo(o,e.props,"0",void 0,t);return Ii(e,n,r)};function zi(e,t,o="0",n=null,r){var g,b;let{active:s=0,"data-path":i,path:a=i,id:l,style:c}=I(r),u=z(r)===e&&o===a,d=u?l:(g=t.id)!=null?g:wn(),p=e==="Stack"?(b=t.active)!=null?b:s:void 0,m=d,f=u?c:Oi(e,t,n);return jo(e)?{id:d,key:m,path:o,style:f,type:e,active:p}:{id:d,key:m,style:f,"data-path":o}}function eo(e,t,o,n=null,r){var c,u;let s=zi(e,t,o,n,r);if(t.layout&&!r)return[s,[ut(t.layout,`${o}.0`)]];let i=(u=r==null?void 0:r.children)!=null?u:(c=r==null?void 0:r.props)==null?void 0:c.children,l=t.dropTarget&&i?i:ki(e,t.children,o,i);return[s,l]}function ki(e,t,o="0",n){let r=Array.isArray(t)?t:Fe.isValidElement(t)?[t]:[];return F(e)?r.map((s,i)=>{let a=z(s),l=z(n==null?void 0:n[i]);if(!l||a===l){let[c,u]=eo(a,s.props,`${o}.${i}`,e,n==null?void 0:n[i]);return Fe.cloneElement(s,c,u)}else return n==null?void 0:n[i]}):t}var Oi=(e,t,o)=>{let{style:n=Ai}=t;if(e==="Flexbox"&&(n={flexDirection:t.column?"column":"row",...n,display:"flex"}),n.flex){let{flex:r,...s}=n;n={...s,...Kt(r)}}else o==="Stack"?n={...n,...Kt(1)}:o==="Flexbox"&&(n.width||n.height)&&n.flexBasis===void 0&&(n={...n,flexBasis:"auto",flexGrow:0,flexShrink:0});return n};function ut({id:e=wn(),type:t,children:o,props:n,state:r},s){let i=t.match(/^[a-z]/)?t:ne[t];if(i===void 0)throw Error(`Unable to create component from JSON, unknown type ${t}`);return r&&En(e,r),Fe.createElement(i,{...n,id:e,key:e,path:s},o?o.map((a,l)=>ut(a,`${s}.${l}`)):void 0)}function vn(e){return Tn(e)}function Tn(e){let t=z(e),{id:o,children:n,type:r,...s}=I(e),i=Rn(o)?xn(o):void 0;return{id:o,type:t,props:Bi(s),state:i,children:Fe.Children.map(n,Tn)}}function Bi(e){if(e){let{path:t,...o}=e,n={};for(let[r,s]of Object.entries(o))n[r]=jt(s);return n}}function jt(e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(jt);if(typeof e=="object"&&e!==null){let t={};for(let[o,n]of Object.entries(e))t[o]=jt(n);return t}}function Dn(e,t){var i;let o=e.props.children,n=o.length,{index:r=-1,positionRelativeToTab:s="after"}=t.tab||{};return r===-1||r>=n?[o[n-1],"after"]:[(i=o[r])!=null?i:null,s]}function pt(e,t,o){let{active:n,children:r=[],path:s}=I(e),i=A(t,"path"),{idx:a,finalStep:l}=q(s,i,!0),[c,u]=l?$i(e,r,o):[n,r==null?void 0:r.map((p,m)=>m===a?pt(p,t,o):p)],d=z(e)==="Stack"?Array.isArray(c)?c[0]:c:n;return We.cloneElement(e,{active:d},u)}function $i(e,t,o){let n=A(e,"path"),r=t==null?void 0:t.length,{id:s=Pn()}=I(o);return r?[r,t.concat(N(o,`${n}.${r}`,{id:s,key:s}))]:[0,[N(o,`${n}.0`,{id:s})]]}function dt(e,t,o,n,r,s,i){let{active:a,children:l,path:c}=I(e),u=A(t,"path"),{idx:d,finalStep:p}=q(c,u),[m,f]=p?Ni(e,l,d,o,n,r,s,i):[a,l.map((b,h)=>h===d?dt(b,t,o,n,r,s,i):b)],g=z(e)==="Stack"?m:a;return We.cloneElement(e,{active:g},f)}function Ni(e,t,o,n,r,s,i,a){let l=K(n);return(l==null?void 0:l.width)&&(l==null?void 0:l.height)?Fi(e,t,o,n,r,i,a):Mn(e,t,o,n,r,(s==null?void 0:s.width)||(s==null?void 0:s.height),i)}var Hi=(e,t,{top:o,right:n,bottom:r,left:s},[i,a,l,c])=>{if(e==="column"&&t==="before")return a-o;if(e==="column")return r-c;if(e==="row"&&t==="before")return i-s;if(e==="row")return n-l};function Fi(e,t,o,n,r,s,i){let{style:{flexDirection:a}}=I(e),[l,c,u]=un(a),{[c]:d,[l]:p}=K(n),m=A(t[o],"path"),f=Hi(a,r,s,i),[g,b]=d<s[c]?[Oe(n,u,m,s,i),p]:[n,void 0],h=f?re(m,f,{flexGrow:0,flexShrink:0}):void 0;return d>s[c]&&(t=t.map(S=>{if(A(S,"placeholder"))return S;{let{[c]:R}=K(S);return R&&R<d?Oe(S,u,A(S,"path")):S}})),Mn(e,t,o,g,r,b,s,h)}function Mn(e,t,o,n,r,s,i,a){let l=A(e,"path"),c=0,u=!t||t.length===0?[n]:t.reduce((d,p,m)=>{if(o===m){let[f,g]=Vi(e,p,n,i);r==="before"?a?d.push(a,g,f):d.push(g,f):a?d.push(f,g,a):d.push(f,g),c=d.indexOf(g)}else d.push(p);return d},[]).map((d,p)=>p<c?d:N(d,`${l}.${p}`));return[c,u]}function Vi(e,t,o,n){let{id:r=Pn(),version:s=0}=I(o);if(s+=1,z(e)==="Flexbox"){let[i]=Sn(e.props.style),a=6,l={[i]:(n[i]-a)/2},c=Zt(t,i,l),u=Zt(o,i,l);return[We.cloneElement(t,{style:c}),We.cloneElement(o,{id:r,version:s,style:u})]}else{let{style:{left:i,top:a,flex:l,...c}={left:void 0,top:void 0,flex:void 0}}=I(o);return[t,We.cloneElement(o,{id:r,version:s,style:c})]}}var Y={ADD:"add",DRAG_START:"drag-start",DRAG_DROP:"drag-drop",MAXIMIZE:"maximize",MINIMIZE:"minimize",REMOVE:"remove",REPLACE:"replace",RESTORE:"restore",SAVE:"save",SET_TITLE:"set-title",SPLITTER_RESIZE:"splitter-resize",SWITCH_TAB:"switch-tab",TEAROUT:"tearout"};import he from"react";import mt from"react";function Ln(e,{target:t,replacement:o}){return to(e,t,o)}function to(e,t,o){let n=A(t,"path"),r=A(t,"resizeable"),{style:s}=I(t),i=Ve(mt.cloneElement(o,{resizeable:r,style:{...s,...o.props.style}}),n);return J(e,t,i)}function J(e,t,o,n){if(e===t)return o;{let{idx:r,finalStep:s}=q(A(e,"path"),A(t,"path")),i=e.props.children.slice();return s?n?n===Se.MINIMIZE?i[r]=Wi(e,i[r]):n===Se.RESTORE&&(i[r]=_i(i[r])):i[r]=o:i[r]=J(i[r],t,o,n),mt.cloneElement(e,void 0,i)}}function Wi(e,t){let{style:o}=I(e),{style:n}=I(t),{width:r,height:s,flexBasis:i,flexShrink:a,flexGrow:l,...c}=n,u={width:r,height:s,flexBasis:i,flexShrink:a,flexGrow:l},d={...c,flexBasis:0,flexGrow:0,flexShrink:0},p=o.flexDirection==="row"?"vertical":o.flexDirection==="column"?"horizontal":!1;return p?mt.cloneElement(t,{collapsed:p,restoreStyle:u,style:d}):t}function _i(e){let{style:t,restoreStyle:o}=I(e),{flexBasis:n,flexShrink:r,flexGrow:s,...i}=t,a={...i,...o};return mt.cloneElement(e,{collapsed:!1,style:a,restoreStyle:void 0})}function oo(e,{path:t}){let o=_(e,t),n=ie(e,t);if(n===null)return e;let{children:r}=I(n);if(r.length>1&&In(r,t)){let{style:{flexBasis:s,display:i,flexDirection:a,...l}}=I(n),c=A(n,"path"),u=J(e,n,re(c,s,l));for(;(n=ie(u,c))&&A(n,"path")!=="0";){let{children:d}=I(n);if(In(d)){c=A(n,"path");let{style:{flexBasis:p,display:m,flexDirection:f,...g}}=I(n);u=J(e,n,re(c,p,g))}else if(Xi(d))u=kn(e,n);else break}return u}else return An(e,o)}function An(e,t){let{active:o,children:n,path:r,preserve:s}=I(e),{idx:i,finalStep:a}=q(r,A(t,"path")),l=z(e),c=n.slice();if(a){if(c.splice(i,1),o!==void 0&&o>=i&&(o=Math.max(0,o-1)),c.length===1&&!s&&r!=="0"&&l.match(/Flexbox|Stack/))return Gi(e,c[0]);!c.some(Ui)&&c.some(zn)&&(c=Ki(c))}else c[i]=An(c[i],t);return c=c.map((u,d)=>N(u,`${r}.${d}`)),he.cloneElement(e,{active:o},c)}function Gi(e,t){let o=z(e),{path:n,style:{flexBasis:r,flexGrow:s,flexShrink:i,width:a,height:l}}=I(e),c=N(t,n);if(n==="0")c=he.cloneElement(c,{style:{...t.props.style,width:a,height:l}});else if(o==="Flexbox"){let u=e.props.style.flexDirection==="column"?"height":"width",{style:{[u]:d,...p}}=c.props;c=he.cloneElement(c,{flexFill:void 0,style:{...p,flexGrow:s,flexShrink:i,flexBasis:r,width:a,height:l}})}return c}function Ui(e){return e.props.style.flexGrow>0}function zn(e){let{width:t,height:o,flexGrow:n}=e.props.style;return n===0&&typeof t!="number"&&typeof o!="number"}function Ki(e){return e.map(t=>zn(t)?he.cloneElement(t,{style:{...t.props.style,flexGrow:1}}):t)}var Xi=e=>{if(e&&e.length>0){let t=A(e[0],"placeholder"),o=!1;for(let n=1;n<e.length;n++){if(o=A(e[n],"placeholder"),t&&o)return!0;t=o}}},kn=(e,t)=>{let{children:o,path:n}=I(e),{idx:r,finalStep:s}=q(n,A(t,"path")),i=o.slice();return s?i[r]=Yi(t):i[r]=kn(i[r],t),i=i.map((a,l)=>N(a,`${n}.${l}`)),he.cloneElement(e,void 0,i)},Yi=e=>{let{children:t}=I(e),o=[],n=[];for(let s=0;s<t.length;s++)A(t[s],"placeholder")?n.push(t[s]):(n.length===1?o.push(n.pop()):n.length>0&&(o.push(Cn(n)),n.length=0),o.push(t[s]));n.length===1?o.push(n.pop()):n.length>0&&o.push(Cn(n));let r=A(e,"path");return he.cloneElement(e,void 0,o.map((s,i)=>N(s,`${r}.${i}`)))},Cn=([e,...t])=>{let o=A(e,"style"),{flexBasis:n,flexGrow:r,flexShrink:s}=o;for(let{props:{style:i}}of t)n+=i.flexBasis,r=Math.max(r,i.flexGrow),s=Math.max(s,i.flexShrink);return he.cloneElement(e,{style:{...o,flexBasis:n,flexGrow:r,flexShrink:s}})},In=(e,t)=>e.every(o=>A(o,"placeholder")||t&&A(o,"path")===t);import On from"react";function Bn(e,{path:t,sizes:o}){let n=_(e,t,!0),{children:r,style:s}=I(n),i=s.flexDirection==="column"?"height":"width",a=Zi(r,o,i),l=On.cloneElement(n,void 0,a);return J(e,n,l)}function Zi(e,t,o){return e.map((n,r)=>{let{style:{[o]:s,flexBasis:i}}=I(n),a=t[r],{currentSize:l,flexBasis:c}=a,d=l!==void 0?a.currentSize:c;return d===void 0||s===d||i===d?n:On.cloneElement(n,{style:qi(n.props.style,o,d)})})}function qi(e,t,o){let n=typeof e[t]=="number",{flexShrink:r=1,flexGrow:s=1}=e;return{...e,[t]:n?o:"auto",flexBasis:n?"auto":o,flexShrink:r,flexGrow:s}}import ft from"react";import{uuid as Ji}from"@vuu-ui/vuu-utils";var $n=e=>{let[t]=z(e);return t===t.toLowerCase()};function _e(e,t,o,n,r,s){let{children:i,path:a}=I(e),l=A(t,"path"),{idx:c,finalStep:u}=q(a,l),d=u?ji(e,i,t,o,n,r,s):i.map((p,m)=>m===c?_e(p,t,o,n,r,s):p);return ft.cloneElement(e,void 0,d)}function ji(e,t,o,n,r,s,i){let a=K(n);if((a==null?void 0:a.width)&&(a==null?void 0:a.height)){if(s===void 0||i===void 0)throw Error("wrap-layout-element, updateChildren clientRect and dropRect must both be available");return ea(t,o,n,r,s,i)}else return Qi(e,t,o,n,r)}function Qi(e,t,o,n,r){var E;let{version:s=0}=I(n),i=A(o,"path"),{type:a,flexDirection:l,showTabs:c}=Hn(r),[u,d,p]=ta(a,o,n,l,r),m=Nn(r),f=m?1:0,g={resizeable:!0,style:p,version:s+1},h={[$n(o)?"data-resizeable":"resizeable"]:!0,style:d},S=a==="Stack"?{showTabs:c}:void 0,R=a==="Flexbox"?{splitterSize:(E=z(e)==="Flexbox"&&e.props.splitterSize)!=null?E:void 0}:void 0,y=Ji();var x=ft.createElement(ne[a],{active:f,id:y,key:y,path:A(o,"path"),flexFill:A(o,"flexFill"),...R,...S,style:u,resizeable:A(o,"resizeable")},m?[N(o,`${i}.0`,h),Ve(ft.cloneElement(n,g),`${i}.1`)]:[Ve(ft.cloneElement(n,g),`${i}.0`),N(o,`${i}.1`,h)]);return t.map(T=>T===o?x:T)}function ea(e,t,o,n,r,s){let{flexDirection:i}=Hn(n),a=i==="column"?"row":"column",l=Nn(n),[c,u,d,p]=s,[m,f]=i==="column"?[u-r.top,r.bottom-p]:[c-r.left,r.right-d],g=A(t,"path"),b=0,h=$n(t)?"data-resizeable":"resizeable",S=[];m&&S.push(l?N(t,`${g}.${b++}`,{[h]:!0,style:{flexBasis:m,flexGrow:1,flexShrink:1}}):re(`${g}.${b++}`,m,{flexGrow:0,flexShrink:0})),S.push(Oe(o,a,`${g}.${b++}`,r,s)),f&&S.push(l?re(`${g}.${b++}`,0):N(t,`${g}.${b++}`,{[h]:!0,style:{flexBasis:0,flexGrow:1,flexShrink:1}}));let R=qt(i,t.props,S,g);return e.map(y=>y===t?R:y)}function ta(e,t,o,n,r){let s={...t.props.style,flexDirection:n},i=e==="Flexbox"&&n==="column"?"height":"width",a=Yt(o,i,r),l=Yt(t,i);return[s,l,a]}var Nn=e=>{var t;return e.position.SouthOrEast?!0:((t=e==null?void 0:e.tab)==null?void 0:t.positionRelativeToTab)==="before"?!1:!!e.position.Header};function Hn(e){return e.position.Header?{type:"Stack",flexDirection:"column",showTabs:!0}:{type:"Flexbox",flexDirection:e.position.EastOrWest?"row":"column"}}var Gn=(e,t)=>{switch(t.type){case Y.ADD:return ia(e,t);case Y.DRAG_DROP:return sa(e,t);case Y.MAXIMIZE:return ra(e,t);case Y.REMOVE:return oo(e,t);case Y.REPLACE:return Ln(e,t);case Y.SET_TITLE:return na(e,t);case Y.SPLITTER_RESIZE:return Bn(e,t);case Y.SWITCH_TAB:return oa(e,t);default:return console.warn(`layoutActionHandlers. No handler for action.type ${t.type}`),e}};function oa(e,{path:t,nextIdx:o}){var n=_(e,t,!0);let r=_n.cloneElement(n,{active:o});return J(e,n,r)}function na(e,{path:t,title:o}){var n=_(e,t,!0);let r=_n.cloneElement(n,{title:o});return J(e,n,r)}function ra(e,{path:t,type:o}){if(t){var n=_(e,t,!0);return J(e,n,n,o)}else return e}function sa(e,t){var p,m;console.log("drag drop");let{draggedReactElement:o,dragInstructions:n,dropTarget:r}=t,s=r.component,{pos:i}=r,a=((p=i==null?void 0:i.position)==null?void 0:p.Header)&&z(s)==="Stack",{id:l,version:c}=I(o),u=K(o),d;if(a){let[f,g]=Dn(s,i);f===void 0?d=pt(e,s,o):d=dt(e,f,o,g)}else!u&&((m=i==null?void 0:i.position)==null?void 0:m.Centre)?d=to(e,s,o):d=aa(e,r,o);if(n.DoNotRemove)return d;{let f=ae(d,b=>b.id===l&&b.version===c),g=A(f,"path");return oo(d,{path:g,type:"remove"})}}function ia(e,{path:t,component:o}){return pt(e,_(e,t),o)}function aa(e,t,o){let{component:n,pos:r,clientRect:s,dropRect:i}=t,a=A(n,"path");if(a==="0.0")return _e(e,n,o,r);var l=ie(e,a);if(Fn(r,l)){let c=r.position.SouthOrEast?"after":"before";return dt(e,n,o,c,r,s,i)}else if(Fn(r,l)){if(F(z(l)))return _e(e,n,o,r);throw Error(`no support right now for position = ${r.position}`)}else return _e(e,n,o,r,s,i);return e}function Fn(e,t){return e.position.Centre?Wn(t)||Vn(t):e.position.NorthOrSouth?Vn(t):e.position.EastOrWest?Wn(t):!1}function Vn(e){return z(e)==="Flexbox"&&e.props.style.flexDirection==="column"}function Wn(e){return z(e)==="Flexbox"&&e.props.style.flexDirection!=="column"}import{createContext as la}from"react";var ca=e=>console.log(`dispatch ${e.type}, have you forgotten to provide a LayoutProvider ?`),Ge=la({dispatchLayoutProvider:ca,version:-1});import{useCallback as Dt,useRef as ho}from"react";var ye={north:1,east:2,south:4,west:8,header:16,centre:32,absolute:64},Ue={AFTER:"after",BEFORE:"before"},W=Object.freeze({North:ge("north"),East:ge("east"),South:ge("south"),West:ge("west"),Header:ge("header"),Centre:ge("centre"),Absolute:ge("absolute")});function ge(e){return Object.freeze({offset:e==="north"||e==="west"?0:e==="south"||e==="east"?1:NaN,valueOf:function(){return ye[e]},toString:function(){return e},North:e==="north",South:e==="south",East:e==="east",West:e==="west",Header:e==="header",Centre:e==="centre",NorthOrSouth:e==="north"||e==="south",EastOrWest:e==="east"||e==="west",NorthOrWest:e==="north"||e==="west",SouthOrEast:e==="east"||e==="south",Absolute:e==="absolute"})}var Un=W.North,Kn=W.South,no=W.East,ro=W.West,ua=W.Header,pa=W.Centre,Pe=class{static measure(t,o=[]){var n={};return fa(t,n,o),n}static allBoxesContainingPoint(t,o,n,r,s){return qn(t,o,n,r,s).reverse()}};function so(e,t,o,n=30){let r=o.right-o.left,s=o.bottom-o.top,i=e-o.left,a=t-o.top,l=0;return i<n&&(l+=8),i>r-n&&(l+=2),a<n&&(l+=1),a>s-n&&(l+=4),{pctX:i/r,pctY:a/s,closeToTheEdge:l}}function io(e,t,o,n){let{BEFORE:r,AFTER:s}=Ue,{pctX:i,pctY:a,closeToTheEdge:l}=so(e,t,o),c,u;if(n==="row")c=i<.5?ro:no;else if(o.header&&ht(o.header,e,t))if(c=ua,o.Stack){let d=o.Stack.length;if(d===0)u={index:-1,left:o.left,positionRelativeToTab:s,width:0};else{let p=o.Stack.find(({left:m,right:f})=>e>=m&&e<=f);if(p){let m=p.right-p.left;u={index:o.Stack.indexOf(p),left:p.left,positionRelativeToTab:(e-p.left)/m<.5?r:s,width:m}}else u={left:o.Stack[d-1].right,width:0,index:d,positionRelativeToTab:s}}}else if(o.header.titleWidth){let d=o.header.titleWidth;u={index:-1,left:o.left,positionRelativeToTab:(e-o.left)/d<.5?r:s,width:d}}else u={left:o.left,width:0,positionRelativeToTab:r,index:-1};else c=da(e,t,o,i,a);return{position:c,x:e,y:t,closeToTheEdge:l,tab:u}}function da(e,t,o,n,r){let s=ma(o,.2);if(ht(s,e,t))return pa;switch(`${r<.5?"north":"south"}${n<.5?"west":"east"}`){case"northwest":return n>r?Un:ro;case"northeast":return 1-n>r?Un:no;case"southeast":return n>r?no:Kn;case"southwest":return 1-n>r?ro:Kn;default:}}function ma({right:e,left:t,top:o,bottom:n},r){let s=(1-r)/2,i=(e-t)*s,a=(n-o)*s;return{left:t+i,top:o+a,right:e-i,bottom:n-a}}function fa(e,t,o){let{id:n,"data-path":r,path:s=r}=I(e),i=z(e);if(n&&s){let[a,l]=Zn(e);Xn(e,a,l,t),F(i)&&Yn(e,t,o)}}function Xn(e,t,o,n){let{"data-path":r,path:s=r,header:i}=I(e);n[s]=t;let a=z(e);if(i||a==="Stack"){let l=o.querySelector(".vuuHeader");if(l){let{top:c,left:u,right:d,bottom:p}=l.getBoundingClientRect();if(n[s].header={top:Math.round(c),left:Math.round(u),right:Math.round(d),bottom:Math.round(p)},a==="Stack")n[s].Stack=Array.from(l.querySelectorAll(".saltTab")).map(m=>m.getBoundingClientRect()).map(({left:m,right:f})=>({left:m,right:f}));else{let m=l.querySelector('[class^="vuuHeader-title"]'),{header:f}=n[s];m&&f&&(f.titleWidth=m.clientWidth)}}}return n[s]}function Yn(e,t,o,n=0,r=0,s=0,i=0){let{children:a,"data-path":l,path:c=l,style:u,active:d=0}=I(e),p=z(e),m=p==="Flexbox",f=p==="Stack",g=m&&u.flexDirection==="column",b=m&&u.flexDirection==="row",S=(f?a.filter((y,x)=>x===d):a.filter(ha)).map(y=>{let[x,E]=Zn(y);return[{...x,top:x.top-s,right:x.right+r,bottom:x.bottom+i,left:x.left-n},E,y]}),R=S.map(([y,x,E],T,D)=>{let P,M,w,v,L,C,k=D.length-1;b?(L=T===0?0:y.left-D[T-1][0].right,C=T===k?0:D[T+1][0].left-y.right,P=T===0||L===0?0:L,M=T===k||C===0?0:C-C/2,y.left-=P,y.right+=M,w=s,v=i):g&&(L=T===0?0:y.top-D[T-1][0].bottom,C=T===k?0:D[T+1][0].top-y.bottom,w=T===0||L===0?0:L,v=T===k||C===0?0:C-C/2,y.top-=w,y.bottom+=v,P=n,M=r);let B=Xn(E,y,x,t),$=z(E);return F($)&&Yn(E,t,o,P,M,w,v),B});S.length&&(t[c].children=R)}function ha(e){let{id:t}=I(e),o=document.getElementById(t);return o?o.dataset.dragging!=="true":(console.warn(`BoxModel: no element found with id #${t}`),!1)}function Zn(e){let{id:t}=I(e),o=z(e),n=document.getElementById(t);if(!n)throw Error(`No DOM for ${o} ${t}`);let{top:r,left:s,right:i,bottom:a,height:l,width:c}=n.getBoundingClientRect(),u;if(F(o)){let d=n.scrollHeight;d>l&&(u={id:t,scrollHeight:d,scrollTop:n.scrollTop})}return[{top:Math.round(r),left:Math.round(s),right:Math.round(i),bottom:Math.round(a),height:Math.round(l),width:Math.round(c),scrolling:u},n,e]}function qn(e,t,o,n,r,s=[]){let{children:i,"data-path":a,path:l=a}=I(e),c=z(e);var u=t[l];if(!ht(u,o,n))return s;if(r&&r.length){if(r.includes(l))s.push(e);else if(!r.some(p=>p.startsWith(l)))return s}else s.push(e);if(!F(c)||u.header&&ht(u.header,o,n))return s;u.scrolling&&ga(u,o,n);for(var d=0;d<i.length;d++){if(c==="Stack"&&e.props.active!==d)continue;let p=qn(i[d],t,o,n,r);if(p.length)return s.concat(p)}return s}function ht(e,t,o){if(e)return t>=e.left&&t<e.right&&o>=e.top&&o<e.bottom}function ga({top:e,bottom:t,scrolling:o},n,r){if(o){let{id:s,scrollTop:i,scrollHeight:a}=o,l=t-e;if(i===0&&t-r<50){let c=a-l;document.getElementById(s).scrollTo({left:0,top:c,behavior:"smooth"}),o.scrollTop=c}else if(i>0&&r-e<50)document.getElementById(s).scrollTo({left:0,top:0,behavior:"smooth"}),o.scrollTop=0;else return!1}else return!1}var ya=.4,gt=class{constructor(t,o,n,r,s){this.init(t,o,n,r,s)}init(t,o,n,r,s){var{left:i,top:a}=r,{pctX:l,pctY:c}=so(o,n,r),u=ya,d=l*r.width,p=r.width-d,m=c*r.height,f=r.height-m,g=r.width*u,b=r.height*u,h=1-u,S=d*h,R=m*h,y=p*h,x=f*h;this.intrinsicSize=s,this.constraint={zone:{x:{lo:t.left,hi:t.right},y:{lo:t.top,hi:t.bottom}},pos:{x:{lo:t.left-S,hi:t.right-r.width+y},y:{lo:t.top-R,hi:t.bottom-r.height+x}},mouse:{x:{lo:t.left+g*l,hi:t.right-g*(1-l)},y:{lo:t.top+b*c,hi:t.bottom-b*(1-c)}}},this.x={pos:i,lo:!1,hi:!1,mousePos:o,mousePct:l},this.y={pos:a,lo:!1,hi:!1,mousePos:n,mousePct:c}}outOfBounds(){return this.x.lo||this.x.hi||this.y.lo||this.y.hi}inBounds(){return!this.outOfBounds()}dropX(){return this.dropXY("x")}dropY(){return this.dropXY("y")}hasIntrinsicSize(){var t,o;return((t=this==null?void 0:this.intrinsicSize)==null?void 0:t.height)&&((o=this==null?void 0:this.intrinsicSize)==null?void 0:o.width)}update(t,o){var n=this[t],r=this.constraint.mouse[t],s=this.constraint.pos[t],i=n.pos,a=o-n.mousePos;return a<0?n.lo||(o<r.lo?(n.lo=!0,n.pos=s.lo):n.hi?o<r.hi&&(n.hi=!1,n.pos+=a):n.pos+=a):a>0&&(n.hi||(o>r.hi?(n.hi=!0,n.pos=s.hi):n.lo?o>r.lo&&(n.lo=!1,n.pos+=a):n.pos+=a)),n.mousePos=o,i!==n.pos}dropXY(t){var o=this[t],n=this.constraint.zone[t];return o.lo?Math.max(n.lo,o.mousePos):o.hi?Math.min(o.mousePos,Math.round(n.hi)-1):o.mousePos}};var af=e=>e.pos.tab&&z(e.component)==="Stack"&&e.pos.position.Header,{north:ba,south:xa,east:Ra,west:Ea}=ye,wa=Ra+Ea,Sa=ba+xa,pe=class{constructor({component:t,pos:o,clientRect:n,nextDropTarget:r}){this.component=t,this.pos=o,this.clientRect=n,this.nextDropTarget=r,this.active=!1,this.dropRect=void 0}targetTabPos(t){let{left:o,width:n,positionRelativeToTab:r}=t;return r===Ue.BEFORE?o:o+n}getTargetDropOutline(t,o){if(this.pos.tab)return this.getDropTabOutline(t,this.pos.tab);if(o&&o.hasIntrinsicSize())return this.getIntrinsicDropRect(o);{let[n,r,s,i]=this.getDropRectOutline(t,o);return{l:n,t:r,r:s,b:i}}}getDropTabOutline(t,o){let{clientRect:{top:n,left:r,right:s,bottom:i,header:a}}=this,l=0,c=Math.round(t/2)+l,u=Math.round(n),d=Math.round(r+c),p=Math.round(s-c),m=Math.round(i-c),f=this.targetTabPos(o),g=60,b=a.bottom-a.top;return{l:d,t:u,r:p,b:m,tabLeft:f,tabWidth:g,tabHeight:b}}getIntrinsicDropRect(t){var g,b,h,S;let{pos:o,clientRect:n}=this,{x:r,y:s}=t,i=(b=(g=t.intrinsicSize)==null?void 0:g.height)!=null?b:0,a=(S=(h=t.intrinsicSize)==null?void 0:h.height)!=null?S:0;i&&i>n.height?(console.log("DropTarget: we're going to blow the gaff"),i=n.height):a&&a>n.width&&(console.log("DropTarget: we're going to blow the gaff"),a=n.width);let l=Math.min(n.right-a,Math.max(n.left,Math.round(o.x-r.mousePct*a))),c=Math.min(n.bottom-i,Math.max(n.top,Math.round(o.y-s.mousePct*i))),[u,d,p,m]=this.dropRect=[l,c,l+a,c+i],f=o.position.EastOrWest?[u,n.top,u,n.bottom,p,n.top,p,n.bottom]:[n.left,d,n.right,d,n.left,m,n.right,m];return{l:u,r:p,t:d,b:m,guideLines:f}}getDropRectOutline(t,o){var S,R,y;let{pos:n,clientRect:r}=this,{width:s,height:i,position:a}=n,{width:l,height:c}=(S=o==null?void 0:o.intrinsicSize)!=null?S:{},u=(R=c!=null?c:i)!=null?R:0,d=(y=l!=null?l:s)!=null?y:0;this.dropRect=void 0;let{top:p,left:m,right:f,bottom:g}=r,b=0,h=Math.round(t/2)+b;switch(a){case W.North:case W.Header:{let x=Math.round((g-p)/2),E=u?Math.min(x,Math.round(u)):x;return d&&m+d<f?[m+h,p+h,m+d-h,p+h+E]:[m+h,p+h,f-h,p+h+E]}case W.West:{let x=Math.round((f-m)/2),E=d?Math.min(x,Math.round(d)):x;return u&&p+u<g?[m+h,p+h,m-h+E,p+u+h]:[m+h,p+h,m-h+E,g-h]}case W.East:{let x=Math.round((f-m)/2),E=d?Math.min(x,Math.round(d)):x;return u&&p+u<g?[f-h-E,p+h,f-h,p+u+h]:[f-h-E,p+h,f-h,g-h]}case W.South:{let x=Math.round((g-p)/2),E=u?Math.min(x,Math.round(u)):x;return d&&m+d<f?[m+h,g-h-E,m+d-h,g-h]:[m+h,g-h-E,f-h,g-h]}case W.Centre:return[m+h,p+h,f-h,g-h];default:return console.warn(`DropTarget does not recognize position ${a}`),null}}activate(){return this.active=!0,this}toArray(){let t=this,o=[t];for(;t=t.nextDropTarget;)o.push(t);return o}static getActiveDropTarget(t){return t===null?null:t!=null&&t.active?t:pe.getActiveDropTarget(t.nextDropTarget)}};function ao(e,t,o,n,r,s){var l;let i=null,a=Pe.allBoxesContainingPoint(o,n,e,t,s);if(a.length){let[c,...u]=a,{"data-path":d,path:p=d,"data-row-placeholder":m}=I(c),f=n[p],b=io(e,t,f,r&&m?"row":void 0),h=n[p],S=([R,...y])=>{var x,E;if(((x=b.position)==null?void 0:x.Header)||b.closeToTheEdge){let T=va(R,b,h,n,e,t);if(T){let[D,P]=T;return new pe({component:R,pos:D,clientRect:P,nextDropTarget:(E=S(y))!=null?E:null})}else if(y.length)return S(y)}};i=new pe({component:c,pos:b,clientRect:f,nextDropTarget:(l=S(u))!=null?l:null}).activate()}return i}function va(e,{closeToTheEdge:t,position:o},n,r,s,i){if(!e||e.type==="DraggableLayout")return;let a=r[e.props.path],l=t&ye.north,c=t&ye.east,u=t&ye.south,d=t&ye.west,p=(l||o.Header)&&Math.round(n.top)===Math.round(a.top),m=c&&Math.round(n.right)===Math.round(a.right),f=u&&Math.round(n.bottom)===Math.round(a.bottom),g=d&&Math.round(n.left)===Math.round(a.left);if(p||m||f||g){let{"data-path":b,path:h=b}=e.props,S=r[h],R=io(s,i,S);if((Ta(e)||Jn(e))&&t&wa)return R.width=120,[R,S];if((Pa(e)||Jn(e))&&(o.Header||t&Sa))return R.height=120,[R,S]}}function Jn(e){return z(e)==="Stack"}function Ta(e){return z(e)==="Flexbox"&&e.props.style.flexDirection==="column"}function Pa(e){return z(e)==="Flexbox"&&e.props.style.flexDirection==="row"}import lo,{createElement as nr,useEffect as za,useRef as or}from"react";import Ke from"react-dom";import{useLayoutEffect as er,useMemo as Aa}from"react";import*as tr from"react-dom";import*as jn from"react-dom";import{SaltProvider as Da}from"@salt-ds/core";import{jsx as Ia}from"react/jsx-runtime";var Ma=1,La=(e=0,t=0,o=window)=>{let n=o.document.createElement("div");return n.className="vuuPopup "+Ma++,n.style.cssText=`left:${e}px; top:${t}px;`,o.document.body.appendChild(n),n},Ca=(e,t)=>La(e,t),yt=(e,t,o,n,r)=>{t.style.cssText=`left:${o}px; top:${n}px;position: absolute;`,jn.render(Ia(Da,{applyClassesTo:"child",children:e}),t,r)},Qn=Ca;var bt=function({children:t,x:o=0,y:n=0,onRender:r}){let s=Aa(()=>Qn(),[]);return er(()=>{yt(t,s,o,n,r)},[t,r,s,o,n]),er(()=>()=>{var i;s&&(tr.unmountComponentAtNode(s),s.classList.contains("vuuPopup")&&((i=s.parentElement)==null||i.removeChild(s)))},[s]),null};import ka from"classnames";window.popupReact=lo;var be=!1,j=[];function Rt(e){e.keyCode===27&&(j.length?sr():be&&Ke.unmountComponentAtNode(document.body.querySelector(".vuuDialog")))}function rr(e){if(j.length){let t=document.body.querySelectorAll(".vuuPopup");for(let o=0;o<t.length;o++)if(t[o].contains(e.target))return;sr()}}function sr(){if(j.length){let e=document.body.querySelectorAll(".vuuPopup");for(let t=0;t<e.length;t++)Ke.unmountComponentAtNode(e[t]);ir("*")}}function Oa(){be===!1&&(be=!0,window.addEventListener("keydown",Rt,!0))}function Ba(){be&&(be=!1,window.removeEventListener("keydown",Rt,!0))}function $a(e){j.indexOf(e)===-1&&(j.push(e),be===!1&&(window.addEventListener("keydown",Rt,!0),window.addEventListener("click",rr,!0)))}function ir(e){if(j.length){if(e==="*")j.length=0;else{let t=j.indexOf(e);t!==-1&&j.splice(t,1)}j.length===0&&be===!1&&(window.removeEventListener("keydown",Rt,!0),window.removeEventListener("click",rr,!0))}}var Na=({children:e,position:t,style:o})=>{let n=ka("hwPopup","hwPopupContainer",t);return nr("div",{className:n,style:o},e)},Ha=1,G=class{static showPopup({name:t="anon",group:o="all",position:n="",left:r=0,right:s="auto",top:i=0,width:a="auto",component:l}){if(!l)throw Error("PopupService showPopup, no component supplied");$a(t,o);let c=document.body.querySelector(".vuuPopup."+o);c===null&&(c=document.createElement("div"),c.className="vuuPopup "+o,document.body.appendChild(c));let u={width:a};yt(nr(Na,{key:Ha++,position:n,style:u},l),c,r,i,()=>{G.keepWithinThePage(c,s)})}static hidePopup(t="anon",o="all"){j.indexOf(t)!==-1&&(ir(t,o),Ke.unmountComponentAtNode(document.body.querySelector(`.vuuPopup.${o}`)))}static keepWithinThePage(t,o="auto"){let n=t.querySelector(".vuuPopupContainer > *");if(n){let{top:r,left:s,width:i,height:a,right:l}=n.getBoundingClientRect(),c=window.innerWidth,d=window.innerHeight-(r+a);d<0&&(n.style.top=parseInt(r,10)+d+"px");let p=c-(s+i);if(p<0&&(n.style.left=parseInt(s,10)+p+"px"),typeof o=="number"&&o!==l){let m=o-l;n.style.left=s+m+"px"}}}},xt=class{static showDialog(t){let o=".vuuDialog",n=t.props.onClose;Oa(),Ke.render(lo.cloneElement(t,{container:o,onClose:()=>{xt.closeDialog(),n&&n()}}),document.body.querySelector(o))}static closeDialog(){Ba(),Ke.unmountComponentAtNode(document.body.querySelector(".vuuDialog"))}},Mf=e=>{let t=or(null),o=or(null),n=(r,s)=>{let{name:i,group:a,depth:l,width:c}=r,u,d;if(t.current&&(clearTimeout(t.current),t.current=null),r.close===!0)G.hidePopup(i,a);else{let{position:p,children:m}=r,{left:f,top:g,width:b,bottom:h}=s;p==="below"?(u=f,d=h):p==="above"&&(u=f,d=g),t.current=setTimeout(()=>{G.showPopup({name:i,group:a,depth:l,position:p,left:u,top:d,width:c||b,component:m})},10)}};return za(()=>{if(o.current){let s=o.current.parentElement.getBoundingClientRect();n(e,s)}return()=>{G.hidePopup(e.name,e.group)}},[e]),lo.createElement("div",{className:"popup-proxy",ref:o})};import Fa from"classnames";import{jsx as ar}from"react/jsx-runtime";function lr(e,t=0,o=0){let{pos:n,clientRect:r}=e,s=20;return n.position.West?[r.left-o+s,n.y-t,"left"]:n.position.South?[n.x-o,r.bottom-t-s,"bottom"]:n.position.East?[r.right-o-s,n.y-t,"right"]:[n.x-o,r.top-t+s,"top"]}var co="vuuDropMenu",cr=({className:e,dropTarget:t,onHover:o,orientation:n})=>{let r=t.toArray();return ar("div",{className:Fa(co,e,`${co}-${n}`),onMouseLeave:()=>o(null),children:r.map((s,i)=>ar("div",{className:`${co}-item`,"data-icon":i===0?"column-2A":"column-2B",onMouseEnter:()=>o(s)},i))})};import{jsx as Xa}from"react/jsx-runtime";var uo=!1,Xe=null,Q=null,Va=e=>Xe=e,Wa=([e,t])=>`M${e},${t}`,_a=([e,t])=>`L${e},${t}`,ur=([e,...t])=>`${Wa(e)} ${t.map(_a)}Z`,Ga=e=>{if(e){let[t,o,n,r,s,i,a,l]=e;return`M${t},${o} L${n},${r} M${s},${i} L${a},${l}`}else return""};function Ua(){if(document.getElementById("hw-drag-canvas")===null){let e=document.getElementById("root"),t=document.createElement("div");t.id="hw-drag-canvas",t.innerHTML=`
|
|
2
|
+
<svg width="100%" height="100%">
|
|
3
|
+
<path id="hw-drop-guides" />
|
|
4
|
+
<path
|
|
5
|
+
id="vuu-drop-outline"
|
|
6
|
+
d="M300,132 L380,132 L380,100 L460,100 L460,132, L550,132 L550,350 L300,350z">
|
|
7
|
+
<animate
|
|
8
|
+
attributeName="d"
|
|
9
|
+
id="hw-drop-outline-animate"
|
|
10
|
+
begin="indefinite"
|
|
11
|
+
dur="300ms"
|
|
12
|
+
fill="freeze"
|
|
13
|
+
to="M255,33 L255,33,L255,1,L315,1,L315,1,L794,1,L794,164,L255,164Z"
|
|
14
|
+
/>
|
|
15
|
+
</path>
|
|
16
|
+
</svg>
|
|
17
|
+
`,document.body.insertBefore(t,e)}}var Ye=class{constructor(){this.currentPath=null;this.tabMode=null;Ua()}prepare(t,o="full-view"){document.body.classList.add("drawing"),this.currentPath=null,this.tabMode=o;let n=this.getPoints(0,0,0,0),r=ur(n),s=document.getElementById("vuu-drop-outline");s==null||s.setAttribute("d",r),this.currentPath=r}clear(){Xe=null,Et(),document.body.classList.remove("drawing"),G.hidePopup()}get hoverDropTarget(){return Xe}getPoints(t,o,n,r,s=0,i=0,a=0){let l=this.tabMode==="tab-only";if(i===0)return[[t,o+a],[t,o+a],[t,o],[t+i,o],[t+i,o],[t+n,o],[t+n,o+r],[t,o+r]];if(l){let c=s;return[[c,o],[c,o],[c+i,o],[c+i,o],[c+i,o+a],[c+i,o+a],[c,o+a],[c,o+a]]}else return s===0?[[t,o+a],[t,o+a],[t,o],[t+i,o],[t+i,o+a],[t+n,o+a],[t+n,o+r],[t,o+r]]:[[t,o+a],[t+s,o+a],[t+s,o],[t+s,o],[t+s,o+a],[t+n,o+a],[t+n,o+r],[t,o+r]]}draw(t,o){let r=uo;if(Xe!==null)this.drawTarget(Xe);else if(uo=t.nextDropTarget!=null,t.pos.tab?Ka(t):Q&&Et(),this.drawTarget(t,o),uo){let[s,i,a]=lr(t);{let l=Xa(cr,{dropTarget:t,onHover:Va,orientation:a});G.showPopup({left:s,top:i,component:l})}}else G.hidePopup()}drawTarget(t,o){let r=t.getTargetDropOutline(6,o);if(r){let{l:s,t:i,r:a,b:l,tabLeft:c,tabWidth:u,tabHeight:d,guideLines:p}=r,m=a-s,f=l-i;if(this.currentPath){let R=document.getElementById("vuu-drop-outline");R==null||R.setAttribute("d",this.currentPath)}let g=this.getPoints(s,i,m,f,c,u,d),b=ur(g),h=document.getElementById("hw-drop-outline-animate");h==null||h.setAttribute("to",b),h==null||h.beginElement(),this.currentPath=b;let S=document.getElementById("hw-drop-guides");S==null||S.setAttribute("d",Ga(p))}}},pr="transition:margin-left .4s ease-out;margin-left: 63px",dr="transition:margin-left .4s ease-out;margin-left: 0px";function Ka(e){var a,l;let{AFTER:t,BEFORE:o}=Ue,{clientRect:{Stack:n},pos:{tab:r}}=e,{id:s}=e.component.props,i=null;if(n&&r&&r.positionRelativeToTab!==t){let c=r.positionRelativeToTab===o?1:2,u=`:scope .hwTabstrip > .hwTabstrip-inner > .hwTab:nth-child(${r.index+c})`;i=(a=document.getElementById(s))==null?void 0:a.querySelector(u),i?(Q===null||Q!==i)&&(i.style.cssText=pr,Q&&(Q.style.cssText=dr),Q=i):Et()}else if((r==null?void 0:r.positionRelativeToTab)===o){if(Q===null){let c=".vuuHeader-title";i=(l=document.getElementById(s))==null?void 0:l.querySelector(c),i.style.cssText=pr,Q=i}}else Et()}function Et(){Q&&(Q.style.cssText=dr,Q=null)}var le,Ze,de,fr,hr,xe,wt,De=null,mo,gr,qe,yr,po,St=null,Ya=3,vt=new Ye,mr=.4;function Za(e,t){return t?_(e,t):ae(e,o=>o.dropTarget)}var fo={handleMousedown(e,t,o={}){le=t,gr=o,fr=e.clientX,hr=e.clientY,po=o.dragThreshold===void 0?Ya:o.dragThreshold,po===0?le(e,0,0):(window.addEventListener("mousemove",Tt,!1),window.addEventListener("mouseup",Pt,!1),St=window.setTimeout(()=>{console.log("mousedownTimer fires"),window.removeEventListener("mousemove",Tt,!1),window.removeEventListener("mouseup",Pt,!1),le==null||le(e,0,0)},500)),e.preventDefault()},initDrag(e,t,{top:o,left:n,right:r,bottom:s},i,a,l,c){return{drag:Ze,drop:de}=a,qa(e,t,{top:o,left:n,right:r,bottom:s},i,l,c)}};function Tt(e){var t=!0,o=!0;let n=t?e.clientX-fr:0,r=o?e.clientY-hr:0;Math.max(Math.abs(n),Math.abs(r))>po&&(window.removeEventListener("mousemove",Tt,!1),window.removeEventListener("mouseup",Pt,!1),le==null||le(e,n,r),le=null)}function Pt(){St&&(window.clearTimeout(St),St=null),window.removeEventListener("mousemove",Tt,!1),window.removeEventListener("mouseup",Pt,!1)}function qa(e,t,o,n,r,s){xe=Za(e,t);let{"data-path":i,path:a=i}=I(xe);s&&(mo=s.map(p=>ae(e,m=>m.id===p)).map(p=>p.props.path)),qe=Pe.measure(xe,s),console.log({_measurements:qe});let l=qe[a];wt=new gt(l,n.x,n.y,o,r);let c=Math.round(wt.x.mousePct*100),u=Math.round(wt.y.mousePct*100);return window.addEventListener("mousemove",br,!1),window.addEventListener("mouseup",xr,!1),yr=!1,vt.prepare(o,"tab-only"),gr.DoNotTransform?"transform:none":`transform:scale(${mr},${mr});transform-origin:${c}% ${u}%;`}function br(e){let t=e.clientX,o=e.clientY,n=wt,r=De,s,i,a;n.update("x",t)&&(i=n.x.pos),n.update("y",o)&&(a=n.y.pos),i===void 0&&a===void 0||Ze==null||Ze(i,a),!yr&&(n.inBounds()?s=ao(t,o,xe,qe,n.hasIntrinsicSize(),mo):s=ao(n.dropX(),n.dropY(),xe,qe),r&&(s==null||s.box!==r.box)&&(De=null),s&&(vt.draw(s,n),De=s))}function xr(){Ja()}function Ja(){if(De){let e=vt.hoverDropTarget||pe.getActiveDropTarget(De);de==null||de(e),De=null}else de==null||de({component:xe,pos:{position:W.Absolute}});Ze=null,de=null,xe=null,vt.clear(),mo=null,window.removeEventListener("mousemove",br,!1),window.removeEventListener("mouseup",xr,!1)}var ja={},Rr=[0,0],Qa=(e,t,o)=>{let n=document.createElement("div");n.className="vuuSimpleDraggableWrapper",n.classList.add("vuuSimpleDraggableWrapper","salt-theme","salt-density-medium"),n.dataset.dragging="true";let r=o!=null?o:document.createElement("div");r.id=t,n.appendChild(r),document.body.appendChild(n);let s=`top:${e.top}px;left:${e.left}px;width:${e.width}px;height:${e.height}px;`;return[n,s,e.left,e.top]},el=e=>{let{offsetParent:t}=e;if(t===null)return Rr;{let{left:o,top:n}=t.getBoundingClientRect();return[o,n]}},Er=(e,t)=>{let o=ho(),n=ho(),r=ho(),s=Dt((c,u)=>{if(n.current&&r.current){let{dragOffsets:[d,p],targetPosition:m}=n.current,f=typeof c=="number"?c-d:m.left,g=typeof u=="number"?u-p:m.top;(f!==m.left||g!==m.top)&&(n.current.targetPosition.left=f,n.current.targetPosition.top=g,r.current.style.top=g+"px",r.current.style.left=f+"px")}},[]),i=Dt(c=>{if(n.current){let{dragInstructions:u,payload:d,originalCSS:p}=n.current;t({type:"drag-drop",draggedReactElement:d,dragInstructions:u,dropTarget:c}),console.log("[useLayoutDragDrop]",{dragInstructions:u}),r.current&&(u.RemoveDraggableOnDragEnd?document.body.removeChild(r.current):(r.current.style.cssText=p,delete r.current.dataset.dragging)),o.current=void 0,n.current=void 0,r.current=void 0}},[]),a=Dt(c=>{if(o.current){let{payload:u,dragContainerPath:d,dragElement:p,dragRect:m,instructions:f=ja,path:g}=o.current,{current:b}=e,h={x:c.clientX,y:c.clientY},S=u!=null?u:_(b,g,!0),{id:R}=S.props,y=K(S),x="",E="",T="",D=f,P=-1,M=-1,w=Rr,v=document.getElementById(R);if(v===null)[v,E,P,M]=Qa(m,R,p),D={...D,RemoveDraggableOnDragEnd:!0};else{w=el(v);let[L,C]=w,{width:k,height:B,left:$,top:U}=v.getBoundingClientRect();P=$-L,M=U-C,E=`width:${k}px;height:${B}px;left:${P}px;top:${M}px;z-index: 100;background-color:#ccc;opacity: 0.6;`,v.dataset.dragging="true",x=v.style.cssText}T=fo.initDrag(e.current,d,m,h,{drag:s,drop:i},y),v.style.cssText=E+T,r.current=v,n.current={payload:S,originalCSS:x,dragRect:m,dragOffsets:w,dragInstructions:f,targetPosition:{left:P,top:M}}}},[s,i,e]);return Dt(c=>{let{evt:u,...d}=c;console.log("prepare to drag",{options:d}),o.current={...d,dragContainerPath:""},fo.handleMousedown(u,a,d.instructions)},[a])};import{jsx as Tr}from"react/jsx-runtime";var Sr=e=>e.dropTarget,nl=e=>["drag-drop","remove","set-title","splitter-resize","switch-tab"].includes(e.type),Dh=()=>{let e=rl();return Tr("div",{children:`Context: ${e} `})},Mh=e=>{let{children:t,layout:o,onLayoutChange:n}=e,r=wr(void 0),s=wr(t),[,i]=ol(null),a=go(d=>{if(n){let p=ae(d,Sr)||r.current,f=z(p)==="DraggableLayout"?I(p).children[0]:p,g=vn(f);n(g,"drag-root")}},[n]),l=go((d,p=!1)=>{let m=Gn(r.current,d);m!==r.current&&(r.current=m,i({}),!p&&nl(d)&&a(m))},[a]),c=go(d=>{d.type==="drag-start"?u(d):d.type==="save"?a(r.current):r.current&&l(d)},[l,a]),u=Er(r,c);return tl(()=>{if(o){let d=ae(r.current,Sr),p=nn(d),m=ut(o,`${d.props.path}.0`),f=p?{type:Y.REPLACE,target:p,replacement:m}:{type:Y.ADD,path:d.props.path,component:m};l(f,!0)}},[l,o]),r.current===void 0?r.current=Qt(t):t!==s.current&&(r.current=Qt(t,r.current),s.current=t),Tr(Ge.Provider,{value:{dispatchLayoutProvider:c,version:0},children:r.current})},Z=()=>{let{dispatchLayoutProvider:e}=vr(Ge);return e},rl=()=>{console.log({LayoutProviderContext:Ge});let{version:e}=vr(Ge);return e};import{jsx as il}from"react/jsx-runtime";var Pr=function(t){let{path:o}=t,n=Z(),r=sl(s=>{n({type:Se.SPLITTER_RESIZE,path:o,sizes:s})},[n,o]);return il(He,{...t,onSplitterMoved:r})};Pr.displayName="Flexbox";O("Flexbox",Pr,"container");import{useForkRef as Hl}from"@salt-ds/core";import Fl from"classnames";import{forwardRef as Vl}from"react";import{useCallback as Ir,useEffect as dl,useRef as xo,useState as ml}from"react";import{useCallback as al,useLayoutEffect as Dr,useRef as ll}from"react";var Gh=["height","width"],Uh=["height"],Kh=["width"],Re=new WeakMap,Lr=(e,t,o)=>{switch(o){case"height":return t.height;case"scrollHeight":return e.scrollHeight;case"scrollWidth":return e.scrollWidth;case"width":return t.width;default:return 0}},Mr=new ResizeObserver(e=>{for(let t of e){let{target:o,contentRect:n}=t,r=Re.get(o);if(r){let{onResize:s,measurements:i}=r,a=!1;for(let[l,c]of Object.entries(i)){let u=Lr(o,n,l);u!==c&&(a=!0,i[l]=u)}a&&s&&s(i)}}});function Mt(e,t,o,n=!1){let r=ll(t),s=al(i=>{let a=i.getBoundingClientRect();return r.current.reduce((l,c)=>(l[c]=Lr(i,a,c),l),{})},[]);Dr(()=>{let i=e.current,a=!1;async function l(){Re.set(i,{measurements:{}}),a=!1;let{fonts:c}=document;if(c&&await c.ready,!a){let u=Re.get(i);if(u){let d=s(i);u.measurements=d,Mr.observe(i),n&&o(d)}}}if(i){if(Re.has(i))throw Error("useResizeObserver attemping to observe same element twice");l()}return()=>{i&&Re.has(i)&&(Mr.unobserve(i),Re.delete(i),a=!0)}},[e,s]),Dr(()=>{let i=e.current,a=Re.get(i);if(a){if(r.current!==t){r.current=t;let l=s(i);a.measurements=l}a.onResize=o}},[t,s,e,o])}function cl(e,t){let o=document.body.querySelector(`.${e}`),n={get:function(r,s){let i=r.getPropertyValue(`--${e}-breakpoint-${s}`);return i?parseInt(i):void 0}};return o?new Proxy(getComputedStyle(o),n):t!=null?t:{}}var ul=([,e],[,t])=>t-e,bo=e=>Object.entries(e).sort(ul).map(([t,o],n,r)=>[t,o,n<r.length-1?r[n+1][1]:9999]),yo=null,pl=(e="salt")=>{let{xs:t,sm:o,md:n,lg:r,xl:s}=cl(e);return bo({xs:t,sm:o,md:n,lg:r,xl:s})},Cr=e=>(yo===null&&(yo=pl(e)),yo);var fl=[],Ar=({breakPoints:e,smallerThan:t},o)=>{let[n,r]=ml(t?!1:"lg"),s=xo(document.body),i=xo(e?bo(e):Cr()),a=xo("lg"),l=Ir(u=>{if(i.current){for(let[d,p]of i.current)if(u>=p)return d}},[i]),c=Ir(u=>{if(t){let d=i.current.find(([p])=>p===t);if(d){let[,,p]=d;return u<p}}else return l(u);return u},[t,l]);return Mt(o||s,i.current?["width"]:fl,({width:u})=>{let d=c(u);d!==a.current&&(a.current=d,r(d))},!0),dl(()=>{let u=o||s;if(u.current){let d=a.current;if(i.current){let{clientWidth:p}=u.current,m=c(p);a.current=m,m!==d&&r(m)}}},[r,c,o]),n};import{useCallback as oe,useLayoutEffect as zr,useRef as te,useState as kr}from"react";var hl=["left","right"],gl=["top","bottom"];function Je(e,t="width"){let{[t]:o}=e.getBoundingClientRect(),{padRight:n=!1,padLeft:r=!1}=e.dataset,s=getComputedStyle(e),[i,a]=t==="width"?hl:gl,l=r?0:parseInt(s.getPropertyValue(`margin-${i}`),10),c=n?0:parseInt(s.getPropertyValue(`margin-${a}`),10),u=o;if(parseInt(s.getPropertyValue("flex-shrink"),10)>0){let p=parseInt(s.getPropertyValue("flex-basis"),10);isNaN(p)||(u=p)}return l+u+c}var yl={horizontal:["width","scrollHeight"],vertical:["height","scrollWidth"],none:[]},bl={},Nr={},xl='[data-collapsible="dynamic"]:not([data-collapsed="true"]):not([data-collapsing="true"])',Ro=(e,t)=>e+t.size,Or=(e,t)=>e+(t.isOverflowIndicator?0:t.size),Rl=e=>{for(let t=e.length-1;t>=0;t--){let o=e[t];if(!o.isOverflowIndicator)return o}return null},Me=1e3,El=e=>e>0&&e<1e3,wo=e=>e>=Me,Eo=e=>e.current[e.current.length-1],wl=e=>e.some(t=>t.collapsed&&t.fullWidth===null),Sl=e=>e.current.querySelector(xl)!==null,Br=(e,t)=>{let o=Rl(e.current);return o?(e.current=e.current.filter(n=>n!==o),t.current=t.current.concat(o),o):null},Hr=(e,t)=>{let o=e.priority-t.priority;return o===0&&(o=e.index-t.index),o},$r=e=>e.current.find(t=>t.isOverflowIndicator),vl={horizontal:{size:"clientWidth",depth:"clientHeight",scrollDepth:"scrollHeight"},vertical:{size:"clientHeight",depth:"clientWidth",scrollDepth:"scrollWidth"}},Tl=({current:e},t="horizontal")=>{let o=vl[t],{[o.depth]:n}=e.parentNode,{[o.scrollDepth]:r,[o.size]:s}=e;return[n<r,s,n]},Pl=()=>{let[,e]=kr(null),[t,o]=kr(0),n=te(0),r=oe(i=>{o(n.current=i)},[o]),s=oe((i,a)=>{Math.abs(i)===Me?i>0&&!wo(n.current)||i<0&&wo(n.current)?r(n.current+i):e({}):i!==0?r(n.current+i):a&&e({})},[e,n,r]);return[n,t,s]},Dl=({current:e},t)=>Array.from(e.childNodes).reduce((n,r)=>{var p;let{collapsible:s,collapsed:i,collapsing:a,index:l,priority:c="1",overflowIndicator:u,overflowed:d}=(p=r==null?void 0:r.dataset)!=null?p:Nr;if(l){let m=Je(r,t);d&&delete r.dataset.overflowed,n.push({collapsible:s,collapsed:s?i==="true":void 0,collapsing:a,fullSize:null,index:parseInt(l,10),isOverflowIndicator:u,label:r.title||r.innerText,priority:parseInt(c,10),size:m})}return n},[]).sort(Hr),ee=(e,t)=>e.current.querySelector(`:scope > [data-idx='${t.index}']`);function sg(e="horizontal",t=""){let o=te(null),[n,r,s]=Pl(),i=te([]),a=te([]),l=te([]),c=te(!1),u=te(null),d=te(null),p=te(e==="horizontal"),m=te(36),f=te(0),g=oe(D=>{let P=p.current;if(D===void 0){let w=P?"width":"height";({[w]:D}=o.current.getBoundingClientRect())}f.current=D;let M=P?"minWidth":"minHeight";o.current.style[M]=D+"px"},[o]),b=oe((D,P)=>{let M=0;if(i.current.some(w=>w.collapsible&&!w.collapsed))for(let w=i.current.length-1;w>=0;w--){let v=i.current[w];if(v.collapsible==="instant"&&!v.collapsed){v.collapsed=!0;let L=ee(o,v);return L.dataset.collapsed=!0,l.current.push(v),1}else if(v.collapsible==="dynamic"&&!v.collapsed&&!v.collapsing){v.collapsing=!0;let L=ee(o,v);return L.dataset.collapsing=!0,l.current.push(v),o.current.dataset.collapsing=!0,1}}for(;D>P;){let w=Br(i,a);if(w===null){g(D);break}D-=w.size;let v=ee(o,w);v.dataset.overflowed=!0,M=Me}return M},[g]),h=oe(D=>{let P=0,M=i.current.reduce(Or,0),w=D-M;if(El(n.current)){for(;l.current.length;){let v=Eo(l),L=v.fullSize-v.size;if(w>=L){v.collapsed=!1,v.size=v.fullSize,delete v.fullSize;let C=ee(o,v);l.current.pop(),delete C.dataset.collapsed,w=w-L,P+=1}else break}return P}else for(;a.current.length>0;){let{size:v}=Eo(a);if(w>=v){let{size:L=0}=$r(i)||bl;if(a.current.length===1||w>=v+L){let C=Br(a,i);M+=C.size;let k=ee(o,C);delete k.dataset.overflowed,w=w-C.size,P=Me}else break}else break}return P},[n]),S=oe(()=>{let P=i.current.reduce(Ro,0)-d.current;for(let M=i.current.length-1;M>=0;M--){let w=i.current[M];if(w.collapsible&&!w.collapsed){let v=ee(o,w);if(P>w.size-36)v.dataset.collapsed=w.collapsed=!0,P-=w.size;else{v.dataset.collapsing=w.collapsing=!0;break}}}},[d,o,i]),R=oe((D,P)=>{P.dataset.collapsing=D.collapsing=!1,P.dataset.collapsed=D.collapsed=!0;let w=i.current.filter(({collapsible:v,collapsed:L})=>v==="dynamic"&&!L).pop();if(w){let v=ee(o,w);v.dataset.collapsing=w.collapsing=!0}else g()},[g]),y=oe((D,P)=>{P.dataset.collapsing=D.collapsing=!1},[]),x=oe(D=>{let P=i.current.find(({collapsible:L,collapsing:C})=>L==="dynamic"&&C),M=i.current.find(({collapsible:L,collapsed:C})=>L==="dynamic"&&C);if(P===void 0&&M===void 0)return;if(P===void 0){let L=ee(o,M);L.dataset.collapsed=M.collapsed=!1,L.dataset.collapsing=M.collapsing=!0;return}let w=ee(o,P),v=p.current?"width":"height";if(D&&M){let L=Je(w,v);M&&L===P.size&&y(P,w)}else{let{[v]:L}=w.getBoundingClientRect(),C=getComputedStyle(w),k=parseInt(C.getPropertyValue(`min-${v}`));L===k&&R(P,w)}},[R,y]),E=oe(()=>{let[D,P,M]=Tl(o,e);d.current=P,u.current=M;let w=Sl(o);if(w||D){let v=p.current?"width":"height",L=Dl(o,v);i.current=L,a.current=[]}if(w)if(c.current=!0,o.current.dataset.collapsing=!0,D)S();else{let v=Eo(i),L=ee(o,v);L.dataset.collapsing=v.collapsing=!0}else if(D){let v=i.current.reduce(Or,0),L=b(v,P-m.current);s(+L)}},[S,b,e,s]),T=oe(({scrollHeight:D,height:P=D,scrollWidth:M,width:w=M})=>{let[v,L]=p.current?[w,P]:[P,w],C=n.current===0,k=L>u.current,B=v>d.current;if(d.current=v,!(B&&v===f.current)){if(c.current)x(B);else if(!C&&B){let $=h(v);$!==Me||a.current.length===0?s(-$):$===Me&&s(0,!0)}else if(C&&k)E();else if(!C&&k){let $=i.current.reduce(Ro,0);if(v<$){let U=b($,v);s(+U)}}}},[x,h,E,b,n,s]);return zr(()=>{var P;let D=p.current?"width":"height";if(wl(i.current)){let[M]=i.current.filter(w=>w.collapsed);if(M.fullSize===null){let w=ee(o,M);if(w){let v=Je(w,D);M.fullSize=M.size,M.size=v;let L=i.current.reduce(Ro,0);if(L>d.current){let C=b(L,d.current-m.current);s(+C)}}}}else if(wo(r)){let M=o.current.querySelector(":scope > [data-overflow-indicator='true']");if(M){let{index:w,priority:v="1"}=(P=M==null?void 0:M.dataset)!=null?P:Nr,L={index:parseInt(w,10),isOverflowIndicator:!0,priority:parseInt(v,10),label:M.innerText,size:Je(M,D)};m.current=L.size,i.current=i.current.concat(L).sort(Hr)}}else $r(i)&&(i.current=i.current.filter(M=>!M.isOverflowIndicator))},[b,r,o,s,i]),zr(()=>{async function D(){await document.fonts.ready,o.current!==null&&E()}e!=="none"&&D()},[t,e,E]),Mt(o,yl[e],T),[o,a.current,l.current,E]}var Fr="data-collapsible",Ml={[Fr]:!0,"data-pad-start":!0,"data-pad-end":!0},Ll=e=>{var t;return(t=Ml[e])!=null?t:!1},Cl=e=>e===Fr,Il={dynamic:"dynamic",instant:"instant",true:"instant"},Al=e=>{var t;return(t=Il[e])!=null?t:"none"},ag=e=>Object.keys(e).reduce((t,o)=>{let[n,r]=t;if(Ll(o)){let s=Cl(o)?Al(e[o]):e[o];n[o]=s,r[o]=void 0}return t},[{},{}]);import{cloneElement as zl,isValidElement as kl,useCallback as Ol,useMemo as Vr,useRef as So}from"react";import{getUniqueId as Bl}from"@vuu-ui/vuu-utils";var $l=["xs","sm","md","lg","xl"],Nl=12,Wr=({children:e,cols:t,style:o})=>{let n=So(null),r=So(null),s=So(),i=t!=null?t:Nl,l=(o==null?void 0:o.flexDirection)==="column"?"height":"width",c=Vr(()=>Array.isArray(e)?e:kl(e)?[e]:[],[e]),u=Ol((d,p)=>{let m=at(d,p,$l),f=[],g=[];for(let b=0;b<d.length;b++){let h=d[b],{style:{flex:S,...R}}=h.props;f.push(zl(h,{key:Bl(),style:{...R,"--parent-col-count":i}})),g.push(m[b])}return[f,g]},[i]);return Vr(()=>{let[d,p]=u(c,l);r.current=p,s.current=d},[u,c,l]),{cols:i,content:s.current,rootRef:n}};import{jsx as Wl}from"react/jsx-runtime";var Lt="hwFluidGrid",vo=Vl(function(t,o){let{breakPoints:n,children:r,column:s,cols:i=12,className:a,flexFill:l,gap:c=3,fullPage:u,id:d,onSplitterMoved:p,resizeable:m,row:f,showGrid:g,spacing:b,splitterSize:h,style:S,...R}=t,{cols:y,content:x,rootRef:E}=Wr({children:r,cols:i,style:S}),T=Ar({breakPoints:n},E),D=Fl(Lt,a,{[`${Lt}-column`]:s,[`${Lt}-row`]:f,[`${Lt}-show-grid`]:g,"flex-fill":l,"full-page":u}),P={...S,"--spacing":b,"--grid-col-count":y,"--grid-gap":c};return Wl("div",{...R,className:D,"data-breakpoint":T,"data-cols":y,"data-resizeable":m||void 0,id:d,ref:Hl(E,o),style:P,children:x})});vo.displayName="FluidGrid";import{jsx as _l}from"react/jsx-runtime";var _r=function(t){return _l(vo,{...t})};_r.displayName="FluidGrid";O("FluidGrid",_r,"container");import Gl,{useContext as Gr}from"react";var Ul={dispatch:null},Ct=Gl.createContext(Ul),Ur=()=>{var t;let e=Gr(Ct);return(t=e==null?void 0:e.dispatch)!=null?t:null},_g=()=>Gr(Ct);import{useForkRef as sc,useIdMemo as ic}from"@salt-ds/core";import ac from"classnames";import Po,{forwardRef as lc,useMemo as cc,useRef as es}from"react";import Kl from"classnames";import Xl,{useRef as Yl,useState as Kr}from"react";import{EditableLabel as Zl,Toolbar as ql,ToolbarButton as Jl,ToolbarField as jl,Tooltray as Xr}from"@heswell/salt-lab";import{CloseIcon as Ql}from"@salt-ds/icons";import{jsx as Le,jsxs as ec}from"react/jsx-runtime";var Yr=({className:e,contributions:t,collapsed:o,expanded:n,closeable:r,onEditTitle:s,orientation:i="horizontal",style:a,tearOut:l,title:c="Untitled"})=>{let u=Yl(null),[d,p]=Kr(c),[m,f]=Kr(!1),g=Ur(),b=(C,k)=>g==null?void 0:g({type:k},C),h=C=>g==null?void 0:g({type:"remove"},C),S="vuuHeader",R=C=>{var k;(k=u.current)==null||k.focus()},y=C=>{C.stopPropagation()},E=Kl(S,e,`${S}-${o||i}`),T=()=>{f(!0)},D=C=>{C.key==="Enter"&&f(!0)},P=(C="",k="",B=!0,$=!1)=>{var U;f(!1),$?p(C):k!==C&&(p(k),s==null||s(k)),B===!1&&((U=u.current)==null||U.focus())},M=C=>{g==null||g({type:"mousedown"},C)},w=[],v=[],L=[];return c&&w.push(Le(jl,{className:"vuuHeader-title",children:Le(Zl,{editing:m,value:d,onChange:p,onMouseDownCapture:R,onEnterEditMode:T,onExitEditMode:P,onKeyDown:D,ref:u,tabIndex:0},"title")},"title")),t==null||t.forEach((C,k)=>{v.push(Xl.cloneElement(C.content,{key:k}))}),r&&L.push(ec(Jl,{onClick:h,onMouseDown:y,children:[Le(Ql,{})," Close"]},"close")),v.length>0&&w.push(Le(Xr,{"data-align-end":!0,children:v},"contributions")),L.length>0&&w.push(Le(Xr,{"data-align-end":!0,children:L},"actions")),Le(ql,{className:E,orientation:i,style:a,onMouseDown:M,children:w})};import{useCallback as Ee,useMemo as Zr}from"react";import{useCallback as je,useState as tc}from"react";var It=(e,t,o,n)=>{var b;let{loadSessionState:r,purgeSessionState:s,purgeState:i,saveSessionState:a}=Te(),[l,c]=tc((b=r(e,"contributions"))!=null?b:[]),u=Z(),d=je((h,S)=>{let R=l.concat([{location:h,content:S}]);a(e,"contributions",R),c(R)},[l,e,a]),p=je(()=>{s(e,"contributions"),c([])},[e,s]),m=je(()=>{let h=r(e,"data-source");h&&h.unsubscribe(),s(e),i(e),u({type:"remove",path:o})},[u,e,r,s,i,o]),f=je(async(h,S,R)=>{var x;h.stopPropagation();let y=(x=t.current)==null?void 0:x.getBoundingClientRect();return new Promise((E,T)=>{u({type:"drag-start",evt:h,path:S===void 0?o:`${o}.${S}`,dragRect:y,preDragActivity:R,dropTargets:n,resolveDragStart:E,rejectDragStart:T})})},[t,u,o,n]);return[je(async(h,S)=>{var y;let{type:R}=h;switch(R){case"maximize":case"minimize":case"restore":return u({type:R,path:(y=h.path)!=null?y:o});case"remove":return m();case"mousedown":return console.log("2) ViewActionDispatch Hook dispatch Action mousedown"),f(S,h.index,h.preDragActivity);case"add-toolbar-contribution":return d(h.location,h.content);case"remove-toolbar-contribution":return p();default:return}},[u,o,m,f,d,p]),l]};var qr=({id:e,rootRef:t,path:o,dropTargets:n,title:r})=>{let s=Z(),{loadState:i,loadSessionState:a,purgeState:l,saveState:c,saveSessionState:u}=Te(),[d,p]=It(e,t,o,n),m=Zr(()=>{var E;return(E=i("view-title"))!=null?E:r},[i,r]),f=Ee(E=>{o&&s({type:"set-title",path:o,title:E})},[s,o]),g=Zr(()=>i(e),[e,i]),b=Ee(E=>i(e,E),[e,i]),h=Ee(E=>{l(e,E),s({type:"save"})},[e,l]),S=Ee((E,T)=>{c(e,T,E),s({type:"save"})},[e,s,c]),R=Ee(E=>a(e,E),[e,a]),y=Ee((E,T)=>u(e,T,E),[e,u]),x=Ee(({type:E,...T})=>{let{[E]:D}=T;S(D,E)},[S]);return{contributions:p,dispatchViewAction:d,load:b,loadSession:R,onConfigChange:x,onEditTitle:f,purge:h,restoredState:g,save:S,saveSession:y,title:m}};import{useResizeObserver as oc,WidthHeight as nc}from"@heswell/salt-lab";import{useCallback as Jr,useRef as jr}from"react";var rc=[],Qr=({mainRef:e,resize:t="responsive",rootRef:o})=>{let n=t==="defer",r=jr({}),s=jr(),i=Jr(()=>{e.current&&(e.current.style.height=r.current.height+"px",e.current.style.width=r.current.width+"px"),s.current=void 0},[]),a=Jr(({height:l,width:c})=>{r.current.height=l,r.current.width=c,s.current!==null&&clearTimeout(s.current),s.current=window.setTimeout(i,40)},[i]);oc(o,n?nc:rc,a,n)};import{jsx as To,jsxs as uc}from"react/jsx-runtime";var ts=lc(function(t,o){let{children:n,className:r,collapsed:s,closeable:i,"data-resizeable":a,dropTargets:l,expanded:c,flexFill:u,id:d,header:p,orientation:m="horizontal",path:f,resize:g="responsive",resizeable:b=a,tearOut:h,style:S={},title:R,...y}=t,x=ic(d),E=es(null),T=es(null),{contributions:D,dispatchViewAction:P,load:M,loadSession:w,onConfigChange:v,onEditTitle:L,purge:C,restoredState:k,save:B,saveSession:$,title:U}=qr({id:x,rootRef:E,path:f,dropTargets:l,title:R});Qr({mainRef:T,resize:g,rootRef:E});let me="vuuView",Ft=()=>Po.isValidElement(n)&&k?Po.cloneElement(n,k):n,Vt=cc(()=>({dispatch:P,id:x,path:f,title:U,load:M,loadSession:w,onConfigChange:v,purge:C,save:B,saveSession:$}),[P,x,M,w,v,f,C,B,$,U]),Ae=typeof p=="object"?p:{};return To("div",{...y,className:ac(me,r,{[`${me}-collapsed`]:s,[`${me}-expanded`]:c,[`${me}-resize-defer`]:g==="defer"}),"data-resizeable":b,id:x,ref:sc(o,E),style:S,tabIndex:-1,children:uc(Ct.Provider,{value:Vt,children:[p?To(Yr,{...Ae,collapsed:s,contributions:D,expanded:c,closeable:i,onEditTitle:L,orientation:m,tearOut:h,title:U}):null,To("div",{className:`${me}-main`,ref:T,children:Ft()})]})})});ts.displayName="View";var se=Po.memo(ts);se.displayName="View";O("View",se,"view");import{Scrim as mc}from"@heswell/salt-lab";import{Toolbar as fc,ToolbarButton as hc}from"@heswell/salt-lab";import{CloseIcon as gc}from"@salt-ds/icons";import{jsx as Ce,jsxs as Do}from"react/jsx-runtime";var rs="vuuDialog",tb=({children:e,className:t,isOpen:o=!1,onClose:n,title:r,...s})=>{let i=pc(null),[a,l]=ns(0),[c,u]=ns(0),d=os(()=>{n==null||n()},[n]),p=os(()=>{},[]);return o?Ce(bt,{onRender:p,x:a,y:c,children:Ce(mc,{className:`${rs}-scrim`,open:o,children:Ce("div",{...s,className:dc(rs,t),ref:i,children:Do(He,{style:{flexDirection:"column",width:"100%",height:"100%"},children:[Do(fc,{style:{height:32},children:[Ce("span",{children:r}),Do(hc,{onClick:d,"data-align-end":!0,children:[Ce(gc,{})," Close"]},"close")]}),Ce(se,{style:{flex:1},children:e})]})})})}):null};import{useIdMemo as Gc}from"@salt-ds/core";import{useCallback as zo,useRef as ws}from"react";import{useCallback as we,useMemo as yc,useRef as Qe,useState as bc}from"react";function ss(e){if(e){let t=e.dataset.idx;if(t)return parseInt(t,10);if(t=e.ariaPosInSet)return parseInt(t,10)-1}}var Mo=e=>e.closest("[data-idx],[aria-posinset]");var is=(e,t,o)=>e.map((n,r)=>r===e.length-1?{...n,[o]:n[o]-t}:n),xc=(e,t)=>is(e,t,"left"),Rc=(e,t)=>is(e,t,"top"),Ec=(e,t)=>{let[o,n]=t.slice(-2),r=document.getElementById(`${e}-${n.id}`),{width:s}=r.getBoundingClientRect();return t.map(i=>i===n?{...i,left:o.left-(s-2)}:i)},wc=e=>e.ariaHasPopup==="true"&&e.ariaExpanded!=="true",Sc=(e,t)=>{let[{left:o,top:n}]=t.slice(-1),{offsetWidth:r,offsetTop:s}=e;return{left:o+r,top:s+n}},et=e=>{let t=e.lastIndexOf("-");return t===-1?e:e.slice(t+1)},At=e=>{let t=et(e),o=t.lastIndexOf(".");return o>-1?t.slice(0,o):"root"},vc=e=>{let t=0,o=e.indexOf(".",0);for(;o!==-1;)t+=1,o=e.indexOf(".",o+1);return t},Tc=e=>[At(e.id),et(e.id),e.ariaHasPopup==="true",e.ariaExpanded==="true",vc(e.id)],as=({id:e,onActivate:t,onMouseEnterItem:o,position:{x:n,y:r}})=>{let[,s]=bc({}),i=Qe([{id:"root",left:n,top:r}]),a=we(R=>{i.current=R,s({})},[]),l=Qe(null),c=Qe(null),u=Qe({root:"no-popup"}),d=Qe(0),p=we((R="root",y=null,x=null)=>{if(R==="root"&&y===null)a([{id:"root",left:n,top:r}]);else{u.current[R]="popup-open";let T=(x?x.ownerDocument:document).getElementById(`${e}-${R}-${y}`),{left:D,top:P}=Sc(T,i.current);a(i.current.concat({id:y,left:D,top:P}))}},[e,n,r,a]),m=we(R=>{a(R==="root"?[]:i.current.slice(0,-1))},[a]),f=we((R,y)=>{let x=i.current.slice(),{id:E}=x[x.length-1];for(;x.length>1&&!y.startsWith(E);){let T=At(E);x.pop(),u.current[E]="no-popup",u.current[T]="no-popup",{id:E}=x[x.length-1]}x.length<i.current.length&&a(x)},[a]),g=we((R,y,x)=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{console.log(`scheduleOpen timed out opening ${y}`),f(R,y),u.current[R]="popup-open",u.current[y]="no-popup",p(R,y,x)},400)},[f,p]),b=we((R,y,x)=>{console.log(`scheduleClose openMenuId ${R} menuId ${y} itemId ${x}`),u.current[R]="pending-close",c.current=setTimeout(()=>{f(y,x)},400)},[f]),h=we(()=>{let{current:R}=i,[y]=R.slice(-1),x=document.getElementById(`${e}-${y.id}`);if(x){let{right:E,bottom:T}=x.getBoundingClientRect(),{clientHeight:D,clientWidth:P}=document.body;if(E>P){let M=R.length>1?Ec(e,R):xc(R,E-P);a(M)}else if(T>D){let M=Rc(R,T-D);a(M)}}},[e,a]),S=yc(()=>({onMouseEnter:R=>{let y=Mo(R.target),[x,E,T,D,P]=Tc(y),M=d.current===P,{current:{[x]:w}}=u;if(d.current=P,w==="no-popup"&&T)u.current[x]="popup-pending",g(x,E,y);else if(w==="popup-pending"&&!T)u.current[x]="no-popup",clearTimeout(l.current),l.current=null;else if(w==="popup-pending"&&T)clearTimeout(l.current),g(x,E,y);else if(w==="popup-open"){let[{id:v},{id:L}]=i.current.slice(-2);v===x&&u.current[L]!=="pending-close"&&M?(b(L,x,E),T&&!D&&g(x,E,y)):v===x&&T&&E!==L&&u.current[L]==="pending-close"?g(x,E,y):T?(f(x,E),g(x,E,y)):u.current[L]==="pending-close"&&M||f(x,E)}w==="pending-close"&&(l.current&&(clearTimeout(l.current),l.current=null),clearTimeout(c.current),c.current=null,u.current[x]="popup-open"),o(R,E)},onClick:R=>{let y=Mo(R.target),x=ss(y);wc(y).ariaHasPopup==="true"?y.ariaExpanded!=="true"&&p(x):t(et(y.id))}}),[f,t,o,p,b,g]);return{closeMenu:m,handleRender:h,listItemProps:S,openMenu:p,openMenus:i.current}};import xs,{useCallback as Vc,useMemo as Wc}from"react";import{useLayoutEffect as Oc,useMemo as Bc,useRef as $c}from"react";import gs from"classnames";import{useIdMemo as Nc}from"@salt-ds/core";import{useCallback as ms,useRef as Lo,useState as zc}from"react";var ls=e=>e.closest("[data-root='true']")!==null,cs=(e,t)=>{var o;return e.ariaHasPopup==="true"&&((o=e.dataset)==null?void 0:o.idx)===`${t}`||e.querySelector(`:scope > [data-idx='${t}'][aria-haspopup='true']`)!==null};var zt=(e,t,...o)=>{let n=()=>{var r,s;return(s=o==null?void 0:(r=o[0]).isPropagationStopped)==null?void 0:s.call(r)};if(e.length>0&&!n()){let r=e.filter(s=>s[t]).map(s=>s[t]);for(let s of r){if(n())break;s(...o)}}};function Pc(e,...t){let o=new Set(e);for(let n of t)for(let r of n)o.add(r);return o}var Dc="Enter";var Mc="Delete",Lc=new Set([Dc,Mc]),Cc=new Set(["Tab"]),Ic=new Set(["ArrowRight","ArrowLeft"]),us=new Set(["Home","End","ArrowDown","ArrowUp"]),ps=new Set(["Home","End","ArrowRight","ArrowLeft"]),Ac=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),db=Pc(Lc,ps,us,Ic,Ac,Cc);var ds=({key:e},t="vertical")=>(t==="vertical"?us:ps).has(e);var fs=({autoHighlightFirstItem:e=!1,count:t,highlightedIdx:o,onActivate:n,onHighlight:r,onKeyDown:s,onCloseMenu:i,onOpenMenu:a},...l)=>{let c=Lo((o!=null?o:e)?0:-1),[,u]=zc(null),d=o!==void 0,p=ms(y=>{c.current=y,r&&r(y),zt(l,"onHighlight",y),u({})},[l,r]),m=Lo(!0),f=Lo(!1),g=y=>f.current=y,b=ms(y=>{y!==c.current&&(d||p(y))},[d,p]),h=d?o:c.current,S={onFocus:()=>{h===-1&&p(0)},onKeyDown:y=>{if(ds(y)?(y.preventDefault(),y.stopPropagation(),m.current=!0,R(y)):(y.key==="ArrowRight"||y.key==="Enter")&&cs(y.target,h)?a(h):y.key==="ArrowLeft"&&!ls(y.target)?i(h):y.key==="Enter"&&n&&n(h),Array.isArray(s))for(let x of s){if(y.isPropagationStopped())break;x(y)}else s&&!y.isPropagationStopped()&&s(y);zt(l,"onKeyDown",y)},onMouseDownCapture:()=>{m.current=!1,g(!0)},onMouseMove:()=>{m.current&&(m.current=!1)},onMouseLeave:()=>{m.current=!0,g(!1),b(-1)}},R=y=>{let x=kc(t,y.key,c.current);x!==c.current&&(b(x),zt(l,"onKeyboardNavigation",y,x))};return{focusVisible:m.current?h:-1,controlledHighlighting:d,highlightedIdx:h,hiliteItemAtIndex:b,keyBoardNavigation:m,listProps:S,setIgnoreFocus:g}};function kc(e,t,o){return t==="Up"?o>0?o-1:o:o===null?0:o===e-1?o:o+1}import{jsx as tt}from"react/jsx-runtime";var hs="hwMenuList",ys=()=>tt("li",{className:"hwMenuItem-divider"}),kt=()=>null,Co=({children:e,idx:t,...o})=>tt("div",{...o,children:e}),Hc=e=>e.props["data-icon"],bs=({activatedByKeyboard:e,childMenuShowing:t=-1,children:o,highlightedIdx:n,id:r,isRoot:s,listItemProps:i,menuId:a,onHighlightMenuItem:l,onActivate:c,onCloseMenu:u,onOpenMenu:d,...p})=>{let m=Nc(r),f=$c(null),g=Bc(()=>new Map,[]),b=D=>{let P=f.current.querySelector(`:scope > [data-idx='${D}']`);d(P.id)},h=D=>{let P=f.current.querySelector(`:scope > [data-idx='${D}']`);c(P.id)},{focusVisible:S,highlightedIdx:R,listProps:y}=fs({count:o.length,highlightedIdx:n,onActivate:h,onHighlight:l,onOpenMenu:b,onCloseMenu:u,id:m}),x=t==-1?S:-1;return Oc(()=>{t===-1&&e&&f.current.focus()},[e,t]),tt("div",{...p,...y,"aria-activedescendant":(()=>R===void 0||R===-1?void 0:g.get(R))(),className:gs(hs,{[`${hs}-childMenuShowing`]:t!==-1}),"data-root":s||void 0,id:`${m}-${a}`,ref:f,role:"menu",tabIndex:0,children:T()});function T(){let D={...i,role:"menuitem"},P=(v,L)=>L?[tt("span",{className:"hwIconContainer"},"icon")].concat(v):v;function M(v,L,C,k){let{children:B,className:$,id:U,hasSeparator:me,label:Ft,...Vt}=L.props,Ae=Ao(L),Uo=Ae&&t===C,Hs=Uo?`${m}-${U}`:void 0;v.push(tt(Co,{...Vt,...D,...Fc(`${m}-${a}`,U,C,L.key,R,x,$,me),"aria-controls":Hs,"aria-haspopup":Ae||void 0,"aria-expanded":Uo||void 0,children:P(Ae?Ft:B,k)}))}let w=[];if(o&&o.length>0){let v=o.some(Hc);o.forEach((L,C)=>{M(w,L,C,v)})}return w}},Fc=(e,t,o,n,r,s,i,a)=>({id:`${e}-${t}`,key:n!=null?n:o,"data-idx":o,"data-highlighted":o===r||void 0,className:gs("hwMenuItem",i,{"hwMenuItem-separator":a,focusVisible:s===o})});bs.displayName="MenuList";var Io=bs;var Ao=e=>e.type===kt||!!e.props["data-group"],Rs=(e,t)=>{let o=Vc(()=>{if(t===void 0)return;let s=(a,l="root",c={},u={})=>{let d=c[l]=[],p=0,m=!1;return xs.Children.forEach(a,f=>{if(f.type===ys)m=!0;else{let g=Ao(f),b=l==="root"?`${p}`:`${l}.${p}`,{props:{action:h,options:S}}=f,[R,y]=i(f,b,g,m);d.push(R),y?s(y,b,c,u):u[b]={action:h,options:S},p+=1,m=!1}}),[c,u]},i=(a,l,c,u=!1)=>{let{props:{children:d}}=a;return[xs.cloneElement(a,{hasSeparator:u,id:`${l}`,key:l,children:c?void 0:d}),c?d:void 0]};return s(t)},[t]),[n,r]=Wc(()=>o(),[o]);return[n,r]};import{useEffect as _c}from"react";var Es=({containerClassName:e,isOpen:t,onClose:o})=>{_c(()=>{let n=t?r=>{r.target.closest(`.${e}`)===null&&o("root")}:null;return document.body.addEventListener("click",n,!0),()=>{n&&document.body.removeEventListener("click",n,!0)}},[e,t,o])};import{Fragment as Uc,jsx as ko}from"react/jsx-runtime";var Ss=({activatedWithKeyboard:e=!1,children:t,id:o,onClose:n=()=>{},position:r={x:0,y:0},source:s,style:i})=>{let a=Gc(o),l=ws(null),[c,u]=Rs(s,t),d=ws(e),p=zo(()=>{d.current=!1},[]),m=zo(P=>{let{action:M,options:w}=u[P];l.current("root"),n(M,w)},[u,n]),{closeMenu:f,listItemProps:g,openMenu:b,openMenus:h,handleRender:S}=as({id:a,onActivate:m,onMouseEnterItem:p,position:r});l.current=f,console.log({openMenus:h});let R=zo(()=>{f(),n()},[f,n]);Es({containerClassName:"hwMenuList",onClose:R,isOpen:h.length>0});let y=P=>{let M=et(P),w=At(M);d.current=!0,b(w,M)},x=()=>{d.current=!0,f()},E=()=>{},T=h.length-1,D=P=>{if(P>=T)return-1;{let{id:M}=h[P+1],w=M.lastIndexOf(".");return parseInt(w===-1?M:M.slice(-w),10)}};return ko(Uc,{children:h.map(({id:P,left:M,top:w},v)=>{let L=D(v);return ko(bt,{x:M,y:w,onRender:S,children:ko(Io,{activatedByKeyboard:d.current,childMenuShowing:L,id:a,menuId:P,isRoot:v===0,listItemProps:g,onActivate:m,onHighlightMenuItem:E,onCloseMenu:x,onOpenMenu:y,style:i,children:c[P]},v)},v)})})};Ss.displayName="ContextMenu";var Oo=Ss;import Kc,{useCallback as vs,useContext as Xc,useMemo as Yc}from"react";import{jsx as Ie}from"react/jsx-runtime";var Zc=(e,t,o)=>{let{clientX:n,clientY:r}=e,a=Ie(Oo,{onClose:(l,c)=>{l&&(o(l,c),G.hidePopup())},position:{x:n,y:r},children:(l=>{let c=({children:u,label:d,icon:p,action:m,options:f},g)=>u?Ie(kt,{label:d,children:u.map(c)},g):Ie(Co,{action:m,"data-icon":p,options:f,children:d},g);return l.map(c)})(t)});G.showPopup({left:0,top:0,component:a})},Bo=Kc.createContext(null),qc={menuItemDescriptors:[]},Jb=()=>{let{menuActionHandler:e,menuBuilders:t}=Xc(Bo),o=vs((r,s,i)=>{let a=[];for(let l of r)a=a.concat(l(s,i));return a},[]);return(r,s,i)=>{r.stopPropagation(),r.preventDefault();let a=o(t,s,i);a.length&&Zc(r,a,e)}},Jc=({children:e,context:{menuBuilders:t,menuActionHandler:o},menuActionHandler:n,menuBuilder:r})=>{let s=Yc(()=>t&&r?t.concat(r):r?[r]:t||[],[t,r]),i=vs((a,l)=>{if(n&&n(a,l)||o&&o(a,l))return!0},[o,n]);return Ie(Bo.Provider,{value:{menuActionHandler:i,menuBuilders:s},children:e})},jb=({children:e,menuActionHandler:t,menuBuilder:o,menuItemDescriptors:n,label:r})=>Ie(Bo.Consumer,{children:s=>Ie(Jc,{context:s||qc,label:r,menuActionHandler:t,menuBuilder:o,menuItemDescriptors:n,children:e})});import jc from"classnames";import{useRef as Qc}from"react";import{jsx as eu}from"react/jsx-runtime";var Ts=function(t){let o=Qc();o.current=t;let{className:n,id:r,style:s}=t,i=jc("DraggableLayout",n);return eu("div",{className:i,id:r,style:s,children:t.children})},Ps="DraggableLayout";Ts.displayName=Ps;O(Ps,Ts,"container");import{List as tu,ListItem as ou}from"@heswell/salt-lab";import{uuid as nu}from"@vuu-ui/vuu-utils";import Ds from"classnames";import{cloneElement as ru,memo as su}from"react";import{jsx as $o}from"react/jsx-runtime";var iu=e=>{let t=e.cloneNode(!0);return t.id="",delete t.dataset.idx,t},Ms=su(({className:e,children:t,idx:o,resizeable:n,header:r,closeable:s,...i})=>$o(ou,{className:Ds("vuuPaletteItem",e),"data-icon":"grab-handle",...i}));Ms.displayName="PaletteItem";var au=({children:e,className:t,orientation:o="horizontal",...n})=>{let r=Z(),s="vuuPalette";function i(a){var E;let c=a.target.closest(".vuuPaletteItem"),u=parseInt((E=c.dataset.idx)!=null?E:"-1");u!==-1&&console.log({children:e,idx:u,listItemElement:c});let{props:{caption:d,children:p,template:m,...f}}=e[u],{height:g,left:b,top:h,width:S}=c.getBoundingClientRect(),R=nu(),x=m?p:$o(se,{...{id:R,key:R},...f,title:f.label,children:p});r({dragRect:{left:b,top:h,right:b+S,bottom:h+150,width:S,height:g},dragElement:iu(c),evt:a.nativeEvent,instructions:{DoNotRemove:!0,DoNotTransform:!0,RemoveDraggableOnDragEnd:!0,dragThreshold:10},path:"*",payload:x,type:"drag-start"})}return $o(tu,{...n,borderless:!0,className:Ds(s,t,`${s}-${o}`),maxHeight:800,selected:null,children:e.map((a,l)=>a.type===Ms?ru(a,{key:l,onMouseDown:i}):a)})};O("Palette",au,"view");import{List as lu,ListItem as cu}from"@heswell/salt-lab";import{uuid as uu}from"@vuu-ui/vuu-utils";import pu from"classnames";import{jsx as No}from"react/jsx-runtime";var du="vuuPalette",Gx=e=>{let{children:t,ViewProps:o,label:n,onMouseDown:r,template:s,...i}=e,a=Z();return No(cu,{onMouseDown:c=>{let{left:u,top:d,width:p}=c.currentTarget.getBoundingClientRect(),m=uu(),g=s?t:No(se,{...{id:m,key:m},...o,title:e.label,children:t});a({type:"drag-start",evt:c.nativeEvent,path:"*",payload:g,instructions:{DoNotRemove:!0,DoNotTransform:!0,RemoveDraggableOnDragEnd:!0,dragThreshold:10},dragRect:{left:u,top:d,right:u+p,bottom:d+150,width:p,height:100}})},...i,children:n})},mu=({className:e,...t})=>No(lu,{...t,className:pu(du,e),height:"100%",selectionStrategy:"none"});O("PaletteSalt",mu,"view");import{useIdMemo as fu}from"@salt-ds/core";import hu from"classnames";import{Tab as gu,Tabstrip as yu,Toolbar as bu,ToolbarField as xu}from"@heswell/salt-lab";import Bt,{forwardRef as Ru,useCallback as Eu}from"react";import{jsx as Ot,jsxs as Tu}from"react/jsx-runtime";var wu="Tabs",Su=(e,t)=>{var o,n;return(n=(o=e.props)==null?void 0:o.title)!=null?n:`Tab ${t+1}`},vu=e=>{let t=[];return Bt.Children.forEach(e,o=>{Bt.isValidElement(o)?t.push(o):console.warn("Stack has unexpected child element type")}),t},Ho=Ru(function({active:t=0,children:o,className:n,enableAddTab:r,enableCloseTabs:s,getTabLabel:i=Su,id:a,keyBoardActivation:l="manual",onMouseDown:c,onTabAdd:u,onTabClose:d,onTabEdit:p,onTabSelectionChanged:m,showTabs:f,style:g,TabstripProps:b},h){let S=fu(a),R=w=>{m==null||m(w)},y=w=>{d==null||d(w)},x=()=>{u==null||u(Bt.Children.count(o))},E=w=>{var k;let L=w.target.closest('[role^="tab"]'),C=L==null?void 0:L.getAttribute("role");if(C==="tab"){let B=parseInt((k=L.dataset.idx)!=null?k:"-1");if(B!==-1)c==null||c(w,B);else throw Error("Stack: mousedown on tab with unknown index")}else C==="tablist"&&console.log("Stack mousedown on tabstrip")},T=Eu((w,v,L,C)=>{p==null||p(C,v)},[p]),D=()=>{var w;return Bt.isValidElement(o)?o:Array.isArray(o)&&(w=o[t])!=null?w:null},P=()=>vu(o).map((w,v)=>{let L=`${S}-${v}`,{closeable:C,id:k}=w.props;return Ot(gu,{ariaControls:`${L}-tab`,draggable:!0,id:L,label:i(w,v),closeable:C,editable:!0},k!=null?k:v)}),M=D();return Tu("div",{className:hu(wu,n),style:g,id:S,ref:h,children:[f?Ot(bu,{className:"vuuTabHeader vuuHeader",children:Ot(xu,{disableFocusRing:!0,"data-collapsible":"dynamic","data-priority":"3",style:{alignSelf:"flex-end"},children:Ot(yu,{...b,enableRenameTab:!0,enableAddTab:r,enableCloseTab:s,keyBoardActivation:l,onActiveChange:R,onAddTab:x,onCloseTab:y,onExitEditMode:T,onMouseDown:E,activeTabIndex:t||(M===null?-1:0),children:P()})})}):null,M]})});Ho.displayName="Stack";import{useIdMemo as Pu}from"@salt-ds/core";import Du,{useRef as Mu}from"react";import{jsx as Fo}from"react/jsx-runtime";var Lu=e=>Fo(se,{resizeable:!0,title:`Tab ${e}`,style:{flexGrow:1,flexShrink:0,flexBasis:0},header:!0,closeable:!0,children:Fo(Ut,{style:{flex:1}})}),Ls=e=>{let t=Mu(null),o=Z(),{loadState:n,saveState:r}=Te(),{createNewChild:s=Lu,id:i,onTabSelectionChanged:a,path:l,...c}=e,{children:u}=e,d=Pu(i),[p]=It(d,t,l);return Fo(Ho,{...c,id:d,getTabLabel:(R,y)=>{let{id:x,title:E}=R.props;return n(x,"view-title")||E||`Tab ${y+1}`},onMouseDown:async(R,y)=>{let x;await p({type:"mousedown",index:y,preDragActivity:async()=>new Promise(D=>{console.log("preDragActivity: Ok, gonna release the drag"),x=D})},R)&&(x==null||x(void 0))},onTabAdd:(R,y=Du.Children.count(u))=>{if(l){console.log("[StackLayout] handleTabAdd");let x=s(y);console.log({component:x}),o({type:"add",path:l,component:x})}},onTabClose:R=>{if(Array.isArray(u)){let{props:{"data-path":y,path:x=y}}=u[R];o({type:"remove",path:x})}},onTabEdit:(R,y)=>{o({type:"set-title",path:`${l}.${R}`,title:y})},onTabSelectionChanged:R=>{console.log(`StackLayout handleTabSelection nextTab = ${R}`),l&&(o({type:"switch-tab",path:l,nextIdx:R}),a==null||a(R))},ref:t})};Ls.displayName="Stack";O("Stack",Ls,"container");import Cs,{useState as Is}from"react";import{jsx as Vo,jsxs as As}from"react/jsx-runtime";var CR=({children:e})=>{let[o,n]=Is(e),[r,s]=Is(e),i=l=>{let c=rn(o,l);s(c)},a=(l,c)=>{console.log(`change ${l} -> ${c}`);let u=Cs.cloneElement(r,{style:{...r.props.style,[l]:c}});s(u),n(Cs.cloneElement(o,null,u))};return As("div",{"data-design-mode":`${!1}`,children:[o,Vo("br",{}),As("div",{style:{display:"flex"},children:[Vo(zs,{height:300,managedStyle:r.props.style,width:300,onChange:a}),Vo(ks,{layout:o,onSelect:i,style:{width:300,height:300,backgroundColor:"#ccc"}})]})]})};import{FormField as $t,Input as Nt}from"@heswell/salt-lab";import{jsx as H,jsxs as _o}from"react/jsx-runtime";var Go={},Cu={margin:{top:"marginTop",right:"marginRight",bottom:"marginBottom",left:"marginLeft"},border:{top:"borderTopWidth",right:"borderRightWidth",bottom:"borderBottomWidth",left:"borderLeftWidth"},padding:{top:"paddingTop",right:"paddingRight",bottom:"paddingBottom",left:"paddingLeft"}},Wo=({feature:e,children:t,style:o,onChange:n})=>_o("div",{className:`LayoutBox layout-${e} layout-outer`,children:[_o("div",{className:"layout-top",children:[H("span",{className:"layout-title",children:e}),H($t,{className:"layout-input",style:{width:30},children:H(Nt,{value:o.top,onChange:(r,s)=>n(e,"top",s)})})]}),_o("div",{className:"layout-inner",children:[H("div",{className:"layout-left",children:H($t,{className:"layout-input",style:{width:30},children:H(Nt,{value:o.left,onChange:(r,s)=>n(e,"left",s)})})}),t,H("div",{className:"layout-right",children:H($t,{className:"layout-input",style:{width:30},children:H(Nt,{value:o.right,onChange:(r,s)=>n(e,"right",s)})})})]}),H("div",{className:"layout-bottom",children:H($t,{className:"layout-input",style:{width:30},children:H(Nt,{value:o.bottom,onChange:(r,s)=>n(e,"bottom",s)})})})]}),HR={margin:!0,marginTop:!0,marginRight:!0,marginBottom:!0,marginLeft:!0},FR={padding:!0,paddingTop:!0,paddingRight:!0,paddingBottom:!0,paddingLeft:!0},VR={border:!0,borderColor:!0,borderWidth:!0,borderTopWidth:!0,borderRightWidth:!0,borderBottomWidth:!0,borderLeftWidth:!0},Ht="(\\d+)(?:px)?",Iu=`^(?:${Ht}(?:\\s${Ht}(?:\\s${Ht}(?:\\s${Ht})?)?)?)$`,Os=new RegExp(Iu),Au=/^(?:(\d+)(?:px)\ssolid\s([a-zA-Z,0-9().]+))$/,zs=({height:e,managedStyle:t,onChange:o,style:n,width:r})=>{let s=Bs(t),i=(R,y,x)=>{let E=parseInt(x||"0",10),T=Cu[R][y];o(T,E)},{marginTop:a=0,marginRight:l=0,marginBottom:c=0,marginLeft:u=0}=s,{borderTopWidth:d=0,borderRightWidth:p=0,borderBottomWidth:m=0,borderLeftWidth:f=0}=s,{paddingTop:g=0,paddingRight:b=0,paddingBottom:h=0,paddingLeft:S=0}=s;return H("div",{className:"LayoutConfigurator",style:{width:r,height:e,...n},children:H(Wo,{feature:"margin",style:{top:a,right:l,bottom:c,left:u},onChange:i,children:H(Wo,{feature:"border",style:{top:d,right:p,bottom:m,left:f},onChange:i,children:H(Wo,{feature:"padding",style:{top:g,right:b,bottom:h,left:S},onChange:i,children:H("div",{className:"layout-content"})})})})})};function WR(e=Go,t=Go){let{margin:o,marginTop:n,marginRight:r,marginBottom:s,marginLeft:i,padding:a,paddingTop:l,paddingRight:c,paddingBottom:u,paddingLeft:d,...p}=e;if(typeof o=="number")p.marginTop=p.marginRight=p.marginBottom=p.marginLeft=o;else if(typeof o=="string"){let m=Os.exec(o);if(m===null)console.error(`Invalid css value for margin '${o}'`);else{let[,f,g,b,h]=m,S=f&&g&&b;S&&h?(p.marginTop=parseInt(f,10),p.marginRight=parseInt(g,10),p.marginBottom=parseInt(b,10),p.marginLeft=parseInt(h,10)):S?(p.marginTop=parseInt(f,10),p.marginRight=p.marginLeft=parseInt(g,10),p.marginBottom=parseInt(b,10)):f&&g?(p.marginTop=p.marginBottom=parseInt(f,10),p.marginRight=p.marginLeft=parseInt(g,10)):p.marginTop=p.marginRight=p.marginBottom=p.marginLeft=parseInt(f,10)}}if(typeof n=="number"&&(p.marginTop=n),typeof r=="number"&&(p.marginRight=r),typeof s=="number"&&(p.marginBottom=s),typeof i=="number"&&(p.marginLeft=i),typeof a=="number")p.paddingTop=p.paddingRight=p.paddingBottom=p.paddingLeft=a;else if(typeof a=="string"){let m=Os.exec(a);if(m===null)console.error(`Invalid css value for padding '${a}'`);else{let[,f,g,b,h]=m,S=f&&g&&b;S&&h?(p.paddingTop=parseInt(f,10),p.paddingRight=parseInt(g,10),p.paddingBottom=parseInt(b,10),p.paddingLeft=parseInt(h,10)):S?(p.paddingTop=parseInt(f,10),p.paddingRight=p.paddingLeft=parseInt(g,10),p.paddingBottom=parseInt(b,10)):f&&g?(p.paddingTop=p.paddingBottom=parseInt(f,10),p.paddingRight=p.paddingLeft=parseInt(g,10)):p.paddingTop=p.paddingRight=p.paddingBottom=p.paddinggLeft=parseInt(f,10)}}return typeof l=="number"&&(p.paddingTop=l),typeof c=="number"&&(p.paddingRight=c),typeof u=="number"&&(p.paddingBottom=u),typeof d=="number"&&(p.paddingLeft=d),Bs(p,t)}function Bs(e=Go){let t={...e},o,{border:n,borderWidth:r,borderTopWidth:s,borderRightWidth:i,borderBottomWidth:a,borderLeftWidth:l,borderColor:c,margin:u,marginTop:d,marginRight:p,marginBottom:m,marginLeft:f,padding:g,paddingTop:b,paddingRight:h,paddingBottom:S,paddingLeft:R,...y}=t,x={},E={};if(typeof u=="number"&&(t.marginTop=t.marginRight=t.marginBottom=t.marginLeft=u,x={marginTop:u,marginRight:u,marginBottom:u,marginLeft:u}),typeof g=="number"&&(t.paddingTop=t.paddingRight=t.paddingBottom=t.paddingLeft=g,E={paddingTop:g,paddingRight:g,paddingBottom:g,paddingLeft:g}),n||r||s||i||a||l){typeof n=="string"&&(o=Au.exec(n))&&([,r,c]=o,r=parseInt(r,10)),r&&(s=s===void 0?r:s,i=i===void 0?r:i,a=a===void 0?r:a,l=l===void 0?r:l),c=c||"black";let T=`
|
|
18
|
+
${c} ${l||0}px ${s||0}px 0 0 inset,
|
|
19
|
+
${c} ${-i||0}px ${-a||0}px 0 0 inset`;return{...y,...x,...E,borderTopWidth:s,borderRightWidth:i,borderBottomWidth:a,borderLeftWidth:l,borderColor:c,borderStyle:"solid",boxShadow:T}}else return t}import zu from"react";import ku from"classnames";import{Tree as Ou}from"@heswell/salt-lab";import{jsx as $s}from"react/jsx-runtime";var Bu="hwLayoutTreeViewer",Ns=(e,t="0")=>({label:z(e),path:t,childNodes:zu.Children.map(e.props.children,(o,n)=>Ns(o,t?`${t}.${n}`:`${n}`))}),ks=({layout:e,onSelect:t,style:o})=>{let n=[Ns(e)],r=(s,[{path:i}])=>{t(i)};return $s("div",{className:ku(Bu),style:o,children:$s(Ou,{source:n,groupSelection:"single",onSelectionChange:r})})};export{Se as Action,VR as BORDER_STYLES,Ys as Chest,Ut as Component,ne as ComponentRegistry,CR as ConfigWrapper,Oo as ContextMenu,Bo as ContextMenuContext,jb as ContextMenuProvider,tb as Dialog,xt as DialogService,fo as Draggable,Ts as DraggableLayout,Wt as Drawer,cr as DropMenu,pe as DropTarget,He as Flexbox,Pr as FlexboxLayout,vo as FluidGrid,_r as FluidGridLayout,Yr as Header,Uh as HeightOnly,zs as LayoutConfigurator,Mh as LayoutProvider,Ge as LayoutProviderContext,Dh as LayoutProviderVersion,ks as LayoutTreeViewer,HR as MARGIN_STYLES,Co as MenuItem,kt as MenuItemGroup,Io as MenuList,FR as PADDING_STYLES,au as Palette,Ms as PaletteItem,Gx as PaletteListItem,mu as PaletteSalt,nt as Placeholder,Mf as Popup,G as PopupService,ys as Separator,Ho as Stack,Ls as StackLayout,se as View,Ct as ViewContext,Gh as WidthHeight,Kh as WidthOnly,WR as XXXnormalizeStyles,sn as componentFromLayout,lr as computeMenuPosition,ii as containerOf,Kt as expandFlex,ag as extractResponsiveProps,ae as findTarget,_ as followPath,rn as followPathToComponent,ie as followPathToParent,ai as getChild,nn as getChildProp,xn as getPersistentState,A as getProp,I as getProps,Rn as hasPersistentState,ao as identifyDropTarget,F as isContainer,jo as isLayoutComponent,Yu as isRegistered,Ll as isResponsiveAttribute,af as isTabstrip,$p as isTypeOf,Gs as isView,Gp as nextLeaf,q as nextStep,Up as previousLeaf,O as registerComponent,N as resetPath,En as setPersistentState,qp as setRef,z as typeOf,Ar as useBreakpoints,Jb as useContextMenu,Z as useLayoutProviderDispatch,rl as useLayoutProviderVersion,sg as useOverflowObserver,Te as usePersistentState,Mt as useResizeObserver,It as useViewActionDispatcher,_g as useViewContext,Ur as useViewDispatch};
|
|
20
|
+
//# sourceMappingURL=index.js.map
|