@vuu-ui/vuu-layout 0.5.5 → 0.5.6

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/esm/index.js CHANGED
@@ -1,4 +1,4 @@
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=`
1
+ import ri from"classnames";import{useCallback as Qr}from"react";import Eo from"classnames";import{Button as So,useControlled as ei}from"@salt-ds/core";import{jsx as Le,jsxs as oi}from"react/jsx-runtime";var ae="vuuDrawer",wo=e=>typeof e=="string"?e:e+"px",ti=(e,t,o)=>{let n=t!==void 0,r=o!==void 0;if(!(!e&&!r&&!n))return!r&&!n?e:{...e,"--drawer-size":n?wo(t):void 0,"--drawer-peek-size":r?wo(o):void 0}},vo=({children:e,className:t,clickToOpen:o,defaultOpen:n,sizeOpen:r,sizeClosed:i,style:s,open:a,position:l="left",inline:c,onClick:p,peekaboo:m=!1,toggleButton:u,...d})=>{let[h,g]=ei({controlled:a,default:n!=null?n:!1,name:"Drawer",state:"open"}),y=Eo(ae,t,`${ae}-${l}`,{[`${ae}-open`]:h,[`${ae}-inline`]:c,[`${ae}-over`]:!c,[`${ae}-peekaboo`]:m}),f=Qr(()=>{console.log("toggleDrawer"),g(!h)},[h,g]),b=ti(s,r,i),R=o?f:p,E=()=>Le("div",{className:Eo("vuuToggleButton-container"),children:h?Le(So,{"aria-label":"close",onClick:f,"data-icon":"close",variant:"secondary"}):Le(So,{"aria-label":"open",onClick:f,"data-icon":"close",variant:"secondary"})});return oi("div",{...d,className:y,onClick:R,style:b,children:[u=="start"?E():null,Le("div",{className:`${ae}-liner`,children:Le("div",{className:`${ae}-content`,children:e})}),u=="end"?E():null]})};vo.displayName="Drawer";var Dt=vo;import{partition as Lo}from"@vuu-ui/vuu-utils";var Do={},To={},oe={};function F(e){return Do[e]===!0}function ni(e){return To[e]===!0}var Po=e=>F(e)||ni(e),vc=e=>!!oe[e];function B(e,t,o="component"){oe[e]=t,o==="container"?Do[e]=!0:o==="view"&&(To[e]=!0)}import{jsx as li,jsxs as ci}from"react/jsx-runtime";var ii=e=>e.type===Dt,si=({props:{position:e="left"}})=>e.match(/top|bottom/),Tt=e=>{let{children:t,className:o,id:n,style:r}=e,i="hwChest",[s,a]=Lo(t,ii),[l,c]=Lo(s,si),p=l.length===0?"horizontal":c.length===0?"vertical":"both",m=ri(i,o,`${i}-${p}`);return ci("div",{className:m,id:n,style:r,children:[s,li("div",{className:`${i}-content`,children:a})]})};Tt.displayName="Chest";var ai=Tt;B("Chest",Tt,"container");import{forwardRef as ui}from"react";import{jsx as pi}from"react/jsx-runtime";var Pt=ui(function({resizeable:t,...o},n){return pi("div",{...o,className:"Component",ref:n})});Pt.displayName="Component";var Lt=Pt;B("Component",Pt);import{useCallback as Oo,useRef as bi,useState as ko}from"react";import xi from"classnames";import{useLayoutEffect as zo,useMemo as yi}from"react";import*as Ao from"react-dom";import*as Mo from"react-dom";import{SaltProvider as mi}from"@salt-ds/core";import{jsx as gi}from"react/jsx-runtime";var di=1,fi=(e=0,t=0,o=window)=>{let n=o.document.createElement("div");return n.className="vuuPopup "+di++,n.style.cssText=`left:${e}px; top:${t}px;`,o.document.body.appendChild(n),n},hi=(e,t)=>fi(e,t),Xe=(e,t,o,n,r)=>{t.style.cssText=`left:${o}px; top:${n}px;position: absolute;`,Mo.render(gi(mi,{applyClassesTo:"child",children:e}),t,r)},Co=hi;var Io=function({children:t,x:o=0,y:n=0,onRender:r}){let i=yi(()=>Co(),[]);return zo(()=>{Xe(t,i,o,n,r)},[t,r,i,o,n]),zo(()=>()=>{var s;i&&(Ao.unmountComponentAtNode(i),i.classList.contains("vuuPopup")&&((s=i.parentElement)==null||s.removeChild(i)))},[i]),null};import{Scrim as Ri}from"@heswell/salt-lab";import{Text as Ei}from"@salt-ds/core";import{Toolbar as Si,ToolbarButton as wi}from"@heswell/salt-lab";import{jsx as Ye,jsxs as Bo}from"react/jsx-runtime";var Mt="vuuDialog",gu=({children:e,className:t,isOpen:o=!1,onClose:n,title:r,...i})=>{let s=bi(null),[a,l]=ko(0),[c,p]=ko(0),m=Oo(()=>{n==null||n()},[n]),u=Oo(()=>{},[]);return o?Ye(Io,{onRender:u,x:a,y:c,children:Ye(Ri,{className:`${Mt}-scrim`,open:o,children:Bo("div",{...i,className:xi(Mt,t),ref:s,children:[Bo(Si,{className:`${Mt}-header`,children:[Ye(Ei,{children:r}),Ye(wi,{onClick:m,"data-align-end":!0,"data-icon":"close"},"close")]}),e]})})}):null};import vi from"classnames";import{useRef as Di}from"react";import{jsx as Ti}from"react/jsx-runtime";var No=function(t){let o=Di();o.current=t;let{className:n,id:r,style:i}=t,s=vi("DraggableLayout",n);return Ti("div",{className:s,id:r,style:i,children:t.children})},Ho="DraggableLayout";No.displayName=Ho;B(Ho,No,"container");var Ct=e=>{if(typeof e=="number")return{flexBasis:0,flexGrow:1,flexShrink:1};throw Error(`"no support yet for flex value ${e}`)};import de from"react";var Pi={},A=(e,t)=>{var n;let o=z(e);return(n=o[t])!=null?n:o[`data-${t}`]},z=e=>(e==null?void 0:e.props)||e||Pi,$o=e=>{let t=z(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 I(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 Au=(e,t)=>I(e)===t;var Li=e=>{let t=e.lastIndexOf(".");return t===-1?e:e.slice(0,t)};function re(e,t){let{"data-path":o,path:n=o}=z(e);return t==="0"||t===n?null:_(e,Li(t),!0)}function ie(e,t){let{children:o,...n}=z(e);if(t(n))return e;if(de.Children.count(o)>0){let r=de.isValidElement(o)?[o]:o;for(let i of r){let s=ie(i,t);if(s)return s}}}function Mi(e,t){if(t===e)return null;{let{path:o,children:n}=z(e),{idx:r,finalStep:i}=q(o,A(t,"path"));return i?e:n===void 0||n[r]===void 0?null:Mi(n[r],t)}}var Ci=(e,t)=>{if(de.isValidElement(e)&&t==0)return e;if(Array.isArray(e))return e[t]};function Fo(e,t){var o=t.split(".");let n=[e],r=i=>de.isValidElement(i.props.children)?[i.props.children]:i.props.children;for(let i=0;i<o.length;i++){let s=parseInt(o[i]),a=n[s];if(i===o.length-1)return a;n=r(a)}}function _(e,t,o=!1){let{"data-path":n,path:r=n}=z(e);if(t.indexOf(r)!==0)throw Error(`pathUtils.followPath path ${t} is not within source path ${r}`);let i=t.slice(r.length+1);if(i==="")return e;let s=e,a=i.split(".");for(var l=0;l<a.length;l++){if(de.Children.count(s.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(s=Ci(s.props.children,parseInt(a[l])),s===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 s}function $u(e,t){let o=re(e,t),n=t.split(".").map(r=>parseInt(r,10));if(o){let r=n.pop(),{children:i}=o.props;if(i.length-1>r)return Ze(i[r+1]);{let s=n.pop(),a=re(e,A(o,"path"));if(a&&typeof s=="number"&&(n=a.props.path.split(".").map(l=>parseInt(l,10)),a.props.children.length-1>s)){let l=a.props.children[s+1];return F(I(l))?Ze(l):l}}}return Ze(e)}function Fu(e,t){let o=t.split(".").map(i=>parseInt(i,10)),n=o.pop(),r=re(e,t);if(r!=null&&typeof n=="number"){let{children:i}=r.props;if(n>0)return qe(i[n-1]);for(;o.length>1;)if(n=o.pop(),r=re(e,A(r,"path")),n>0){let s=r.props.children[n-1];return F(I(s))?qe(s):s}}return qe(e)}function Ze(e){if(F(I(e))){let{children:t}=e.props||e;return Ze(t[0])}else return e}function qe(e){if(F(I(e))){let{children:t}=e.props||e;return qe(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,i=t.replace(n,"").split(".").map(s=>parseInt(s,10));return{idx:i[0],finalStep:i.length===r}}function H(e,t,o){if(A(e,"path")===t)return e;let n=[];de.Children.forEach(e.props.children,(i,s)=>{A(i,"path")?n.push(H(i,`${t}.${s}`)):n.push(i)});let r=e.props["data-path"]?"data-path":"path";return de.cloneElement(e,{[r]:t,...o},n)}import{createElement as Ai}from"react";function Vo(e){let{id:t,type:o,props:n,children:r}=e,i=zi(o),s=!r||r.length===0?null:r.length===1?Vo(r[0]):r.map(Vo);return Ai(i,{...n,key:t},s)}function zi(e){let t=oe[e];if(t===void 0)throw Error("componentFromLayout: unknown component type: "+e);return t}function Uu(e,t){typeof e=="function"?e(t):e&&(e.current=t)}var he={north:1,east:2,south:4,west:8,header:16,centre:32,absolute:64},Me={AFTER:"after",BEFORE:"before"},V=Object.freeze({North:fe("north"),East:fe("east"),South:fe("south"),West:fe("west"),Header:fe("header"),Centre:fe("centre"),Absolute:fe("absolute")});function fe(e){return Object.freeze({offset:e==="north"||e==="west"?0:e==="south"||e==="east"?1:NaN,valueOf:function(){return he[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 Wo=V.North,_o=V.South,zt=V.East,At=V.West,Ii=V.Header,Oi=V.Centre,Re=class{static measure(t,o=[]){var n={};return Ni(t,n,o),n}static allBoxesContainingPoint(t,o,n,r,i){return Yo(t,o,n,r,i).reverse()}};function It(e,t,o,n=30){let r=o.right-o.left,i=o.bottom-o.top,s=e-o.left,a=t-o.top,l=0;return s<n&&(l+=8),s>r-n&&(l+=2),a<n&&(l+=1),a>i-n&&(l+=4),{pctX:s/r,pctY:a/i,closeToTheEdge:l}}function Ot(e,t,o,n){let{BEFORE:r,AFTER:i}=Me,{pctX:s,pctY:a,closeToTheEdge:l}=It(e,t,o),c,p;if(n==="row")c=s<.5?At:zt;else if(o.header&&Je(o.header,e,t))if(c=Ii,o.Stack){let m=o.Stack.length;if(m===0)p={index:-1,left:o.left,positionRelativeToTab:i,width:0};else{let u=o.Stack.find(({left:d,right:h})=>e>=d&&e<=h);if(u){let d=u.right-u.left;p={index:o.Stack.indexOf(u),left:u.left,positionRelativeToTab:(e-u.left)/d<.5?r:i,width:d}}else p={left:o.Stack[m-1].right,width:0,index:m,positionRelativeToTab:i}}}else if(o.header.titleWidth){let m=o.header.titleWidth;p={index:-1,left:o.left,positionRelativeToTab:(e-o.left)/m<.5?r:i,width:m}}else p={left:o.left,width:0,positionRelativeToTab:r,index:-1};else c=ki(e,t,o,s,a);return{position:c,x:e,y:t,closeToTheEdge:l,tab:p}}function ki(e,t,o,n,r){let i=Bi(o,.2);if(Je(i,e,t))return Oi;switch(`${r<.5?"north":"south"}${n<.5?"west":"east"}`){case"northwest":return n>r?Wo:At;case"northeast":return 1-n>r?Wo:zt;case"southeast":return n>r?zt:_o;case"southwest":return 1-n>r?At:_o;default:}}function Bi({right:e,left:t,top:o,bottom:n},r){let i=(1-r)/2,s=(e-t)*i,a=(n-o)*i;return{left:t+s,top:o+a,right:e-s,bottom:n-a}}function Ni(e,t,o){let{id:n,"data-path":r,path:i=r}=z(e),s=I(e);if(n&&i){let[a,l]=Xo(e);Go(e,a,l,t),F(s)&&Uo(e,t,o)}}function Go(e,t,o,n){let{"data-path":r,path:i=r,header:s}=z(e);n[i]=t;let a=I(e);if(s||a==="Stack"){let l=o.querySelector(".vuuHeader");if(l){let{top:c,left:p,right:m,bottom:u}=l.getBoundingClientRect();if(n[i].header={top:Math.round(c),left:Math.round(p),right:Math.round(m),bottom:Math.round(u)},a==="Stack")n[i].Stack=Array.from(l.querySelectorAll(".saltTab")).map(d=>d.getBoundingClientRect()).map(({left:d,right:h})=>({left:d,right:h}));else{let d=l.querySelector('[class^="vuuHeader-title"]'),{header:h}=n[i];d&&h&&(h.titleWidth=d.clientWidth)}}}return n[i]}function Uo(e,t,o,n=0,r=0,i=0,s=0){let{children:a,"data-path":l,path:c=l,style:p,active:m=0}=z(e),u=I(e),d=u==="Flexbox",h=u==="Stack",g=d&&p.flexDirection==="column",y=d&&p.flexDirection==="row",b=(h?a.filter((E,w)=>w===m):a.filter(Hi)).map(E=>{let[w,x]=Xo(E);return[{...w,top:w.top-i,right:w.right+r,bottom:w.bottom+s,left:w.left-n},x,E]}),R=b.map(([E,w,x],v,T)=>{let L,M,D,S,P,C,O=T.length-1;y?(P=v===0?0:E.left-T[v-1][0].right,C=v===O?0:T[v+1][0].left-E.right,L=v===0||P===0?0:P,M=v===O||C===0?0:C-C/2,E.left-=L,E.right+=M,D=i,S=s):g&&(P=v===0?0:E.top-T[v-1][0].bottom,C=v===O?0:T[v+1][0].top-E.bottom,D=v===0||P===0?0:P,S=v===O||C===0?0:C-C/2,E.top-=D,E.bottom+=S,L=n,M=r);let N=Go(x,E,w,t),k=I(x);return F(k)&&Uo(x,t,o,L,M,D,S),N});b.length&&(t[c].children=R)}function Hi(e){let{id:t}=z(e),o=document.getElementById(t);return o?o.dataset.dragging!=="true":(console.warn(`BoxModel: no element found with id #${t}`),!1)}function Xo(e){let{id:t}=z(e),o=I(e),n=document.getElementById(t);if(!n)throw Error(`No DOM for ${o} ${t}`);let{top:r,left:i,right:s,bottom:a,height:l,width:c}=n.getBoundingClientRect(),p;if(F(o)){let m=n.scrollHeight;m>l&&(p={id:t,scrollHeight:m,scrollTop:n.scrollTop})}return[{top:Math.round(r),left:Math.round(i),right:Math.round(s),bottom:Math.round(a),height:Math.round(l),width:Math.round(c),scrolling:p},n,e]}function Yo(e,t,o,n,r,i=[]){let{children:s,"data-path":a,path:l=a}=z(e),c=I(e);var p=t[l];if(!Je(p,o,n))return i;if(r&&r.length){if(r.includes(l))i.push(e);else if(!r.some(u=>u.startsWith(l)))return i}else i.push(e);if(!F(c)||p.header&&Je(p.header,o,n))return i;p.scrolling&&$i(p,o,n);for(var m=0;m<s.length;m++){if(c==="Stack"&&e.props.active!==m)continue;let u=Yo(s[m],t,o,n,r);if(u.length)return i.concat(u)}return i}function Je(e,t,o){if(e)return t>=e.left&&t<e.right&&o>=e.top&&o<e.bottom}function $i({top:e,bottom:t,scrolling:o},n,r){if(o){let{id:i,scrollTop:s,scrollHeight:a}=o,l=t-e;if(s===0&&t-r<50){let c=a-l;document.getElementById(i).scrollTo({left:0,top:c,behavior:"smooth"}),o.scrollTop=c}else if(s>0&&r-e<50)document.getElementById(i).scrollTo({left:0,top:0,behavior:"smooth"}),o.scrollTop=0;else return!1}else return!1}var Fi=.4,Ke=class{constructor(t,o,n,r,i){this.init(t,o,n,r,i)}init(t,o,n,r,i){var{left:s,top:a}=r,{pctX:l,pctY:c}=It(o,n,r),p=Fi,m=l*r.width,u=r.width-m,d=c*r.height,h=r.height-d,g=r.width*p,y=r.height*p,f=1-p,b=m*f,R=d*f,E=u*f,w=h*f;this.intrinsicSize=i,this.constraint={zone:{x:{lo:t.left,hi:t.right},y:{lo:t.top,hi:t.bottom}},pos:{x:{lo:t.left-b,hi:t.right-r.width+E},y:{lo:t.top-R,hi:t.bottom-r.height+w}},mouse:{x:{lo:t.left+g*l,hi:t.right-g*(1-l)},y:{lo:t.top+y*c,hi:t.bottom-y*(1-c)}}},this.x={pos:s,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],i=this.constraint.pos[t],s=n.pos,a=o-n.mousePos;return a<0?n.lo||(o<r.lo?(n.lo=!0,n.pos=i.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=i.hi):n.lo?o>r.lo&&(n.lo=!1,n.pos+=a):n.pos+=a)),n.mousePos=o,s!==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 cp=e=>e.pos.tab&&I(e.component)==="Stack"&&e.pos.position.Header,{north:Vi,south:Wi,east:_i,west:Gi}=he,Ui=_i+Gi,Xi=Vi+Wi,le=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===Me.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,i,s]=this.getDropRectOutline(t,o);return{l:n,t:r,r:i,b:s}}}getDropTabOutline(t,o){let{clientRect:{top:n,left:r,right:i,bottom:s,header:a}}=this,l=0,c=Math.round(t/2)+l,p=Math.round(n),m=Math.round(r+c),u=Math.round(i-c),d=Math.round(s-c),h=this.targetTabPos(o),g=60,y=a.bottom-a.top;return{l:m,t:p,r:u,b:d,tabLeft:h,tabWidth:g,tabHeight:y}}getIntrinsicDropRect(t){var g,y,f,b;let{pos:o,clientRect:n}=this,{x:r,y:i}=t,s=(y=(g=t.intrinsicSize)==null?void 0:g.height)!=null?y:0,a=(b=(f=t.intrinsicSize)==null?void 0:f.height)!=null?b:0;s&&s>n.height?(console.log("DropTarget: we're going to blow the gaff"),s=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-s,Math.max(n.top,Math.round(o.y-i.mousePct*s))),[p,m,u,d]=this.dropRect=[l,c,l+a,c+s],h=o.position.EastOrWest?[p,n.top,p,n.bottom,u,n.top,u,n.bottom]:[n.left,m,n.right,m,n.left,d,n.right,d];return{l:p,r:u,t:m,b:d,guideLines:h}}getDropRectOutline(t,o){var b,R,E;let{pos:n,clientRect:r}=this,{width:i,height:s,position:a}=n,{width:l,height:c}=(b=o==null?void 0:o.intrinsicSize)!=null?b:{},p=(R=c!=null?c:s)!=null?R:0,m=(E=l!=null?l:i)!=null?E:0;this.dropRect=void 0;let{top:u,left:d,right:h,bottom:g}=r,y=0,f=Math.round(t/2)+y;switch(a){case V.North:case V.Header:{let w=Math.round((g-u)/2),x=p?Math.min(w,Math.round(p)):w;return m&&d+m<h?[d+f,u+f,d+m-f,u+f+x]:[d+f,u+f,h-f,u+f+x]}case V.West:{let w=Math.round((h-d)/2),x=m?Math.min(w,Math.round(m)):w;return p&&u+p<g?[d+f,u+f,d-f+x,u+p+f]:[d+f,u+f,d-f+x,g-f]}case V.East:{let w=Math.round((h-d)/2),x=m?Math.min(w,Math.round(m)):w;return p&&u+p<g?[h-f-x,u+f,h-f,u+p+f]:[h-f-x,u+f,h-f,g-f]}case V.South:{let w=Math.round((g-u)/2),x=p?Math.min(w,Math.round(p)):w;return m&&d+m<h?[d+f,g-f-x,d+m-f,g-f]:[d+f,g-f-x,h-f,g-f]}case V.Centre:return[d+f,u+f,h-f,g-f];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:le.getActiveDropTarget(t.nextDropTarget)}};function kt(e,t,o,n,r,i){var l;let s=null,a=Re.allBoxesContainingPoint(o,n,e,t,i);if(a.length){let[c,...p]=a,{"data-path":m,path:u=m,"data-row-placeholder":d}=z(c),h=n[u],y=Ot(e,t,h,r&&d?"row":void 0),f=n[u],b=([R,...E])=>{var w,x;if(((w=y.position)==null?void 0:w.Header)||y.closeToTheEdge){let v=Yi(R,y,f,n,e,t);if(v){let[T,L]=v;return new le({component:R,pos:T,clientRect:L,nextDropTarget:(x=b(E))!=null?x:null})}else if(E.length)return b(E)}};s=new le({component:c,pos:y,clientRect:h,nextDropTarget:(l=b(p))!=null?l:null}).activate()}return s}function Yi(e,{closeToTheEdge:t,position:o},n,r,i,s){if(!e||e.type==="DraggableLayout")return;let a=r[e.props.path],l=t&he.north,c=t&he.east,p=t&he.south,m=t&he.west,u=(l||o.Header)&&Math.round(n.top)===Math.round(a.top),d=c&&Math.round(n.right)===Math.round(a.right),h=p&&Math.round(n.bottom)===Math.round(a.bottom),g=m&&Math.round(n.left)===Math.round(a.left);if(u||d||h||g){let{"data-path":y,path:f=y}=e.props,b=r[f],R=Ot(i,s,b);if((Zi(e)||Zo(e))&&t&Ui)return R.width=120,[R,b];if((qi(e)||Zo(e))&&(o.Header||t&Xi))return R.height=120,[R,b]}}function Zo(e){return I(e)==="Stack"}function Zi(e){return I(e)==="Flexbox"&&e.props.style.flexDirection==="column"}function qi(e){return I(e)==="Flexbox"&&e.props.style.flexDirection==="row"}import Ji from"classnames";import Ki,{createElement as qo,useEffect as hp,useRef as gp}from"react";import Bt from"react-dom";window.popupReact=Ki;var Nt=!1,J=[];function Jo(e){e.keyCode===27&&(J.length?jo():Nt&&Bt.unmountComponentAtNode(document.body.querySelector(".vuuDialog")))}function Ko(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;jo()}}function jo(){if(J.length){let e=document.body.querySelectorAll(".vuuPopup");for(let t=0;t<e.length;t++)Bt.unmountComponentAtNode(e[t]);Qo("*")}}function ji(e){J.indexOf(e)===-1&&(J.push(e),Nt===!1&&(window.addEventListener("keydown",Jo,!0),window.addEventListener("click",Ko,!0)))}function Qo(e){if(J.length){if(e==="*")J.length=0;else{let t=J.indexOf(e);t!==-1&&J.splice(t,1)}J.length===0&&Nt===!1&&(window.removeEventListener("keydown",Jo,!0),window.removeEventListener("click",Ko,!0))}}var Qi=({children:e,position:t,style:o})=>{let n=Ji("hwPopup","hwPopupContainer",t);return qo("div",{className:n,style:o},e)},es=1,ce=class{static showPopup({name:t="anon",group:o="all",position:n="",left:r=0,right:i="auto",top:s=0,width:a="auto",component:l}){if(!l)throw Error("PopupService showPopup, no component supplied");ji(t,o);let c=document.body.querySelector(".vuuPopup."+o);c===null&&(c=document.createElement("div"),c.className="vuuPopup "+o,document.body.appendChild(c));let p={width:a};Xe(qo(Qi,{key:es++,position:n,style:p},l),c,r,s,()=>{ce.keepWithinThePage(c,i)})}static hidePopup(t="anon",o="all"){J.indexOf(t)!==-1&&(Qo(t,o),Bt.unmountComponentAtNode(document.body.querySelector(`.vuuPopup.${o}`)))}static keepWithinThePage(t,o="auto"){let n=t.querySelector(".vuuPopupContainer > *");if(n){let{top:r,left:i,width:s,height:a,right:l}=n.getBoundingClientRect(),c=window.innerWidth,m=window.innerHeight-(r+a);m<0&&(n.style.top=parseInt(r,10)+m+"px");let u=c-(i+s);if(u<0&&(n.style.left=parseInt(i,10)+u+"px"),typeof o=="number"&&o!==l){let d=o-l;n.style.left=i+d+"px"}}}};import ts from"classnames";import{jsx as en}from"react/jsx-runtime";function tn(e,t=0,o=0){let{pos:n,clientRect:r}=e,i=20;return n.position.West?[r.left-o+i,n.y-t,"left"]:n.position.South?[n.x-o,r.bottom-t-i,"bottom"]:n.position.East?[r.right-o-i,n.y-t,"right"]:[n.x-o,r.top-t+i,"top"]}var Ht="vuuDropMenu",on=({className:e,dropTarget:t,onHover:o,orientation:n})=>{let r=t.toArray();return en("div",{className:ts(Ht,e,`${Ht}-${n}`),onMouseLeave:()=>o(null),children:r.map((i,s)=>en("div",{className:`${Ht}-item`,"data-icon":s===0?"column-2A":"column-2B",onMouseEnter:()=>o(i)},s))})};import{jsx as ls}from"react/jsx-runtime";var $t=!1,Ce=null,K=null,os=e=>Ce=e,ns=([e,t])=>`M${e},${t}`,rs=([e,t])=>`L${e},${t}`,nn=([e,...t])=>`${ns(e)} ${t.map(rs)}Z`,is=e=>{if(e){let[t,o,n,r,i,s,a,l]=e;return`M${t},${o} L${n},${r} M${i},${s} L${a},${l}`}else return""};function ss(){if(document.getElementById("hw-drag-canvas")===null){let e=document.getElementById("root"),t=document.createElement("div");t.id="hw-drag-canvas",t.innerHTML=`
2
2
  <svg width="100%" height="100%">
3
3
  <path id="hw-drop-guides" />
4
4
  <path
@@ -14,7 +14,7 @@ import Us from"classnames";import{useCallback as Fs}from"react";import Ko from"c
14
14
  />
15
15
  </path>
16
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};
17
+ `,document.body.insertBefore(t,e)}}var ze=class{constructor(){this.currentPath=null;this.tabMode=null;ss()}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=nn(n),i=document.getElementById("vuu-drop-outline");i==null||i.setAttribute("d",r),this.currentPath=r}clear(){Ce=null,je(),document.body.classList.remove("drawing"),ce.hidePopup()}get hoverDropTarget(){return Ce}getPoints(t,o,n,r,i=0,s=0,a=0){let l=this.tabMode==="tab-only";if(s===0)return[[t,o+a],[t,o+a],[t,o],[t+s,o],[t+s,o],[t+n,o],[t+n,o+r],[t,o+r]];if(l){let c=i;return[[c,o],[c,o],[c+s,o],[c+s,o],[c+s,o+a],[c+s,o+a],[c,o+a],[c,o+a]]}else return i===0?[[t,o+a],[t,o+a],[t,o],[t+s,o],[t+s,o+a],[t+n,o+a],[t+n,o+r],[t,o+r]]:[[t,o+a],[t+i,o+a],[t+i,o],[t+i,o],[t+i,o+a],[t+n,o+a],[t+n,o+r],[t,o+r]]}draw(t,o){let r=$t;if(Ce!==null)this.drawTarget(Ce);else if($t=t.nextDropTarget!=null,t.pos.tab?as(t):K&&je(),this.drawTarget(t,o),$t){let[i,s,a]=tn(t);{let l=ls(on,{dropTarget:t,onHover:os,orientation:a});ce.showPopup({left:i,top:s,component:l})}}else ce.hidePopup()}drawTarget(t,o){let r=t.getTargetDropOutline(6,o);if(r){let{l:i,t:s,r:a,b:l,tabLeft:c,tabWidth:p,tabHeight:m,guideLines:u}=r,d=a-i,h=l-s;if(this.currentPath){let R=document.getElementById("vuu-drop-outline");R==null||R.setAttribute("d",this.currentPath)}let g=this.getPoints(i,s,d,h,c,p,m),y=nn(g),f=document.getElementById("hw-drop-outline-animate");f==null||f.setAttribute("to",y),f==null||f.beginElement(),this.currentPath=y;let b=document.getElementById("hw-drop-guides");b==null||b.setAttribute("d",is(u))}}},rn="transition:margin-left .4s ease-out;margin-left: 63px",sn="transition:margin-left .4s ease-out;margin-left: 0px";function as(e){var a,l;let{AFTER:t,BEFORE:o}=Me,{clientRect:{Stack:n},pos:{tab:r}}=e,{id:i}=e.component.props,s=null;if(n&&r&&r.positionRelativeToTab!==t){let c=r.positionRelativeToTab===o?1:2,p=`:scope .hwTabstrip > .hwTabstrip-inner > .hwTab:nth-child(${r.index+c})`;s=(a=document.getElementById(i))==null?void 0:a.querySelector(p),s?(K===null||K!==s)&&(s.style.cssText=rn,K&&(K.style.cssText=sn),K=s):je()}else if((r==null?void 0:r.positionRelativeToTab)===o){if(K===null){let c=".vuuHeader-title";s=(l=document.getElementById(i))==null?void 0:l.querySelector(c),s.style.cssText=rn,K=s}}else je()}function je(){K&&(K.style.cssText=sn,K=null)}var se,Ae,ue,ln,cn,ge,Qe,Ee=null,Vt,un,Ie,pn,Ft,et=null,cs=3,tt=new ze,an=.4;function us(e,t){return t?_(e,t):ie(e,o=>o.dropTarget)}var Wt={handleMousedown(e,t,o={}){se=t,un=o,ln=e.clientX,cn=e.clientY,Ft=o.dragThreshold===void 0?cs:o.dragThreshold,Ft===0?se(e,0,0):(window.addEventListener("mousemove",ot,!1),window.addEventListener("mouseup",nt,!1),et=window.setTimeout(()=>{console.log("mousedownTimer fires"),window.removeEventListener("mousemove",ot,!1),window.removeEventListener("mouseup",nt,!1),se==null||se(e,0,0)},500)),e.preventDefault()},initDrag(e,t,{top:o,left:n,right:r,bottom:i},s,a,l,c){return{drag:Ae,drop:ue}=a,ps(e,t,{top:o,left:n,right:r,bottom:i},s,l,c)}};function ot(e){var t=!0,o=!0;let n=t?e.clientX-ln:0,r=o?e.clientY-cn:0;Math.max(Math.abs(n),Math.abs(r))>Ft&&(window.removeEventListener("mousemove",ot,!1),window.removeEventListener("mouseup",nt,!1),se==null||se(e,n,r),se=null)}function nt(){et&&(window.clearTimeout(et),et=null),window.removeEventListener("mousemove",ot,!1),window.removeEventListener("mouseup",nt,!1)}function ps(e,t,o,n,r,i){ge=us(e,t);let{"data-path":s,path:a=s}=z(ge);i&&(Vt=i.map(u=>ie(e,d=>d.id===u)).map(u=>u.props.path)),Ie=Re.measure(ge,i),console.log({_measurements:Ie});let l=Ie[a];Qe=new Ke(l,n.x,n.y,o,r);let c=Math.round(Qe.x.mousePct*100),p=Math.round(Qe.y.mousePct*100);return window.addEventListener("mousemove",mn,!1),window.addEventListener("mouseup",dn,!1),pn=!1,tt.prepare(o,"tab-only"),un.DoNotTransform?"transform:none":`transform:scale(${an},${an});transform-origin:${c}% ${p}%;`}function mn(e){let t=e.clientX,o=e.clientY,n=Qe,r=Ee,i,s,a;n.update("x",t)&&(s=n.x.pos),n.update("y",o)&&(a=n.y.pos),s===void 0&&a===void 0||Ae==null||Ae(s,a),!pn&&(n.inBounds()?i=kt(t,o,ge,Ie,n.hasIntrinsicSize(),Vt):i=kt(n.dropX(),n.dropY(),ge,Ie),r&&(i==null||i.box!==r.box)&&(Ee=null),i&&(tt.draw(i,n),Ee=i))}function dn(){ms()}function ms(){if(Ee){let e=tt.hoverDropTarget||le.getActiveDropTarget(Ee);ue==null||ue(e),Ee=null}else ue==null||ue({component:ge,pos:{position:V.Absolute}});Ae=null,ue=null,ge=null,tt.clear(),Vt=null,window.removeEventListener("mousemove",mn,!1),window.removeEventListener("mouseup",dn,!1)}import{useForkRef as ks}from"@salt-ds/core";import Bs from"classnames";import{forwardRef as Ns}from"react";import He,{useCallback as lt,useMemo as Dn,useRef as ct,useState as Ls}from"react";import{getUniqueId as Ms}from"@vuu-ui/vuu-utils";import ds,{useCallback as Oe,useRef as rt,useState as fs}from"react";import hs from"classnames";import{jsx as fn}from"react/jsx-runtime";var hn=ds.memo(function({column:t,index:o,onDrag:n,onDragEnd:r,onDragStart:i,style:s}){let a=rt(),l=rt(null),c=rt(0),[p,m]=fs(!1),u=Oe(({key:v,shiftKey:T})=>{let L=T?10:1;t&&v==="ArrowDown"?n(o,L):t&&v==="ArrowUp"||!t&&v==="ArrowLeft"?n(o,-L):!t&&v==="ArrowRight"&&n(o,L)},[t,o,n]),d=Oe(v=>{let{key:T}=v;(t&&(T==="ArrowUp"||T==="ArrowDown")||!t&&(T==="ArrowLeft"||T==="ArrowRIght"))&&(i(o),u(v),h.current=u)},[t,u,o,i]),h=rt(d),g=v=>h.current(v),y=Oe(v=>{a.current=!0;let T=v[t?"clientY":"clientX"],L=T-c.current;T&&T!==c.current&&n(o,L),c.current=T},[t,o,n]),f=Oe(()=>{var v;window.removeEventListener("mousemove",y,!1),window.removeEventListener("mouseup",f,!1),r(),m(!1),(v=l.current)==null||v.focus()},[y,r,m]),b=Oe(v=>{c.current=t?v.clientY:v.clientX,i(o),window.addEventListener("mousemove",y,!1),window.addEventListener("mouseup",f,!1),v.preventDefault(),m(!0)},[t,y,f,o,i,m]),R=()=>{},E=()=>{var v;a.current?a.current=!1:(v=l.current)==null||v.focus()},w=()=>{h.current=d},x=hs("Splitter","focusable",{active:p,column:t});return fn("div",{className:x,"data-splitter":!0,ref:l,role:"separator",style:s,onBlur:w,onClick:E,onFocus:R,onKeyDown:g,onMouseDown:b,tabIndex:0,children:fn("div",{className:"grab-zone"})})});import gs from"classnames";import{jsx as ys}from"react/jsx-runtime";var gn="vuuPlaceholder",it=({className:e,closeable:t,flexFill:o,resizeable:n,shim:r,...i})=>ys("div",{className:gs(gn,e,{[`${gn}-shim`]:r}),...i,"data-placeholder":!0,"data-resizeable":!0});it.displayName="Placeholder";B("Placeholder",it);import yn from"react";import{uuid as bn}from"@vuu-ui/vuu-utils";var bs={"data-placeholder":!0,"data-resizeable":!0},st={},pe="auto",_t={flexBasis:0,flexGrow:1,flexShrink:1,height:pe,width:pe},xn={height:"width",width:"height"},Rn=(e="row")=>e==="row"?["width","height","column"]:["height","width","row"],xs=e=>typeof e=="string"&&e.endsWith("%"),U=e=>{let{style:{width:t=pe,height:o=pe}=st}=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 Gt(e,t,o){let n=xn[t],{style:{[n]:r=pe,...i}=st}=e.props;return o&&o[t]?{...i,..._t,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...i,..._t,[n]:r}}function En(e){let{style:{flex:t,flexGrow:o,flexShrink:n,flexBasis:r}=st}=e.props;return typeof t=="number"||r===0&&o===1&&n===1?!0:typeof r!="number"}function Ut(e,t,o){let n=xn[t],{style:{[t]:r=pe,[n]:i=pe,...s}=st}=e.props;return r!==pe?xs(r)?{flexBasis:0,flexGrow:1,flexShrink:1,[t]:void 0,[n]:i}:{flexBasis:r,flexGrow:0,flexShrink:0,[t]:r,[n]:i}:o&&o[t]?{...s,..._t,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...s,[n]:i}}function ke(e,t,o,n,r){let i=[],s=0,a;if(n&&r){let p,[m,u,d,h]=r;[p,a]=t==="column"?[u-n.top,n.bottom-h]:[m-n.left,n.right-d],p&&i.push(ne(`${o}.${s++}`,p,{flexGrow:0,flexShrink:0}))}else a=!0;let{version:l=0,style:c}=z(e);return i.push(H(e,`${o}.${s++}`,{version:l+1,style:{...c,flexBasis:"auto",flexGrow:0,flexShrink:0}})),a&&i.push(ne(`${o}.${s++}`,0,void 0,{[`data-${t}-placeholder`]:!0})),Xt(t,{resizeable:!1,style:{flexBasis:"auto"}},i,o)}var Rs=(e,t)=>{if(!t)return e===0?1:0};function Xt(e,t,o,n){let r=bn(),{flexFill:i,style:s,resizeable:a=!0}=t,{flexBasis:l=i?void 0:"auto"}=s,c=Rs(l,i);return yn.createElement(oe.Flexbox,{id:r,key:r,path:n,flexFill:i,style:{...s,flexDirection:e,flexBasis:l,flexGrow:c,flexShrink:c},resizeable:a},o)}var Es={flexGrow:1,flexShrink:1};function ne(e,t,o,n){let r=bn();return yn.createElement("div",{...bs,...n,"data-path":e,id:r,key:r,style:{...Es,...o,flexBasis:t}})}var Ss={},Be=1,Ne=2,ws=e=>typeof e.intrinsicSize=="number",vs=(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 i=A(n,"resizeable"),{[t]:s}=(l=U(n))!=null?l:Ss,a=En(n);return o?{index:r,flexOpen:a,intrinsicSize:s,resizeable:i,...vs(o,n)}:{index:r,flexOpen:a,intrinsicSize:s,resizeable:i}}),Sn=e=>{let t=e.length,o=e.every(ws),n=Array(t).fill(0);if(o&&(n[0]=Ne,n[t-1]=Ne),t<2)return n;for(let r=0,i=0;r<t-1;r++)e[r].resizeable&&!i&&(i=Be),n[r]+=i;for(let r=t-1;r>0&&(n[r]&Be&&(n[r]-=Be),!e[r].resizeable);r--);return n},wn=(e,t)=>{let o=Ts(e,t),n=Ps(e,t),r=o!==-1&&n!==-1?[o,n]:void 0,i=Ds(e,r);return[r,i]};function Ds(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 Ts(e,t){let o=t,n=!1;for(;o>=1&&!n;)o=o-1,n=vn(e,o);return o}function Ps(e,t){let o=t,n=!1,r=e.length;for(;o<r&&!n;)o=o+1,n=vn(e,o);return o===r?-1:o}function vn(e,t){let{placeholder:o,splitter:n,resizeable:r,intrinsicSize:i}=e[t];return Boolean(!n&&!i&&(o||r))}var Cs=e=>!e.splitter&&!e.placeholder,Pn=({children:e,onSplitterMoved:t,style:o})=>{let n=ct(),r=ct(),i=ct(),s=ct([]),[,a]=Ls({}),l=y=>{i.current=y,a({})},c=(o==null?void 0:o.flexDirection)==="column",p=c?"height":"width",m=Dn(()=>Array.isArray(e)?e:He.isValidElement(e)?[e]:[],[e]),u=lt(y=>{let{current:f}=r;if(f){let[b,R]=wn(f,y);b&&(b.forEach(E=>{var x;let w=(x=n.current)==null?void 0:x.childNodes[E];if(w){let{size:v,minSize:T}=Os(w,p);f[E].currentSize=v,f[E].minSize=T}}),R&&R.forEach(E=>{var x;let w=(x=n.current)==null?void 0:x.childNodes[E];if(w){let{[p]:v}=w.getBoundingClientRect();f[E].flexBasis=v}}))}},[p]),d=lt((y,f)=>{i.current&&r.current&&l(As(i.current,r.current,f,p))},[p]),h=lt(()=>{let y=r.current;y&&(t==null||t(y.filter(Cs))),y==null||y.forEach(f=>{f.currentSize=void 0,f.flexBasis=void 0,f.flexOpen=!1})},[t]),g=lt(y=>He.createElement(hn,{column:c,index:y,key:`splitter-${y}`,onDrag:d,onDragEnd:h,onDragStart:u}),[d,h,u,c]);return Dn(()=>{let[y,f]=zs(m,p,g,s.current);r.current=f,i.current=y},[m,g,p]),{content:i.current||[],rootRef:n}};function zs(e,t,o,n){let r=at(e,t),i=Sn(r),s=[],a=[];for(let l=0;l<e.length;l++){let c=e[l];if(l===0&&i[l]&Ne&&(s.push(Tn(l)),a.push({placeholder:!0,shim:!0})),c.key==null){let p=n[l]||(n[l]=Ms());s.push(He.cloneElement(c,{key:p}))}else s.push(c);a.push(r[l]),l>0&&i[l]&Ne?(s.push(Tn(l)),a.push({placeholder:!0})):i[l]&Be&&(s.push(o(s.length)),a.push({splitter:!0}))}return[s,a]}function As(e,t,o,n){return Is(t,o)?e.map((i,s)=>{let a=t[s],{currentSize:l,flexOpen:c,flexBasis:p}=a,m=l!==void 0;if(m||c){let{flexBasis:u}=i.props.style||{},d=m?a.currentSize:p;return d!==u?He.cloneElement(i,{style:{...i.props.style,flexBasis:d,[n]:"auto"}}):i}else return i}):e}function Is(e,t){let o=[];e.forEach((p,m)=>{p.currentSize!==void 0&&o.push(m)});let n=t<0?o[0]:o[1],{currentSize:r=0,minSize:i=0}=e[n];if(r===i)return!1;if(Math.abs(t)>r-i){let p=t<0?-1:1;t=Math.max(0,r-i)*p}let s=e[o[0]],{currentSize:a=0}=s;s.currentSize=a+t;let l=e[o[1]],{currentSize:c=0}=l;return l.currentSize=c-t,!0}function Tn(e){return He.createElement(it,{shim:e===0,key:`placeholder-${e}`})}function Os(e,t){let{[t]:o}=e.getBoundingClientRect(),r=getComputedStyle(e).getPropertyValue(`min-${t}`),i=r.endsWith("px")?parseInt(r,10):0;return{size:o,minSize:i}}import{jsx as Hs}from"react/jsx-runtime";var Yt="hwFlexbox",Ln=Ns(function(t,o){let{breakPoints:n,children:r,column:i,className:s,flexFill:a,gap:l,fullPage:c,id:p,onSplitterMoved:m,resizeable:u,row:d,spacing:h,splitterSize:g,style:y,...f}=t,{content:b,rootRef:R}=Pn({children:r,onSplitterMoved:m,style:y}),E=Bs(Yt,s,{[`${Yt}-column`]:i,[`${Yt}-row`]:d,"flex-fill":a,"full-page":c});return Hs("div",{...f,className:E,"data-resizeable":u||void 0,id:p,ref:ks(R,o),style:{...y,gap:l,"--spacing":h},children:b})});Ln.displayName="Flexbox";var Zt=Ln;import{useCallback as Da}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 to,useContext as ir,useEffect as Ea,useRef as nr,useState as Sa}from"react";import Qn from"react";import Ve from"react";import{uuid as Bn}from"@vuu-ui/vuu-utils";import{uuid as An}from"@vuu-ui/vuu-utils";import $e,{cloneElement as $s}from"react";import{useCallback as we}from"react";var W=new Map,X=new Map,Mn=e=>W.get(e),Cn=e=>W.has(e),zn=(e,t)=>W.set(e,t),ve=()=>{let e=we((s,a)=>{let l=X.get(s);if(l)return a!==void 0&&l[a]!==void 0?l[a]:a!==void 0?void 0:l},[]),t=we((s,a,l)=>{if(a===void 0)X.set(s,l);else if(X.has(s)){let c=X.get(s);X.set(s,{...c,[a]:l})}else X.set(s,{[a]:l})},[]),o=we((s,a)=>{if(X.has(s)){if(a===void 0)X.delete(s);else if(X.get(s)[a]){let{[a]:c,...p}=X.get(s);Object.keys(p).length>0?X.set(s,p):X.delete(s)}}},[]),n=we((s,a)=>{let l=W.get(s);if(l)return a!==void 0?l[a]:l},[]),r=we((s,a,l)=>{if(a===void 0)W.set(s,l);else if(W.has(s)){let c=W.get(s);W.set(s,{...c,[a]:l})}else W.set(s,{[a]:l})},[]),i=we((s,a)=>{if(W.has(s)){if(a===void 0)W.delete(s);else if(W.get(s)[a]){let{[a]:c,...p}=W.get(s);Object.keys(p).length>0?W.set(s,p):W.delete(s)}}},[]);return{loadSessionState:e,loadState:n,saveSessionState:t,saveState:r,purgeState:i,purgeSessionState:o}};var In=e=>e.flexDirection==="column"?["height","width"]:["width","height"],Fs={},Fe=(e,t="0")=>{let[o,n]=Kt(I(e),e.props,t);return $e.cloneElement(e,o,n)},Jt=(e,t)=>{let o=I(e),[n,r]=Kt(o,e.props,"0",void 0,t);return $s(e,n,r)};function Vs(e,t,o="0",n=null,r){var g,y;let{active:i=0,"data-path":s,path:a=s,id:l,style:c}=z(r),p=I(r)===e&&o===a,m=p?l:(g=t.id)!=null?g:An(),u=e==="Stack"?(y=t.active)!=null?y:i:void 0,d=m,h=p?c:_s(e,t,n);return Po(e)?{id:m,key:d,path:o,style:h,type:e,active:u}:{id:m,key:d,style:h,"data-path":o}}function Kt(e,t,o,n=null,r){var c,p;let i=Vs(e,t,o,n,r);if(t.layout&&!r)return[i,[ut(t.layout,`${o}.0`)]];let s=(p=r==null?void 0:r.children)!=null?p:(c=r==null?void 0:r.props)==null?void 0:c.children,l=t.dropTarget&&s?s:Ws(e,t.children,o,s);return[i,l]}function Ws(e,t,o="0",n){let r=Array.isArray(t)?t:$e.isValidElement(t)?[t]:[];return F(e)?r.map((i,s)=>{let a=I(i),l=I(n==null?void 0:n[s]);if(!l||a===l){let[c,p]=Kt(a,i.props,`${o}.${s}`,e,n==null?void 0:n[s]);return $e.cloneElement(i,c,p)}else return n==null?void 0:n[s]}):t}var _s=(e,t,o)=>{let{style:n=Fs}=t;if(e==="Flexbox"&&(n={flexDirection:t.column?"column":"row",...n,display:"flex"}),n.flex){let{flex:r,...i}=n;n={...i,...Ct(r)}}else o==="Stack"?n={...n,...Ct(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=An(),type:t,children:o,props:n,state:r},i){let s=t.match(/^[a-z]/)?t:oe[t];if(s===void 0)throw Error(`Unable to create component from JSON, unknown type ${t}`);return r&&zn(e,r),$e.createElement(s,{...n,id:e,key:e,path:i},o?o.map((a,l)=>ut(a,`${i}.${l}`)):void 0)}function On(e){return kn(e)}function kn(e){let t=I(e),{id:o,children:n,type:r,...i}=z(e),s=Cn(o)?Mn(o):void 0;return{id:o,type:t,props:Gs(i),state:s,children:$e.Children.map(n,kn)}}function Gs(e){if(e){let{path:t,...o}=e,n={};for(let[r,i]of Object.entries(o))n[r]=qt(i);return n}}function qt(e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(qt);if(typeof e=="object"&&e!==null){let t={};for(let[o,n]of Object.entries(e))t[o]=qt(n);return t}}function Nn(e,t){var s;let o=e.props.children,n=o.length,{index:r=-1,positionRelativeToTab:i="after"}=t.tab||{};return r===-1||r>=n?[o[n-1],"after"]:[(s=o[r])!=null?s:null,i]}function pt(e,t,o){let{active:n,children:r=[],path:i}=z(e),s=A(t,"path"),{idx:a,finalStep:l}=q(i,s,!0),[c,p]=l?Us(e,r,o):[n,r==null?void 0:r.map((u,d)=>d===a?pt(u,t,o):u)],m=I(e)==="Stack"?Array.isArray(c)?c[0]:c:n;return Ve.cloneElement(e,{active:m},p)}function Us(e,t,o){let n=A(e,"path"),r=t==null?void 0:t.length,{id:i=Bn()}=z(o);return r?[r,t.concat(H(o,`${n}.${r}`,{id:i,key:i}))]:[0,[H(o,`${n}.0`,{id:i})]]}function mt(e,t,o,n,r,i,s){let{active:a,children:l,path:c}=z(e),p=A(t,"path"),{idx:m,finalStep:u}=q(c,p),[d,h]=u?Xs(e,l,m,o,n,r,i,s):[a,l.map((y,f)=>f===m?mt(y,t,o,n,r,i,s):y)],g=I(e)==="Stack"?d:a;return Ve.cloneElement(e,{active:g},h)}function Xs(e,t,o,n,r,i,s,a){let l=U(n);return(l==null?void 0:l.width)&&(l==null?void 0:l.height)?Zs(e,t,o,n,r,s,a):Hn(e,t,o,n,r,(i==null?void 0:i.width)||(i==null?void 0:i.height),s)}var Ys=(e,t,{top:o,right:n,bottom:r,left:i},[s,a,l,c])=>{if(e==="column"&&t==="before")return a-o;if(e==="column")return r-c;if(e==="row"&&t==="before")return s-i;if(e==="row")return n-l};function Zs(e,t,o,n,r,i,s){let{style:{flexDirection:a}}=z(e),[l,c,p]=Rn(a),{[c]:m,[l]:u}=U(n),d=A(t[o],"path"),h=Ys(a,r,i,s),[g,y]=m<i[c]?[ke(n,p,d,i,s),u]:[n,void 0],f=h?ne(d,h,{flexGrow:0,flexShrink:0}):void 0;return m>i[c]&&(t=t.map(b=>{if(A(b,"placeholder"))return b;{let{[c]:R}=U(b);return R&&R<m?ke(b,p,A(b,"path")):b}})),Hn(e,t,o,g,r,y,i,f)}function Hn(e,t,o,n,r,i,s,a){let l=A(e,"path"),c=0,p=!t||t.length===0?[n]:t.reduce((m,u,d)=>{if(o===d){let[h,g]=qs(e,u,n,s);r==="before"?a?m.push(a,g,h):m.push(g,h):a?m.push(h,g,a):m.push(h,g),c=m.indexOf(g)}else m.push(u);return m},[]).map((m,u)=>u<c?m:H(m,`${l}.${u}`));return[c,p]}function qs(e,t,o,n){let{id:r=Bn(),version:i=0}=z(o);if(i+=1,I(e)==="Flexbox"){let[s]=In(e.props.style),a=6,l={[s]:(n[s]-a)/2},c=Ut(t,s,l),p=Ut(o,s,l);return[Ve.cloneElement(t,{style:c}),Ve.cloneElement(o,{id:r,version:i,style:p})]}else{let{style:{left:s,top:a,flex:l,...c}={left:void 0,top:void 0,flex:void 0}}=z(o);return[t,Ve.cloneElement(o,{id:r,version:i,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 ye from"react";import dt from"react";function $n(e,{target:t,replacement:o}){return jt(e,t,o)}function jt(e,t,o){let n=A(t,"path"),r=A(t,"resizeable"),{style:i}=z(t),s=Fe(dt.cloneElement(o,{resizeable:r,style:{...i,...o.props.style}}),n);return j(e,t,s)}function j(e,t,o,n){if(e===t)return o;{let{idx:r,finalStep:i}=q(A(e,"path"),A(t,"path")),s=e.props.children.slice();return i?n?n===Se.MINIMIZE?s[r]=Js(e,s[r]):n===Se.RESTORE&&(s[r]=Ks(s[r])):s[r]=o:s[r]=j(s[r],t,o,n),dt.cloneElement(e,void 0,s)}}function Js(e,t){let{style:o}=z(e),{style:n}=z(t),{width:r,height:i,flexBasis:s,flexShrink:a,flexGrow:l,...c}=n,p={width:r,height:i,flexBasis:s,flexShrink:a,flexGrow:l},m={...c,flexBasis:0,flexGrow:0,flexShrink:0},u=o.flexDirection==="row"?"vertical":o.flexDirection==="column"?"horizontal":!1;return u?dt.cloneElement(t,{collapsed:u,restoreStyle:p,style:m}):t}function Ks(e){let{style:t,restoreStyle:o}=z(e),{flexBasis:n,flexShrink:r,flexGrow:i,...s}=t,a={...s,...o};return dt.cloneElement(e,{collapsed:!1,style:a,restoreStyle:void 0})}function Qt(e,{path:t}){let o=_(e,t),n=re(e,t);if(n===null)return e;let{children:r}=z(n);if(r.length>1&&Vn(r,t)){let{style:{flexBasis:i,display:s,flexDirection:a,...l}}=z(n),c=A(n,"path"),p=j(e,n,ne(c,i,l));for(;(n=re(p,c))&&A(n,"path")!=="0";){let{children:m}=z(n);if(Vn(m)){c=A(n,"path");let{style:{flexBasis:u,display:d,flexDirection:h,...g}}=z(n);p=j(e,n,ne(c,u,g))}else if(ta(m))p=Gn(e,n);else break}return p}else return Wn(e,o)}function Wn(e,t){let{active:o,children:n,path:r,preserve:i}=z(e),{idx:s,finalStep:a}=q(r,A(t,"path")),l=I(e),c=n.slice();if(a){if(c.splice(s,1),o!==void 0&&o>=s&&(o=Math.max(0,o-1)),c.length===1&&!i&&r!=="0"&&l.match(/Flexbox|Stack/))return js(e,c[0]);!c.some(Qs)&&c.some(_n)&&(c=ea(c))}else c[s]=Wn(c[s],t);return c=c.map((p,m)=>H(p,`${r}.${m}`)),ye.cloneElement(e,{active:o},c)}function js(e,t){let o=I(e),{path:n,style:{flexBasis:r,flexGrow:i,flexShrink:s,width:a,height:l}}=z(e),c=H(t,n);if(n==="0")c=ye.cloneElement(c,{style:{...t.props.style,width:a,height:l}});else if(o==="Flexbox"){let p=e.props.style.flexDirection==="column"?"height":"width",{style:{[p]:m,...u}}=c.props;c=ye.cloneElement(c,{flexFill:void 0,style:{...u,flexGrow:i,flexShrink:s,flexBasis:r,width:a,height:l}})}return c}function Qs(e){return e.props.style.flexGrow>0}function _n(e){let{width:t,height:o,flexGrow:n}=e.props.style;return n===0&&typeof t!="number"&&typeof o!="number"}function ea(e){return e.map(t=>_n(t)?ye.cloneElement(t,{style:{...t.props.style,flexGrow:1}}):t)}var ta=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}}},Gn=(e,t)=>{let{children:o,path:n}=z(e),{idx:r,finalStep:i}=q(n,A(t,"path")),s=o.slice();return i?s[r]=oa(t):s[r]=Gn(s[r],t),s=s.map((a,l)=>H(a,`${n}.${l}`)),ye.cloneElement(e,void 0,s)},oa=e=>{let{children:t}=z(e),o=[],n=[];for(let i=0;i<t.length;i++)A(t[i],"placeholder")?n.push(t[i]):(n.length===1?o.push(n.pop()):n.length>0&&(o.push(Fn(n)),n.length=0),o.push(t[i]));n.length===1?o.push(n.pop()):n.length>0&&o.push(Fn(n));let r=A(e,"path");return ye.cloneElement(e,void 0,o.map((i,s)=>H(i,`${r}.${s}`)))},Fn=([e,...t])=>{let o=A(e,"style"),{flexBasis:n,flexGrow:r,flexShrink:i}=o;for(let{props:{style:s}}of t)n+=s.flexBasis,r=Math.max(r,s.flexGrow),i=Math.max(i,s.flexShrink);return ye.cloneElement(e,{style:{...o,flexBasis:n,flexGrow:r,flexShrink:i}})},Vn=(e,t)=>e.every(o=>A(o,"placeholder")||t&&A(o,"path")===t);import Un from"react";function Xn(e,{path:t,sizes:o}){let n=_(e,t,!0),{children:r,style:i}=z(n),s=i.flexDirection==="column"?"height":"width",a=na(r,o,s),l=Un.cloneElement(n,void 0,a);return j(e,n,l)}function na(e,t,o){return e.map((n,r)=>{let{style:{[o]:i,flexBasis:s}}=z(n),a=t[r],{currentSize:l,flexBasis:c}=a,m=l!==void 0?a.currentSize:c;return m===void 0||i===m||s===m?n:Un.cloneElement(n,{style:ra(n.props.style,o,m)})})}function ra(e,t,o){let n=typeof e[t]=="number",{flexShrink:r=1,flexGrow:i=1}=e;return{...e,[t]:n?o:"auto",flexBasis:n?"auto":o,flexShrink:r,flexGrow:i}}import ft from"react";import{uuid as ia}from"@vuu-ui/vuu-utils";var Yn=e=>{let[t]=I(e);return t===t.toLowerCase()};function We(e,t,o,n,r,i){let{children:s,path:a}=z(e),l=A(t,"path"),{idx:c,finalStep:p}=q(a,l),m=p?sa(e,s,t,o,n,r,i):s.map((u,d)=>d===c?We(u,t,o,n,r,i):u);return ft.cloneElement(e,void 0,m)}function sa(e,t,o,n,r,i,s){let a=U(n);if((a==null?void 0:a.width)&&(a==null?void 0:a.height)){if(i===void 0||s===void 0)throw Error("wrap-layout-element, updateChildren clientRect and dropRect must both be available");return la(t,o,n,r,i,s)}else return aa(e,t,o,n,r)}function aa(e,t,o,n,r){var x;let{version:i=0}=z(n),s=A(o,"path"),{type:a,flexDirection:l,showTabs:c}=qn(r),[p,m,u]=ca(a,o,n,l,r),d=Zn(r),h=d?1:0,g={resizeable:!0,style:u,version:i+1},f={[Yn(o)?"data-resizeable":"resizeable"]:!0,style:m},b=a==="Stack"?{showTabs:c}:void 0,R=a==="Flexbox"?{splitterSize:(x=I(e)==="Flexbox"&&e.props.splitterSize)!=null?x:void 0}:void 0,E=ia();var w=ft.createElement(oe[a],{active:h,id:E,key:E,path:A(o,"path"),flexFill:A(o,"flexFill"),...R,...b,style:p,resizeable:A(o,"resizeable")},d?[H(o,`${s}.0`,f),Fe(ft.cloneElement(n,g),`${s}.1`)]:[Fe(ft.cloneElement(n,g),`${s}.0`),H(o,`${s}.1`,f)]);return t.map(v=>v===o?w:v)}function la(e,t,o,n,r,i){let{flexDirection:s}=qn(n),a=s==="column"?"row":"column",l=Zn(n),[c,p,m,u]=i,[d,h]=s==="column"?[p-r.top,r.bottom-u]:[c-r.left,r.right-m],g=A(t,"path"),y=0,f=Yn(t)?"data-resizeable":"resizeable",b=[];d&&b.push(l?H(t,`${g}.${y++}`,{[f]:!0,style:{flexBasis:d,flexGrow:1,flexShrink:1}}):ne(`${g}.${y++}`,d,{flexGrow:0,flexShrink:0})),b.push(ke(o,a,`${g}.${y++}`,r,i)),h&&b.push(l?ne(`${g}.${y++}`,0):H(t,`${g}.${y++}`,{[f]:!0,style:{flexBasis:0,flexGrow:1,flexShrink:1}}));let R=Xt(s,t.props,b,g);return e.map(E=>E===t?R:E)}function ca(e,t,o,n,r){let i={...t.props.style,flexDirection:n},s=e==="Flexbox"&&n==="column"?"height":"width",a=Gt(o,s,r),l=Gt(t,s);return[i,l,a]}var Zn=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 qn(e){return e.position.Header?{type:"Stack",flexDirection:"column",showTabs:!0}:{type:"Flexbox",flexDirection:e.position.EastOrWest?"row":"column"}}var er=(e,t)=>{switch(t.type){case Y.ADD:return fa(e,t);case Y.DRAG_DROP:return da(e,t);case Y.MAXIMIZE:return ma(e,t);case Y.REMOVE:return Qt(e,t);case Y.REPLACE:return $n(e,t);case Y.SET_TITLE:return pa(e,t);case Y.SPLITTER_RESIZE:return Xn(e,t);case Y.SWITCH_TAB:return ua(e,t);default:return console.warn(`layoutActionHandlers. No handler for action.type ${t.type}`),e}};function ua(e,{path:t,nextIdx:o}){var n=_(e,t,!0);let r=Qn.cloneElement(n,{active:o});return j(e,n,r)}function pa(e,{path:t,title:o}){var n=_(e,t,!0);let r=Qn.cloneElement(n,{title:o});return j(e,n,r)}function ma(e,{path:t,type:o}){if(t){var n=_(e,t,!0);return j(e,n,n,o)}else return e}function da(e,t){var u,d;console.log("drag drop");let{draggedReactElement:o,dragInstructions:n,dropTarget:r}=t,i=r.component,{pos:s}=r,a=((u=s==null?void 0:s.position)==null?void 0:u.Header)&&I(i)==="Stack",{id:l,version:c}=z(o),p=U(o),m;if(a){let[h,g]=Nn(i,s);h===void 0?m=pt(e,i,o):m=mt(e,h,o,g)}else!p&&((d=s==null?void 0:s.position)==null?void 0:d.Centre)?m=jt(e,i,o):m=ha(e,r,o);if(n.DoNotRemove)return m;{let h=ie(m,y=>y.id===l&&y.version===c),g=A(h,"path");return Qt(m,{path:g,type:"remove"})}}function fa(e,{path:t,component:o}){return pt(e,_(e,t),o)}function ha(e,t,o){let{component:n,pos:r,clientRect:i,dropRect:s}=t,a=A(n,"path");if(a==="0.0")return We(e,n,o,r);var l=re(e,a);if(Jn(r,l)){let c=r.position.SouthOrEast?"after":"before";return mt(e,n,o,c,r,i,s)}else if(Jn(r,l)){if(F(I(l)))return We(e,n,o,r);throw Error(`no support right now for position = ${r.position}`)}else return We(e,n,o,r,i,s);return e}function Jn(e,t){return e.position.Centre?jn(t)||Kn(t):e.position.NorthOrSouth?Kn(t):e.position.EastOrWest?jn(t):!1}function Kn(e){return I(e)==="Flexbox"&&e.props.style.flexDirection==="column"}function jn(e){return I(e)==="Flexbox"&&e.props.style.flexDirection!=="column"}import{createContext as ga}from"react";var ya=e=>console.log(`dispatch ${e.type}, have you forgotten to provide a LayoutProvider ?`),_e=ga({dispatchLayoutProvider:ya,version:-1});import{useCallback as ht,useRef as eo}from"react";var ba={},tr=[0,0],xa=(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 i=`top:${e.top}px;left:${e.left}px;width:${e.width}px;height:${e.height}px;`;return[n,i,e.left,e.top]},Ra=e=>{let{offsetParent:t}=e;if(t===null)return tr;{let{left:o,top:n}=t.getBoundingClientRect();return[o,n]}},or=(e,t)=>{let o=eo(),n=eo(),r=eo(),i=ht((c,p)=>{if(n.current&&r.current){let{dragOffsets:[m,u],targetPosition:d}=n.current,h=typeof c=="number"?c-m:d.left,g=typeof p=="number"?p-u:d.top;(h!==d.left||g!==d.top)&&(n.current.targetPosition.left=h,n.current.targetPosition.top=g,r.current.style.top=g+"px",r.current.style.left=h+"px")}},[]),s=ht(c=>{if(n.current){let{dragInstructions:p,payload:m,originalCSS:u}=n.current;t({type:"drag-drop",draggedReactElement:m,dragInstructions:p,dropTarget:c}),console.log("[useLayoutDragDrop]",{dragInstructions:p}),r.current&&(p.RemoveDraggableOnDragEnd?document.body.removeChild(r.current):(r.current.style.cssText=u,delete r.current.dataset.dragging)),o.current=void 0,n.current=void 0,r.current=void 0}},[]),a=ht(c=>{if(o.current){let{payload:p,dragContainerPath:m,dragElement:u,dragRect:d,instructions:h=ba,path:g}=o.current,{current:y}=e,f={x:c.clientX,y:c.clientY},b=p!=null?p:_(y,g,!0),{id:R}=b.props,E=U(b),w="",x="",v="",T=h,L=-1,M=-1,D=tr,S=document.getElementById(R);if(S===null)[S,x,L,M]=xa(d,R,u),T={...T,RemoveDraggableOnDragEnd:!0};else{D=Ra(S);let[P,C]=D,{width:O,height:N,left:k,top:G}=S.getBoundingClientRect();L=k-P,M=G-C,x=`width:${O}px;height:${N}px;left:${L}px;top:${M}px;z-index: 100;background-color:#ccc;opacity: 0.6;`,S.dataset.dragging="true",w=S.style.cssText}v=Wt.initDrag(e.current,m,d,f,{drag:i,drop:s},E),S.style.cssText=x+v,r.current=S,n.current={payload:b,originalCSS:w,dragRect:d,dragOffsets:D,dragInstructions:h,targetPosition:{left:L,top:M}}}},[i,s,e]);return ht(c=>{let{evt:p,...m}=c;console.log("prepare to drag",{options:m}),o.current={...m,dragContainerPath:""},Wt.handleMousedown(p,a,m.instructions)},[a])};import{jsx as sr}from"react/jsx-runtime";var rr=e=>e.dropTarget,wa=e=>["drag-drop","remove","set-title","splitter-resize","switch-tab"].includes(e.type),Lf=()=>{let e=va();return sr("div",{children:`Context: ${e} `})},Mf=e=>{let{children:t,layout:o,onLayoutChange:n}=e,r=nr(void 0),i=nr(t),[,s]=Sa(null),a=to(m=>{if(n){let u=ie(m,rr)||r.current,h=I(u)==="DraggableLayout"?z(u).children[0]:u,g=On(h);n(g,"drag-root")}},[n]),l=to((m,u=!1)=>{let d=er(r.current,m);d!==r.current&&(r.current=d,s({}),!u&&wa(m)&&a(d))},[a]),c=to(m=>{m.type==="drag-start"?p(m):m.type==="save"?a(r.current):r.current&&l(m)},[l,a]),p=or(r,c);return Ea(()=>{if(o){let m=ie(r.current,rr),u=$o(m),d=ut(o,`${m.props.path}.0`),h=u?{type:Y.REPLACE,target:u,replacement:d}:{type:Y.ADD,path:m.props.path,component:d};l(h,!0)}},[l,o]),r.current===void 0?r.current=Jt(t):t!==i.current&&(r.current=Jt(t,r.current),i.current=t),sr(_e.Provider,{value:{dispatchLayoutProvider:c,version:0},children:r.current})},Z=()=>{let{dispatchLayoutProvider:e}=ir(_e);return e},va=()=>{console.log({LayoutProviderContext:_e});let{version:e}=ir(_e);return e};import{jsx as Ta}from"react/jsx-runtime";var ar=function(t){let{path:o}=t,n=Z(),r=Da(i=>{n({type:Se.SPLITTER_RESIZE,path:o,sizes:i})},[n,o]);return Ta(Zt,{...t,onSplitterMoved:r})};ar.displayName="Flexbox";B("Flexbox",ar,"container");import{useForkRef as il}from"@salt-ds/core";import sl from"classnames";import{forwardRef as al}from"react";import{useCallback as mr,useEffect as Aa,useRef as ro,useState as Ia}from"react";import{useCallback as Pa,useLayoutEffect as lr,useRef as La}from"react";var Uf=["height","width"],Xf=["height"],Yf=["width"],be=new WeakMap,ur=(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}},cr=new ResizeObserver(e=>{for(let t of e){let{target:o,contentRect:n}=t,r=be.get(o);if(r){let{onResize:i,measurements:s}=r,a=!1;for(let[l,c]of Object.entries(s)){let p=ur(o,n,l);p!==c&&(a=!0,s[l]=p)}a&&i&&i(s)}}});function gt(e,t,o,n=!1){let r=La(t),i=Pa(s=>{let a=s.getBoundingClientRect();return r.current.reduce((l,c)=>(l[c]=ur(s,a,c),l),{})},[]);lr(()=>{let s=e.current,a=!1;async function l(){be.set(s,{measurements:{}}),a=!1;let{fonts:c}=document;if(c&&await c.ready,!a){let p=be.get(s);if(p){let m=i(s);p.measurements=m,cr.observe(s),n&&o(m)}}}if(s){if(be.has(s))throw Error("useResizeObserver attemping to observe same element twice");l()}return()=>{s&&be.has(s)&&(cr.unobserve(s),be.delete(s),a=!0)}},[e,i]),lr(()=>{let s=e.current,a=be.get(s);if(a){if(r.current!==t){r.current=t;let l=i(s);a.measurements=l}a.onResize=o}},[t,i,e,o])}function Ma(e,t){let o=document.body.querySelector(`.${e}`),n={get:function(r,i){let s=r.getPropertyValue(`--${e}-breakpoint-${i}`);return s?parseInt(s):void 0}};return o?new Proxy(getComputedStyle(o),n):t!=null?t:{}}var Ca=([,e],[,t])=>t-e,no=e=>Object.entries(e).sort(Ca).map(([t,o],n,r)=>[t,o,n<r.length-1?r[n+1][1]:9999]),oo=null,za=(e="salt")=>{let{xs:t,sm:o,md:n,lg:r,xl:i}=Ma(e);return no({xs:t,sm:o,md:n,lg:r,xl:i})},pr=e=>(oo===null&&(oo=za(e)),oo);var Oa=[],dr=({breakPoints:e,smallerThan:t},o)=>{let[n,r]=Ia(t?!1:"lg"),i=ro(document.body),s=ro(e?no(e):pr()),a=ro("lg"),l=mr(p=>{if(s.current){for(let[m,u]of s.current)if(p>=u)return m}},[s]),c=mr(p=>{if(t){let m=s.current.find(([u])=>u===t);if(m){let[,,u]=m;return p<u}}else return l(p);return p},[t,l]);return gt(o||i,s.current?["width"]:Oa,({width:p})=>{let m=c(p);m!==a.current&&(a.current=m,r(m))},!0),Aa(()=>{let p=o||i;if(p.current){let m=a.current;if(s.current){let{clientWidth:u}=p.current,d=c(u);a.current=d,d!==m&&r(d)}}},[r,c,o]),n};import{useCallback as te,useLayoutEffect as fr,useRef as ee,useState as hr}from"react";var ka=["left","right"],Ba=["top","bottom"];function Ge(e,t="width"){let{[t]:o}=e.getBoundingClientRect(),{padRight:n=!1,padLeft:r=!1}=e.dataset,i=getComputedStyle(e),[s,a]=t==="width"?ka:Ba,l=r?0:parseInt(i.getPropertyValue(`margin-${s}`),10),c=n?0:parseInt(i.getPropertyValue(`margin-${a}`),10),p=o;if(parseInt(i.getPropertyValue("flex-shrink"),10)>0){let u=parseInt(i.getPropertyValue("flex-basis"),10);isNaN(u)||(p=u)}return l+p+c}var Na={horizontal:["width","scrollHeight"],vertical:["height","scrollWidth"],none:[]},Ha={},xr={},$a='[data-collapsible="dynamic"]:not([data-collapsed="true"]):not([data-collapsing="true"])',io=(e,t)=>e+t.size,gr=(e,t)=>e+(t.isOverflowIndicator?0:t.size),Fa=e=>{for(let t=e.length-1;t>=0;t--){let o=e[t];if(!o.isOverflowIndicator)return o}return null},De=1e3,Va=e=>e>0&&e<1e3,ao=e=>e>=De,so=e=>e.current[e.current.length-1],Wa=e=>e.some(t=>t.collapsed&&t.fullWidth===null),_a=e=>e.current.querySelector($a)!==null,yr=(e,t)=>{let o=Fa(e.current);return o?(e.current=e.current.filter(n=>n!==o),t.current=t.current.concat(o),o):null},Rr=(e,t)=>{let o=e.priority-t.priority;return o===0&&(o=e.index-t.index),o},br=e=>e.current.find(t=>t.isOverflowIndicator),Ga={horizontal:{size:"clientWidth",depth:"clientHeight",scrollDepth:"scrollHeight"},vertical:{size:"clientHeight",depth:"clientWidth",scrollDepth:"scrollWidth"}},Ua=({current:e},t="horizontal")=>{let o=Ga[t],{[o.depth]:n}=e.parentNode,{[o.scrollDepth]:r,[o.size]:i}=e;return[n<r,i,n]},Xa=()=>{let[,e]=hr(null),[t,o]=hr(0),n=ee(0),r=te(s=>{o(n.current=s)},[o]),i=te((s,a)=>{Math.abs(s)===De?s>0&&!ao(n.current)||s<0&&ao(n.current)?r(n.current+s):e({}):s!==0?r(n.current+s):a&&e({})},[e,n,r]);return[n,t,i]},Ya=({current:e},t)=>Array.from(e.childNodes).reduce((n,r)=>{var u;let{collapsible:i,collapsed:s,collapsing:a,index:l,priority:c="1",overflowIndicator:p,overflowed:m}=(u=r==null?void 0:r.dataset)!=null?u:xr;if(l){let d=Ge(r,t);m&&delete r.dataset.overflowed,n.push({collapsible:i,collapsed:i?s==="true":void 0,collapsing:a,fullSize:null,index:parseInt(l,10),isOverflowIndicator:p,label:r.title||r.innerText,priority:parseInt(c,10),size:d})}return n},[]).sort(Rr),Q=(e,t)=>e.current.querySelector(`:scope > [data-idx='${t.index}']`);function sh(e="horizontal",t=""){let o=ee(null),[n,r,i]=Xa(),s=ee([]),a=ee([]),l=ee([]),c=ee(!1),p=ee(null),m=ee(null),u=ee(e==="horizontal"),d=ee(36),h=ee(0),g=te(T=>{let L=u.current;if(T===void 0){let D=L?"width":"height";({[D]:T}=o.current.getBoundingClientRect())}h.current=T;let M=L?"minWidth":"minHeight";o.current.style[M]=T+"px"},[o]),y=te((T,L)=>{let M=0;if(s.current.some(D=>D.collapsible&&!D.collapsed))for(let D=s.current.length-1;D>=0;D--){let S=s.current[D];if(S.collapsible==="instant"&&!S.collapsed){S.collapsed=!0;let P=Q(o,S);return P.dataset.collapsed=!0,l.current.push(S),1}else if(S.collapsible==="dynamic"&&!S.collapsed&&!S.collapsing){S.collapsing=!0;let P=Q(o,S);return P.dataset.collapsing=!0,l.current.push(S),o.current.dataset.collapsing=!0,1}}for(;T>L;){let D=yr(s,a);if(D===null){g(T);break}T-=D.size;let S=Q(o,D);S.dataset.overflowed=!0,M=De}return M},[g]),f=te(T=>{let L=0,M=s.current.reduce(gr,0),D=T-M;if(Va(n.current)){for(;l.current.length;){let S=so(l),P=S.fullSize-S.size;if(D>=P){S.collapsed=!1,S.size=S.fullSize,delete S.fullSize;let C=Q(o,S);l.current.pop(),delete C.dataset.collapsed,D=D-P,L+=1}else break}return L}else for(;a.current.length>0;){let{size:S}=so(a);if(D>=S){let{size:P=0}=br(s)||Ha;if(a.current.length===1||D>=S+P){let C=yr(a,s);M+=C.size;let O=Q(o,C);delete O.dataset.overflowed,D=D-C.size,L=De}else break}else break}return L},[n]),b=te(()=>{let L=s.current.reduce(io,0)-m.current;for(let M=s.current.length-1;M>=0;M--){let D=s.current[M];if(D.collapsible&&!D.collapsed){let S=Q(o,D);if(L>D.size-36)S.dataset.collapsed=D.collapsed=!0,L-=D.size;else{S.dataset.collapsing=D.collapsing=!0;break}}}},[m,o,s]),R=te((T,L)=>{L.dataset.collapsing=T.collapsing=!1,L.dataset.collapsed=T.collapsed=!0;let D=s.current.filter(({collapsible:S,collapsed:P})=>S==="dynamic"&&!P).pop();if(D){let S=Q(o,D);S.dataset.collapsing=D.collapsing=!0}else g()},[g]),E=te((T,L)=>{L.dataset.collapsing=T.collapsing=!1},[]),w=te(T=>{let L=s.current.find(({collapsible:P,collapsing:C})=>P==="dynamic"&&C),M=s.current.find(({collapsible:P,collapsed:C})=>P==="dynamic"&&C);if(L===void 0&&M===void 0)return;if(L===void 0){let P=Q(o,M);P.dataset.collapsed=M.collapsed=!1,P.dataset.collapsing=M.collapsing=!0;return}let D=Q(o,L),S=u.current?"width":"height";if(T&&M){let P=Ge(D,S);M&&P===L.size&&E(L,D)}else{let{[S]:P}=D.getBoundingClientRect(),C=getComputedStyle(D),O=parseInt(C.getPropertyValue(`min-${S}`));P===O&&R(L,D)}},[R,E]),x=te(()=>{let[T,L,M]=Ua(o,e);m.current=L,p.current=M;let D=_a(o);if(D||T){let S=u.current?"width":"height",P=Ya(o,S);s.current=P,a.current=[]}if(D)if(c.current=!0,o.current.dataset.collapsing=!0,T)b();else{let S=so(s),P=Q(o,S);P.dataset.collapsing=S.collapsing=!0}else if(T){let S=s.current.reduce(gr,0),P=y(S,L-d.current);i(+P)}},[b,y,e,i]),v=te(({scrollHeight:T,height:L=T,scrollWidth:M,width:D=M})=>{let[S,P]=u.current?[D,L]:[L,D],C=n.current===0,O=P>p.current,N=S>m.current;if(m.current=S,!(N&&S===h.current)){if(c.current)w(N);else if(!C&&N){let k=f(S);k!==De||a.current.length===0?i(-k):k===De&&i(0,!0)}else if(C&&O)x();else if(!C&&O){let k=s.current.reduce(io,0);if(S<k){let G=y(k,S);i(+G)}}}},[w,f,x,y,n,i]);return fr(()=>{var L;let T=u.current?"width":"height";if(Wa(s.current)){let[M]=s.current.filter(D=>D.collapsed);if(M.fullSize===null){let D=Q(o,M);if(D){let S=Ge(D,T);M.fullSize=M.size,M.size=S;let P=s.current.reduce(io,0);if(P>m.current){let C=y(P,m.current-d.current);i(+C)}}}}else if(ao(r)){let M=o.current.querySelector(":scope > [data-overflow-indicator='true']");if(M){let{index:D,priority:S="1"}=(L=M==null?void 0:M.dataset)!=null?L:xr,P={index:parseInt(D,10),isOverflowIndicator:!0,priority:parseInt(S,10),label:M.innerText,size:Ge(M,T)};d.current=P.size,s.current=s.current.concat(P).sort(Rr)}}else br(s)&&(s.current=s.current.filter(M=>!M.isOverflowIndicator))},[y,r,o,i,s]),fr(()=>{async function T(){await document.fonts.ready,o.current!==null&&x()}e!=="none"&&T()},[t,e,x]),gt(o,Na[e],v),[o,a.current,l.current,x]}var Er="data-collapsible",Za={[Er]:!0,"data-pad-start":!0,"data-pad-end":!0},qa=e=>{var t;return(t=Za[e])!=null?t:!1},Ja=e=>e===Er,Ka={dynamic:"dynamic",instant:"instant",true:"instant"},ja=e=>{var t;return(t=Ka[e])!=null?t:"none"},lh=e=>Object.keys(e).reduce((t,o)=>{let[n,r]=t;if(qa(o)){let i=Ja(o)?ja(e[o]):e[o];n[o]=i,r[o]=void 0}return t},[{},{}]);import{cloneElement as Qa,isValidElement as el,useCallback as tl,useMemo as Sr,useRef as lo}from"react";import{getUniqueId as ol}from"@vuu-ui/vuu-utils";var nl=["xs","sm","md","lg","xl"],rl=12,wr=({children:e,cols:t,style:o})=>{let n=lo(null),r=lo(null),i=lo(),s=t!=null?t:rl,l=(o==null?void 0:o.flexDirection)==="column"?"height":"width",c=Sr(()=>Array.isArray(e)?e:el(e)?[e]:[],[e]),p=tl((m,u)=>{let d=at(m,u,nl),h=[],g=[];for(let y=0;y<m.length;y++){let f=m[y],{style:{flex:b,...R}}=f.props;h.push(Qa(f,{key:ol(),style:{...R,"--parent-col-count":s}})),g.push(d[y])}return[h,g]},[s]);return Sr(()=>{let[m,u]=p(c,l);r.current=u,i.current=m},[p,c,l]),{cols:s,content:i.current,rootRef:n}};import{jsx as ll}from"react/jsx-runtime";var yt="hwFluidGrid",co=al(function(t,o){let{breakPoints:n,children:r,column:i,cols:s=12,className:a,flexFill:l,gap:c=3,fullPage:p,id:m,onSplitterMoved:u,resizeable:d,row:h,showGrid:g,spacing:y,splitterSize:f,style:b,...R}=t,{cols:E,content:w,rootRef:x}=wr({children:r,cols:s,style:b}),v=dr({breakPoints:n},x),T=sl(yt,a,{[`${yt}-column`]:i,[`${yt}-row`]:h,[`${yt}-show-grid`]:g,"flex-fill":l,"full-page":p}),L={...b,"--spacing":y,"--grid-col-count":E,"--grid-gap":c};return ll("div",{...R,className:T,"data-breakpoint":v,"data-cols":E,"data-resizeable":d||void 0,id:m,ref:il(x,o),style:L,children:w})});co.displayName="FluidGrid";import{jsx as cl}from"react/jsx-runtime";var vr=function(t){return cl(co,{...t})};vr.displayName="FluidGrid";B("FluidGrid",vr,"container");import Sl from"classnames";import wl,{useRef as vl,useState as kr}from"react";import ul,{useContext as Dr}from"react";var pl={dispatch:null},bt=ul.createContext(pl),Tr=()=>{var t;let e=Dr(bt);return(t=e==null?void 0:e.dispatch)!=null?t:null},Gh=()=>Dr(bt);import{useForkRef as gl,useIdMemo as yl}from"@salt-ds/core";import bl from"classnames";import po,{forwardRef as xl,useMemo as Rl,useRef as Ar}from"react";import{useCallback as xe,useMemo as Pr}from"react";import{useCallback as Ue,useState as ml}from"react";var xt=(e,t,o,n)=>{var y;let{loadSessionState:r,purgeSessionState:i,purgeState:s,saveSessionState:a}=ve(),[l,c]=ml((y=r(e,"contributions"))!=null?y:[]),p=Z(),m=Ue((f,b)=>{let R=l.concat([{location:f,content:b}]);a(e,"contributions",R),c(R)},[l,e,a]),u=Ue(()=>{i(e,"contributions"),c([])},[e,i]),d=Ue(()=>{let f=r(e,"data-source");f&&f.unsubscribe(),i(e),s(e),p({type:"remove",path:o})},[p,e,r,i,s,o]),h=Ue(async(f,b,R)=>{var w;f.stopPropagation();let E=(w=t.current)==null?void 0:w.getBoundingClientRect();return new Promise((x,v)=>{p({type:"drag-start",evt:f,path:b===void 0?o:`${o}.${b}`,dragRect:E,preDragActivity:R,dropTargets:n,resolveDragStart:x,rejectDragStart:v})})},[t,p,o,n]);return[Ue(async(f,b)=>{var E;let{type:R}=f;switch(R){case"maximize":case"minimize":case"restore":return p({type:R,path:(E=f.path)!=null?E:o});case"remove":return d();case"mousedown":return console.log("2) ViewActionDispatch Hook dispatch Action mousedown"),h(b,f.index,f.preDragActivity);case"add-toolbar-contribution":return m(f.location,f.content);case"remove-toolbar-contribution":return u();default:return}},[p,o,d,h,m,u]),l]};var Lr=({id:e,rootRef:t,path:o,dropTargets:n,title:r})=>{let i=Z(),{loadState:s,loadSessionState:a,purgeState:l,saveState:c,saveSessionState:p}=ve(),[m,u]=xt(e,t,o,n),d=Pr(()=>{var x;return(x=s("view-title"))!=null?x:r},[s,r]),h=xe(x=>{o&&i({type:"set-title",path:o,title:x})},[i,o]),g=Pr(()=>s(e),[e,s]),y=xe(x=>s(e,x),[e,s]),f=xe(x=>{l(e,x),i({type:"save"})},[e,l]),b=xe((x,v)=>{c(e,v,x),i({type:"save"})},[e,i,c]),R=xe(x=>a(e,x),[e,a]),E=xe((x,v)=>p(e,v,x),[e,p]),w=xe(({type:x,...v})=>{let{[x]:T}=v;b(T,x)},[b]);return{contributions:u,dispatchViewAction:m,load:y,loadSession:R,onConfigChange:w,onEditTitle:h,purge:f,restoredState:g,save:b,saveSession:E,title:d}};import{useResizeObserver as dl,WidthHeight as fl}from"@heswell/salt-lab";import{useCallback as Mr,useRef as Cr}from"react";var hl=[],zr=({mainRef:e,resize:t="responsive",rootRef:o})=>{let n=t==="defer",r=Cr({}),i=Cr(),s=Mr(()=>{e.current&&(e.current.style.height=r.current.height+"px",e.current.style.width=r.current.width+"px"),i.current=void 0},[]),a=Mr(({height:l,width:c})=>{r.current.height=l,r.current.width=c,i.current!==null&&clearTimeout(i.current),i.current=window.setTimeout(s,40)},[s]);dl(o,n?fl:hl,a,n)};import{jsx as uo,jsxs as El}from"react/jsx-runtime";var Ir=xl(function(t,o){let{children:n,className:r,collapsed:i,closeable:s,"data-resizeable":a,dropTargets:l,expanded:c,flexFill:p,id:m,header:u,orientation:d="horizontal",path:h,resize:g="responsive",resizeable:y=a,tearOut:f,style:b={},title:R,...E}=t,w=yl(m),x=Ar(null),v=Ar(null),{contributions:T,dispatchViewAction:L,load:M,loadSession:D,onConfigChange:S,onEditTitle:P,purge:C,restoredState:O,save:N,saveSession:k,title:G}=Lr({id:w,rootRef:x,path:h,dropTargets:l,title:R});zr({mainRef:v,resize:g,rootRef:x});let Pe="vuuView",Jr=()=>po.isValidElement(n)&&O?po.cloneElement(n,O):n,Kr=Rl(()=>({dispatch:L,id:w,path:h,title:G,load:M,loadSession:D,onConfigChange:S,purge:C,save:N,saveSession:k}),[L,w,M,D,S,h,C,N,k,G]),jr=typeof u=="object"?u:{};return uo("div",{...E,className:bl(Pe,r,{[`${Pe}-collapsed`]:i,[`${Pe}-expanded`]:c,[`${Pe}-resize-defer`]:g==="defer"}),"data-resizeable":y,id:w,ref:gl(o,x),style:b,tabIndex:-1,children:El(bt.Provider,{value:Kr,children:[u?uo(Or,{...jr,collapsed:i,contributions:T,expanded:c,closeable:s,onEditTitle:P,orientation:d,tearOut:f,title:G}):null,uo("div",{className:`${Pe}-main`,ref:v,children:Jr()})]})})});Ir.displayName="View";var me=po.memo(Ir);me.displayName="View";B("View",me,"view");import{EditableLabel as Dl,Toolbar as Tl,ToolbarButton as Pl,ToolbarField as Ll,Tooltray as Br}from"@heswell/salt-lab";import{CloseIcon as Ml}from"@salt-ds/icons";import{jsx as Te,jsxs as Cl}from"react/jsx-runtime";var Or=({className:e,contributions:t,collapsed:o,expanded:n,closeable:r,onEditTitle:i,orientation:s="horizontal",style:a,tearOut:l,title:c="Untitled"})=>{let p=vl(null),[m,u]=kr(c),[d,h]=kr(!1),g=Tr(),y=(C,O)=>g==null?void 0:g({type:O},C),f=C=>g==null?void 0:g({type:"remove"},C),b="vuuHeader",R=C=>{var O;(O=p.current)==null||O.focus()},E=C=>{C.stopPropagation()},x=Sl(b,e,`${b}-${o||s}`),v=()=>{h(!0)},T=C=>{C.key==="Enter"&&h(!0)},L=(C="",O="",N=!0,k=!1)=>{var G;h(!1),k?u(C):O!==C&&(u(O),i==null||i(O)),N===!1&&((G=p.current)==null||G.focus())},M=C=>{g==null||g({type:"mousedown"},C)},D=[],S=[],P=[];return c&&D.push(Te(Ll,{className:"vuuHeader-title",children:Te(Dl,{editing:d,value:m,onChange:u,onMouseDownCapture:R,onEnterEditMode:v,onExitEditMode:L,onKeyDown:T,ref:p,tabIndex:0},"title")},"title")),t==null||t.forEach((C,O)=>{S.push(wl.cloneElement(C.content,{key:O}))}),r&&P.push(Cl(Pl,{onClick:f,onMouseDown:E,children:[Te(Ml,{})," Close"]},"close")),S.length>0&&D.push(Te(Br,{"data-align-end":!0,children:S},"contributions")),P.length>0&&D.push(Te(Br,{"data-align-end":!0,children:P},"actions")),Te(Tl,{className:x,orientation:s,style:a,onMouseDown:M,children:D})};import{List as zl,ListItem as Al}from"@heswell/salt-lab";import{uuid as Il}from"@vuu-ui/vuu-utils";import Nr from"classnames";import{cloneElement as Ol,memo as kl}from"react";import{jsx as mo}from"react/jsx-runtime";var Bl=e=>{let t=e.cloneNode(!0);return t.id="",delete t.dataset.idx,t},Hr=kl(({className:e,children:t,idx:o,resizeable:n,header:r,closeable:i,...s})=>mo(Al,{className:Nr("vuuPaletteItem",e),"data-icon":"grab-handle",...s}));Hr.displayName="PaletteItem";var Nl=({children:e,className:t,orientation:o="horizontal",...n})=>{let r=Z(),i="vuuPalette";function s(a){var x;let c=a.target.closest(".vuuPaletteItem"),p=parseInt((x=c.dataset.idx)!=null?x:"-1");p!==-1&&console.log({children:e,idx:p,listItemElement:c});let{props:{caption:m,children:u,template:d,...h}}=e[p],{height:g,left:y,top:f,width:b}=c.getBoundingClientRect(),R=Il(),w=d?u:mo(me,{...{id:R,key:R},...h,title:h.label,children:u});r({dragRect:{left:y,top:f,right:y+b,bottom:f+150,width:b,height:g},dragElement:Bl(c),evt:a.nativeEvent,instructions:{DoNotRemove:!0,DoNotTransform:!0,RemoveDraggableOnDragEnd:!0,dragThreshold:10},path:"*",payload:w,type:"drag-start"})}return mo(zl,{...n,borderless:!0,className:Nr(i,t,`${i}-${o}`),maxHeight:800,selected:null,children:e.map((a,l)=>a.type===Hr?Ol(a,{key:l,onMouseDown:s}):a)})};B("Palette",Nl,"view");import{List as Hl,ListItem as $l}from"@heswell/salt-lab";import{uuid as Fl}from"@vuu-ui/vuu-utils";import Vl from"classnames";import{jsx as fo}from"react/jsx-runtime";var Wl="vuuPalette",by=e=>{let{children:t,ViewProps:o,label:n,onMouseDown:r,template:i,...s}=e,a=Z();return fo($l,{onMouseDown:c=>{let{left:p,top:m,width:u}=c.currentTarget.getBoundingClientRect(),d=Fl(),g=i?t:fo(me,{...{id:d,key:d},...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:p,top:m,right:p+u,bottom:m+150,width:u,height:100}})},...s,children:n})},_l=({className:e,...t})=>fo(Hl,{...t,className:Vl(Wl,e),height:"100%",selectionStrategy:"none"});B("PaletteSalt",_l,"view");import{useIdMemo as Gl}from"@salt-ds/core";import Ul from"classnames";import{Tab as Xl,Tabstrip as Yl,Toolbar as Zl,ToolbarField as ql}from"@heswell/salt-lab";import Et,{forwardRef as Jl,useCallback as Kl}from"react";import{jsx as Rt,jsxs as tc}from"react/jsx-runtime";var $r="Tabs",jl=(e,t)=>{},Ql=(e,t)=>{var o,n;return(n=(o=e.props)==null?void 0:o.title)!=null?n:`Tab ${t+1}`},ec=e=>{let t=[];return Et.Children.forEach(e,o=>{Et.isValidElement(o)?t.push(o):console.warn("Stack has unexpected child element type")}),t},ho=Jl(function({active:t=0,children:o,className:n,enableAddTab:r,enableCloseTabs:i,getTabIcon:s=jl,getTabLabel:a=Ql,id:l,keyBoardActivation:c="manual",onMouseDown:p,onTabAdd:m,onTabClose:u,onTabEdit:d,onTabSelectionChanged:h,showTabs:g,style:y,TabstripProps:f},b){var S;let R=Gl(l),E=P=>{h==null||h(P)},w=P=>{u==null||u(P)},x=()=>{m==null||m(Et.Children.count(o))},v=P=>{var k;let O=P.target.closest('[role^="tab"]'),N=O==null?void 0:O.getAttribute("role");if(N==="tab"){let G=parseInt((k=O.dataset.idx)!=null?k:"-1");if(G!==-1)p==null||p(P,G);else throw Error("Stack: mousedown on tab with unknown index")}else N==="tablist"&&console.log("Stack mousedown on tabstrip")},T=Kl((P,C,O,N)=>{d==null||d(N,C)},[d]),L=()=>{var P;return Et.isValidElement(o)?o:Array.isArray(o)&&(P=o[t])!=null?P:null},M=()=>ec(o).map((P,C)=>{let O=`${R}-${C}`,{closeable:N,id:k}=P.props;return Rt(Xl,{ariaControls:`${O}-tab`,"data-icon":s(P,C),draggable:!0,id:O,label:a(P,C),closeable:N,editable:(f==null?void 0:f.enableRenameTab)!==!1},k!=null?k:C)}),D=L();return tc("div",{className:Ul($r,n,{[`${$r}-horizontal`]:(f==null?void 0:f.orientation)==="vertical"}),style:y,id:R,ref:b,children:[g?Rt(Zl,{className:"vuuTabHeader vuuHeader",orientation:f==null?void 0:f.orientation,children:Rt(ql,{disableFocusRing:!0,"data-collapsible":"dynamic","data-priority":"3",style:{alignSelf:"flex-end"},children:Rt(Yl,{...f,enableRenameTab:(f==null?void 0:f.enableRenameTab)!==!1,enableAddTab:r,enableCloseTab:i,keyBoardActivation:c,onActiveChange:E,onAddTab:x,onCloseTab:w,onExitEditMode:T,onMouseDown:v,activeTabIndex:(S=f==null?void 0:f.activeTabIndex)!=null?S:D===null?-1:t,children:M()})})}):null,D]})});ho.displayName="Stack";import{useIdMemo as oc}from"@salt-ds/core";import nc,{useRef as rc}from"react";import{jsx as go}from"react/jsx-runtime";var ic=e=>go(me,{resizeable:!0,title:`Tab ${e}`,style:{flexGrow:1,flexShrink:0,flexBasis:0},header:!0,closeable:!0,children:go(Lt,{style:{flex:1}})}),Fr=e=>{let t=rc(null),o=Z(),{loadState:n,saveState:r}=ve(),{createNewChild:i=ic,id:s,onTabSelectionChanged:a,path:l,...c}=e,{children:p}=e,m=oc(s),[u]=xt(m,t,l);return go(ho,{...c,id:m,getTabLabel:(R,E)=>{let{id:w,title:x}=R.props;return n(w,"view-title")||x||`Tab ${E+1}`},onMouseDown:async(R,E)=>{let w;await u({type:"mousedown",index:E,preDragActivity:async()=>new Promise(T=>{console.log("preDragActivity: Ok, gonna release the drag"),w=T})},R)&&(w==null||w(void 0))},onTabAdd:(R,E=nc.Children.count(p))=>{if(l){console.log("[StackLayout] handleTabAdd");let w=i(E);console.log({component:w}),o({type:"add",path:l,component:w})}},onTabClose:R=>{if(Array.isArray(p)){let{props:{"data-path":E,path:w=E}}=p[R];o({type:"remove",path:w})}},onTabEdit:(R,E)=>{o({type:"set-title",path:`${l}.${R}`,title:E})},onTabSelectionChanged:R=>{console.log(`StackLayout handleTabSelection nextTab = ${R}`),l&&(o({type:"switch-tab",path:l,nextIdx:R}),a==null||a(R))},ref:t})};Fr.displayName="Stack";B("Stack",Fr,"container");import Vr,{useState as Wr}from"react";import{jsx as yo,jsxs as _r}from"react/jsx-runtime";var rb=({children:e})=>{let[o,n]=Wr(e),[r,i]=Wr(e),s=l=>{let c=Fo(o,l);i(c)},a=(l,c)=>{console.log(`change ${l} -> ${c}`);let p=Vr.cloneElement(r,{style:{...r.props.style,[l]:c}});i(p),n(Vr.cloneElement(o,null,p))};return _r("div",{"data-design-mode":`${!1}`,children:[o,yo("br",{}),_r("div",{style:{display:"flex"},children:[yo(Gr,{height:300,managedStyle:r.props.style,width:300,onChange:a}),yo(Ur,{layout:o,onSelect:s,style:{width:300,height:300,backgroundColor:"#ccc"}})]})]})};import{FormField as St,Input as wt}from"@heswell/salt-lab";import{jsx as $,jsxs as xo}from"react/jsx-runtime";var Ro={},sc={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"}},bo=({feature:e,children:t,style:o,onChange:n})=>xo("div",{className:`LayoutBox layout-${e} layout-outer`,children:[xo("div",{className:"layout-top",children:[$("span",{className:"layout-title",children:e}),$(St,{className:"layout-input",style:{width:30},children:$(wt,{value:o.top,onChange:(r,i)=>n(e,"top",i)})})]}),xo("div",{className:"layout-inner",children:[$("div",{className:"layout-left",children:$(St,{className:"layout-input",style:{width:30},children:$(wt,{value:o.left,onChange:(r,i)=>n(e,"left",i)})})}),t,$("div",{className:"layout-right",children:$(St,{className:"layout-input",style:{width:30},children:$(wt,{value:o.right,onChange:(r,i)=>n(e,"right",i)})})})]}),$("div",{className:"layout-bottom",children:$(St,{className:"layout-input",style:{width:30},children:$(wt,{value:o.bottom,onChange:(r,i)=>n(e,"bottom",i)})})})]}),db={margin:!0,marginTop:!0,marginRight:!0,marginBottom:!0,marginLeft:!0},fb={padding:!0,paddingTop:!0,paddingRight:!0,paddingBottom:!0,paddingLeft:!0},hb={border:!0,borderColor:!0,borderWidth:!0,borderTopWidth:!0,borderRightWidth:!0,borderBottomWidth:!0,borderLeftWidth:!0},vt="(\\d+)(?:px)?",ac=`^(?:${vt}(?:\\s${vt}(?:\\s${vt}(?:\\s${vt})?)?)?)$`,Xr=new RegExp(ac),lc=/^(?:(\d+)(?:px)\ssolid\s([a-zA-Z,0-9().]+))$/,Gr=({height:e,managedStyle:t,onChange:o,style:n,width:r})=>{let i=Yr(t),s=(R,E,w)=>{let x=parseInt(w||"0",10),v=sc[R][E];o(v,x)},{marginTop:a=0,marginRight:l=0,marginBottom:c=0,marginLeft:p=0}=i,{borderTopWidth:m=0,borderRightWidth:u=0,borderBottomWidth:d=0,borderLeftWidth:h=0}=i,{paddingTop:g=0,paddingRight:y=0,paddingBottom:f=0,paddingLeft:b=0}=i;return $("div",{className:"LayoutConfigurator",style:{width:r,height:e,...n},children:$(bo,{feature:"margin",style:{top:a,right:l,bottom:c,left:p},onChange:s,children:$(bo,{feature:"border",style:{top:m,right:u,bottom:d,left:h},onChange:s,children:$(bo,{feature:"padding",style:{top:g,right:y,bottom:f,left:b},onChange:s,children:$("div",{className:"layout-content"})})})})})};function gb(e=Ro,t=Ro){let{margin:o,marginTop:n,marginRight:r,marginBottom:i,marginLeft:s,padding:a,paddingTop:l,paddingRight:c,paddingBottom:p,paddingLeft:m,...u}=e;if(typeof o=="number")u.marginTop=u.marginRight=u.marginBottom=u.marginLeft=o;else if(typeof o=="string"){let d=Xr.exec(o);if(d===null)console.error(`Invalid css value for margin '${o}'`);else{let[,h,g,y,f]=d,b=h&&g&&y;b&&f?(u.marginTop=parseInt(h,10),u.marginRight=parseInt(g,10),u.marginBottom=parseInt(y,10),u.marginLeft=parseInt(f,10)):b?(u.marginTop=parseInt(h,10),u.marginRight=u.marginLeft=parseInt(g,10),u.marginBottom=parseInt(y,10)):h&&g?(u.marginTop=u.marginBottom=parseInt(h,10),u.marginRight=u.marginLeft=parseInt(g,10)):u.marginTop=u.marginRight=u.marginBottom=u.marginLeft=parseInt(h,10)}}if(typeof n=="number"&&(u.marginTop=n),typeof r=="number"&&(u.marginRight=r),typeof i=="number"&&(u.marginBottom=i),typeof s=="number"&&(u.marginLeft=s),typeof a=="number")u.paddingTop=u.paddingRight=u.paddingBottom=u.paddingLeft=a;else if(typeof a=="string"){let d=Xr.exec(a);if(d===null)console.error(`Invalid css value for padding '${a}'`);else{let[,h,g,y,f]=d,b=h&&g&&y;b&&f?(u.paddingTop=parseInt(h,10),u.paddingRight=parseInt(g,10),u.paddingBottom=parseInt(y,10),u.paddingLeft=parseInt(f,10)):b?(u.paddingTop=parseInt(h,10),u.paddingRight=u.paddingLeft=parseInt(g,10),u.paddingBottom=parseInt(y,10)):h&&g?(u.paddingTop=u.paddingBottom=parseInt(h,10),u.paddingRight=u.paddingLeft=parseInt(g,10)):u.paddingTop=u.paddingRight=u.paddingBottom=u.paddinggLeft=parseInt(h,10)}}return typeof l=="number"&&(u.paddingTop=l),typeof c=="number"&&(u.paddingRight=c),typeof p=="number"&&(u.paddingBottom=p),typeof m=="number"&&(u.paddingLeft=m),Yr(u,t)}function Yr(e=Ro){let t={...e},o,{border:n,borderWidth:r,borderTopWidth:i,borderRightWidth:s,borderBottomWidth:a,borderLeftWidth:l,borderColor:c,margin:p,marginTop:m,marginRight:u,marginBottom:d,marginLeft:h,padding:g,paddingTop:y,paddingRight:f,paddingBottom:b,paddingLeft:R,...E}=t,w={},x={};if(typeof p=="number"&&(t.marginTop=t.marginRight=t.marginBottom=t.marginLeft=p,w={marginTop:p,marginRight:p,marginBottom:p,marginLeft:p}),typeof g=="number"&&(t.paddingTop=t.paddingRight=t.paddingBottom=t.paddingLeft=g,x={paddingTop:g,paddingRight:g,paddingBottom:g,paddingLeft:g}),n||r||i||s||a||l){typeof n=="string"&&(o=lc.exec(n))&&([,r,c]=o,r=parseInt(r,10)),r&&(i=i===void 0?r:i,s=s===void 0?r:s,a=a===void 0?r:a,l=l===void 0?r:l),c=c||"black";let v=`
18
+ ${c} ${l||0}px ${i||0}px 0 0 inset,
19
+ ${c} ${-s||0}px ${-a||0}px 0 0 inset`;return{...E,...w,...x,borderTopWidth:i,borderRightWidth:s,borderBottomWidth:a,borderLeftWidth:l,borderColor:c,borderStyle:"solid",boxShadow:v}}else return t}import cc from"react";import uc from"classnames";import{Tree as pc}from"@heswell/salt-lab";import{jsx as Zr}from"react/jsx-runtime";var mc="hwLayoutTreeViewer",qr=(e,t="0")=>({label:I(e),path:t,childNodes:cc.Children.map(e.props.children,(o,n)=>qr(o,t?`${t}.${n}`:`${n}`))}),Ur=({layout:e,onSelect:t,style:o})=>{let n=[qr(e)],r=(i,[{path:s}])=>{t(s)};return Zr("div",{className:uc(mc),style:o,children:Zr(pc,{source:n,groupSelection:"single",onSelectionChange:r})})};export{Se as Action,hb as BORDER_STYLES,ai as Chest,Lt as Component,oe as ComponentRegistry,rb as ConfigWrapper,gu as Dialog,Wt as Draggable,No as DraggableLayout,Dt as Drawer,on as DropMenu,le as DropTarget,Zt as Flexbox,ar as FlexboxLayout,co as FluidGrid,vr as FluidGridLayout,Or as Header,Xf as HeightOnly,Gr as LayoutConfigurator,Mf as LayoutProvider,_e as LayoutProviderContext,Lf as LayoutProviderVersion,Ur as LayoutTreeViewer,db as MARGIN_STYLES,fb as PADDING_STYLES,Nl as Palette,Hr as PaletteItem,by as PaletteListItem,_l as PaletteSalt,it as Placeholder,ho as Stack,Fr as StackLayout,me as View,bt as ViewContext,Uf as WidthHeight,Yf as WidthOnly,gb as XXXnormalizeStyles,Vo as componentFromLayout,tn as computeMenuPosition,Mi as containerOf,Ct as expandFlex,lh as extractResponsiveProps,ie as findTarget,_ as followPath,Fo as followPathToComponent,re as followPathToParent,Ci as getChild,$o as getChildProp,Mn as getPersistentState,A as getProp,z as getProps,Cn as hasPersistentState,kt as identifyDropTarget,F as isContainer,Po as isLayoutComponent,vc as isRegistered,qa as isResponsiveAttribute,cp as isTabstrip,Au as isTypeOf,ni as isView,$u as nextLeaf,q as nextStep,Fu as previousLeaf,B as registerComponent,H as resetPath,zn as setPersistentState,Uu as setRef,I as typeOf,dr as useBreakpoints,Z as useLayoutProviderDispatch,va as useLayoutProviderVersion,sh as useOverflowObserver,ve as usePersistentState,gt as useResizeObserver,xt as useViewActionDispatcher,Gh as useViewContext,Tr as useViewDispatch};
20
20
  //# sourceMappingURL=index.js.map