@vuu-ui/vuu-layout 0.8.4 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{partition as Ro}from"@vuu-ui/vuu-utils";import Ir from"classnames";var mo={},fo={},te={};function F(e){return mo[e]===!0}function Mr(e){return fo[e]===!0}var ho=e=>F(e)||Mr(e),dl=e=>!!te[e];function k(e,t,o="component"){te[e]=t,o==="container"?mo[e]=!0:o==="view"&&(fo[e]=!0)}import{Button as go,useControlled as Cr}from"@salt-ds/core";import yo from"classnames";import{useCallback as Ar}from"react";import{jsx as Ee,jsxs as kr}from"react/jsx-runtime";var oe="vuuDrawer",bo=e=>typeof e=="string"?e:e+"px",zr=(e,t,o)=>{let n=t!==void 0,r=o!==void 0;if(!(!e&&!r&&!n))return!r&&!n?e:{...e,"--drawer-size":n?bo(t):void 0,"--drawer-peek-size":r?bo(o):void 0}},xo=({children:e,className:t,clickToOpen:o,defaultOpen:n,sizeOpen:r,sizeClosed:i,style:s,open:a,position:l="left",inline:c,onClick:p,peekaboo:m=!1,toggleButton:u,...f})=>{let[h,g]=Cr({controlled:a,default:n!=null?n:!1,name:"Drawer",state:"open"}),y=yo(oe,t,`${oe}-${l}`,{[`${oe}-open`]:h,[`${oe}-inline`]:c,[`${oe}-over`]:!c,[`${oe}-peekaboo`]:m}),d=Ar(()=>{g(!h)},[h,g]),b=zr(s,r,i),E=o?d:p,R=()=>Ee("div",{className:yo("vuuToggleButton-container"),children:h?Ee(go,{"aria-label":"close",onClick:d,"data-icon":"close",variant:"secondary"}):Ee(go,{"aria-label":"open",onClick:d,"data-icon":"close",variant:"secondary"})});return kr("div",{...f,className:y,onClick:E,style:b,children:[u=="start"?R():null,Ee("div",{className:`${oe}-liner`,children:Ee("div",{className:`${oe}-content`,children:e})}),u=="end"?R():null]})};xo.displayName="Drawer";var gt=xo;import{jsx as $r,jsxs as Fr}from"react/jsx-runtime";var Br=e=>e.type===gt,Or=({props:{position:e="left"}})=>e.match(/top|bottom/),yt=e=>{let{children:t,className:o,id:n,style:r}=e,i="vuuDockLayout",[s,a]=Ro(t,Br),[l,c]=Ro(s,Or),p=l.length===0?"horizontal":c.length===0?"vertical":"both",m=Ir(i,o,`${i}-${p}`);return Fr("div",{className:m,id:n,style:r,children:[s,$r("div",{className:`${i}-content`,children:a})]})};yt.displayName="DockLayout";var Hr=yt;k("DockLayout",yt,"container");import{forwardRef as Nr}from"react";import{jsx as Vr}from"react/jsx-runtime";var bt=Nr(function({resizeable:t,...o},n){return Vr("div",{...o,className:"Component",ref:n})});bt.displayName="Component";var xt=bt;k("Component",bt);import ne,{isValidElement as So}from"react";var _r={},P=(e,t)=>{var n;let o=D(e);return(n=o[t])!=null?n:o[`data-${t}`]},D=e=>(e==null?void 0:e.props)||e||_r,Eo=e=>{let t=D(e);if(t.children){let{children:[o,...n]}=t;return n.length>0&&console.warn(`getChild expected a single child, found ${n.length+1}`),o}};function w(e){var t;if(e){let o=e.type;if(typeof o=="function"||typeof o=="object"){let n=o.displayName||o.name||((t=o.type)==null?void 0:t.name);if(typeof n=="string")return n}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 Yl=(e,t)=>w(e)===t;var Wr=e=>{let t=e.lastIndexOf(".");return t===-1?e:e.slice(0,t)};function q(e,t){let{"data-path":o,path:n=o}=D(e);return t==="0"||t===n?null:$(e,Wr(t),!0)}function Q(e,t){let{children:o,...n}=D(e);if(t(n))return e;if(ne.Children.count(o)>0){let r=ne.isValidElement(o)?[o]:o;for(let i of r){let s=Q(i,t);if(s)return s}}}function Gr(e,t){if(t===e)return null;let{path:o,children:n}=D(e),{idx:r,finalStep:i}=J(o,P(t,"path"));return i?e:n===void 0||n[r]===void 0?null:Gr(n[r],t)}var Ur=(e,t)=>{if(ne.isValidElement(e)&&t==0)return e;if(Array.isArray(e))return e[t]};function To(e,t){let o=t.split("."),n=[e],r=i=>ne.isValidElement(i.props.children)?[i.props.children]:i.props.children;for(let i=0;i<o.length;i++){let s=parseInt(o[i]),a=n[s];if(i===o.length-1)return a;n=r(a)}}var Do=(e,t,o=!0)=>{let{children:n,id:r}=e.props;if(r===t)return e;if(ne.Children.count(n)>0){let i=So(n)?[n]:n;for(let s of i)if(So(s)){let a=Do(s,t,!1);if(a)return a}}if(o===!0)throw Error(`pathUtils.findTargetById id #${t} not found in source`)};function $(e,t,o=!1){if(t.startsWith("#"))return Do(e,t.slice(1),o);let{"data-path":n,path:r=n}=D(e);if(t.indexOf(r)!==0)throw Error(`pathUtils.followPath path ${t} is not within source path ${r}`);let i=t.slice(r.length+1);if(i==="")return e;let s=e,a=i.split(".");for(let l=0;l<a.length;l++){if(ne.Children.count(s.props.children)===0){let c=`element at 0.${a.slice(0,l).join(".")} has no children, so cannot fulfill rest of path ${a.slice(l).join(".")}`;if(o)throw Error(c);console.warn(c);return}if(s=Ur(s.props.children,parseInt(a[l])),s===void 0){let c=`model at 0.${a.slice(0,l).join(".")} has no children that fulfill next step of path ${a.slice(l).join(".")}`;if(o)throw Error(c);console.warn(c)}}return s}function ec(e,t){let o=q(e,t),n=t.split(".").map(r=>parseInt(r,10));if(o){let r=n.pop(),{children:i}=o.props;if(i.length-1>r)return Fe(i[r+1]);{let s=n.pop(),a=q(e,P(o,"path"));if(a&&typeof s=="number"&&(n=a.props.path.split(".").map(l=>parseInt(l,10)),a.props.children.length-1>s)){let l=a.props.children[s+1];return F(w(l))?Fe(l):l}}}return Fe(e)}function tc(e,t){let o=t.split(".").map(i=>parseInt(i,10)),n=o.pop(),r=q(e,t);if(r!=null&&typeof n=="number"){let{children:i}=r.props;if(n>0)return Ne(i[n-1]);for(;o.length>1;)if(n=o.pop(),r=q(e,P(r,"path")),n>0){let s=r.props.children[n-1];return F(w(s))?Ne(s):s}}return Ne(e)}function Fe(e){if(F(w(e))){let{children:t}=e.props||e;return Fe(t[0])}return e}function Ne(e){if(F(w(e))){let{children:t}=e.props||e;return Ne(t[t.length-1])}return e}function J(e,t,o=!1){if(e===t)return{idx:-1,finalStep:!0};let n=`${e}.`;if(!t.startsWith(n))throw Error("pathUtils nextStep has strayed from the path");let r=o?0:1,i=t.replace(n,"").split(".").map(s=>parseInt(s,10));return{idx:i[0],finalStep:i.length===r}}function O(e,t,o){if(P(e,"path")===t)return e;let n=[];ne.Children.forEach(e.props.children,(i,s)=>{P(i,"path")?n.push(O(i,`${t}.${s}`)):n.push(i)});let r=e.props["data-path"]?"data-path":"path";return ne.cloneElement(e,{[r]:t,...o},n)}function nc(e,t){typeof e=="function"?e(t):e&&(e.current=t)}var Rt=e=>{if(typeof e!="number")throw Error(`"no support yet for flex value ${e}`);return{flexBasis:0,flexGrow:1,flexShrink:1}};var pe={north:1,east:2,south:4,west:8,header:16,centre:32,absolute:64},Se={AFTER:"after",BEFORE:"before"},N=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 pe[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 Po=N.North,wo=N.South,Et=N.East,St=N.West,Zr=N.Header,Yr=N.Centre,fe=class{static measure(t,o=[]){let n={};return jr(t,n,o),n}static allBoxesContainingPoint(t,o,n,r,i){return Co(t,o,n,r,i).reverse()}};function Tt(e,t,o,n=30){let r=o.right-o.left,i=o.bottom-o.top,s=e-o.left,a=t-o.top,l=0;return s<n&&(l+=8),s>r-n&&(l+=2),a<n&&(l+=1),a>i-n&&(l+=4),{pctX:s/r,pctY:a/i,closeToTheEdge:l}}function Dt(e,t,o,n){let{BEFORE:r,AFTER:i}=Se,{pctX:s,pctY:a,closeToTheEdge:l}=Tt(e,t,o),c,p;if(n==="row")c=s<.5?St:Et;else if(o.header&&Ve(o.header,e,t))if(c=Zr,o.Stack){let m=o.Stack.length;if(m===0)p={index:-1,left:o.left,positionRelativeToTab:i,width:0};else{let u=o.Stack.find(({left:f,right:h})=>e>=f&&e<=h);if(u){let f=u.right-u.left;p={index:o.Stack.indexOf(u),left:u.left,positionRelativeToTab:(e-u.left)/f<.5?r:i,width:f}}else p={left:o.Stack[m-1].right,width:0,index:m,positionRelativeToTab:i}}}else if(o.header.titleWidth){let m=o.header.titleWidth;p={index:-1,left:o.left,positionRelativeToTab:(e-o.left)/m<.5?r:i,width:m}}else p={left:o.left,width:0,positionRelativeToTab:r,index:-1};else c=Xr(e,t,o,s,a);return{position:c,x:e,y:t,closeToTheEdge:l,tab:p}}function Xr(e,t,o,n,r){let i=Jr(o,.2);if(Ve(i,e,t))return Yr;switch(`${r<.5?"north":"south"}${n<.5?"west":"east"}`){case"northwest":return n>r?Po:St;case"northeast":return 1-n>r?Po:Et;case"southeast":return n>r?Et:wo;case"southwest":return 1-n>r?St:wo;default:}}function Jr({right:e,left:t,top:o,bottom:n},r){let i=(1-r)/2,s=(e-t)*i,a=(n-o)*i;return{left:t+s,top:o+a,right:e-s,bottom:n-a}}function jr(e,t,o){let{id:n,"data-path":r,path:i=r}=D(e),s=w(e);if(n&&i){let[a,l]=Mo(e);Lo(e,a,l,t),F(s)&&vo(e,t,o)}}function Lo(e,t,o,n){let{"data-path":r,path:i=r,header:s}=D(e);n[i]=t;let a=w(e);if(s||a==="Stack"){let l=o.querySelector(".vuuHeader");if(l){let{top:c,left:p,right:m,bottom:u}=l.getBoundingClientRect();if(n[i].header={top:Math.round(c),left:Math.round(p),right:Math.round(m),bottom:Math.round(u)},a==="Stack")n[i].Stack=Array.from(l.querySelectorAll(".saltTab")).map(f=>f.getBoundingClientRect()).map(({left:f,right:h})=>({left:f,right:h}));else{let f=l.querySelector('[class^="vuuHeader-title"]'),{header:h}=n[i];f&&h&&(h.titleWidth=f.clientWidth)}}}return n[i]}function vo(e,t,o,n=0,r=0,i=0,s=0){let{children:a,"data-path":l,path:c=l,style:p,active:m=0}=D(e),u=w(e),f=u==="Flexbox",h=u==="Stack",g=f&&p.flexDirection==="column",y=f&&p.flexDirection==="row",b=(h?a.filter((R,T)=>T===m):a.filter(Kr)).map(R=>{let[T,x]=Mo(R);return[{...T,top:T.top-i,right:T.right+r,bottom:T.bottom+s,left:T.left-n},x,R]}),E=b.map(([R,T,x],S,L)=>{let C,B,v,I,M,A,z=L.length-1;y?(M=S===0?0:R.left-L[S-1][0].right,A=S===z?0:L[S+1][0].left-R.right,C=S===0||M===0?0:M,B=S===z||A===0?0:A-A/2,R.left-=C,R.right+=B,v=i,I=s):g&&(M=S===0?0:R.top-L[S-1][0].bottom,A=S===z?0:L[S+1][0].top-R.bottom,v=S===0||M===0?0:M,I=S===z||A===0?0:A-A/2,R.top-=v,R.bottom+=I,C=n,B=r);let X=Lo(x,R,T,t),G=w(x);return F(G)&&vo(x,t,o,C,B,v,I),X});b.length&&(t[c].children=E)}function Kr(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 Mo(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:n,left:r,right:i,bottom:s,height:a,width:l}=o.getBoundingClientRect(),c,p=w(e);if(F(p)){let m=o.scrollHeight;m>a&&(c={id:t,scrollHeight:m,scrollTop:o.scrollTop})}return[{top:Math.round(n),left:Math.round(r),right:Math.round(i),bottom:Math.round(s),height:Math.round(a),width:Math.round(l),scrolling:c},o,e]}function Co(e,t,o,n,r,i=[]){let{children:s,"data-path":a,path:l=a}=D(e),c=w(e),p=t[l];if(!Ve(p,o,n))return i;if(r&&r.length){if(r.includes(l))i.push(e);else if(!r.some(m=>m.startsWith(l)))return i}else i.push(e);if(!F(c)||p.header&&Ve(p.header,o,n))return i;p.scrolling&&qr(p,o,n);for(let m=0;m<s.length;m++){if(c==="Stack"&&e.props.active!==m)continue;let u=Co(s[m],t,o,n,r);if(u.length)return i.concat(u)}return i}function Ve(e,t,o){if(e)return t>=e.left&&t<e.right&&o>=e.top&&o<e.bottom}function qr({top:e,bottom:t,scrolling:o},n,r){if(o){let{id:i,scrollTop:s,scrollHeight:a}=o,l=t-e;if(s===0&&t-r<50){let c=a-l;document.getElementById(i).scrollTo({left:0,top:c,behavior:"smooth"}),o.scrollTop=c}else if(s>0&&r-e<50)document.getElementById(i).scrollTo({left:0,top:0,behavior:"smooth"}),o.scrollTop=0;else return!1}else return!1}var Qr=.4,_e=class{constructor(t,o,n,r,i){this.init(t,o,n,r,i)}init(t,o,n,r,i){let{left:s,top:a}=r,{pctX:l,pctY:c}=Tt(o,n,r),p=Qr,m=l*r.width,u=r.width-m,f=c*r.height,h=r.height-f,g=r.width*p,y=r.height*p,d=1-p,b=m*d,E=f*d,R=u*d,T=h*d;this.intrinsicSize=i,this.constraint={zone:{x:{lo:t.left,hi:t.right},y:{lo:t.top,hi:t.bottom}},pos:{x:{lo:t.left-b,hi:t.right-r.width+R},y:{lo:t.top-E,hi:t.bottom-r.height+T}},mouse:{x:{lo:t.left+g*l,hi:t.right-g*(1-l)},y:{lo:t.top+y*c,hi:t.bottom-y*(1-c)}}},this.x={pos:s,lo:!1,hi:!1,mousePos:o,mousePct:l},this.y={pos:a,lo:!1,hi:!1,mousePos:n,mousePct:c}}outOfBounds(){return this.x.lo||this.x.hi||this.y.lo||this.y.hi}inBounds(){return!this.outOfBounds()}dropX(){return this.dropXY("x")}dropY(){return this.dropXY("y")}hasIntrinsicSize(){var t,o;return((t=this==null?void 0:this.intrinsicSize)==null?void 0:t.height)&&((o=this==null?void 0:this.intrinsicSize)==null?void 0:o.width)}update(t,o){let n=this[t],r=this.constraint.mouse[t],i=this.constraint.pos[t],s=n.pos,a=o-n.mousePos;return a<0?n.lo||(o<r.lo?(n.lo=!0,n.pos=i.lo):n.hi?o<r.hi&&(n.hi=!1,n.pos+=a):n.pos+=a):a>0&&(n.hi||(o>r.hi?(n.hi=!0,n.pos=i.hi):n.lo?o>r.lo&&(n.lo=!1,n.pos+=a):n.pos+=a)),n.mousePos=o,s!==n.pos}dropXY(t){let o=this[t],n=this.constraint.zone[t];return o.lo?Math.max(n.lo,o.mousePos):o.hi?Math.min(o.mousePos,Math.round(n.hi)-1):o.mousePos}};var Rc=e=>e.pos.tab&&w(e.component)==="Stack"&&e.pos.position.Header,{north:ei,south:ti,east:oi,west:ni}=pe,ri=oi+ni,ii=ei+ti,re=class{constructor({component:t,pos:o,clientRect:n,nextDropTarget:r}){this.component=t,this.pos=o,this.clientRect=n,this.nextDropTarget=r,this.active=!1,this.dropRect=void 0}targetTabPos(t){let{left:o,width:n,positionRelativeToTab:r}=t;return r===Se.BEFORE?o:o+n}getTargetDropOutline(t,o){if(this.pos.tab)return this.getDropTabOutline(t,this.pos.tab);if(o&&o.hasIntrinsicSize())return this.getIntrinsicDropRect(o);{let[n,r,i,s]=this.getDropRectOutline(t,o);return{l:n,t:r,r:i,b:s}}}getDropTabOutline(t,o){var d,b;let{clientRect:{top:n,left:r,right:i,bottom:s,header:a}}=this,l=0,c=Math.round(t/2)+l,p=Math.round(n),m=Math.round(r+c),u=Math.round(i-c),f=Math.round(s-c),h=this.targetTabPos(o),g=60,y=((d=a==null?void 0:a.bottom)!=null?d:0)-((b=a==null?void 0:a.top)!=null?b:0);return{l:m,t:p,r:u,b:f,tabLeft:h,tabWidth:g,tabHeight:y}}getIntrinsicDropRect(t){var g,y,d,b;let{pos:o,clientRect:n}=this,{x:r,y:i}=t,s=(y=(g=t.intrinsicSize)==null?void 0:g.height)!=null?y:0,a=(b=(d=t.intrinsicSize)==null?void 0:d.height)!=null?b:0;s&&s>n.height?(console.log("DropTarget: we're going to blow the gaff"),s=n.height):a&&a>n.width&&(console.log("DropTarget: we're going to blow the gaff"),a=n.width);let l=Math.min(n.right-a,Math.max(n.left,Math.round(o.x-r.mousePct*a))),c=Math.min(n.bottom-s,Math.max(n.top,Math.round(o.y-i.mousePct*s))),[p,m,u,f]=this.dropRect=[l,c,l+a,c+s],h=o.position.EastOrWest?[p,n.top,p,n.bottom,u,n.top,u,n.bottom]:[n.left,m,n.right,m,n.left,f,n.right,f];return{l:p,r:u,t:m,b:f,guideLines:h}}getDropRectOutline(t,o){var b,E,R;let{pos:n,clientRect:r}=this,{width:i,height:s,position:a}=n,{width:l,height:c}=(b=o==null?void 0:o.intrinsicSize)!=null?b:{},p=(E=c!=null?c:s)!=null?E:0,m=(R=l!=null?l:i)!=null?R:0;this.dropRect=void 0;let{top:u,left:f,right:h,bottom:g}=r,y=0,d=Math.round(t/2)+y;switch(a){case N.North:case N.Header:{let T=Math.round((g-u)/2),x=p?Math.min(T,Math.round(p)):T;return m&&f+m<h?[f+d,u+d,f+m-d,u+d+x]:[f+d,u+d,h-d,u+d+x]}case N.West:{let T=Math.round((h-f)/2),x=m?Math.min(T,Math.round(m)):T;return p&&u+p<g?[f+d,u+d,f-d+x,u+p+d]:[f+d,u+d,f-d+x,g-d]}case N.East:{let T=Math.round((h-f)/2),x=m?Math.min(T,Math.round(m)):T;return p&&u+p<g?[h-d-x,u+d,h-d,u+p+d]:[h-d-x,u+d,h-d,g-d]}case N.South:{let T=Math.round((g-u)/2),x=p?Math.min(T,Math.round(p)):T;return m&&f+m<h?[f+d,g-d-x,f+m-d,g-d]:[f+d,g-d-x,h-d,g-d]}case N.Centre:return[f+d,u+d,h-d,g-d];default:return console.warn(`DropTarget does not recognize position ${a}`),null}}activate(){return this.active=!0,this}toArray(){let t=this,o=[t];for(;t=t.nextDropTarget;)o.push(t);return o}static getActiveDropTarget(t){return t===null?null:t!=null&&t.active?t:re.getActiveDropTarget(t.nextDropTarget)}};function Pt(e,t,o,n,r,i){var l;let s=null,a=fe.allBoxesContainingPoint(o,n,e,t,i);if(a.length){let[c,...p]=a,{"data-path":m,path:u=m,"data-row-placeholder":f}=D(c),h=n[u],y=Dt(e,t,h,r&&f?"row":void 0),d=n[u],b=([E,...R])=>{var T,x;if((T=y.position)!=null&&T.Header||y.closeToTheEdge){let S=si(E,y,d,n,e,t);if(S){let[L,C]=S;return new re({component:E,pos:L,clientRect:C,nextDropTarget:(x=b(R))!=null?x:null})}else if(R.length)return b(R)}};s=new re({component:c,pos:y,clientRect:h,nextDropTarget:(l=b(p))!=null?l:null}).activate()}return s}function si(e,{closeToTheEdge:t,position:o},n,r,i,s){if(!e||e.type==="DraggableLayout")return;let a=r[e.props.path],l=t&pe.north,c=t&pe.east,p=t&pe.south,m=t&pe.west,u=(l||o.Header)&&Math.round(n.top)===Math.round(a.top),f=c&&Math.round(n.right)===Math.round(a.right),h=p&&Math.round(n.bottom)===Math.round(a.bottom),g=m&&Math.round(n.left)===Math.round(a.left);if(u||f||h||g){let{"data-path":y,path:d=y}=e.props,b=r[d],E=Dt(i,s,b);if((ai(e)||Ao(e))&&t&ri)return E.width=120,[E,b];if((li(e)||Ao(e))&&(o.Header||t&ii))return E.height=120,[E,b]}}function Ao(e){return w(e)==="Stack"}function ai(e){return w(e)==="Flexbox"&&e.props.style.flexDirection==="column"}function li(e){return w(e)==="Flexbox"&&e.props.style.flexDirection==="row"}import{PopupService as Lt}from"@vuu-ui/vuu-popups";import ci from"classnames";import{jsx as zo}from"react/jsx-runtime";function ko(e,t=0,o=0){let{pos:n,clientRect:r}=e,i=20;return n.position.West?[r.left-o+i,n.y-t,"left"]:n.position.South?[n.x-o,r.bottom-t-i,"bottom"]:n.position.East?[r.right-o-i,n.y-t,"right"]:[n.x-o,r.top-t+i,"top"]}var wt="vuuDropMenu",Io=({className:e,dropTarget:t,onHover:o,orientation:n})=>{let r=t.toArray();return zo("div",{className:ci(wt,e,`${wt}-${n}`),onMouseLeave:()=>o(null),children:r.map((i,s)=>zo("div",{className:`${wt}-item`,"data-icon":s===0?"column-2A":"column-2B",onMouseEnter:()=>o(i)},s))})};import{jsx as gi}from"react/jsx-runtime";var vt=!1,Te=null,j=null,pi=e=>Te=e,ui=([e,t])=>`M${e},${t}`,mi=([e,t])=>`L${e},${t}`,Bo=([e,...t])=>`${ui(e)} ${t.map(mi)}Z`,di=e=>{if(e){let[t,o,n,r,i,s,a,l]=e;return`M${t},${o} L${n},${r} M${i},${s} L${a},${l}`}else return""};function fi(){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 Hn}from"@vuu-ui/vuu-utils";import ea from"classnames";var Pn={},Mn={},Pe={};function re(e){return Pn[e]===!0}function Xi(e){return Mn[e]===!0}var Ln=e=>re(e)||Xi(e),bd=e=>!!Pe[e];function Y(e,t,o="component"){Pe[e]=t,o==="container"?Pn[e]=!0:o==="view"&&(Mn[e]=!0)}import{Button as In,useControlled as Yi}from"@salt-ds/core";import Cn from"classnames";import{useCallback as ji}from"react";import{jsx as at,jsxs as Qi}from"react/jsx-runtime";var Me="vuuDrawer",On=e=>typeof e=="string"?e:e+"px",Ji=(e,t,o)=>{let n=t!==void 0,r=o!==void 0;if(!(!e&&!r&&!n))return!r&&!n?e:{...e,"--drawer-size":n?On(t):void 0,"--drawer-peek-size":r?On(o):void 0}},An=({children:e,className:t,clickToOpen:o,defaultOpen:n,sizeOpen:r,sizeClosed:s,style:i,open:a,position:l="left",inline:c,onClick:p,peekaboo:d=!1,toggleButton:u,...m})=>{let[h,g]=Yi({controlled:a,default:n!=null?n:!1,name:"Drawer",state:"open"}),b=Cn(Me,t,`${Me}-${l}`,{[`${Me}-open`]:h,[`${Me}-inline`]:c,[`${Me}-over`]:!c,[`${Me}-peekaboo`]:d}),f=ji(()=>{g(!h)},[h,g]),y=Ji(i,r,s),T=o?f:p,x=()=>at("div",{className:Cn("vuuToggleButton-container"),children:h?at(In,{"aria-label":"close",onClick:f,"data-icon":"close",variant:"secondary"}):at(In,{"aria-label":"open",onClick:f,"data-icon":"close",variant:"secondary"})});return Qi("div",{...m,className:b,onClick:T,style:y,children:[u=="start"?x():null,at("div",{className:`${Me}-liner`,children:at("div",{className:`${Me}-content`,children:e})}),u=="end"?x():null]})};An.displayName="Drawer";var xo=An;import{jsx as ra,jsxs as sa}from"react/jsx-runtime";var ta=e=>e.type===xo,oa=({props:{position:e="left"}})=>e.match(/top|bottom/),To=e=>{let{children:t,className:o,id:n,style:r}=e,s="vuuDockLayout",[i,a]=Hn(t,ta),[l,c]=Hn(i,oa),p=l.length===0?"horizontal":c.length===0?"vertical":"both",d=ea(s,o,`${s}-${p}`);return sa("div",{className:d,id:n,style:r,children:[i,ra("div",{className:`${s}-content`,children:a})]})};To.displayName="DockLayout";var na=To;Y("DockLayout",To,"container");import{forwardRef as ia}from"react";import{jsx as aa}from"react/jsx-runtime";var vo=ia(function({resizeable:t,...o},n){return aa("div",{...o,className:"Component",ref:n})});vo.displayName="Component";var Do=vo;Y("Component",vo);import Le,{isValidElement as zn}from"react";var la={},B=(e,t)=>{var n;let o=A(e);return(n=o[t])!=null?n:o[`data-${t}`]},A=e=>(e==null?void 0:e.props)||e||la,kn=e=>{let t=A(e);if(t.children){let{children:[o,...n]}=t;return n.length>0&&console.warn(`getChild expected a single child, found ${n.length+1}`),o}};function $(e){var t;if(e){let o=e.type;if(typeof o=="function"||typeof o=="object"){let n=o.displayName||o.name||((t=o.type)==null?void 0:t.name);if(typeof n=="string")return n}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 jd=(e,t)=>$(e)===t;var ca=e=>{let t=e.lastIndexOf(".");return t===-1?e:e.slice(0,t)};function De(e,t){let{"data-path":o,path:n=o}=A(e);return t==="0"||t===n?null:ee(e,ca(t),!0)}function we(e,t){let{children:o,...n}=A(e);if(t(n))return e;if(Le.Children.count(o)>0){let r=Le.isValidElement(o)?[o]:o;for(let s of r){let i=we(s,t);if(i)return i}}}function ua(e,t){if(t===e)return null;let{path:o,children:n}=A(e),{idx:r,finalStep:s}=he(o,B(t,"path"));return s?e:n===void 0||n[r]===void 0?null:ua(n[r],t)}var pa=(e,t)=>{if(Le.isValidElement(e)&&t==0)return e;if(Array.isArray(e))return e[t]};function Nn(e,t){let o=t.split("."),n=[e],r=s=>Le.isValidElement(s.props.children)?[s.props.children]:s.props.children;for(let s=0;s<o.length;s++){let i=parseInt(o[s]),a=n[i];if(s===o.length-1)return a;n=r(a)}}var Bn=(e,t,o=!0)=>{let{children:n,id:r}=e.props;if(r===t)return e;if(Le.Children.count(n)>0){let s=zn(n)?[n]:n;for(let i of s)if(zn(i)){let a=Bn(i,t,!1);if(a)return a}}if(o===!0)throw Error(`pathUtils.findTargetById id #${t} not found in source`)};function ee(e,t,o=!1){if(t.startsWith("#"))return Bn(e,t.slice(1),o);let{"data-path":n,path:r=n}=A(e);if(t.indexOf(r)!==0)throw Error(`pathUtils.followPath path ${t} is not within source path ${r}`);let s=t.slice(r.length+1);if(s==="")return e;let i=e,a=s.split(".");for(let l=0;l<a.length;l++){if(Le.Children.count(i.props.children)===0){let c=`element at 0.${a.slice(0,l).join(".")} has no children, so cannot fulfill rest of path ${a.slice(l).join(".")}`;if(o)throw Error(c);console.warn(c);return}if(i=pa(i.props.children,parseInt(a[l])),i===void 0){let c=`model at 0.${a.slice(0,l).join(".")} has no children that fulfill next step of path ${a.slice(l).join(".")}`;if(o)throw Error(c);console.warn(c)}}return i}function rm(e,t){let o=De(e,t),n=t.split(".").map(r=>parseInt(r,10));if(o){let r=n.pop(),{children:s}=o.props;if(s.length-1>r)return Ot(s[r+1]);{let i=n.pop(),a=De(e,B(o,"path"));if(a&&typeof i=="number"&&(n=a.props.path.split(".").map(l=>parseInt(l,10)),a.props.children.length-1>i)){let l=a.props.children[i+1];return re($(l))?Ot(l):l}}}return Ot(e)}function sm(e,t){let o=t.split(".").map(s=>parseInt(s,10)),n=o.pop(),r=De(e,t);if(r!=null&&typeof n=="number"){let{children:s}=r.props;if(n>0)return At(s[n-1]);for(;o.length>1;)if(n=o.pop(),r=De(e,B(r,"path")),n>0){let i=r.props.children[n-1];return re($(i))?At(i):i}}return At(e)}function Ot(e){if(re($(e))){let{children:t}=e.props||e;return Ot(t[0])}return e}function At(e){if(re($(e))){let{children:t}=e.props||e;return At(t[t.length-1])}return e}function he(e,t,o=!1){if(e===t)return{idx:-1,finalStep:!0};let n=`${e}.`;if(!t.startsWith(n))throw Error("pathUtils nextStep has strayed from the path");let r=o?0:1,s=t.replace(n,"").split(".").map(i=>parseInt(i,10));return{idx:s[0],finalStep:s.length===r}}function te(e,t,o){if(B(e,"path")===t)return e;let n=[];Le.Children.forEach(e.props.children,(s,i)=>{B(s,"path")?n.push(te(s,`${t}.${i}`)):n.push(s)});let r=e.props["data-path"]?"data-path":"path";return Le.cloneElement(e,{[r]:t,...o},n)}function am(e,t){typeof e=="function"?e(t):e&&(e.current=t)}import{Children as da,isValidElement as $n,useLayoutEffect as ma,useMemo as fa,useRef as ga}from"react";var ha=[],ba=0,qe=e=>{let t=Array.isArray(e),o=t?e.length:da.count(e);return t&&e.every($n)?e:o===1&&!t&&$n(e)?[e]:o>1?e:ha},Fn=(e,t)=>{let o=ga(!1);ma(()=>{o.current?e():o.current=!0},t)},Ht=e=>fa(()=>e!=null?e:`vuu-${++ba}`,[e]);var wo=e=>{if(typeof e!="number")throw Error(`"no support yet for flex value ${e}`);return{flexBasis:0,flexGrow:1,flexShrink:1}};var Be={north:1,east:2,south:4,west:8,header:16,centre:32,absolute:64},lt={AFTER:"after",BEFORE:"before"},se=Object.freeze({North:Ne("north"),East:Ne("east"),South:Ne("south"),West:Ne("west"),Header:Ne("header"),Centre:Ne("centre"),Absolute:Ne("absolute")});function Ne(e){return Object.freeze({offset:e==="north"||e==="west"?0:e==="south"||e==="east"?1:NaN,valueOf:function(){return Be[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 _n=se.North,Vn=se.South,Ro=se.East,So=se.West,ya=se.Header,Ea=se.Centre,Xe=class{static measure(t,o=[]){let n={};return va(t,n,o),n}static allBoxesContainingPoint(t,o,n,r,s){return Zn(t,o,n,r,s).reverse()}};function Po(e,t,o,n=30){let r=o.right-o.left,s=o.bottom-o.top,i=e-o.left,a=t-o.top,l=0;return i<n&&(l+=8),i>r-n&&(l+=2),a<n&&(l+=1),a>s-n&&(l+=4),{pctX:i/r,pctY:a/s,closeToTheEdge:l}}function Mo(e,t,o,n){let{BEFORE:r,AFTER:s}=lt,{pctX:i,pctY:a,closeToTheEdge:l}=Po(e,t,o),c,p;if(n==="row")c=i<.5?So:Ro;else if(o.header&&kt(o.header,e,t))if(c=ya,o.Stack){let d=o.Stack.length;if(d===0)p={index:-1,left:o.left,positionRelativeToTab:s,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?r:s,width:m}}else p={left:o.Stack[d-1].right,width:0,index:d,positionRelativeToTab:s}}}else if(o.header.titleWidth){let d=o.header.titleWidth;p={index:-1,left:o.left,positionRelativeToTab:(e-o.left)/d<.5?r:s,width:d}}else p={left:o.left,width:0,positionRelativeToTab:r,index:-1};else c=xa(e,t,o,i,a);return{position:c,x:e,y:t,closeToTheEdge:l,tab:p}}function xa(e,t,o,n,r){let s=Ta(o,.2);if(kt(s,e,t))return Ea;switch(`${r<.5?"north":"south"}${n<.5?"west":"east"}`){case"northwest":return n>r?_n:So;case"northeast":return 1-n>r?_n:Ro;case"southeast":return n>r?Ro:Vn;case"southwest":return 1-n>r?So:Vn;default:}}function Ta({right:e,left:t,top:o,bottom:n},r){let s=(1-r)/2,i=(e-t)*s,a=(n-o)*s;return{left:t+i,top:o+a,right:e-i,bottom:n-a}}function va(e,t,o){let{id:n,"data-path":r,path:s=r}=A(e),i=$(e);if(n&&s){let[a,l]=Kn(e);Wn(e,a,l,t),re(i)&&Gn(e,t,o)}}function Wn(e,t,o,n){let{"data-path":r,path:s=r,header:i}=A(e);n[s]=t;let a=$(e);if(i||a==="Stack"){let l=o.querySelector(".vuuHeader");if(l){let{top:c,left:p,right:d,bottom:u}=l.getBoundingClientRect();if(n[s].header={top:Math.round(c),left:Math.round(p),right:Math.round(d),bottom:Math.round(u)},a==="Stack")n[s].Stack=Array.from(l.querySelectorAll(".saltTab")).map(m=>m.getBoundingClientRect()).map(({left:m,right:h})=>({left:m,right:h}));else{let m=l.querySelector('[class^="vuuHeader-title"]'),{header:h}=n[s];m&&h&&(h.titleWidth=m.clientWidth)}}}return n[s]}function Gn(e,t,o,n=0,r=0,s=0,i=0){let{children:a,"data-path":l,path:c=l,style:p,active:d=0}=A(e),u=$(e),m=u==="Flexbox",h=u==="Stack",g=m&&p.flexDirection==="column",b=m&&p.flexDirection==="row",y=(h?a.filter((x,v)=>v===d):a.filter(Da)).map(x=>{let[v,E]=Kn(x);return[{...v,top:v.top-s,right:v.right+r,bottom:v.bottom+i,left:v.left-n},E,x]}),T=y.map(([x,v,E],D,P)=>{let k,C,M,w,R,O,I=P.length-1;b?(R=D===0?0:x.left-P[D-1][0].right,O=D===I?0:P[D+1][0].left-x.right,k=D===0||R===0?0:R,C=D===I||O===0?0:O-O/2,x.left-=k,x.right+=C,M=s,w=i):g&&(R=D===0?0:x.top-P[D-1][0].bottom,O=D===I?0:P[D+1][0].top-x.bottom,M=D===0||R===0?0:R,w=D===I||O===0?0:O-O/2,x.top-=M,x.bottom+=w,k=n,C=r);let S=Wn(E,x,v,t),L=$(E);return re(L)&&Gn(E,t,o,k,C,M,w),S});y.length&&(t[c].children=T)}function Da(e){let{id:t}=A(e),o=document.getElementById(t);return o?o.dataset.dragging!=="true":(console.warn(`BoxModel: no element found with id #${t}`),!1)}function Kn(e){let{id:t}=A(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:n,left:r,right:s,bottom:i,height:a,width:l}=o.getBoundingClientRect(),c,p=$(e);if(re(p)){let d=o.scrollHeight;d>a&&(c={id:t,scrollHeight:d,scrollTop:o.scrollTop})}return[{top:Math.round(n),left:Math.round(r),right:Math.round(s),bottom:Math.round(i),height:Math.round(a),width:Math.round(l),scrolling:c},o,e]}function Zn(e,t,o,n,r,s=[]){let{children:i,"data-path":a,path:l=a}=A(e),c=$(e),p=t[l];if(!kt(p,o,n))return s;if(r&&r.length){if(r.includes(l))s.push(e);else if(!r.some(d=>d.startsWith(l)))return s}else s.push(e);if(!re(c)||p.header&&kt(p.header,o,n))return s;p.scrolling&&wa(p,o,n);for(let d=0;d<i.length;d++){if(c==="Stack"&&e.props.active!==d)continue;let u=Zn(i[d],t,o,n,r);if(u.length)return s.concat(u)}return s}function kt(e,t,o){if(e)return t>=e.left&&t<e.right&&o>=e.top&&o<e.bottom}function wa({top:e,bottom:t,scrolling:o},n,r){if(o){let{id:s,scrollTop:i,scrollHeight:a}=o,l=t-e;if(i===0&&t-r<50){let c=a-l;document.getElementById(s).scrollTo({left:0,top:c,behavior:"smooth"}),o.scrollTop=c}else if(i>0&&r-e<50)document.getElementById(s).scrollTo({left:0,top:0,behavior:"smooth"}),o.scrollTop=0;else return!1}else return!1}var Ra=.4,zt=class{constructor(t,o,n,r,s){this.init(t,o,n,r,s)}init(t,o,n,r,s){let{left:i,top:a}=r,{pctX:l,pctY:c}=Po(o,n,r),p=Ra,d=l*r.width,u=r.width-d,m=c*r.height,h=r.height-m,g=r.width*p,b=r.height*p,f=1-p,y=d*f,T=m*f,x=u*f,v=h*f;this.intrinsicSize=s,this.constraint={zone:{x:{lo:t.left,hi:t.right},y:{lo:t.top,hi:t.bottom}},pos:{x:{lo:t.left-y,hi:t.right-r.width+x},y:{lo:t.top-T,hi:t.bottom-r.height+v}},mouse:{x:{lo:t.left+g*l,hi:t.right-g*(1-l)},y:{lo:t.top+b*c,hi:t.bottom-b*(1-c)}}},this.x={pos:i,lo:!1,hi:!1,mousePos:o,mousePct:l},this.y={pos:a,lo:!1,hi:!1,mousePos:n,mousePct:c}}outOfBounds(){return this.x.lo||this.x.hi||this.y.lo||this.y.hi}inBounds(){return!this.outOfBounds()}dropX(){return this.dropXY("x")}dropY(){return this.dropXY("y")}hasIntrinsicSize(){var t,o;return((t=this==null?void 0:this.intrinsicSize)==null?void 0:t.height)&&((o=this==null?void 0:this.intrinsicSize)==null?void 0:o.width)}update(t,o){let n=this[t],r=this.constraint.mouse[t],s=this.constraint.pos[t],i=n.pos,a=o-n.mousePos;return a<0?n.lo||(o<r.lo?(n.lo=!0,n.pos=s.lo):n.hi?o<r.hi&&(n.hi=!1,n.pos+=a):n.pos+=a):a>0&&(n.hi||(o>r.hi?(n.hi=!0,n.pos=s.hi):n.lo?o>r.lo&&(n.lo=!1,n.pos+=a):n.pos+=a)),n.mousePos=o,i!==n.pos}dropXY(t){let o=this[t],n=this.constraint.zone[t];return o.lo?Math.max(n.lo,o.mousePos):o.hi?Math.min(o.mousePos,Math.round(n.hi)-1):o.mousePos}};var Cm=e=>e.pos.tab&&$(e.component)==="Stack"&&e.pos.position.Header,{north:Sa,south:Pa,east:Ma,west:La}=Be,Ia=Ma+La,Ca=Sa+Pa,Ie=class{constructor({component:t,pos:o,clientRect:n,nextDropTarget:r}){this.component=t,this.pos=o,this.clientRect=n,this.nextDropTarget=r,this.active=!1,this.dropRect=void 0}targetTabPos(t){let{left:o,width:n,positionRelativeToTab:r}=t;return r===lt.BEFORE?o:o+n}getTargetDropOutline(t,o){if(this.pos.tab)return this.getDropTabOutline(t,this.pos.tab);if(o&&o.hasIntrinsicSize())return this.getIntrinsicDropRect(o);{let[n,r,s,i]=this.getDropRectOutline(t,o);return{l:n,t:r,r:s,b:i}}}getDropTabOutline(t,o){var f,y;let{clientRect:{top:n,left:r,right:s,bottom:i,header:a}}=this,l=0,c=Math.round(t/2)+l,p=Math.round(n),d=Math.round(r+c),u=Math.round(s-c),m=Math.round(i-c),h=this.targetTabPos(o),g=60,b=((f=a==null?void 0:a.bottom)!=null?f:0)-((y=a==null?void 0:a.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:n}=this,{x:r,y:s}=t,i=(b=(g=t.intrinsicSize)==null?void 0:g.height)!=null?b:0,a=(y=(f=t.intrinsicSize)==null?void 0:f.height)!=null?y:0;i&&i>n.height?(console.log("DropTarget: we're going to blow the gaff"),i=n.height):a&&a>n.width&&(console.log("DropTarget: we're going to blow the gaff"),a=n.width);let l=Math.min(n.right-a,Math.max(n.left,Math.round(o.x-r.mousePct*a))),c=Math.min(n.bottom-i,Math.max(n.top,Math.round(o.y-s.mousePct*i))),[p,d,u,m]=this.dropRect=[l,c,l+a,c+i],h=o.position.EastOrWest?[p,n.top,p,n.bottom,u,n.top,u,n.bottom]:[n.left,d,n.right,d,n.left,m,n.right,m];return{l:p,r:u,t:d,b:m,guideLines:h}}getDropRectOutline(t,o){var y,T,x;let{pos:n,clientRect:r}=this,{width:s,height:i,position:a}=n,{width:l,height:c}=(y=o==null?void 0:o.intrinsicSize)!=null?y:{},p=(T=c!=null?c:i)!=null?T:0,d=(x=l!=null?l:s)!=null?x:0;this.dropRect=void 0;let{top:u,left:m,right:h,bottom:g}=r,b=0,f=Math.round(t/2)+b;switch(a){case se.North:case se.Header:{let v=Math.round((g-u)/2),E=p?Math.min(v,Math.round(p)):v;return d&&m+d<h?[m+f,u+f,m+d-f,u+f+E]:[m+f,u+f,h-f,u+f+E]}case se.West:{let v=Math.round((h-m)/2),E=d?Math.min(v,Math.round(d)):v;return p&&u+p<g?[m+f,u+f,m-f+E,u+p+f]:[m+f,u+f,m-f+E,g-f]}case se.East:{let v=Math.round((h-m)/2),E=d?Math.min(v,Math.round(d)):v;return p&&u+p<g?[h-f-E,u+f,h-f,u+p+f]:[h-f-E,u+f,h-f,g-f]}case se.South:{let v=Math.round((g-u)/2),E=p?Math.min(v,Math.round(p)):v;return d&&m+d<h?[m+f,g-f-E,m+d-f,g-f]:[m+f,g-f-E,h-f,g-f]}case se.Centre:return[m+f,u+f,h-f,g-f];default:return console.warn(`DropTarget does not recognize position ${a}`),null}}activate(){return this.active=!0,this}toArray(){let t=this,o=[t];for(;t=t.nextDropTarget;)o.push(t);return o}static getActiveDropTarget(t){return t===null?null:t!=null&&t.active?t:Ie.getActiveDropTarget(t.nextDropTarget)}};function Lo(e,t,o,n,r,s){var l;let i=null,a=Xe.allBoxesContainingPoint(o,n,e,t,s);if(a.length){let[c,...p]=a,{"data-path":d,path:u=d,"data-row-placeholder":m}=A(c),h=n[u],b=Mo(e,t,h,r&&m?"row":void 0),f=n[u],y=([T,...x])=>{var v,E;if((v=b.position)!=null&&v.Header||b.closeToTheEdge){let D=Oa(T,b,f,n,e,t);if(D){let[P,k]=D;return new Ie({component:T,pos:P,clientRect:k,nextDropTarget:(E=y(x))!=null?E:null})}else if(x.length)return y(x)}};i=new Ie({component:c,pos:b,clientRect:h,nextDropTarget:(l=y(p))!=null?l:null}).activate()}return i}function Oa(e,{closeToTheEdge:t,position:o},n,r,s,i){if(!e||e.type==="DraggableLayout")return;let a=r[e.props.path],l=t&Be.north,c=t&Be.east,p=t&Be.south,d=t&Be.west,u=(l||o.Header)&&Math.round(n.top)===Math.round(a.top),m=c&&Math.round(n.right)===Math.round(a.right),h=p&&Math.round(n.bottom)===Math.round(a.bottom),g=d&&Math.round(n.left)===Math.round(a.left);if(u||m||h||g){let{"data-path":b,path:f=b}=e.props,y=r[f],T=Mo(s,i,y);if((Aa(e)||Un(e))&&t&Ia)return T.width=120,[T,y];if((Ha(e)||Un(e))&&(o.Header||t&Ca))return T.height=120,[T,y]}}function Un(e){return $(e)==="Stack"}function Aa(e){return $(e)==="Flexbox"&&e.props.style.flexDirection==="column"}function Ha(e){return $(e)==="Flexbox"&&e.props.style.flexDirection==="row"}import{PopupService as Co}from"@vuu-ui/vuu-popups";import ka from"classnames";import{jsx as qn}from"react/jsx-runtime";function Xn(e,t=0,o=0){let{pos:n,clientRect:r}=e,s=20;return n.position.West?[r.left-o+s,n.y-t,"left"]:n.position.South?[n.x-o,r.bottom-t-s,"bottom"]:n.position.East?[r.right-o-s,n.y-t,"right"]:[n.x-o,r.top-t+s,"top"]}var Io="vuuDropMenu",Yn=({className:e,dropTarget:t,onHover:o,orientation:n})=>{let r=t.toArray();return qn("div",{className:ka(Io,e,`${Io}-${n}`),onMouseLeave:()=>o(null),children:r.map((s,i)=>qn("div",{className:`${Io}-item`,"data-icon":i===0?"column-2A":"column-2B",onMouseEnter:()=>o(s)},i))})};import{jsx as Va}from"react/jsx-runtime";var Oo=!1,ct=null,be=null,za=e=>ct=e,Na=([e,t])=>`M${e},${t}`,Ba=([e,t])=>`L${e},${t}`,jn=([e,...t])=>`${Na(e)} ${t.map(Ba)}Z`,$a=e=>{if(e){let[t,o,n,r,s,i,a,l]=e;return`M${t},${o} L${n},${r} M${s},${i} L${a},${l}`}else return""};function Fa(){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 Ro}from"@vuu-ui/vuu-utils";import Ir from"classnames";var mo
14
14
  />
15
15
  </path>
16
16
  </svg>
17
- `,document.body.insertBefore(t,e)}}var De=class{constructor(){this.currentPath=null;this.tabMode=null;fi()}prepare(t,o="full-view"){document.body.classList.add("drawing"),this.currentPath=null,this.tabMode=o;let n=this.getPoints(0,0,0,0),r=Bo(n),i=document.getElementById("vuu-drop-outline");i==null||i.setAttribute("d",r),this.currentPath=r}clear(){Te=null,We(),document.body.classList.remove("drawing"),Lt.hidePopup()}get hoverDropTarget(){return Te}getPoints(t,o,n,r,i=0,s=0,a=0){let l=this.tabMode==="tab-only";if(s===0)return[[t,o+a],[t,o+a],[t,o],[t+s,o],[t+s,o],[t+n,o],[t+n,o+r],[t,o+r]];if(l){let c=i;return[[c,o],[c,o],[c+s,o],[c+s,o],[c+s,o+a],[c+s,o+a],[c,o+a],[c,o+a]]}else return i===0?[[t,o+a],[t,o+a],[t,o],[t+s,o],[t+s,o+a],[t+n,o+a],[t+n,o+r],[t,o+r]]:[[t,o+a],[t+i,o+a],[t+i,o],[t+i,o],[t+i,o+a],[t+n,o+a],[t+n,o+r],[t,o+r]]}draw(t,o){let r=vt;if(Te!==null)this.drawTarget(Te);else if(vt=t.nextDropTarget!=null,t.pos.tab?hi(t):j&&We(),this.drawTarget(t,o),vt){let[i,s,a]=ko(t);{let l=gi(Io,{dropTarget:t,onHover:pi,orientation:a});Lt.showPopup({left:i,top:s,component:l})}}else Lt.hidePopup()}drawTarget(t,o){let r=t.getTargetDropOutline(6,o);if(r){let{l:i,t:s,r:a,b:l,tabLeft:c,tabWidth:p,tabHeight:m,guideLines:u}=r,f=a-i,h=l-s;if(this.currentPath){let E=document.getElementById("vuu-drop-outline");E==null||E.setAttribute("d",this.currentPath)}let g=this.getPoints(i,s,f,h,c,p,m),y=Bo(g),d=document.getElementById("hw-drop-outline-animate");d==null||d.setAttribute("to",y),d==null||d.beginElement(),this.currentPath=y;let b=document.getElementById("hw-drop-guides");b==null||b.setAttribute("d",di(u))}}},Oo="transition:margin-left .4s ease-out;margin-left: 63px",Ho="transition:margin-left .4s ease-out;margin-left: 0px";function hi(e){var a,l;let{AFTER:t,BEFORE:o}=Se,{clientRect:{Stack:n},pos:{tab:r}}=e,{id:i}=e.component.props,s=null;if(n&&r&&r.positionRelativeToTab!==t){let c=r.positionRelativeToTab===o?1:2,p=`:scope .hwTabstrip > .hwTabstrip-inner > .hwTab:nth-child(${r.index+c})`;s=(a=document.getElementById(i))==null?void 0:a.querySelector(p),s?(j===null||j!==s)&&(s.style.cssText=Oo,j&&(j.style.cssText=Ho),j=s):We()}else if((r==null?void 0:r.positionRelativeToTab)===o){if(j===null){let c=".vuuHeader-title";s=(l=document.getElementById(i))==null?void 0:l.querySelector(c),s.style.cssText=Oo,j=s}}else We()}function We(){j&&(j.style.cssText=Ho,j=null)}var ee,Pe,ie,Fo,No,se,Ge,he=null,Ct,Vo,we,_o,Mt,Ue=null,yi=3,Ze=new De,$o=.4;function bi(e,t){return t?$(e,t):Q(e,o=>o.dropTarget)}var At={handleMousedown(e,t,o={}){ee=t,Vo=o,Fo=e.clientX,No=e.clientY,Mt=o.dragThreshold===void 0?yi:o.dragThreshold,Mt===0?ee(e,0,0):(window.addEventListener("mousemove",Ye,!1),window.addEventListener("mouseup",Xe,!1),Ue=window.setTimeout(()=>{console.log("mousedownTimer fires"),window.removeEventListener("mousemove",Ye,!1),window.removeEventListener("mouseup",Xe,!1),ee==null||ee(e,0,0)},500)),e.preventDefault()},initDrag(e,t,{top:o,left:n,right:r,bottom:i},s,a,l,c){return{drag:Pe,drop:ie}=a,xi(e,t,{top:o,left:n,right:r,bottom:i},s,l,c)}};function Ye(e){let n=e.clientX-Fo,r=e.clientY-No;Math.max(Math.abs(n),Math.abs(r))>Mt&&(window.removeEventListener("mousemove",Ye,!1),window.removeEventListener("mouseup",Xe,!1),ee==null||ee(e,n,r),ee=null)}function Xe(){Ue&&(window.clearTimeout(Ue),Ue=null),window.removeEventListener("mousemove",Ye,!1),window.removeEventListener("mouseup",Xe,!1)}function xi(e,t,o,n,r,i){se=bi(e,t);let{"data-path":s,path:a=s}=D(se);i&&(Ct=i.map(u=>Q(e,f=>f.id===u)).map(u=>u.props.path)),we=fe.measure(se,i),console.log({_measurements:we});let l=we[a];Ge=new _e(l,n.x,n.y,o,r);let c=Math.round(Ge.x.mousePct*100),p=Math.round(Ge.y.mousePct*100);return window.addEventListener("mousemove",Wo,!1),window.addEventListener("mouseup",Go,!1),_o=!1,Ze.prepare(o,"tab-only"),Vo.DoNotTransform?"transform:none":`transform:scale(${$o},${$o});transform-origin:${c}% ${p}%;`}function Wo(e){let t=e.clientX,o=e.clientY,n=Ge,r=he,i,s,a;n.update("x",t)&&(s=n.x.pos),n.update("y",o)&&(a=n.y.pos),s===void 0&&a===void 0||Pe==null||Pe(s,a),!(_o||se===void 0)&&(n.inBounds()?i=Pt(t,o,se,we,n.hasIntrinsicSize(),Ct):i=Pt(n.dropX(),n.dropY(),se,we),r&&(i==null||i.box!==r.box)&&(he=null),i&&(Ze.draw(i,n),he=i))}function Go(){Ri()}function Ri(){if(he){let e=Ze.hoverDropTarget||re.getActiveDropTarget(he);ie==null||ie(e),he=null}else ie==null||ie({component:se,pos:{position:N.Absolute}});Pe=null,ie=null,se=void 0,Ze.clear(),Ct=void 0,window.removeEventListener("mousemove",Wo,!1),window.removeEventListener("mouseup",Go,!1)}import Ei from"classnames";import{forwardRef as Si}from"react";import{jsx as Ti}from"react/jsx-runtime";var Uo=Si(function({children:t,className:o,dropTarget:n,resizeable:r,...i},s){let a=Ei("DraggableLayout",o);return Ti("div",{className:a,ref:s,...i,children:t})}),Zo="DraggableLayout";Uo.displayName=Zo;k(Zo,Uo,"container");import{useForkRef as Zi}from"@salt-ds/core";import Yi from"classnames";import{forwardRef as Xi}from"react";import{getUniqueId as Fi}from"@vuu-ui/vuu-utils";import Ae,{useCallback as Qe,useMemo as rn,useRef as et,useState as Ni}from"react";import Di from"classnames";import{jsx as Pi}from"react/jsx-runtime";var Yo="vuuPlaceholder",Je=({className:e,closeable:t,flexFill:o,resizeable:n,shim:r,...i})=>Pi("div",{className:Di(Yo,e,{[`${Yo}-shim`]:r}),...i,"data-placeholder":!0,"data-resizeable":!0});Je.displayName="Placeholder";k("Placeholder",Je);import wi from"classnames";import Li,{useCallback as Le,useRef as je,useState as vi}from"react";import{jsx as Xo}from"react/jsx-runtime";var Jo=Li.memo(function({column:t,index:o,onDrag:n,onDragEnd:r,onDragStart:i,style:s}){let a=je(),l=je(null),c=je(0),[p,m]=vi(!1),u=Le(({key:x,shiftKey:S})=>{let L=S?10:1;t&&x==="ArrowDown"?n(o,L):t&&x==="ArrowUp"||!t&&x==="ArrowLeft"?n(o,-L):!t&&x==="ArrowRight"&&n(o,L)},[t,o,n]),f=Le(x=>{let{key:S}=x;(t&&(S==="ArrowUp"||S==="ArrowDown")||!t&&(S==="ArrowLeft"||S==="ArrowRIght"))&&(i(o),u(x),h.current=u)},[t,u,o,i]),h=je(f),g=x=>h.current(x),y=Le(x=>{a.current=!0;let S=x[t?"clientY":"clientX"],L=S-c.current;S&&S!==c.current&&n(o,L),c.current=S},[t,o,n]),d=Le(()=>{var x;window.removeEventListener("mousemove",y,!1),window.removeEventListener("mouseup",d,!1),r(),m(!1),(x=l.current)==null||x.focus()},[y,r,m]),b=Le(x=>{c.current=t?x.clientY:x.clientX,i(o),window.addEventListener("mousemove",y,!1),window.addEventListener("mouseup",d,!1),x.preventDefault(),m(!0)},[t,y,d,o,i,m]),E=()=>{var x;a.current?a.current=!1:(x=l.current)==null||x.focus()},R=()=>{h.current=f},T=wi("Splitter","focusable",{active:p,column:t});return Xo("div",{className:T,"data-splitter":!0,ref:l,role:"separator",style:s,onBlur:R,onClick:E,onKeyDown:g,onMouseDown:b,tabIndex:0,children:Xo("div",{className:"grab-zone"})})});import{uuid as jo}from"@vuu-ui/vuu-utils";import Ko from"react";var Mi={"data-placeholder":!0,"data-resizeable":!0},Ke={},ae="auto",zt={flexBasis:0,flexGrow:1,flexShrink:1,height:ae,width:ae},qo={height:"width",width:"height"},Qo=(e="row")=>e==="row"?["width","height","column"]:["height","width","row"],Ci=e=>typeof e=="string"&&e.endsWith("%"),U=e=>{let{style:{width:t=ae,height:o=ae}=Ke}=e.props,n=typeof o=="number",r=typeof t=="number";return n&&r?{height:o,width:t}:n?{height:o}:r?{width:t}:void 0};function kt(e,t,o){let n=qo[t],{style:{[n]:r=ae,...i}=Ke}=e.props;return o&&o[t]?{...i,...zt,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...i,...zt,[n]:r}}function en(e){let{style:{flex:t,flexGrow:o,flexShrink:n,flexBasis:r}=Ke}=e.props;return typeof t=="number"||r===0&&o===1&&n===1?!0:typeof r!="number"}function It(e,t,o){let n=qo[t],{style:{[t]:r=ae,[n]:i=ae,...s}=Ke}=e.props;return r!==ae?Ci(r)?{flexBasis:0,flexGrow:1,flexShrink:1,[t]:void 0,[n]:i}:{flexBasis:r,flexGrow:0,flexShrink:0,[t]:r,[n]:i}:o&&o[t]?{...s,...zt,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...s,[n]:i}}function ve(e,t,o,n,r){let i=[],s=0,a;if(n&&r){let p,[m,u,f,h]=r;[p,a]=t==="column"?[u-n.top,n.bottom-h]:[m-n.left,n.right-f],p&&i.push(K(`${o}.${s++}`,p,{flexGrow:0,flexShrink:0}))}else a=!0;let{version:l=0,style:c}=D(e);return i.push(O(e,`${o}.${s++}`,{version:l+1,style:{...c,flexBasis:"auto",flexGrow:0,flexShrink:0}})),a&&i.push(K(`${o}.${s++}`,0,void 0,{[`data-${t}-placeholder`]:!0})),Bt(t,{resizeable:!1,style:{flexBasis:"auto"}},i,o)}var Ai=(e,t)=>{if(!t)return e===0?1:0};function Bt(e,t,o,n){let r=jo(),{flexFill:i,style:s,resizeable:a=!0}=t,{flexBasis:l=i?void 0:"auto"}=s,c=Ai(l,i);return Ko.createElement(te.Flexbox,{id:r,key:r,path:n,flexFill:i,style:{...s,flexDirection:e,flexBasis:l,flexGrow:c,flexShrink:c},resizeable:a},o)}var zi={flexGrow:1,flexShrink:1};function K(e,t,o,n){let r=jo();return Ko.createElement("div",{...Mi,...n,"data-path":e,id:r,key:r,style:{...zi,...o,flexBasis:t}})}var ki={},Me=1,Ce=2,Ii=e=>typeof e.intrinsicSize=="number",Bi=(e,t)=>{let o={};return e.forEach(n=>{o[n]=P(t,n)}),o},qe=(e,t,o)=>e.map((n,r)=>{var l;let i=P(n,"resizeable"),{[t]:s}=(l=U(n))!=null?l:ki,a=en(n);return o?{index:r,flexOpen:a,intrinsicSize:s,resizeable:i,...Bi(o,n)}:{index:r,flexOpen:a,intrinsicSize:s,resizeable:i}}),tn=e=>{let t=e.length,o=e.every(Ii),n=Array(t).fill(0);if(o&&(n[0]=Ce,n[t-1]=Ce),t<2)return n;for(let r=0,i=0;r<t-1;r++)e[r].resizeable&&!i&&(i=Me),n[r]+=i;for(let r=t-1;r>0&&(n[r]&Me&&(n[r]-=Me),!e[r].resizeable);r--);return n},on=(e,t)=>{let o=Hi(e,t),n=$i(e,t),r=o!==-1&&n!==-1?[o,n]:void 0,i=Oi(e,r);return[r,i]};function Oi(e,t){if(t){let o=[];for(let n=0;n<e.length;n++)e[n].flexOpen&&!t.includes(n)&&o.push(n);return o}}function Hi(e,t){let o=t,n=!1;for(;o>=1&&!n;)o=o-1,n=nn(e,o);return o}function $i(e,t){let o=t,n=!1,r=e.length;for(;o<r-1&&!n;)o=o+1,n=nn(e,o);return o===r?-1:o}function nn(e,t){let{placeholder:o,splitter:n,resizeable:r,intrinsicSize:i}=e[t];return!!(!n&&!i&&(o||r))}var Vi=e=>!e.splitter&&!e.placeholder,an=({children:e,onSplitterMoved:t,style:o})=>{let n=et(null),r=et(),i=et(),s=et([]),[,a]=Ni({}),l=y=>{i.current=y,a({})},c=(o==null?void 0:o.flexDirection)==="column",p=c?"height":"width",m=rn(()=>Array.isArray(e)?e:Ae.isValidElement(e)?[e]:[],[e]),u=Qe(y=>{let{current:d}=r;if(d){let[b,E]=on(d,y);b&&(b.forEach(R=>{var x;let T=(x=n.current)==null?void 0:x.childNodes[R];if(T){let{size:S,minSize:L}=Ui(T,p);d[R].currentSize=S,d[R].minSize=L}}),E&&E.forEach(R=>{var x;let T=(x=n.current)==null?void 0:x.childNodes[R];if(T){let{[p]:S}=T.getBoundingClientRect();d[R].flexBasis=S}}))}},[p]),f=Qe((y,d)=>{i.current&&r.current&&l(Wi(i.current,r.current,d,p))},[p]),h=Qe(()=>{let y=r.current;y&&(t==null||t(y.filter(Vi))),y==null||y.forEach(d=>{d.currentSize=void 0,d.flexBasis=void 0,d.flexOpen=!1})},[t]),g=Qe(y=>Ae.createElement(Jo,{column:c,index:y,key:`splitter-${y}`,onDrag:f,onDragEnd:h,onDragStart:u}),[f,h,u,c]);return rn(()=>{let[y,d]=_i(m,p,g,s.current);r.current=d,i.current=y},[m,g,p]),{content:i.current||[],rootRef:n}};function _i(e,t,o,n){let r=qe(e,t),i=tn(r),s=[],a=[];for(let l=0;l<e.length;l++){let c=e[l];if(l===0&&i[l]&Ce&&(s.push(sn(l)),a.push({placeholder:!0,shim:!0})),c.key==null){let p=n[l]||(n[l]=Fi());s.push(Ae.cloneElement(c,{key:p}))}else s.push(c);a.push(r[l]),l>0&&i[l]&Ce?(s.push(sn(l)),a.push({placeholder:!0})):i[l]&Me&&(s.push(o(s.length)),a.push({splitter:!0}))}return[s,a]}function Wi(e,t,o,n){return Gi(t,o)?e.map((i,s)=>{let a=t[s],{currentSize:l,flexOpen:c,flexBasis:p}=a,m=l!==void 0;if(m||c){let{flexBasis:u}=i.props.style||{},f=m?a.currentSize:p;return f!==u?Ae.cloneElement(i,{style:{...i.props.style,flexBasis:f,[n]:"auto"}}):i}else return i}):e}function Gi(e,t){let o=[];e.forEach((p,m)=>{p.currentSize!==void 0&&o.push(m)});let n=t<0?o[0]:o[1],{currentSize:r=0,minSize:i=0}=e[n];if(r===i)return!1;if(Math.abs(t)>r-i){let p=t<0?-1:1;t=Math.max(0,r-i)*p}let s=e[o[0]],{currentSize:a=0}=s;s.currentSize=a+t;let l=e[o[1]],{currentSize:c=0}=l;return l.currentSize=c-t,!0}function sn(e){return Ae.createElement(Je,{shim:e===0,key:`placeholder-${e}`})}function Ui(e,t){let{[t]:o}=e.getBoundingClientRect(),r=getComputedStyle(e).getPropertyValue(`min-${t}`),i=r.endsWith("px")?parseInt(r,10):0;return{size:o,minSize:i}}import{jsx as Ji}from"react/jsx-runtime";var Ot="hwFlexbox",ln=Xi(function(t,o){let{breakPoints:n,children:r,column:i,className:s,flexFill:a,gap:l,fullPage:c,id:p,onSplitterMoved:m,resizeable:u,row:f,spacing:h,splitterSize:g,style:y,...d}=t,{content:b,rootRef:E}=an({children:r,onSplitterMoved:m,style:y}),R=Yi(Ot,s,{[`${Ot}-column`]:i,[`${Ot}-row`]:f,"flex-fill":a,"full-page":c});return Ji("div",{...d,className:R,"data-resizeable":u||void 0,id:p,ref:Zi(E,o),style:{...y,gap:l,"--spacing":h},children:b})});ln.displayName="Flexbox";var Ht=ln;import{useCallback as Os}from"react";var ge={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"};import{useCallback as Zt,useContext as Fn,useEffect as zs,useRef as Hn,useState as ks}from"react";import Gt from"react";import{uuid as gn}from"@vuu-ui/vuu-utils";import Ie from"react";import{uuid as mn}from"@vuu-ui/vuu-utils";import ze,{cloneElement as ji}from"react";import{useCallback as ye}from"react";var V=new Map,Z=new Map,cn=e=>V.get(e),pn=e=>V.has(e),un=(e,t)=>V.set(e,t),be=()=>{let e=ye((s,a)=>{let l=Z.get(s);if(l)return a!==void 0&&l[a]!==void 0?l[a]:a!==void 0?void 0:l},[]),t=ye((s,a,l)=>{if(a===void 0)Z.set(s,l);else if(Z.has(s)){let c=Z.get(s);Z.set(s,{...c,[a]:l})}else Z.set(s,{[a]:l})},[]),o=ye((s,a)=>{if(Z.has(s)){if(a===void 0)Z.delete(s);else if(Z.get(s)[a]){let{[a]:c,...p}=Z.get(s);Object.keys(p).length>0?Z.set(s,p):Z.delete(s)}}},[]),n=ye((s,a)=>{let l=V.get(s);if(l)return a!==void 0?l[a]:l},[]),r=ye((s,a,l)=>{if(a===void 0)V.set(s,l);else if(V.has(s)){let c=V.get(s);V.set(s,{...c,[a]:l})}else V.set(s,{[a]:l})},[]),i=ye((s,a)=>{if(V.has(s)){if(a===void 0)V.delete(s);else if(V.get(s)[a]){let{[a]:c,...p}=V.get(s);Object.keys(p).length>0?V.set(s,p):V.delete(s)}}},[]);return{loadSessionState:e,loadState:n,saveSessionState:t,saveState:r,purgeState:i,purgeSessionState:o}};var dn=e=>e.flexDirection==="column"?["height","width"]:["width","height"],Ki={},ke=(e,t="0")=>{let[o,n]=Nt(w(e),e.props,t);return ze.cloneElement(e,o,n)},Ft=(e,t)=>{let o=w(e),[n,r]=Nt(o,e.props,"0",void 0,t);return ji(e,n,r)};function qi(e,t,o="0",n=null,r){var g,y;let{active:i=0,"data-path":s,path:a=s,id:l,style:c}=D(r),p=w(r)===e&&o===a,m=p?l:(g=t.id)!=null?g:mn(),u=e==="Stack"?(y=t.active)!=null?y:i:void 0,f=m,h=p?c:es(e,t,n);return ho(e)?{id:m,key:f,path:o,style:h,type:e,active:u}:{id:m,key:f,style:h,"data-path":o}}function Nt(e,t,o,n=null,r){var c,p;let i=qi(e,t,o,n,r);if(t.layout&&!r)return[i,[tt(t.layout,`${o}.0`)]];let s=(p=r==null?void 0:r.children)!=null?p:(c=r==null?void 0:r.props)==null?void 0:c.children,l=t.dropTarget&&s?s:Qi(e,t.children,o,s);return[i,l]}function Qi(e,t,o="0",n){let r=Array.isArray(t)?t:ze.isValidElement(t)?[t]:[];return F(e)?r.map((i,s)=>{let a=w(i),l=w(n==null?void 0:n[s]);if(!l||a===l){let[c,p]=Nt(a,i.props,`${o}.${s}`,e,n==null?void 0:n[s]);return ze.cloneElement(i,c,p)}return n==null?void 0:n[s]}):t}var es=(e,t,o)=>{let{style:n=Ki}=t;if(e==="Flexbox"&&(n={flexDirection:t.column?"column":"row",...n,display:"flex"}),n.flex){let{flex:r,...i}=n;n={...i,...Rt(typeof r=="number"?r:0)}}else o==="Stack"?n={...n,...Rt(1)}:o==="Flexbox"&&(n.width||n.height)&&n.flexBasis===void 0&&(n={...n,flexBasis:"auto",flexGrow:0,flexShrink:0});return n};function tt({id:e=mn(),type:t,children:o,props:n,state:r},i){let s=t.match(/^[a-z]/)?t:te[t];if(s===void 0)throw Error(`layoutUtils unable to create component from JSON, unknown type ${t}`);return r&&un(e,r),ze.createElement(s,{id:e,...n,key:e,path:i},o?o.map((a,l)=>tt(a,`${i}.${l}`)):void 0)}function fn(e){return hn(e)}function hn(e){let t=w(e),{id:o,children:n,type:r,...i}=D(e),s=pn(o)?cn(o):void 0;return{id:o,type:t,props:ts(i),state:s,children:ze.Children.map(n,hn)}}function ts(e){if(e){let{path:t,...o}=e,n={};for(let[r,i]of Object.entries(o))n[r]=$t(i);return n}}function $t(e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map($t);if(typeof e=="object"&&e!==null){let t={};for(let[o,n]of Object.entries(e))t[o]=$t(n);return t}}function yn(e,t){var s;let o=e.props.children,n=o.length,{index:r=-1,positionRelativeToTab:i="after"}=t.tab||{};return r===-1||r>=n?[o[n-1],"after"]:[(s=o[r])!=null?s:null,i]}function ot(e,t,o){let{active:n,children:r=[],path:i}=D(e),s=P(t,"path"),{idx:a,finalStep:l}=J(i,s,!0),[c,p]=l?os(e,r,o):[n,r==null?void 0:r.map((u,f)=>f===a?ot(u,t,o):u)],m=w(e)==="Stack"?Array.isArray(c)?c[0]:c:n;return Ie.cloneElement(e,{active:m},p)}function os(e,t,o){let n=P(e,"path"),r=t==null?void 0:t.length,{id:i=gn()}=D(o);return r?[r,t.concat(O(o,`${n}.${r}`,{id:i,key:i}))]:[0,[O(o,`${n}.0`,{id:i})]]}function nt(e,t,o,n,r,i,s){let{active:a,children:l,path:c}=D(e),p=P(t,"path"),{idx:m,finalStep:u}=J(c,p),[f,h]=u?ns(e,l,m,o,n,r,i,s):[a,l.map((y,d)=>d===m?nt(y,t,o,n,r,i,s):y)],g=w(e)==="Stack"?f:a;return Ie.cloneElement(e,{active:g},h)}function ns(e,t,o,n,r,i,s,a){let l=U(n);return l!=null&&l.width&&(l!=null&&l.height)?is(e,t,o,n,r,s,a):bn(e,t,o,n,r,(i==null?void 0:i.width)||(i==null?void 0:i.height),s)}var rs=(e,t,{top:o,right:n,bottom:r,left:i},[s,a,l,c])=>{if(e==="column"&&t==="before")return a-o;if(e==="column")return r-c;if(e==="row"&&t==="before")return s-i;if(e==="row")return n-l};function is(e,t,o,n,r,i,s){let{style:{flexDirection:a}}=D(e),[l,c,p]=Qo(a),{[c]:m,[l]:u}=U(n),f=P(t[o],"path"),h=rs(a,r,i,s),[g,y]=m<i[c]?[ve(n,p,f,i,s),u]:[n,void 0],d=h?K(f,h,{flexGrow:0,flexShrink:0}):void 0;return m>i[c]&&(t=t.map(b=>{if(P(b,"placeholder"))return b;{let{[c]:E}=U(b);return E&&E<m?ve(b,p,P(b,"path")):b}})),bn(e,t,o,g,r,y,i,d)}function bn(e,t,o,n,r,i,s,a){let l=P(e,"path"),c=0,p=!t||t.length===0?[n]:t.reduce((m,u,f)=>{if(o===f){let[h,g]=ss(e,u,n,s);r==="before"?a?m.push(a,g,h):m.push(g,h):a?m.push(h,g,a):m.push(h,g),c=m.indexOf(g)}else m.push(u);return m},[]).map((m,u)=>u<c?m:O(m,`${l}.${u}`));return[c,p]}function ss(e,t,o,n){let r=gn(),{version:i=0}=D(o);if(i+=1,w(e)==="Flexbox"){let[s]=dn(e.props.style),a=6,l={[s]:(n[s]-a)/2},c=It(t,s,l),p=It(o,s,l);return[Ie.cloneElement(t,{style:c}),Ie.cloneElement(o,{id:r,version:i,style:p})]}else{let{style:{left:s,top:a,flex:l,...c}={left:void 0,top:void 0,flex:void 0}}=D(o);return[t,Ie.cloneElement(o,{id:r,version:i,style:c})]}}var _={ADD:"add",DRAG_START:"drag-start",DRAG_DROP:"drag-drop",LAYOUT_RESIZE:"layout-resize",MAXIMIZE:"maximize",MINIMIZE:"minimize",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"};import ue from"react";import rt from"react";function xn(e,{target:t,replacement:o}){return Vt(e,t,o)}function Vt(e,t,o){let n=P(t,"path"),r=P(t,"resizeable"),{style:i}=D(t),s=ke(rt.cloneElement(o,{resizeable:r,style:{...i,...o.props.style}}),n);return W(e,t,s)}function W(e,t,o,n){if(e===t)return o;let{idx:r,finalStep:i}=J(P(e,"path"),P(t,"path")),s=e.props.children.slice();return i?n?n===ge.MINIMIZE?s[r]=as(e,s[r]):n===ge.RESTORE&&(s[r]=ls(s[r])):s[r]=o:s[r]=W(s[r],t,o,n),rt.cloneElement(e,void 0,s)}function as(e,t){let{style:o}=D(e),{style:n}=D(t),{width:r,height:i,flexBasis:s,flexShrink:a,flexGrow:l,...c}=n,p={width:r,height:i,flexBasis:s,flexShrink:a,flexGrow:l},m={...c,flexBasis:0,flexGrow:0,flexShrink:0},u=o.flexDirection==="row"?"vertical":o.flexDirection==="column"?"horizontal":!1;return u?rt.cloneElement(t,{collapsed:u,restoreStyle:p,style:m}):t}function ls(e){let{style:t,restoreStyle:o}=D(e),{flexBasis:n,flexShrink:r,flexGrow:i,...s}=t,a={...s,...o};return rt.cloneElement(e,{collapsed:!1,style:a,restoreStyle:void 0})}function _t(e,{path:t}){let o=$(e,t),n=q(e,t);if(n===null)return e;let{children:r}=D(n);if(r.length>1&&En(r,t)){let{style:{flexBasis:i,display:s,flexDirection:a,...l}}=D(n),c=P(n,"path"),p=W(e,n,K(c,i,l));for(;(n=q(p,c))&&P(n,"path")!=="0";){let{children:m}=D(n);if(En(m)){c=P(n,"path");let{style:{flexBasis:u,display:f,flexDirection:h,...g}}=D(n);p=W(e,n,K(c,u,g))}else if(ms(m))p=Dn(e,n);else break}return p}return Sn(e,o)}function Sn(e,t){let o=D(e),{children:n,path:r,preserve:i}=o,{active:s}=o,{idx:a,finalStep:l}=J(r,P(t,"path")),c=w(e),p=n.slice();if(l){if(p.splice(a,1),s!==void 0&&s>=a&&(s=Math.max(0,s-1)),p.length===1&&!i&&r!=="0"&&c.match(/Flexbox|Stack/))return cs(e,p[0]);!p.some(ps)&&p.some(Tn)&&(p=us(p))}else p[a]=Sn(p[a],t);return p=p.map((m,u)=>O(m,`${r}.${u}`)),ue.cloneElement(e,{active:s},p)}function cs(e,t){let o=w(e),{path:n,style:{flexBasis:r,flexGrow:i,flexShrink:s,width:a,height:l}}=D(e),c=O(t,n);if(n==="0")c=ue.cloneElement(c,{style:{...t.props.style,width:a,height:l}});else if(o==="Flexbox"){let p=e.props.style.flexDirection==="column"?"height":"width",{style:{[p]:m,...u}}=c.props;c=ue.cloneElement(c,{flexFill:void 0,style:{...u,flexGrow:i,flexShrink:s,flexBasis:r,width:a,height:l}})}return c}var ps=e=>e.props.style.flexGrow>0,Tn=e=>{let{width:t,height:o,flexGrow:n}=e.props.style;return n===0&&typeof t!="number"&&typeof o!="number"},us=e=>e.map(t=>Tn(t)?ue.cloneElement(t,{style:{...t.props.style,flexGrow:1}}):t),ms=e=>{if(e&&e.length>0){let t=P(e[0],"placeholder"),o=!1;for(let n=1;n<e.length;n++){if(o=P(e[n],"placeholder"),t&&o)return!0;t=o}}},Dn=(e,t)=>{let{children:o,path:n}=D(e),{idx:r,finalStep:i}=J(n,P(t,"path")),s=o.slice();return i?s[r]=ds(t):s[r]=Dn(s[r],t),s=s.map((a,l)=>O(a,`${n}.${l}`)),ue.cloneElement(e,void 0,s)},ds=e=>{let{children:t}=D(e),o=[],n=[];for(let i=0;i<t.length;i++)P(t[i],"placeholder")?n.push(t[i]):(n.length===1?o.push(n.pop()):n.length>0&&(o.push(Rn(n)),n.length=0),o.push(t[i]));n.length===1?o.push(n.pop()):n.length>0&&o.push(Rn(n));let r=P(e,"path");return ue.cloneElement(e,void 0,o.map((i,s)=>O(i,`${r}.${s}`)))},Rn=([e,...t])=>{let o=P(e,"style"),{flexBasis:n,flexGrow:r,flexShrink:i}=o;for(let{props:{style:s}}of t)n+=s.flexBasis,r=Math.max(r,s.flexGrow),i=Math.max(i,s.flexShrink);return ue.cloneElement(e,{style:{...o,flexBasis:n,flexGrow:r,flexShrink:i}})},En=(e,t)=>e.every(o=>P(o,"placeholder")||t&&P(o,"path")===t);import Wt from"react";function Pn(e,{path:t,size:o}){let n=$(e,t,!0),{style:r}=D(n),i={...r,width:o},s=Wt.cloneElement(n,{style:i});return W(e,n,s)}function wn(e,{path:t,sizes:o}){let n=$(e,t,!0),{children:r,style:i}=D(n),s=i.flexDirection==="column"?"height":"width",a=fs(r,o,s),l=Wt.cloneElement(n,void 0,a);return W(e,n,l)}function fs(e,t,o){return e.map((n,r)=>{let{style:{[o]:i,flexBasis:s}}=D(n),a=t[r],{currentSize:l,flexBasis:c}=a,m=l!==void 0?a.currentSize:c;return m===void 0||i===m||s===m?n:Wt.cloneElement(n,{style:hs(n.props.style,o,m)})})}function hs(e,t,o){let n=typeof e[t]=="number",{flexShrink:r=1,flexGrow:i=1}=e;return{...e,[t]:n?o:"auto",flexBasis:n?"auto":o,flexShrink:r,flexGrow:i}}import{uuid as gs}from"@vuu-ui/vuu-utils";import it from"react";var Ln=e=>{let[t]=w(e);return t===t.toLowerCase()};function Be(e,t,o,n,r,i){let{children:s,path:a}=D(e),l=P(t,"path"),{idx:c,finalStep:p}=J(a,l),m=p?ys(e,s,t,o,n,r,i):s.map((u,f)=>f===c?Be(u,t,o,n,r,i):u);return it.cloneElement(e,void 0,m)}function ys(e,t,o,n,r,i,s){let a=U(n);if(a!=null&&a.width&&(a!=null&&a.height)){if(i===void 0||s===void 0)throw Error("wrap-layout-element, updateChildren clientRect and dropRect must both be available");return xs(t,o,n,r,i,s)}return bs(e,t,o,n,r)}function bs(e,t,o,n,r){var x;let{version:i=0}=D(n),s=P(o,"path"),{type:a,flexDirection:l,showTabs:c}=Mn(r),[p,m,u]=Rs(a,o,n,l,r),f=vn(r),h=f?1:0,g={resizeable:!0,style:u,version:i+1},d={[Ln(o)?"data-resizeable":"resizeable"]:!0,style:m},b=a==="Stack"?{showTabs:c}:void 0,E=a==="Flexbox"?{splitterSize:(x=w(e)==="Flexbox"&&e.props.splitterSize)!=null?x:void 0}:void 0,R=gs(),T=it.createElement(te[a],{active:h,id:R,key:R,path:P(o,"path"),flexFill:P(o,"flexFill"),...E,...b,style:p,resizeable:P(o,"resizeable")},f?[O(o,`${s}.0`,d),ke(it.cloneElement(n,g),`${s}.1`)]:[ke(it.cloneElement(n,g),`${s}.0`),O(o,`${s}.1`,d)]);return t.map(S=>S===o?T:S)}function xs(e,t,o,n,r,i){let{flexDirection:s}=Mn(n),a=s==="column"?"row":"column",l=vn(n),[c,p,m,u]=i,[f,h]=s==="column"?[p-r.top,r.bottom-u]:[c-r.left,r.right-m],g=P(t,"path"),y=0,d=Ln(t)?"data-resizeable":"resizeable",b=[];f&&b.push(l?O(t,`${g}.${y++}`,{[d]:!0,style:{flexBasis:f,flexGrow:1,flexShrink:1}}):K(`${g}.${y++}`,f,{flexGrow:0,flexShrink:0})),b.push(ve(o,a,`${g}.${y++}`,r,i)),h&&b.push(l?K(`${g}.${y++}`,0):O(t,`${g}.${y++}`,{[d]:!0,style:{flexBasis:0,flexGrow:1,flexShrink:1}}));let E=Bt(s,t.props,b,g);return e.map(R=>R===t?E:R)}function Rs(e,t,o,n,r){let i={...t.props.style,flexDirection:n},s=e==="Flexbox"&&n==="column"?"height":"width",a=kt(o,s,r),l=kt(t,s);return[i,l,a]}var vn=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 Mn(e){return e.position.Header?{type:"Stack",flexDirection:"column",showTabs:!0}:{type:"Flexbox",flexDirection:e.position.EastOrWest?"row":"column"}}var In=(e,t)=>{switch(t.type){case _.ADD:return Ps(e,t);case _.DRAG_DROP:return Ds(e,t);case _.MAXIMIZE:return Ts(e,t);case _.REMOVE:return _t(e,t);case _.REPLACE:return xn(e,t);case _.SET_PROP:return Cn(e,t);case _.SET_PROPS:return Ss(e,t);case _.SET_TITLE:return Cn(e,{type:"set-prop",path:t.path,propName:"title",propValue:t.title});case _.SPLITTER_RESIZE:return wn(e,t);case _.LAYOUT_RESIZE:return Pn(e,t);case _.SWITCH_TAB:return Es(e,t);default:return e}},Es=(e,{path:t,nextIdx:o})=>{let n=$(e,t,!0),r=Gt.cloneElement(n,{active:o});return W(e,n,r)},Cn=(e,{path:t,propName:o,propValue:n})=>{let r=$(e,t,!0),i=Gt.cloneElement(r,{[o]:n});return W(e,r,i)},Ss=(e,{path:t,props:o})=>{let n=$(e,t,!0),r=Gt.cloneElement(n,o);return W(e,n,r)},Ts=(e,{path:t,type:o})=>{if(t){let n=$(e,t,!0);return W(e,n,n,o)}else return e},Ds=(e,t)=>{var h,g;let{draggedReactElement:o,dragInstructions:n,dropTarget:r}=t,i=r.component,{pos:s}=r,a=((h=s==null?void 0:s.position)==null?void 0:h.Header)&&w(i)==="Stack",{id:l,version:c}=D(o),p=U(o),m;if(a){let[y,d]=yn(i,s);y===void 0?m=ot(e,i,o):m=nt(e,y,o,d)}else!p&&((g=s==null?void 0:s.position)!=null&&g.Centre)?m=Vt(e,i,o):m=ws(e,r,o);if(n.DoNotRemove)return m;let u=Q(m,y=>y.id===l&&y.version===c),f=P(u,"path");return _t(m,{path:f,type:"remove"})},Ps=(e,{path:t,component:o})=>ot(e,$(e,t),o),ws=(e,t,o)=>{let{component:n,pos:r,clientRect:i,dropRect:s}=t,a=P(n,"path");if(a==="0.0")return Be(e,n,o,r);let l=q(e,a);if(An(r,l)){let c=r.position.SouthOrEast?"after":"before";return nt(e,n,o,c,r,i,s)}if(!An(r,l))return Be(e,n,o,r,i,s);if(F(w(l)))return Be(e,n,o,r);throw Error(`no support right now for position = ${r.position}`)},An=(e,t)=>e.position.Centre?kn(t)||zn(t):e.position.NorthOrSouth?zn(t):e.position.EastOrWest?kn(t):!1,zn=e=>w(e)==="Flexbox"&&e.props.style.flexDirection==="column",kn=e=>w(e)==="Flexbox"&&e.props.style.flexDirection!=="column";import{createContext as Ls}from"react";var vs=e=>console.log(`dispatch ${e.type}, have you forgotten to provide a LayoutProvider ?`),Oe=Ls({dispatchLayoutProvider:vs,version:-1});import{useCallback as st,useRef as Ut}from"react";var Ms={},Bn=[0,0],Cs=(e,t,o)=>{let n=document.createElement("div");n.className="vuuSimpleDraggableWrapper",n.classList.add("vuuSimpleDraggableWrapper","salt-theme","salt-density-medium"),n.dataset.dragging="true";let r=o!=null?o:document.createElement("div");r.id=t,n.appendChild(r),document.body.appendChild(n);let i=`top:${e.top}px;left:${e.left}px;width:${e.width}px;height:${e.height}px;`;return[n,i,e.left,e.top]},As=e=>{let{offsetParent:t}=e;if(t===null)return Bn;{let{left:o,top:n}=t.getBoundingClientRect();return[o,n]}},On=(e,t)=>{let o=Ut(),n=Ut(),r=Ut(),i=st((c,p)=>{if(n.current&&r.current){let{dragOffsets:[m,u],targetPosition:f}=n.current,h=typeof c=="number"?c-m:f.left,g=typeof p=="number"?p-u:f.top;(h!==f.left||g!==f.top)&&(n.current.targetPosition.left=h,n.current.targetPosition.top=g,r.current.style.top=g+"px",r.current.style.left=h+"px")}},[]),s=st(c=>{if(n.current){let{dragInstructions:p,payload:m,originalCSS:u}=n.current;t({type:"drag-drop",draggedReactElement:m,dragInstructions:p,dropTarget:c}),console.log("[useLayoutDragDrop]",{dragInstructions:p}),r.current&&(p.RemoveDraggableOnDragEnd?document.body.removeChild(r.current):(r.current.style.cssText=u,delete r.current.dataset.dragging)),o.current=void 0,n.current=void 0,r.current=void 0}},[t]),a=st(c=>{if(o.current){let{payload:p,dragContainerPath:m,dragElement:u,dragRect:f,instructions:h=Ms,path:g}=o.current,{current:y}=e,d={x:c.clientX,y:c.clientY},b=p!=null?p:$(y,g,!0),{id:E}=b.props,R=U(b),T="",x="",S="",L=-1,C=-1,B=Bn,v=document.getElementById(E);if(v===null)[v,x,L,C]=Cs(f,E,u);else{B=As(v);let[I,M]=B,{width:A,height:z,left:X,top:G}=v.getBoundingClientRect();L=X-I,C=G-M,x=`width:${A}px;height:${z}px;left:${L}px;top:${C}px;z-index: 100;background-color:#ccc;opacity: 0.6;`,v.dataset.dragging="true",T=v.style.cssText}S=At.initDrag(e.current,m,f,d,{drag:i,drop:s},R),v.style.cssText=x+S,r.current=v,n.current={payload:b,originalCSS:T,dragRect:f,dragOffsets:B,dragInstructions:h,targetPosition:{left:L,top:C}}}},[i,s,e]);return st(c=>{let{evt:p,...m}=c;console.log("prepare to drag",{options:m}),o.current={...m,dragContainerPath:""},At.handleMousedown(p,a,m.instructions)},[a])};import{jsx as Nn}from"react/jsx-runtime";var $n=e=>e.dropTarget,Is=e=>["drag-drop","remove","set-title","splitter-resize","switch-tab"].includes(e.type),_m=()=>{let e=Bs();return Nn("div",{children:`Context: ${e} `})},Wm=e=>{let{children:t,layout:o,onLayoutChange:n}=e,r=Hn(void 0),i=Hn(t),[,s]=ks(null),a=Zt(m=>{if(n){let u=Q(m,$n)||r.current,h=w(u)==="DraggableLayout"?D(u).children[0]:u,g=fn(h);n(g,"drag-root")}},[n]),l=Zt((m,u=!1)=>{let f=In(r.current,m);f!==r.current&&(r.current=f,s({}),!u&&Is(m)&&a(f))},[a]),c=Zt(m=>{switch(m.type){case"drag-start":{p(m);break}case"save":{a(r.current);break}default:{l(m);break}}},[l,a]),p=On(r,c);return zs(()=>{if(o){let m=Q(r.current,$n),u=Eo(m),f=tt(o,`${m.props.path}.0`),h=u?{type:_.REPLACE,target:u,replacement:f}:{type:_.ADD,path:m.props.path,component:f};l(h,!0)}},[l,o]),r.current===void 0?r.current=Ft(t):t!==i.current&&(r.current=Ft(t,r.current),i.current=t),Nn(Oe.Provider,{value:{dispatchLayoutProvider:c,version:0},children:r.current})},Y=()=>{let{dispatchLayoutProvider:e}=Fn(Oe);return e},Bs=()=>{console.log({LayoutProviderContext:Oe});let{version:e}=Fn(Oe);return e};import{jsx as Hs}from"react/jsx-runtime";var Vn=function(t){let{path:o}=t,n=Y(),r=Os(i=>{n({type:ge.SPLITTER_RESIZE,path:o,sizes:i})},[n,o]);return Hs(Ht,{...t,onSplitterMoved:r})};Vn.displayName="Flexbox";k("Flexbox",Vn,"container");import{useForkRef as na}from"@salt-ds/core";import ra from"classnames";import{forwardRef as ia}from"react";import{useCallback as Yn,useEffect as Ws,useRef as Jt,useState as Gs}from"react";import{useCallback as $s,useLayoutEffect as _n,useRef as Fs}from"react";var rd=["height","width"],id=["height"],sd=["width"],me=new WeakMap,Gn=(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:n}=t,r=me.get(o);if(r){let{onResize:i,measurements:s}=r,a=!1;for(let[l,c]of Object.entries(s)){let p=Gn(o,n,l);p!==c&&(a=!0,s[l]=p)}a&&i&&i(s)}}});function Un(e,t,o,n=!1){let r=Fs(t),i=$s(s=>{let a=s.getBoundingClientRect();return r.current.reduce((l,c)=>(l[c]=Gn(s,a,c),l),{})},[]);_n(()=>{let s=e.current,a=!1;async function l(){me.set(s,{measurements:{}}),a=!1;let{fonts:c}=document;if(c&&await c.ready,!a){let p=me.get(s);if(p){let m=i(s);p.measurements=m,Wn.observe(s),n&&o(m)}}}if(s){if(me.has(s))throw Error("useResizeObserver attemping to observe same element twice");l()}return()=>{s&&me.has(s)&&(Wn.unobserve(s),me.delete(s),a=!0)}},[e,i,n,o]),_n(()=>{let s=e.current,a=me.get(s);if(a){if(r.current!==t){r.current=t;let l=i(s);a.measurements=l}a.onResize=o}},[t,i,e,o])}function Ns(e,t){let o=document.body.querySelector(`.${e}`),n={get:function(r,i){let s=r.getPropertyValue(`--${e}-breakpoint-${i}`);return s?parseInt(s):void 0}};return o?new Proxy(getComputedStyle(o),n):t!=null?t:{}}var Vs=([,e],[,t])=>t-e,Xt=e=>Object.entries(e).sort(Vs).map(([t,o],n,r)=>[t,o,n<r.length-1?r[n+1][1]:9999]),Yt=null,_s=(e="salt")=>{let{xs:t,sm:o,md:n,lg:r,xl:i}=Ns(e);return Xt({xs:t,sm:o,md:n,lg:r,xl:i})},Zn=e=>(Yt===null&&(Yt=_s(e)),Yt);var Us=[],Xn=({breakPoints:e,smallerThan:t},o)=>{let[n,r]=Gs(t?!1:"lg"),i=Jt(document.body),s=Jt(e?Xt(e):Zn()),a=Jt("lg"),l=Yn(p=>{if(s.current){for(let[m,u]of s.current)if(p>=u)return m}},[s]),c=Yn(p=>{if(t){let m=s.current.find(([u])=>u===t);if(m){let[,,u]=m;return p<u}}else return l(p);return p},[t,l]);return Un(o||i,s.current?["width"]:Us,({width:p})=>{let m=c(p);m!==a.current&&(a.current=m,r(m))},!0),Ws(()=>{let p=o||i;if(p.current){let m=a.current;if(s.current){let{clientWidth:u}=p.current,f=c(u);a.current=f,f!==m&&r(f)}}},[r,c,o]),n};var Jn="data-collapsible",Zs={[Jn]:!0,"data-pad-start":!0,"data-pad-end":!0},Ys=e=>{var t;return(t=Zs[e])!=null?t:!1},Xs=e=>e===Jn,Js={dynamic:"dynamic",instant:"instant",true:"instant"},js=e=>{var t;return(t=Js[e])!=null?t:"none"},hd=e=>Object.keys(e).reduce((t,o)=>{let[n,r]=t;if(Ys(o)){let i=Xs(o)?js(e[o]):e[o];n[o]=i,r[o]=void 0}return t},[{},{}]);import{getUniqueId as Ks}from"@vuu-ui/vuu-utils";import{cloneElement as qs,isValidElement as Qs,useCallback as ea,useMemo as jn,useRef as jt}from"react";var ta=["xs","sm","md","lg","xl"],oa=12,Kn=({children:e,cols:t,style:o})=>{let n=jt(null),r=jt(null),i=jt(),s=t!=null?t:oa,l=(o==null?void 0:o.flexDirection)==="column"?"height":"width",c=jn(()=>Array.isArray(e)?e:Qs(e)?[e]:[],[e]),p=ea((m,u)=>{let f=qe(m,u,ta),h=[],g=[];for(let y=0;y<m.length;y++){let d=m[y],{style:{flex:b,...E}}=d.props;h.push(qs(d,{key:Ks(),style:{...E,"--parent-col-count":s}})),g.push(f[y])}return[h,g]},[s]);return jn(()=>{let[m,u]=p(c,l);r.current=u,i.current=m},[p,c,l]),{cols:s,content:i.current,rootRef:n}};import{jsx as sa}from"react/jsx-runtime";var at="hwFluidGrid",Kt=ia(function(t,o){let{breakPoints:n,children:r,column:i,cols:s=12,className:a,flexFill:l,gap:c=3,fullPage:p,id:m,onSplitterMoved:u,resizeable:f,row:h,showGrid:g,spacing:y,splitterSize:d,style:b,...E}=t,{cols:R,content:T,rootRef:x}=Kn({children:r,cols:s,style:b}),S=Xn({breakPoints:n},x),L=ra(at,a,{[`${at}-column`]:i,[`${at}-row`]:h,[`${at}-show-grid`]:g,"flex-fill":l,"full-page":p}),C={...b,"--spacing":y,"--grid-col-count":R,"--grid-gap":c};return sa("div",{...E,className:L,"data-breakpoint":S,"data-cols":R,"data-resizeable":f||void 0,id:m,ref:na(x,o),style:C,children:T})});Kt.displayName="FluidGrid";import{jsx as aa}from"react/jsx-runtime";var qn=function(t){return aa(Kt,{...t})};qn.displayName="FluidGrid";k("FluidGrid",qn,"container");import Ta from"classnames";import cr,{useRef as Da,useState as pr}from"react";import{useCallback as He,useState as la}from"react";var lt=(e,t,o,n)=>{var y;let{loadSessionState:r,purgeSessionState:i,purgeState:s,saveSessionState:a}=be(),[l,c]=la((y=r(e,"contributions"))!=null?y:[]),p=Y(),m=He((d,b)=>{let E=l.concat([{location:d,content:b}]);a(e,"contributions",E),c(E)},[l,e,a]),u=He(()=>{i(e,"contributions"),c([])},[e,i]),f=He(()=>{let d=r(e,"data-source");d&&d.unsubscribe(),i(e),s(e),p({type:"remove",path:o})},[p,e,r,i,s,o]),h=He(async(d,b,E)=>{var T;d.stopPropagation();let R=(T=t.current)==null?void 0:T.getBoundingClientRect();return new Promise((x,S)=>{p({type:"drag-start",evt:d,path:b===void 0?o:`${o}.${b}`,dragRect:R,preDragActivity:E,dropTargets:n,resolveDragStart:x,rejectDragStart:S})})},[t,p,o,n]);return[He(async(d,b)=>{var R;let{type:E}=d;switch(E){case"maximize":case"minimize":case"restore":return p({type:E,path:(R=d.path)!=null?R:o});case"remove":return f();case"mousedown":return h(b,d.index,d.preDragActivity);case"add-toolbar-contribution":return m(d.location,d.content);case"remove-toolbar-contribution":return u();default:return}},[p,o,f,h,m,u]),l]};import{useForkRef as fa,useIdMemo as ha}from"@salt-ds/core";import ga from"classnames";import Qt,{forwardRef as ya,useCallback as ba,useMemo as xa,useRef as sr,useState as Ra}from"react";import{useCallback as de,useMemo as Qn}from"react";var er=({id:e,rootRef:t,path:o,dropTargets:n,title:r})=>{let i=Y(),{loadState:s,loadSessionState:a,purgeState:l,saveState:c,saveSessionState:p}=be(),[m,u]=lt(e,t,o,n),f=Qn(()=>{var x;return(x=s("view-title"))!=null?x:r},[s,r]),h=de(x=>{o&&i({type:"set-title",path:o,title:x})},[i,o]),g=Qn(()=>s(e),[e,s]),y=de(x=>s(e,x),[e,s]),d=de(x=>{l(e,x),i({type:"save"})},[e,i,l]),b=de((x,S)=>{c(e,S,x),i({type:"save"})},[e,i,c]),E=de(x=>a(e,x),[e,a]),R=de((x,S)=>p(e,S,x),[e,p]),T=de(({type:x,...S})=>{let{[x]:L}=S;b(L,x)},[b]);return{contributions:u,dispatchViewAction:m,load:y,loadSession:E,onConfigChange:T,onEditTitle:h,purge:d,restoredState:g,save:b,saveSession:R,title:f}};import{useResizeObserver as ca,WidthHeight as pa}from"@heswell/salt-lab";import{useCallback as tr,useRef as or}from"react";var ua=[],nr=({mainRef:e,resize:t="responsive",rootRef:o})=>{let n=t==="defer",r=or({}),i=or(),s=tr(()=>{e.current&&(e.current.style.height=r.current.height+"px",e.current.style.width=r.current.width+"px"),i.current=void 0},[e]),a=tr(({height:l,width:c})=>{r.current.height=l,r.current.width=c,i.current!==null&&clearTimeout(i.current),i.current=window.setTimeout(s,40)},[s]);ca(o,n?pa:ua,a,n)};import ma,{useContext as rr}from"react";var da={dispatch:null},ct=ma.createContext(da),ir=()=>{var t;let e=rr(ct);return(t=e==null?void 0:e.dispatch)!=null?t:null},ff=()=>rr(ct);import{jsx as qt,jsxs as Sa}from"react/jsx-runtime";var $e="vuuView",Ea=(e,t)=>e&&t?{...e,...t}:e||t,ar=ya(function(t,o){let{Header:n=lr,children:r,className:i,collapsed:s,closeable:a,"data-path":l,"data-resizeable":c,dropTargets:p,expanded:m,flexFill:u,id:f,header:h,orientation:g="horizontal",path:y=l,resize:d="responsive",resizeable:b=c,tearOut:E,style:R={},title:T,...x}=t,S=ha(f),L=sr(null),C=sr(null),[B,v]=Ra(),{contributions:I,dispatchViewAction:M,load:A,loadSession:z,onConfigChange:X,onEditTitle:G,purge:Re,restoredState:lo,save:co,saveSession:po,title:ht}=er({id:S,rootRef:L,path:y,dropTargets:p,title:T});nr({mainRef:C,resize:d,rootRef:L});let uo=ba(vr=>{v(vr)},[]),Pr=()=>Qt.isValidElement(r)&&(lo||B)?Qt.cloneElement(r,Ea(lo,B)):r,wr=xa(()=>({dispatch:M,id:S,path:y,title:ht,load:A,loadSession:z,onConfigChange:X,purge:Re,save:co,saveSession:po,setComponentProps:uo}),[M,S,A,z,X,y,Re,co,po,uo,ht]),Lr=typeof h=="object"?h:{};return qt("div",{...x,className:ga($e,i,{[`${$e}-collapsed`]:s,[`${$e}-expanded`]:m,[`${$e}-resize-defer`]:d==="defer"}),"data-resizeable":b,id:S,ref:fa(o,L),style:R,tabIndex:-1,children:Sa(ct.Provider,{value:wr,children:[h?qt(n,{...Lr,collapsed:s,contributions:I,expanded:m,closeable:a,onEditTitle:G,orientation:g,tearOut:E,title:ht}):null,qt("div",{className:`${$e}-main`,ref:C,children:Pr()})]})})});ar.displayName="View";var le=Qt.memo(ar);le.displayName="View";k("View",le,"view");import{EditableLabel as Pa,Toolbar as wa,ToolbarButton as La,ToolbarField as va,Tooltray as ur}from"@heswell/salt-lab";import{CloseIcon as Ma}from"@salt-ds/icons";import{jsx as xe,jsxs as Ca}from"react/jsx-runtime";var lr=({className:e,contributions:t,collapsed:o,closeable:n,onEditTitle:r,orientation:i="horizontal",style:s,title:a="Untitled"})=>{let l=Da(null),[c,p]=pr(a),[m,u]=pr(!1),f=ir(),h=v=>f==null?void 0:f({type:"remove"},v),g="vuuHeader",y=()=>{var v;(v=l.current)==null||v.focus()},d=v=>{v.stopPropagation()},E=Ta(g,e,`${g}-${o||i}`),R=()=>{u(!0)},T=v=>{v.key==="Enter"&&u(!0)},x=(v="",I="",M=!0,A=!1)=>{var z;u(!1),A?p(v):I!==v&&(p(I),r==null||r(I)),M===!1&&((z=l.current)==null||z.focus())},S=v=>{f==null||f({type:"mousedown"},v)},L=[],C=[],B=[];return t==null||t.forEach((v,I)=>{switch(v.location){case"pre-title":L.push(cr.cloneElement(v.content,{key:I}));break;default:C.push(cr.cloneElement(v.content,{key:I}))}}),a&&L.push(xe(va,{className:"vuuHeader-title",children:xe(Pa,{editing:m,value:c,onChange:p,onMouseDownCapture:y,onEnterEditMode:R,onExitEditMode:x,onKeyDown:T,ref:l,tabIndex:0},"title")},"title")),n&&B.push(Ca(La,{onClick:h,onMouseDown:d,children:[xe(Ma,{})," Close"]},"close")),C.length>0&&L.push(xe(ur,{"data-align-end":!0,children:C},"contributions")),B.length>0&&L.push(xe(ur,{"data-align-end":!0,children:B},"actions")),xe(wa,{className:E,orientation:i,style:s,onMouseDown:S,children:L})};import{uuid as Aa}from"@vuu-ui/vuu-utils";import{List as za,ListItem as ka}from"@heswell/salt-lab";import mr from"classnames";import{cloneElement as Ia,memo as Ba}from"react";import{jsx as eo}from"react/jsx-runtime";var Oa=e=>{let t=e.cloneNode(!0);return t.id="",delete t.dataset.idx,t},dr=Ba(({className:e,children:t,idx:o,resizeable:n,header:r,closeable:i,...s})=>eo(ka,{className:mr("vuuPaletteItem",e),"data-draggable":!0,...s}));dr.displayName="PaletteItem";var Ha=({children:e,className:t,orientation:o="horizontal",ViewProps:n,...r})=>{let i=Y(),s="vuuPalette";function a(l){var S;let p=l.target.closest(".vuuPaletteItem"),m=parseInt((S=p.dataset.idx)!=null?S:"-1");m!==-1&&console.log({children:e,idx:m,listItemElement:p});let{props:{caption:u,children:f,template:h,...g}}=e[m],{height:y,left:d,top:b,width:E}=p.getBoundingClientRect(),R=Aa(),x=h?f:eo(le,{...n,...{id:R,key:R},...g,title:g.label,children:f});i({dragRect:{left:d,top:b,right:d+E,bottom:b+150,width:E,height:y},dragElement:Oa(p),evt:l.nativeEvent,instructions:{DoNotRemove:!0,DoNotTransform:!0,RemoveDraggableOnDragEnd:!0,dragThreshold:10},path:"*",payload:x,type:"drag-start"})}return eo(za,{...r,borderless:!0,className:mr(s,t,`${s}-${o}`),maxHeight:800,selected:null,children:e.map((l,c)=>l.type===dr?Ia(l,{key:c,onMouseDown:a}):l)})};k("Palette",Ha,"view");import{uuid as $a}from"@vuu-ui/vuu-utils";import{List as Fa,ListItem as Na}from"@heswell/salt-lab";import Va from"classnames";import{jsx as to}from"react/jsx-runtime";var _a="vuuPalette",vh=e=>{let{children:t,ViewProps:o,label:n,onMouseDown:r,template:i,...s}=e,a=Y();return to(Na,{onMouseDown:c=>{let{left:p,top:m,width:u}=c.currentTarget.getBoundingClientRect(),f=$a(),g=i?t:to(le,{...{id:f,key:f},...o,title:e.label,children:t});a({type:"drag-start",evt:c.nativeEvent,path:"*",payload:g,instructions:{DoNotRemove:!0,DoNotTransform:!0,RemoveDraggableOnDragEnd:!0,dragThreshold:10},dragRect:{left:p,top:m,right:p+u,bottom:m+150,width:u,height:100}})},...s,children:n})},Wa=({className:e,...t})=>to(Fa,{...t,className:Va(_a,e),height:"100%",selectionStrategy:"none"});k("PaletteSalt",Wa,"view");import{Tab as Ga,Tabstrip as Ua,Toolbar as Za,ToolbarField as Ya}from"@heswell/salt-lab";import{useIdMemo as Xa}from"@salt-ds/core";import Ja from"classnames";import ut,{forwardRef as ja,useCallback as Ka}from"react";import{jsx as pt,jsxs as tl}from"react/jsx-runtime";var fr="Tabs",qa=()=>{},Qa=(e,t)=>{var o,n;return(n=(o=e.props)==null?void 0:o.title)!=null?n:`Tab ${t+1}`},el=e=>{let t=[];return ut.Children.forEach(e,o=>{ut.isValidElement(o)?t.push(o):console.warn("Stack has unexpected child element type")}),t},oo=ja(function({active:t=0,children:o,className:n,enableAddTab:r,enableCloseTabs:i,getTabIcon:s=qa,getTabLabel:a=Qa,id:l,keyBoardActivation:c="manual",onMouseDown:p,onTabAdd:m,onTabClose:u,onTabEdit:f,onTabSelectionChanged:h,showTabs:g,style:y,TabstripProps:d},b){var I;let E=Xa(l),R=M=>{h==null||h(M)},T=M=>{u==null||u(M)},x=()=>{m==null||m(ut.Children.count(o))},S=M=>{var G;let z=M.target.closest('[role^="tab"]');if((z==null?void 0:z.getAttribute("role"))==="tab"){let Re=parseInt((G=z.dataset.idx)!=null?G:"-1");if(Re===-1)throw Error("Stack: mousedown on tab with unknown index");p==null||p(M,Re)}},L=Ka((M,A,z,X)=>{f==null||f(X,A)},[f]),C=()=>{var M;return ut.isValidElement(o)?o:Array.isArray(o)&&(M=o[t])!=null?M:null},B=()=>el(o).map((M,A)=>{let z=`${E}-${A}`,{closeable:X,id:G}=M.props;return pt(Ga,{ariaControls:`${z}-tab`,"data-icon":s(M,A),draggable:!0,id:z,label:a(M,A),closeable:X&&(d==null?void 0:d.enableCloseTab)!==!1,editable:(d==null?void 0:d.enableRenameTab)!==!1},G!=null?G:A)}),v=C();return tl("div",{className:Ja(fr,n,{[`${fr}-horizontal`]:(d==null?void 0:d.orientation)==="vertical"}),style:y,id:E,ref:b,children:[g?pt(Za,{className:"vuuTabHeader vuuHeader",orientation:d==null?void 0:d.orientation,children:pt(Ya,{disableFocusRing:!0,"data-collapsible":"dynamic","data-priority":"3",style:{alignSelf:"flex-end"},children:pt(Ua,{...d,activeTabIndex:(I=d==null?void 0:d.activeTabIndex)!=null?I:v===null?-1:t,enableRenameTab:(d==null?void 0:d.enableRenameTab)!==!1,enableAddTab:r,enableCloseTab:i,keyBoardActivation:c,onActiveChange:R,onAddTab:x,onCloseTab:T,onExitEditMode:L,onMouseDown:S,children:B()})})}):null,v]})});oo.displayName="Stack";import{useIdMemo as ol}from"@salt-ds/core";import nl,{useRef as rl}from"react";import{jsx as no}from"react/jsx-runtime";var il=e=>no(le,{resizeable:!0,title:`Tab ${e}`,style:{flexGrow:1,flexShrink:0,flexBasis:0},header:!0,closeable:!0,children:no(xt,{style:{flex:1}})}),hr=e=>{let t=rl(null),o=Y(),{loadState:n}=be(),{createNewChild:r=il,id:i,onTabSelectionChanged:s,path:a,...l}=e,{children:c}=e,p=ol(i),[m]=lt(p,t,a);return no(oo,{...l,id:p,getTabLabel:(b,E)=>{let{id:R,title:T}=b.props;return n(R,"view-title")||T||`Tab ${E+1}`},onMouseDown:async(b,E)=>{let R;await m({type:"mousedown",index:E,preDragActivity:async()=>new Promise(S=>{console.log("preDragActivity: Ok, gonna release the drag"),R=S})},b)&&(R==null||R(void 0))},onTabAdd:(b,E=nl.Children.count(c))=>{if(a){console.log("[StackLayout] handleTabAdd");let R=r(E);console.log({component:R}),o({type:"add",path:a,component:R})}},onTabClose:b=>{if(Array.isArray(c)){let{props:{"data-path":E,path:R=E}}=c[b];o({type:"remove",path:R})}},onTabEdit:(b,E)=>{o({type:"set-title",path:`${a}.${b}`,title:E})},onTabSelectionChanged:b=>{console.log(`StackLayout handleTabSelection nextTab = ${b}`),a&&(o({type:"switch-tab",path:a,nextIdx:b}),s==null||s(b))},ref:t})};hr.displayName="Stack";k("Stack",hr,"container");import gr,{useState as yr}from"react";import{jsx as ro,jsxs as br}from"react/jsx-runtime";var fg=({children:e})=>{let[o,n]=yr(e),[r,i]=yr(e),s=l=>{let c=To(o,l);i(c)},a=(l,c)=>{console.log(`change ${l} -> ${c}`);let p=gr.cloneElement(r,{style:{...r.props.style,[l]:c}});i(p),n(gr.cloneElement(o,{},p))};return br("div",{"data-design-mode":`${!1}`,children:[o,ro("br",{}),br("div",{style:{display:"flex"},children:[ro(xr,{height:300,managedStyle:r.props.style,width:300,onChange:a,style:void 0}),ro(Rr,{layout:o,onSelect:s,style:{width:300,height:300,backgroundColor:"#ccc"}})]})]})};import{FormField as mt,Input as dt}from"@heswell/salt-lab";import{jsx as H,jsxs as so}from"react/jsx-runtime";var ao={},sl={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"}},io=({feature:e,children:t,style:o,onChange:n})=>so("div",{className:`LayoutBox layout-${e} layout-outer`,children:[so("div",{className:"layout-top",children:[H("span",{className:"layout-title",children:e}),H(mt,{className:"layout-input",style:{width:30},children:H(dt,{value:o.top,onChange:(r,i)=>n(e,"top",i)})})]}),so("div",{className:"layout-inner",children:[H("div",{className:"layout-left",children:H(mt,{className:"layout-input",style:{width:30},children:H(dt,{value:o.left,onChange:(r,i)=>n(e,"left",i)})})}),t,H("div",{className:"layout-right",children:H(mt,{className:"layout-input",style:{width:30},children:H(dt,{value:o.right,onChange:(r,i)=>n(e,"right",i)})})})]}),H("div",{className:"layout-bottom",children:H(mt,{className:"layout-input",style:{width:30},children:H(dt,{value:o.bottom,onChange:(r,i)=>n(e,"bottom",i)})})})]}),Tg={margin:!0,marginTop:!0,marginRight:!0,marginBottom:!0,marginLeft:!0},Dg={padding:!0,paddingTop:!0,paddingRight:!0,paddingBottom:!0,paddingLeft:!0},Pg={border:!0,borderColor:!0,borderWidth:!0,borderTopWidth:!0,borderRightWidth:!0,borderBottomWidth:!0,borderLeftWidth:!0},ft="(\\d+)(?:px)?",al=`^(?:${ft}(?:\\s${ft}(?:\\s${ft}(?:\\s${ft})?)?)?)$`,Er=new RegExp(al),ll=/^(?:(\d+)(?:px)\ssolid\s([a-zA-Z,0-9().]+))$/,xr=({height:e,managedStyle:t,onChange:o,style:n,width:r})=>{let i=Sr(t),s=(E,R,T)=>{let x=parseInt(T||"0",10),S=sl[E][R];o(S,x)},{marginTop:a=0,marginRight:l=0,marginBottom:c=0,marginLeft:p=0}=i,{borderTopWidth:m=0,borderRightWidth:u=0,borderBottomWidth:f=0,borderLeftWidth:h=0}=i,{paddingTop:g=0,paddingRight:y=0,paddingBottom:d=0,paddingLeft:b=0}=i;return H("div",{className:"LayoutConfigurator",style:{width:r,height:e,...n},children:H(io,{feature:"margin",style:{top:a,right:l,bottom:c,left:p},onChange:s,children:H(io,{feature:"border",style:{top:m,right:u,bottom:f,left:h},onChange:s,children:H(io,{feature:"padding",style:{top:g,right:y,bottom:d,left:b},onChange:s,children:H("div",{className:"layout-content"})})})})})};function wg(e=ao,t=ao){let{margin:o,marginTop:n,marginRight:r,marginBottom:i,marginLeft:s,padding:a,paddingTop:l,paddingRight:c,paddingBottom:p,paddingLeft:m,...u}=e;if(typeof o=="number")u.marginTop=u.marginRight=u.marginBottom=u.marginLeft=o;else if(typeof o=="string"){let f=Er.exec(o);if(f===null)console.error(`Invalid css value for margin '${o}'`);else{let[,h,g,y,d]=f,b=h&&g&&y;b&&d?(u.marginTop=parseInt(h,10),u.marginRight=parseInt(g,10),u.marginBottom=parseInt(y,10),u.marginLeft=parseInt(d,10)):b?(u.marginTop=parseInt(h,10),u.marginRight=u.marginLeft=parseInt(g,10),u.marginBottom=parseInt(y,10)):h&&g?(u.marginTop=u.marginBottom=parseInt(h,10),u.marginRight=u.marginLeft=parseInt(g,10)):u.marginTop=u.marginRight=u.marginBottom=u.marginLeft=parseInt(h,10)}}if(typeof n=="number"&&(u.marginTop=n),typeof r=="number"&&(u.marginRight=r),typeof i=="number"&&(u.marginBottom=i),typeof s=="number"&&(u.marginLeft=s),typeof a=="number")u.paddingTop=u.paddingRight=u.paddingBottom=u.paddingLeft=a;else if(typeof a=="string"){let f=Er.exec(a);if(f===null)console.error(`Invalid css value for padding '${a}'`);else{let[,h,g,y,d]=f,b=h&&g&&y;b&&d?(u.paddingTop=parseInt(h,10),u.paddingRight=parseInt(g,10),u.paddingBottom=parseInt(y,10),u.paddingLeft=parseInt(d,10)):b?(u.paddingTop=parseInt(h,10),u.paddingRight=u.paddingLeft=parseInt(g,10),u.paddingBottom=parseInt(y,10)):h&&g?(u.paddingTop=u.paddingBottom=parseInt(h,10),u.paddingRight=u.paddingLeft=parseInt(g,10)):u.paddingTop=u.paddingRight=u.paddingBottom=u.paddinggLeft=parseInt(h,10)}}return typeof l=="number"&&(u.paddingTop=l),typeof c=="number"&&(u.paddingRight=c),typeof p=="number"&&(u.paddingBottom=p),typeof m=="number"&&(u.paddingLeft=m),Sr(u,t)}function Sr(e=ao){let t={...e},o,{border:n,borderWidth:r,borderTopWidth:i,borderRightWidth:s,borderBottomWidth:a,borderLeftWidth:l,borderColor:c,margin:p,marginTop:m,marginRight:u,marginBottom:f,marginLeft:h,padding:g,paddingTop:y,paddingRight:d,paddingBottom:b,paddingLeft:E,...R}=t,T={},x={};if(typeof p=="number"&&(t.marginTop=t.marginRight=t.marginBottom=t.marginLeft=p,T={marginTop:p,marginRight:p,marginBottom:p,marginLeft:p}),typeof g=="number"&&(t.paddingTop=t.paddingRight=t.paddingBottom=t.paddingLeft=g,x={paddingTop:g,paddingRight:g,paddingBottom:g,paddingLeft:g}),n||r||i||s||a||l){typeof n=="string"&&(o=ll.exec(n))&&([,r,c]=o,r=parseInt(r,10)),r&&(i=i===void 0?r:i,s=s===void 0?r:s,a=a===void 0?r:a,l=l===void 0?r:l),c=c||"black";let S=`
18
- ${c} ${l||0}px ${i||0}px 0 0 inset,
19
- ${c} ${-s||0}px ${-a||0}px 0 0 inset`;return{...R,...T,...x,borderTopWidth:i,borderRightWidth:s,borderBottomWidth:a,borderLeftWidth:l,borderColor:c,borderStyle:"solid",boxShadow:S}}else return t}import cl from"react";import pl from"classnames";import{Tree as ul}from"@heswell/salt-lab";import{jsx as Tr}from"react/jsx-runtime";var ml="hwLayoutTreeViewer",Dr=(e,t="0")=>({label:w(e),path:t,childNodes:cl.Children.map(e.props.children,(o,n)=>Dr(o,t?`${t}.${n}`:`${n}`))}),Rr=({layout:e,onSelect:t,style:o})=>{let n=[Dr(e)],r=(i,[{path:s}])=>{t(s)};return Tr("div",{className:pl(ml),style:o,children:Tr(ul,{source:n,groupSelection:"single",onSelectionChange:r})})};export{ge as Action,Pg as BORDER_STYLES,xt as Component,te as ComponentRegistry,fg as ConfigWrapper,Hr as DockLayout,At as Draggable,Uo as DraggableLayout,gt as Drawer,Io as DropMenu,re as DropTarget,Ht as Flexbox,Vn as FlexboxLayout,Kt as FluidGrid,qn as FluidGridLayout,lr as Header,id as HeightOnly,xr as LayoutConfigurator,Wm as LayoutProvider,Oe as LayoutProviderContext,_m as LayoutProviderVersion,Rr as LayoutTreeViewer,Tg as MARGIN_STYLES,Dg as PADDING_STYLES,Ha as Palette,dr as PaletteItem,vh as PaletteListItem,Wa as PaletteSalt,Je as Placeholder,oo as Stack,hr as StackLayout,le as View,ct as ViewContext,rd as WidthHeight,sd as WidthOnly,wg as XXXnormalizeStyles,ko as computeMenuPosition,Gr as containerOf,Rt as expandFlex,hd as extractResponsiveProps,Q as findTarget,$ as followPath,To as followPathToComponent,q as followPathToParent,Ur as getChild,Eo as getChildProp,cn as getPersistentState,P as getProp,D as getProps,pn as hasPersistentState,Pt as identifyDropTarget,F as isContainer,ho as isLayoutComponent,dl as isRegistered,Ys as isResponsiveAttribute,Rc as isTabstrip,Yl as isTypeOf,Mr as isView,ec as nextLeaf,J as nextStep,tc as previousLeaf,k as registerComponent,O as resetPath,un as setPersistentState,nc as setRef,w as typeOf,Xn as useBreakpoints,Y as useLayoutProviderDispatch,Bs as useLayoutProviderVersion,be as usePersistentState,Un as useResizeObserver,lt as useViewActionDispatcher,ff as useViewContext,ir as useViewDispatch};
17
+ `,document.body.insertBefore(t,e)}}var ut=class{constructor(){this.currentPath=null;this.tabMode=null;Fa()}prepare(t,o="full-view"){document.body.classList.add("drawing"),this.currentPath=null,this.tabMode=o;let n=this.getPoints(0,0,0,0),r=jn(n),s=document.getElementById("vuu-drop-outline");s==null||s.setAttribute("d",r),this.currentPath=r}clear(){ct=null,Nt(),document.body.classList.remove("drawing"),Co.hidePopup()}get hoverDropTarget(){return ct}getPoints(t,o,n,r,s=0,i=0,a=0){let l=this.tabMode==="tab-only";if(i===0)return[[t,o+a],[t,o+a],[t,o],[t+i,o],[t+i,o],[t+n,o],[t+n,o+r],[t,o+r]];if(l){let c=s;return[[c,o],[c,o],[c+i,o],[c+i,o],[c+i,o+a],[c+i,o+a],[c,o+a],[c,o+a]]}else return s===0?[[t,o+a],[t,o+a],[t,o],[t+i,o],[t+i,o+a],[t+n,o+a],[t+n,o+r],[t,o+r]]:[[t,o+a],[t+s,o+a],[t+s,o],[t+s,o],[t+s,o+a],[t+n,o+a],[t+n,o+r],[t,o+r]]}draw(t,o){let r=Oo;if(ct!==null)this.drawTarget(ct);else if(Oo=t.nextDropTarget!=null,t.pos.tab?_a(t):be&&Nt(),this.drawTarget(t,o),Oo){let[s,i,a]=Xn(t);{let l=Va(Yn,{dropTarget:t,onHover:za,orientation:a});Co.showPopup({left:s,top:i,component:l})}}else Co.hidePopup()}drawTarget(t,o){let r=t.getTargetDropOutline(6,o);if(r){let{l:s,t:i,r:a,b:l,tabLeft:c,tabWidth:p,tabHeight:d,guideLines:u}=r,m=a-s,h=l-i;if(this.currentPath){let T=document.getElementById("vuu-drop-outline");T==null||T.setAttribute("d",this.currentPath)}let g=this.getPoints(s,i,m,h,c,p,d),b=jn(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",$a(u))}}},Jn="transition:margin-left .4s ease-out;margin-left: 63px",Qn="transition:margin-left .4s ease-out;margin-left: 0px";function _a(e){var a,l;let{AFTER:t,BEFORE:o}=lt,{clientRect:{Stack:n},pos:{tab:r}}=e,{id:s}=e.component.props,i=null;if(n&&r&&r.positionRelativeToTab!==t){let c=r.positionRelativeToTab===o?1:2,p=`:scope .hwTabstrip > .hwTabstrip-inner > .hwTab:nth-child(${r.index+c})`;i=(a=document.getElementById(s))==null?void 0:a.querySelector(p),i?(be===null||be!==i)&&(i.style.cssText=Jn,be&&(be.style.cssText=Qn),be=i):Nt()}else if((r==null?void 0:r.positionRelativeToTab)===o){if(be===null){let c=".vuuHeader-title";i=(l=document.getElementById(s))==null?void 0:l.querySelector(c),i.style.cssText=Jn,be=i}}else Nt()}function Nt(){be&&(be.style.cssText=Qn,be=null)}var Re,pt,Ce,tr,or,Oe,Bt,Ye=null,Ho,nr,dt,rr,Ao,$t=null,Wa=3,Ft=new ut,er=.4;function Ga(e,t){return t?ee(e,t):we(e,o=>o.dropTarget)}var ko={handleMousedown(e,t,o={}){Re=t,nr=o,tr=e.clientX,or=e.clientY,Ao=o.dragThreshold===void 0?Wa:o.dragThreshold,Ao===0?Re(e,0,0):(window.addEventListener("mousemove",_t,!1),window.addEventListener("mouseup",Vt,!1),$t=window.setTimeout(()=>{console.log("mousedownTimer fires"),window.removeEventListener("mousemove",_t,!1),window.removeEventListener("mouseup",Vt,!1),Re==null||Re(e,0,0)},500)),e.preventDefault()},initDrag(e,t,{top:o,left:n,right:r,bottom:s},i,a,l,c){return{drag:pt,drop:Ce}=a,Ka(e,t,{top:o,left:n,right:r,bottom:s},i,l,c)}};function _t(e){let n=e.clientX-tr,r=e.clientY-or;Math.max(Math.abs(n),Math.abs(r))>Ao&&(window.removeEventListener("mousemove",_t,!1),window.removeEventListener("mouseup",Vt,!1),Re==null||Re(e,n,r),Re=null)}function Vt(){$t&&(window.clearTimeout($t),$t=null),window.removeEventListener("mousemove",_t,!1),window.removeEventListener("mouseup",Vt,!1)}function Ka(e,t,o,n,r,s){Oe=Ga(e,t);let{"data-path":i,path:a=i}=A(Oe);s&&(Ho=s.map(u=>we(e,m=>m.id===u)).map(u=>u.props.path)),dt=Xe.measure(Oe,s),console.log({_measurements:dt});let l=dt[a];Bt=new zt(l,n.x,n.y,o,r);let c=Math.round(Bt.x.mousePct*100),p=Math.round(Bt.y.mousePct*100);return window.addEventListener("mousemove",sr,!1),window.addEventListener("mouseup",ir,!1),rr=!1,Ft.prepare(o,"tab-only"),nr.DoNotTransform?"transform:none":`transform:scale(${er},${er});transform-origin:${c}% ${p}%;`}function sr(e){let t=e.clientX,o=e.clientY,n=Bt,r=Ye,s,i,a;n.update("x",t)&&(i=n.x.pos),n.update("y",o)&&(a=n.y.pos),i===void 0&&a===void 0||pt==null||pt(i,a),!(rr||Oe===void 0)&&(n.inBounds()?s=Lo(t,o,Oe,dt,n.hasIntrinsicSize(),Ho):s=Lo(n.dropX(),n.dropY(),Oe,dt),r&&(s==null||s.box!==r.box)&&(Ye=null),s&&(Ft.draw(s,n),Ye=s))}function ir(){Za()}function Za(){if(Ye){let e=Ft.hoverDropTarget||Ie.getActiveDropTarget(Ye);Ce==null||Ce(e),Ye=null}else Ce==null||Ce({component:Oe,pos:{position:se.Absolute}});pt=null,Ce=null,Oe=void 0,Ft.clear(),Ho=void 0,window.removeEventListener("mousemove",sr,!1),window.removeEventListener("mouseup",ir,!1)}import Ua from"classnames";import{forwardRef as qa}from"react";import{jsx as Xa}from"react/jsx-runtime";var ar=qa(function({children:t,className:o,dropTarget:n,resizeable:r,...s},i){let a=Ua("DraggableLayout",o);return Xa("div",{className:a,ref:i,...s,children:t})}),lr="DraggableLayout";ar.displayName=lr;Y(lr,ar,"container");import{useForkRef as yl}from"@salt-ds/core";import El from"classnames";import{forwardRef as xl}from"react";import{getUniqueId as pl}from"@vuu-ui/vuu-utils";import bt,{useCallback as Ut,useMemo as xr,useRef as qt,useState as dl}from"react";import Ya from"classnames";import{jsx as ja}from"react/jsx-runtime";var cr="vuuPlaceholder",Wt=({className:e,closeable:t,flexFill:o,resizeable:n,shim:r,...s})=>ja("div",{className:Ya(cr,e,{[`${cr}-shim`]:r}),...s,"data-placeholder":!0,"data-resizeable":!0});Wt.displayName="Placeholder";Y("Placeholder",Wt);import Ja from"classnames";import Qa,{useCallback as mt,useRef as Gt,useState as el}from"react";import{jsx as ur}from"react/jsx-runtime";var pr=Qa.memo(function({column:t,index:o,onDrag:n,onDragEnd:r,onDragStart:s,style:i}){let a=Gt(),l=Gt(null),c=Gt(0),[p,d]=el(!1),u=mt(({key:E,shiftKey:D})=>{let P=D?10:1;t&&E==="ArrowDown"?n(o,P):t&&E==="ArrowUp"||!t&&E==="ArrowLeft"?n(o,-P):!t&&E==="ArrowRight"&&n(o,P)},[t,o,n]),m=mt(E=>{let{key:D}=E;(t&&(D==="ArrowUp"||D==="ArrowDown")||!t&&(D==="ArrowLeft"||D==="ArrowRIght"))&&(s(o),u(E),h.current=u)},[t,u,o,s]),h=Gt(m),g=E=>h.current(E),b=mt(E=>{a.current=!0;let D=E[t?"clientY":"clientX"],P=D-c.current;D&&D!==c.current&&n(o,P),c.current=D},[t,o,n]),f=mt(()=>{var E;window.removeEventListener("mousemove",b,!1),window.removeEventListener("mouseup",f,!1),r(),d(!1),(E=l.current)==null||E.focus()},[b,r,d]),y=mt(E=>{c.current=t?E.clientY:E.clientX,s(o),window.addEventListener("mousemove",b,!1),window.addEventListener("mouseup",f,!1),E.preventDefault(),d(!0)},[t,b,f,o,s,d]),T=()=>{var E;a.current?a.current=!1:(E=l.current)==null||E.focus()},x=()=>{h.current=m},v=Ja("Splitter","focusable",{active:p,column:t});return ur("div",{className:v,"data-splitter":!0,ref:l,role:"separator",style:i,onBlur:x,onClick:T,onKeyDown:g,onMouseDown:y,tabIndex:0,children:ur("div",{className:"grab-zone"})})});import{uuid as dr}from"@vuu-ui/vuu-utils";import mr from"react";var tl={"data-placeholder":!0,"data-resizeable":!0},Kt={},Ae="auto",zo={flexBasis:0,flexGrow:1,flexShrink:1,height:Ae,width:Ae},fr={height:"width",width:"height"},gr=(e="row")=>e==="row"?["width","height","column"]:["height","width","row"],ol=e=>typeof e=="string"&&e.endsWith("%"),ue=e=>{let{style:{width:t=Ae,height:o=Ae}=Kt}=e.props,n=typeof o=="number",r=typeof t=="number";return n&&r?{height:o,width:t}:n?{height:o}:r?{width:t}:void 0};function No(e,t,o){let n=fr[t],{style:{[n]:r=Ae,...s}=Kt}=e.props;return o&&o[t]?{...s,...zo,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...s,...zo,[n]:r}}function hr(e){let{style:{flex:t,flexGrow:o,flexShrink:n,flexBasis:r}=Kt}=e.props;return typeof t=="number"||r===0&&o===1&&n===1?!0:typeof r!="number"}function Bo(e,t,o){let n=fr[t],{style:{[t]:r=Ae,[n]:s=Ae,...i}=Kt}=e.props;return r!==Ae?ol(r)?{flexBasis:0,flexGrow:1,flexShrink:1,[t]:void 0,[n]:s}:{flexBasis:r,flexGrow:0,flexShrink:0,[t]:r,[n]:s}:o&&o[t]?{...i,...zo,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...i,[n]:s}}function ft(e,t,o,n,r){let s=[],i=0,a;if(n&&r){let p,[d,u,m,h]=r;[p,a]=t==="column"?[u-n.top,n.bottom-h]:[d-n.left,n.right-m],p&&s.push(ye(`${o}.${i++}`,p,{flexGrow:0,flexShrink:0}))}else a=!0;let{version:l=0,style:c}=A(e);return s.push(te(e,`${o}.${i++}`,{version:l+1,style:{...c,flexBasis:"auto",flexGrow:0,flexShrink:0}})),a&&s.push(ye(`${o}.${i++}`,0,void 0,{[`data-${t}-placeholder`]:!0})),$o(t,{resizeable:!1,style:{flexBasis:"auto"}},s,o)}var nl=(e,t)=>{if(!t)return e===0?1:0};function $o(e,t,o,n){let r=dr(),{flexFill:s,style:i,resizeable:a=!0}=t,{flexBasis:l=s?void 0:"auto"}=i,c=nl(l,s);return mr.createElement(Pe.Flexbox,{id:r,key:r,path:n,flexFill:s,style:{...i,flexDirection:e,flexBasis:l,flexGrow:c,flexShrink:c},resizeable:a},o)}var rl={flexGrow:1,flexShrink:1};function ye(e,t,o,n){let r=dr();return mr.createElement("div",{...tl,...n,"data-path":e,id:r,key:r,style:{...rl,...o,flexBasis:t}})}var sl={},gt=1,ht=2,il=e=>typeof e.intrinsicSize=="number",al=(e,t)=>{let o={};return e.forEach(n=>{o[n]=B(t,n)}),o},Zt=(e,t,o)=>e.map((n,r)=>{var l;let s=B(n,"resizeable"),{[t]:i}=(l=ue(n))!=null?l:sl,a=hr(n);return o?{index:r,flexOpen:a,intrinsicSize:i,resizeable:s,...al(o,n)}:{index:r,flexOpen:a,intrinsicSize:i,resizeable:s}}),br=e=>{let t=e.length,o=e.every(il),n=Array(t).fill(0);if(o&&t>0&&(n[0]=ht,n[t-1]=ht),t<2)return n;for(let r=0,s=0;r<t-1;r++)e[r].resizeable&&!s&&(s=gt),n[r]+=s;for(let r=t-1;r>0&&(n[r]&gt&&(n[r]-=gt),!e[r].resizeable);r--);return n},yr=(e,t)=>{let o=cl(e,t),n=ul(e,t),r=o!==-1&&n!==-1?[o,n]:void 0,s=ll(e,r);return[r,s]};function ll(e,t){if(t){let o=[];for(let n=0;n<e.length;n++)e[n].flexOpen&&!t.includes(n)&&o.push(n);return o}}function cl(e,t){let o=t,n=!1;for(;o>=1&&!n;)o=o-1,n=Er(e,o);return o}function ul(e,t){let o=t,n=!1,r=e.length;for(;o<r-1&&!n;)o=o+1,n=Er(e,o);return o===r?-1:o}function Er(e,t){let{placeholder:o,splitter:n,resizeable:r,intrinsicSize:s}=e[t];return!!(!n&&!s&&(o||r))}var ml=e=>!e.splitter&&!e.placeholder,vr=({children:e,onSplitterMoved:t,style:o})=>{let n=qt(null),r=qt(),s=qt(),i=qt([]),[,a]=dl({}),l=b=>{s.current=b,a({})},c=(o==null?void 0:o.flexDirection)==="column",p=c?"height":"width",d=xr(()=>Array.isArray(e)?e:bt.isValidElement(e)?[e]:[],[e]),u=Ut(b=>{let{current:f}=r;if(f){let[y,T]=yr(f,b);y&&(y.forEach(x=>{var E;let v=(E=n.current)==null?void 0:E.childNodes[x];if(v){let{size:D,minSize:P}=bl(v,p);f[x].currentSize=D,f[x].minSize=P}}),T&&T.forEach(x=>{var E;let v=(E=n.current)==null?void 0:E.childNodes[x];if(v){let{[p]:D}=v.getBoundingClientRect();f[x].flexBasis=D}}))}},[p]),m=Ut((b,f)=>{s.current&&r.current&&l(gl(s.current,r.current,f,p))},[p]),h=Ut(()=>{let b=r.current;b&&(t==null||t(b.filter(ml))),b==null||b.forEach(f=>{f.currentSize=void 0,f.flexBasis=void 0,f.flexOpen=!1})},[t]),g=Ut(b=>bt.createElement(pr,{column:c,index:b,key:`splitter-${b}`,onDrag:m,onDragEnd:h,onDragStart:u}),[m,h,u,c]);return xr(()=>{let[b,f]=fl(d,p,g,i.current);r.current=f,s.current=b},[d,g,p]),{content:s.current||[],rootRef:n}};function fl(e,t,o,n){let r=Zt(e,t),s=br(r),i=[],a=[];for(let l=0;l<e.length;l++){let c=e[l];if(l===0&&s[l]&ht&&(i.push(Tr(l)),a.push({placeholder:!0,shim:!0})),c.key==null){let p=n[l]||(n[l]=pl());i.push(bt.cloneElement(c,{key:p}))}else i.push(c);a.push(r[l]),l>0&&s[l]&ht?(i.push(Tr(l)),a.push({placeholder:!0})):s[l]&gt&&(i.push(o(i.length)),a.push({splitter:!0}))}return[i,a]}function gl(e,t,o,n){return hl(t,o)?e.map((s,i)=>{let a=t[i],{currentSize:l,flexOpen:c,flexBasis:p}=a,d=l!==void 0;if(d||c){let{flexBasis:u}=s.props.style||{},m=d?a.currentSize:p;return m!==u?bt.cloneElement(s,{style:{...s.props.style,flexBasis:m,[n]:"auto"}}):s}else return s}):e}function hl(e,t){let o=[];e.forEach((p,d)=>{p.currentSize!==void 0&&o.push(d)});let n=t<0?o[0]:o[1],{currentSize:r=0,minSize:s=0}=e[n];if(r===s)return!1;if(Math.abs(t)>r-s){let p=t<0?-1:1;t=Math.max(0,r-s)*p}let i=e[o[0]],{currentSize:a=0}=i;i.currentSize=a+t;let l=e[o[1]],{currentSize:c=0}=l;return l.currentSize=c-t,!0}function Tr(e){return bt.createElement(Wt,{shim:e===0,key:`placeholder-${e}`})}function bl(e,t){let{[t]:o}=e.getBoundingClientRect(),r=getComputedStyle(e).getPropertyValue(`min-${t}`),s=r.endsWith("px")?parseInt(r,10):0;return{size:o,minSize:s}}import{jsx as Tl}from"react/jsx-runtime";var Fo="hwFlexbox",Dr=xl(function(t,o){let{breakPoints:n,children:r,column:s,className:i,flexFill:a,gap:l,fullPage:c,id:p,onSplitterMoved:d,resizeable:u,row:m,spacing:h,splitterSize:g,style:b,...f}=t,{content:y,rootRef:T}=vr({children:r,onSplitterMoved:d,style:b}),x=El(Fo,i,{[`${Fo}-column`]:s,[`${Fo}-row`]:m,"flex-fill":a,"full-page":c});return Tl("div",{...f,className:x,"data-resizeable":u||void 0,id:p,ref:yl(T,o),style:{...b,gap:l,"--spacing":h},children:y})});Dr.displayName="Flexbox";var _o=Dr;import{useCallback as uc}from"react";var je={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"};import{useCallback as Yo,useContext as ts,useEffect as ic,useRef as Qr,useState as ac}from"react";import qo from"react";import{uuid as Cr}from"@vuu-ui/vuu-utils";import xt from"react";import{uuid as Pr}from"@vuu-ui/vuu-utils";import yt,{cloneElement as vl}from"react";import{useCallback as Je}from"react";var ie=new Map,pe=new Map,wr=e=>ie.get(e),Rr=e=>ie.has(e),Sr=(e,t)=>ie.set(e,t),Qe=()=>{let e=Je((i,a)=>{let l=pe.get(i);if(l)return a!==void 0&&l[a]!==void 0?l[a]:a!==void 0?void 0:l},[]),t=Je((i,a,l)=>{if(a===void 0)pe.set(i,l);else if(pe.has(i)){let c=pe.get(i);pe.set(i,{...c,[a]:l})}else pe.set(i,{[a]:l})},[]),o=Je((i,a)=>{if(pe.has(i)){if(a===void 0)pe.delete(i);else if(pe.get(i)[a]){let{[a]:c,...p}=pe.get(i);Object.keys(p).length>0?pe.set(i,p):pe.delete(i)}}},[]),n=Je((i,a)=>{let l=ie.get(i);if(l)return a!==void 0?l[a]:l},[]),r=Je((i,a,l)=>{if(a===void 0)ie.set(i,l);else if(ie.has(i)){let c=ie.get(i);ie.set(i,{...c,[a]:l})}else ie.set(i,{[a]:l})},[]),s=Je((i,a)=>{if(ie.has(i)){if(a===void 0)ie.delete(i);else if(ie.get(i)[a]){let{[a]:c,...p}=ie.get(i);Object.keys(p).length>0?ie.set(i,p):ie.delete(i)}}},[]);return{loadSessionState:e,loadState:n,saveSessionState:t,saveState:r,purgeState:s,purgeSessionState:o}};var Mr=e=>e.flexDirection==="column"?["height","width"]:["width","height"],Dl={},Et=(e,t="0")=>{let[o,n]=Go($(e),e.props,t);return yt.cloneElement(e,o,n)},Wo=(e,t)=>{let o=$(e),[n,r]=Go(o,e.props,"0",void 0,t);return vl(e,n,r)};function wl(e,t,o="0",n=null,r){var g,b;let{active:s=0,"data-path":i,path:a=i,id:l,style:c}=A(r),p=$(r)===e&&o===a,d=p?l:(g=t.id)!=null?g:Pr(),u=e==="Stack"?(b=t.active)!=null?b:s:void 0,m=d,h=p?c:Sl(e,t,n);return Ln(e)?{id:d,key:m,path:o,style:h,type:e,active:u}:{id:d,key:m,style:h,"data-path":o}}function Go(e,t,o,n=null,r){var c,p;let s=wl(e,t,o,n,r);if(t.layout&&!r)return[s,[Xt(t.layout,`${o}.0`)]];let i=(p=r==null?void 0:r.children)!=null?p:(c=r==null?void 0:r.props)==null?void 0:c.children,l=t.dropTarget&&i?i:Rl(e,t.children,o,i);return[s,l]}function Rl(e,t,o="0",n){let r=Array.isArray(t)?t:yt.isValidElement(t)?[t]:[];return re(e)?r.map((s,i)=>{let a=$(s),l=$(n==null?void 0:n[i]);if(!l||a===l){let[c,p]=Go(a,s.props,`${o}.${i}`,e,n==null?void 0:n[i]);return yt.cloneElement(s,c,p)}return n==null?void 0:n[i]}):t}var Sl=(e,t,o)=>{let{style:n=Dl}=t;if(e==="Flexbox"&&(n={flexDirection:t.column?"column":"row",...n,display:"flex"}),n.flex){let{flex:r,...s}=n;n={...s,...wo(typeof r=="number"?r:0)}}else o==="Stack"?n={...n,...wo(1)}:o==="Flexbox"&&(n.width||n.height)&&n.flexBasis===void 0&&(n={...n,flexBasis:"auto",flexGrow:0,flexShrink:0});return n};function Xt({id:e=Pr(),type:t,children:o,props:n,state:r},s){let i=t.match(/^[a-z]/)?t:Pe[t];if(i===void 0)throw Error(`layoutUtils unable to create component from JSON, unknown type ${t}`);return r&&Sr(e,r),yt.createElement(i,{id:e,...n,key:e,path:s},o?o.map((a,l)=>Xt(a,`${s}.${l}`)):void 0)}function Lr(e){return Ir(e)}function Ir(e){let t=$(e),{id:o,children:n,type:r,...s}=A(e),i=Rr(o)?wr(o):void 0;return{id:o,type:t,props:Pl(s),state:i,children:yt.Children.map(n,Ir)}}function Pl(e){if(e){let{path:t,...o}=e,n={};for(let[r,s]of Object.entries(o))n[r]=Vo(s);return n}}function Vo(e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(Vo);if(typeof e=="object"&&e!==null){let t={};for(let[o,n]of Object.entries(e))t[o]=Vo(n);return t}}function Or(e,t){var i;let o=e.props.children,n=o.length,{index:r=-1,positionRelativeToTab:s="after"}=t.tab||{};return r===-1||r>=n?[o[n-1],"after"]:[(i=o[r])!=null?i:null,s]}function Yt(e,t,o){let{active:n,children:r=[],path:s}=A(e),i=B(t,"path"),{idx:a,finalStep:l}=he(s,i,!0),[c,p]=l?Ml(e,r,o):[n,r==null?void 0:r.map((u,m)=>m===a?Yt(u,t,o):u)],d=$(e)==="Stack"?Array.isArray(c)?c[0]:c:n;return xt.cloneElement(e,{active:d},p)}function Ml(e,t,o){let n=B(e,"path"),r=t==null?void 0:t.length,{id:s=Cr()}=A(o);return r?[r,t.concat(te(o,`${n}.${r}`,{id:s,key:s}))]:[0,[te(o,`${n}.0`,{id:s})]]}function jt(e,t,o,n,r,s,i){let{active:a,children:l,path:c}=A(e),p=B(t,"path"),{idx:d,finalStep:u}=he(c,p),[m,h]=u?Ll(e,l,d,o,n,r,s,i):[a,l.map((b,f)=>f===d?jt(b,t,o,n,r,s,i):b)],g=$(e)==="Stack"?m:a;return xt.cloneElement(e,{active:g},h)}function Ll(e,t,o,n,r,s,i,a){let l=ue(n);return l!=null&&l.width&&(l!=null&&l.height)?Cl(e,t,o,n,r,i,a):Ar(e,t,o,n,r,(s==null?void 0:s.width)||(s==null?void 0:s.height),i)}var Il=(e,t,{top:o,right:n,bottom:r,left:s},[i,a,l,c])=>{if(e==="column"&&t==="before")return a-o;if(e==="column")return r-c;if(e==="row"&&t==="before")return i-s;if(e==="row")return n-l};function Cl(e,t,o,n,r,s,i){let{style:{flexDirection:a}}=A(e),[l,c,p]=gr(a),{[c]:d,[l]:u}=ue(n),m=B(t[o],"path"),h=Il(a,r,s,i),[g,b]=d<s[c]?[ft(n,p,m,s,i),u]:[n,void 0],f=h?ye(m,h,{flexGrow:0,flexShrink:0}):void 0;return d>s[c]&&(t=t.map(y=>{if(B(y,"placeholder"))return y;{let{[c]:T}=ue(y);return T&&T<d?ft(y,p,B(y,"path")):y}})),Ar(e,t,o,g,r,b,s,f)}function Ar(e,t,o,n,r,s,i,a){let l=B(e,"path"),c=0,p=!t||t.length===0?[n]:t.reduce((d,u,m)=>{if(o===m){let[h,g]=Ol(e,u,n,i);r==="before"?a?d.push(a,g,h):d.push(g,h):a?d.push(h,g,a):d.push(h,g),c=d.indexOf(g)}else d.push(u);return d},[]).map((d,u)=>u<c?d:te(d,`${l}.${u}`));return[c,p]}function Ol(e,t,o,n){let r=Cr(),{version:s=0}=A(o);if(s+=1,$(e)==="Flexbox"){let[i]=Mr(e.props.style),a=6,l={[i]:(n[i]-a)/2},c=Bo(t,i,l),p=Bo(o,i,l);return[xt.cloneElement(t,{style:c}),xt.cloneElement(o,{id:r,version:s,style:p})]}else{let{style:{left:i,top:a,flex:l,...c}={left:void 0,top:void 0,flex:void 0}}=A(o);return[t,xt.cloneElement(o,{id:r,version:s,style:c})]}}import{cloneElement as kl}from"react";import Jt from"react";function Hr(e,{target:t,replacement:o}){return Ko(e,t,o)}function Ko(e,t,o){let n=B(t,"path"),r=B(t,"resizeable"),{style:s}=A(t),i=Et(Jt.cloneElement(o,{resizeable:r,style:{...s,...o.props.style}}),n);return ae(e,t,i)}function ae(e,t,o,n){if(e===t)return o;let{idx:r,finalStep:s}=he(B(e,"path"),B(t,"path")),i=e.props.children.slice();return s?n?n===je.MINIMIZE?i[r]=Al(e,i[r]):n===je.RESTORE&&(i[r]=Hl(i[r])):i[r]=o:i[r]=ae(i[r],t,o,n),Jt.cloneElement(e,void 0,i)}function Al(e,t){let{style:o}=A(e),{style:n}=A(t),{width:r,height:s,flexBasis:i,flexShrink:a,flexGrow:l,...c}=n,p={width:r,height:s,flexBasis:i,flexShrink:a,flexGrow:l},d={...c,flexBasis:0,flexGrow:0,flexShrink:0},u=o.flexDirection==="row"?"vertical":o.flexDirection==="column"?"horizontal":!1;return u?Jt.cloneElement(t,{collapsed:u,restoreStyle:p,style:d}):t}function Hl(e){let{style:t,restoreStyle:o}=A(e),{flexBasis:n,flexShrink:r,flexGrow:s,...i}=t,a={...i,...o};return Jt.cloneElement(e,{collapsed:!1,style:a,restoreStyle:void 0})}function kr(e,{fromIndex:t,path:o,toIndex:n}){let r=ee(e,o,!0),{children:s}=A(r),i=zl(s,t,n),a=kl(r,void 0,i);return ae(e,r,a)}function zl(e,t,o){let n=e.slice(),[r]=n.splice(t,1);return o===-1?n.concat(r):(n.splice(o,0,r),n)}var ne={ADD:"add",DRAG_START:"drag-start",DRAG_DROP:"drag-drop",LAYOUT_RESIZE:"layout-resize",MAXIMIZE:"maximize",MINIMIZE:"minimize",MOVE_CHILD:"move-child",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"};import $e from"react";function Zo(e,{path:t}){let o=ee(e,t),n=De(e,t);if(n===null)return e;let{children:r}=A(n);if(r.length>1&&Nr(r,t)){let{style:{flexBasis:s,display:i,flexDirection:a,...l}}=A(n),c=B(n,"path"),p=ae(e,n,ye(c,s,l));for(;(n=De(p,c))&&B(n,"path")!=="0";){let{children:d}=A(n);if(Nr(d)){c=B(n,"path");let{style:{flexBasis:u,display:m,flexDirection:h,...g}}=A(n);p=ae(e,n,ye(c,u,g))}else if(Fl(d))p=Fr(e,n);else break}return p}return Br(e,o)}function Br(e,t){let o=A(e),{children:n,path:r,preserve:s}=o,{active:i}=o,{idx:a,finalStep:l}=he(r,B(t,"path")),c=$(e),p=n.slice();if(l){if(p.splice(a,1),i!==void 0&&i>=a&&(i=Math.max(0,i-1)),p.length===1&&!s&&r!=="0"&&c.match(/Flexbox|Stack/))return Nl(e,p[0]);!p.some(Bl)&&p.some($r)&&(p=$l(p))}else p[a]=Br(p[a],t);return p=p.map((d,u)=>te(d,`${r}.${u}`)),$e.cloneElement(e,{active:i},p)}function Nl(e,t){let o=$(e),{path:n,style:{flexBasis:r,flexGrow:s,flexShrink:i,width:a,height:l}}=A(e),c=te(t,n);if(n==="0")c=$e.cloneElement(c,{style:{...t.props.style,width:a,height:l}});else if(o==="Flexbox"){let p=e.props.style.flexDirection==="column"?"height":"width",{style:{[p]:d,...u}}=c.props;c=$e.cloneElement(c,{flexFill:void 0,style:{...u,flexGrow:s,flexShrink:i,flexBasis:r,width:a,height:l}})}return c}var Bl=e=>e.props.style.flexGrow>0,$r=e=>{let{width:t,height:o,flexGrow:n}=e.props.style;return n===0&&typeof t!="number"&&typeof o!="number"},$l=e=>e.map(t=>$r(t)?$e.cloneElement(t,{style:{...t.props.style,flexGrow:1}}):t),Fl=e=>{if(e&&e.length>0){let t=B(e[0],"placeholder"),o=!1;for(let n=1;n<e.length;n++){if(o=B(e[n],"placeholder"),t&&o)return!0;t=o}}},Fr=(e,t)=>{let{children:o,path:n}=A(e),{idx:r,finalStep:s}=he(n,B(t,"path")),i=o.slice();return s?i[r]=_l(t):i[r]=Fr(i[r],t),i=i.map((a,l)=>te(a,`${n}.${l}`)),$e.cloneElement(e,void 0,i)},_l=e=>{let{children:t}=A(e),o=[],n=[];for(let s=0;s<t.length;s++)B(t[s],"placeholder")?n.push(t[s]):(n.length===1?o.push(n.pop()):n.length>0&&(o.push(zr(n)),n.length=0),o.push(t[s]));n.length===1?o.push(n.pop()):n.length>0&&o.push(zr(n));let r=B(e,"path");return $e.cloneElement(e,void 0,o.map((s,i)=>te(s,`${r}.${i}`)))},zr=([e,...t])=>{let o=B(e,"style"),{flexBasis:n,flexGrow:r,flexShrink:s}=o;for(let{props:{style:i}}of t)n+=i.flexBasis,r=Math.max(r,i.flexGrow),s=Math.max(s,i.flexShrink);return $e.cloneElement(e,{style:{...o,flexBasis:n,flexGrow:r,flexShrink:s}})},Nr=(e,t)=>e.every(o=>B(o,"placeholder")||t&&B(o,"path")===t);import Uo from"react";function _r(e,{path:t,size:o}){let n=ee(e,t,!0),{style:r}=A(n),s={...r,width:o},i=Uo.cloneElement(n,{style:s});return ae(e,n,i)}function Vr(e,{path:t,sizes:o}){let n=ee(e,t,!0),{children:r,style:s}=A(n),i=s.flexDirection==="column"?"height":"width",a=Vl(r,o,i),l=Uo.cloneElement(n,void 0,a);return ae(e,n,l)}function Vl(e,t,o){return e.map((n,r)=>{let{style:{[o]:s,flexBasis:i}}=A(n),a=t[r],{currentSize:l,flexBasis:c}=a,d=l!==void 0?a.currentSize:c;return d===void 0||s===d||i===d?n:Uo.cloneElement(n,{style:Wl(n.props.style,o,d)})})}function Wl(e,t,o){let n=typeof e[t]=="number",{flexShrink:r=1,flexGrow:s=1}=e;return{...e,[t]:n?o:"auto",flexBasis:n?"auto":o,flexShrink:r,flexGrow:s}}import{uuid as Gl}from"@vuu-ui/vuu-utils";import Qt from"react";var Wr=e=>{let[t]=$(e);return t===t.toLowerCase()};function Tt(e,t,o,n,r,s){let{children:i,path:a}=A(e),l=B(t,"path"),{idx:c,finalStep:p}=he(a,l),d=p?Kl(e,i,t,o,n,r,s):i.map((u,m)=>m===c?Tt(u,t,o,n,r,s):u);return Qt.cloneElement(e,void 0,d)}function Kl(e,t,o,n,r,s,i){let a=ue(n);if(a!=null&&a.width&&(a!=null&&a.height)){if(s===void 0||i===void 0)throw Error("wrap-layout-element, updateChildren clientRect and dropRect must both be available");return Ul(t,o,n,r,s,i)}return Zl(e,t,o,n,r)}function Zl(e,t,o,n,r){var E;let{version:s=0}=A(n),i=B(o,"path"),{type:a,flexDirection:l,showTabs:c}=Kr(r),[p,d,u]=ql(a,o,n,l,r),m=Gr(r),h=m?1:0,g={resizeable:!0,style:u,version:s+1},f={[Wr(o)?"data-resizeable":"resizeable"]:!0,style:d},y=a==="Stack"?{showTabs:c}:void 0,T=a==="Flexbox"?{splitterSize:(E=$(e)==="Flexbox"&&e.props.splitterSize)!=null?E:void 0}:void 0,x=Gl(),v=Qt.createElement(Pe[a],{active:h,id:x,key:x,path:B(o,"path"),flexFill:B(o,"flexFill"),...T,...y,style:p,resizeable:B(o,"resizeable")},m?[te(o,`${i}.0`,f),Et(Qt.cloneElement(n,g),`${i}.1`)]:[Et(Qt.cloneElement(n,g),`${i}.0`),te(o,`${i}.1`,f)]);return t.map(D=>D===o?v:D)}function Ul(e,t,o,n,r,s){let{flexDirection:i}=Kr(n),a=i==="column"?"row":"column",l=Gr(n),[c,p,d,u]=s,[m,h]=i==="column"?[p-r.top,r.bottom-u]:[c-r.left,r.right-d],g=B(t,"path"),b=0,f=Wr(t)?"data-resizeable":"resizeable",y=[];m&&y.push(l?te(t,`${g}.${b++}`,{[f]:!0,style:{flexBasis:m,flexGrow:1,flexShrink:1}}):ye(`${g}.${b++}`,m,{flexGrow:0,flexShrink:0})),y.push(ft(o,a,`${g}.${b++}`,r,s)),h&&y.push(l?ye(`${g}.${b++}`,0):te(t,`${g}.${b++}`,{[f]:!0,style:{flexBasis:0,flexGrow:1,flexShrink:1}}));let T=$o(i,t.props,y,g);return e.map(x=>x===t?T:x)}function ql(e,t,o,n,r){let s={...t.props.style,flexDirection:n},i=e==="Flexbox"&&n==="column"?"height":"width",a=No(o,i,r),l=No(t,i);return[s,l,a]}var Gr=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 Kr(e){return e.position.Header?{type:"Stack",flexDirection:"column",showTabs:!0}:{type:"Flexbox",flexDirection:e.position.EastOrWest?"row":"column"}}var Yr=(e,t)=>{switch(t.type){case ne.ADD:return Ql(e,t);case ne.DRAG_DROP:return Jl(e,t);case ne.MAXIMIZE:return jl(e,t);case ne.REMOVE:return Zo(e,t);case ne.REPLACE:return Hr(e,t);case ne.SET_PROP:return Zr(e,t);case ne.SET_PROPS:return Yl(e,t);case ne.SET_TITLE:return Zr(e,{type:"set-prop",path:t.path,propName:"title",propValue:t.title});case ne.SPLITTER_RESIZE:return Vr(e,t);case ne.LAYOUT_RESIZE:return _r(e,t);case ne.SWITCH_TAB:return Xl(e,t);case ne.MOVE_CHILD:return kr(e,t);default:return e}},Xl=(e,{path:t,nextIdx:o})=>{let n=ee(e,t,!0),r=qo.cloneElement(n,{active:o});return ae(e,n,r)},Zr=(e,{path:t,propName:o,propValue:n})=>{let r=ee(e,t,!0),s=qo.cloneElement(r,{[o]:n});return ae(e,r,s)},Yl=(e,{path:t,props:o})=>{let n=ee(e,t,!0),r=qo.cloneElement(n,o);return ae(e,n,r)},jl=(e,{path:t,type:o})=>{if(t){let n=ee(e,t,!0);return ae(e,n,n,o)}else return e},Jl=(e,t)=>{var h,g;let{draggedReactElement:o,dragInstructions:n,dropTarget:r}=t,s=r.component,{pos:i}=r,a=((h=i==null?void 0:i.position)==null?void 0:h.Header)&&$(s)==="Stack",{id:l,version:c}=A(o),p=ue(o),d;if(a){let[b,f]=Or(s,i);b===void 0?d=Yt(e,s,o):d=jt(e,b,o,f)}else!p&&((g=i==null?void 0:i.position)!=null&&g.Centre)?d=Ko(e,s,o):d=ec(e,r,o);if(n.DoNotRemove)return d;let u=we(d,b=>b.id===l&&b.version===c),m=B(u,"path");return Zo(d,{path:m,type:"remove"})},Ql=(e,{path:t,component:o})=>Yt(e,ee(e,t),o),ec=(e,t,o)=>{let{component:n,pos:r,clientRect:s,dropRect:i}=t,a=B(n,"path");if(a==="0.0")return Tt(e,n,o,r);let l=De(e,a);if(Ur(r,l)){let c=r.position.SouthOrEast?"after":"before";return jt(e,n,o,c,r,s,i)}if(!Ur(r,l))return Tt(e,n,o,r,s,i);if(re($(l)))return Tt(e,n,o,r);throw Error(`no support right now for position = ${r.position}`)},Ur=(e,t)=>e.position.Centre?Xr(t)||qr(t):e.position.NorthOrSouth?qr(t):e.position.EastOrWest?Xr(t):!1,qr=e=>$(e)==="Flexbox"&&e.props.style.flexDirection==="column",Xr=e=>$(e)==="Flexbox"&&e.props.style.flexDirection!=="column";import{createContext as tc}from"react";var oc=e=>console.log(`dispatch ${e.type}, have you forgotten to provide a LayoutProvider ?`),vt=tc({dispatchLayoutProvider:oc,version:-1});import{useCallback as eo,useRef as Xo}from"react";var nc={},jr=[0,0],rc=(e,t,o)=>{let n=document.createElement("div");n.className="vuuSimpleDraggableWrapper",n.classList.add("vuuSimpleDraggableWrapper","salt-theme","salt-density-medium"),n.dataset.dragging="true";let r=o!=null?o:document.createElement("div");r.id=t,n.appendChild(r),document.body.appendChild(n);let s=`top:${e.top}px;left:${e.left}px;width:${e.width}px;height:${e.height}px;`;return[n,s,e.left,e.top]},sc=e=>{let{offsetParent:t}=e;if(t===null)return jr;{let{left:o,top:n}=t.getBoundingClientRect();return[o,n]}},Jr=(e,t)=>{let o=Xo(),n=Xo(),r=Xo(),s=eo((c,p)=>{if(n.current&&r.current){let{dragOffsets:[d,u],targetPosition:m}=n.current,h=typeof c=="number"?c-d:m.left,g=typeof p=="number"?p-u:m.top;(h!==m.left||g!==m.top)&&(n.current.targetPosition.left=h,n.current.targetPosition.top=g,r.current.style.top=g+"px",r.current.style.left=h+"px")}},[]),i=eo(c=>{if(n.current){let{dragInstructions:p,payload:d,originalCSS:u}=n.current;t({type:"drag-drop",draggedReactElement:d,dragInstructions:p,dropTarget:c}),console.log("[useLayoutDragDrop]",{dragInstructions:p}),r.current&&(p.RemoveDraggableOnDragEnd?document.body.removeChild(r.current):(r.current.style.cssText=u,delete r.current.dataset.dragging)),o.current=void 0,n.current=void 0,r.current=void 0}},[t]),a=eo(c=>{if(o.current){let{payload:p,dragContainerPath:d,dragElement:u,dragRect:m,instructions:h=nc,path:g}=o.current,{current:b}=e,f={x:c.clientX,y:c.clientY},y=p!=null?p:ee(b,g,!0),{id:T}=y.props,x=ue(y),v="",E="",D="",P=-1,k=-1,C=jr,M=document.getElementById(T);if(M===null)[M,E,P,k]=rc(m,T,u);else{C=sc(M);let[w,R]=C,{width:O,height:I,left:S,top:L}=M.getBoundingClientRect();P=S-w,k=L-R,E=`width:${O}px;height:${I}px;left:${P}px;top:${k}px;z-index: 100;background-color:#ccc;opacity: 0.6;`,M.dataset.dragging="true",v=M.style.cssText}D=ko.initDrag(e.current,d,m,f,{drag:s,drop:i},x),M.style.cssText=E+D,r.current=M,n.current={payload:y,originalCSS:v,dragRect:m,dragOffsets:C,dragInstructions:h,targetPosition:{left:P,top:k}}}},[s,i,e]);return eo(c=>{let{evt:p,...d}=c;console.log("prepare to drag",{options:d}),o.current={...d,dragContainerPath:""},ko.handleMousedown(p,a,d.instructions)},[a])};import{jsx as os}from"react/jsx-runtime";var es=e=>e.dropTarget,lc=e=>["drag-drop","remove","set-title","splitter-resize","switch-tab"].includes(e.type),ib=()=>{let e=cc();return os("div",{children:`Context: ${e} `})},ab=e=>{let{children:t,layout:o,onLayoutChange:n}=e,r=Qr(void 0),s=Qr(t),[,i]=ac(null),a=Yo(d=>{if(n){let u=we(d,es)||r.current,h=$(u)==="DraggableLayout"?A(u).children[0]:u,g=Lr(h);n(g,"drag-root")}},[n]),l=Yo((d,u=!1)=>{let m=Yr(r.current,d);m!==r.current&&(r.current=m,i({}),!u&&lc(d)&&a(m))},[a]),c=Yo(d=>{switch(d.type){case"drag-start":{p(d);break}case"save":{a(r.current);break}default:{l(d);break}}},[l,a]),p=Jr(r,c);return ic(()=>{if(o){let d=we(r.current,es),u=kn(d),m=Xt(o,`${d.props.path}.0`),h=u?{type:ne.REPLACE,target:u,replacement:m}:{type:ne.ADD,path:d.props.path,component:m};l(h,!0)}},[l,o]),r.current===void 0?r.current=Wo(t):t!==s.current&&(r.current=Wo(t,r.current),s.current=t),os(vt.Provider,{value:{dispatchLayoutProvider:c,version:0},children:r.current})},de=()=>{let{dispatchLayoutProvider:e}=ts(vt);return e},cc=()=>{console.log({LayoutProviderContext:vt});let{version:e}=ts(vt);return e};import{jsx as pc}from"react/jsx-runtime";var ns=function(t){let{path:o}=t,n=de(),r=uc(s=>{n({type:je.SPLITTER_RESIZE,path:o,sizes:s})},[n,o]);return pc(_o,{...t,onSplitterMoved:r})};ns.displayName="Flexbox";Y("Flexbox",ns,"container");import{useForkRef as Cc}from"@salt-ds/core";import Oc from"classnames";import{forwardRef as Ac,useMemo as Hc}from"react";import{useCallback as cs,useEffect as bc,useRef as Qo,useState as yc}from"react";import{useCallback as dc,useLayoutEffect as rs,useRef as mc}from"react";var vb=["height","width"],Db=["height"],wb=["width"],Fe=new WeakMap,is=(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}},ss=new ResizeObserver(e=>{for(let t of e){let{target:o,contentRect:n}=t,r=Fe.get(o);if(r){let{onResize:s,measurements:i}=r,a=!1;for(let[l,c]of Object.entries(i)){let p=is(o,n,l);p!==c&&(a=!0,i[l]=p)}a&&s&&s(i)}}});function as(e,t,o,n=!1){console.log("resizeObserver container",{ref:e.current});let r=mc(t),s=dc(i=>{let a=i.getBoundingClientRect();return r.current.reduce((l,c)=>(l[c]=is(i,a,c),l),{})},[]);rs(()=>{let i=e.current,a=!1;async function l(){Fe.set(i,{measurements:{}}),a=!1;let{fonts:c}=document;if(c&&await c.ready,!a){let p=Fe.get(i);if(p){let d=s(i);p.measurements=d,ss.observe(i),n&&o(d)}}}if(i){if(Fe.has(i))throw Error("useResizeObserver attemping to observe same element twice");l()}return()=>{i&&Fe.has(i)&&(ss.unobserve(i),Fe.delete(i),a=!0)}},[e,s,n,o]),rs(()=>{let i=e.current,a=Fe.get(i);if(a){if(r.current!==t){r.current=t;let l=s(i);a.measurements=l}a.onResize=o}},[t,s,e,o])}function fc(e,t){let o=document.body.querySelector(`.${e}`),n={get:function(r,s){let i=r.getPropertyValue(`--${e}-breakpoint-${s}`);return i?parseInt(i):void 0}};return o?new Proxy(getComputedStyle(o),n):t!=null?t:{}}var gc=([,e],[,t])=>t-e,Jo=e=>Object.entries(e).sort(gc).map(([t,o],n,r)=>[t,o,n<r.length-1?r[n+1][1]:9999]),jo=null,hc=(e="salt")=>{let{xs:t,sm:o,md:n,lg:r,xl:s}=fc(e);return Jo({xs:t,sm:o,md:n,lg:r,xl:s})},ls=e=>(jo===null&&(jo=hc(e)),jo);var Ec=[],us=({breakPoints:e,smallerThan:t},o)=>{let[n,r]=yc(t?!1:"lg"),s=Qo(document.body),i=Qo(e?Jo(e):ls()),a=Qo("lg"),l=cs(p=>{if(i.current){for(let[d,u]of i.current)if(p>=u)return d}},[i]),c=cs(p=>{if(t){let d=i.current.find(([u])=>u===t);if(d){let[,,u]=d;return p<u}}else return l(p);return p},[t,l]);return as(o||s,i.current?["width"]:Ec,({width:p})=>{let d=c(p);d!==a.current&&(a.current=d,r(d))},!0),bc(()=>{let p=o||s;if(p.current){let d=a.current;if(i.current){let{clientWidth:u}=p.current,m=c(u);a.current=m,m!==d&&r(m)}}},[r,c,o]),n};var ps="data-collapsible",xc={[ps]:!0,"data-pad-start":!0,"data-pad-end":!0},Tc=e=>{var t;return(t=xc[e])!=null?t:!1},vc=e=>e===ps,Dc={dynamic:"dynamic",instant:"instant",true:"instant"},wc=e=>{var t;return(t=Dc[e])!=null?t:"none"},Ab=e=>Object.keys(e).reduce((t,o)=>{let[n,r]=t;if(Tc(o)){let s=vc(o)?wc(e[o]):e[o];n[o]=s,r[o]=void 0}return t},[{},{}]);import{getUniqueId as Rc}from"@vuu-ui/vuu-utils";import{cloneElement as Sc,isValidElement as Pc,useCallback as Mc,useMemo as ds,useRef as en}from"react";var Lc=["xs","sm","md","lg","xl"],Ic=12,ms=({children:e,cols:t,style:o})=>{let n=en(null),r=en(null),s=en(),i=t!=null?t:Ic,l=(o==null?void 0:o.flexDirection)==="column"?"height":"width",c=ds(()=>Array.isArray(e)?e:Pc(e)?[e]:[],[e]),p=Mc((d,u)=>{let m=Zt(d,u,Lc),h=[],g=[];for(let b=0;b<d.length;b++){let f=d[b],{style:{flex:y,...T}}=f.props;h.push(Sc(f,{key:Rc(),style:{...T,"--parent-col-count":i}})),g.push(m[b])}return[h,g]},[i]);return ds(()=>{let[d,u]=p(c,l);r.current=u,s.current=d},[p,c,l]),{cols:i,content:s.current,rootRef:n}};import{jsx as kc}from"react/jsx-runtime";var to="hwFluidGrid",tn=Ac(function(t,o){let{breakPoints:n,children:r,column:s,cols:i=12,className:a,flexFill:l,gap:c=3,fullPage:p,id:d,onSplitterMoved:u,resizeable:m,row:h,showGrid:g,spacing:b,splitterSize:f,style:y,...T}=t,x=Hc(()=>qe(r),[r]),{cols:v,content:E,rootRef:D}=ms({children:x,cols:i,style:y}),P=us({breakPoints:n},D),k=Oc(to,a,{[`${to}-column`]:s,[`${to}-row`]:h,[`${to}-show-grid`]:g,"flex-fill":l,"full-page":p}),C={...y,"--spacing":b,"--grid-col-count":v,"--grid-gap":c};return kc("div",{...T,className:k,"data-breakpoint":P,"data-cols":v,"data-resizeable":m||void 0,id:d,ref:Cc(D,o),style:C,children:E})});tn.displayName="FluidGrid";import{jsx as zc}from"react/jsx-runtime";var fs=function(t){return zc(tn,{...t})};fs.displayName="FluidGrid";Y("FluidGrid",fs,"container");import mp from"classnames";import bi,{useRef as fp,useState as yi}from"react";import{useCallback as Dt,useState as Nc}from"react";var oo=(e,t,o,n)=>{var b;let{loadSessionState:r,purgeSessionState:s,purgeState:i,saveSessionState:a}=Qe(),[l,c]=Nc((b=r(e,"contributions"))!=null?b:[]),p=de(),d=Dt((f,y)=>{let T=l.concat([{location:f,content:y}]);a(e,"contributions",T),c(T)},[l,e,a]),u=Dt(()=>{s(e,"contributions"),c([])},[e,s]),m=Dt(()=>{let f=r(e,"data-source");f&&f.unsubscribe(),s(e),i(e),p({type:"remove",path:o})},[p,e,r,s,i,o]),h=Dt(async(f,y,T)=>{var v;f.stopPropagation();let x=(v=t.current)==null?void 0:v.getBoundingClientRect();return new Promise((E,D)=>{p({type:"drag-start",evt:f,path:y===void 0?o:`${o}.${y}`,dragRect:x,preDragActivity:T,dropTargets:n,resolveDragStart:E,rejectDragStart:D})})},[t,p,o,n]);return[Dt(async(f,y)=>{var x;let{type:T}=f;switch(T){case"maximize":case"minimize":case"restore":return p({type:T,path:(x=f.path)!=null?x: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();default:return}},[p,o,m,h,d,u]),l]};import{useForkRef as Wc,useIdMemo as Gc}from"@salt-ds/core";import Kc from"classnames";import nn,{forwardRef as Zc,useCallback as Uc,useMemo as qc,useRef as vs,useState as Xc}from"react";import{useCallback as _e,useMemo as gs}from"react";var hs=({id:e,rootRef:t,path:o,dropTargets:n,title:r})=>{let s=de(),{loadState:i,loadSessionState:a,purgeState:l,saveState:c,saveSessionState:p}=Qe(),[d,u]=oo(e,t,o,n),m=gs(()=>{var E;return(E=i("view-title"))!=null?E:r},[i,r]),h=_e(E=>{o&&s({type:"set-title",path:o,title:E})},[s,o]),g=gs(()=>i(e),[e,i]),b=_e(E=>i(e,E),[e,i]),f=_e(E=>{l(e,E),s({type:"save"})},[e,s,l]),y=_e((E,D)=>{c(e,D,E),s({type:"save"})},[e,s,c]),T=_e(E=>a(e,E),[e,a]),x=_e((E,D)=>p(e,D,E),[e,p]),v=_e(({type:E,...D})=>{let{[E]:P}=D;y(P,E)},[y]);return{contributions:u,dispatchViewAction:d,load:b,loadSession:T,onConfigChange:v,onEditTitle:h,purge:f,restoredState:g,save:y,saveSession:x,title:m}};import{useResizeObserver as Bc,WidthHeight as $c}from"@heswell/salt-lab";import{useCallback as bs,useRef as ys}from"react";var Fc=[],Es=({mainRef:e,resize:t="responsive",rootRef:o})=>{let n=t==="defer",r=ys({}),s=ys(),i=bs(()=>{e.current&&(e.current.style.height=r.current.height+"px",e.current.style.width=r.current.width+"px"),s.current=void 0},[e]),a=bs(({height:l,width:c})=>{r.current.height=l,r.current.width=c,s.current!==null&&clearTimeout(s.current),s.current=window.setTimeout(i,40)},[i]);Bc(o,n?$c:Fc,a,n)};import _c,{useContext as xs}from"react";var Vc={dispatch:null},no=_c.createContext(Vc),Ts=()=>{var t;let e=xs(no);return(t=e==null?void 0:e.dispatch)!=null?t:null},Oy=()=>xs(no);import{jsx as on,jsxs as jc}from"react/jsx-runtime";var wt="vuuView",Yc=(e,t)=>e&&t?{...e,...t}:e||t,Ds=Zc(function(t,o){let{Header:n=ws,children:r,className:s,collapsed:i,closeable:a,"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:T,style:x={},title:v,...E}=t,D=Gc(m),P=vs(null),k=vs(null),[C,M]=Xc(),{contributions:w,dispatchViewAction:R,load:O,loadSession:I,onConfigChange:S,onEditTitle:L,purge:H,restoredState:G,save:_,saveSession:F,title:K}=hs({id:D,rootRef:P,path:b,dropTargets:p,title:v});Es({mainRef:k,resize:f,rootRef:P});let Q=Uc(N=>{M(N)},[]),V=()=>nn.isValidElement(r)&&(G||C)?nn.cloneElement(r,Yc(G,C)):r,q=qc(()=>({dispatch:R,id:D,path:b,title:K,load:O,loadSession:I,onConfigChange:S,purge:H,save:_,saveSession:F,setComponentProps:Q}),[R,D,O,I,S,b,H,_,F,Q,K]),z=typeof h=="object"?h:{};return on("div",{...E,className:Kc(wt,s,{[`${wt}-collapsed`]:i,[`${wt}-expanded`]:d,[`${wt}-resize-defer`]:f==="defer"}),"data-resizeable":y,id:D,ref:Wc(o,P),style:x,tabIndex:-1,children:jc(no.Provider,{value:q,children:[h?on(n,{...z,collapsed:i,contributions:w,expanded:d,closeable:a,onEditTitle:L,orientation:g,tearOut:T,title:K}):null,on("div",{className:`${wt}-main`,ref:k,children:V()})]})})});Ds.displayName="View";var He=nn.memo(Ds);He.displayName="View";Y("View",He,"view");import{Toolbar as gp,ToolbarButton as hp,ToolbarField as bp,Tooltray as Ei}from"@heswell/salt-lab";import{CloseIcon as yp}from"@salt-ds/icons";function Rs(e){var t,o,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(o=Rs(e[t]))&&(n&&(n+=" "),n+=o);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function ro(){for(var e,t,o=0,n="";o<arguments.length;)(e=arguments[o++])&&(t=Rs(e))&&(n&&(n+=" "),n+=t);return n}import{useCallback as Ss,useLayoutEffect as Jc,forwardRef as Qc,useRef as rn}from"react";import{useControlled as Ps}from"@salt-ds/core";import{Input as eu}from"@heswell/salt-lab";import{jsx as Ms}from"react/jsx-runtime";var sn="vuuEditableLabel",so=Qc(function({className:t,defaultEditing:o,defaultValue:n,editing:r,onChange:s,onEnterEditMode:i,onExitEditMode:a,value:l,...c},p){let d=rn(null),u=rn(!1),[m,h]=Ps({controlled:l,default:n!=null?n:"",name:"EditableLabel",state:"value"}),[g,b]=Ps({controlled:r,default:o!=null?o:!1,name:"EditableLabel",state:"editing"}),f=Ss(C=>{b(u.current=C)},[]),y=rn(m);Jc(()=>{g&&d.current!==null&&(d.current.select(),d.current.focus())},[g,d]);let T=Ss(()=>{f(!0),i&&i()},[i,f]),x=({cancelEdit:C=!1,allowDeactivation:M=!1}={})=>{f(!1);let w=y.current;w!==m&&(C?h(w):y.current=m),a&&a(w,m,M,C)},v=C=>{let{value:M}=C.target;h(M),s&&s(M)},E=()=>{T()},D=()=>{u.current&&x({allowDeactivation:!0})},P=C=>{g&&C.key==="Enter"?(C.stopPropagation(),x()):C.key==="ArrowRight"||C.key==="ArrowLeft"?C.stopPropagation():C.key==="Escape"&&x({cancelEdit:!0})},k=ro(sn,t,{[`${sn}-editing`]:g});return Ms("div",{...c,className:k,onDoubleClick:E,"data-text":m,ref:p,children:g?Ms(eu,{inputProps:{className:`${sn}-input`},value:m,onBlur:D,onChange:v,onKeyDown:P,ref:d,style:{padding:0},textAlign:"left"}):m})});import{Button as qu}from"@salt-ds/core";import Xu from"classnames";import Yu,{useMemo as ju,useRef as Ju}from"react";import{useCallback as ce,useRef as Gu}from"react";import{createContext as tu,useCallback as TE,useContext as ou,useMemo as vE}from"react";import{jsx as wE}from"react/jsx-runtime";var nu={isDragSource:!1,isDropTarget:!1,register:()=>{}},ru=()=>console.log("have you forgotten to provide a DragDrop Provider ?"),su=tu({registerDragDropParty:ru});var Ls=e=>{var r,s;let{dragSources:t,dropTargets:o,registerDragDropParty:n}=ou(su);if(e){let i=(r=t==null?void 0:t.has(e))!=null?r:!1,a=(s=o==null?void 0:o.has(e))!=null?s:!1;return{isDragSource:i,isDropTarget:a,register:n}}else return nu};import{useCallback as St,useMemo as hu,useRef as Ve,useState as bu}from"react";import{useCallback as ot,useMemo as gu,useRef as Bs}from"react";var iu=["left","right"],au=["top","bottom"],io=":not(.wrapped)",Is=':not([aria-hidden="true"])',Cs=e=>{let t=e.cloneNode(!0);return t.removeAttribute("id"),t.dataset.index="-1",t},lu=(e,t="width",o=!1)=>{let n=t==="width"?"left":"top",{[t]:r,[n]:s}=e.getBoundingClientRect(),{padEnd:i=!1,padStart:a=!1}=e.dataset,l=getComputedStyle(e),[c,p]=t==="width"?iu:au,d=a&&!o?0:parseInt(l.getPropertyValue(`margin-${c}`),10),u=i&&!o?0:parseInt(l.getPropertyValue(`margin-${p}`),10),m=r;if(parseInt(l.getPropertyValue("flex-shrink"),10)>0){let g=parseInt(l.getPropertyValue("flex-basis"),10);!isNaN(g)&&g>0&&(m=g)}return[s,d+m+u]},cu={horizontal:{CLIENT_POS:"clientX",CLIENT_SIZE:"clientWidth",CONTRA:"top",CONTRA_CLIENT_POS:"clientY",CONTRA_END:"bottom",CONTRA_POS:"y",DIMENSION:"width",END:"right",POS:"x",SCROLL_POS:"scrollLeft",SCROLL_SIZE:"scrollWidth",START:"left"},vertical:{CLIENT_POS:"clientY",CLIENT_SIZE:"clientHeight",CONTRA:"left",CONTRA_CLIENT_POS:"clientX",CONTRA_END:"right",CONTRA_POS:"x",DIMENSION:"height",END:"bottom",POS:"y",SCROLL_POS:"scrollTop",SCROLL_SIZE:"scrollHeight",START:"top"}},me=e=>cu[e],Os=(e,t)=>{let o=e.find(n=>n.id===t);if(o)return o},As=(e,t)=>{e.splice(t,1);for(let o=t;o<e.length;o++)e[o].currentIndex-=1},et=(e,t,o,n,r)=>{var d;let s=[],{DIMENSION:i}=me(t),a=Array.from(o?e.querySelectorAll(o):e.children),l=a.length,c=typeof(n==null?void 0:n.from)=="number"?n.atEnd?Math.max(0,n.from-1):n.from:0,p=typeof(n==null?void 0:n.to)=="number"?Math.min(n.to+2,l-1):l-1;for(let u=c;u<=p;u++){let m=a[u],[h,g]=lu(m,i),b=u===l-1,f=m.id,y=parseInt((d=m.dataset.index)!=null?d:"-1");s.push({currentIndex:u,dataIndex:isNaN(y)?-1:y,id:f,index:u,isDraggedItem:r===f,isLast:b,isOverflowIndicator:m.dataset.index==="overflow",element:m,start:h,end:h+g,size:g,mid:h+g/2})}return s},Rt=e=>e.findIndex(t=>t.isDraggedItem),an=(e,t)=>{let o=Rt(e),n=t==="fwd"?o+1:o-1;if(n<0||n>=e.length)throw Error("switchDropTargetPosition index out of range");let r=e.at(o),s=e.at(n),i=s.size-r.size;if(t==="fwd"){let a=s.start+i,l=s.end,c={...r,start:a,mid:Math.floor(a+(l-a)/2),end:l},p=r.start,d=r.end+i,u={...s,start:p,mid:Math.floor(p+(d-p)/2),end:d};e.splice(o,2,u,c)}else{let a=s.start,l=s.end-i,c={...r,start:a,mid:Math.floor(a+(l-a)/2),end:l},p=r.start-i,d=r.end,u={...s,start:p,mid:Math.floor(p+(d-p)/2),end:d};e.splice(n,2,c,u)}},tt=(e,t,o)=>{let n=e.length,r=Rt(e),s=e[r];if(o==="fwd"){let i=Math.round(t+s.size);for(let a=n-1;a>=0;a--){let l=e[a];if(i>l.mid)return a<r?s:l}}else{let i=Math.round(t);for(let a=0;a<n;a++){let l=e[a];if(i<l.mid)return a>r?s:l}}throw Error("no dropTraget identified")};function Hs(e,t){let{height:o,left:n,top:r,width:s}=e,{height:i,width:a}=t;return{height:Math.min(o,i),left:n,top:r,width:Math.min(s,a)}}import{useForkRef as uu}from"@salt-ds/core";import{forwardRef as pu,useCallback as du}from"react";import{Portal as mu}from"@vuu-ui/vuu-popups";import{jsx as ks}from"react/jsx-runtime";var fu=e=>e.split(" ").map(t=>`vuuDraggable-${t}`),ao=pu(function({wrapperClassName:t,element:o,onTransitionEnd:n,style:r,scale:s=1},i){let a=du(c=>{c&&(c.innerHTML="",c.appendChild(o),s!==1&&(c.style.transform=`scale(${s},${s})`))},[o,s]),l=uu(i,a);return ks(mu,{children:ks("div",{className:ro("vuuDraggable",...fu(t)),ref:l,onTransitionEnd:n,style:r})})}),ln=e=>{let t=document.createElement("div");return t.className="vuuDraggable-spacer",e&&t.addEventListener("transitionend",()=>{e.current=!1}),t},zs=()=>{let e=document.createElement("div");return e.className="vuuDraggable-dropIndicatorPosition",e},Ns=e=>{let t=document.createElement("div");return t.className="vuuDraggable-dropIndicator",e&&t.addEventListener("transitionend",()=>{e.current=!1}),t};var $s=()=>{let e=Bs(0),t=Bs(!1),o=gu(()=>[ln(t),ln()],[]),n=ot(()=>o.forEach(c=>c.remove()),[o]),r=ot((c,p="width")=>{let[d,u]=o;e.current=requestAnimationFrame(()=>{t.current=!0,d.style.cssText=`${p}: 0px`,u.style.cssText=`${p}: ${c}px`,o[0]=u,o[1]=d})},[o]),s=ot(()=>{e.current&&(cancelAnimationFrame(e.current),e.current=0)},[]),i=ot(()=>{n()},[n]),a=ot((c,p,d,u=!1,m="static",h="horizontal")=>{if(p){let g=h==="horizontal"?"width":"height",[b,f]=o;if(s(),u)t.current?(n(),b.style.cssText=`${g}: ${d}px`,f.style.cssText=`${g}: 0px`,m==="fwd"?(p.element.before(b),p.element.after(f)):(p.element.after(b),p.element.before(f))):m==="fwd"?p.element.after(f):p.element.before(f),r(d,g);else if(m==="static")b.style.cssText=`${g}: ${d}px`,p.element.before(b);else throw Error("useDragDisplacers currently only supports noTransition for static displacement");m!=="static"&&an(c,m)}},[r,s,n,o]),l=ot((c,p,d,u=!1,m="static",h="horizontal")=>{let g=h==="horizontal"?"width":"height",[b,f]=o;s(),u?(t.current?(n(),b.style.cssText=`${g}: ${d}px`,f.style.cssText=`${g}: 0px`,p.element.before(b),p.element.after(f)):m==="fwd"?p.element.after(f):p.element.before(f),r(d,g)):(b.style.cssText=`${g}: ${d}px`,p.element.after(b)),m!=="static"&&an(c,m)},[r,s,n,o]);return{clearDisplacedItem:i,displaceItem:a,displaceLastItem:l,clearSpacers:n}};var Fs=({draggableRef:e,onDrop:t,orientation:o="horizontal",containerRef:n,itemQuery:r="*",selected:s,viewportRange:i})=>{let a=Ve(),l=Ve(!1),c=Ve(-1),p=Ve([]),d=Ve(!1),[u,m]=bu(!1),{clearDisplacedItem:h,clearSpacers:g,displaceItem:b,displaceLastItem:f}=$s(),y=Ve(),T=`:is(${r}${io}${Is},.vuuOverflowContainer-OverflowIndicator)`,x=R=>p.current.findIndex(O=>O.id===R.id),v=Ve();v.current=i;let E=St(()=>{h()},[h]),D=St((R,O,I)=>{let{current:S}=n,{current:L}=y;if(S&&L){p.current=et(S,o,T,v.current);let{size:H}=L,_=c.current+H/2,{current:F}=p,K=tt(F,_,"fwd");if(K){let V=x(K),q=F[V];I&&R==="fwd"?f(F,F[F.length-1],H,!1,"static",o):b(F,q,H,!0,"static",o)}}},[n,b,f,T,o]),P=St(R=>{let I=R.target.closest(r);I.ariaSelected&&Array.isArray(s)&&s.length>1&&console.log("its a selected element, and we have a multi select");let{current:S}=n;if(S&&I){let{SCROLL_SIZE:L,CLIENT_SIZE:H}=me(o),{id:G}=I,{[L]:_,[H]:F}=S;l.current=_>F;let K=p.current=et(S,o,T,i,G);console.log({dropTargets:K});let Q=Rt(K),V=K[Q];V&&S&&(y.current=V,(V.isLast?f:b)(K,V,V.size,!1,"static",o))}},[n,b,f,T,r,o,s,i]),[k,C]=hu(()=>{let R=!1;return[S=>{if(!R){R=!0;let L=S.element.querySelector(".vuuPopupMenu");if(L){let H=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});L.dispatchEvent(H)}}},S=>{if(R){R=!1;let L=S.element.querySelector(".vuuPopupMenu");if(L){let H=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});L.dispatchEvent(H)}}}]},[]),M=St((R,O)=>{let{current:I}=y;if(I&&e.current&&n.current){c.current=R;let{current:S}=p,L=tt(S,R,O);if(L&&!L.isDraggedItem)if(L.isOverflowIndicator)m(d.current=!0),k(L);else{let{size:H}=I;(x(L)===S.length-1?f:b)(S,L,H,!0,O,o);let F=S.at(-1);C(F),m(d.current=!1)}a.current=O}},[n,b,f,e,C,o,k]),w=St(()=>{var S;g();let{current:R}=p,O=Rt(R),I=R[O];if(I&&(a.current=void 0,d.current?t(I.index,-1):t(I.index,O)),m(!1),n.current){let L=(S=n.current)==null?void 0:S.scrollTop;O<R.length&&(n.current.scrollTop=L)}},[g,n,t]);return{beginDrag:P,drag:M,drop:w,handleScrollStart:E,handleScrollStop:D,revealOverflowedItems:u}};import{useCallback as Pt,useRef as Ee,useState as Ws}from"react";import{useCallback as _s,useMemo as yu}from"react";var Vs=()=>{let e=yu(()=>zs(),[]),t=_s(()=>e.remove(),[e]);return{positionDropIndicator:_s((n,r="end")=>(r==="end"?n.element.after(e):n.element.before(e),e),[e]),clearSpacer:t}};import{jsx as Tu}from"react/jsx-runtime";var Eu=':not([data-overflowed="true"])',xu=':not([aria-hidden="true"])',Gs=({draggableRef:e,onDrop:t,orientation:o="horizontal",containerRef:n,itemQuery:r="*",selected:s,viewportRange:i})=>{let a=Ee(),l=Ee(null),c=Ee(null),p=Ee(""),d=Ee(!1),u=Ee(-1),m=Ee([]),h=Ee(!1),[g,b]=Ws(!1),[f,y]=Ws(),{clearSpacer:T,positionDropIndicator:x}=Vs(),v=Ee(),E=`:is(${r}${Eu}${xu},[data-overflow-indicator])`,D=I=>m.current.findIndex(S=>S.id===I.id),P=(I,S,L)=>{I.start+=S,I.mid+=S,I.end+=S,typeof L=="number"&&(I.currentIndex+=L)},k=Ee();k.current=i;let C=Pt(()=>{T()},[T]),M=Pt((I,S,L)=>{let{current:H}=n,{current:G}=v;if(H&&G){m.current=et(H,o,E,k.current);let{size:_}=G,K=u.current+_/2,{current:Q}=m,V=tt(Q,K,"fwd");V&&x(L&&I==="fwd"?Q[Q.length-1]:V,"start")}},[n,x,E,o]),w=Pt(I=>{let L=I.target.closest(r);L.ariaSelected&&Array.isArray(s)&&s.length>1&&console.log("its a selected element, and we have a multi select");let{current:H}=n;if(H&&L){let{SCROLL_SIZE:G,CLIENT_SIZE:_}=me(o),{id:F}=L,{[G]:K,[_]:Q}=H;d.current=K>Q;let V=m.current=et(H,o,E,i),q=Os(V,F);if(q&&H){let z=D(q);As(V,z),v.current=q;let{current:N}=k;if(N!=null&&N.atEnd)for(let X=0;X<V.length;X++)P(V[X],q.size);for(let X=z;X<V.length;X++)P(V[X],-q.size,-1);let[Z,le]=q.isLast?[V[V.length-1],"end"]:[V[z],"start"];c.current=Z,p.current=le;let Se=x(Z,le),{top:W,left:U,width:j}=Se.getBoundingClientRect(),J={top:q.isLast?N!=null&&N.atEnd&&!N.atStart?W+q.size-2:W-2:W-q.size-2,left:U,width:j,height:2};y(Tu(ao,{wrapperClassName:"dropIndicatorContainer",style:J,ref:l,element:Ns()}))}}},[r,s,n,o,E,i,x]),R=Pt((I,S)=>{let{current:L}=c,{current:H}=v;if(H&&e.current&&n.current){let G=o==="horizontal"?"left":"top";u.current=I;let{current:_}=m,F=tt(_,I,S);if(F&&F.index!==(L==null?void 0:L.index)){if(F.isOverflowIndicator)b(h.current=!0);else if(l.current){if(D(F)===_.length-1){let Q=_[_.length-1],q=x(Q,"start").getBoundingClientRect();l.current.style[G]=`${q.top}px`}else{let V=x(F,"start").getBoundingClientRect();l.current.style[G]=`${V.top}px`}b(h.current=!1)}c.current=F,a.current=S}}},[e,n,o,x]),O=Pt(()=>{T();let{current:I}=v,{current:S}=c,{current:L}=p,{current:H}=k;if(I&&H&&S){let{index:G}=I,_=L==="start",{index:F,currentIndex:K}=S;c.current=null,a.current=void 0,h.current?t(G,-1):G<F?t(G,_?K:K+1):t(G,_?F:F+1),y(void 0)}b(!1)},[T,t]);return{beginDrag:w,drag:R,drop:O,dropIndicator:f,handleScrollStart:C,handleScrollStop:M,revealOverflowedItems:g}};import{useCallback as xe,useLayoutEffect as vu,useRef as fe,useState as Du}from"react";import{useCallback as Ks,useRef as lo}from"react";var Zs=({containerRef:e,onScrollingStopped:t,orientation:o="vertical"})=>{let n=lo(null),r=lo(!1),s=lo(0),i=lo("fwd"),a=Ks((c=!1)=>{console.log("[useAutoScroll] stopScrolling"),n.current!==null&&(clearTimeout(n.current),n.current=null),r.current=!1,t==null||t(i.current,s.current,c)},[t]),l=Ks((c,p,d=30)=>{let{current:u}=e;if(u){let{SCROLL_POS:m,SCROLL_SIZE:h,CLIENT_SIZE:g}=me(o),{[m]:b,[h]:f,[g]:y}=u,T=c==="fwd"?f-y-b:b,x=Math.min(T,d);c==="fwd"?(i.current="fwd",u[m]=s.current=b+x):(i.current="bwd",u[m]=s.current=b-x),x===T?a(!0):(r.current=!0,n.current=window.setTimeout(()=>{l(c,p,d)},100))}},[e,o,a]);return{isScrolling:r,startScrolling:l,stopScrolling:a}};import{jsx as Iu}from"react/jsx-runtime";var wu={beginDrag:()=>{},drag:()=>{},draggableRef:{current:null},drop:()=>{},isDragging:!1,isScrolling:!1,handleScrollStart:()=>{},handleScrollStop:()=>{},revealOverflowedItems:!1},Us={start:0,end:1e3,contraStart:0,contraEnd:1e3},Ru=()=>wu,Su=3,Pu=(e,t)=>e.closest(t),Mu=e=>e.dataset.index==="overflow"&&e.parentElement!==null&&e.parentElement.classList.contains("overflowed"),Lu=(e,t)=>{let o=`:is(${t}${io},.vuuOverflowContainer-OverflowIndicator)`,r=Array.from(e.querySelectorAll(o)).pop();return[r,Mu(r)]},qs=({allowDragDrop:e,containerRef:t,draggableClassName:o,itemQuery:n="*",onDragStart:r,onDrop:s,onDropSettle:i,orientation:a,...l})=>{let c=fe({start:0,end:0,contraStart:0,contraEnd:0}),[p,d]=Du({draggable:void 0,draggedItemIndex:-1,isDragging:!1}),u=fe(null),m=fe(),h=fe(null),g=fe(!1),b=fe({x:0,y:0}),f=fe({x:0,y:0}),y=fe({x:0,y:0}),T=fe(null),x=fe(-1),v=fe(-1),E=fe(),{isDragSource:D,isDropTarget:P,register:k}=Ls(l.id);l.id&&(D||P)&&k(l.id);let C=xe(()=>{var j;let{current:W}=v,U=(j=t.current)==null?void 0:j.querySelector(`${n}[data-index="${W}"]`);U&&U.classList.remove("vuuDropTarget-settling"),v.current=-1,i==null||i(W),d(J=>({...J,draggable:void 0}))},[t,n,i]),M=xe(W=>{if(t.current){let{POS:U,SCROLL_POS:j,SCROLL_SIZE:J,CLIENT_SIZE:X}=me(a),{[j]:ge,[J]:rt,[X]:ke}=t.current,Ge=rt-ke,Ke=ge<Ge,st=c.current.end,Ze=ge>0&&W-b.current[U]<=c.current.start,Ue=Ke&&W-b.current[U]>=st;return Ze?"bwd":Ue?"fwd":""}},[t,a]),w=e===!0||e==="natural-movement"?Fs:e==="drop-indicator"?Gs:Ru,R=xe((W,U,j)=>{var J;(J=E.current)==null||J.call(E,W,U,j)},[]),{isScrolling:O,startScrolling:I,stopScrolling:S}=Zs({containerRef:t,onScrollingStopped:R,orientation:a}),L=xe((W,U)=>{x.current=U,s==null||s(W,U),v.current=U},[s]),{beginDrag:H,drag:G,drop:_,handleScrollStart:F,handleScrollStop:K,...Q}=w({...l,containerRef:t,draggableRef:u,isDragSource:D,isDropTarget:P,itemQuery:n,onDrop:L,orientation:a});E.current=K;let V=xe(W=>{let{CLIENT_POS:U,CONTRA_CLIENT_POS:j,CONTRA_POS:J,POS:X}=me(a),{clientX:ge,clientY:rt}=W,{[U]:ke,[j]:Ge}=W,Ke=f.current[X],st=f.current[J],Ze=Math.abs(Ke-ke);if((D?Math.abs(st-Ge):0)-Ze>5&&(c.current=Us),f.current.x=ge,f.current.y=rt,c.current===Us&&u.current){let it=f.current.x-b.current.x,ze=f.current.y-b.current.y;u.current.style.top=`${ze}px`,u.current.style.left=`${it}px`}else if(Ze>0&&u.current){let it=Ke<ke?"fwd":"bwd",ze=M(ke),yo=f.current[X]-b.current[X];if(ze&&g.current&&!O.current?(F(),I(ze,1)):!ze&&O.current&&S(),!O.current){let It=Math.round(Math.max(c.current.start,Math.min(c.current.end,yo))),ve=a==="horizontal"?"left":"top";u.current.style[ve]=`${It}px`,G(It,it)}}},[G,u,M,F,D,O,a,I,S]),q=xe(()=>{document.removeEventListener("mousemove",V,!1),document.removeEventListener("mouseup",q,!1),T.current=u.current,_(),d(W=>({...W,draggedItemIndex:-1,isDragging:!1})),m.current=void 0},[V,u,_]),z=xe(W=>{let{clientX:U,clientY:j,target:J}=W,X=Pu(J,n),{current:ge}=t;if(ge&&X){let{CONTRA:rt,CONTRA_END:ke,DIMENSION:Ge,END:Ke,SCROLL_SIZE:st,CLIENT_SIZE:Ze,START:Ue}=me(a);m.current=X;let{[st]:it,[Ze]:ze}=ge;g.current=it>ze;let[yo,It]=Lu(ge,n),ve=ge.getBoundingClientRect(),Ct=X.getBoundingClientRect(),Eo=Ct[Ge],{[Ue]:Zi,[Ke]:Ui}=yo.getBoundingClientRect();b.current.x=U-Ct.left,b.current.y=j-Ct.top,c.current.start=ve[Ue],c.current.end=It?Math.max(Zi,ve.right-Eo):g.current?ve[Ue]+ve[Ge]-Eo:Ui-Eo,c.current.contraStart=ve[rt],c.current.contraEnd=ve[ke],H(W);let{dataset:{index:qi="-1"}}=X;d({isDragging:!0,draggable:Iu(ao,{element:Cs(X),onTransitionEnd:C,ref:u,style:Hs(Ct,ve),wrapperClassName:o}),draggedItemIndex:parseInt(qi)}),r==null||r(),document.addEventListener("mousemove",V,!1),document.addEventListener("mouseup",q,!1)}},[H,t,V,q,o,u,n,r,a,C]),N=xe(W=>{let{CLIENT_POS:U,POS:j}=me(a),{[U]:J}=W;Math.abs(J-y.current[j])>Su&&t.current&&(h.current&&(window.clearTimeout(h.current),h.current=null),document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",Z,!1),z(W))},[t,H,a]),Z=xe(()=>{h.current&&(window.clearTimeout(h.current),h.current=null),document.removeEventListener("mousemove",N,!1),document.removeEventListener("mouseup",Z,!1)},[N]),le=xe(W=>{console.log("useDragDropNext onMouseDown");let{current:U}=t;if(U&&!W.defaultPrevented){let{clientX:j,clientY:J}=W;f.current.x=y.current.x=j,f.current.y=y.current.y=J,document.addEventListener("mousemove",N,!1),document.addEventListener("mouseup",Z,!1),W.persist(),h.current=window.setTimeout(()=>{document.removeEventListener("mousemove",N,!1),document.removeEventListener("mouseup",Z,!1),z(W.nativeEvent)},500)}},[t,z,N,Z]),{current:Se}=T;return vu(()=>{if(Se&&t.current){let W=x.current,U=t.current.querySelector(`${n}[data-index="${W}"]`);U?(U.classList.add("vuuDropTarget-settling"),requestAnimationFrame(()=>{let{top:j,left:J}=U.getBoundingClientRect(),{top:X,left:ge}=Se.getBoundingClientRect();ge!==J||X!==j?(Se.classList.add("vuuDraggable-settling"),Se.style.top=`${j}px`,Se.style.left=`${J}px`):C()})):console.log(`dont have the dropped item (at ${W})`),T.current=null}},[t,n,Se,C]),{...Q,...p,isScrolling:O,onMouseDown:e?le:void 0}};var Xs=e=>typeof e=="object"&&e!==null&&"tabIndex"in e&&typeof e.tabIndex=="number",Ys=e=>({label:"Close",location:"tab",action:"close-tab",options:e}),js=e=>({label:"Rename",location:"tab",action:"rename-tab",options:e});var Cu=e=>{if(e){let t=parseInt(e.dataset.index||"");if(!isNaN(t))return t}return-1},Js=(e,t)=>{if(e){let o=e.querySelector(`[data-index]:has(${t})`);return Cu(o)}return-1},cn=e=>Js(e,'[aria-selected="true"]'),Qs=e=>Js(e,".vuuEditableLabel-editing");import{useCallback as un,useMemo as Ou,useRef as ei}from"react";var ti=(e,t)=>{let o=ei(!1),n=un(()=>{o.current=!0},[]),r=un(()=>{o.current=!1},[]),s=un(()=>{var a,l;(a=e.current)==null||a.style.setProperty("--tab-thumb-transition","none"),(l=e.current)==null||l.removeEventListener("transitionend",s)},[e]),i=ei(-1);return Ou(()=>{var c,p;let a=0,l=0;if(i.current!==-1){let d=(c=e.current)==null?void 0:c.querySelector(".vuuTab-selected"),u=(p=e.current)==null?void 0:p.querySelector(`[data-index="${t}"] .vuuTab`);if(d&&u&&!o.current){let{left:m,width:h}=d.getBoundingClientRect(),{left:g}=u.getBoundingClientRect();a=m-g,l=h;let b=Math.abs(a/1100);requestAnimationFrame(()=>{var f,y,T,x;(f=e.current)==null||f.style.setProperty("--tab-thumb-offset","0px"),(y=e.current)==null||y.style.setProperty("--tab-thumb-width","100%"),(T=e.current)==null||T.style.setProperty("--tab-thumb-transition",`all ${b}s ease`),(x=e.current)==null||x.addEventListener("transitionend",s)})}}return i.current=t,o.current?{containerStyle:{"--tab-thumb-offset":"0px","--tab-thumb-width":"100%"},resumeAnimation:r,suspendAnimation:n}:{containerStyle:{"--tab-thumb-offset":`${a}px`,"--tab-thumb-width":l?`${l}px`:void 0},resumeAnimation:r,suspendAnimation:n}},[t,r,n,e,s])};import{useControlled as Au}from"@salt-ds/core";import{getFocusableElement as Hu}from"@vuu-ui/vuu-utils";import{useCallback as Te,useRef as pn,useState as oi}from"react";import{ArrowDown as ii,ArrowUp as ku,ArrowLeft as zu,ArrowRight as Nu,Home as ni,End as ri}from"@vuu-ui/vuu-utils";var ai={horizontal:{[ni]:"start",[ri]:"end",[zu]:"bwd",[Nu]:"fwd"},vertical:{[ni]:"start",[ri]:"end",[ku]:"bwd",[ii]:"fwd"}},Bu=(e,t="horizontal")=>ai[t][e]!==void 0,$u=e=>e===ii;function si(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 Fu=e=>e!==null&&!e.classList.contains("wrapped"),co=(e,t)=>e?e.querySelector(`[data-index="${t}"]`):null,li=({containerRef:e,defaultHighlightedIdx:t=-1,highlightedIdx:o,keyBoardActivation:n,orientation:r,selectedIndex:s=0})=>{let i=n==="manual",a=pn(!1),l=pn(-1),[c,p]=oi(!1),[,d]=oi({}),[u,m]=Au({controlled:o,default:t,name:"UseKeyboardNavigation"}),h=Te(w=>{m(l.current=w)},[m]),g=pn(!1),b=Te((w,R=!1,O,I=70)=>{h(w),O===!0&&!g.current&&(g.current=!0);let S=()=>{let L=co(e.current,w);if(L){let H=Hu(L);H==null||H.focus()}};R?S():setTimeout(S,I)},[e,h]),f=w=>{if(console.log("ONFOCUS"),l.current===-1&&w.target.tabIndex!==-1){let R=Qs(e.current);R!==-1?requestAnimationFrame(()=>{h(R)}):setTimeout(()=>{l.current===-1&&s!==null&&h(s)},200)}},y=Te(()=>{var w,R;return(R=(w=e.current)==null?void 0:w.querySelectorAll("[data-index]").length)!=null?R:0},[e]),T=Te((w="fwd",R)=>{let O=y(),S=si(O,w,typeof R=="number"?R:O),L=w==="start"?"fwd":w==="end"?"bwd":w;for(;(L==="fwd"&&S<O||L==="bwd"&&S>0)&&!Fu(co(e.current,S));){let H=si(O,L,S);if(H===S)break;S=H}return S},[e,y]),x=Te((w,R=!1)=>{let O=ai[r][w.key],I=T(O,u);I!==u?i&&b(I,!0):R&&d({})},[u,i,T,b,r]),v=Te(()=>{let w=co(e.current,u);return w?w.querySelector(".vuuPopupMenu")!=null:!1},[e,u]),E=Te(()=>{let w=co(e.current,u),R=w==null?void 0:w.querySelector(".vuuPopupMenu");if(R){let O=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});R.dispatchEvent(O)}return!1},[e,u]),D=Te(w=>{y()>0&&Bu(w.key,r)?(w.preventDefault(),g.current?x(w):(g.current=!0,x(w,!0))):$u(w.key)&&v()&&E()},[E,y,v,x,r]),P=(w,R)=>{h(R)},k=Te(()=>{c||(p(!0),a.current?a.current=!1:g.current=!0)},[c]),C=Te(()=>{c||(a.current=!0),g.current=!1},[c]);return{containerProps:{onBlur:w=>{let R=w.target.closest(".vuuTabstrip"),O=w.relatedTarget;R&&!(R!=null&&R.contains(O))&&(h(-1),p(!1))},onMouseDownCapture:C,onFocus:k,onMouseLeave:()=>{g.current=!0,h(-1),a.current=!1}},focusVisible:g.current?u:-1,focusIsWithinComponent:c,highlightedIdx:u,focusTab:b,onClick:P,onFocus:f,onKeyDown:D,setHighlightedIdx:h}};import{useControlled as _u}from"@salt-ds/core";import{useCallback as uo}from"react";var Vu=["Enter"," "],Wu=e=>e&&e.matches('[class*="vuuTab "]'),ci=({defaultSelected:e,highlightedIdx:t,onSelectionChange:o,selected:n})=>{let[r,s,i]=_u({controlled:n,default:e!=null?e:0,name:"Tabstrip",state:"value"}),a=uo(d=>Vu.includes(d.key),[]),l=uo(d=>{s(d),o==null||o(d)},[o,s]),c=uo(d=>{let u=d.target;a(d)&&t!==r&&Wu(u)&&(d.stopPropagation(),d.preventDefault(),l(t))},[a,t,r,l]),p=uo((d,u)=>{u!==r&&l(u)},[l,r]);return{activateTab:l,isControlled:i,onClick:p,onKeyDown:c,selected:r}};var Ku=new Set(["Enter"," "]),Zu=e=>Ku.has(e),Uu=(e,t)=>e?e.querySelector(`[data-index="${t}"]`):null,ui=({activeTabIndex:e,allowDragDrop:t,animateSelectionThumb:o,containerRef:n,onActiveChange:r,onAddTab:s,onCloseTab:i,onExitEditMode:a,onMoveTab:l,orientation:c,keyBoardActivation:p})=>{let d=Gu(e),{focusTab:u,highlightedIdx:m,onClick:h,onKeyDown:g,setHighlightedIdx:b,...f}=li({containerRef:n,keyBoardActivation:p,orientation:c,selectedIndex:d.current}),{activateTab:y,onClick:T,onKeyDown:x,selected:v}=ci({highlightedIdx:m,onSelectionChange:r,selected:e});d.current=v;let{containerStyle:E,resumeAnimation:D,suspendAnimation:P}=ti(n,o?v:-1),k=ce((z,N)=>{let{current:Z}=d;console.log(`useTabstrip handleDrop ${z} - ${N} ${Z}`),l==null||l(z,N);let le=-1;N!==-1&&(Z===z?le=N:z>Z&&N<=Z?le=Z+1:z<Z&&N>=Z&&(le=Z-1),le!==-1&&(P(),y(le),requestAnimationFrame(D)),u(N,!1,!1,350))},[u,l,D,y,P]),{onMouseDown:C,...M}=qs({allowDragDrop:t,containerRef:n,draggableClassName:`tabstrip-${c}`,onDrop:k,orientation:"horizontal",itemQuery:".vuuOverflowContainer-item"}),w=ce((z,N,Z,le)=>{console.log(`handleExitEditMode ${z} ${N} ${Z} ${le}`),a==null||a(z,N,Z,le),Z||u(le,!1,!0)},[u,a]),R=ce((z,N)=>{h(z,N),T(z,N)},[h,T]),O=ce((z=m)=>{let N=Uu(n.current,z);if(N)return N.querySelector(".vuuEditableLabel")},[n,m]),I=ce((z=m)=>{let N=O(z);return N?N.classList.contains("vuuEditableLabel-editing"):!1},[O,m]),S=ce((z=m)=>{let N=O(z);if(N){let Z=new MouseEvent("dblclick",{view:window,bubbles:!0,cancelable:!0});N.dispatchEvent(Z)}},[O,m]),L=ce(z=>{g(z),z.defaultPrevented||x(z),!z.defaultPrevented&&Zu(z.key)&&S()},[S,g,x]),H=ce(z=>{let N=cn(n.current),Z=N>z?N-1:N===z?0:N;return P(),i==null||i(z,Z),setTimeout(()=>{D()},200),!0},[n,i,D,P]),G=ce(z=>(S(z),!0),[S]),_=ce(z=>{if(Xs(z.options))switch(z.menuId){case"close-tab":return H(z.options.tabIndex);case"rename-tab":return G(z.options.tabIndex);default:console.log(`tab menu action ${z.menuId}`)}return!1},[H,G]),F=ce(()=>{I()?b(m):u(m)},[m,u,b,I]),K=ce(z=>{let N=parseInt(z.index);isNaN(N)||y(N)},[y]),Q={onFocus:f.onFocus,onKeyDown:L},V=ce(()=>{s==null||s(),requestAnimationFrame(()=>{let z=cn(n.current);z!==-1&&u(z)})},[n,u,s]),q={onClick:R,onKeyDown:L,onExitEditMode:w,onMenuAction:_,onMenuClose:F,onMouseDown:C};return{activeTabIndex:v,containerStyle:E,focusVisible:f.focusVisible,containerProps:{...f.containerProps,onSwitchWrappedItemIntoView:K},navigationProps:Q,onClickAddTab:V,tabProps:q,...M}};import{Fragment as tp,jsx as ep,jsxs as op}from"react/jsx-runtime";import{createElement as Qu}from"react";var dn="vuuTabstrip",pi=({activeTabIndex:e,allowAddTab:t,allowCloseTab:o,allowDragDrop:n=!1,allowRenameTab:r=!1,animateSelectionThumb:s=!1,children:i,className:a,id:l,keyBoardActivation:c="manual",location:p,onActiveChange:d,onAddTab:u,onCloseTab:m,onExitEditMode:h,onMoveTab:g,orientation:b="horizontal",showTabMenuButton:f,style:y,...T})=>{let x=Ju(null),{activeTabIndex:v,focusVisible:E,containerStyle:D,draggedItemIndex:P,onClickAddTab:k,tabProps:C,...M}=ui({activeTabIndex:e,allowDragDrop:n,animateSelectionThumb:s,containerRef:x,keyBoardActivation:c,onActiveChange:d,onAddTab:u,onCloseTab:m,onExitEditMode:h,onMoveTab:g,orientation:b}),w=Ht(l),R=Xu(dn,`${dn}-${b}`,a),O=y||D?{...y,...D}:void 0,I=ju(()=>qe(i).map((S,L)=>{let{id:H=`${w}-tab-${L}`,closeable:G=o,editable:_=r,showMenuButton:F=f}=S.props,K=L===v;return Yu.cloneElement(S,{...C,...M.navigationProps,closeable:G,"data-overflow-priority":K?"1":void 0,dragging:P===L,editable:_,focusVisible:E===L,id:H,index:L,location:p,selected:K,showMenuButton:F,tabIndex:K?0:-1})}).concat(t?Qu(qu,{...M.navigationProps,"aria-label":"Create Tab",className:`${dn}-addTabButton`,"data-icon":"add","data-overflow-priority":"1",key:"addButton",onClick:k,variant:"secondary",tabIndex:-1}):[]),[v,t,o,r,i,E,w,p,k,f,C,P,M.navigationProps]);return op(tp,{children:[ep(di,{...T,...M.containerProps,className:R,height:28,id:w,overflowIcon:"more-horiz",ref:x,style:O,children:I}),M.draggable]})};import{useForkRef as lp}from"@salt-ds/core";import cp from"classnames";import{forwardRef as up,useCallback as pp,useRef as fi}from"react";import{PopupMenu as np}from"@vuu-ui/vuu-popups";import{useMemo as rp}from"react";import sp from"classnames";import{jsx as ap}from"react/jsx-runtime";var ip="vuuTabMenu",mi=({allowClose:e,allowRename:t,location:o,onMenuAction:n,onMenuClose:r,index:s})=>{let[i,a]=rp(()=>[(l,c)=>{let p=[];return t&&p.push(js(c)),e&&p.push(Ys(c)),p},{tabIndex:s}],[e,t,s]);return ap(np,{className:ip,menuBuilder:i,menuActionHandler:n,menuLocation:sp("tab",o),menuOptions:a,onMenuClose:r,tabIndex:-1})};import{jsx as po,jsxs as dp}from"react/jsx-runtime";var We="vuuTab",gi=()=>{},hi=up(function({ariaControls:t,children:o,className:n,closeable:r=!1,dragging:s,editable:i=!1,editing:a,focusVisible:l,index:c,label:p,location:d,onClick:u,onClose:m,onEnterEditMode:h=gi,onExitEditMode:g=gi,onFocus:b,onKeyUp:f,onMenuAction:y,onMenuClose:T,orientation:x,selected:v,showMenuButton:E=r||i,tabIndex:D,...P},k){if(E&&typeof y!="function")throw Error("Tab onMenuAction must be provided if showMenuButton is set");let C=fi(null),M=fi(null),w=lp(k,C),R=pp(H=>{a||(H.preventDefault(),u==null||u(H,c))},[a,c,u]),O=(H="",G="",_=!0)=>g(H,G,_,c),I=H=>{switch(H.key){case"Backspace":case"Delete":r&&(H.stopPropagation(),m&&m(c));break;default:f&&f(H,c)}},S=()=>i?po(so,{editing:a,defaultValue:p,onEnterEditMode:h,onExitEditMode:O,ref:M},p):p,L=H=>{if(M.current){let _=M.current.querySelector(".vuuEditableLabel-input");_==null||_.focus()}b==null||b(H)};return dp("div",{...P,"aria-controls":t,"aria-selected":v,className:cp(We,{[`${We}-closeable`]:r,"vuuDraggable-dragAway":s,[`${We}-editing`]:a,[`${We}-selected`]:v||void 0,[`${We}-vertical`]:x==="vertical",saltFocusVisible:l}),onClick:R,onFocus:L,onKeyUp:I,ref:w,role:"tab",tabIndex:D,children:[po("div",{className:`${We}-main`,children:po("span",{className:`${We}-text`,"data-text":i?void 0:p,children:o!=null?o:S()})}),E?po(mi,{allowClose:r,allowRename:i,location:d,onMenuAction:y,onMenuClose:T,index:c}):null]})});import{jsx as nt,jsxs as Ep}from"react/jsx-runtime";var ws=({className:e,contributions:t,collapsed:o,closeable:n,onEditTitle:r,orientation:s="horizontal",style:i,title:a="Untitled"})=>{let l=fp(null),[c,p]=yi(a),[d,u]=yi(!1),m=Ts(),h=M=>m==null?void 0:m({type:"remove"},M),g="vuuHeader",b=()=>{var M;(M=l.current)==null||M.focus()},f=M=>{M.stopPropagation()},T=mp(g,e,`${g}-${o||s}`),x=()=>{u(!0)},v=M=>{M.key==="Enter"&&u(!0)},E=(M="",w="",R=!0,O=!1)=>{var I;u(!1),O?p(M):w!==M&&(p(w),r==null||r(w)),R===!1&&((I=l.current)==null||I.focus())},D=M=>{m==null||m({type:"mousedown"},M)},P=[],k=[],C=[];return t==null||t.forEach((M,w)=>{switch(M.location){case"pre-title":P.push(bi.cloneElement(M.content,{key:w}));break;default:k.push(bi.cloneElement(M.content,{key:w}))}}),a&&P.push(nt(bp,{className:"vuuHeader-title",children:nt(so,{editing:d,value:c,onChange:p,onMouseDownCapture:b,onEnterEditMode:x,onExitEditMode:E,onKeyDown:v,ref:l,tabIndex:0},"title")},"title")),n&&C.push(Ep(hp,{onClick:h,onMouseDown:f,children:[nt(yp,{})," Close"]},"close")),k.length>0&&P.push(nt(Ei,{"data-align-end":!0,children:k},"contributions")),C.length>0&&P.push(nt(Ei,{"data-align-end":!0,children:C},"actions")),nt(gp,{className:T,orientation:s,style:i,onMouseDown:D,children:P})};import kp,{forwardRef as zp}from"react";import hn from"classnames";import{PopupMenu as Np}from"@vuu-ui/vuu-popups";import{useCallback as Li,useMemo as gn,useRef as Ap,useState as Hp}from"react";var xp=".vuuOverflowContainer-item:not(.wrapped)",Tp=e=>e.sort((t,o)=>{let{dataset:{index:n="?"}}=t,{dataset:{index:r="?"}}=o,s=t.classList.contains("wrapped"),i=o.classList.contains("wrapped"),a=n==="overflow",l=r==="overflow";return s&&!i?1:!s&&i?-1:a?1:l?-1:parseInt(n)>parseInt(r)?1:-1}),mn=[],Mt=e=>{let t=[],o=[],n=-1,r=!1,s=Tp(Array.from(e.children));for(let i of s){let a=i,{dataset:{index:l="?",label:c="?",overflowPriority:p="0"}}=a,{left:d}=a.getBoundingClientRect();d<=n?(l==="overflow"?o.push(t.pop()):o.push({index:l,label:c,overflowPriority:p}),r=!0):r?o.push({index:l,label:c,overflowPriority:p}):t.push({index:l,label:c,overflowPriority:p}),n=d}return[t,o]},xi=(e,t)=>{let o=!1;t.find(({index:n})=>n==="overflow")&&t.length===1&&(o=!0);for(let n of e.children){let{dataset:{index:r="?"}}=n;t.length===0||o?e.classList.remove("overflowed"):e.classList.add("overflowed"),r!=="overflow"&&t.find(s=>s.index===r)?n.classList.add("wrapped"):n.classList.remove("wrapped")}},vp=(e,{overflowPriority:t})=>Math.max(e,parseInt(t)),Dp=(e,{overflowPriority:t})=>Math.min(e,parseInt(t)),Ti=e=>{var t;return e.length>1&&((t=e.at(-1))==null?void 0:t.index)==="overflow"},wp=e=>{let[t]=e;for(let o=1;o<e.length;o++){let n=e[o];parseInt(n.overflowPriority)>parseInt(t.overflowPriority)&&(t=n)}return t},vi=(e,t)=>{var r;let o=e.reduce(Dp,Number.MAX_SAFE_INTEGER);return t.reduce(vp,0)>o?!0:t.length>1&&((r=t.at(-1))==null?void 0:r.index)==="overflow"},Di=(e,t)=>new Promise(o=>{requestAnimationFrame(()=>{let[,n]=Mt(e);Pp(t,n).forEach(s=>Rp(e,s)),o(n)})}),wi=(e,t,o)=>new Promise(n=>{requestAnimationFrame(()=>{let[,r]=Mt(e),s=wp(r);if(s){let[i,a]=fn(e,s);n([i,a])}else n([t,o])})}),Ri=(e,t)=>e.querySelector(`[data-index="${t.index}"]`),Rp=(e,t)=>{let o=Ri(e,t);if(o)o.classList.add("wrapped");else throw Error(`markElementAsWrapped element item with index ${t.index} not found`)},Sp=e=>Array.from(e.querySelectorAll(".wrapped")),Pp=(e,t)=>{let o=[];for(let n of t)e.find(({index:r})=>r===n.index)||o.push(n);return o},Mp=(e,t)=>{Sp(e).forEach(n=>{let{dataset:{index:r="?"}}=n;t.find(s=>s.index===r)||n.classList.remove("wrapped")})},Si=e=>e.querySelector('[data-index="overflow"]'),Lp=e=>e.querySelector(".wrapped"),mo=e=>parseInt(getComputedStyle(e).getPropertyValue("width")),Pi=(e,t)=>{let{right:o}=e.getBoundingClientRect(),n=parseInt(getComputedStyle(e).getPropertyValue("padding-right")),{right:r}=t.getBoundingClientRect();return o-n-r},Mi=e=>{let t=Si(e),o=Pi(e,t),n=mo(t),r=Lp(e);return mo(r)<=o+n?(e.classList.remove("overflowed"),r.classList.remove("wrapped"),!0):!1},Ip=(e,t)=>{let{dataset:{index:o="0",overflowPriority:n="0"}}=e,{dataset:{index:r="0",overflowPriority:s="0"}}=t;return n>s?-1:n<s?1:parseInt(o)-parseInt(r)},Cp=e=>Array.from(e.querySelectorAll(xp)).sort(Ip),fn=(e,t)=>{let o=Cp(e),n=Ri(e,t),r=-1,s=o.at(r),i=mo(s),a=mo(n),l=Si(e),c=Pi(e,l)+i;if(c>=a)Op(n,s);else{let{left:u}=s.getBoundingClientRect(),m=c,h=[s];for(;c<a;){r-=1,s=o.at(r),h.push(s);let{left:g}=s.getBoundingClientRect(),b=u-g;c=m+b}n==null||n.classList.remove("wrapped"),h.forEach(g=>{g.classList.add("wrapped")})}let[p,d]=Mt(e);return Mp(e,d),[p,d]},Op=(e,t)=>{if(!e||!t)throw Error("switchWrapOnElements, element undefined");e.classList.remove("wrapped"),t.classList.add("wrapped")};var Ii=({itemCount:e,onSwitchWrappedItemIntoView:t})=>{let[o,n]=Hp(null),r=Ap(mn),s=Li(async()=>{if(o){let[d,u]=Mt(o);for(xi(o,u),Ti(u)&&(u=await Di(o,u));vi(d,u);)[d,u]=await wi(o,d,u);u.length===1&&Mi(o)&&(u=mn),r.current=u}},[o]),i=d=>typeof d=="object"&&d!==null&&"overflowItem"in d,[a,l]=gn(()=>[()=>{let{current:d}=r;return d.map(u=>({label:u.label,action:`activate-item-${u.index}`,options:{overflowItem:u}}))},({options:d})=>{if(o&&i(d)){let[,u]=fn(o,d.overflowItem);r.current=u,t==null||t(d.overflowItem)}return!0}],[o,t]),c=gn(()=>{let d=0;return new ResizeObserver(u=>{for(let m of u){let{width:h}=m.contentRect;d!==h&&(d=h,s())}})},[s]);Fn(()=>{s()},[s,e]),gn(()=>{o&&c.observe(o)},[o,c]);let p=Li(d=>{n(d)},[]);return{menuActionHandler:l,menuBuilder:a,rootRef:p}};import{jsx as Lt,jsxs as Bp}from"react/jsx-runtime";var fo="vuuOverflowContainer",Ci=kp.memo(({children:e,height:t,onSwitchWrappedItemIntoView:o,overflowIcon:n})=>{let r=qe(e),{menuActionHandler:s,menuBuilder:i,rootRef:a}=Ii({itemCount:r.length,onSwitchWrappedItemIntoView:o}),l={"--overflow-container-height":`${t}px`};return Bp("div",{className:`${fo}-wrapContainer`,ref:a,style:l,children:[r.map((c,p)=>{let{"data-overflow-priority":d="0",id:u,label:m=`Item ${p+1}`}=c.props;return Lt("div",{className:hn(`${fo}-item`),"data-index":p,"data-label":m,"data-overflow-priority":d,id:`${u}-wrapper`,children:c},p)}),Lt("div",{className:`${fo}-OverflowIndicator`,"data-index":"overflow",children:Lt(Np,{icon:n,menuBuilder:i,menuActionHandler:s})})]})});Ci.displayName="OverflowContainer.InnerContainer";var di=zp(function({children:t,className:o,height:n=44,onSwitchWrappedItemIntoView:r,overflowIcon:s,...i},a){return Lt("div",{...i,className:hn(hn(fo,o)),ref:a,children:Lt(Ci,{height:n,overflowIcon:s,onSwitchWrappedItemIntoView:r,children:t})})});import{uuid as $p}from"@vuu-ui/vuu-utils";import{List as Fp,ListItem as _p}from"@heswell/salt-lab";import Oi from"classnames";import{cloneElement as Vp,memo as Wp}from"react";import{jsx as bn}from"react/jsx-runtime";var Gp=e=>{let t=e.cloneNode(!0);return t.id="",delete t.dataset.idx,t},Ai=Wp(({className:e,children:t,idx:o,resizeable:n,header:r,closeable:s,...i})=>bn(_p,{className:Oi("vuuPaletteItem",e),"data-draggable":!0,...i}));Ai.displayName="PaletteItem";var Kp=({children:e,className:t,orientation:o="horizontal",ViewProps:n,...r})=>{let s=de(),i="vuuPalette";function a(l){var D;let p=l.target.closest(".vuuPaletteItem"),d=parseInt((D=p.dataset.idx)!=null?D:"-1");d!==-1&&console.log({children:e,idx:d,listItemElement:p});let{props:{caption:u,children:m,template:h,...g}}=e[d],{height:b,left:f,top:y,width:T}=p.getBoundingClientRect(),x=$p(),E=h?m:bn(He,{...n,...{id:x,key:x},...g,title:g.label,children:m});s({dragRect:{left:f,top:y,right:f+T,bottom:y+150,width:T,height:b},dragElement:Gp(p),evt:l.nativeEvent,instructions:{DoNotRemove:!0,DoNotTransform:!0,RemoveDraggableOnDragEnd:!0,dragThreshold:10},path:"*",payload:E,type:"drag-start"})}return bn(Fp,{...r,borderless:!0,className:Oi(i,t,`${i}-${o}`),maxHeight:800,selected:null,children:e.map((l,c)=>l.type===Ai?Vp(l,{key:c,onMouseDown:a}):l)})};Y("Palette",Kp,"view");import{uuid as Zp}from"@vuu-ui/vuu-utils";import{List as Up,ListItem as qp}from"@heswell/salt-lab";import Xp from"classnames";import{jsx as yn}from"react/jsx-runtime";var Yp="vuuPalette",cD=e=>{let{children:t,ViewProps:o,label:n,onMouseDown:r,template:s,...i}=e,a=de();return yn(qp,{onMouseDown:c=>{let{left:p,top:d,width:u}=c.currentTarget.getBoundingClientRect(),m=Zp(),g=s?t:yn(He,{...{id:m,key:m},...o,title:e.label,children:t});a({type:"drag-start",evt:c.nativeEvent,path:"*",payload:g,instructions:{DoNotRemove:!0,DoNotTransform:!0,RemoveDraggableOnDragEnd:!0,dragThreshold:10},dragRect:{left:p,top:d,right:p+u,bottom:d+150,width:u,height:100}})},...i,children:n})},jp=({className:e,...t})=>yn(Up,{...t,className:Xp(Yp,e),height:"100%",selectionStrategy:"none"});Y("PaletteSalt",jp,"view");import Jp from"classnames";import En,{forwardRef as Qp,useCallback as ed}from"react";import{jsx as ki,jsxs as sd}from"react/jsx-runtime";var Hi="Tabs",td=()=>{},od=(e,t)=>{var o,n;return(n=(o=e.props)==null?void 0:o.title)!=null?n:`Tab ${t+1}`},nd=e=>{let t=[];return En.Children.forEach(e,o=>{En.isValidElement(o)?t.push(o):console.warn("Stack has unexpected child element type")}),t},rd={allowAddTab:!1,allowCloseTab:!1,allowRenameTab:!1},xn=Qp(function({active:t=0,children:o,className:n,getTabIcon:r=td,getTabLabel:s=od,id:i,keyBoardActivation:a="manual",onAddTab:l,onMoveTab:c,onTabClose:p,onTabEdit:d,onTabSelectionChanged:u,showTabs:m=!0,style:h,TabstripProps:g=rd},b){var P;let f=Ht(i),{allowCloseTab:y,allowRenameTab:T}=g,x=ed((k,C,M,w)=>{d==null||d(w,C)},[d]),v=()=>{var k;return En.isValidElement(o)?o:Array.isArray(o)&&(k=o[t])!=null?k:null},E=()=>nd(o).map((k,C)=>{let M=`${f}-${C}`,{closeable:w=y,id:R}=k.props;return ki(hi,{ariaControls:`${M}-tab`,"data-icon":r(k,C),id:M,index:C,label:s(k,C),closeable:w,editable:T},R!=null?R:C)}),D=v();return sd("div",{className:Jp(Hi,n,{[`${Hi}-horizontal`]:(g==null?void 0:g.orientation)==="vertical"}),style:h,id:f,ref:b,children:[m?ki(pi,{...g,activeTabIndex:(P=g==null?void 0:g.activeTabIndex)!=null?P:D===null?-1:t,allowDragDrop:g.allowDragDrop!==!1,animateSelectionThumb:!0,className:"vuuTabHeader",keyBoardActivation:a,onActiveChange:u,onAddTab:l,onCloseTab:p,onExitEditMode:x,onMoveTab:c,children:E()}):null,D]})});xn.displayName="Stack";import{useIdMemo as id}from"@salt-ds/core";import ad,{useCallback as Tn,useRef as ld}from"react";import{jsx as vn}from"react/jsx-runtime";var cd=e=>vn(He,{resizeable:!0,title:`Tab ${e}`,style:{flexGrow:1,flexShrink:0,flexBasis:0},header:!0,closeable:!0,children:vn(Do,{style:{flex:1}})}),zi=e=>{let t=ld(null),o=de(),{loadState:n}=Qe(),{createNewChild:r=cd,id:s,onTabSelectionChanged:i,path:a,...l}=e,{children:c}=e,p=id(s),[d]=oo(p,t,a),u=T=>{a&&(o({type:"switch-tab",path:a,nextIdx:T}),i==null||i(T))},m=Tn(T=>{if(Array.isArray(c)){let{props:{"data-path":x,path:v=x}}=c[T];o({type:"remove",path:v})}},[c,o]),h=Tn(()=>{if(a){let T=ad.Children.count(c),x=r(T);o({type:"add",path:a,component:x})}},[c,r,o,a]),g=Tn((T,x)=>{a&&o({fromIndex:T,toIndex:x,path:a,type:"move-child"})},[o,a]);return vn(xn,{...l,id:p,getTabLabel:(T,x)=>{let{id:v,title:E}=T.props;return n(v,"view-title")||E||`Tab ${x+1}`},onMouseDown:async(T,x)=>{let v;await d({type:"mousedown",index:x,preDragActivity:async()=>new Promise(P=>{console.log("preDragActivity: Ok, gonna release the drag"),v=P})},T)&&(v==null||v(void 0))},onMoveTab:g,onAddTab:h,onTabClose:m,onTabEdit:(T,x)=>{o({type:"set-title",path:`${a}.${T}`,title:x})},onTabSelectionChanged:u,ref:t})};zi.displayName="Stack";Y("Stack",zi,"container");import Ni,{useState as Bi}from"react";import{jsx as Dn,jsxs as $i}from"react/jsx-runtime";var XD=({children:e})=>{let[o,n]=Bi(e),[r,s]=Bi(e),i=l=>{let c=Nn(o,l);s(c)},a=(l,c)=>{console.log(`change ${l} -> ${c}`);let p=Ni.cloneElement(r,{style:{...r.props.style,[l]:c}});s(p),n(Ni.cloneElement(o,{},p))};return $i("div",{"data-design-mode":`${!1}`,children:[o,Dn("br",{}),$i("div",{style:{display:"flex"},children:[Dn(Fi,{height:300,managedStyle:r.props.style,width:300,onChange:a,style:void 0}),Dn(_i,{layout:o,onSelect:i,style:{width:300,height:300,backgroundColor:"#ccc"}})]})]})};import{FormField as go,Input as ho}from"@heswell/salt-lab";import{jsx as oe,jsxs as Rn}from"react/jsx-runtime";var Sn={},ud={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"}},wn=({feature:e,children:t,style:o,onChange:n})=>Rn("div",{className:`LayoutBox layout-${e} layout-outer`,children:[Rn("div",{className:"layout-top",children:[oe("span",{className:"layout-title",children:e}),oe(go,{className:"layout-input",style:{width:30},children:oe(ho,{value:o.top,onChange:(r,s)=>n(e,"top",s)})})]}),Rn("div",{className:"layout-inner",children:[oe("div",{className:"layout-left",children:oe(go,{className:"layout-input",style:{width:30},children:oe(ho,{value:o.left,onChange:(r,s)=>n(e,"left",s)})})}),t,oe("div",{className:"layout-right",children:oe(go,{className:"layout-input",style:{width:30},children:oe(ho,{value:o.right,onChange:(r,s)=>n(e,"right",s)})})})]}),oe("div",{className:"layout-bottom",children:oe(go,{className:"layout-input",style:{width:30},children:oe(ho,{value:o.bottom,onChange:(r,s)=>n(e,"bottom",s)})})})]}),rw={margin:!0,marginTop:!0,marginRight:!0,marginBottom:!0,marginLeft:!0},sw={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},bo="(\\d+)(?:px)?",pd=`^(?:${bo}(?:\\s${bo}(?:\\s${bo}(?:\\s${bo})?)?)?)$`,Vi=new RegExp(pd),dd=/^(?:(\d+)(?:px)\ssolid\s([a-zA-Z,0-9().]+))$/,Fi=({height:e,managedStyle:t,onChange:o,style:n,width:r})=>{let s=Wi(t),i=(T,x,v)=>{let E=parseInt(v||"0",10),D=ud[T][x];o(D,E)},{marginTop:a=0,marginRight:l=0,marginBottom:c=0,marginLeft:p=0}=s,{borderTopWidth:d=0,borderRightWidth:u=0,borderBottomWidth:m=0,borderLeftWidth:h=0}=s,{paddingTop:g=0,paddingRight:b=0,paddingBottom:f=0,paddingLeft:y=0}=s;return oe("div",{className:"LayoutConfigurator",style:{width:r,height:e,...n},children:oe(wn,{feature:"margin",style:{top:a,right:l,bottom:c,left:p},onChange:i,children:oe(wn,{feature:"border",style:{top:d,right:u,bottom:m,left:h},onChange:i,children:oe(wn,{feature:"padding",style:{top:g,right:b,bottom:f,left:y},onChange:i,children:oe("div",{className:"layout-content"})})})})})};function aw(e=Sn,t=Sn){let{margin:o,marginTop:n,marginRight:r,marginBottom:s,marginLeft:i,padding:a,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=Vi.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 n=="number"&&(u.marginTop=n),typeof r=="number"&&(u.marginRight=r),typeof s=="number"&&(u.marginBottom=s),typeof i=="number"&&(u.marginLeft=i),typeof a=="number")u.paddingTop=u.paddingRight=u.paddingBottom=u.paddingLeft=a;else if(typeof a=="string"){let m=Vi.exec(a);if(m===null)console.error(`Invalid css value for padding '${a}'`);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=Sn){let t={...e},o,{border:n,borderWidth:r,borderTopWidth:s,borderRightWidth:i,borderBottomWidth:a,borderLeftWidth:l,borderColor:c,margin:p,marginTop:d,marginRight:u,marginBottom:m,marginLeft:h,padding:g,paddingTop:b,paddingRight:f,paddingBottom:y,paddingLeft:T,...x}=t,v={},E={};if(typeof p=="number"&&(t.marginTop=t.marginRight=t.marginBottom=t.marginLeft=p,v={marginTop:p,marginRight:p,marginBottom:p,marginLeft:p}),typeof g=="number"&&(t.paddingTop=t.paddingRight=t.paddingBottom=t.paddingLeft=g,E={paddingTop:g,paddingRight:g,paddingBottom:g,paddingLeft:g}),n||r||s||i||a||l){typeof n=="string"&&(o=dd.exec(n))&&([,r,c]=o,r=parseInt(r,10)),r&&(s=s===void 0?r:s,i=i===void 0?r:i,a=a===void 0?r:a,l=l===void 0?r:l),c=c||"black";let D=`
18
+ ${c} ${l||0}px ${s||0}px 0 0 inset,
19
+ ${c} ${-i||0}px ${-a||0}px 0 0 inset`;return{...x,...v,...E,borderTopWidth:s,borderRightWidth:i,borderBottomWidth:a,borderLeftWidth:l,borderColor:c,borderStyle:"solid",boxShadow:D}}else return t}import md from"react";import fd from"classnames";import{Tree as gd}from"@heswell/salt-lab";import{jsx as Gi}from"react/jsx-runtime";var hd="hwLayoutTreeViewer",Ki=(e,t="0")=>({label:$(e),path:t,childNodes:md.Children.map(e.props.children,(o,n)=>Ki(o,t?`${t}.${n}`:`${n}`))}),_i=({layout:e,onSelect:t,style:o})=>{let n=[Ki(e)],r=(s,[{path:i}])=>{t(i)};return Gi("div",{className:fd(hd),style:o,children:Gi(gd,{source:n,groupSelection:"single",onSelectionChange:r})})};export{je as Action,iw as BORDER_STYLES,Do as Component,Pe as ComponentRegistry,XD as ConfigWrapper,na as DockLayout,ko as Draggable,ar as DraggableLayout,xo as Drawer,Yn as DropMenu,Ie as DropTarget,_o as Flexbox,ns as FlexboxLayout,tn as FluidGrid,fs as FluidGridLayout,ws as Header,Db as HeightOnly,Fi as LayoutConfigurator,ab as LayoutProvider,vt as LayoutProviderContext,ib as LayoutProviderVersion,_i as LayoutTreeViewer,rw as MARGIN_STYLES,mn as NO_WRAPPED_ITEMS,di as OverflowContainer,sw as PADDING_STYLES,Kp as Palette,Ai as PaletteItem,cD as PaletteListItem,jp as PaletteSalt,Wt as Placeholder,xn as Stack,zi as StackLayout,He as View,no as ViewContext,vb as WidthHeight,wb as WidthOnly,aw as XXXnormalizeStyles,xi as applyOverflowClassToWrappedItems,qe as asReactElements,Xn as computeMenuPosition,ua as containerOf,wi as correctForWrappedHighPriorityItems,Di as correctForWrappedOverflowIndicator,wo as expandFlex,Ab as extractResponsiveProps,we as findTarget,ee as followPath,Nn as followPathToComponent,De as followPathToParent,pa as getChild,kn as getChildProp,Sp as getElementsMarkedAsWrapped,Mt as getNonWrappedAndWrappedItems,wr as getPersistentState,B as getProp,A as getProps,Rr as hasPersistentState,vi as highPriorityItemsHaveWrappedButShouldNotHave,Lo as identifyDropTarget,re as isContainer,Ln as isLayoutComponent,bd as isRegistered,Tc as isResponsiveAttribute,Cm as isTabstrip,jd as isTypeOf,Xi as isView,Rp as markElementAsWrapped,rm as nextLeaf,he as nextStep,Ti as overflowIndicatorHasWrappedButShouldNotHave,sm as previousLeaf,Y as registerComponent,Mi as removeOverflowIndicatorIfNoLongerNeeded,te as resetPath,ss as resizeObserver,Sr as setPersistentState,am as setRef,Tp as sortByScreenOrder,fn as switchWrappedItemIntoView,$ as typeOf,Mp as unmarkItemsWhichAreNoLongerWrapped,us as useBreakpoints,Ht as useId,Fn as useLayoutEffectSkipFirst,de as useLayoutProviderDispatch,cc as useLayoutProviderVersion,Qe as usePersistentState,as as useResizeObserver,oo as useViewActionDispatcher,Oy as useViewContext,Ts as useViewDispatch};
20
20
  //# sourceMappingURL=index.js.map