@vuu-ui/vuu-layout 0.8.22 → 0.8.23
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/cjs/index.js +4 -4
- package/cjs/index.js.map +4 -4
- package/esm/index.js +4 -4
- package/esm/index.js.map +4 -4
- package/index.css +1 -1
- package/index.css.map +3 -3
- package/package.json +8 -8
- package/types/index.d.ts +0 -3
- package/types/utils/index.d.ts +0 -1
- package/types/utils/typeOf.d.ts +2 -1
- package/types/measured-container/MeasuredContainer.d.ts +0 -15
- package/types/measured-container/index.d.ts +0 -2
- package/types/measured-container/useMeasuredContainer.d.ts +0 -22
- package/types/measured-container/useResizeObserver.d.ts +0 -15
- package/types/overflow-container/OverflowContainer.d.ts +0 -17
- package/types/overflow-container/index.d.ts +0 -2
- package/types/overflow-container/overflow-utils.d.ts +0 -49
- package/types/overflow-container/useOverflowContainer.d.ts +0 -20
- package/types/toolbar/Toolbar.d.ts +0 -21
- package/types/toolbar/index.d.ts +0 -1
- package/types/toolbar/toolbar-dom-utils.d.ts +0 -3
- package/types/toolbar/useKeyboardNavigation.d.ts +0 -32
- package/types/toolbar/useSelection.d.ts +0 -22
- package/types/toolbar/useToolbar.d.ts +0 -28
- package/types/utils/react-utils.d.ts +0 -2
package/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{partition as Yo}from"@vuu-ui/vuu-utils";import Qi from"clsx";var Vo={},_o={},le={};function W(e){return Vo[e]===!0}function ji(e){return _o[e]===!0}var Go=e=>W(e)||ji(e);function z(e,t,o="component"){le[e]=t,o==="container"?Vo[e]=!0:o==="view"&&(_o[e]=!0)}import{Button as Ko,useControlled as Yi}from"@salt-ds/core";import Uo from"clsx";import{useCallback as Zi}from"react";import{jsx as Me,jsxs as Ji}from"react/jsx-runtime";var re="vuuDrawer",qo=e=>typeof e=="string"?e:e+"px",Xi=(e,t,o)=>{let r=t!==void 0,n=o!==void 0;if(!(!e&&!n&&!r))return!n&&!r?e:{...e,"--drawer-size":r?qo(t):void 0,"--drawer-peek-size":n?qo(o):void 0}},jo=({children:e,className:t,clickToOpen:o,defaultOpen:r,sizeOpen:n,sizeClosed:i,style:a,open:s,position:l="left",inline:c,onClick:p,peekaboo:d=!1,toggleButton:u,...m})=>{let[h,g]=Yi({controlled:s,default:r!=null?r:!1,name:"Drawer",state:"open"});console.log(`Drawer sizeOpen ${n} sizeClosed ${i}`);let b=Uo(re,t,`${re}-${l}`,{[`${re}-open`]:h,[`${re}-inline`]:c,[`${re}-over`]:!c,[`${re}-peekaboo`]:d}),f=Zi(()=>{g(!h)},[h,g]),y=Xi(a,n,i),x=o?f:p,w=()=>Me("div",{className:Uo("vuuToggleButton-container"),children:h?Me(Ko,{"aria-label":"close",onClick:f,"data-icon":"close",variant:"secondary"}):Me(Ko,{"aria-label":"open",onClick:f,"data-icon":"close",variant:"secondary"})});return Ji("div",{...m,className:b,onClick:x,style:y,children:[u=="start"?w():null,Me("div",{className:`${re}-liner`,children:Me("div",{className:`${re}-content`,children:e})}),u=="end"?w():null]})};jo.displayName="Drawer";var Ht=jo;import{jsx as ra,jsxs as na}from"react/jsx-runtime";var ea=e=>e.type===Ht,ta=({props:{position:e="left"}})=>e.match(/top|bottom/),zt=e=>{let{children:t,className:o,id:r,style:n}=e,i="vuuDockLayout",[a,s]=Yo(t,ea),[l,c]=Yo(a,ta),p=l.length===0?"horizontal":c.length===0?"vertical":"both",d=Qi(i,o,`${i}-${p}`);return na("div",{className:d,id:r,style:n,children:[a,ra("div",{className:`${i}-content`,children:s})]})};zt.displayName="DockLayout";var oa=zt;z("DockLayout",zt,"container");import{forwardRef as ia}from"react";import{jsx as sa}from"react/jsx-runtime";var Bt=ia(function({resizeable:t,...o},r){return sa("div",{...o,className:"Component",ref:r})});Bt.displayName="Component";var aa=Bt;z("Component",Bt);import ne,{isValidElement as Xo}from"react";var la={},C=(e,t)=>{var r;let o=D(e);return(r=o[t])!=null?r:o[`data-${t}`]},D=e=>(e==null?void 0:e.props)||e||la,Zo=e=>{let t=D(e);if(t.children){let{children:[o,...r]}=t;return r.length>0&&console.warn(`getChild expected a single child, found ${r.length+1}`),o}};function M(e){var t;if(e){let o=e.type;if(typeof o=="function"||typeof o=="object"){let r=o.displayName||o.name||((t=o.type)==null?void 0:t.name);if(typeof r=="string")return r}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 Dp=(e,t)=>M(e)===t;var ca=e=>{let t=e.lastIndexOf(".");return t===-1?e:e.slice(0,t)},Jo=e=>ne.isValidElement(e.props.children)?[e.props.children]:e.props.children,Nt=(e,t="")=>{let[o,...r]=t.split(".");if(o!=null&&o.startsWith("#")){let n=Ft(e,o.slice(1),!0);if(n&&r.length)return Nt(n,r.join("."))}else if(o==="ACTIVE_CHILD"){let{active:n}=D(e),i=Jo(e),{path:a}=D(i[n]);return a}return""},ua=(e,t="")=>{let[o,...r]=t.split(".");if(o!=null&&o.startsWith("#")){let n=er(e,o.slice(1),!0);if(n&&r.length)return ua(n,r.join("."))}else if(o==="ACTIVE_CHILD"){let{children:n,props:i}=e,{active:a}=i;if(typeof a=="number"&&(n!=null&&n[a]))return n[a]}};function Y(e,t){let{"data-path":o,path:r=o}=D(e);return t==="0"||t===r?null:B(e,ca(t),!0)}function te(e,t){let{children:o,...r}=D(e);if(t(r))return e;if(ne.Children.count(o)>0){let n=ne.isValidElement(o)?[o]:o;for(let i of n){let a=te(i,t);if(a)return a}}}function pa(e,t){if(t===e)return null;let{path:o,children:r}=D(e),{idx:n,finalStep:i}=Z(o,C(t,"path"));return i?e:r===void 0||r[n]===void 0?null:pa(r[n],t)}var da=(e,t)=>{if(ne.isValidElement(e)&&t==0)return e;if(Array.isArray(e))return e[t]};function Qo(e,t){let o=t.split("."),r=[e];for(let n=0;n<o.length;n++){let i=parseInt(o[n]),a=r[i];if(n===o.length-1)return a;r=Jo(a)}}var Ft=(e,t,o=!0)=>{let{children:r,id:n}=e.props;if(n===t)return e;if(ne.Children.count(r)>0){let i=Xo(r)?[r]:r;for(let a of i)if(Xo(a)){let s=Ft(a,t,!1);if(s)return s}}if(o===!0)throw Error(`pathUtils.findTargetById id #${t} not found in source`)},er=(e,t,o=!0)=>{let{children:r,id:n}=e;if(n===t)return e;if(Array.isArray(r)&&r.length>0){for(let i of r)if(i!==null&&typeof i=="object"){let a=er(i,t,!1);if(a)return a}}if(o===!0)throw Error(`pathUtils.findTargetJSONById id #${t} not found in source`)};function B(e,t,o=!1){if(t.startsWith("#"))return Ft(e,t.slice(1),o);let{"data-path":r,path:n=r}=D(e);if(t.indexOf(n)!==0)throw Error(`pathUtils.followPath path ${t} is not within source path ${n}`);let i=t.slice(n.length+1);if(i==="")return e;let a=e,s=i.split(".");for(let l=0;l<s.length;l++){if(ne.Children.count(a.props.children)===0){let c=`element at 0.${s.slice(0,l).join(".")} has no children, so cannot fulfill rest of path ${s.slice(l).join(".")}`;if(o)throw Error(c);console.warn(c);return}if(a=da(a.props.children,parseInt(s[l])),a===void 0){let c=`model at 0.${s.slice(0,l).join(".")} has no children that fulfill next step of path ${s.slice(l).join(".")}`;if(o)throw Error(c);console.warn(c)}}return a}function Ap(e,t){let o=Y(e,t),r=t.split(".").map(n=>parseInt(n,10));if(o){let n=r.pop(),{children:i}=o.props;if(i.length-1>n)return Je(i[n+1]);{let a=r.pop(),s=Y(e,C(o,"path"));if(s&&typeof a=="number"&&(r=s.props.path.split(".").map(l=>parseInt(l,10)),s.props.children.length-1>a)){let l=s.props.children[a+1];return W(M(l))?Je(l):l}}}return Je(e)}function Op(e,t){let o=t.split(".").map(i=>parseInt(i,10)),r=o.pop(),n=Y(e,t);if(n!=null&&typeof r=="number"){let{children:i}=n.props;if(r>0)return Qe(i[r-1]);for(;o.length>1;)if(r=o.pop(),n=Y(e,C(n,"path")),r>0){let a=n.props.children[r-1];return W(M(a))?Qe(a):a}}return Qe(e)}function Je(e){if(W(M(e))){let{children:t}=e.props||e;return Je(t[0])}return e}function Qe(e){if(W(M(e))){let{children:t}=e.props||e;return Qe(t[t.length-1])}return e}function Z(e,t,o=!1){if(e===t)return{idx:-1,finalStep:!0};let r=`${e}.`;if(!t.startsWith(r))throw Error("pathUtils nextStep has strayed from the path");let n=o?0:1,i=t.replace(r,"").split(".").map(a=>parseInt(a,10));return{idx:i[0],finalStep:i.length===n}}function N(e,t,o){if(C(e,"path")===t)return e;let r=[];ne.Children.forEach(e.props.children,(i,a)=>{C(i,"path")?r.push(N(i,`${t}.${a}`)):r.push(i)});let n=e.props["data-path"]?"data-path":"path";return ne.cloneElement(e,{[n]:t,...o},r)}function zp(e,t){typeof e=="function"?e(t):e&&(e.current=t)}import{Children as ma,isValidElement as tr}from"react";var fa=[],ve=e=>{let t=Array.isArray(e),o=t?e.length:ma.count(e);return t&&e.every(tr)?e:o===1&&!t&&tr(e)?[e]:o>1?e:fa};var $t=e=>{if(typeof e!="number")throw Error(`"no support yet for flex value ${e}`);return{flexBasis:0,flexGrow:1,flexShrink:1}};import{boxContainsPoint as et}from"@vuu-ui/vuu-utils";var ue={north:1,east:2,south:4,west:8,header:16,centre:32,absolute:64},Ce={AFTER:"after",BEFORE:"before"},K=Object.freeze({North:ce("north"),East:ce("east"),South:ce("south"),West:ce("west"),Header:ce("header"),Centre:ce("centre"),Absolute:ce("absolute")});function ce(e){return Object.freeze({offset:e==="north"||e==="west"?0:e==="south"||e==="east"?1:NaN,valueOf:function(){return ue[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 or=K.North,rr=K.South,Wt=K.East,Vt=K.West,ha=K.Header,ga=K.Centre,ye=class{static measure(t,o=[]){let r={};return ya(t,r,o),r}static allBoxesContainingPoint(t,o,r,n,i){return sr(t,o,r,n,i).reverse()}};function _t(e,t,o,r=30){let n=o.right-o.left,i=o.bottom-o.top,a=e-o.left,s=t-o.top,l=0;return a<r&&(l+=8),a>n-r&&(l+=2),s<r&&(l+=1),s>i-r&&(l+=4),{pctX:a/n,pctY:s/i,closeToTheEdge:l}}function Gt(e,t,o,r){let{BEFORE:n,AFTER:i}=Ce,{pctX:a,pctY:s,closeToTheEdge:l}=_t(e,t,o),c,p;if(r==="row")c=a<.5?Vt:Wt;else if(o.header&&et(o.header,e,t))if(c=ha,o.Stack){let d=o.Stack.length;if(d===0)p={index:-1,left:o.left,positionRelativeToTab:i,width:0};else{let u=o.Stack.find(({left:m,right:h})=>e>=m&&e<=h);if(u){let m=u.right-u.left;p={index:o.Stack.indexOf(u),left:u.left,positionRelativeToTab:(e-u.left)/m<.5?n:i,width:m}}else p={left:o.Stack[d-1].right,width:0,index:d,positionRelativeToTab:i}}}else if(o.header.titleWidth){let d=o.header.titleWidth;p={index:-1,left:o.left,positionRelativeToTab:(e-o.left)/d<.5?n:i,width:d}}else p={left:o.left,width:0,positionRelativeToTab:n,index:-1};else c=ba(e,t,o,a,s);return{position:c,x:e,y:t,closeToTheEdge:l,tab:p}}function ba(e,t,o,r,n){let i=va(o,.2);if(et(i,e,t))return ga;switch(`${n<.5?"north":"south"}${r<.5?"west":"east"}`){case"northwest":return r>n?or:Vt;case"northeast":return 1-r>n?or:Wt;case"southeast":return r>n?Wt:rr;case"southwest":return 1-r>n?Vt:rr;default:}}function va({right:e,left:t,top:o,bottom:r},n){let i=(1-n)/2,a=(e-t)*i,s=(r-o)*i;return{left:t+a,top:o+s,right:e-a,bottom:r-s}}function ya(e,t,o){let{id:r,"data-path":n,path:i=n}=D(e),a=M(e);if(r&&i){let[s,l]=ar(e);nr(e,s,l,t),W(a)&&ir(e,t,o)}}function nr(e,t,o,r){let{"data-path":n,path:i=n,header:a}=D(e);r[i]=t;let s=M(e);if(a||s==="Stack"){let l=s==="Stack"?".vuuTabstrip":".vuuHeader",c=o.querySelector(l);if(c){let{top:p,left:d,right:u,bottom:m}=c.getBoundingClientRect();if(r[i].header={top:Math.round(p),left:Math.round(d),right:Math.round(u),bottom:Math.round(m)},s==="Stack")r[i].Stack=Array.from(c.querySelectorAll(".vuuTab")).map(h=>h.getBoundingClientRect()).map(({left:h,right:g})=>({left:h,right:g}));else{let h=c.querySelector('[class^="vuuHeader-title"]'),{header:g}=r[i];h&&g&&(g.titleWidth=h.clientWidth)}}}return r[i]}function ir(e,t,o,r=0,n=0,i=0,a=0){let{children:s,"data-path":l,path:c=l,style:p,active:d=0}=D(e),u=M(e),m=u==="Flexbox",h=u==="Stack",g=m&&p.flexDirection==="column",b=m&&p.flexDirection==="row",y=(h?s.filter((w,R)=>R===d):s.filter(wa)).map(w=>{let[R,v]=ar(w);return[{...R,top:R.top-i,right:R.right+n,bottom:R.bottom+a,left:R.left-r},v,w]}),x=y.map(([w,R,v],E,S)=>{let I,L,T,P,k,A,O=S.length-1;b?(k=E===0?0:w.left-S[E-1][0].right,A=E===O?0:S[E+1][0].left-w.right,I=E===0||k===0?0:k,L=E===O||A===0?0:A-A/2,w.left-=I,w.right+=L,T=i,P=a):g&&(k=E===0?0:w.top-S[E-1][0].bottom,A=E===O?0:S[E+1][0].top-w.bottom,T=E===0||k===0?0:k,P=E===O||A===0?0:A-A/2,w.top-=T,w.bottom+=P,I=r,L=n);let H=nr(v,w,R,t),G=M(v);return W(G)&&ir(v,t,o,I,L,T,P),H});y.length&&(t[c].children=x)}function wa(e){let{id:t}=D(e),o=document.getElementById(t);return o?o.dataset.dragging!=="true":(console.warn(`BoxModel: no element found with id #${t}`),!1)}function ar(e){let{id:t}=D(e);if(t===void 0)throw Error("`BoxModel.measureComponentElement, component has no id");let o=document.getElementById(t);if(!o)throw Error("BoxModel.measureComponentElement, no DOM element found for component");let{top:r,left:n,right:i,bottom:a,height:s,width:l}=o.getBoundingClientRect(),c,p=M(e);if(W(p)){let d=o.scrollHeight;d>s&&(c={id:t,scrollHeight:d,scrollTop:o.scrollTop})}return[{top:Math.round(r),left:Math.round(n),right:Math.round(i),bottom:Math.round(a),height:Math.round(s),width:Math.round(l),scrolling:c},o,e]}function sr(e,t,o,r,n,i=[]){let{children:a,"data-path":s,path:l=s}=D(e),c=M(e),p=t[l];if(!et(p,o,r))return i;if(n&&n.length){if(n.includes(l))i.push(e);else if(!n.some(d=>d.startsWith(l)))return i}else i.push(e);if(!W(c)||p.header&&et(p.header,o,r))return i;p.scrolling&&xa(p,o,r);for(let d=0;d<a.length;d++){if(c==="Stack"&&e.props.active!==d)continue;let u=sr(a[d],t,o,r,n);if(u.length)return i.concat(u)}return i}function xa({top:e,bottom:t,scrolling:o},r,n){if(o){let{id:i,scrollTop:a,scrollHeight:s}=o,l=t-e;if(a===0&&t-n<50){let c=s-l;document.getElementById(i).scrollTo({left:0,top:c,behavior:"smooth"}),o.scrollTop=c}else if(a>0&&n-e<50)document.getElementById(i).scrollTo({left:0,top:0,behavior:"smooth"}),o.scrollTop=0;else return!1}else return!1}var Ea=.4,tt=class{constructor(t,o,r,n,i){this.init(t,o,r,n,i)}init(t,o,r,n,i){let{left:a,top:s}=n,{pctX:l,pctY:c}=_t(o,r,n),p=Ea,d=l*n.width,u=n.width-d,m=c*n.height,h=n.height-m,g=n.width*p,b=n.height*p,f=1-p,y=d*f,x=m*f,w=u*f,R=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-y,hi:t.right-n.width+w},y:{lo:t.top-x,hi:t.bottom-n.height+R}},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:a,lo:!1,hi:!1,mousePos:o,mousePct:l},this.y={pos:s,lo:!1,hi:!1,mousePos:r,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){let r=this[t],n=this.constraint.mouse[t],i=this.constraint.pos[t],a=r.pos,s=o-r.mousePos;return s<0?r.lo||(o<n.lo?(r.lo=!0,r.pos=i.lo):r.hi?o<n.hi&&(r.hi=!1,r.pos+=s):r.pos+=s):s>0&&(r.hi||(o>n.hi?(r.hi=!0,r.pos=i.hi):r.lo?o>n.lo&&(r.lo=!1,r.pos+=s):r.pos+=s)),r.mousePos=o,a!==r.pos}dropXY(t){let o=this[t],r=this.constraint.zone[t];return o.lo?Math.max(r.lo,o.mousePos):o.hi?Math.min(o.mousePos,Math.round(r.hi)-1):o.mousePos}};var Jp=e=>e.pos.tab&&M(e.component)==="Stack"&&e.pos.position.Header,{north:Ra,south:Ta,east:Sa,west:Da}=ue,Pa=Sa+Da,La=Ra+Ta,we=class e{constructor({component:t,pos:o,clientRect:r,nextDropTarget:n}){this.component=t,this.pos=o,this.clientRect=r,this.nextDropTarget=n,this.active=!1,this.dropRect=void 0}targetTabPos(t){let{left:o,width:r,positionRelativeToTab:n}=t;return n===Ce.BEFORE?o:o+r}getTargetDropOutline(t,o){if(this.pos.tab)return this.getDropTabOutline(t,this.pos.tab);if(o&&o.hasIntrinsicSize())return this.getIntrinsicDropRect(o);{let[r,n,i,a]=this.getDropRectOutline(t,o);return{l:r,t:n,r:i,b:a}}}getDropTabOutline(t,o){var f,y;let{clientRect:{top:r,left:n,right:i,bottom:a,header:s}}=this,l=0,c=Math.round(t/2)+l,p=Math.round(r),d=Math.round(n+c),u=Math.round(i-c),m=Math.round(a-c),h=this.targetTabPos(o),g=60,b=((f=s==null?void 0:s.bottom)!=null?f:0)-((y=s==null?void 0:s.top)!=null?y:0);return{l:d,t:p,r:u,b:m,tabLeft:h,tabWidth:g,tabHeight:b}}getIntrinsicDropRect(t){var g,b,f,y;let{pos:o,clientRect:r}=this,{x:n,y:i}=t,a=(b=(g=t.intrinsicSize)==null?void 0:g.height)!=null?b:0,s=(y=(f=t.intrinsicSize)==null?void 0:f.height)!=null?y:0;a&&a>r.height?(console.log("DropTarget: we're going to blow the gaff"),a=r.height):s&&s>r.width&&(console.log("DropTarget: we're going to blow the gaff"),s=r.width);let l=Math.min(r.right-s,Math.max(r.left,Math.round(o.x-n.mousePct*s))),c=Math.min(r.bottom-a,Math.max(r.top,Math.round(o.y-i.mousePct*a))),[p,d,u,m]=this.dropRect=[l,c,l+s,c+a],h=o.position.EastOrWest?[p,r.top,p,r.bottom,u,r.top,u,r.bottom]:[r.left,d,r.right,d,r.left,m,r.right,m];return{l:p,r:u,t:d,b:m,guideLines:h}}getDropRectOutline(t,o){var y,x,w;let{pos:r,clientRect:n}=this,{width:i,height:a,position:s}=r,{width:l,height:c}=(y=o==null?void 0:o.intrinsicSize)!=null?y:{},p=(x=c!=null?c:a)!=null?x:0,d=(w=l!=null?l:i)!=null?w:0;this.dropRect=void 0;let{top:u,left:m,right:h,bottom:g}=n,b=0,f=Math.round(t/2)+b;switch(s){case K.North:case K.Header:{let R=Math.round((g-u)/2),v=p?Math.min(R,Math.round(p)):R;return d&&m+d<h?[m+f,u+f,m+d-f,u+f+v]:[m+f,u+f,h-f,u+f+v]}case K.West:{let R=Math.round((h-m)/2),v=d?Math.min(R,Math.round(d)):R;return p&&u+p<g?[m+f,u+f,m-f+v,u+p+f]:[m+f,u+f,m-f+v,g-f]}case K.East:{let R=Math.round((h-m)/2),v=d?Math.min(R,Math.round(d)):R;return p&&u+p<g?[h-f-v,u+f,h-f,u+p+f]:[h-f-v,u+f,h-f,g-f]}case K.South:{let R=Math.round((g-u)/2),v=p?Math.min(R,Math.round(p)):R;return d&&m+d<h?[m+f,g-f-v,m+d-f,g-f]:[m+f,g-f-v,h-f,g-f]}case K.Centre:return[m+f,u+f,h-f,g-f];default:return console.warn(`DropTarget does not recognize position ${s}`),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:e.getActiveDropTarget(t.nextDropTarget)}};function Kt(e,t,o,r,n,i){var l;let a=null,s=ye.allBoxesContainingPoint(o,r,e,t,i);if(s.length){let[c,...p]=s,{"data-path":d,path:u=d,"data-row-placeholder":m}=D(c),h=r[u],b=Gt(e,t,h,n&&m?"row":void 0),f=r[u],y=([x,...w])=>{var R,v;if((R=b.position)!=null&&R.Header||b.closeToTheEdge){let E=Ma(x,b,f,r,e,t);if(E){let[S,I]=E;return new we({component:x,pos:S,clientRect:I,nextDropTarget:(v=y(w))!=null?v:null})}else if(w.length)return y(w)}};a=new we({component:c,pos:b,clientRect:h,nextDropTarget:(l=y(p))!=null?l:null}).activate()}return a}function Ma(e,{closeToTheEdge:t,position:o},r,n,i,a){if(!e||e.type==="DraggableLayout")return;let s=n[e.props.path],l=t&ue.north,c=t&ue.east,p=t&ue.south,d=t&ue.west,u=(l||o.Header)&&Math.round(r.top)===Math.round(s.top),m=c&&Math.round(r.right)===Math.round(s.right),h=p&&Math.round(r.bottom)===Math.round(s.bottom),g=d&&Math.round(r.left)===Math.round(s.left);if(u||m||h||g){let{"data-path":b,path:f=b}=e.props,y=n[f],x=Gt(i,a,y);if((Ca(e)||lr(e))&&t&Pa)return x.width=120,[x,y];if((Ia(e)||lr(e))&&(o.Header||t&La))return x.height=120,[x,y]}}function lr(e){return M(e)==="Stack"}function Ca(e){return M(e)==="Flexbox"&&e.props.style.flexDirection==="column"}function Ia(e){return M(e)==="Flexbox"&&e.props.style.flexDirection==="row"}import{PopupService as qt}from"@vuu-ui/vuu-popups";import ka from"clsx";import{jsx as cr}from"react/jsx-runtime";function ur(e,t=0,o=0){let{pos:r,clientRect:n}=e,i=20;return r.position.West?[n.left-o+i,r.y-t,"left"]:r.position.South?[r.x-o,n.bottom-t-i,"bottom"]:r.position.East?[n.right-o-i,r.y-t,"right"]:[r.x-o,n.top-t+i,"top"]}var Ut="vuuDropMenu",pr=({className:e,dropTarget:t,onHover:o,orientation:r})=>{let n=t.toArray();return cr("div",{className:ka(Ut,e,`${Ut}-${r}`),onMouseLeave:()=>o(null),children:n.map((i,a)=>cr("div",{className:`${Ut}-item`,"data-icon":a===0?"column-2A":"column-2B",onMouseEnter:()=>o(i)},a))})};import{jsx as Fa}from"react/jsx-runtime";var jt=!1,Ie=null,X=null,Aa=e=>Ie=e,Oa=([e,t])=>`M${e},${t}`,Ha=([e,t])=>`L${e},${t}`,dr=([e,...t])=>`${Oa(e)} ${t.map(Ha)}Z`,za=e=>{if(e){let[t,o,r,n,i,a,s,l]=e;return`M${t},${o} L${r},${n} M${i},${a} L${s},${l}`}else return""};function Ba(){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{partition as Co}from"@vuu-ui/vuu-utils";import qn from"clsx";var Ro={},Eo={},ae={};function H(e){return Ro[e]===!0}function Jn(e){return Eo[e]===!0}var Do=e=>H(e)||Jn(e);function I(e,t,o="component"){ae[e]=t,o==="container"?Ro[e]=!0:o==="view"&&(Eo[e]=!0)}import{Button as So,useControlled as Yn}from"@salt-ds/core";import To from"clsx";import{useCallback as Zn}from"react";import{jsx as Ee,jsxs as jn}from"react/jsx-runtime";var ee="vuuDrawer",Po=e=>typeof e=="string"?e:e+"px",Xn=(e,t,o)=>{let r=t!==void 0,n=o!==void 0;if(!(!e&&!n&&!r))return!n&&!r?e:{...e,"--drawer-size":r?Po(t):void 0,"--drawer-peek-size":n?Po(o):void 0}},Lo=({children:e,className:t,clickToOpen:o,defaultOpen:r,sizeOpen:n,sizeClosed:a,style:i,open:s,position:l="left",inline:c,onClick:u,peekaboo:d=!1,toggleButton:p,...m})=>{let[h,g]=Yn({controlled:s,default:r!=null?r:!1,name:"Drawer",state:"open"});console.log(`Drawer sizeOpen ${n} sizeClosed ${a}`);let y=To(ee,t,`${ee}-${l}`,{[`${ee}-open`]:h,[`${ee}-inline`]:c,[`${ee}-over`]:!c,[`${ee}-peekaboo`]:d}),f=Zn(()=>{g(!h)},[h,g]),x=Xn(i,n,a),R=o?f:u,w=()=>Ee("div",{className:To("vuuToggleButton-container"),children:h?Ee(So,{"aria-label":"close",onClick:f,"data-icon":"close",variant:"secondary"}):Ee(So,{"aria-label":"open",onClick:f,"data-icon":"close",variant:"secondary"})});return jn("div",{...m,className:y,onClick:R,style:x,children:[p=="start"?w():null,Ee("div",{className:`${ee}-liner`,children:Ee("div",{className:`${ee}-content`,children:e})}),p=="end"?w():null]})};Lo.displayName="Drawer";var vt=Lo;import{jsx as ti,jsxs as oi}from"react/jsx-runtime";var Qn=e=>e.type===vt,Kn=({props:{position:e="left"}})=>e.match(/top|bottom/),wt=e=>{let{children:t,className:o,id:r,style:n}=e,a="vuuDockLayout",[i,s]=Co(t,Qn),[l,c]=Co(i,Kn),u=l.length===0?"horizontal":c.length===0?"vertical":"both",d=qn(a,o,`${a}-${u}`);return oi("div",{className:d,id:r,style:n,children:[i,ti("div",{className:`${a}-content`,children:s})]})};wt.displayName="DockLayout";var ei=wt;I("DockLayout",wt,"container");import{forwardRef as ri}from"react";import{jsx as ii}from"react/jsx-runtime";var Rt=ri(function({resizeable:t,...o},r){return ii("div",{...o,className:"Component",ref:r})});Rt.displayName="Component";var ni=Rt;I("Component",Rt);import te,{isValidElement as ko}from"react";var ai={},P=(e,t)=>{var r;let o=D(e);return(r=o[t])!=null?r:o[`data-${t}`]},D=e=>(e==null?void 0:e.props)||e||ai,Mo=e=>{let t=D(e);if(t.children){let{children:[o,...r]}=t;return r.length>0&&console.warn(`getChild expected a single child, found ${r.length+1}`),o}};function T(e){var t;if(e){let o=e.type;if(typeof o=="function"||typeof o=="object"){let r=o.displayName||o.name||((t=o.type)==null?void 0:t.name);if(typeof r=="string")return r}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 cc=(e,t)=>T(e)===t,uc=e=>e!==void 0&&"type"in e;var si=e=>{let t=e.lastIndexOf(".");return t===-1?e:e.slice(0,t)},Ao=e=>te.isValidElement(e.props.children)?[e.props.children]:e.props.children,Et=(e,t="")=>{let[o,...r]=t.split(".");if(o!=null&&o.startsWith("#")){let n=Dt(e,o.slice(1),!0);if(n&&r.length)return Et(n,r.join("."))}else if(o==="ACTIVE_CHILD"){let{active:n}=D(e),a=Ao(e),{path:i}=D(a[n]);return i}return""},li=(e,t="")=>{let[o,...r]=t.split(".");if(o!=null&&o.startsWith("#")){let n=Io(e,o.slice(1),!0);if(n&&r.length)return li(n,r.join("."))}else if(o==="ACTIVE_CHILD"){let{children:n,props:a}=e,{active:i}=a;if(typeof i=="number"&&(n!=null&&n[i]))return n[i]}};function Y(e,t){let{"data-path":o,path:r=o}=D(e);return t==="0"||t===r?null:B(e,si(t),!0)}function Q(e,t){let{children:o,...r}=D(e);if(t(r))return e;if(te.Children.count(o)>0){let n=te.isValidElement(o)?[o]:o;for(let a of n){let i=Q(a,t);if(i)return i}}}function ci(e,t){if(t===e)return null;let{path:o,children:r}=D(e),{idx:n,finalStep:a}=Z(o,P(t,"path"));return a?e:r===void 0||r[n]===void 0?null:ci(r[n],t)}var ui=(e,t)=>{if(te.isValidElement(e)&&t==0)return e;if(Array.isArray(e))return e[t]};function zo(e,t){let o=t.split("."),r=[e];for(let n=0;n<o.length;n++){let a=parseInt(o[n]),i=r[a];if(n===o.length-1)return i;r=Ao(i)}}var Dt=(e,t,o=!0)=>{let{children:r,id:n}=e.props;if(n===t)return e;if(te.Children.count(r)>0){let a=ko(r)?[r]:r;for(let i of a)if(ko(i)){let s=Dt(i,t,!1);if(s)return s}}if(o===!0)throw Error(`pathUtils.findTargetById id #${t} not found in source`)},Io=(e,t,o=!0)=>{let{children:r,id:n}=e;if(n===t)return e;if(Array.isArray(r)&&r.length>0){for(let a of r)if(a!==null&&typeof a=="object"){let i=Io(a,t,!1);if(i)return i}}if(o===!0)throw Error(`pathUtils.findTargetJSONById id #${t} not found in source`)};function B(e,t,o=!1){if(t.startsWith("#"))return Dt(e,t.slice(1),o);let{"data-path":r,path:n=r}=D(e);if(t.indexOf(n)!==0)throw Error(`pathUtils.followPath path ${t} is not within source path ${n}`);let a=t.slice(n.length+1);if(a==="")return e;let i=e,s=a.split(".");for(let l=0;l<s.length;l++){if(te.Children.count(i.props.children)===0){let c=`element at 0.${s.slice(0,l).join(".")} has no children, so cannot fulfill rest of path ${s.slice(l).join(".")}`;if(o)throw Error(c);console.warn(c);return}if(i=ui(i.props.children,parseInt(s[l])),i===void 0){let c=`model at 0.${s.slice(0,l).join(".")} has no children that fulfill next step of path ${s.slice(l).join(".")}`;if(o)throw Error(c);console.warn(c)}}return i}function yc(e,t){let o=Y(e,t),r=t.split(".").map(n=>parseInt(n,10));if(o){let n=r.pop(),{children:a}=o.props;if(a.length-1>n)return Ve(a[n+1]);{let i=r.pop(),s=Y(e,P(o,"path"));if(s&&typeof i=="number"&&(r=s.props.path.split(".").map(l=>parseInt(l,10)),s.props.children.length-1>i)){let l=s.props.children[i+1];return H(T(l))?Ve(l):l}}}return Ve(e)}function bc(e,t){let o=t.split(".").map(a=>parseInt(a,10)),r=o.pop(),n=Y(e,t);if(n!=null&&typeof r=="number"){let{children:a}=n.props;if(r>0)return _e(a[r-1]);for(;o.length>1;)if(r=o.pop(),n=Y(e,P(n,"path")),r>0){let i=n.props.children[r-1];return H(T(i))?_e(i):i}}return _e(e)}function Ve(e){if(H(T(e))){let{children:t}=e.props||e;return Ve(t[0])}return e}function _e(e){if(H(T(e))){let{children:t}=e.props||e;return _e(t[t.length-1])}return e}function Z(e,t,o=!1){if(e===t)return{idx:-1,finalStep:!0};let r=`${e}.`;if(!t.startsWith(r))throw Error("pathUtils nextStep has strayed from the path");let n=o?0:1,a=t.replace(r,"").split(".").map(i=>parseInt(i,10));return{idx:a[0],finalStep:a.length===n}}function O(e,t,o){if(P(e,"path")===t)return e;let r=[];te.Children.forEach(e.props.children,(a,i)=>{P(a,"path")?r.push(O(a,`${t}.${i}`)):r.push(a)});let n=e.props["data-path"]?"data-path":"path";return te.cloneElement(e,{[n]:t,...o},r)}function vc(e,t){typeof e=="function"?e(t):e&&(e.current=t)}var St=e=>{if(typeof e!="number")throw Error(`"no support yet for flex value ${e}`);return{flexBasis:0,flexGrow:1,flexShrink:1}};import{boxContainsPoint as Ge}from"@vuu-ui/vuu-utils";var le={north:1,east:2,south:4,west:8,header:16,centre:32,absolute:64},De={AFTER:"after",BEFORE:"before"},_=Object.freeze({North:se("north"),East:se("east"),South:se("south"),West:se("west"),Header:se("header"),Centre:se("centre"),Absolute:se("absolute")});function se(e){return Object.freeze({offset:e==="north"||e==="west"?0:e==="south"||e==="east"?1:NaN,valueOf:function(){return le[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 Bo=_.North,Oo=_.South,Tt=_.East,Pt=_.West,pi=_.Header,di=_.Centre,he=class{static measure(t,o=[]){let r={};return hi(t,r,o),r}static allBoxesContainingPoint(t,o,r,n,a){return $o(t,o,r,n,a).reverse()}};function Lt(e,t,o,r=30){let n=o.right-o.left,a=o.bottom-o.top,i=e-o.left,s=t-o.top,l=0;return i<r&&(l+=8),i>n-r&&(l+=2),s<r&&(l+=1),s>a-r&&(l+=4),{pctX:i/n,pctY:s/a,closeToTheEdge:l}}function Ct(e,t,o,r){let{BEFORE:n,AFTER:a}=De,{pctX:i,pctY:s,closeToTheEdge:l}=Lt(e,t,o),c,u;if(r==="row")c=i<.5?Pt:Tt;else if(o.header&&Ge(o.header,e,t))if(c=pi,o.Stack){let d=o.Stack.length;if(d===0)u={index:-1,left:o.left,positionRelativeToTab:a,width:0};else{let p=o.Stack.find(({left:m,right:h})=>e>=m&&e<=h);if(p){let m=p.right-p.left;u={index:o.Stack.indexOf(p),left:p.left,positionRelativeToTab:(e-p.left)/m<.5?n:a,width:m}}else u={left:o.Stack[d-1].right,width:0,index:d,positionRelativeToTab:a}}}else if(o.header.titleWidth){let d=o.header.titleWidth;u={index:-1,left:o.left,positionRelativeToTab:(e-o.left)/d<.5?n:a,width:d}}else u={left:o.left,width:0,positionRelativeToTab:n,index:-1};else c=mi(e,t,o,i,s);return{position:c,x:e,y:t,closeToTheEdge:l,tab:u}}function mi(e,t,o,r,n){let a=fi(o,.2);if(Ge(a,e,t))return di;switch(`${n<.5?"north":"south"}${r<.5?"west":"east"}`){case"northwest":return r>n?Bo:Pt;case"northeast":return 1-r>n?Bo:Tt;case"southeast":return r>n?Tt:Oo;case"southwest":return 1-r>n?Pt:Oo;default:}}function fi({right:e,left:t,top:o,bottom:r},n){let a=(1-n)/2,i=(e-t)*a,s=(r-o)*a;return{left:t+i,top:o+s,right:e-i,bottom:r-s}}function hi(e,t,o){let{id:r,"data-path":n,path:a=n}=D(e),i=T(e);if(r&&a){let[s,l]=Ho(e);No(e,s,l,t),H(i)&&Fo(e,t,o)}}function No(e,t,o,r){let{"data-path":n,path:a=n,header:i}=D(e);r[a]=t;let s=T(e);if(i||s==="Stack"){let l=s==="Stack"?".vuuTabstrip":".vuuHeader",c=o.querySelector(l);if(c){let{top:u,left:d,right:p,bottom:m}=c.getBoundingClientRect();if(r[a].header={top:Math.round(u),left:Math.round(d),right:Math.round(p),bottom:Math.round(m)},s==="Stack")r[a].Stack=Array.from(c.querySelectorAll(".vuuTab")).map(h=>h.getBoundingClientRect()).map(({left:h,right:g})=>({left:h,right:g}));else{let h=c.querySelector('[class^="vuuHeader-title"]'),{header:g}=r[a];h&&g&&(g.titleWidth=h.clientWidth)}}}return r[a]}function Fo(e,t,o,r=0,n=0,a=0,i=0){let{children:s,"data-path":l,path:c=l,style:u,active:d=0}=D(e),p=T(e),m=p==="Flexbox",h=p==="Stack",g=m&&u.flexDirection==="column",y=m&&u.flexDirection==="row",x=(h?s.filter((w,E)=>E===d):s.filter(gi)).map(w=>{let[E,b]=Ho(w);return[{...E,top:E.top-a,right:E.right+n,bottom:E.bottom+i,left:E.left-r},b,w]}),R=x.map(([w,E,b],v,S)=>{let C,L,M,z,A,k,G=S.length-1;y?(A=v===0?0:w.left-S[v-1][0].right,k=v===G?0:S[v+1][0].left-w.right,C=v===0||A===0?0:A,L=v===G||k===0?0:k-k/2,w.left-=C,w.right+=L,M=a,z=i):g&&(A=v===0?0:w.top-S[v-1][0].bottom,k=v===G?0:S[v+1][0].top-w.bottom,M=v===0||A===0?0:A,z=v===G||k===0?0:k-k/2,w.top-=M,w.bottom+=z,C=r,L=n);let W=No(b,w,E,t),ne=T(b);return H(ne)&&Fo(b,t,o,C,L,M,z),W});x.length&&(t[c].children=R)}function gi(e){let{id:t}=D(e),o=document.getElementById(t);return o?o.dataset.dragging!=="true":(console.warn(`BoxModel: no element found with id #${t}`),!1)}function Ho(e){let{id:t}=D(e);if(t===void 0)throw Error("`BoxModel.measureComponentElement, component has no id");let o=document.getElementById(t);if(!o)throw Error("BoxModel.measureComponentElement, no DOM element found for component");let{top:r,left:n,right:a,bottom:i,height:s,width:l}=o.getBoundingClientRect(),c,u=T(e);if(H(u)){let d=o.scrollHeight;d>s&&(c={id:t,scrollHeight:d,scrollTop:o.scrollTop})}return[{top:Math.round(r),left:Math.round(n),right:Math.round(a),bottom:Math.round(i),height:Math.round(s),width:Math.round(l),scrolling:c},o,e]}function $o(e,t,o,r,n,a=[]){let{children:i,"data-path":s,path:l=s}=D(e),c=T(e),u=t[l];if(!Ge(u,o,r))return a;if(n&&n.length){if(n.includes(l))a.push(e);else if(!n.some(d=>d.startsWith(l)))return a}else a.push(e);if(!H(c)||u.header&&Ge(u.header,o,r))return a;u.scrolling&&yi(u,o,r);for(let d=0;d<i.length;d++){if(c==="Stack"&&e.props.active!==d)continue;let p=$o(i[d],t,o,r,n);if(p.length)return a.concat(p)}return a}function yi({top:e,bottom:t,scrolling:o},r,n){if(o){let{id:a,scrollTop:i,scrollHeight:s}=o,l=t-e;if(i===0&&t-n<50){let c=s-l;document.getElementById(a).scrollTo({left:0,top:c,behavior:"smooth"}),o.scrollTop=c}else if(i>0&&n-e<50)document.getElementById(a).scrollTo({left:0,top:0,behavior:"smooth"}),o.scrollTop=0;else return!1}else return!1}var bi=.4,We=class{constructor(t,o,r,n,a){this.init(t,o,r,n,a)}init(t,o,r,n,a){let{left:i,top:s}=n,{pctX:l,pctY:c}=Lt(o,r,n),u=bi,d=l*n.width,p=n.width-d,m=c*n.height,h=n.height-m,g=n.width*u,y=n.height*u,f=1-u,x=d*f,R=m*f,w=p*f,E=h*f;this.intrinsicSize=a,this.constraint={zone:{x:{lo:t.left,hi:t.right},y:{lo:t.top,hi:t.bottom}},pos:{x:{lo:t.left-x,hi:t.right-n.width+w},y:{lo:t.top-R,hi:t.bottom-n.height+E}},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:i,lo:!1,hi:!1,mousePos:o,mousePct:l},this.y={pos:s,lo:!1,hi:!1,mousePos:r,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){let r=this[t],n=this.constraint.mouse[t],a=this.constraint.pos[t],i=r.pos,s=o-r.mousePos;return s<0?r.lo||(o<n.lo?(r.lo=!0,r.pos=a.lo):r.hi?o<n.hi&&(r.hi=!1,r.pos+=s):r.pos+=s):s>0&&(r.hi||(o>n.hi?(r.hi=!0,r.pos=a.hi):r.lo?o>n.lo&&(r.lo=!1,r.pos+=s):r.pos+=s)),r.mousePos=o,i!==r.pos}dropXY(t){let o=this[t],r=this.constraint.zone[t];return o.lo?Math.max(r.lo,o.mousePos):o.hi?Math.min(o.mousePos,Math.round(r.hi)-1):o.mousePos}};var Ac=e=>e.pos.tab&&T(e.component)==="Stack"&&e.pos.position.Header,{north:xi,south:vi,east:wi,west:Ri}=le,Ei=wi+Ri,Di=xi+vi,ge=class e{constructor({component:t,pos:o,clientRect:r,nextDropTarget:n}){this.component=t,this.pos=o,this.clientRect=r,this.nextDropTarget=n,this.active=!1,this.dropRect=void 0}targetTabPos(t){let{left:o,width:r,positionRelativeToTab:n}=t;return n===De.BEFORE?o:o+r}getTargetDropOutline(t,o){if(this.pos.tab)return this.getDropTabOutline(t,this.pos.tab);if(o&&o.hasIntrinsicSize())return this.getIntrinsicDropRect(o);{let[r,n,a,i]=this.getDropRectOutline(t,o);return{l:r,t:n,r:a,b:i}}}getDropTabOutline(t,o){var f,x;let{clientRect:{top:r,left:n,right:a,bottom:i,header:s}}=this,l=0,c=Math.round(t/2)+l,u=Math.round(r),d=Math.round(n+c),p=Math.round(a-c),m=Math.round(i-c),h=this.targetTabPos(o),g=60,y=((f=s==null?void 0:s.bottom)!=null?f:0)-((x=s==null?void 0:s.top)!=null?x:0);return{l:d,t:u,r:p,b:m,tabLeft:h,tabWidth:g,tabHeight:y}}getIntrinsicDropRect(t){var g,y,f,x;let{pos:o,clientRect:r}=this,{x:n,y:a}=t,i=(y=(g=t.intrinsicSize)==null?void 0:g.height)!=null?y:0,s=(x=(f=t.intrinsicSize)==null?void 0:f.height)!=null?x:0;i&&i>r.height?(console.log("DropTarget: we're going to blow the gaff"),i=r.height):s&&s>r.width&&(console.log("DropTarget: we're going to blow the gaff"),s=r.width);let l=Math.min(r.right-s,Math.max(r.left,Math.round(o.x-n.mousePct*s))),c=Math.min(r.bottom-i,Math.max(r.top,Math.round(o.y-a.mousePct*i))),[u,d,p,m]=this.dropRect=[l,c,l+s,c+i],h=o.position.EastOrWest?[u,r.top,u,r.bottom,p,r.top,p,r.bottom]:[r.left,d,r.right,d,r.left,m,r.right,m];return{l:u,r:p,t:d,b:m,guideLines:h}}getDropRectOutline(t,o){var x,R,w;let{pos:r,clientRect:n}=this,{width:a,height:i,position:s}=r,{width:l,height:c}=(x=o==null?void 0:o.intrinsicSize)!=null?x:{},u=(R=c!=null?c:i)!=null?R:0,d=(w=l!=null?l:a)!=null?w:0;this.dropRect=void 0;let{top:p,left:m,right:h,bottom:g}=n,y=0,f=Math.round(t/2)+y;switch(s){case _.North:case _.Header:{let E=Math.round((g-p)/2),b=u?Math.min(E,Math.round(u)):E;return d&&m+d<h?[m+f,p+f,m+d-f,p+f+b]:[m+f,p+f,h-f,p+f+b]}case _.West:{let E=Math.round((h-m)/2),b=d?Math.min(E,Math.round(d)):E;return u&&p+u<g?[m+f,p+f,m-f+b,p+u+f]:[m+f,p+f,m-f+b,g-f]}case _.East:{let E=Math.round((h-m)/2),b=d?Math.min(E,Math.round(d)):E;return u&&p+u<g?[h-f-b,p+f,h-f,p+u+f]:[h-f-b,p+f,h-f,g-f]}case _.South:{let E=Math.round((g-p)/2),b=u?Math.min(E,Math.round(u)):E;return d&&m+d<h?[m+f,g-f-b,m+d-f,g-f]:[m+f,g-f-b,h-f,g-f]}case _.Centre:return[m+f,p+f,h-f,g-f];default:return console.warn(`DropTarget does not recognize position ${s}`),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:e.getActiveDropTarget(t.nextDropTarget)}};function Mt(e,t,o,r,n,a){var l;let i=null,s=he.allBoxesContainingPoint(o,r,e,t,a);if(s.length){let[c,...u]=s,{"data-path":d,path:p=d,"data-row-placeholder":m}=D(c),h=r[p],y=Ct(e,t,h,n&&m?"row":void 0),f=r[p],x=([R,...w])=>{var E,b;if((E=y.position)!=null&&E.Header||y.closeToTheEdge){let v=Si(R,y,f,r,e,t);if(v){let[S,C]=v;return new ge({component:R,pos:S,clientRect:C,nextDropTarget:(b=x(w))!=null?b:null})}else if(w.length)return x(w)}};i=new ge({component:c,pos:y,clientRect:h,nextDropTarget:(l=x(u))!=null?l:null}).activate()}return i}function Si(e,{closeToTheEdge:t,position:o},r,n,a,i){if(!e||e.type==="DraggableLayout")return;let s=n[e.props.path],l=t&le.north,c=t&le.east,u=t&le.south,d=t&le.west,p=(l||o.Header)&&Math.round(r.top)===Math.round(s.top),m=c&&Math.round(r.right)===Math.round(s.right),h=u&&Math.round(r.bottom)===Math.round(s.bottom),g=d&&Math.round(r.left)===Math.round(s.left);if(p||m||h||g){let{"data-path":y,path:f=y}=e.props,x=n[f],R=Ct(a,i,x);if((Ti(e)||Vo(e))&&t&Ei)return R.width=120,[R,x];if((Pi(e)||Vo(e))&&(o.Header||t&Di))return R.height=120,[R,x]}}function Vo(e){return T(e)==="Stack"}function Ti(e){return T(e)==="Flexbox"&&e.props.style.flexDirection==="column"}function Pi(e){return T(e)==="Flexbox"&&e.props.style.flexDirection==="row"}import{PopupService as At}from"@vuu-ui/vuu-popups";import Li from"clsx";import{jsx as _o}from"react/jsx-runtime";function Go(e,t=0,o=0){let{pos:r,clientRect:n}=e,a=20;return r.position.West?[n.left-o+a,r.y-t,"left"]:r.position.South?[r.x-o,n.bottom-t-a,"bottom"]:r.position.East?[n.right-o-a,r.y-t,"right"]:[r.x-o,n.top-t+a,"top"]}var kt="vuuDropMenu",Wo=({className:e,dropTarget:t,onHover:o,orientation:r})=>{let n=t.toArray();return _o("div",{className:Li(kt,e,`${kt}-${r}`),onMouseLeave:()=>o(null),children:n.map((a,i)=>_o("div",{className:`${kt}-item`,"data-icon":i===0?"column-2A":"column-2B",onMouseEnter:()=>o(a)},i))})};import{jsx as Bi}from"react/jsx-runtime";var zt=!1,Se=null,X=null,Ci=e=>Se=e,Mi=([e,t])=>`M${e},${t}`,ki=([e,t])=>`L${e},${t}`,Uo=([e,...t])=>`${Mi(e)} ${t.map(ki)}Z`,Ai=e=>{if(e){let[t,o,r,n,a,i,s,l]=e;return`M${t},${o} L${r},${n} M${a},${i} L${s},${l}`}else return""};function zi(){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{partition as Yo}from"@vuu-ui/vuu-utils";import Qi from"clsx";var Vo={},_o
|
|
|
14
14
|
/>
|
|
15
15
|
</path>
|
|
16
16
|
</svg>
|
|
17
|
-
`,document.body.insertBefore(t,e)}}var ke=class{constructor(){this.currentPath=null;this.tabMode=null;Ba()}prepare(t,o="full-view"){document.body.classList.add("drawing"),this.currentPath=null,this.tabMode=o;let r=this.getPoints(0,0,0,0),n=dr(r),i=document.getElementById("vuu-drop-outline");i==null||i.setAttribute("d",n),this.currentPath=n}clear(){Ie=null,ot(),document.body.classList.remove("drawing"),qt.hidePopup()}get hoverDropTarget(){return Ie}getPoints(t,o,r,n,i=0,a=0,s=0){let l=this.tabMode==="tab-only";if(a===0)return[[t,o+s],[t,o+s],[t,o],[t+a,o],[t+a,o],[t+r,o],[t+r,o+n],[t,o+n]];if(l){let c=i;return[[c,o],[c,o],[c+a,o],[c+a,o],[c+a,o+s],[c+a,o+s],[c,o+s],[c,o+s]]}else return i===0?[[t,o+s],[t,o+s],[t,o],[t+a,o],[t+a,o+s],[t+r,o+s],[t+r,o+n],[t,o+n]]:[[t,o+s],[t+i,o+s],[t+i,o],[t+i,o],[t+i,o+s],[t+r,o+s],[t+r,o+n],[t,o+n]]}draw(t,o){let n=jt;if(Ie!==null)this.drawTarget(Ie);else if(jt=t.nextDropTarget!=null,t.pos.tab?Na(t):X&&ot(),this.drawTarget(t,o),jt){let[i,a,s]=ur(t);{let l=Fa(pr,{dropTarget:t,onHover:Aa,orientation:s});qt.showPopup({left:i,top:a,component:l})}}else qt.hidePopup()}drawTarget(t,o){let n=t.getTargetDropOutline(6,o);if(n){let{l:i,t:a,r:s,b:l,tabLeft:c,tabWidth:p,tabHeight:d,guideLines:u}=n,m=s-i,h=l-a;if(this.currentPath){let x=document.getElementById("vuu-drop-outline");x==null||x.setAttribute("d",this.currentPath)}let g=this.getPoints(i,a,m,h,c,p,d),b=dr(g),f=document.getElementById("hw-drop-outline-animate");f==null||f.setAttribute("to",b),f==null||f.beginElement(),this.currentPath=b;let y=document.getElementById("hw-drop-guides");y==null||y.setAttribute("d",za(u))}}},mr="transition:margin-left .4s ease-out;margin-left: 63px",fr="transition:margin-left .4s ease-out;margin-left: 0px";function Na(e){var s,l;let{AFTER:t,BEFORE:o}=Ce,{clientRect:{Stack:r},pos:{tab:n}}=e,{id:i}=e.component.props,a=null;if(r&&n&&n.positionRelativeToTab!==t){let c=n.positionRelativeToTab===o?1:2,p=`:scope .hwTabstrip > .hwTabstrip-inner > .hwTab:nth-child(${n.index+c})`;a=(s=document.getElementById(i))==null?void 0:s.querySelector(p),a?(X===null||X!==a)&&(a.style.cssText=mr,X&&(X.style.cssText=fr),X=a):ot()}else if((n==null?void 0:n.positionRelativeToTab)===o){if(X===null){let c=".vuuHeader-title";a=(l=document.getElementById(i))==null?void 0:l.querySelector(c),a.style.cssText=mr,X=a}}else ot()}function ot(){X&&(X.style.cssText=fr,X=null)}var oe,Ae,ie,gr,br,pe,rt,de=null,Zt,vr,it,yr,Yt,nt=null,$a=3,at=new ke,hr=.4;function Wa(e,t){return t?B(e,t):te(e,o=>o.dropTarget)}var Xt={handleMousedown(e,t,o={}){oe=t,vr=o,gr=e.clientX,br=e.clientY,Yt=o.dragThreshold===void 0?$a:o.dragThreshold,Yt===0?oe(e,0,0):(window.addEventListener("mousemove",st,!1),window.addEventListener("mouseup",lt,!1),nt=window.setTimeout(()=>{window.removeEventListener("mousemove",st,!1),window.removeEventListener("mouseup",lt,!1),oe==null||oe(e,0,0)},500)),e.preventDefault()},initDrag(e,t,{top:o,left:r,right:n,bottom:i},a,s,l,c){return{drag:Ae,drop:ie}=s,Va(e,t,{top:o,left:r,right:n,bottom:i},a,l,c)}};function st(e){let r=e.clientX-gr,n=e.clientY-br;Math.max(Math.abs(r),Math.abs(n))>Yt&&(window.removeEventListener("mousemove",st,!1),window.removeEventListener("mouseup",lt,!1),oe==null||oe(e,r,n),oe=null)}function lt(){nt&&(window.clearTimeout(nt),nt=null),window.removeEventListener("mousemove",st,!1),window.removeEventListener("mouseup",lt,!1)}function Va(e,t,o,r,n,i){pe=Wa(e,t);let{"data-path":a,path:s=a}=D(pe);i&&(Zt=i.map(u=>te(e,m=>m.id===u)).map(u=>u.props.path)),it=ye.measure(pe,i);let l=it[s];rt=new tt(l,r.x,r.y,o,n);let c=Math.round(rt.x.mousePct*100),p=Math.round(rt.y.mousePct*100);return window.addEventListener("mousemove",wr,!1),window.addEventListener("mouseup",Er,!1),window.addEventListener("keydown",xr,!1),yr=!1,at.prepare(o,"tab-only"),vr.DoNotTransform?"transform:none":`transform:scale(${hr},${hr});transform-origin:${c}% ${p}%;`}function wr(e){let t=e.clientX,o=e.clientY,r=rt,n=de,i,a,s;r.update("x",t)&&(a=r.x.pos),r.update("y",o)&&(s=r.y.pos),a===void 0&&s===void 0||Ae==null||Ae(a,s),!(yr||pe===void 0)&&(r.inBounds()?i=Kt(t,o,pe,it,r.hasIntrinsicSize(),Zt):i=Kt(r.dropX(),r.dropY(),pe,it),n&&(i==null||i.box!==n.box)&&(de=null),i&&(at.draw(i,r),de=i))}function xr(e){e.key==="Escape"&&(de=null,Rr())}function Er(){Rr()}function Rr(){if(de){let e=at.hoverDropTarget||we.getActiveDropTarget(de);ie==null||ie(e),de=null}else ie==null||ie();Ae=null,ie=null,pe=void 0,at.clear(),Zt=void 0,window.removeEventListener("mousemove",wr,!1),window.removeEventListener("mouseup",Er,!1),window.removeEventListener("keydown",xr,!1)}import _a from"clsx";import{forwardRef as Ga}from"react";import{jsx as Ka}from"react/jsx-runtime";var Tr=Ga(function({children:t,className:o,dropTarget:r,resizeable:n,...i},a){let s=_a("DraggableLayout",o);return Ka("div",{className:s,ref:a,...i,children:t})}),Sr="DraggableLayout";Tr.displayName=Sr;z(Sr,Tr,"container");import{useForkRef as Wl}from"@salt-ds/core";import Vl from"clsx";import{forwardRef as _l}from"react";import{getUniqueId as Ol}from"@vuu-ui/vuu-utils";import Ue,{useCallback as Tt,useMemo as Wn,useRef as St,useState as Hl}from"react";import xl from"clsx";import{Button as bl}from"@salt-ds/core";import{useMemo as vl,useState as yl}from"react";import{useCallback as $e,useState as $s}from"react";import{useCallback as co,useContext as uo,useEffect as zs,useRef as ln,useState as Bs}from"react";import{uuid as Dr}from"@vuu-ui/vuu-utils";import Pr from"react";var Ua={"data-placeholder":!0,"data-resizeable":!0},ct={},ae="auto",Jt={flexBasis:0,flexGrow:1,flexShrink:1,height:ae,width:ae},Lr={height:"width",width:"height"},Mr=(e="row")=>e==="row"?["width","height","column"]:["height","width","row"],qa=e=>typeof e=="string"&&e.endsWith("%"),U=e=>{let{style:{width:t=ae,height:o=ae}=ct}=e.props,r=typeof o=="number",n=typeof t=="number";return r&&n?{height:o,width:t}:r?{height:o}:n?{width:t}:void 0};function Qt(e,t,o){let r=Lr[t],{style:{[r]:n=ae,...i}=ct}=e.props;return o&&o[t]?{...i,...Jt,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...i,...Jt,[r]:n}}function Cr(e){let{style:{flex:t,flexGrow:o,flexShrink:r,flexBasis:n}=ct}=e.props;return typeof t=="number"||n===0&&o===1&&r===1?!0:typeof n!="number"}function eo(e,t,o){let r=Lr[t],{style:{[t]:n=ae,[r]:i=ae,...a}=ct}=e.props;return n!==ae?qa(n)?{flexBasis:0,flexGrow:1,flexShrink:1,[t]:void 0,[r]:i}:{flexBasis:n,flexGrow:0,flexShrink:0,[t]:n,[r]:i}:o&&o[t]?{...a,...Jt,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...a,[r]:i}}function Oe(e,t,o,r,n){let i=[],a=0,s;if(r&&n){let p,[d,u,m,h]=n;[p,s]=t==="column"?[u-r.top,r.bottom-h]:[d-r.left,r.right-m],p&&i.push(J(`${o}.${a++}`,p,{flexGrow:0,flexShrink:0}))}else s=!0;let{version:l=0,style:c}=D(e);return i.push(N(e,`${o}.${a++}`,{version:l+1,style:{...c,flexBasis:"auto",flexGrow:0,flexShrink:0}})),s&&i.push(J(`${o}.${a++}`,0,void 0,{[`data-${t}-placeholder`]:!0})),to(t,{resizeable:!1,style:{flexBasis:"auto"}},i,o)}var ja=(e,t)=>{if(!t)return e===0?1:0};function to(e,t,o,r){let n=Dr(),{flexFill:i,style:a,resizeable:s=!0}=t,{flexBasis:l=i?void 0:"auto"}=a,c=ja(l,i);return Pr.createElement(le.Flexbox,{id:n,key:n,path:r,flexFill:i,style:{...a,flexDirection:e,flexBasis:l,flexGrow:c,flexShrink:c},resizeable:s},o)}var Ya={flexGrow:1,flexShrink:1};function J(e,t,o,r){let n=Dr();return Pr.createElement("div",{...Ua,...r,"data-path":e,id:n,key:n,style:{...Ya,...o,flexBasis:t}})}import so from"react";import{uuid as Fr}from"@vuu-ui/vuu-utils";import Be from"react";import{uuid as Or}from"@vuu-ui/vuu-utils";import He,{cloneElement as Za}from"react";import{useCallback as xe}from"react";var V=new Map,q=new Map,Ir=e=>V.get(e),kr=e=>V.has(e),Ar=(e,t)=>V.set(e,t),Ee=()=>{let e=xe((a,s)=>{let l=q.get(a);if(l)return s!==void 0&&l[s]!==void 0?l[s]:s!==void 0?void 0:l},[]),t=xe((a,s,l)=>{if(s===void 0)q.set(a,l);else if(q.has(a)){let c=q.get(a);q.set(a,{...c,[s]:l})}else q.set(a,{[s]:l})},[]),o=xe((a,s)=>{if(q.has(a)){if(s===void 0)q.delete(a);else if(q.get(a)[s]){let{[s]:c,...p}=q.get(a);Object.keys(p).length>0?q.set(a,p):q.delete(a)}}},[]),r=xe((a,s)=>{let l=V.get(a);if(l)return s!==void 0?l[s]:l},[]),n=xe((a,s,l)=>{if(s===void 0)V.set(a,l);else if(V.has(a)){let c=V.get(a);V.set(a,{...c,[s]:l})}else V.set(a,{[s]:l})},[]),i=xe((a,s)=>{if(V.has(a)){if(s===void 0)V.delete(a);else if(V.get(a)[s]){let{[s]:c,...p}=V.get(a);Object.keys(p).length>0?V.set(a,p):V.delete(a)}}},[]);return{loadSessionState:e,loadState:r,saveSessionState:t,saveState:n,purgeState:i,purgeSessionState:o}};var Hr=e=>e.flexDirection==="column"?["height","width"]:["width","height"],Xa={},ze=(e,t="0")=>{let[o,r]=ut(M(e),e.props,t);return He.cloneElement(e,o,r)},ro=(e,t)=>{let o=M(e),[r,n]=ut(o,e.props,"0",void 0,t);return Za(e,r,n)},em=(e,t,o)=>{let[r,n]=ut(e,t,"0",void 0,o);return{...t,...r,type:e,children:n}};function Ja(e,t,o="0",r=null,n){var g,b;let{active:i=0,"data-path":a,path:s=a,id:l,style:c}=D(n),p=M(n)===e&&o===s,d=p?l:(g=t.id)!=null?g:Or(),u=e==="Stack"?(b=t.active)!=null?b:i:void 0,m=d,h=p?c:es(e,t,r);return Go(e)?{id:d,key:m,path:o,style:h,type:e,active:u}:{id:d,key:m,style:h,"data-path":o}}function ut(e,t,o,r=null,n){var c,p;let i=Ja(e,t,o,r,n);if(t.layout&&!n)return[i,[me(t.layout,`${o}.0`)]];let a=(p=n==null?void 0:n.children)!=null?p:(c=n==null?void 0:n.props)==null?void 0:c.children,l=t.dropTarget&&a?a:Qa(e,t.children,o,a);return[i,l]}function Qa(e,t,o="0",r){let n=Array.isArray(t)?t:He.isValidElement(t)?[t]:[];return W(e)?n.map((i,a)=>{let s=M(i),l=M(r==null?void 0:r[a]);if(!l||s===l){let[c,p]=ut(s,i.props,`${o}.${a}`,e,r==null?void 0:r[a]);return He.cloneElement(i,c,p)}return r==null?void 0:r[a]}):t}var es=(e,t,o)=>{let{style:r=Xa}=t;if(e==="Flexbox"&&(r={flexDirection:t.column?"column":"row",...r,display:"flex"}),r.flex){let{flex:n,...i}=r;r={...i,...$t(typeof n=="number"?n:0)}}else o==="Stack"?r={...r,...$t(1)}:o==="Flexbox"&&(r.width||r.height)&&r.flexBasis===void 0&&(r={...r,flexBasis:"auto",flexGrow:0,flexShrink:0});return r};function me({id:e=Or(),type:t,children:o,props:r,state:n},i){let a=t.match(/^[a-z]/)?t:le[t];if(a===void 0)throw Error(`layoutUtils unable to create component from JSON, unknown type ${t}`);return n&&Ar(e,n),He.createElement(a,{id:e,...r,key:e,path:i},o?o.map((s,l)=>me(s,`${i}.${l}`)):void 0)}function zr(e){return Br(e)}function Br(e){let t=M(e),{id:o,children:r,type:n,...i}=D(e),a=kr(o)?Ir(o):void 0;return{id:o,type:t,props:ts(i),state:a,children:He.Children.map(r,Br)}}function ts(e){if(e){let{path:t,...o}=e,r={};for(let[n,i]of Object.entries(o))r[n]=oo(i);return r}}function oo(e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(oo);if(typeof e=="object"&&e!==null){let t={};for(let[o,r]of Object.entries(e))t[o]=oo(r);return t}}var Nr=(e,t,o)=>{if(t&&o){let r=Y(o,t);if(r){let{id:n}=D(r),i=M(r);return{parentContainerId:n,parentContainerType:i}}return{parentContainerType:"Stack",parentContainerId:"blah"}}},Re=(e,t,o=[])=>{var n,i,a;let r=(a=(n=e.props)==null?void 0:n.title)!=null?a:(i=e.props)==null?void 0:i["data-tab-title"];if(r)return r;{let s=t;do r=`Tab ${++s}`;while(o.includes(r));return r}};function $r(e,t){var a;let o=e.props.children,r=o.length,{index:n=-1,positionRelativeToTab:i="after"}=t.tab||{};return n===-1||n>=r?[o[r-1],"after"]:[(a=o[n])!=null?a:null,i]}function pt(e,t,o){let{active:r,children:n=[],path:i}=D(e),a=C(t,"path"),{idx:s,finalStep:l}=Z(i,a,!0),[c,p]=l?ns(e,n,o):[r,n==null?void 0:n.map((u,m)=>m===s?pt(u,t,o):u)],d=M(e)==="Stack"?Array.isArray(c)?c[0]:c:r;return Be.cloneElement(e,{active:d},p)}var os=(e,t,o,r)=>e==="Stack"?Re(t,o,r):void 0,rs=e=>e.map(t=>t.props.title);function ns(e,t,o){let r=C(e,"path"),n=t==null?void 0:t.length,{id:i=Fr(),title:a=os(M(e),o,n!=null?n:0,rs(t))}=D(o);return n?[n,t.concat(N(o,`${r}.${n}`,{id:i,key:i,title:a}))]:[0,[N(o,`${r}.0`,{id:i,title:a})]]}function dt(e,t,o,r,n,i,a){let{active:s,children:l,path:c}=D(e),p=C(t,"path"),{idx:d,finalStep:u}=Z(c,p),[m,h]=u?is(e,l,d,o,r,n,i,a):[s,l.map((b,f)=>f===d?dt(b,t,o,r,n,i,a):b)],g=M(e)==="Stack"?m:s;return Be.cloneElement(e,{active:g},h)}function is(e,t,o,r,n,i,a,s){let l=U(r);return l!=null&&l.width&&(l!=null&&l.height)?ss(e,t,o,r,n,a,s):Wr(e,t,o,r,n,(i==null?void 0:i.width)||(i==null?void 0:i.height),a)}var as=(e,t,{top:o,right:r,bottom:n,left:i},[a,s,l,c])=>{if(e==="column"&&t==="before")return s-o;if(e==="column")return n-c;if(e==="row"&&t==="before")return a-i;if(e==="row")return r-l};function ss(e,t,o,r,n,i,a){let{style:{flexDirection:s}}=D(e),[l,c,p]=Mr(s),{[c]:d,[l]:u}=U(r),m=C(t[o],"path"),h=as(s,n,i,a),[g,b]=d<i[c]?[Oe(r,p,m,i,a),u]:[r,void 0],f=h?J(m,h,{flexGrow:0,flexShrink:0}):void 0;return d>i[c]&&(t=t.map(y=>{if(C(y,"placeholder"))return y;{let{[c]:x}=U(y);return x&&x<d?Oe(y,p,C(y,"path")):y}})),Wr(e,t,o,g,n,b,i,f)}function Wr(e,t,o,r,n,i,a,s){let l=C(e,"path"),c=0,p=!t||t.length===0?[r]:t.reduce((d,u,m)=>{if(o===m){let[h,g]=ls(e,u,r,a);n==="before"?s?d.push(s,g,h):d.push(g,h):s?d.push(h,g,s):d.push(h,g),c=d.indexOf(g)}else d.push(u);return d},[]).map((d,u)=>u<c?d:N(d,`${l}.${u}`));return[c,p]}function ls(e,t,o,r){let n=Fr(),{version:i=0}=D(o);if(i+=1,M(e)==="Flexbox"){let[a]=Hr(e.props.style),s=6,l={[a]:(r[a]-s)/2},c=eo(t,a,l),p=eo(o,a,l);return[Be.cloneElement(t,{style:c}),Be.cloneElement(o,{id:n,version:i,style:p})]}else{let{style:{left:a,top:s,flex:l,...c}={left:void 0,top:void 0,flex:void 0}}=D(o);return[t,Be.cloneElement(o,{id:n,version:i,style:{...c,flex:"1 1 0px"}})]}}import{cloneElement as ps}from"react";import mt from"react";var Te={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",LAYOUT_RESIZE:"layout-resize",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"};function Vr(e,{target:t,replacement:o}){return no(e,t,o)}function no(e,t,o){let r=C(t,"path"),n=C(t,"resizeable"),{style:i}=D(t),a=ze(mt.cloneElement(o,{resizeable:n,style:{...i,...o.props.style}}),r);return _(e,t,a)}function _(e,t,o,r){if(e===t)return o;let{idx:n,finalStep:i}=Z(C(e,"path"),C(t,"path")),a=e.props.children.slice();return i?r?r===Te.MINIMIZE?a[n]=cs(e,a[n]):r===Te.RESTORE&&(a[n]=us(a[n])):a[n]=o:a[n]=_(a[n],t,o,r),mt.cloneElement(e,void 0,a)}function cs(e,t){let{style:o}=D(e),{style:r}=D(t),{width:n,height:i,flexBasis:a,flexShrink:s,flexGrow:l,...c}=r,p={width:n,height:i,flexBasis:a,flexShrink:s,flexGrow:l},d={...c,flexBasis:0,flexGrow:0,flexShrink:0},u=o.flexDirection==="row"?"vertical":o.flexDirection==="column"?"horizontal":!1;return u?mt.cloneElement(t,{collapsed:u,restoreStyle:p,style:d}):t}function us(e){let{style:t,restoreStyle:o}=D(e),{flexBasis:r,flexShrink:n,flexGrow:i,...a}=t,s={...a,...o};return mt.cloneElement(e,{collapsed:!1,style:s,restoreStyle:void 0})}function _r(e,{fromIndex:t,path:o,toIndex:r}){let n=B(e,o,!0),{children:i}=D(n),a=ds(i,t,r),s=ps(n,void 0,a);return _(e,n,s)}function ds(e,t,o){let r=e.slice(),[n]=r.splice(t,1);return o===-1?r.concat(n):(r.splice(o,0,n),r)}var F={ADD:"add",DRAG_START:"drag-start",DRAG_DROP:"drag-drop",LAYOUT_RESIZE:"layout-resize",MAXIMIZE:"maximize",MINIMIZE:"minimize",MOVE_CHILD:"move-child",QUERY:"query",REMOVE:"remove",REPLACE:"replace",RESTORE:"restore",SAVE:"save",SET_PROP:"set-prop",SET_PROPS:"set-props",SET_TITLE:"set-title",SPLITTER_RESIZE:"splitter-resize",SWITCH_TAB:"switch-tab",TEAROUT:"tearout"},Sm=e=>["switch-active-layout","open-layout","close-layout","rename-layout"].includes(e),Dm=e=>["switch-active-tab","edit-feature-title","save-feature-props","remove-component","resize-component","drag-drop-operation"].includes(e);import fe from"react";function io(e,{path:t}){let o=B(e,t),r=Y(e,t);if(r===null)return e;let{children:n}=D(r);if(n.length>1&&M(r)!=="Stack"&&Kr(n,t)){let{style:{flexBasis:i,display:a,flexDirection:s,...l}}=D(r),c=C(r,"path"),p=_(e,r,J(c,i,l));for(;(r=Y(p,c))&&C(r,"path")!=="0";){let{children:d}=D(r);if(Kr(d)){c=C(r,"path");let{style:{flexBasis:u,display:m,flexDirection:h,...g}}=D(r);p=_(e,r,J(c,u,g))}else if(gs(d))p=jr(e,r);else break}return p}return Ur(e,o)}function Ur(e,t){let o=D(e),{children:r,path:n,preserve:i}=o,{active:a,id:s}=o,{idx:l,finalStep:c}=Z(n,C(t,"path")),p=M(e),d=r.slice();if(c){if(d.splice(l,1),a!==void 0&&a>=l&&(a=Math.max(0,a-1)),d.length===0&&i&&p==="Stack"){let{path:u,style:{flexBasis:m}}=D(t),h=s==="main-tabs"?me({props:{style:{flexGrow:1,flexShrink:1,flexBasis:m},title:"Tab 1"},type:"Placeholder"},u):J(u,m);d.push(h)}else if(d.length===1&&!i&&n!=="0"&&p.match(/Flexbox|Stack/))return ms(e,d[0]);!d.some(fs)&&d.some(qr)&&(d=hs(d))}else d[l]=Ur(d[l],t);return d=d.map((u,m)=>N(u,`${n}.${m}`)),fe.cloneElement(e,{active:a},d)}function ms(e,t){let o=M(e),{path:r,style:{flexBasis:n,flexGrow:i,flexShrink:a,width:s,height:l}}=D(e),c=N(t,r);if(r==="0")c=fe.cloneElement(c,{style:{...t.props.style,width:s,height:l}});else if(o==="Flexbox"){let p=e.props.style.flexDirection==="column"?"height":"width",{style:{[p]:d,...u}}=c.props;c=fe.cloneElement(c,{flexFill:void 0,style:{...u,flexGrow:i,flexShrink:a,flexBasis:n,width:s,height:l}})}return c}var fs=e=>e.props.style.flexGrow>0,qr=e=>{let{width:t,height:o,flexGrow:r}=e.props.style;return r===0&&typeof t!="number"&&typeof o!="number"},hs=e=>e.map(t=>qr(t)?fe.cloneElement(t,{style:{...t.props.style,flexGrow:1}}):t),gs=e=>{if(e&&e.length>0){let t=C(e[0],"placeholder"),o=!1;for(let r=1;r<e.length;r++){if(o=C(e[r],"placeholder"),t&&o)return!0;t=o}}},jr=(e,t)=>{let{children:o,path:r}=D(e),{idx:n,finalStep:i}=Z(r,C(t,"path")),a=o.slice();return i?a[n]=bs(t):a[n]=jr(a[n],t),a=a.map((s,l)=>N(s,`${r}.${l}`)),fe.cloneElement(e,void 0,a)},bs=e=>{let{children:t}=D(e),o=[],r=[];for(let i=0;i<t.length;i++)C(t[i],"placeholder")?r.push(t[i]):(r.length===1?o.push(r.pop()):r.length>0&&(o.push(Gr(r)),r.length=0),o.push(t[i]));r.length===1?o.push(r.pop()):r.length>0&&o.push(Gr(r));let n=C(e,"path");return fe.cloneElement(e,void 0,o.map((i,a)=>N(i,`${n}.${a}`)))},Gr=([e,...t])=>{let o=C(e,"style"),{flexBasis:r,flexGrow:n,flexShrink:i}=o;for(let{props:{style:a}}of t)r+=a.flexBasis,n=Math.max(n,a.flexGrow),i=Math.max(i,a.flexShrink);return fe.cloneElement(e,{style:{...o,flexBasis:r,flexGrow:n,flexShrink:i}})},Kr=(e,t)=>e.every(o=>C(o,"placeholder")||t&&C(o,"path")===t);import ao from"react";function Yr(e,{path:t,size:o}){let r=B(e,t,!0),{style:n}=D(r),i={...n,width:o},a=ao.cloneElement(r,{style:i});return _(e,r,a)}function Zr(e,{path:t,sizes:o}){let r=B(e,t,!0),{children:n,style:i}=D(r),a=i.flexDirection==="column"?"height":"width",s=vs(n,o,a),l=ao.cloneElement(r,void 0,s);return _(e,r,l)}function vs(e,t,o){return e.map((r,n)=>{let{style:{[o]:i,flexBasis:a}}=D(r),s=t[n],{currentSize:l,flexBasis:c}=s,d=l!==void 0?s.currentSize:c;return d===void 0||i===d||a===d?r:ao.cloneElement(r,{style:ys(r.props.style,o,d)})})}function ys(e,t,o){let r=typeof e[t]=="number",{flexShrink:n=1,flexGrow:i=1}=e;return{...e,[t]:r?o:"auto",flexBasis:r?"auto":o,flexShrink:n,flexGrow:i}}import{uuid as ws}from"@vuu-ui/vuu-utils";import ft from"react";var Xr=e=>{let[t]=M(e);return t===t.toLowerCase()};function Ne(e,t,o,r,n,i){let{children:a,path:s}=D(e),l=C(t,"path"),{idx:c,finalStep:p}=Z(s,l),d=p?xs(e,a,t,o,r,n,i):a.map((u,m)=>m===c?Ne(u,t,o,r,n,i):u);return ft.cloneElement(e,void 0,d)}function xs(e,t,o,r,n,i,a){let s=U(r);if(s!=null&&s.width&&(s!=null&&s.height)){if(i===void 0||a===void 0)throw Error("wrap-layout-element, updateChildren clientRect and dropRect must both be available");return Rs(t,o,r,n,i,a)}return Es(e,t,o,r,n)}function Es(e,t,o,r,n){var E;let{version:i=0}=D(r),{path:a,title:s}=D(o),{type:l,flexDirection:c,showTabs:p}=Qr(n),[d,u,m]=Ts(l,o,r,c,n),h=Jr(n),g=h?1:0,b={resizeable:!0,style:m,version:i+1},y={[Xr(o)?"data-resizeable":"resizeable"]:!0,style:u},x=l==="Stack"?{showTabs:p}:void 0,w=l==="Flexbox"?{splitterSize:(E=M(e)==="Flexbox"&&e.props.splitterSize)!=null?E:void 0}:void 0,R=ws(),v=ft.createElement(le[l],{active:g,id:R,key:R,path:C(o,"path"),flexFill:C(o,"flexFill"),...w,...x,style:d,title:s,resizeable:C(o,"resizeable")},h?[N(o,`${a}.0`,y),ze(ft.cloneElement(r,b),`${a}.1`)]:[ze(ft.cloneElement(r,b),`${a}.0`),N(o,`${a}.1`,y)]);return t.map(S=>S===o?v:S)}function Rs(e,t,o,r,n,i){let{flexDirection:a}=Qr(r),s=a==="column"?"row":"column",l=Jr(r),[c,p,d,u]=i,[m,h]=a==="column"?[p-n.top,n.bottom-u]:[c-n.left,n.right-d],g=C(t,"path"),b=0,f=Xr(t)?"data-resizeable":"resizeable",y=[];m&&y.push(l?N(t,`${g}.${b++}`,{[f]:!0,style:{flexBasis:m,flexGrow:1,flexShrink:1}}):J(`${g}.${b++}`,m,{flexGrow:0,flexShrink:0})),y.push(Oe(o,s,`${g}.${b++}`,n,i)),h&&y.push(l?J(`${g}.${b++}`,0):N(t,`${g}.${b++}`,{[f]:!0,style:{flexBasis:0,flexGrow:1,flexShrink:1}}));let x=to(a,t.props,y,g);return e.map(w=>w===t?x:w)}function Ts(e,t,o,r,n){let i={...t.props.style,flexDirection:r},a=e==="Flexbox"&&r==="column"?"height":"width",s=Qt(o,a,n),l=Qt(t,a);return[i,l,s]}var Jr=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 Qr(e){return e.position.Header?{type:"Stack",flexDirection:"column",showTabs:!0}:{type:"Flexbox",flexDirection:e.position.EastOrWest?"row":"column"}}var nn=(e,t)=>{switch(t.type){case F.ADD:return Ms(e,t);case F.DRAG_DROP:return Ls(e,t);case F.MAXIMIZE:return Ps(e,t);case F.REMOVE:return io(e,t);case F.REPLACE:return Vr(e,t);case F.SET_PROP:return en(e,t);case F.SET_PROPS:return Ds(e,t);case F.SET_TITLE:return en(e,{type:"set-prop",path:t.path,propName:"title",propValue:t.title});case F.SPLITTER_RESIZE:return Zr(e,t);case F.LAYOUT_RESIZE:return Yr(e,t);case F.SWITCH_TAB:return Ss(e,t);case F.MOVE_CHILD:return _r(e,t);default:return e}},Ss=(e,{path:t,nextIdx:o})=>{let r=B(e,t,!0),n=so.cloneElement(r,{active:o});return _(e,r,n)},en=(e,{path:t,propName:o,propValue:r})=>{let n=B(e,t,!0),i=so.cloneElement(n,{[o]:r});return _(e,n,i)},Ds=(e,{path:t,props:o})=>{let r=B(e,t,!0),n=so.cloneElement(r,o);return _(e,r,n)},Ps=(e,{path:t,type:o})=>{if(t){let r=B(e,t,!0);return _(e,r,r,o)}else return e},Ls=(e,t)=>{var h,g;let{draggedReactElement:o,dragInstructions:r,dropTarget:n}=t,i=n.component,{pos:a}=n,s=((h=a==null?void 0:a.position)==null?void 0:h.Header)&&M(i)==="Stack",{id:l,version:c}=D(o),p=U(o),d;if(s){let[b,f]=$r(i,a);b===void 0?d=pt(e,i,o):d=dt(e,b,o,f)}else!p&&((g=a==null?void 0:a.position)!=null&&g.Centre)?d=no(e,i,o):d=Cs(e,n,o);if(r.DoNotRemove)return d;let u=te(d,b=>b.id===l&&b.version===c),m=C(u,"path");return io(d,{path:m,type:"remove"})},Ms=(e,{path:t,component:o})=>pt(e,B(e,t),o),Cs=(e,t,o)=>{let{component:r,pos:n,clientRect:i,dropRect:a}=t,s=r,l=C(s,"path");if(l==="0.0")return Ne(e,s,o,n);let c=Y(e,l);if(tn(n,c)){let p=n.position.SouthOrEast?"after":"before";return dt(e,s,o,p,n,i,a)}if(!tn(n,c))return Ne(e,s,o,n,i,a);if(W(M(c)))return Ne(e,s,o,n);throw Error(`no support right now for position = ${n.position}`)},tn=(e,t)=>e.position.Centre?rn(t)||on(t):e.position.NorthOrSouth?on(t):e.position.EastOrWest?rn(t):!1,on=e=>M(e)==="Flexbox"&&e.props.style.flexDirection==="column",rn=e=>M(e)==="Flexbox"&&e.props.style.flexDirection!=="column";import{createContext as Is}from"react";var ks=e=>console.log(`dispatch ${e.type}, have you forgotten to provide a LayoutProvider ?`),Fe=Is({dispatchLayoutProvider:ks,version:-1});import{useCallback as ht,useRef as lo}from"react";var As={},an=[0,0],Os=(e,t,o)=>{let r=document.createElement("div");r.className="vuuSimpleDraggableWrapper",r.classList.add("vuuSimpleDraggableWrapper","salt-theme","salt-density-medium"),r.dataset.dragging="true";let n=o!=null?o:document.createElement("div");n.id=t,r.appendChild(n),document.body.appendChild(r);let i=`top:${e.top}px;left:${e.left}px;width:${e.width}px;height:${e.height}px;`;return[r,i,e.left,e.top]},Hs=e=>{let{offsetParent:t}=e;if(t===null)return an;{let{left:o,top:r}=t.getBoundingClientRect();return[o,r]}},sn=(e,t,o)=>{let r=lo(),n=lo(),i=lo(),a=ht((p,d)=>{if(n.current&&i.current){let{dragOffsets:[u,m],targetPosition:h}=n.current,g=typeof p=="number"?p-u:h.left,b=typeof d=="number"?d-m:h.top;(g!==h.left||b!==h.top)&&(n.current.targetPosition.left=g,n.current.targetPosition.top=b,i.current.style.top=b+"px",i.current.style.left=g+"px")}},[]),s=ht(p=>{if(n.current){let{dragInstructions:d,payload:u,originalCSS:m}=n.current;p&&t({type:"drag-drop",draggedReactElement:u,dragInstructions:d,dropTarget:p}),i.current&&(!p&&d.DriftHomeIfNoDropTarget?(console.log("drift back to start"),document.body.removeChild(i.current)):d.RemoveDraggableOnDragEnd?document.body.removeChild(i.current):(i.current.style.cssText=m,delete i.current.dataset.dragging)),r.current=void 0,n.current=void 0,i.current=void 0}},[t]),l=ht(p=>{if(r.current){let{payload:d,dragContainerPath:u,dragElement:m,dragRect:h,instructions:g=As,path:b}=r.current,{current:f}=e,y={x:p.clientX,y:p.clientY},x=d!=null?d:B(f,b,!0),{id:w}=x.props,R=U(x),v="",E="",S="",I=-1,L=-1,T=an,P=document.getElementById(w);if(P===null)[P,E,I,L]=Os(h,w,m);else{T=Hs(P);let[k,A]=T,{width:O,height:H,left:G,top:Q}=P.getBoundingClientRect();I=G-k,L=Q-A,E=`width:${O}px;height:${H}px;left:${I}px;top:${L}px;z-index: 100;background-color:#ccc;opacity: 0.6;`,P.dataset.dragging="true",v=P.style.cssText}S=Xt.initDrag(e.current,u,h,y,{drag:a,drop:s},R),P.style.cssText=E+S,i.current=P,n.current={payload:x,originalCSS:v,dragRect:h,dragOffsets:T,dragInstructions:g,targetPosition:{left:I,top:L}}}},[a,s,e]);return ht(p=>{let{evt:d,...u}=p;r.current={...u,dragContainerPath:Nt(e.current,o)},Xt.handleMousedown(d,l,u.instructions)},[l,o,e])};import{jsx as dn}from"react/jsx-runtime";var cn=e=>e.dropTarget,Ns=e=>["drag-drop","remove","set-title","splitter-resize","switch-tab"].includes(e.type),un=e=>{switch(e.type){case"switch-tab":return e.id==="main-tabs"?"switch-active-layout":"switch-active-tab";case"save":return"save-feature-props";case"drag-drop":return"drag-drop-operation";case"remove":return"remove-component";case"splitter-resize":return"resize-component";case"set-title":return"edit-feature-title";default:throw Error("unknown layout action")}},Uf=()=>{let e=Fs();return dn("div",{children:`Context: ${e} `})},qf=e=>{let{children:t,createNewChild:o,pathToDropTarget:r,layout:n,onLayoutChange:i}=e,a=ln(void 0),s=ln(t),[,l]=Bs(null),c=co((m,h)=>{if(i){let g=te(m,cn)||a.current,f=M(g)==="DraggableLayout"?D(g).children[0]:g,y=zr(f);i(y,h)}},[i]),p=co((m,h=!1)=>{let g=nn(a.current,m);g!==a.current&&(a.current=g,l({}),!h&&Ns(m)&&c(g,un(m)))},[l,c]),d=co(m=>{switch(m.type){case"drag-start":{u(m);break}case"save":{c(a.current,un(m));break}case"query":if(m.query==="PARENT_CONTAINER")return Nr(m.query,m.path,a.current);break;default:{p(m);break}}},[p,c]),u=sn(a,d,r);return zs(()=>{if(n){let m=te(a.current,cn);if(m){let h=Zo(m),g=me(n,`${m.props.path}.0`),b=h?{type:F.REPLACE,target:h,replacement:g}:{type:F.ADD,path:m.props.path,component:g};p(b,!0)}else if(n.id===C(a.current,"id")){let h=me(n,"0"),g={type:F.REPLACE,target:a.current,replacement:h};p(g,!0)}}},[p,n]),a.current===void 0?a.current=ro(t):t!==s.current&&(a.current=ro(t,a.current),s.current=t),dn(Fe.Provider,{value:{createNewChild:o,dispatchLayoutProvider:d,version:0},children:a.current})},ee=()=>{let{dispatchLayoutProvider:e}=uo(Fe);return e},pn=()=>{let{createNewChild:e}=uo(Fe);return e},Fs=()=>{let{version:e}=uo(Fe);return e};var gt=(e,t,o,r)=>{var b;let{loadSessionState:n,purgeSessionState:i,purgeState:a,saveSessionState:s}=Ee(),[l,c]=$s((b=n(e,"contributions"))!=null?b:[]),p=ee(),d=$e((f,y)=>{let x=l.concat([{location:f,content:y}]);s(e,"contributions",x),c(x)},[l,e,s]),u=$e(()=>{i(e,"contributions"),c([])},[e,i]),m=$e(()=>{let f=n(e,"data-source");f&&f.unsubscribe(),i(e),a(e),p({type:"remove",path:o})},[p,e,n,i,a,o]),h=$e(async(f,y,x)=>{var R;f.stopPropagation();let w=(R=t.current)==null?void 0:R.getBoundingClientRect();return new Promise((v,E)=>{p({type:"drag-start",evt:f,path:y===void 0?o:`${o}.${y}`,dragRect:w,preDragActivity:x,dropTargets:r,resolveDragStart:v,rejectDragStart:E})})},[t,p,o,r]);return[$e(async(f,y)=>{var w;let{type:x}=f;switch(x){case"maximize":case"minimize":case"restore":return p({type:x,path:(w=f.path)!=null?w:o});case"remove":return m();case"mousedown":return h(y,f.index,f.preDragActivity);case"add-toolbar-contribution":return d(f.location,f.content);case"remove-toolbar-contribution":return u();case"query":return p({type:x,path:f.path,query:f.query});default:return}},[p,o,m,h,d,u]),l]};import{useId as ll}from"@vuu-ui/vuu-utils";import{useForkRef as cl}from"@salt-ds/core";import ul from"clsx";import bo,{forwardRef as pl,useCallback as dl,useMemo as ml,useRef as kn,useState as fl}from"react";import{EditableLabel as Ws}from"@vuu-ui/vuu-ui-controls";import{Button as Vs}from"@salt-ds/core";import{default as _s,default as Gs}from"clsx";import{cloneElement as mn,useRef as Ks,useState as fn}from"react";import{jsx as We}from"react/jsx-runtime";var po="vuuHeader",hn=({className:e,contributions:t,collapsed:o,closeable:r,onEditTitle:n,orientation:i="horizontal",style:a,title:s="Untitled"})=>{let l=Ks(null),[c,p]=fn(s),[d,u]=fn(!1),m=gn(),h=L=>m==null?void 0:m({type:"remove"},L),g=()=>{var L;(L=l.current)==null||L.focus()},b=L=>{L.stopPropagation()},y=_s(po,e,`${po}-${o||i}`),x=()=>{u(!0)},w=L=>{L.key==="Enter"&&u(!0)},R=(L="",T="",P=!0,k=!1)=>{var A;u(!1),k?p(L):T!==L&&(p(T),n==null||n(T)),P===!1&&((A=l.current)==null||A.focus())},v=L=>{m==null||m({type:"mousedown"},L)},E=[],S=[],I=[];return t==null||t.forEach((L,T)=>{switch(L.location){case"pre-title":E.push(mn(L.content,{key:T}));break;default:S.push(mn(L.content,{key:T}))}}),s&&E.push(We(Ws,{className:`${po}-title`,editing:d,value:c,onChange:p,onMouseDownCapture:g,onEnterEditMode:x,onExitEditMode:R,onKeyDown:w,ref:l,tabIndex:0},"title")),r&&I.push(We(Vs,{"data-icon":"close",onClick:h,onMouseDown:b,variant:"secondary"},"close")),S.length>0&&E.push(We("div",{className:"vuuTooltrayProxy","data-align":"end",children:S},"contributions")),I.length>0&&E.push(We("div",{className:"vuuTooltrayProxy","data-align":"end",children:I},"actions")),We("div",{className:Gs("vuuToolbarProxy",y),style:a,onMouseDown:v,children:E})};import{useCallback as he,useMemo as bn}from"react";var vn=({id:e,rootRef:t,path:o,dropTargets:r,title:n})=>{let i=ee(),{loadState:a,loadSessionState:s,purgeState:l,saveState:c,saveSessionState:p}=Ee(),[d,u]=gt(e,t,o,r),m=bn(()=>{var v;return(v=a("view-title"))!=null?v:n},[a,n]),h=he(v=>{o&&i({type:"set-title",path:o,title:v})},[i,o]),g=bn(()=>a(e),[e,a]),b=he(v=>a(e,v),[e,a]),f=he(v=>{l(e,v),i({type:"save"})},[e,i,l]),y=he((v,E)=>{c(e,E,v),i({type:"save"})},[e,i,c]),x=he(v=>s(e,v),[e,s]),w=he((v,E)=>p(e,E,v),[e,p]),R=he(({type:v,...E})=>{let{[v]:S}=E;y(S,v)},[y]);return{contributions:u,dispatchViewAction:d,load:b,loadSession:x,onConfigChange:R,onEditTitle:h,purge:f,restoredState:g,save:y,saveSession:w,title:m}};import{useCallback as Tn,useEffect as Xs,useRef as ho,useState as Js}from"react";import{useCallback as Us,useLayoutEffect as yn,useRef as qs}from"react";var xn=["height","width"],Dh=["height"],Ph=["width"],ge=new WeakMap,En=(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}},wn=new ResizeObserver(e=>{for(let t of e){let{target:o,contentRect:r}=t,n=ge.get(o);if(n){let{onResize:i,measurements:a}=n,s=!1;for(let[l,c]of Object.entries(a)){let p=En(o,r,l);p!==c&&(s=!0,a[l]=p)}s&&i&&i(a)}}});function bt(e,t,o,r=!1){let n=qs(t),i=Us(a=>{let s=a.getBoundingClientRect();return n.current.reduce((l,c)=>(l[c]=En(a,s,c),l),{})},[]);yn(()=>{let a=e.current,s=!1;async function l(){ge.set(a,{measurements:{}}),s=!1;let{fonts:c}=document;if(c&&await c.ready,!s){let p=ge.get(a);if(p){let d=i(a);p.measurements=d,wn.observe(a),r&&o(d)}}}if(a){if(ge.has(a))throw Error("useResizeObserver attemping to observe same element twice");l()}return()=>{a&&ge.has(a)&&(wn.unobserve(a),ge.delete(a),s=!0)}},[e,i,r,o]),yn(()=>{let a=e.current,s=ge.get(a);if(s){if(n.current!==t){n.current=t;let l=i(a);s.measurements=l}s.onResize=o}},[t,i,e,o])}function js(e,t){let o=document.body.querySelector(`.${e}`),r={get:function(n,i){let a=n.getPropertyValue(`--${e}-breakpoint-${i}`);return a?parseInt(a):void 0}};return o?new Proxy(getComputedStyle(o),r):t!=null?t:{}}var Ys=([,e],[,t])=>t-e,fo=e=>Object.entries(e).sort(Ys).map(([t,o],r,n)=>[t,o,r<n.length-1?n[r+1][1]:9999]),mo=null,Zs=(e="salt")=>{let{xs:t,sm:o,md:r,lg:n,xl:i}=js(e);return fo({xs:t,sm:o,md:r,lg:n,xl:i})},Rn=e=>(mo===null&&(mo=Zs(e)),mo);var Qs=[],Sn=({breakPoints:e,smallerThan:t},o)=>{let[r,n]=Js(t?!1:"lg"),i=ho(document.body),a=ho(e?fo(e):Rn()),s=ho("lg"),l=Tn(p=>{if(a.current){for(let[d,u]of a.current)if(p>=u)return d}},[a]),c=Tn(p=>{if(t){let d=a.current.find(([u])=>u===t);if(d){let[,,u]=d;return p<u}}else return l(p);return p},[t,l]);return bt(o||i,a.current?["width"]:Qs,({width:p})=>{let d=c(p);d!==s.current&&(s.current=d,n(d))},!0),Xs(()=>{let p=o||i;if(p.current){let d=s.current;if(a.current){let{clientWidth:u}=p.current,m=c(u);s.current=m,m!==d&&n(m)}}},[n,c,o]),r};var Dn="data-collapsible",el={[Dn]:!0,"data-pad-start":!0,"data-pad-end":!0},tl=e=>{var t;return(t=el[e])!=null?t:!1},ol=e=>e===Dn,rl={dynamic:"dynamic",instant:"instant",true:"instant"},nl=e=>{var t;return(t=rl[e])!=null?t:"none"},zh=e=>Object.keys(e).reduce((t,o)=>{let[r,n]=t;if(tl(o)){let i=ol(o)?nl(e[o]):e[o];r[o]=i,n[o]=void 0}return t},[{},{}]);import{useCallback as Pn,useRef as Ln}from"react";var il=[],Mn=({mainRef:e,resize:t="responsive",rootRef:o})=>{let r=t==="defer",n=Ln({}),i=Ln(),a=Pn(()=>{e.current&&(e.current.style.height=n.current.height+"px",e.current.style.width=n.current.width+"px"),i.current=void 0},[e]),s=Pn(({height:l,width:c})=>{n.current.height=l,n.current.width=c,i.current!==null&&clearTimeout(i.current),i.current=window.setTimeout(a,40)},[a]);bt(o,r?xn:il,s,r)};import al,{useContext as Cn}from"react";var sl={dispatch:null},vt=al.createContext(sl),gn=()=>{var t;let e=Cn(vt);return(t=e==null?void 0:e.dispatch)!=null?t:null},In=()=>Cn(vt);import{jsx as go,jsxs as gl}from"react/jsx-runtime";var Ve="vuuView",hl=(e,t)=>e&&t?{...e,...t}:e||t,An=pl(function(t,o){let{Header:r=hn,children:n,className:i,collapsed:a,closeable:s,"data-path":l,"data-resizeable":c,dropTargets:p,expanded:d,flexFill:u,id:m,header:h,orientation:g="horizontal",path:b=l,resize:f="responsive",resizeable:y=c,tearOut:x,style:w={},title:R,...v}=t,E=ll(m),S=kn(null),I=kn(null),[L,T]=fl(),{contributions:P,dispatchViewAction:k,load:A,loadSession:O,onConfigChange:H,onEditTitle:G,purge:Q,restoredState:Le,save:Fo,saveSession:$o,title:Ot}=vn({id:E,rootRef:S,path:b,dropTargets:p,title:R});Mn({mainRef:I,resize:f,rootRef:S});let Wo=dl(qi=>{T(qi)},[]),Gi=()=>bo.isValidElement(n)&&(Le||L)?bo.cloneElement(n,hl(Le,L)):n,Ki=ml(()=>({dispatch:k,id:E,path:b,title:Ot,load:A,loadSession:O,onConfigChange:H,purge:Q,save:Fo,saveSession:$o,setComponentProps:Wo}),[k,E,A,O,H,b,Q,Fo,$o,Wo,Ot]),Ui=typeof h=="object"?h:{};return go("div",{...v,className:ul(Ve,i,{[`${Ve}-collapsed`]:a,[`${Ve}-expanded`]:d,[`${Ve}-resize-defer`]:f==="defer"}),"data-resizeable":y,id:E,ref:cl(o,S),style:w,tabIndex:-1,children:gl(vt.Provider,{value:Ki,children:[h?go(r,{...Ui,collapsed:a,contributions:P,expanded:d,closeable:s,onEditTitle:G,orientation:g,tearOut:x,title:Ot}):null,go("div",{className:`${Ve}-main`,ref:I,children:Gi()})]})})});An.displayName="View";var Se=bo.memo(An);Se.displayName="View";z("View",Se,"view");import{Fragment as wl,jsx as vo,jsxs as On}from"react/jsx-runtime";var yt="vuuLayoutStartPanel",Hn=e=>{let{dispatch:t,path:o}=In(),[r,n]=yl();return vl(()=>{t==null||t({type:"query",path:o,query:"PARENT_CONTAINER"}).then(a=>{(a==null?void 0:a.parentContainerId)==="main-tabs"?n("initial"):n("nested")})},[t,o]),r===void 0?null:On("div",{...e,className:yt,children:[r==="initial"?On(wl,{children:[vo("header",{className:`${yt}-title`,children:"Start by adding a table"}),vo("div",{className:`${yt}-text`,children:"To add a table, drag any of the Vuu Tables to this area or click the button below"})]}):null,vo(bl,{className:`${yt}-addButton`,"data-icon":"add",variant:"cta"})]})};import{Fragment as Tl,jsx as wt}from"react/jsx-runtime";var El="vuuPlaceholder",Rl=({showStartMenu:e=!0})=>wt(Tl,{children:e?wt(Hn,{}):null}),De=({className:e,showStartMenu:t,...o})=>{let r=xl(El,e);return wt(Se,{...o,className:r,"data-placeholder":!0,resizeable:!0,children:wt(Rl,{showStartMenu:t})})};De.displayName="Placeholder";z("Placeholder",De);import Sl from"clsx";import Dl,{useCallback as _e,useRef as xt,useState as Pl}from"react";import{jsx as zn}from"react/jsx-runtime";var Et="vuuSplitter",Bn=Dl.memo(function({column:t,index:o,onDrag:r,onDragEnd:n,onDragStart:i,style:a}){let s=xt(),l=xt(null),c=xt(0),[p,d]=Pl(!1),u=_e(({key:v,shiftKey:E})=>{let S=E?10:1;t&&v==="ArrowDown"?r(o,S):t&&v==="ArrowUp"||!t&&v==="ArrowLeft"?r(o,-S):!t&&v==="ArrowRight"&&r(o,S)},[t,o,r]),m=_e(v=>{let{key:E}=v;(t&&(E==="ArrowUp"||E==="ArrowDown")||!t&&(E==="ArrowLeft"||E==="ArrowRight"))&&(i(o),u(v),h.current=u)},[t,u,o,i]),h=xt(m),g=v=>h.current(v),b=_e(v=>{s.current=!0;let E=v[t?"clientY":"clientX"],S=E-c.current;E&&E!==c.current&&r(o,S),c.current=E},[t,o,r]),f=_e(()=>{var v;window.removeEventListener("mousemove",b,!1),window.removeEventListener("mouseup",f,!1),n(),d(!1),(v=l.current)==null||v.focus()},[b,n,d]),y=_e(v=>{c.current=t?v.clientY:v.clientX,i(o),window.addEventListener("mousemove",b,!1),window.addEventListener("mouseup",f,!1),v.preventDefault(),d(!0)},[t,b,f,o,i,d]),x=()=>{var v;s.current?s.current=!1:(v=l.current)==null||v.focus()},w=()=>{h.current=m},R=Sl(Et,{[`${Et}-active`]:p,[`${Et}-column`]:t});return zn("div",{className:R,"data-splitter":!0,ref:l,role:"separator",style:a,onBlur:w,onClick:x,onKeyDown:g,onMouseDown:y,tabIndex:0,children:zn("div",{className:`${Et}-grab-zone`})})});var Ll={},Ge=1,Ke=2,Ml=e=>typeof e.intrinsicSize=="number",Cl=(e,t)=>{let o={};return e.forEach(r=>{o[r]=C(t,r)}),o},Rt=(e,t,o)=>e.map((r,n)=>{var l;let i=C(r,"resizeable"),{[t]:a}=(l=U(r))!=null?l:Ll,s=Cr(r);return o?{index:n,flexOpen:s,intrinsicSize:a,resizeable:i,...Cl(o,r)}:{index:n,flexOpen:s,intrinsicSize:a,resizeable:i}}),Nn=e=>{let t=e.length,o=e.every(Ml),r=Array(t).fill(0);if(o&&t>0&&(r[0]=Ke,r[t-1]=Ke),t<2)return r;for(let n=0,i=0;n<t-1;n++)e[n].resizeable&&!i&&(i=Ge),r[n]+=i;for(let n=t-1;n>0&&(r[n]&Ge&&(r[n]-=Ge),!e[n].resizeable);n--);return r},Fn=(e,t)=>{let o=kl(e,t),r=Al(e,t),n=o!==-1&&r!==-1?[o,r]:void 0,i=Il(e,n);return[n,i]};function Il(e,t){if(t){let o=[];for(let r=0;r<e.length;r++)e[r].flexOpen&&!t.includes(r)&&o.push(r);return o}}function kl(e,t){let o=t,r=!1;for(;o>=1&&!r;)o=o-1,r=$n(e,o);return o}function Al(e,t){let o=t,r=!1,n=e.length;for(;o<n-1&&!r;)o=o+1,r=$n(e,o);return o===n?-1:o}function $n(e,t){let{placeholder:o,splitter:r,resizeable:n,intrinsicSize:i}=e[t];return!!(!r&&!i&&(o||n))}var zl=e=>!e.splitter&&!e.placeholder,_n=({children:e,onSplitterMoved:t,style:o})=>{let r=St(null),n=St(),i=St(),a=St([]),[,s]=Hl({}),l=b=>{i.current=b,s({})},c=(o==null?void 0:o.flexDirection)==="column",p=c?"height":"width",d=Wn(()=>Array.isArray(e)?e:Ue.isValidElement(e)?[e]:[],[e]),u=Tt(b=>{let{current:f}=n;if(f){let[y,x]=Fn(f,b);y&&(y.forEach(w=>{var v;let R=(v=r.current)==null?void 0:v.childNodes[w];if(R){let{size:E,minSize:S}=$l(R,p);f[w].currentSize=E,f[w].minSize=S}}),x&&x.forEach(w=>{var v;let R=(v=r.current)==null?void 0:v.childNodes[w];if(R){let{[p]:E}=R.getBoundingClientRect();f[w].flexBasis=E}}))}},[p]),m=Tt((b,f)=>{i.current&&n.current&&l(Nl(i.current,n.current,f,p))},[p]),h=Tt(()=>{let b=n.current;b&&(t==null||t(b.filter(zl))),b==null||b.forEach(f=>{f.currentSize=void 0,f.flexBasis=void 0,f.flexOpen=!1})},[t]),g=Tt(b=>Ue.createElement(Bn,{column:c,index:b,key:`splitter-${b}`,onDrag:m,onDragEnd:h,onDragStart:u}),[m,h,u,c]);return Wn(()=>{let[b,f]=Bl(d,p,g,a.current);n.current=f,i.current=b},[d,g,p]),{content:i.current||[],rootRef:r}};function Bl(e,t,o,r){let n=Rt(e,t),i=Nn(n),a=[],s=[];for(let l=0;l<e.length;l++){let c=e[l];if(l===0&&i[l]&Ke&&(a.push(Vn(l)),s.push({placeholder:!0,shim:!0})),c.key==null){let p=r[l]||(r[l]=Ol());a.push(Ue.cloneElement(c,{key:p}))}else a.push(c);s.push(n[l]),l>0&&i[l]&Ke?(a.push(Vn(l)),s.push({placeholder:!0})):i[l]&Ge&&(a.push(o(a.length)),s.push({splitter:!0}))}return[a,s]}function Nl(e,t,o,r){return Fl(t,o)?e.map((i,a)=>{let s=t[a],{currentSize:l,flexOpen:c,flexBasis:p}=s,d=l!==void 0;if(d||c){let{flexBasis:u}=i.props.style||{},m=d?s.currentSize:p;return m!==u?Ue.cloneElement(i,{style:{...i.props.style,flexBasis:m,[r]:"auto"}}):i}else return i}):e}function Fl(e,t){let o=[];e.forEach((p,d)=>{p.currentSize!==void 0&&o.push(d)});let r=t<0?o[0]:o[1],{currentSize:n=0,minSize:i=0}=e[r];if(n===i)return!1;if(Math.abs(t)>n-i){let p=t<0?-1:1;t=Math.max(0,n-i)*p}let a=e[o[0]],{currentSize:s=0}=a;a.currentSize=s+t;let l=e[o[1]],{currentSize:c=0}=l;return l.currentSize=c-t,!0}function Vn(e){return Ue.createElement(De,{shim:e===0,key:`placeholder-${e}`})}function $l(e,t){let{[t]:o}=e.getBoundingClientRect(),n=getComputedStyle(e).getPropertyValue(`min-${t}`),i=n.endsWith("px")?parseInt(n,10):0;return{size:o,minSize:i}}import{jsx as Gl}from"react/jsx-runtime";var yo="hwFlexbox",Gn=_l(function(t,o){let{breakPoints:r,children:n,column:i,className:a,flexFill:s,gap:l,fullPage:c,id:p,onSplitterMoved:d,resizeable:u,row:m,spacing:h,splitterSize:g,style:b,...f}=t,{content:y,rootRef:x}=_n({children:n,onSplitterMoved:d,style:b}),w=Vl(yo,a,{[`${yo}-column`]:i,[`${yo}-row`]:m,"flex-fill":s,"full-page":c});return Gl("div",{...f,className:w,"data-resizeable":u||void 0,id:p,ref:Wl(x,o),style:{...b,gap:l,"--spacing":h},children:y})});Gn.displayName="Flexbox";var wo=Gn;import{useCallback as Kl}from"react";import{jsx as Ul}from"react/jsx-runtime";var Kn=function(t){let{path:o}=t,r=ee(),n=Kl(i=>{r({type:Te.SPLITTER_RESIZE,path:o,sizes:i})},[r,o]);return Ul(wo,{...t,onSplitterMoved:n})};Kn.displayName="Flexbox";z("Flexbox",Kn,"container");import{useForkRef as Ql}from"@salt-ds/core";import ec from"clsx";import{forwardRef as tc,useMemo as oc}from"react";import{getUniqueId as ql}from"@vuu-ui/vuu-utils";import{cloneElement as jl,isValidElement as Yl,useCallback as Zl,useMemo as Un,useRef as xo}from"react";var Xl=["xs","sm","md","lg","xl"],Jl=12,qn=({children:e,cols:t,style:o})=>{let r=xo(null),n=xo(null),i=xo(),a=t!=null?t:Jl,l=(o==null?void 0:o.flexDirection)==="column"?"height":"width",c=Un(()=>Array.isArray(e)?e:Yl(e)?[e]:[],[e]),p=Zl((d,u)=>{let m=Rt(d,u,Xl),h=[],g=[];for(let b=0;b<d.length;b++){let f=d[b],{style:{flex:y,...x}}=f.props;h.push(jl(f,{key:ql(),style:{...x,"--parent-col-count":a}})),g.push(m[b])}return[h,g]},[a]);return Un(()=>{let[d,u]=p(c,l);n.current=u,i.current=d},[p,c,l]),{cols:a,content:i.current,rootRef:r}};import{jsx as rc}from"react/jsx-runtime";var Dt="hwFluidGrid",Eo=tc(function(t,o){let{breakPoints:r,children:n,column:i,cols:a=12,className:s,flexFill:l,gap:c=3,fullPage:p,id:d,onSplitterMoved:u,resizeable:m,row:h,showGrid:g,spacing:b,splitterSize:f,style:y,...x}=t,w=oc(()=>ve(n),[n]),{cols:R,content:v,rootRef:E}=qn({children:w,cols:a,style:y}),S=Sn({breakPoints:r},E),I=ec(Dt,s,{[`${Dt}-column`]:i,[`${Dt}-row`]:h,[`${Dt}-show-grid`]:g,"flex-fill":l,"full-page":p}),L={...y,"--spacing":b,"--grid-col-count":R,"--grid-gap":c};return rc("div",{...x,className:I,"data-breakpoint":S,"data-cols":R,"data-resizeable":m||void 0,id:d,ref:Ql(E,o),style:L,children:v})});Eo.displayName="FluidGrid";import{jsx as nc}from"react/jsx-runtime";var jn=function(t){return nc(Eo,{...t})};jn.displayName="FluidGrid";z("FluidGrid",jn,"container");import{forwardRef as yc}from"react";import{isValidNumber as se}from"@vuu-ui/vuu-utils";import{useCallback as sc,useEffect as lc,useMemo as cc,useRef as uc,useState as pc}from"react";import{useCallback as ic,useEffect as Yn,useRef as ac}from"react";var be=new Map,Xn=(e,t,o)=>{switch(o){case"height":return t.height;case"clientHeight":return Math.floor(e.clientHeight);case"clientWidth":return Math.floor(e.clientWidth);case"contentHeight":return t.contentHeight;case"contentWidth":return t.contentWidth;case"scrollHeight":return Math.ceil(Math.floor(e.scrollHeight));case"scrollWidth":return Math.ceil(Math.floor(e.scrollWidth));case"width":return t.width;default:return 0}},Zn=new ResizeObserver(e=>{for(let t of e){let{target:o,borderBoxSize:r,contentBoxSize:n}=t,i=be.get(o);if(i){let[{blockSize:a,inlineSize:s}]=r,[{blockSize:l,inlineSize:c}]=n,{onResize:p,measurements:d}=i,u=!1;for(let[m,h]of Object.entries(d)){let g=Xn(o,{height:a,width:s,contentHeight:l,contentWidth:c},m);g!==h&&(u=!0,d[m]=g)}u&&p&&p(d)}}});function Jn(e,t,o,r=!1){let n=ac(t),i=ic(a=>{let{width:s,height:l}=a.getBoundingClientRect(),{clientWidth:c,clientHeight:p}=a,d=Math.floor(l),u=Math.floor(s);return n.current.reduce((m,h)=>(m[h]=Xn(a,{width:u,height:d,contentHeight:p,contentWidth:c},h),m),{})},[]);Yn(()=>{let a=e.current;async function s(){be.set(a,{measurements:{}});let l=be.get(a);if(l){let c=i(a);l.measurements=c,Zn.observe(a),r&&o(c)}else console.log("%cuseResizeObserver an target expected to be under observation wa snot found. This warrants investigation","font-weight:bold; color:red;")}return a&&(be.has(a)&&console.log("useResizeObserver attemping to observe same element twice",{target:a}),s()),()=>{a&&be.has(a)&&(Zn.unobserve(a),be.delete(a))}},[i,e]),Yn(()=>{let a=e.current,s=be.get(a);if(s){if(n.current!==t){n.current=t;let l=i(a);s.measurements=l}s.onResize=o}},[t,i,e,o])}var dc=["clientHeight","clientWidth"],mc=["clientWidth"],fc=["clientHeight"],hc=[],Pt=e=>Number.isFinite(e),gc={height:"100%",width:"auto"},bc=(e,t)=>se(e)&&se(t)?{height:`${e}px`,width:`${t}px`}:typeof e=="string"||typeof t=="string"?{height:e!=null?e:"100%",width:t!=null?t:"auto"}:gc,vc=(e,t)=>{if(se(e)&&se(t))return{height:e,width:t}},Qn=({defaultHeight:e=0,defaultWidth:t=0,height:o,onResize:r,width:n})=>{let i=uc(null),[a,s]=pc({css:bc(o,n),inner:vc(o,n),outer:{height:o!=null?o:"100%",width:n!=null?n:"auto"}}),l=typeof o=="number",c=typeof n=="number",p=l&&c?hc:l?mc:c?fc:dc;cc(()=>{s(u=>{let{inner:m,outer:h}=u;if(se(o)&&se(n)&&m&&h){let{height:g,width:b}=m,{height:f,width:y}=h;if(f!==o||y!==n){let x=se(f)?f-g:0,w=se(y)?y-b:0;return{...u,outer:{height:o,width:n},inner:{height:o-x,width:n-w}}}}return u})},[o,n]);let d=sc(({clientWidth:u,clientHeight:m})=>{let{css:h,inner:g,outer:b}=a,f=a;l&&Pt(u)&&Math.floor(u)!==(g==null?void 0:g.width)?f={css:h,outer:b,inner:{width:Math.floor(u)||t,height:o}}:c&&Pt(m)&&Math.floor(m)!==(g==null?void 0:g.height)?f={css:h,outer:b,inner:{height:Math.floor(m)||e,width:n}}:Pt(m)&&Pt(u)&&(u!==(g==null?void 0:g.width)||m!==(g==null?void 0:g.height))&&(f={css:h,outer:b,inner:{width:Math.floor(u)||t,height:Math.floor(m)||e}}),f!==a&&s(f)},[e,t,l,c,o,a,n]);return lc(()=>{a.inner&&(r==null||r(a.inner))},[r,a.inner]),Jn(i,p,d,!0),{containerRef:i,cssSize:a.css,outerSize:a.outer,innerSize:a.inner}};import{useForkRef as wc}from"@salt-ds/core";import ei from"clsx";import{jsx as ti}from"react/jsx-runtime";var Ro="vuuMeasuredContainer",av=yc(function({children:t,className:o,height:r,onResize:n,style:i,width:a,...s},l){let{containerRef:c,...p}=Qn({height:r,onResize:n,width:a}),{cssSize:d,innerSize:u}=p,m=u===void 0,h=()=>m?{"--measured-css-height":`${d.height}`,"--measured-css-width":`${d.width}`}:{...i,"--measured-css-height":`${d.height}`,"--measured-css-width":`${d.width}`,"--measured-px-height":`${u==null?void 0:u.height}px`,"--measured-px-width":`${u==null?void 0:u.width}px`},g=wc(c,l);return m?ti("div",{...s,className:ei(Ro,`${Ro}-ummeasured`),style:h(),ref:c}):ti("div",{...s,className:ei(Ro,o),ref:g,style:h(),children:t})});import{PopupMenu as Fc}from"@vuu-ui/vuu-popups";import{useId as $c}from"@vuu-ui/vuu-utils";import Ct from"clsx";import Wc,{forwardRef as Vc}from"react";import{useDragDrop as Oc}from"@vuu-ui/vuu-ui-controls";import{isValidNumber as Hc,MEASURES as zc,useLayoutEffectSkipFirst as Bc}from"@vuu-ui/vuu-utils";import{useCallback as Mt,useMemo as Do,useRef as pi,useState as Nc}from"react";import{getElementByDataIndex as oi}from"@vuu-ui/vuu-utils";var xc=".vuuOverflowContainer-item:not(.wrapped)",pv=e=>e!==null&&e.dataset.index==="overflow"&&e.parentElement!==null&&e.parentElement.classList.contains("vuuOverflowContainer-wrapContainer-overflowed"),Ec=e=>e.sort((t,o)=>{let{dataset:{index:r="?"}}=t,{dataset:{index:n="?"}}=o,i=t.classList.contains("wrapped"),a=o.classList.contains("wrapped"),s=r==="overflow",l=n==="overflow";return i&&!a?1:!i&&a?-1:s?1:l?-1:parseInt(r)>parseInt(n)?1:-1}),To=[],qe=(e,t="horizontal")=>{let o=[],r=[],n=-1,i=!1,a=Ec(Array.from(e.children)),s=t==="vertical"?"top":"left";for(let l of a){let c=l,{dataset:{index:p="?",label:d="?",overflowPriority:u="0"}}=c,{[s]:m}=c.getBoundingClientRect();m<=n?(p==="overflow"?r.push(o.pop()):r.push({index:p,label:d,overflowPriority:u}),i=!0):i?r.push({index:p,label:d,overflowPriority:u}):o.push({index:p,label:d,overflowPriority:u}),n=m}return[o,r]},ri=(e,t,o)=>{let r=!1,n=o?`${o}-overflowed`:"overflow";t.find(({index:i})=>i==="overflow")&&t.length===1&&(r=!0);for(let i of e.children){let{dataset:{index:a="?"}}=i;t.length===0||r?e.classList.remove(n):e.classList.add(n),a!=="overflow"&&t.find(s=>s.index===a)?i.classList.add("wrapped"):i.classList.remove("wrapped")}},Rc=(e,{overflowPriority:t})=>Math.max(e,parseInt(t)),Tc=(e,{overflowPriority:t})=>Math.min(e,parseInt(t)),ni=e=>{var t;return e.length>1&&((t=e.at(-1))==null?void 0:t.index)==="overflow"},Sc=e=>{let[t]=e;for(let o=1;o<e.length;o++){let r=e[o];parseInt(r.overflowPriority)>parseInt(t.overflowPriority)&&(t=r)}return t},ii=(e,t)=>{var n;let o=e.reduce(Tc,Number.MAX_SAFE_INTEGER);return t.reduce(Rc,0)>o?!0:t.length>1&&((n=t.at(-1))==null?void 0:n.index)==="overflow"},ai=(e,t)=>new Promise(o=>{requestAnimationFrame(()=>{let[,r]=qe(e);Lc(t,r).forEach(i=>Dc(e,i)),o(r)})}),si=(e,t,o)=>new Promise(r=>{requestAnimationFrame(()=>{let[,n]=qe(e),i=Sc(n);if(i){let[a,s]=So(e,i);r([a,s])}else r([t,o])})}),Dc=(e,t)=>{let o=oi(e,t.index);if(o)o.classList.add("wrapped");else throw Error(`markElementAsWrapped element item with index ${t.index} not found`)},Pc=e=>Array.from(e.querySelectorAll(".wrapped")),Lc=(e,t)=>{let o=[];for(let r of t)e.find(({index:n})=>n===r.index)||o.push(r);return o},Mc=(e,t)=>{Pc(e).forEach(r=>{let{dataset:{index:n="?"}}=r;t.find(i=>i.index===n)||r.classList.remove("wrapped")})},li=e=>e.querySelector('[data-index="overflow"]'),Cc=e=>e.querySelector(".wrapped"),Lt=e=>parseInt(getComputedStyle(e).getPropertyValue("width")),ci=(e,t)=>{let{right:o}=e.getBoundingClientRect(),r=parseInt(getComputedStyle(e).getPropertyValue("padding-right")),{right:n}=t.getBoundingClientRect();return o-r-n},ui=e=>{let t=li(e),o=ci(e,t),r=Lt(t),n=Cc(e);return Lt(n)<=o+r?(e.classList.remove("overflowed"),n.classList.remove("wrapped"),!0):!1},Ic=(e,t)=>{let{dataset:{index:o="0",overflowPriority:r="0"}}=e,{dataset:{index:n="0",overflowPriority:i="0"}}=t;return r>i?-1:r<i?1:parseInt(o)-parseInt(n)},kc=e=>Array.from(e.querySelectorAll(xc)).sort(Ic),So=(e,t)=>{let o=kc(e),r=oi(e,t.index,!0),n=-1,i=o.at(n),a=Lt(i),s=Lt(r),l=li(e),c=ci(e,l)+a;if(c>=s)Ac(r,i);else{let{left:u}=i.getBoundingClientRect(),m=c,h=[i];for(;c<s;){n-=1,i=o.at(n),h.push(i);let{left:g}=i.getBoundingClientRect(),b=u-g;c=m+b}r==null||r.classList.remove("wrapped"),h.forEach(g=>{g.classList.add("wrapped")})}let[p,d]=qe(e);return Mc(e,d),[p,d]},Ac=(e,t)=>{if(!e||!t)throw Error("switchWrapOnElements, element undefined");e.classList.remove("wrapped"),t.classList.add("wrapped")};var di=({allowDragDrop:e=!1,itemCount:t,onMoveItem:o,onSwitchWrappedItemIntoView:r,orientation:n="horizontal"})=>{let[i,a]=Nc(null),s=pi(To),l=pi(null),c=Mt(x=>{var w;l.current&&((w=l.current.querySelector(".vuuOverflowContainer-OverflowIndicator button"))==null||w.setAttribute("tabindex",x))},[]),p=Mt(async()=>{if(i){let[x,w]=qe(i,n);for(ri(i,w,"vuuOverflowContainer-wrapContainer"),ni(w)&&(w=await ai(i,w));ii(x,w);)[x,w]=await si(i,x,w);w.length===1&&ui(i)&&(w=To),s.current.length===0&&w.length>0?c("0"):s.current.length>0&&w.length===0&&c("-1"),s.current=w}},[i,n,c]),d=x=>typeof x=="object"&&x!==null&&"overflowItem"in x,[u,m]=Do(()=>[()=>{let{current:x}=s;return x.map(w=>({label:w.label,action:`activate-item-${w.index}`,options:{overflowItem:w}}))},({options:x})=>{if(i&&d(x)){let[,w]=So(i,x.overflowItem);s.current=w,r==null||r(x.overflowItem)}return!0}],[i,r]),h=Do(()=>{let{sizeProp:x}=zc[n],w=0;return new ResizeObserver(R=>{for(let v of R){let{[x]:E}=v.contentRect,S=Math.round(E);Hc(S)&&w!==S&&(w=S,p())}})},[p,n]);Bc(()=>{p()},[p,t]),Do(()=>{i&&h.observe(i)},[i,h]);let g=Mt(x=>{a(l.current=x)},[]),b=Mt((x,w)=>{o==null||o(x,w)},[o]),{onMouseDown:f,...y}=Oc({allowDragDrop:e,containerRef:l,draggableClassName:"vuuOverflowContainer",onDrop:b,orientation:"horizontal",itemQuery:".vuuOverflowContainer-item"});return{menuActionHandler:m,menuBuilder:u,onItemMouseDown:f,rootRef:g,...y}};import{jsx as je,jsxs as _c}from"react/jsx-runtime";var Pe="vuuOverflowContainer",mi=Wc.memo(({PopupMenuProps:e,allowDragDrop:t,children:o,className:r,height:n,id:i,onMoveItem:a,onSwitchWrappedItemIntoView:s,orientation:l="horizontal",overflowIcon:c,overflowPosition:p="end"})=>{let d=ve(o),{draggable:u,draggedItemIndex:m,menuActionHandler:h,menuBuilder:g,onItemMouseDown:b,rootRef:f}=di({allowDragDrop:t,itemCount:d.length,onMoveItem:a,onSwitchWrappedItemIntoView:s,orientation:l}),x={"--overflow-container-height":`${l==="vertical"?"100%":`${n}px`}`},w=Ct(`${Pe}-wrapContainer`,r,{[`${Pe}-horizontal`]:l==="horizontal",[`${Pe}-vertical`]:l==="vertical"}),R=d.map((E,S)=>{let{"data-align":I,"data-overflow-priority":L="0",id:T=`${i}-${S}`,label:P=`Item ${S+1}`}=E.props;return je("div",{className:Ct(`${Pe}-item`,{"vuuDraggable-dragAway":m===S}),"data-index":S,"data-align":I,"data-label":P,"data-overflow-priority":L,id:`${T}-wrapper`,onMouseDown:b,children:E},S)}),v=je("div",{className:`${Pe}-OverflowIndicator`,"data-index":"overflow",children:je(Fc,{...e,icon:c,menuBuilder:g,menuActionHandler:h,tabIndex:-1})},"overflow");return R.push(v),_c("div",{className:w,ref:f,style:x,children:[R,u]})});mi.displayName="OverflowContainer.InnerContainer";var fi=Vc(function({PopupMenuProps:t,allowDragDrop:o=!1,children:r,className:n,height:i=44,id:a,onMoveItem:s,onSwitchWrappedItemIntoView:l,orientation:c,overflowIcon:p,overflowPosition:d,...u},m){let h=$c(a);return je("div",{...u,className:Ct(Ct(n,Pe)),id:h,ref:m,children:je(mi,{PopupMenuProps:t,allowDragDrop:o,height:i,id:h,orientation:c,overflowIcon:p,overflowPosition:d,onMoveItem:s,onSwitchWrappedItemIntoView:l,children:r})})});import{uuid as Gc}from"@vuu-ui/vuu-utils";import{List as Kc,ListItem as Uc}from"@vuu-ui/vuu-ui-controls";import hi from"clsx";import{cloneElement as qc,memo as jc}from"react";import{jsx as Po}from"react/jsx-runtime";var Yc=e=>{let t=e.cloneNode(!0);return t.id="",delete t.dataset.idx,t},gi=jc(({className:e,children:t,idx:o,resizeable:r,header:n,closeable:i,...a})=>Po(Uc,{className:hi("vuuPaletteItem",e),"data-draggable":!0,"data-icon":"draggable",...a}));gi.displayName="PaletteItem";var Zc=({ListProps:e,ViewProps:t,children:o,className:r,itemHeight:n=41,orientation:i="horizontal",...a})=>{let s=ee(),l="vuuPalette";function c(p){var L,T;let u=p.target.closest(".vuuPaletteItem"),m=parseInt((T=(L=u.dataset)==null?void 0:L.index)!=null?T:"-1"),{props:{caption:h,children:g,template:b,...f}}=o[m],{ViewProps:y}=g.props,{height:x,left:w,top:R,width:v}=u.getBoundingClientRect(),E=Gc(),I=b?g:Po(Se,{...t,...{id:E,key:E},...f,...y,title:f.label,children:g});s({dragRect:{left:w,top:R,right:w+v,bottom:R+150,width:v,height:x},dragElement:Yc(u),evt:p.nativeEvent,instructions:{DoNotRemove:!0,DoNotTransform:!0,DriftHomeIfNoDropTarget:!0,RemoveDraggableOnDragEnd:!0,dragThreshold:10},path:"*",payload:I,type:"drag-start"})}return Po(Kc,{...e,...a,className:hi(l,r,`${l}-${i}`),itemHeight:n,selected:null,children:o.map((p,d)=>p.type===gi?qc(p,{key:d,onMouseDown:c}):p)})};z("Palette",Zc,"view");import{Tab as Xc,Tabstrip as Jc}from"@vuu-ui/vuu-ui-controls";import{useId as Qc}from"@vuu-ui/vuu-utils";import bi from"clsx";import Co,{forwardRef as eu,useCallback as tu,useRef as ou}from"react";import{jsx as Mo,jsxs as au}from"react/jsx-runtime";var Lo="vuuTabs",ru=()=>{},nu=e=>{let t=[];return Co.Children.forEach(e,o=>{Co.isValidElement(o)?t.push(o):console.warn("Stack has unexpected child element type")}),t},iu={allowAddTab:!1,allowCloseTab:!1,allowRenameTab:!1},Io=eu(function({TabstripProps:t=iu,active:o=0,children:r,className:n,getTabIcon:i=ru,getTabLabel:a=Re,id:s,keyBoardActivation:l="manual",onAddTab:c,onMoveTab:p,onTabClose:d,onTabEdit:u,onTabSelectionChanged:m,showTabs:h="top",style:g},b){var P;let f=Qc(s),y=ou([]),{allowCloseTab:x,allowRenameTab:w,className:R}=t,v=tu((k,A,O,H)=>{u==null||u(H,A)},[u]),E=()=>{var k;return Co.isValidElement(r)?r:Array.isArray(r)&&(k=r[o])!=null?k:null},S=()=>nu(r).map((k,A)=>{let{closeable:O=x,id:H=`${f}-${A}`,"data-tab-location":G}=k.props,Q=a(k,A,y.current);return y.current.push(Q),Mo(Xc,{ariaControls:H,"data-icon":i(k,A),id:`${H}-tab`,index:A,label:Q,location:G,closeable:O,editable:w},H)}),I=E(),L=h==="left"||h==="right",T=L?"vertical":"horizontal";return au("div",{className:bi(Lo,n,{[`${Lo}-horizontal`]:L}),style:g,id:f,ref:b,children:[h?Mo(Jc,{...t,activeTabIndex:(P=t==null?void 0:t.activeTabIndex)!=null?P:I===null?-1:o,allowDragDrop:t.allowDragDrop!==!1,animateSelectionThumb:!0,className:bi("vuuTabHeader",R),"aria-label":"data tabs",keyBoardActivation:l,onActiveChange:m,onAddTab:c,onCloseTab:d,onExitEditMode:v,onMoveTab:p,orientation:T,children:S()}):null,Mo("div",{"aria-labelledby":`${f}-${o}`,className:`${Lo}-tabPanel`,role:"tabpanel",children:I})]})});Io.displayName="Stack";import{useId as su}from"@vuu-ui/vuu-utils";import lu,{useCallback as ko,useRef as cu}from"react";import{jsx as yi}from"react/jsx-runtime";var uu=()=>yi(De,{resizeable:!0,style:{flexGrow:1,flexShrink:0,flexBasis:0}}),vi=e=>{var R;let t=cu(null),o=ee(),{loadState:r}=Ee(),{createNewChild:n,id:i,onTabSelectionChanged:a,path:s,...l}=e,{children:c}=e,p=su(i),[d]=gt(p,t,s),u=pn(),m=(R=n!=null?n:u)!=null?R:uu,h=v=>{s&&(o({type:"switch-tab",id:p,path:s,nextIdx:v}),a==null||a(v))},g=ko(v=>{if(Array.isArray(c)){let{props:{"data-path":E,path:S=E}}=c[v];o({type:"remove",path:S})}},[c,o]),b=ko(()=>{if(s){let v=lu.Children.count(c),E=m(v);o({type:"add",path:s,component:E})}},[c,m,o,s]),f=ko((v,E)=>{s&&o({fromIndex:v,toIndex:E,path:s,type:"move-child"})},[o,s]);return yi(Io,{...l,id:p,getTabLabel:(v,E,S)=>{let{id:I,title:L}=v.props;return r(I,"view-title")||L||Re(v,E,S)},onMouseDown:async(v,E)=>{let S;await d({type:"mousedown",index:E,preDragActivity:async()=>new Promise(T=>{console.log("preDragActivity: Ok, gonna release the drag"),S=T})},v)&&(S==null||S(void 0))},onMoveTab:f,onAddTab:b,onTabClose:g,onTabEdit:(v,E)=>{o({type:"set-title",path:`${s}.${v}`,title:E})},onTabSelectionChanged:h,ref:t})};vi.displayName="Stack";z("Stack",vi,"container");import{forwardCallbackProps as Ou}from"@vuu-ui/vuu-ui-controls";import{useId as Hu}from"@vuu-ui/vuu-utils";import Oi from"clsx";import zu,{useMemo as Bu,useRef as Nu}from"react";import{isValidNumber as ku}from"@vuu-ui/vuu-utils";import{useCallback as Oo,useRef as Au}from"react";import{useControlled as mu}from"@salt-ds/core";import{dispatchMouseEvent as fu,getClosest as hu,getElementDataIndex as gu,getFocusableElement as bu}from"@vuu-ui/vuu-utils";import{useCallback as j,useRef as Ao,useState as vu}from"react";import{ArrowDown as Si,ArrowUp as yu,ArrowLeft as wu,ArrowRight as xu,Home as xi,End as Ei}from"@vuu-ui/vuu-utils";import{getElementDataIndex as pu}from"@vuu-ui/vuu-utils";var du=(e,t)=>{if(e){let o=e.querySelector(`[data-index]:has(${t})`);return pu(o)}return-1};var wi=e=>du(e,".vuuEditableLabel-editing");var Di={horizontal:{[xi]:"start",[Ei]:"end",[wu]:"bwd",[xu]:"fwd"},vertical:{[xi]:"start",[Ei]:"end",[yu]:"bwd",[Si]:"fwd"}},Pi=e=>e!==null&&e.dataset.index==="overflow",Eu=(e,t,o,r,n)=>{if(e){let i=t==="bwd"&&r>0,a=t==="fwd"&&r<o,s=i||a,l=Ye(e,r,!0),c=n&&!Ti(l),p=!n&&Pi(l);return n&&Ti(l),s&&(c||p)}else return!1},Ru=(e,t="horizontal")=>Di[t][e]!==void 0,Tu=e=>e===Si;function Ri(e,t,o){return t==="start"?0:t==="end"?e-1:t==="bwd"?o>0?o-1:o:o===null?0:o===e-1?o:o+1}var Ti=e=>e!==null&&!e.classList.contains("wrapped"),Li=e=>Array.from(e.querySelectorAll("[data-index]")),Su=e=>e===null?-1:Li(e).map(r=>r.dataset.index).indexOf("overflow"),Ye=(e,t,o=!1)=>{if(e!==null){let n=Li(e)[t];return!o&&Pi(n)?null:n}return null},Mi=({containerRef:e,defaultHighlightedIdx:t=-1,highlightedIdx:o,onNavigateOutOfBounds:r,orientation:n})=>{let i=Ao(!1),a=Ao(-1),[s,l]=vu(!1),[c,p]=mu({controlled:o,default:t,name:"UseKeyboardNavigation"}),d=j(T=>{p(a.current=T)},[p]),u=Ao(!1),m=j((T,P=!1,k,A=70)=>{console.log(`focus item ${T}`),d(T),k===!0&&!u.current&&(u.current=!0);let O=()=>{let H=Ye(e.current,T,!0);if(H){let G=bu(H);G==null||G.focus()}};P?O():setTimeout(O,A)},[e,d]),h=T=>{if(a.current===-1){if(T.target.tabIndex===0){let P=gu(hu(T.target,"index"));d(P)}else if(T.target.tabIndex!==-1){let P=wi(e.current);P!==-1&&requestAnimationFrame(()=>{d(P)})}}},g=j(()=>{var T,P;return(P=(T=e.current)==null?void 0:T.querySelectorAll("[data-index]").length)!=null?P:0},[e]),b=j((T="fwd",P)=>{var Q;let k=g(),A=typeof P=="number"?P:k,O=Ri(k,T,A),H=T==="start"?"fwd":T==="end"?"bwd":T,G=((Q=e.current)==null?void 0:Q.querySelector(".vuuOverflowContainer-wrapContainer-overflowed"))!=null;for(;Eu(e.current,H,k,O,G);){let Le=Ri(k,H,O);if(Le===O)return A;O=Le}return O},[e,g]),f=j(T=>{let P=Di[n][T.key],k=b(P,c);console.log(`highlightedIdx = ${c}, nextIdx = ${k} `),k!==c?m(k,!0):r==null||r(P==="bwd"?"start":"end")},[n,b,c,m,r]),y=j(()=>{let T=Ye(e.current,c);return T?T.querySelector(".vuuPopupMenu")!=null:!1},[e,c]),x=j(()=>{let T=Ye(e.current,c);return T?T.querySelector(".vuuEditableLabel-input")!=null:!1},[e,c]),w=j(()=>{let T=Ye(e.current,c),P=T==null?void 0:T.querySelector(".vuuPopupMenu");return P&&fu(P,"click"),!1},[e,c]),R=j(T=>{g()>0&&Ru(T.key,n)?(T.preventDefault(),u.current||(u.current=!0),f(T)):Tu(T.key)&&y()&&!x()&&w()},[w,g,y,x,f,n]),v=(T,P)=>{d(P)},E=j(()=>{s||(l(!0),i.current?i.current=!1:u.current=!0)},[s]),S=j(()=>{s||(i.current=!0),u.current=!1},[s]),I=j(T=>{if((T==null?void 0:T.type)==="escape"){let P=Su(e.current);P!==-1&&m(P)}},[e,m]);return{containerProps:{onBlur:T=>{let P=T.target.closest(".vuuToolbar"),k=T.relatedTarget;P&&!(P!=null&&P.contains(k))&&(d(-1),l(!1))},onMouseDownCapture:S,onFocus:E,onMouseLeave:()=>{u.current=!0,d(-1),i.current=!1}},focusVisible:u.current?c:-1,focusIsWithinComponent:s,highlightedIdx:c,focusableIdx:0,focusItem:m,onClick:v,onFocus:h,onKeyDown:R,onOverflowMenuClose:I,setHighlightedIdx:d}};import{isSelectableElement as Ci,getClosestIndexItem as Du}from"@vuu-ui/vuu-utils";import{allowMultipleSelection as Pu,deselectionIsAllowed as Ii,selectionIsDisallowed as Lu,useControlled as Mu}from"@vuu-ui/vuu-ui-controls";import{useCallback as Ze}from"react";var Cu=["Enter"," "],Iu={},ki=({containerRef:e,defaultSelected:t,highlightedIdx:o,itemQuery:r,onSelectionChange:n,selected:i,selectionStrategy:a})=>{let[s,l,c]=Mu({controlled:i,default:t!=null?t:[],name:"useSelection",state:"selected"}),p=Ze(b=>Cu.includes(b.key),[]),d=Ze((b,f=!1)=>{let y=Pu(a,f)?s.concat(b):[b];l(y),n==null||n(y)},[n,s,a,l]),u=Ze((b,f=!1)=>{let y=a==="deselectable"||a==="multiple-special-key"&&!f?[]:s.filter(x=>x!==b);l(y),n==null||n(y)},[n,s,a,l]),m=Ze(b=>{p(b)&&Ci(b.target)&&(s.includes(o)?Ii(a)&&(b.stopPropagation(),b.preventDefault(),u(o,b.shiftKey)):(b.stopPropagation(),b.preventDefault(),d(o,b.shiftKey)))},[p,s,o,a,d,u]),h=Ze((b,f)=>{let y=Du(b.target);Ci(y)&&(s.includes(f)?Ii(a)&&u(f,b.shiftKey):d(f,b.shiftKey))},[u,d,s,a]),g=Lu(a)?Iu:{onClick:h,onKeyDown:m};return{activateItem:d,itemHandlers:g,isControlled:c,selected:s}};var Ai=({activeItemIndex:e,defaultActiveItemIndex:t,containerRef:o,itemQuery:r="vuuToolbarItem",onActiveChange:n,onNavigateOutOfBounds:i,orientation:a,selectionStrategy:s})=>{let l=Au(e),{focusItem:c,highlightedIdx:p,onClick:d,onKeyDown:u,setHighlightedIdx:m,...h}=Mi({containerRef:o,onNavigateOutOfBounds:i,orientation:a}),{activateItem:g,itemHandlers:{onClick:b,onKeyDown:f},selected:y}=ki({containerRef:o,defaultSelected:t,highlightedIdx:p,itemQuery:r,onSelectionChange:n,selected:e,selectionStrategy:s});l.current=y;let x=Oo(E=>{var L;let I=E.target.closest("[data-index]");if(I){let T=parseInt((L=I.dataset.index)!=null?L:"-1");T!==-1&&ku(T)&&(d(E,T),b==null||b(E,T))}},[d,b]),w=Oo(E=>{u(E),E.defaultPrevented||f==null||f(E)},[u,f]),R=Oo(E=>{let S=parseInt(E.index);isNaN(S)||(g(S),c(S))},[c,g]),v={onClick:x,onFocus:h.onFocus,onKeyDown:w};return{activeItemIndex:y,focusableIdx:h.focusableIdx,focusVisible:h.focusVisible,containerProps:{PopupMenuProps:{onKeyDown:w,onMenuClose:h.onOverflowMenuClose},...h.containerProps,onSwitchWrappedItemIntoView:R},itemProps:v}};import{jsx as Fu}from"react/jsx-runtime";var Xe="vuuToolbar",gw=({activeItemIndex:e,alignItems:t="start",defaultActiveItemIndex:o,children:r,className:n,id:i,onActiveChange:a,onNavigateOutOfBounds:s,orientation:l="horizontal",selectionStrategy:c="none",showSeparators:p=!1,...d})=>{let u=Nu(null),{activeItemIndex:m,focusableIdx:h,focusVisible:g,itemProps:b,...f}=Ai({activeItemIndex:e,defaultActiveItemIndex:o,containerRef:u,onActiveChange:a,onNavigateOutOfBounds:s,orientation:l,selectionStrategy:c}),y=Hu(i),x=Bu(()=>ve(r).map((w,R)=>{let{id:v=`${y}-tab-${R}`,className:E,...S}=w.props,I=m.includes(R);return zu.cloneElement(w,{...Ou(S,b),className:Oi("vuuToolbarItem",E),"data-overflow-priority":I?"1":void 0,id:v,key:R,"aria-selected":I,tabIndex:h===R?0:-1})}),[m,r,h,y,b]);return Fu(fi,{...d,...f.containerProps,className:Oi(n,Xe,`${Xe}-${l}`,{[`${Xe}-alignCenter`]:t==="center",[`${Xe}-alignEnd`]:t==="end",[`${Xe}-withSeparators`]:p}),...d,ref:u,children:x})};import Hi,{useState as zi}from"react";import{jsx as Ho,jsxs as Bi}from"react/jsx-runtime";var Ew=({children:e})=>{let[o,r]=zi(e),[n,i]=zi(e),a=l=>{let c=Qo(o,l);i(c)},s=(l,c)=>{console.log(`change ${l} -> ${c}`);let p=Hi.cloneElement(n,{style:{...n.props.style,[l]:c}});i(p),r(Hi.cloneElement(o,{},p))};return Bi("div",{"data-design-mode":`${!1}`,children:[o,Ho("br",{}),Bi("div",{style:{display:"flex"},children:[Ho(Ni,{height:300,managedStyle:n.props.style,width:300,onChange:s,style:void 0}),Ho(Fi,{layout:o,onSelect:a,style:{width:300,height:300,backgroundColor:"#ccc"}})]})]})};import{FormField as It,Input as kt}from"@salt-ds/core";import{jsx as $,jsxs as Bo}from"react/jsx-runtime";var No={},$u={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"}},zo=({feature:e,children:t,style:o,onChange:r})=>Bo("div",{className:`LayoutBox layout-${e} layout-outer`,children:[Bo("div",{className:"layout-top",children:[$("span",{className:"layout-title",children:e}),$(It,{className:"layout-input",style:{width:30},children:$(kt,{value:o.top,onChange:(n,i)=>r(e,"top",i)})})]}),Bo("div",{className:"layout-inner",children:[$("div",{className:"layout-left",children:$(It,{className:"layout-input",style:{width:30},children:$(kt,{value:o.left,onChange:(n,i)=>r(e,"left",i)})})}),t,$("div",{className:"layout-right",children:$(It,{className:"layout-input",style:{width:30},children:$(kt,{value:o.right,onChange:(n,i)=>r(e,"right",i)})})})]}),$("div",{className:"layout-bottom",children:$(It,{className:"layout-input",style:{width:30},children:$(kt,{value:o.bottom,onChange:(n,i)=>r(e,"bottom",i)})})})]}),Mw={margin:!0,marginTop:!0,marginRight:!0,marginBottom:!0,marginLeft:!0},Cw={padding:!0,paddingTop:!0,paddingRight:!0,paddingBottom:!0,paddingLeft:!0},Iw={border:!0,borderColor:!0,borderWidth:!0,borderTopWidth:!0,borderRightWidth:!0,borderBottomWidth:!0,borderLeftWidth:!0},At="(\\d+)(?:px)?",Wu=`^(?:${At}(?:\\s${At}(?:\\s${At}(?:\\s${At})?)?)?)$`,$i=new RegExp(Wu),Vu=/^(?:(\d+)(?:px)\ssolid\s([a-zA-Z,0-9().]+))$/,Ni=({height:e,managedStyle:t,onChange:o,style:r,width:n})=>{let i=Wi(t),a=(x,w,R)=>{let v=parseInt(R||"0",10),E=$u[x][w];o(E,v)},{marginTop:s=0,marginRight:l=0,marginBottom:c=0,marginLeft:p=0}=i,{borderTopWidth:d=0,borderRightWidth:u=0,borderBottomWidth:m=0,borderLeftWidth:h=0}=i,{paddingTop:g=0,paddingRight:b=0,paddingBottom:f=0,paddingLeft:y=0}=i;return $("div",{className:"LayoutConfigurator",style:{width:n,height:e,...r},children:$(zo,{feature:"margin",style:{top:s,right:l,bottom:c,left:p},onChange:a,children:$(zo,{feature:"border",style:{top:d,right:u,bottom:m,left:h},onChange:a,children:$(zo,{feature:"padding",style:{top:g,right:b,bottom:f,left:y},onChange:a,children:$("div",{className:"layout-content"})})})})})};function kw(e=No,t=No){let{margin:o,marginTop:r,marginRight:n,marginBottom:i,marginLeft:a,padding:s,paddingTop:l,paddingRight:c,paddingBottom:p,paddingLeft:d,...u}=e;if(typeof o=="number")u.marginTop=u.marginRight=u.marginBottom=u.marginLeft=o;else if(typeof o=="string"){let m=$i.exec(o);if(m===null)console.error(`Invalid css value for margin '${o}'`);else{let[,h,g,b,f]=m,y=h&&g&&b;y&&f?(u.marginTop=parseInt(h,10),u.marginRight=parseInt(g,10),u.marginBottom=parseInt(b,10),u.marginLeft=parseInt(f,10)):y?(u.marginTop=parseInt(h,10),u.marginRight=u.marginLeft=parseInt(g,10),u.marginBottom=parseInt(b,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 r=="number"&&(u.marginTop=r),typeof n=="number"&&(u.marginRight=n),typeof i=="number"&&(u.marginBottom=i),typeof a=="number"&&(u.marginLeft=a),typeof s=="number")u.paddingTop=u.paddingRight=u.paddingBottom=u.paddingLeft=s;else if(typeof s=="string"){let m=$i.exec(s);if(m===null)console.error(`Invalid css value for padding '${s}'`);else{let[,h,g,b,f]=m,y=h&&g&&b;y&&f?(u.paddingTop=parseInt(h,10),u.paddingRight=parseInt(g,10),u.paddingBottom=parseInt(b,10),u.paddingLeft=parseInt(f,10)):y?(u.paddingTop=parseInt(h,10),u.paddingRight=u.paddingLeft=parseInt(g,10),u.paddingBottom=parseInt(b,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 d=="number"&&(u.paddingLeft=d),Wi(u,t)}function Wi(e=No){let t={...e},o,{border:r,borderWidth:n,borderTopWidth:i,borderRightWidth:a,borderBottomWidth:s,borderLeftWidth:l,borderColor:c,margin:p,marginTop:d,marginRight:u,marginBottom:m,marginLeft:h,padding:g,paddingTop:b,paddingRight:f,paddingBottom:y,paddingLeft:x,...w}=t,R={},v={};if(typeof p=="number"&&(t.marginTop=t.marginRight=t.marginBottom=t.marginLeft=p,R={marginTop:p,marginRight:p,marginBottom:p,marginLeft:p}),typeof g=="number"&&(t.paddingTop=t.paddingRight=t.paddingBottom=t.paddingLeft=g,v={paddingTop:g,paddingRight:g,paddingBottom:g,paddingLeft:g}),r||n||i||a||s||l){typeof r=="string"&&(o=Vu.exec(r))&&([,n,c]=o,n=parseInt(n,10)),n&&(i=i===void 0?n:i,a=a===void 0?n:a,s=s===void 0?n:s,l=l===void 0?n:l),c=c||"black";let E=`
|
|
18
|
-
${c} ${l||0}px ${
|
|
19
|
-
${c} ${-
|
|
17
|
+
`,document.body.insertBefore(t,e)}}var Te=class{constructor(){this.currentPath=null;this.tabMode=null;zi()}prepare(t,o="full-view"){document.body.classList.add("drawing"),this.currentPath=null,this.tabMode=o;let r=this.getPoints(0,0,0,0),n=Uo(r),a=document.getElementById("vuu-drop-outline");a==null||a.setAttribute("d",n),this.currentPath=n}clear(){Se=null,Ue(),document.body.classList.remove("drawing"),At.hidePopup()}get hoverDropTarget(){return Se}getPoints(t,o,r,n,a=0,i=0,s=0){let l=this.tabMode==="tab-only";if(i===0)return[[t,o+s],[t,o+s],[t,o],[t+i,o],[t+i,o],[t+r,o],[t+r,o+n],[t,o+n]];if(l){let c=a;return[[c,o],[c,o],[c+i,o],[c+i,o],[c+i,o+s],[c+i,o+s],[c,o+s],[c,o+s]]}else return a===0?[[t,o+s],[t,o+s],[t,o],[t+i,o],[t+i,o+s],[t+r,o+s],[t+r,o+n],[t,o+n]]:[[t,o+s],[t+a,o+s],[t+a,o],[t+a,o],[t+a,o+s],[t+r,o+s],[t+r,o+n],[t,o+n]]}draw(t,o){let n=zt;if(Se!==null)this.drawTarget(Se);else if(zt=t.nextDropTarget!=null,t.pos.tab?Ii(t):X&&Ue(),this.drawTarget(t,o),zt){let[a,i,s]=Go(t);{let l=Bi(Wo,{dropTarget:t,onHover:Ci,orientation:s});At.showPopup({left:a,top:i,component:l})}}else At.hidePopup()}drawTarget(t,o){let n=t.getTargetDropOutline(6,o);if(n){let{l:a,t:i,r:s,b:l,tabLeft:c,tabWidth:u,tabHeight:d,guideLines:p}=n,m=s-a,h=l-i;if(this.currentPath){let R=document.getElementById("vuu-drop-outline");R==null||R.setAttribute("d",this.currentPath)}let g=this.getPoints(a,i,m,h,c,u,d),y=Uo(g),f=document.getElementById("hw-drop-outline-animate");f==null||f.setAttribute("to",y),f==null||f.beginElement(),this.currentPath=y;let x=document.getElementById("hw-drop-guides");x==null||x.setAttribute("d",Ai(p))}}},Jo="transition:margin-left .4s ease-out;margin-left: 63px",Yo="transition:margin-left .4s ease-out;margin-left: 0px";function Ii(e){var s,l;let{AFTER:t,BEFORE:o}=De,{clientRect:{Stack:r},pos:{tab:n}}=e,{id:a}=e.component.props,i=null;if(r&&n&&n.positionRelativeToTab!==t){let c=n.positionRelativeToTab===o?1:2,u=`:scope .hwTabstrip > .hwTabstrip-inner > .hwTab:nth-child(${n.index+c})`;i=(s=document.getElementById(a))==null?void 0:s.querySelector(u),i?(X===null||X!==i)&&(i.style.cssText=Jo,X&&(X.style.cssText=Yo),X=i):Ue()}else if((n==null?void 0:n.positionRelativeToTab)===o){if(X===null){let c=".vuuHeader-title";i=(l=document.getElementById(a))==null?void 0:l.querySelector(c),i.style.cssText=Jo,X=i}}else Ue()}function Ue(){X&&(X.style.cssText=Yo,X=null)}var K,Pe,oe,Xo,jo,ce,Je,ue=null,Bt,qo,Ze,Qo,It,Ye=null,Oi=3,Xe=new Te,Zo=.4;function Ni(e,t){return t?B(e,t):Q(e,o=>o.dropTarget)}var Ot={handleMousedown(e,t,o={}){K=t,qo=o,Xo=e.clientX,jo=e.clientY,It=o.dragThreshold===void 0?Oi:o.dragThreshold,It===0?K(e,0,0):(window.addEventListener("mousemove",je,!1),window.addEventListener("mouseup",qe,!1),Ye=window.setTimeout(()=>{window.removeEventListener("mousemove",je,!1),window.removeEventListener("mouseup",qe,!1),K==null||K(e,0,0)},500)),e.preventDefault()},initDrag(e,t,{top:o,left:r,right:n,bottom:a},i,s,l,c){return{drag:Pe,drop:oe}=s,Fi(e,t,{top:o,left:r,right:n,bottom:a},i,l,c)}};function je(e){let r=e.clientX-Xo,n=e.clientY-jo;Math.max(Math.abs(r),Math.abs(n))>It&&(window.removeEventListener("mousemove",je,!1),window.removeEventListener("mouseup",qe,!1),K==null||K(e,r,n),K=null)}function qe(){Ye&&(window.clearTimeout(Ye),Ye=null),window.removeEventListener("mousemove",je,!1),window.removeEventListener("mouseup",qe,!1)}function Fi(e,t,o,r,n,a){ce=Ni(e,t);let{"data-path":i,path:s=i}=D(ce);a&&(Bt=a.map(p=>Q(e,m=>m.id===p)).map(p=>p.props.path)),Ze=he.measure(ce,a);let l=Ze[s];Je=new We(l,r.x,r.y,o,n);let c=Math.round(Je.x.mousePct*100),u=Math.round(Je.y.mousePct*100);return window.addEventListener("mousemove",Ko,!1),window.addEventListener("mouseup",tr,!1),window.addEventListener("keydown",er,!1),Qo=!1,Xe.prepare(o,"tab-only"),qo.DoNotTransform?"transform:none":`transform:scale(${Zo},${Zo});transform-origin:${c}% ${u}%;`}function Ko(e){let t=e.clientX,o=e.clientY,r=Je,n=ue,a,i,s;r.update("x",t)&&(i=r.x.pos),r.update("y",o)&&(s=r.y.pos),i===void 0&&s===void 0||Pe==null||Pe(i,s),!(Qo||ce===void 0)&&(r.inBounds()?a=Mt(t,o,ce,Ze,r.hasIntrinsicSize(),Bt):a=Mt(r.dropX(),r.dropY(),ce,Ze),n&&(a==null||a.box!==n.box)&&(ue=null),a&&(Xe.draw(a,r),ue=a))}function er(e){e.key==="Escape"&&(ue=null,or())}function tr(){or()}function or(){if(ue){let e=Xe.hoverDropTarget||ge.getActiveDropTarget(ue);oe==null||oe(e),ue=null}else oe==null||oe();Pe=null,oe=null,ce=void 0,Xe.clear(),Bt=void 0,window.removeEventListener("mousemove",Ko,!1),window.removeEventListener("mouseup",tr,!1),window.removeEventListener("keydown",er,!1)}import Hi from"clsx";import{forwardRef as $i}from"react";import{jsx as Vi}from"react/jsx-runtime";var rr=$i(function({children:t,className:o,dropTarget:r,resizeable:n,...a},i){let s=Hi("DraggableLayout",o);return Vi("div",{className:s,ref:i,...a,children:t})}),nr="DraggableLayout";rr.displayName=nr;I(nr,rr,"container");import{useForkRef as Ns}from"@salt-ds/core";import Fs from"clsx";import{forwardRef as Hs}from"react";import{getUniqueId as Ms}from"@vuu-ui/vuu-utils";import $e,{useCallback as mt,useMemo as vn,useRef as ft,useState as ks}from"react";import ys from"clsx";import{Button as ms}from"@salt-ds/core";import{useMemo as fs,useState as hs}from"react";import{useCallback as Ie,useState as Oa}from"react";import{useCallback as Zt,useContext as Xt,useEffect as Aa,useRef as $r,useState as za}from"react";import{uuid as ir}from"@vuu-ui/vuu-utils";import ar from"react";var _i={"data-placeholder":!0,"data-resizeable":!0},Qe={},re="auto",Nt={flexBasis:0,flexGrow:1,flexShrink:1,height:re,width:re},sr={height:"width",width:"height"},lr=(e="row")=>e==="row"?["width","height","column"]:["height","width","row"],Gi=e=>typeof e=="string"&&e.endsWith("%"),U=e=>{let{style:{width:t=re,height:o=re}=Qe}=e.props,r=typeof o=="number",n=typeof t=="number";return r&&n?{height:o,width:t}:r?{height:o}:n?{width:t}:void 0};function Ft(e,t,o){let r=sr[t],{style:{[r]:n=re,...a}=Qe}=e.props;return o&&o[t]?{...a,...Nt,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...a,...Nt,[r]:n}}function cr(e){let{style:{flex:t,flexGrow:o,flexShrink:r,flexBasis:n}=Qe}=e.props;return typeof t=="number"||n===0&&o===1&&r===1?!0:typeof n!="number"}function Ht(e,t,o){let r=sr[t],{style:{[t]:n=re,[r]:a=re,...i}=Qe}=e.props;return n!==re?Gi(n)?{flexBasis:0,flexGrow:1,flexShrink:1,[t]:void 0,[r]:a}:{flexBasis:n,flexGrow:0,flexShrink:0,[t]:n,[r]:a}:o&&o[t]?{...i,...Nt,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...i,[r]:a}}function Le(e,t,o,r,n){let a=[],i=0,s;if(r&&n){let u,[d,p,m,h]=n;[u,s]=t==="column"?[p-r.top,r.bottom-h]:[d-r.left,r.right-m],u&&a.push(j(`${o}.${i++}`,u,{flexGrow:0,flexShrink:0}))}else s=!0;let{version:l=0,style:c}=D(e);return a.push(O(e,`${o}.${i++}`,{version:l+1,style:{...c,flexBasis:"auto",flexGrow:0,flexShrink:0}})),s&&a.push(j(`${o}.${i++}`,0,void 0,{[`data-${t}-placeholder`]:!0})),$t(t,{resizeable:!1,style:{flexBasis:"auto"}},a,o)}var Wi=(e,t)=>{if(!t)return e===0?1:0};function $t(e,t,o,r){let n=ir(),{flexFill:a,style:i,resizeable:s=!0}=t,{flexBasis:l=a?void 0:"auto"}=i,c=Wi(l,a);return ar.createElement(ae.Flexbox,{id:n,key:n,path:r,flexFill:a,style:{...i,flexDirection:e,flexBasis:l,flexGrow:c,flexShrink:c},resizeable:s},o)}var Ui={flexGrow:1,flexShrink:1};function j(e,t,o,r){let n=ir();return ar.createElement("div",{..._i,...r,"data-path":e,id:n,key:n,style:{...Ui,...o,flexBasis:t}})}import Jt from"react";import{uuid as br}from"@vuu-ui/vuu-utils";import ke from"react";import{uuid as mr}from"@vuu-ui/vuu-utils";import Ce,{cloneElement as Ji}from"react";import{useCallback as ye}from"react";var $=new Map,J=new Map,ur=e=>$.get(e),pr=e=>$.has(e),dr=(e,t)=>$.set(e,t),be=()=>{let e=ye((i,s)=>{let l=J.get(i);if(l)return s!==void 0&&l[s]!==void 0?l[s]:s!==void 0?void 0:l},[]),t=ye((i,s,l)=>{if(s===void 0)J.set(i,l);else if(J.has(i)){let c=J.get(i);J.set(i,{...c,[s]:l})}else J.set(i,{[s]:l})},[]),o=ye((i,s)=>{if(J.has(i)){if(s===void 0)J.delete(i);else if(J.get(i)[s]){let{[s]:c,...u}=J.get(i);Object.keys(u).length>0?J.set(i,u):J.delete(i)}}},[]),r=ye((i,s)=>{let l=$.get(i);if(l)return s!==void 0?l[s]:l},[]),n=ye((i,s,l)=>{if(s===void 0)$.set(i,l);else if($.has(i)){let c=$.get(i);$.set(i,{...c,[s]:l})}else $.set(i,{[s]:l})},[]),a=ye((i,s)=>{if($.has(i)){if(s===void 0)$.delete(i);else if($.get(i)[s]){let{[s]:c,...u}=$.get(i);Object.keys(u).length>0?$.set(i,u):$.delete(i)}}},[]);return{loadSessionState:e,loadState:r,saveSessionState:t,saveState:n,purgeState:a,purgeSessionState:o}};var fr=e=>e.flexDirection==="column"?["height","width"]:["width","height"],Yi={},Me=(e,t="0")=>{let[o,r]=Ke(T(e),e.props,t);return Ce.cloneElement(e,o,r)},_t=(e,t)=>{let o=T(e),[r,n]=Ke(o,e.props,"0",void 0,t);return Ji(e,r,n)},Iu=(e,t,o)=>{let[r,n]=Ke(e,t,"0",void 0,o);return{...t,...r,type:e,children:n}};function Zi(e,t,o="0",r=null,n){var g,y;let{active:a=0,"data-path":i,path:s=i,id:l,style:c}=D(n),u=T(n)===e&&o===s,d=u?l:(g=t.id)!=null?g:mr(),p=e==="Stack"?(y=t.active)!=null?y:a:void 0,m=d,h=u?c:ji(e,t,r);return Do(e)?{id:d,key:m,path:o,style:h,type:e,active:p}:{id:d,key:m,style:h,"data-path":o}}function Ke(e,t,o,r=null,n){var c,u;let a=Zi(e,t,o,r,n);if(t.layout&&!n)return[a,[pe(t.layout,`${o}.0`)]];let i=(u=n==null?void 0:n.children)!=null?u:(c=n==null?void 0:n.props)==null?void 0:c.children,l=t.dropTarget&&i?i:Xi(e,t.children,o,i);return[a,l]}function Xi(e,t,o="0",r){let n=Array.isArray(t)?t:Ce.isValidElement(t)?[t]:[];return H(e)?n.map((a,i)=>{let s=T(a),l=T(r==null?void 0:r[i]);if(!l||s===l){let[c,u]=Ke(s,a.props,`${o}.${i}`,e,r==null?void 0:r[i]);return Ce.cloneElement(a,c,u)}return r==null?void 0:r[i]}):t}var ji=(e,t,o)=>{let{style:r=Yi}=t;if(e==="Flexbox"&&(r={flexDirection:t.column?"column":"row",...r,display:"flex"}),r.flex){let{flex:n,...a}=r;r={...a,...St(typeof n=="number"?n:0)}}else o==="Stack"?r={...r,...St(1)}:o==="Flexbox"&&(r.width||r.height)&&r.flexBasis===void 0&&(r={...r,flexBasis:"auto",flexGrow:0,flexShrink:0});return r};function pe({id:e=mr(),type:t,children:o,props:r,state:n},a){let i=t.match(/^[a-z]/)?t:ae[t];if(i===void 0)throw Error(`layoutUtils unable to create component from JSON, unknown type ${t}`);return n&&dr(e,n),Ce.createElement(i,{id:e,...r,key:e,path:a},o?o.map((s,l)=>pe(s,`${a}.${l}`)):void 0)}function hr(e){return gr(e)}function gr(e){let t=T(e),{id:o,children:r,type:n,...a}=D(e),i=pr(o)?ur(o):void 0;return{id:o,type:t,props:qi(a),state:i,children:Ce.Children.map(r,gr)}}function qi(e){if(e){let{path:t,...o}=e,r={};for(let[n,a]of Object.entries(o))r[n]=Vt(a);return r}}function Vt(e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(Vt);if(typeof e=="object"&&e!==null){let t={};for(let[o,r]of Object.entries(e))t[o]=Vt(r);return t}}var yr=(e,t,o)=>{if(t&&o){let r=Y(o,t);if(r){let{id:n}=D(r),a=T(r);return{parentContainerId:n,parentContainerType:a}}return{parentContainerType:"Stack",parentContainerId:"blah"}}},xe=(e,t,o=[])=>{var n,a,i;let r=(i=(n=e.props)==null?void 0:n.title)!=null?i:(a=e.props)==null?void 0:a["data-tab-title"];if(r)return r;{let s=t;do r=`Tab ${++s}`;while(o.includes(r));return r}};function xr(e,t){var i;let o=e.props.children,r=o.length,{index:n=-1,positionRelativeToTab:a="after"}=t.tab||{};return n===-1||n>=r?[o[r-1],"after"]:[(i=o[n])!=null?i:null,a]}function et(e,t,o){let{active:r,children:n=[],path:a}=D(e),i=P(t,"path"),{idx:s,finalStep:l}=Z(a,i,!0),[c,u]=l?ea(e,n,o):[r,n==null?void 0:n.map((p,m)=>m===s?et(p,t,o):p)],d=T(e)==="Stack"?Array.isArray(c)?c[0]:c:r;return ke.cloneElement(e,{active:d},u)}var Qi=(e,t,o,r)=>e==="Stack"?xe(t,o,r):void 0,Ki=e=>e.map(t=>t.props.title);function ea(e,t,o){let r=P(e,"path"),n=t==null?void 0:t.length,{id:a=br(),title:i=Qi(T(e),o,n!=null?n:0,Ki(t))}=D(o);return n?[n,t.concat(O(o,`${r}.${n}`,{id:a,key:a,title:i}))]:[0,[O(o,`${r}.0`,{id:a,title:i})]]}function tt(e,t,o,r,n,a,i){let{active:s,children:l,path:c}=D(e),u=P(t,"path"),{idx:d,finalStep:p}=Z(c,u),[m,h]=p?ta(e,l,d,o,r,n,a,i):[s,l.map((y,f)=>f===d?tt(y,t,o,r,n,a,i):y)],g=T(e)==="Stack"?m:s;return ke.cloneElement(e,{active:g},h)}function ta(e,t,o,r,n,a,i,s){let l=U(r);return l!=null&&l.width&&(l!=null&&l.height)?ra(e,t,o,r,n,i,s):vr(e,t,o,r,n,(a==null?void 0:a.width)||(a==null?void 0:a.height),i)}var oa=(e,t,{top:o,right:r,bottom:n,left:a},[i,s,l,c])=>{if(e==="column"&&t==="before")return s-o;if(e==="column")return n-c;if(e==="row"&&t==="before")return i-a;if(e==="row")return r-l};function ra(e,t,o,r,n,a,i){let{style:{flexDirection:s}}=D(e),[l,c,u]=lr(s),{[c]:d,[l]:p}=U(r),m=P(t[o],"path"),h=oa(s,n,a,i),[g,y]=d<a[c]?[Le(r,u,m,a,i),p]:[r,void 0],f=h?j(m,h,{flexGrow:0,flexShrink:0}):void 0;return d>a[c]&&(t=t.map(x=>{if(P(x,"placeholder"))return x;{let{[c]:R}=U(x);return R&&R<d?Le(x,u,P(x,"path")):x}})),vr(e,t,o,g,n,y,a,f)}function vr(e,t,o,r,n,a,i,s){let l=P(e,"path"),c=0,u=!t||t.length===0?[r]:t.reduce((d,p,m)=>{if(o===m){let[h,g]=na(e,p,r,i);n==="before"?s?d.push(s,g,h):d.push(g,h):s?d.push(h,g,s):d.push(h,g),c=d.indexOf(g)}else d.push(p);return d},[]).map((d,p)=>p<c?d:O(d,`${l}.${p}`));return[c,u]}function na(e,t,o,r){let n=br(),{version:a=0}=D(o);if(a+=1,T(e)==="Flexbox"){let[i]=fr(e.props.style),s=6,l={[i]:(r[i]-s)/2},c=Ht(t,i,l),u=Ht(o,i,l);return[ke.cloneElement(t,{style:c}),ke.cloneElement(o,{id:n,version:a,style:u})]}else{let{style:{left:i,top:s,flex:l,...c}={left:void 0,top:void 0,flex:void 0}}=D(o);return[t,ke.cloneElement(o,{id:n,version:a,style:{...c,flex:"1 1 0px"}})]}}import{cloneElement as sa}from"react";import ot from"react";var ve={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",LAYOUT_RESIZE:"layout-resize",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"};function wr(e,{target:t,replacement:o}){return Gt(e,t,o)}function Gt(e,t,o){let r=P(t,"path"),n=P(t,"resizeable"),{style:a}=D(t),i=Me(ot.cloneElement(o,{resizeable:n,style:{...a,...o.props.style}}),r);return V(e,t,i)}function V(e,t,o,r){if(e===t)return o;let{idx:n,finalStep:a}=Z(P(e,"path"),P(t,"path")),i=e.props.children.slice();return a?r?r===ve.MINIMIZE?i[n]=ia(e,i[n]):r===ve.RESTORE&&(i[n]=aa(i[n])):i[n]=o:i[n]=V(i[n],t,o,r),ot.cloneElement(e,void 0,i)}function ia(e,t){let{style:o}=D(e),{style:r}=D(t),{width:n,height:a,flexBasis:i,flexShrink:s,flexGrow:l,...c}=r,u={width:n,height:a,flexBasis:i,flexShrink:s,flexGrow:l},d={...c,flexBasis:0,flexGrow:0,flexShrink:0},p=o.flexDirection==="row"?"vertical":o.flexDirection==="column"?"horizontal":!1;return p?ot.cloneElement(t,{collapsed:p,restoreStyle:u,style:d}):t}function aa(e){let{style:t,restoreStyle:o}=D(e),{flexBasis:r,flexShrink:n,flexGrow:a,...i}=t,s={...i,...o};return ot.cloneElement(e,{collapsed:!1,style:s,restoreStyle:void 0})}function Rr(e,{fromIndex:t,path:o,toIndex:r}){let n=B(e,o,!0),{children:a}=D(n),i=la(a,t,r),s=sa(n,void 0,i);return V(e,n,s)}function la(e,t,o){let r=e.slice(),[n]=r.splice(t,1);return o===-1?r.concat(n):(r.splice(o,0,n),r)}var N={ADD:"add",DRAG_START:"drag-start",DRAG_DROP:"drag-drop",LAYOUT_RESIZE:"layout-resize",MAXIMIZE:"maximize",MINIMIZE:"minimize",MOVE_CHILD:"move-child",QUERY:"query",REMOVE:"remove",REPLACE:"replace",RESTORE:"restore",SAVE:"save",SET_PROP:"set-prop",SET_PROPS:"set-props",SET_TITLE:"set-title",SPLITTER_RESIZE:"splitter-resize",SWITCH_TAB:"switch-tab",TEAROUT:"tearout"},ip=e=>["switch-active-layout","open-layout","close-layout","rename-layout"].includes(e),ap=e=>["switch-active-tab","edit-feature-title","save-feature-props","remove-component","resize-component","drag-drop-operation"].includes(e);import de from"react";function Wt(e,{path:t}){let o=B(e,t),r=Y(e,t);if(r===null)return e;let{children:n}=D(r);if(n.length>1&&T(r)!=="Stack"&&Dr(n,t)){let{style:{flexBasis:a,display:i,flexDirection:s,...l}}=D(r),c=P(r,"path"),u=V(e,r,j(c,a,l));for(;(r=Y(u,c))&&P(r,"path")!=="0";){let{children:d}=D(r);if(Dr(d)){c=P(r,"path");let{style:{flexBasis:p,display:m,flexDirection:h,...g}}=D(r);u=V(e,r,j(c,p,g))}else if(da(d))u=Pr(e,r);else break}return u}return Sr(e,o)}function Sr(e,t){let o=D(e),{children:r,path:n,preserve:a}=o,{active:i,id:s}=o,{idx:l,finalStep:c}=Z(n,P(t,"path")),u=T(e),d=r.slice();if(c){if(d.splice(l,1),i!==void 0&&i>=l&&(i=Math.max(0,i-1)),d.length===0&&a&&u==="Stack"){let{path:p,style:{flexBasis:m}}=D(t),h=s==="main-tabs"?pe({props:{style:{flexGrow:1,flexShrink:1,flexBasis:m},title:"Tab 1"},type:"Placeholder"},p):j(p,m);d.push(h)}else if(d.length===1&&!a&&n!=="0"&&u.match(/Flexbox|Stack/))return ca(e,d[0]);!d.some(ua)&&d.some(Tr)&&(d=pa(d))}else d[l]=Sr(d[l],t);return d=d.map((p,m)=>O(p,`${n}.${m}`)),de.cloneElement(e,{active:i},d)}function ca(e,t){let o=T(e),{path:r,style:{flexBasis:n,flexGrow:a,flexShrink:i,width:s,height:l}}=D(e),c=O(t,r);if(r==="0")c=de.cloneElement(c,{style:{...t.props.style,width:s,height:l}});else if(o==="Flexbox"){let u=e.props.style.flexDirection==="column"?"height":"width",{style:{[u]:d,...p}}=c.props;c=de.cloneElement(c,{flexFill:void 0,style:{...p,flexGrow:a,flexShrink:i,flexBasis:n,width:s,height:l}})}return c}var ua=e=>e.props.style.flexGrow>0,Tr=e=>{let{width:t,height:o,flexGrow:r}=e.props.style;return r===0&&typeof t!="number"&&typeof o!="number"},pa=e=>e.map(t=>Tr(t)?de.cloneElement(t,{style:{...t.props.style,flexGrow:1}}):t),da=e=>{if(e&&e.length>0){let t=P(e[0],"placeholder"),o=!1;for(let r=1;r<e.length;r++){if(o=P(e[r],"placeholder"),t&&o)return!0;t=o}}},Pr=(e,t)=>{let{children:o,path:r}=D(e),{idx:n,finalStep:a}=Z(r,P(t,"path")),i=o.slice();return a?i[n]=ma(t):i[n]=Pr(i[n],t),i=i.map((s,l)=>O(s,`${r}.${l}`)),de.cloneElement(e,void 0,i)},ma=e=>{let{children:t}=D(e),o=[],r=[];for(let a=0;a<t.length;a++)P(t[a],"placeholder")?r.push(t[a]):(r.length===1?o.push(r.pop()):r.length>0&&(o.push(Er(r)),r.length=0),o.push(t[a]));r.length===1?o.push(r.pop()):r.length>0&&o.push(Er(r));let n=P(e,"path");return de.cloneElement(e,void 0,o.map((a,i)=>O(a,`${n}.${i}`)))},Er=([e,...t])=>{let o=P(e,"style"),{flexBasis:r,flexGrow:n,flexShrink:a}=o;for(let{props:{style:i}}of t)r+=i.flexBasis,n=Math.max(n,i.flexGrow),a=Math.max(a,i.flexShrink);return de.cloneElement(e,{style:{...o,flexBasis:r,flexGrow:n,flexShrink:a}})},Dr=(e,t)=>e.every(o=>P(o,"placeholder")||t&&P(o,"path")===t);import Ut from"react";function Lr(e,{path:t,size:o}){let r=B(e,t,!0),{style:n}=D(r),a={...n,width:o},i=Ut.cloneElement(r,{style:a});return V(e,r,i)}function Cr(e,{path:t,sizes:o}){let r=B(e,t,!0),{children:n,style:a}=D(r),i=a.flexDirection==="column"?"height":"width",s=fa(n,o,i),l=Ut.cloneElement(r,void 0,s);return V(e,r,l)}function fa(e,t,o){return e.map((r,n)=>{let{style:{[o]:a,flexBasis:i}}=D(r),s=t[n],{currentSize:l,flexBasis:c}=s,d=l!==void 0?s.currentSize:c;return d===void 0||a===d||i===d?r:Ut.cloneElement(r,{style:ha(r.props.style,o,d)})})}function ha(e,t,o){let r=typeof e[t]=="number",{flexShrink:n=1,flexGrow:a=1}=e;return{...e,[t]:r?o:"auto",flexBasis:r?"auto":o,flexShrink:n,flexGrow:a}}import{uuid as ga}from"@vuu-ui/vuu-utils";import rt from"react";var Mr=e=>{let[t]=T(e);return t===t.toLowerCase()};function Ae(e,t,o,r,n,a){let{children:i,path:s}=D(e),l=P(t,"path"),{idx:c,finalStep:u}=Z(s,l),d=u?ya(e,i,t,o,r,n,a):i.map((p,m)=>m===c?Ae(p,t,o,r,n,a):p);return rt.cloneElement(e,void 0,d)}function ya(e,t,o,r,n,a,i){let s=U(r);if(s!=null&&s.width&&(s!=null&&s.height)){if(a===void 0||i===void 0)throw Error("wrap-layout-element, updateChildren clientRect and dropRect must both be available");return xa(t,o,r,n,a,i)}return ba(e,t,o,r,n)}function ba(e,t,o,r,n){var v;let{version:a=0}=D(r),{path:i,title:s}=D(o),{type:l,flexDirection:c,showTabs:u}=Ar(n),[d,p,m]=va(l,o,r,c,n),h=kr(n),g=h?1:0,y={resizeable:!0,style:m,version:a+1},x={[Mr(o)?"data-resizeable":"resizeable"]:!0,style:p},R=l==="Stack"?{showTabs:u}:void 0,w=l==="Flexbox"?{splitterSize:(v=T(e)==="Flexbox"&&e.props.splitterSize)!=null?v:void 0}:void 0,E=ga(),b=rt.createElement(ae[l],{active:g,id:E,key:E,path:P(o,"path"),flexFill:P(o,"flexFill"),...w,...R,style:d,title:s,resizeable:P(o,"resizeable")},h?[O(o,`${i}.0`,x),Me(rt.cloneElement(r,y),`${i}.1`)]:[Me(rt.cloneElement(r,y),`${i}.0`),O(o,`${i}.1`,x)]);return t.map(S=>S===o?b:S)}function xa(e,t,o,r,n,a){let{flexDirection:i}=Ar(r),s=i==="column"?"row":"column",l=kr(r),[c,u,d,p]=a,[m,h]=i==="column"?[u-n.top,n.bottom-p]:[c-n.left,n.right-d],g=P(t,"path"),y=0,f=Mr(t)?"data-resizeable":"resizeable",x=[];m&&x.push(l?O(t,`${g}.${y++}`,{[f]:!0,style:{flexBasis:m,flexGrow:1,flexShrink:1}}):j(`${g}.${y++}`,m,{flexGrow:0,flexShrink:0})),x.push(Le(o,s,`${g}.${y++}`,n,a)),h&&x.push(l?j(`${g}.${y++}`,0):O(t,`${g}.${y++}`,{[f]:!0,style:{flexBasis:0,flexGrow:1,flexShrink:1}}));let R=$t(i,t.props,x,g);return e.map(w=>w===t?R:w)}function va(e,t,o,r,n){let a={...t.props.style,flexDirection:r},i=e==="Flexbox"&&r==="column"?"height":"width",s=Ft(o,i,n),l=Ft(t,i);return[a,l,s]}var kr=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 Ar(e){return e.position.Header?{type:"Stack",flexDirection:"column",showTabs:!0}:{type:"Flexbox",flexDirection:e.position.EastOrWest?"row":"column"}}var Nr=(e,t)=>{switch(t.type){case N.ADD:return Sa(e,t);case N.DRAG_DROP:return Da(e,t);case N.MAXIMIZE:return Ea(e,t);case N.REMOVE:return Wt(e,t);case N.REPLACE:return wr(e,t);case N.SET_PROP:return zr(e,t);case N.SET_PROPS:return Ra(e,t);case N.SET_TITLE:return zr(e,{type:"set-prop",path:t.path,propName:"title",propValue:t.title});case N.SPLITTER_RESIZE:return Cr(e,t);case N.LAYOUT_RESIZE:return Lr(e,t);case N.SWITCH_TAB:return wa(e,t);case N.MOVE_CHILD:return Rr(e,t);default:return e}},wa=(e,{path:t,nextIdx:o})=>{let r=B(e,t,!0),n=Jt.cloneElement(r,{active:o});return V(e,r,n)},zr=(e,{path:t,propName:o,propValue:r})=>{let n=B(e,t,!0),a=Jt.cloneElement(n,{[o]:r});return V(e,n,a)},Ra=(e,{path:t,props:o})=>{let r=B(e,t,!0),n=Jt.cloneElement(r,o);return V(e,r,n)},Ea=(e,{path:t,type:o})=>{if(t){let r=B(e,t,!0);return V(e,r,r,o)}else return e},Da=(e,t)=>{var h,g;let{draggedReactElement:o,dragInstructions:r,dropTarget:n}=t,a=n.component,{pos:i}=n,s=((h=i==null?void 0:i.position)==null?void 0:h.Header)&&T(a)==="Stack",{id:l,version:c}=D(o),u=U(o),d;if(s){let[y,f]=xr(a,i);y===void 0?d=et(e,a,o):d=tt(e,y,o,f)}else!u&&((g=i==null?void 0:i.position)!=null&&g.Centre)?d=Gt(e,a,o):d=Ta(e,n,o);if(r.DoNotRemove)return d;let p=Q(d,y=>y.id===l&&y.version===c),m=P(p,"path");return Wt(d,{path:m,type:"remove"})},Sa=(e,{path:t,component:o})=>et(e,B(e,t),o),Ta=(e,t,o)=>{let{component:r,pos:n,clientRect:a,dropRect:i}=t,s=r,l=P(s,"path");if(l==="0.0")return Ae(e,s,o,n);let c=Y(e,l);if(Ir(n,c)){let u=n.position.SouthOrEast?"after":"before";return tt(e,s,o,u,n,a,i)}if(!Ir(n,c))return Ae(e,s,o,n,a,i);if(H(T(c)))return Ae(e,s,o,n);throw Error(`no support right now for position = ${n.position}`)},Ir=(e,t)=>e.position.Centre?Or(t)||Br(t):e.position.NorthOrSouth?Br(t):e.position.EastOrWest?Or(t):!1,Br=e=>T(e)==="Flexbox"&&e.props.style.flexDirection==="column",Or=e=>T(e)==="Flexbox"&&e.props.style.flexDirection!=="column";import{createContext as Pa}from"react";var La=e=>console.log(`dispatch ${e.type}, have you forgotten to provide a LayoutProvider ?`),ze=Pa({dispatchLayoutProvider:La,version:-1});import{useCallback as nt,useRef as Yt}from"react";var Ca={},Fr=[0,0],Ma=(e,t,o)=>{let r=document.createElement("div");r.className="vuuSimpleDraggableWrapper",r.classList.add("vuuSimpleDraggableWrapper","salt-theme","salt-density-medium"),r.dataset.dragging="true";let n=o!=null?o:document.createElement("div");n.id=t,r.appendChild(n),document.body.appendChild(r);let a=`top:${e.top}px;left:${e.left}px;width:${e.width}px;height:${e.height}px;`;return[r,a,e.left,e.top]},ka=e=>{let{offsetParent:t}=e;if(t===null)return Fr;{let{left:o,top:r}=t.getBoundingClientRect();return[o,r]}},Hr=(e,t,o)=>{let r=Yt(),n=Yt(),a=Yt(),i=nt((u,d)=>{if(n.current&&a.current){let{dragOffsets:[p,m],targetPosition:h}=n.current,g=typeof u=="number"?u-p:h.left,y=typeof d=="number"?d-m:h.top;(g!==h.left||y!==h.top)&&(n.current.targetPosition.left=g,n.current.targetPosition.top=y,a.current.style.top=y+"px",a.current.style.left=g+"px")}},[]),s=nt(u=>{if(n.current){let{dragInstructions:d,payload:p,originalCSS:m}=n.current;u&&t({type:"drag-drop",draggedReactElement:p,dragInstructions:d,dropTarget:u}),a.current&&(!u&&d.DriftHomeIfNoDropTarget?(console.log("drift back to start"),document.body.removeChild(a.current)):d.RemoveDraggableOnDragEnd?document.body.removeChild(a.current):(a.current.style.cssText=m,delete a.current.dataset.dragging)),r.current=void 0,n.current=void 0,a.current=void 0}},[t]),l=nt(u=>{if(r.current){let{payload:d,dragContainerPath:p,dragElement:m,dragRect:h,instructions:g=Ca,path:y}=r.current,{current:f}=e,x={x:u.clientX,y:u.clientY},R=d!=null?d:B(f,y,!0),{id:w}=R.props,E=U(R),b="",v="",S="",C=-1,L=-1,M=Fr,z=document.getElementById(w);if(z===null)[z,v,C,L]=Ma(h,w,m);else{M=ka(z);let[A,k]=M,{width:G,height:W,left:ne,top:ie}=z.getBoundingClientRect();C=ne-A,L=ie-k,v=`width:${G}px;height:${W}px;left:${C}px;top:${L}px;z-index: 100;background-color:#ccc;opacity: 0.6;`,z.dataset.dragging="true",b=z.style.cssText}S=Ot.initDrag(e.current,p,h,x,{drag:i,drop:s},E),z.style.cssText=v+S,a.current=z,n.current={payload:R,originalCSS:b,dragRect:h,dragOffsets:M,dragInstructions:g,targetPosition:{left:C,top:L}}}},[i,s,e]);return nt(u=>{let{evt:d,...p}=u;r.current={...p,dragContainerPath:Et(e.current,o)},Ot.handleMousedown(d,l,p.instructions)},[l,o,e])};import{jsx as Wr}from"react/jsx-runtime";var Vr=e=>e.dropTarget,Ia=e=>["drag-drop","remove","set-title","splitter-resize","switch-tab"].includes(e.type),_r=e=>{switch(e.type){case"switch-tab":return e.id==="main-tabs"?"switch-active-layout":"switch-active-tab";case"save":return"save-feature-props";case"drag-drop":return"drag-drop-operation";case"remove":return"remove-component";case"splitter-resize":return"resize-component";case"set-title":return"edit-feature-title";default:throw Error("unknown layout action")}},Sd=()=>{let e=Ba();return Wr("div",{children:`Context: ${e} `})},Td=e=>{let{children:t,createNewChild:o,pathToDropTarget:r,layout:n,onLayoutChange:a}=e,i=$r(void 0),s=$r(t),[,l]=za(null),c=Zt((m,h)=>{if(a){let g=Q(m,Vr)||i.current,f=T(g)==="DraggableLayout"?D(g).children[0]:g,x=hr(f);a(x,h)}},[a]),u=Zt((m,h=!1)=>{let g=Nr(i.current,m);g!==i.current&&(i.current=g,l({}),!h&&Ia(m)&&c(g,_r(m)))},[l,c]),d=Zt(m=>{switch(m.type){case"drag-start":{p(m);break}case"save":{c(i.current,_r(m));break}case"query":if(m.query==="PARENT_CONTAINER")return yr(m.query,m.path,i.current);break;default:{u(m);break}}},[u,c]),p=Hr(i,d,r);return Aa(()=>{if(n){let m=Q(i.current,Vr);if(m){let h=Mo(m),g=pe(n,`${m.props.path}.0`),y=h?{type:N.REPLACE,target:h,replacement:g}:{type:N.ADD,path:m.props.path,component:g};u(y,!0)}else if(n.id===P(i.current,"id")){let h=pe(n,"0"),g={type:N.REPLACE,target:i.current,replacement:h};u(g,!0)}}},[u,n]),i.current===void 0?i.current=_t(t):t!==s.current&&(i.current=_t(t,i.current),s.current=t),Wr(ze.Provider,{value:{createNewChild:o,dispatchLayoutProvider:d,version:0},children:i.current})},q=()=>{let{dispatchLayoutProvider:e}=Xt(ze);return e},Gr=()=>{let{createNewChild:e}=Xt(ze);return e},Ba=()=>{let{version:e}=Xt(ze);return e};var it=(e,t,o,r)=>{var y;let{loadSessionState:n,purgeSessionState:a,purgeState:i,saveSessionState:s}=be(),[l,c]=Oa((y=n(e,"contributions"))!=null?y:[]),u=q(),d=Ie((f,x)=>{let R=l.concat([{location:f,content:x}]);s(e,"contributions",R),c(R)},[l,e,s]),p=Ie(()=>{a(e,"contributions"),c([])},[e,a]),m=Ie(()=>{let f=n(e,"data-source");f&&f.unsubscribe(),a(e),i(e),u({type:"remove",path:o})},[u,e,n,a,i,o]),h=Ie(async(f,x,R)=>{var E;f.stopPropagation();let w=(E=t.current)==null?void 0:E.getBoundingClientRect();return new Promise((b,v)=>{u({type:"drag-start",evt:f,path:x===void 0?o:`${o}.${x}`,dragRect:w,preDragActivity:R,dropTargets:r,resolveDragStart:b,rejectDragStart:v})})},[t,u,o,r]);return[Ie(async(f,x)=>{var w;let{type:R}=f;switch(R){case"maximize":case"minimize":case"restore":return u({type:R,path:(w=f.path)!=null?w:o});case"remove":return m();case"mousedown":return h(x,f.index,f.preDragActivity);case"add-toolbar-contribution":return d(f.location,f.content);case"remove-toolbar-contribution":return p();case"query":return u({type:R,path:f.path,query:f.query});default:return}},[u,o,m,h,d,p]),l]};import{useId as ns}from"@vuu-ui/vuu-utils";import{useForkRef as is}from"@salt-ds/core";import as from"clsx";import to,{forwardRef as ss,useCallback as ls,useMemo as cs,useRef as pn,useState as us}from"react";import{EditableLabel as Na}from"@vuu-ui/vuu-ui-controls";import{Button as Fa}from"@salt-ds/core";import{default as Ha,default as $a}from"clsx";import{cloneElement as Ur,useRef as Va,useState as Jr}from"react";import{jsx as Be}from"react/jsx-runtime";var jt="vuuHeader",Yr=({className:e,contributions:t,collapsed:o,closeable:r,onEditTitle:n,orientation:a="horizontal",style:i,title:s="Untitled"})=>{let l=Va(null),[c,u]=Jr(s),[d,p]=Jr(!1),m=Zr(),h=L=>m==null?void 0:m({type:"remove"},L),g=()=>{var L;(L=l.current)==null||L.focus()},y=L=>{L.stopPropagation()},x=Ha(jt,e,`${jt}-${o||a}`),R=()=>{p(!0)},w=L=>{L.key==="Enter"&&p(!0)},E=(L="",M="",z=!0,A=!1)=>{var k;p(!1),A?u(L):M!==L&&(u(M),n==null||n(M)),z===!1&&((k=l.current)==null||k.focus())},b=L=>{m==null||m({type:"mousedown"},L)},v=[],S=[],C=[];return t==null||t.forEach((L,M)=>{switch(L.location){case"pre-title":v.push(Ur(L.content,{key:M}));break;default:S.push(Ur(L.content,{key:M}))}}),s&&v.push(Be(Na,{className:`${jt}-title`,editing:d,value:c,onChange:u,onMouseDownCapture:g,onEnterEditMode:R,onExitEditMode:E,onKeyDown:w,ref:l,tabIndex:0},"title")),r&&C.push(Be(Fa,{"data-icon":"close",onClick:h,onMouseDown:y,variant:"secondary"},"close")),S.length>0&&v.push(Be("div",{className:"vuuTooltrayProxy","data-align":"end",children:S},"contributions")),C.length>0&&v.push(Be("div",{className:"vuuTooltrayProxy","data-align":"end",children:C},"actions")),Be("div",{className:$a("vuuToolbarProxy",x),style:i,onMouseDown:b,children:v})};import{useCallback as me,useMemo as Xr}from"react";var jr=({id:e,rootRef:t,path:o,dropTargets:r,title:n})=>{let a=q(),{loadState:i,loadSessionState:s,purgeState:l,saveState:c,saveSessionState:u}=be(),[d,p]=it(e,t,o,r),m=Xr(()=>{var b;return(b=i("view-title"))!=null?b:n},[i,n]),h=me(b=>{o&&a({type:"set-title",path:o,title:b})},[a,o]),g=Xr(()=>i(e),[e,i]),y=me(b=>i(e,b),[e,i]),f=me(b=>{l(e,b),a({type:"save"})},[e,a,l]),x=me((b,v)=>{c(e,v,b),a({type:"save"})},[e,a,c]),R=me(b=>s(e,b),[e,s]),w=me((b,v)=>u(e,v,b),[e,u]),E=me(({type:b,...v})=>{let{[b]:S}=v;x(S,b)},[x]);return{contributions:p,dispatchViewAction:d,load:y,loadSession:R,onConfigChange:E,onEditTitle:h,purge:f,restoredState:g,save:x,saveSession:w,title:m}};import{useCallback as on,useEffect as Ya,useRef as Kt,useState as Za}from"react";import{useCallback as _a,useLayoutEffect as qr,useRef as Ga}from"react";var Kr=["height","width"],im=["height"],am=["width"],fe=new WeakMap,en=(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}},Qr=new ResizeObserver(e=>{for(let t of e){let{target:o,contentRect:r}=t,n=fe.get(o);if(n){let{onResize:a,measurements:i}=n,s=!1;for(let[l,c]of Object.entries(i)){let u=en(o,r,l);u!==c&&(s=!0,i[l]=u)}s&&a&&a(i)}}});function at(e,t,o,r=!1){let n=Ga(t),a=_a(i=>{let s=i.getBoundingClientRect();return n.current.reduce((l,c)=>(l[c]=en(i,s,c),l),{})},[]);qr(()=>{let i=e.current,s=!1;async function l(){fe.set(i,{measurements:{}}),s=!1;let{fonts:c}=document;if(c&&await c.ready,!s){let u=fe.get(i);if(u){let d=a(i);u.measurements=d,Qr.observe(i),r&&o(d)}}}if(i){if(fe.has(i))throw Error("useResizeObserver attemping to observe same element twice");l()}return()=>{i&&fe.has(i)&&(Qr.unobserve(i),fe.delete(i),s=!0)}},[e,a,r,o]),qr(()=>{let i=e.current,s=fe.get(i);if(s){if(n.current!==t){n.current=t;let l=a(i);s.measurements=l}s.onResize=o}},[t,a,e,o])}function Wa(e,t){let o=document.body.querySelector(`.${e}`),r={get:function(n,a){let i=n.getPropertyValue(`--${e}-breakpoint-${a}`);return i?parseInt(i):void 0}};return o?new Proxy(getComputedStyle(o),r):t!=null?t:{}}var Ua=([,e],[,t])=>t-e,Qt=e=>Object.entries(e).sort(Ua).map(([t,o],r,n)=>[t,o,r<n.length-1?n[r+1][1]:9999]),qt=null,Ja=(e="salt")=>{let{xs:t,sm:o,md:r,lg:n,xl:a}=Wa(e);return Qt({xs:t,sm:o,md:r,lg:n,xl:a})},tn=e=>(qt===null&&(qt=Ja(e)),qt);var Xa=[],rn=({breakPoints:e,smallerThan:t},o)=>{let[r,n]=Za(t?!1:"lg"),a=Kt(document.body),i=Kt(e?Qt(e):tn()),s=Kt("lg"),l=on(u=>{if(i.current){for(let[d,p]of i.current)if(u>=p)return d}},[i]),c=on(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 at(o||a,i.current?["width"]:Xa,({width:u})=>{let d=c(u);d!==s.current&&(s.current=d,n(d))},!0),Ya(()=>{let u=o||a;if(u.current){let d=s.current;if(i.current){let{clientWidth:p}=u.current,m=c(p);s.current=m,m!==d&&n(m)}}},[n,c,o]),r};var nn="data-collapsible",ja={[nn]:!0,"data-pad-start":!0,"data-pad-end":!0},qa=e=>{var t;return(t=ja[e])!=null?t:!1},Qa=e=>e===nn,Ka={dynamic:"dynamic",instant:"instant",true:"instant"},es=e=>{var t;return(t=Ka[e])!=null?t:"none"},hm=e=>Object.keys(e).reduce((t,o)=>{let[r,n]=t;if(qa(o)){let a=Qa(o)?es(e[o]):e[o];r[o]=a,n[o]=void 0}return t},[{},{}]);import{useCallback as an,useRef as sn}from"react";var ts=[],ln=({mainRef:e,resize:t="responsive",rootRef:o})=>{let r=t==="defer",n=sn({}),a=sn(),i=an(()=>{e.current&&(e.current.style.height=n.current.height+"px",e.current.style.width=n.current.width+"px"),a.current=void 0},[e]),s=an(({height:l,width:c})=>{n.current.height=l,n.current.width=c,a.current!==null&&clearTimeout(a.current),a.current=window.setTimeout(i,40)},[i]);at(o,r?Kr:ts,s,r)};import os,{useContext as cn}from"react";var rs={dispatch:null},st=os.createContext(rs),Zr=()=>{var t;let e=cn(st);return(t=e==null?void 0:e.dispatch)!=null?t:null},un=()=>cn(st);import{jsx as eo,jsxs as ds}from"react/jsx-runtime";var Oe="vuuView",ps=(e,t)=>e&&t?{...e,...t}:e||t,dn=ss(function(t,o){let{Header:r=Yr,children:n,className:a,collapsed:i,closeable:s,"data-path":l,"data-resizeable":c,dropTargets:u,expanded:d,flexFill:p,id:m,header:h,orientation:g="horizontal",path:y=l,resize:f="responsive",resizeable:x=c,tearOut:R,style:w={},title:E,...b}=t,v=ns(m),S=pn(null),C=pn(null),[L,M]=us(),{contributions:z,dispatchViewAction:A,load:k,loadSession:G,onConfigChange:W,onEditTitle:ne,purge:ie,restoredState:bo,save:xo,saveSession:vo,title:xt}=jr({id:v,rootRef:S,path:y,dropTargets:u,title:E});ln({mainRef:C,resize:f,rootRef:S});let wo=ls(Un=>{M(Un)},[]),_n=()=>to.isValidElement(n)&&(bo||L)?to.cloneElement(n,ps(bo,L)):n,Gn=cs(()=>({dispatch:A,id:v,path:y,title:xt,load:k,loadSession:G,onConfigChange:W,purge:ie,save:xo,saveSession:vo,setComponentProps:wo}),[A,v,k,G,W,y,ie,xo,vo,wo,xt]),Wn=typeof h=="object"?h:{};return eo("div",{...b,className:as(Oe,a,{[`${Oe}-collapsed`]:i,[`${Oe}-expanded`]:d,[`${Oe}-resize-defer`]:f==="defer"}),"data-resizeable":x,id:v,ref:is(o,S),style:w,tabIndex:-1,children:ds(st.Provider,{value:Gn,children:[h?eo(r,{...Wn,collapsed:i,contributions:z,expanded:d,closeable:s,onEditTitle:ne,orientation:g,tearOut:R,title:xt}):null,eo("div",{className:`${Oe}-main`,ref:C,children:_n()})]})})});dn.displayName="View";var we=to.memo(dn);we.displayName="View";I("View",we,"view");import{Fragment as gs,jsx as oo,jsxs as mn}from"react/jsx-runtime";var lt="vuuLayoutStartPanel",fn=e=>{let{dispatch:t,path:o}=un(),[r,n]=hs();return fs(()=>{t==null||t({type:"query",path:o,query:"PARENT_CONTAINER"}).then(i=>{(i==null?void 0:i.parentContainerId)==="main-tabs"?n("initial"):n("nested")})},[t,o]),r===void 0?null:mn("div",{...e,className:lt,children:[r==="initial"?mn(gs,{children:[oo("header",{className:`${lt}-title`,children:"Start by adding a table"}),oo("div",{className:`${lt}-text`,children:"To add a table, drag any of the Vuu Tables to this area or click the button below"})]}):null,oo(ms,{className:`${lt}-addButton`,"data-icon":"add",variant:"cta"})]})};import{Fragment as vs,jsx as ct}from"react/jsx-runtime";var bs="vuuPlaceholder",xs=({showStartMenu:e=!0})=>ct(vs,{children:e?ct(fn,{}):null}),Re=({className:e,showStartMenu:t,...o})=>{let r=ys(bs,e);return ct(we,{...o,className:r,"data-placeholder":!0,resizeable:!0,children:ct(xs,{showStartMenu:t})})};Re.displayName="Placeholder";I("Placeholder",Re);import ws from"clsx";import Rs,{useCallback as Ne,useRef as ut,useState as Es}from"react";import{jsx as hn}from"react/jsx-runtime";var pt="vuuSplitter",gn=Rs.memo(function({column:t,index:o,onDrag:r,onDragEnd:n,onDragStart:a,style:i}){let s=ut(),l=ut(null),c=ut(0),[u,d]=Es(!1),p=Ne(({key:b,shiftKey:v})=>{let S=v?10:1;t&&b==="ArrowDown"?r(o,S):t&&b==="ArrowUp"||!t&&b==="ArrowLeft"?r(o,-S):!t&&b==="ArrowRight"&&r(o,S)},[t,o,r]),m=Ne(b=>{let{key:v}=b;(t&&(v==="ArrowUp"||v==="ArrowDown")||!t&&(v==="ArrowLeft"||v==="ArrowRight"))&&(a(o),p(b),h.current=p)},[t,p,o,a]),h=ut(m),g=b=>h.current(b),y=Ne(b=>{s.current=!0;let v=b[t?"clientY":"clientX"],S=v-c.current;v&&v!==c.current&&r(o,S),c.current=v},[t,o,r]),f=Ne(()=>{var b;window.removeEventListener("mousemove",y,!1),window.removeEventListener("mouseup",f,!1),n(),d(!1),(b=l.current)==null||b.focus()},[y,n,d]),x=Ne(b=>{c.current=t?b.clientY:b.clientX,a(o),window.addEventListener("mousemove",y,!1),window.addEventListener("mouseup",f,!1),b.preventDefault(),d(!0)},[t,y,f,o,a,d]),R=()=>{var b;s.current?s.current=!1:(b=l.current)==null||b.focus()},w=()=>{h.current=m},E=ws(pt,{[`${pt}-active`]:u,[`${pt}-column`]:t});return hn("div",{className:E,"data-splitter":!0,ref:l,role:"separator",style:i,onBlur:w,onClick:R,onKeyDown:g,onMouseDown:x,tabIndex:0,children:hn("div",{className:`${pt}-grab-zone`})})});var Ds={},Fe=1,He=2,Ss=e=>typeof e.intrinsicSize=="number",Ts=(e,t)=>{let o={};return e.forEach(r=>{o[r]=P(t,r)}),o},dt=(e,t,o)=>e.map((r,n)=>{var l;let a=P(r,"resizeable"),{[t]:i}=(l=U(r))!=null?l:Ds,s=cr(r);return o?{index:n,flexOpen:s,intrinsicSize:i,resizeable:a,...Ts(o,r)}:{index:n,flexOpen:s,intrinsicSize:i,resizeable:a}}),yn=e=>{let t=e.length,o=e.every(Ss),r=Array(t).fill(0);if(o&&t>0&&(r[0]=He,r[t-1]=He),t<2)return r;for(let n=0,a=0;n<t-1;n++)e[n].resizeable&&!a&&(a=Fe),r[n]+=a;for(let n=t-1;n>0&&(r[n]&Fe&&(r[n]-=Fe),!e[n].resizeable);n--);return r},bn=(e,t)=>{let o=Ls(e,t),r=Cs(e,t),n=o!==-1&&r!==-1?[o,r]:void 0,a=Ps(e,n);return[n,a]};function Ps(e,t){if(t){let o=[];for(let r=0;r<e.length;r++)e[r].flexOpen&&!t.includes(r)&&o.push(r);return o}}function Ls(e,t){let o=t,r=!1;for(;o>=1&&!r;)o=o-1,r=xn(e,o);return o}function Cs(e,t){let o=t,r=!1,n=e.length;for(;o<n-1&&!r;)o=o+1,r=xn(e,o);return o===n?-1:o}function xn(e,t){let{placeholder:o,splitter:r,resizeable:n,intrinsicSize:a}=e[t];return!!(!r&&!a&&(o||n))}var As=e=>!e.splitter&&!e.placeholder,Rn=({children:e,onSplitterMoved:t,style:o})=>{let r=ft(null),n=ft(),a=ft(),i=ft([]),[,s]=ks({}),l=y=>{a.current=y,s({})},c=(o==null?void 0:o.flexDirection)==="column",u=c?"height":"width",d=vn(()=>Array.isArray(e)?e:$e.isValidElement(e)?[e]:[],[e]),p=mt(y=>{let{current:f}=n;if(f){let[x,R]=bn(f,y);x&&(x.forEach(w=>{var b;let E=(b=r.current)==null?void 0:b.childNodes[w];if(E){let{size:v,minSize:S}=Os(E,u);f[w].currentSize=v,f[w].minSize=S}}),R&&R.forEach(w=>{var b;let E=(b=r.current)==null?void 0:b.childNodes[w];if(E){let{[u]:v}=E.getBoundingClientRect();f[w].flexBasis=v}}))}},[u]),m=mt((y,f)=>{a.current&&n.current&&l(Is(a.current,n.current,f,u))},[u]),h=mt(()=>{let y=n.current;y&&(t==null||t(y.filter(As))),y==null||y.forEach(f=>{f.currentSize=void 0,f.flexBasis=void 0,f.flexOpen=!1})},[t]),g=mt(y=>$e.createElement(gn,{column:c,index:y,key:`splitter-${y}`,onDrag:m,onDragEnd:h,onDragStart:p}),[m,h,p,c]);return vn(()=>{let[y,f]=zs(d,u,g,i.current);n.current=f,a.current=y},[d,g,u]),{content:a.current||[],rootRef:r}};function zs(e,t,o,r){let n=dt(e,t),a=yn(n),i=[],s=[];for(let l=0;l<e.length;l++){let c=e[l];if(l===0&&a[l]&He&&(i.push(wn(l)),s.push({placeholder:!0,shim:!0})),c.key==null){let u=r[l]||(r[l]=Ms());i.push($e.cloneElement(c,{key:u}))}else i.push(c);s.push(n[l]),l>0&&a[l]&He?(i.push(wn(l)),s.push({placeholder:!0})):a[l]&Fe&&(i.push(o(i.length)),s.push({splitter:!0}))}return[i,s]}function Is(e,t,o,r){return Bs(t,o)?e.map((a,i)=>{let s=t[i],{currentSize:l,flexOpen:c,flexBasis:u}=s,d=l!==void 0;if(d||c){let{flexBasis:p}=a.props.style||{},m=d?s.currentSize:u;return m!==p?$e.cloneElement(a,{style:{...a.props.style,flexBasis:m,[r]:"auto"}}):a}else return a}):e}function Bs(e,t){let o=[];e.forEach((u,d)=>{u.currentSize!==void 0&&o.push(d)});let r=t<0?o[0]:o[1],{currentSize:n=0,minSize:a=0}=e[r];if(n===a)return!1;if(Math.abs(t)>n-a){let u=t<0?-1:1;t=Math.max(0,n-a)*u}let i=e[o[0]],{currentSize:s=0}=i;i.currentSize=s+t;let l=e[o[1]],{currentSize:c=0}=l;return l.currentSize=c-t,!0}function wn(e){return $e.createElement(Re,{shim:e===0,key:`placeholder-${e}`})}function Os(e,t){let{[t]:o}=e.getBoundingClientRect(),n=getComputedStyle(e).getPropertyValue(`min-${t}`),a=n.endsWith("px")?parseInt(n,10):0;return{size:o,minSize:a}}import{jsx as $s}from"react/jsx-runtime";var ro="hwFlexbox",En=Hs(function(t,o){let{breakPoints:r,children:n,column:a,className:i,flexFill:s,gap:l,fullPage:c,id:u,onSplitterMoved:d,resizeable:p,row:m,spacing:h,splitterSize:g,style:y,...f}=t,{content:x,rootRef:R}=Rn({children:n,onSplitterMoved:d,style:y}),w=Fs(ro,i,{[`${ro}-column`]:a,[`${ro}-row`]:m,"flex-fill":s,"full-page":c});return $s("div",{...f,className:w,"data-resizeable":p||void 0,id:u,ref:Ns(R,o),style:{...y,gap:l,"--spacing":h},children:x})});En.displayName="Flexbox";var no=En;import{useCallback as Vs}from"react";import{jsx as _s}from"react/jsx-runtime";var Dn=function(t){let{path:o}=t,r=q(),n=Vs(a=>{r({type:ve.SPLITTER_RESIZE,path:o,sizes:a})},[r,o]);return _s(no,{...t,onSplitterMoved:n})};Dn.displayName="Flexbox";I("Flexbox",Dn,"container");import{asReactElements as Xs}from"@vuu-ui/vuu-utils";import{useForkRef as js}from"@salt-ds/core";import qs from"clsx";import{forwardRef as Qs,useMemo as Ks}from"react";import{getUniqueId as Gs}from"@vuu-ui/vuu-utils";import{cloneElement as Ws,isValidElement as Us,useCallback as Js,useMemo as Sn,useRef as io}from"react";var Ys=["xs","sm","md","lg","xl"],Zs=12,Tn=({children:e,cols:t,style:o})=>{let r=io(null),n=io(null),a=io(),i=t!=null?t:Zs,l=(o==null?void 0:o.flexDirection)==="column"?"height":"width",c=Sn(()=>Array.isArray(e)?e:Us(e)?[e]:[],[e]),u=Js((d,p)=>{let m=dt(d,p,Ys),h=[],g=[];for(let y=0;y<d.length;y++){let f=d[y],{style:{flex:x,...R}}=f.props;h.push(Ws(f,{key:Gs(),style:{...R,"--parent-col-count":i}})),g.push(m[y])}return[h,g]},[i]);return Sn(()=>{let[d,p]=u(c,l);n.current=p,a.current=d},[u,c,l]),{cols:i,content:a.current,rootRef:r}};import{jsx as el}from"react/jsx-runtime";var ht="hwFluidGrid",ao=Qs(function(t,o){let{breakPoints:r,children:n,column:a,cols:i=12,className:s,flexFill:l,gap:c=3,fullPage:u,id:d,onSplitterMoved:p,resizeable:m,row:h,showGrid:g,spacing:y,splitterSize:f,style:x,...R}=t,w=Ks(()=>Xs(n),[n]),{cols:E,content:b,rootRef:v}=Tn({children:w,cols:i,style:x}),S=rn({breakPoints:r},v),C=qs(ht,s,{[`${ht}-column`]:a,[`${ht}-row`]:h,[`${ht}-show-grid`]:g,"flex-fill":l,"full-page":u}),L={...x,"--spacing":y,"--grid-col-count":E,"--grid-gap":c};return el("div",{...R,className:C,"data-breakpoint":S,"data-cols":E,"data-resizeable":m||void 0,id:d,ref:js(v,o),style:L,children:b})});ao.displayName="FluidGrid";import{jsx as tl}from"react/jsx-runtime";var Pn=function(t){return tl(ao,{...t})};Pn.displayName="FluidGrid";I("FluidGrid",Pn,"container");import{uuid as ol}from"@vuu-ui/vuu-utils";import{List as rl,ListItem as nl}from"@vuu-ui/vuu-ui-controls";import Ln from"clsx";import{cloneElement as il,memo as al}from"react";import{jsx as so}from"react/jsx-runtime";var sl=e=>{let t=e.cloneNode(!0);return t.id="",delete t.dataset.idx,t},Cn=al(({className:e,children:t,idx:o,resizeable:r,header:n,closeable:a,...i})=>so(nl,{className:Ln("vuuPaletteItem",e),"data-draggable":!0,"data-icon":"draggable",...i}));Cn.displayName="PaletteItem";var ll=({ListProps:e,ViewProps:t,children:o,className:r,itemHeight:n=41,orientation:a="horizontal",...i})=>{let s=q(),l="vuuPalette";function c(u){var L,M;let p=u.target.closest(".vuuPaletteItem"),m=parseInt((M=(L=p.dataset)==null?void 0:L.index)!=null?M:"-1"),{props:{caption:h,children:g,template:y,...f}}=o[m],{ViewProps:x}=g.props,{height:R,left:w,top:E,width:b}=p.getBoundingClientRect(),v=ol(),C=y?g:so(we,{...t,...{id:v,key:v},...f,...x,title:f.label,children:g});s({dragRect:{left:w,top:E,right:w+b,bottom:E+150,width:b,height:R},dragElement:sl(p),evt:u.nativeEvent,instructions:{DoNotRemove:!0,DoNotTransform:!0,DriftHomeIfNoDropTarget:!0,RemoveDraggableOnDragEnd:!0,dragThreshold:10},path:"*",payload:C,type:"drag-start"})}return so(rl,{...e,...i,className:Ln(l,r,`${l}-${a}`),itemHeight:n,selected:null,children:o.map((u,d)=>u.type===Cn?il(u,{key:d,onMouseDown:c}):u)})};I("Palette",ll,"view");import{Tab as cl,Tabstrip as ul}from"@vuu-ui/vuu-ui-controls";import{useId as pl}from"@vuu-ui/vuu-utils";import Mn from"clsx";import uo,{forwardRef as dl,useCallback as ml,useRef as fl}from"react";import{jsx as co,jsxs as bl}from"react/jsx-runtime";var lo="vuuTabs",hl=()=>{},gl=e=>{let t=[];return uo.Children.forEach(e,o=>{uo.isValidElement(o)?t.push(o):console.warn("Stack has unexpected child element type")}),t},yl={allowAddTab:!1,allowCloseTab:!1,allowRenameTab:!1},po=dl(function({TabstripProps:t=yl,active:o=0,children:r,className:n,getTabIcon:a=hl,getTabLabel:i=xe,id:s,keyBoardActivation:l="manual",onAddTab:c,onMoveTab:u,onTabClose:d,onTabEdit:p,onTabSelectionChanged:m,showTabs:h="top",style:g},y){var z;let f=pl(s),x=fl([]),{allowCloseTab:R,allowRenameTab:w,className:E}=t,b=ml((A,k,G,W)=>{p==null||p(W,k)},[p]),v=()=>{var A;return uo.isValidElement(r)?r:Array.isArray(r)&&(A=r[o])!=null?A:null},S=()=>gl(r).map((A,k)=>{let{closeable:G=R,id:W=`${f}-${k}`,"data-tab-location":ne}=A.props,ie=i(A,k,x.current);return x.current.push(ie),co(cl,{ariaControls:W,"data-icon":a(A,k),id:`${W}-tab`,index:k,label:ie,location:ne,closeable:G,editable:w},W)}),C=v(),L=h==="left"||h==="right",M=L?"vertical":"horizontal";return bl("div",{className:Mn(lo,n,{[`${lo}-horizontal`]:L}),style:g,id:f,ref:y,children:[h?co(ul,{...t,activeTabIndex:(z=t==null?void 0:t.activeTabIndex)!=null?z:C===null?-1:o,allowDragDrop:t.allowDragDrop!==!1,animateSelectionThumb:!0,className:Mn("vuuTabHeader",E),"aria-label":"data tabs",keyBoardActivation:l,onActiveChange:m,onAddTab:c,onCloseTab:d,onExitEditMode:b,onMoveTab:u,orientation:M,children:S()}):null,co("div",{"aria-labelledby":`${f}-${o}`,className:`${lo}-tabPanel`,role:"tabpanel",children:C})]})});po.displayName="Stack";import{useId as xl}from"@vuu-ui/vuu-utils";import vl,{useCallback as mo,useRef as wl}from"react";import{jsx as An}from"react/jsx-runtime";var Rl=()=>An(Re,{resizeable:!0,style:{flexGrow:1,flexShrink:0,flexBasis:0}}),kn=e=>{var E;let t=wl(null),o=q(),{loadState:r}=be(),{createNewChild:n,id:a,onTabSelectionChanged:i,path:s,...l}=e,{children:c}=e,u=xl(a),[d]=it(u,t,s),p=Gr(),m=(E=n!=null?n:p)!=null?E:Rl,h=b=>{s&&(o({type:"switch-tab",id:u,path:s,nextIdx:b}),i==null||i(b))},g=mo(b=>{if(Array.isArray(c)){let{props:{"data-path":v,path:S=v}}=c[b];o({type:"remove",path:S})}},[c,o]),y=mo(()=>{if(s){let b=vl.Children.count(c),v=m(b);o({type:"add",path:s,component:v})}},[c,m,o,s]),f=mo((b,v)=>{s&&o({fromIndex:b,toIndex:v,path:s,type:"move-child"})},[o,s]);return An(po,{...l,id:u,getTabLabel:(b,v,S)=>{let{id:C,title:L}=b.props;return r(C,"view-title")||L||xe(b,v,S)},onMouseDown:async(b,v)=>{let S;await d({type:"mousedown",index:v,preDragActivity:async()=>new Promise(M=>{console.log("preDragActivity: Ok, gonna release the drag"),S=M})},b)&&(S==null||S(void 0))},onMoveTab:f,onAddTab:y,onTabClose:g,onTabEdit:(b,v)=>{o({type:"set-title",path:`${s}.${b}`,title:v})},onTabSelectionChanged:h,ref:t})};kn.displayName="Stack";I("Stack",kn,"container");import zn,{useState as In}from"react";import{jsx as fo,jsxs as Bn}from"react/jsx-runtime";var dg=({children:e})=>{let[o,r]=In(e),[n,a]=In(e),i=l=>{let c=zo(o,l);a(c)},s=(l,c)=>{console.log(`change ${l} -> ${c}`);let u=zn.cloneElement(n,{style:{...n.props.style,[l]:c}});a(u),r(zn.cloneElement(o,{},u))};return Bn("div",{"data-design-mode":`${!1}`,children:[o,fo("br",{}),Bn("div",{style:{display:"flex"},children:[fo(On,{height:300,managedStyle:n.props.style,width:300,onChange:s,style:void 0}),fo(Nn,{layout:o,onSelect:i,style:{width:300,height:300,backgroundColor:"#ccc"}})]})]})};import{FormField as gt,Input as yt}from"@salt-ds/core";import{jsx as F,jsxs as go}from"react/jsx-runtime";var yo={},El={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"}},ho=({feature:e,children:t,style:o,onChange:r})=>go("div",{className:`LayoutBox layout-${e} layout-outer`,children:[go("div",{className:"layout-top",children:[F("span",{className:"layout-title",children:e}),F(gt,{className:"layout-input",style:{width:30},children:F(yt,{value:o.top,onChange:(n,a)=>r(e,"top",a)})})]}),go("div",{className:"layout-inner",children:[F("div",{className:"layout-left",children:F(gt,{className:"layout-input",style:{width:30},children:F(yt,{value:o.left,onChange:(n,a)=>r(e,"left",a)})})}),t,F("div",{className:"layout-right",children:F(gt,{className:"layout-input",style:{width:30},children:F(yt,{value:o.right,onChange:(n,a)=>r(e,"right",a)})})})]}),F("div",{className:"layout-bottom",children:F(gt,{className:"layout-input",style:{width:30},children:F(yt,{value:o.bottom,onChange:(n,a)=>r(e,"bottom",a)})})})]}),xg={margin:!0,marginTop:!0,marginRight:!0,marginBottom:!0,marginLeft:!0},vg={padding:!0,paddingTop:!0,paddingRight:!0,paddingBottom:!0,paddingLeft:!0},wg={border:!0,borderColor:!0,borderWidth:!0,borderTopWidth:!0,borderRightWidth:!0,borderBottomWidth:!0,borderLeftWidth:!0},bt="(\\d+)(?:px)?",Dl=`^(?:${bt}(?:\\s${bt}(?:\\s${bt}(?:\\s${bt})?)?)?)$`,Fn=new RegExp(Dl),Sl=/^(?:(\d+)(?:px)\ssolid\s([a-zA-Z,0-9().]+))$/,On=({height:e,managedStyle:t,onChange:o,style:r,width:n})=>{let a=Hn(t),i=(R,w,E)=>{let b=parseInt(E||"0",10),v=El[R][w];o(v,b)},{marginTop:s=0,marginRight:l=0,marginBottom:c=0,marginLeft:u=0}=a,{borderTopWidth:d=0,borderRightWidth:p=0,borderBottomWidth:m=0,borderLeftWidth:h=0}=a,{paddingTop:g=0,paddingRight:y=0,paddingBottom:f=0,paddingLeft:x=0}=a;return F("div",{className:"LayoutConfigurator",style:{width:n,height:e,...r},children:F(ho,{feature:"margin",style:{top:s,right:l,bottom:c,left:u},onChange:i,children:F(ho,{feature:"border",style:{top:d,right:p,bottom:m,left:h},onChange:i,children:F(ho,{feature:"padding",style:{top:g,right:y,bottom:f,left:x},onChange:i,children:F("div",{className:"layout-content"})})})})})};function Rg(e=yo,t=yo){let{margin:o,marginTop:r,marginRight:n,marginBottom:a,marginLeft:i,padding:s,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=Fn.exec(o);if(m===null)console.error(`Invalid css value for margin '${o}'`);else{let[,h,g,y,f]=m,x=h&&g&&y;x&&f?(p.marginTop=parseInt(h,10),p.marginRight=parseInt(g,10),p.marginBottom=parseInt(y,10),p.marginLeft=parseInt(f,10)):x?(p.marginTop=parseInt(h,10),p.marginRight=p.marginLeft=parseInt(g,10),p.marginBottom=parseInt(y,10)):h&&g?(p.marginTop=p.marginBottom=parseInt(h,10),p.marginRight=p.marginLeft=parseInt(g,10)):p.marginTop=p.marginRight=p.marginBottom=p.marginLeft=parseInt(h,10)}}if(typeof r=="number"&&(p.marginTop=r),typeof n=="number"&&(p.marginRight=n),typeof a=="number"&&(p.marginBottom=a),typeof i=="number"&&(p.marginLeft=i),typeof s=="number")p.paddingTop=p.paddingRight=p.paddingBottom=p.paddingLeft=s;else if(typeof s=="string"){let m=Fn.exec(s);if(m===null)console.error(`Invalid css value for padding '${s}'`);else{let[,h,g,y,f]=m,x=h&&g&&y;x&&f?(p.paddingTop=parseInt(h,10),p.paddingRight=parseInt(g,10),p.paddingBottom=parseInt(y,10),p.paddingLeft=parseInt(f,10)):x?(p.paddingTop=parseInt(h,10),p.paddingRight=p.paddingLeft=parseInt(g,10),p.paddingBottom=parseInt(y,10)):h&&g?(p.paddingTop=p.paddingBottom=parseInt(h,10),p.paddingRight=p.paddingLeft=parseInt(g,10)):p.paddingTop=p.paddingRight=p.paddingBottom=p.paddinggLeft=parseInt(h,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),Hn(p,t)}function Hn(e=yo){let t={...e},o,{border:r,borderWidth:n,borderTopWidth:a,borderRightWidth:i,borderBottomWidth:s,borderLeftWidth:l,borderColor:c,margin:u,marginTop:d,marginRight:p,marginBottom:m,marginLeft:h,padding:g,paddingTop:y,paddingRight:f,paddingBottom:x,paddingLeft:R,...w}=t,E={},b={};if(typeof u=="number"&&(t.marginTop=t.marginRight=t.marginBottom=t.marginLeft=u,E={marginTop:u,marginRight:u,marginBottom:u,marginLeft:u}),typeof g=="number"&&(t.paddingTop=t.paddingRight=t.paddingBottom=t.paddingLeft=g,b={paddingTop:g,paddingRight:g,paddingBottom:g,paddingLeft:g}),r||n||a||i||s||l){typeof r=="string"&&(o=Sl.exec(r))&&([,n,c]=o,n=parseInt(n,10)),n&&(a=a===void 0?n:a,i=i===void 0?n:i,s=s===void 0?n:s,l=l===void 0?n:l),c=c||"black";let v=`
|
|
18
|
+
${c} ${l||0}px ${a||0}px 0 0 inset,
|
|
19
|
+
${c} ${-i||0}px ${-s||0}px 0 0 inset`;return{...w,...E,...b,borderTopWidth:a,borderRightWidth:i,borderBottomWidth:s,borderLeftWidth:l,borderColor:c,borderStyle:"solid",boxShadow:v}}else return t}import Tl from"react";import Pl from"clsx";import{Tree as Ll}from"@vuu-ui/vuu-ui-controls";import{jsx as $n}from"react/jsx-runtime";var Cl="hwLayoutTreeViewer",Vn=(e,t="0")=>({label:T(e),path:t,childNodes:Tl.Children.map(e.props.children,(o,r)=>Vn(o,t?`${t}.${r}`:`${r}`))}),Nn=({layout:e,onSelect:t,style:o})=>{let r=[Vn(e)],n=(a,[{path:i}])=>{t(i)};return $n("div",{className:Pl(Cl),style:o,children:$n(Ll,{source:r,groupSelection:"single",onSelectionChange:n})})};export{ve as Action,wg as BORDER_STYLES,ni as Component,ae as ComponentRegistry,dg as ConfigWrapper,ei as DockLayout,Ot as Draggable,rr as DraggableLayout,vt as Drawer,Wo as DropMenu,ge as DropTarget,no as Flexbox,Dn as FlexboxLayout,ao as FluidGrid,Pn as FluidGridLayout,Yr as Header,im as HeightOnly,N as LayoutActionType,On as LayoutConfigurator,Td as LayoutProvider,ze as LayoutProviderContext,Sd as LayoutProviderVersion,Nn as LayoutTreeViewer,xg as MARGIN_STYLES,vg as PADDING_STYLES,ll as Palette,Cn as PaletteItem,Re as Placeholder,po as Stack,kn as StackLayout,we as View,st as ViewContext,Kr as WidthHeight,am as WidthOnly,Rg as XXXnormalizeStyles,Iu as applyLayout,Me as applyLayoutProps,gr as componentToJson,Go as computeMenuPosition,ci as containerOf,$t as createFlexbox,j as createPlaceHolder,St as expandFlex,hm as extractResponsiveProps,Q as findTarget,B as followPath,zo as followPathToComponent,Y as followPathToParent,ui as getChild,Mo as getChildProp,xe as getDefaultTabLabel,lr as getFlexDimensions,Ht as getFlexOrIntrinsicStyle,Ft as getFlexStyle,U as getIntrinsicSize,fr as getManagedDimension,ur as getPersistentState,P as getProp,D as getProps,pr as hasPersistentState,cr as hasUnboundedFlexStyle,Mt as identifyDropTarget,ip as isApplicationLevelChange,H as isContainer,Do as isLayoutComponent,uc as isLayoutJSON,ap as isLayoutLevelChange,qa as isResponsiveAttribute,Ac as isTabstrip,cc as isTypeOf,Jn as isView,pe as layoutFromJson,yr as layoutQuery,Nr as layoutReducer,hr as layoutToJSON,yc as nextLeaf,Z as nextStep,bc as previousLeaf,_t as processLayoutElement,I as registerComponent,O as resetPath,Qr as resizeObserver,li as resolveJSONPath,Et as resolvePath,qi as serializeProps,dr as setPersistentState,vc as setRef,T as typeOf,rn as useBreakpoints,Gr as useLayoutCreateNewChild,q as useLayoutProviderDispatch,Ba as useLayoutProviderVersion,be as usePersistentState,at as useResizeObserver,it as useViewActionDispatcher,un as useViewContext,Zr as useViewDispatch,Le as wrapIntrinsicSizeComponentWithFlexbox};
|
|
20
20
|
//# sourceMappingURL=index.js.map
|