@vuu-ui/vuu-layout 0.8.5 → 0.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Ua=Object.create;var fo=Object.defineProperty;var qa=Object.getOwnPropertyDescriptor;var Xa=Object.getOwnPropertyNames;var Ya=Object.getPrototypeOf,ja=Object.prototype.hasOwnProperty;var Ja=(e,t)=>{for(var o in t)fo(e,o,{get:t[o],enumerable:!0})},Cr=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Xa(t))!ja.call(e,r)&&r!==o&&fo(e,r,{get:()=>t[r],enumerable:!(n=qa(t,r))||n.enumerable});return e};var F=(e,t,o)=>(o=e!=null?Ua(Ya(e)):{},Cr(t||!e||!e.__esModule?fo(o,"default",{value:e,enumerable:!0}):o,e)),Qa=e=>Cr(fo({},"__esModule",{value:!0}),e);var tp={};Ja(tp,{Action:()=>mt,BORDER_STYLES:()=>Yu,Component:()=>bo,ComponentRegistry:()=>Fe,ConfigWrapper:()=>Zu,DockLayout:()=>$r,Draggable:()=>Co,DraggableLayout:()=>An,Drawer:()=>go,DropMenu:()=>Ln,DropTarget:()=>_e,Flexbox:()=>Ho,FlexboxLayout:()=>Qn,FluidGrid:()=>Vo,FluidGridLayout:()=>sr,Header:()=>ar,HeightOnly:()=>$c,LayoutConfigurator:()=>Sr,LayoutProvider:()=>Nc,LayoutProviderContext:()=>Lt,LayoutProviderVersion:()=>zc,LayoutTreeViewer:()=>Pr,MARGIN_STYLES:()=>qu,NO_WRAPPED_ITEMS:()=>Jo,OverflowContainer:()=>hr,PADDING_STYLES:()=>Xu,Palette:()=>Ca,PaletteItem:()=>wr,PaletteListItem:()=>Fu,PaletteSalt:()=>Ha,Placeholder:()=>Xt,Stack:()=>cn,StackLayout:()=>Rr,View:()=>Ge,ViewContext:()=>so,WidthHeight:()=>Bc,WidthOnly:()=>Fc,XXXnormalizeStyles:()=>Qu,applyOverflowClassToWrappedItems:()=>br,asReactElements:()=>ut,computeMenuPosition:()=>Mn,containerOf:()=>Vr,correctForWrappedHighPriorityItems:()=>Tr,correctForWrappedOverflowIndicator:()=>xr,expandFlex:()=>xo,extractResponsiveProps:()=>Xc,findTarget:()=>ze,followPath:()=>re,followPathToComponent:()=>xn,followPathToParent:()=>ke,getChild:()=>Wr,getChildProp:()=>En,getElementsMarkedAsWrapped:()=>Da,getNonWrappedAndWrappedItems:()=>Nt,getPersistentState:()=>Vn,getProp:()=>B,getProps:()=>A,hasPersistentState:()=>Wn,highPriorityItemsHaveWrappedButShouldNotHave:()=>Er,identifyDropTarget:()=>Do,isContainer:()=>ce,isLayoutComponent:()=>fn,isRegistered:()=>el,isResponsiveAttribute:()=>mi,isTabstrip:()=>xl,isTypeOf:()=>sl,isView:()=>Hr,markElementAsWrapped:()=>va,nextLeaf:()=>al,nextStep:()=>De,overflowIndicatorHasWrappedButShouldNotHave:()=>yr,previousLeaf:()=>ll,registerComponent:()=>Q,removeOverflowIndicatorIfNoLongerNeeded:()=>vr,resetPath:()=>ie,resizeObserver:()=>er,setPersistentState:()=>Gn,setRef:()=>cl,sortByScreenOrder:()=>xa,switchWrappedItemIntoView:()=>Qo,typeOf:()=>$,unmarkItemsWhichAreNoLongerWrapped:()=>wa,useBreakpoints:()=>rr,useId:()=>Wt,useLayoutEffectSkipFirst:()=>Tn,useLayoutProviderDispatch:()=>xe,useLayoutProviderVersion:()=>ai,usePersistentState:()=>gt,useResizeObserver:()=>tr,useViewActionDispatcher:()=>no,useViewContext:()=>eu,useViewDispatch:()=>ir});module.exports=Qa(tp);var hn=require("@vuu-ui/vuu-utils"),Br=F(require("classnames"));var Or={},Ar={},Fe={};function ce(e){return Or[e]===!0}function Hr(e){return Ar[e]===!0}var fn=e=>ce(e)||Hr(e),el=e=>!!Fe[e];function Q(e,t,o="component"){Fe[e]=t,o==="container"?Or[e]=!0:o==="view"&&(Ar[e]=!0)}var Vt=require("@salt-ds/core"),gn=F(require("classnames")),zr=require("react");var Ye=require("react/jsx-runtime"),Xe="vuuDrawer",kr=e=>typeof e=="string"?e:e+"px",tl=(e,t,o)=>{let n=t!==void 0,r=o!==void 0;if(!(!e&&!r&&!n))return!r&&!n?e:{...e,"--drawer-size":n?kr(t):void 0,"--drawer-peek-size":r?kr(o):void 0}},Nr=({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]=(0,Vt.useControlled)({controlled:a,default:n!=null?n:!1,name:"Drawer",state:"open"}),b=(0,gn.default)(Xe,t,`${Xe}-${l}`,{[`${Xe}-open`]:h,[`${Xe}-inline`]:c,[`${Xe}-over`]:!c,[`${Xe}-peekaboo`]:d}),f=(0,zr.useCallback)(()=>{g(!h)},[h,g]),y=tl(i,r,s),T=o?f:p,x=()=>(0,Ye.jsx)("div",{className:(0,gn.default)("vuuToggleButton-container"),children:h?(0,Ye.jsx)(Vt.Button,{"aria-label":"close",onClick:f,"data-icon":"close",variant:"secondary"}):(0,Ye.jsx)(Vt.Button,{"aria-label":"open",onClick:f,"data-icon":"close",variant:"secondary"})});return(0,Ye.jsxs)("div",{...m,className:b,onClick:T,style:y,children:[u=="start"?x():null,(0,Ye.jsx)("div",{className:`${Xe}-liner`,children:(0,Ye.jsx)("div",{className:`${Xe}-content`,children:e})}),u=="end"?x():null]})};Nr.displayName="Drawer";var go=Nr;var ho=require("react/jsx-runtime"),ol=e=>e.type===go,nl=({props:{position:e="left"}})=>e.match(/top|bottom/),bn=e=>{let{children:t,className:o,id:n,style:r}=e,s="vuuDockLayout",[i,a]=(0,hn.partition)(t,ol),[l,c]=(0,hn.partition)(i,nl),p=l.length===0?"horizontal":c.length===0?"vertical":"both",d=(0,Br.default)(s,o,`${s}-${p}`);return(0,ho.jsxs)("div",{className:d,id:n,style:r,children:[i,(0,ho.jsx)("div",{className:`${s}-content`,children:a})]})};bn.displayName="DockLayout";var $r=bn;Q("DockLayout",bn,"container");var Fr=require("react");var _r=require("react/jsx-runtime"),yn=(0,Fr.forwardRef)(function({resizeable:t,...o},n){return(0,_r.jsx)("div",{...o,className:"Component",ref:n})});yn.displayName="Component";var bo=yn;Q("Component",yn);var ve=F(require("react"));var rl={},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||rl,En=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 sl=(e,t)=>$(e)===t;var il=e=>{let t=e.lastIndexOf(".");return t===-1?e:e.slice(0,t)};function ke(e,t){let{"data-path":o,path:n=o}=A(e);return t==="0"||t===n?null:re(e,il(t),!0)}function ze(e,t){let{children:o,...n}=A(e);if(t(n))return e;if(ve.default.Children.count(o)>0){let r=ve.default.isValidElement(o)?[o]:o;for(let s of r){let i=ze(s,t);if(i)return i}}}function Vr(e,t){if(t===e)return null;let{path:o,children:n}=A(e),{idx:r,finalStep:s}=De(o,B(t,"path"));return s?e:n===void 0||n[r]===void 0?null:Vr(n[r],t)}var Wr=(e,t)=>{if(ve.default.isValidElement(e)&&t==0)return e;if(Array.isArray(e))return e[t]};function xn(e,t){let o=t.split("."),n=[e],r=s=>ve.default.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 Gr=(e,t,o=!0)=>{let{children:n,id:r}=e.props;if(r===t)return e;if(ve.default.Children.count(n)>0){let s=(0,ve.isValidElement)(n)?[n]:n;for(let i of s)if((0,ve.isValidElement)(i)){let a=Gr(i,t,!1);if(a)return a}}if(o===!0)throw Error(`pathUtils.findTargetById id #${t} not found in source`)};function re(e,t,o=!1){if(t.startsWith("#"))return Gr(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(ve.default.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=Wr(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 al(e,t){let o=ke(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 yo(s[r+1]);{let i=n.pop(),a=ke(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 ce($(l))?yo(l):l}}}return yo(e)}function ll(e,t){let o=t.split(".").map(s=>parseInt(s,10)),n=o.pop(),r=ke(e,t);if(r!=null&&typeof n=="number"){let{children:s}=r.props;if(n>0)return Eo(s[n-1]);for(;o.length>1;)if(n=o.pop(),r=ke(e,B(r,"path")),n>0){let i=r.props.children[n-1];return ce($(i))?Eo(i):i}}return Eo(e)}function yo(e){if(ce($(e))){let{children:t}=e.props||e;return yo(t[0])}return e}function Eo(e){if(ce($(e))){let{children:t}=e.props||e;return Eo(t[t.length-1])}return e}function De(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 ie(e,t,o){if(B(e,"path")===t)return e;let n=[];ve.default.Children.forEach(e.props.children,(s,i)=>{B(s,"path")?n.push(ie(s,`${t}.${i}`)):n.push(s)});let r=e.props["data-path"]?"data-path":"path";return ve.default.cloneElement(e,{[r]:t,...o},n)}function cl(e,t){typeof e=="function"?e(t):e&&(e.current=t)}var Le=require("react"),ul=[],pl=0,ut=e=>{let t=Array.isArray(e),o=t?e.length:Le.Children.count(e);return t&&e.every(Le.isValidElement)?e:o===1&&!t&&(0,Le.isValidElement)(e)?[e]:o>1?e:ul},Tn=(e,t)=>{let o=(0,Le.useRef)(!1);(0,Le.useLayoutEffect)(()=>{o.current?e():o.current=!0},t)},Wt=e=>(0,Le.useMemo)(()=>e!=null?e:`vuu-${++pl}`,[e]);var xo=e=>{if(typeof e!="number")throw Error(`"no support yet for flex value ${e}`);return{flexBasis:0,flexGrow:1,flexShrink:1}};var dt={north:1,east:2,south:4,west:8,header:16,centre:32,absolute:64},Gt={AFTER:"after",BEFORE:"before"},de=Object.freeze({North:pt("north"),East:pt("east"),South:pt("south"),West:pt("west"),Header:pt("header"),Centre:pt("centre"),Absolute:pt("absolute")});function pt(e){return Object.freeze({offset:e==="north"||e==="west"?0:e==="south"||e==="east"?1:NaN,valueOf:function(){return dt[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 Kr=de.North,Zr=de.South,vn=de.East,Dn=de.West,dl=de.Header,ml=de.Centre,St=class{static measure(t,o=[]){let n={};return hl(t,n,o),n}static allBoxesContainingPoint(t,o,n,r,s){return Yr(t,o,n,r,s).reverse()}};function wn(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 Rn(e,t,o,n){let{BEFORE:r,AFTER:s}=Gt,{pctX:i,pctY:a,closeToTheEdge:l}=wn(e,t,o),c,p;if(n==="row")c=i<.5?Dn:vn;else if(o.header&&To(o.header,e,t))if(c=dl,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=fl(e,t,o,i,a);return{position:c,x:e,y:t,closeToTheEdge:l,tab:p}}function fl(e,t,o,n,r){let s=gl(o,.2);if(To(s,e,t))return ml;switch(`${r<.5?"north":"south"}${n<.5?"west":"east"}`){case"northwest":return n>r?Kr:Dn;case"northeast":return 1-n>r?Kr:vn;case"southeast":return n>r?vn:Zr;case"southwest":return 1-n>r?Dn:Zr;default:}}function gl({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 hl(e,t,o){let{id:n,"data-path":r,path:s=r}=A(e),i=$(e);if(n&&s){let[a,l]=Xr(e);Ur(e,a,l,t),ce(i)&&qr(e,t,o)}}function Ur(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 qr(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(bl)).map(x=>{let[v,E]=Xr(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=Ur(E,x,v,t),L=$(E);return ce(L)&&qr(E,t,o,k,C,M,w),S});y.length&&(t[c].children=T)}function bl(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 Xr(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(ce(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 Yr(e,t,o,n,r,s=[]){let{children:i,"data-path":a,path:l=a}=A(e),c=$(e),p=t[l];if(!To(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(!ce(c)||p.header&&To(p.header,o,n))return s;p.scrolling&&yl(p,o,n);for(let d=0;d<i.length;d++){if(c==="Stack"&&e.props.active!==d)continue;let u=Yr(i[d],t,o,n,r);if(u.length)return s.concat(u)}return s}function To(e,t,o){if(e)return t>=e.left&&t<e.right&&o>=e.top&&o<e.bottom}function yl({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 El=.4,vo=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}=wn(o,n,r),p=El,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 xl=e=>e.pos.tab&&$(e.component)==="Stack"&&e.pos.position.Header,{north:Tl,south:vl,east:Dl,west:wl}=dt,Rl=Dl+wl,Sl=Tl+vl,_e=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===Gt.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 de.North:case de.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 de.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 de.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 de.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 de.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:_e.getActiveDropTarget(t.nextDropTarget)}};function Do(e,t,o,n,r,s){var l;let i=null,a=St.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=Rn(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=Pl(T,b,f,n,e,t);if(D){let[P,k]=D;return new _e({component:T,pos:P,clientRect:k,nextDropTarget:(E=y(x))!=null?E:null})}else if(x.length)return y(x)}};i=new _e({component:c,pos:b,clientRect:h,nextDropTarget:(l=y(p))!=null?l:null}).activate()}return i}function Pl(e,{closeToTheEdge:t,position:o},n,r,s,i){if(!e||e.type==="DraggableLayout")return;let a=r[e.props.path],l=t&dt.north,c=t&dt.east,p=t&dt.south,d=t&dt.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=Rn(s,i,y);if((Ml(e)||jr(e))&&t&Rl)return T.width=120,[T,y];if((Ll(e)||jr(e))&&(o.Header||t&Sl))return T.height=120,[T,y]}}function jr(e){return $(e)==="Stack"}function Ml(e){return $(e)==="Flexbox"&&e.props.style.flexDirection==="column"}function Ll(e){return $(e)==="Flexbox"&&e.props.style.flexDirection==="row"}var wo=require("@vuu-ui/vuu-popups");var Jr=F(require("classnames"));var Pn=require("react/jsx-runtime");function Mn(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 Sn="vuuDropMenu",Ln=({className:e,dropTarget:t,onHover:o,orientation:n})=>{let r=t.toArray();return(0,Pn.jsx)("div",{className:(0,Jr.default)(Sn,e,`${Sn}-${n}`),onMouseLeave:()=>o(null),children:r.map((s,i)=>(0,Pn.jsx)("div",{className:`${Sn}-item`,"data-icon":i===0?"column-2A":"column-2B",onMouseEnter:()=>o(s)},i))})};var os=require("react/jsx-runtime"),In=!1,Kt=null,Ie=null,Il=e=>Kt=e,Cl=([e,t])=>`M${e},${t}`,Ol=([e,t])=>`L${e},${t}`,Qr=([e,...t])=>`${Cl(e)} ${t.map(Ol)}Z`,Al=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 Hl(){if(document.getElementById("hw-drag-canvas")===null){let e=document.getElementById("root"),t=document.createElement("div");t.id="hw-drag-canvas",t.innerHTML=`
1
+ "use strict";var Kl=Object.create;var No=Object.defineProperty;var Gl=Object.getOwnPropertyDescriptor;var Zl=Object.getOwnPropertyNames;var Ul=Object.getPrototypeOf,Xl=Object.prototype.hasOwnProperty;var ql=(e,t)=>{for(var o in t)No(e,o,{get:t[o],enumerable:!0})},ls=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Zl(t))!Xl.call(e,n)&&n!==o&&No(e,n,{get:()=>t[n],enumerable:!(r=Gl(t,n))||r.enumerable});return e};var W=(e,t,o)=>(o=e!=null?Kl(Ul(e)):{},ls(t||!e||!e.__esModule?No(o,"default",{value:e,enumerable:!0}):o,e)),Yl=e=>ls(No({},"__esModule",{value:!0}),e);var bp={};ql(bp,{Action:()=>ht,BORDER_STYLES:()=>pp,Component:()=>Oo,ComponentRegistry:()=>Ve,ConfigWrapper:()=>lp,DockLayout:()=>hs,Draggable:()=>qo,DraggableLayout:()=>nn,Drawer:()=>Ho,DropMenu:()=>en,DropTarget:()=>Ke,Flexbox:()=>tr,FlexboxLayout:()=>Rn,FluidGrid:()=>ur,FluidGridLayout:()=>Nn,Header:()=>Un,HeightOnly:()=>Ou,LayoutActionType:()=>ce,LayoutConfigurator:()=>rs,LayoutProvider:()=>Au,LayoutProviderContext:()=>Bt,LayoutProviderVersion:()=>Hu,LayoutTreeViewer:()=>ns,MARGIN_STYLES:()=>up,NO_WRAPPED_ITEMS:()=>Mr,OverflowContainer:()=>Fn,PADDING_STYLES:()=>dp,Palette:()=>Nl,PaletteItem:()=>ts,Placeholder:()=>uo,Stack:()=>Ar,StackLayout:()=>os,View:()=>Mt,ViewContext:()=>Ro,WidthHeight:()=>Pn,WidthOnly:()=>ku,XXXnormalizeStyles:()=>gp,applyLayout:()=>Qc,applyLayoutProps:()=>kt,applyOverflowClassToWrappedItems:()=>Xn,asReactElements:()=>mt,componentToJson:()=>En,computeMenuPosition:()=>Qr,containerOf:()=>xs,correctForWrappedHighPriorityItems:()=>Jn,correctForWrappedOverflowIndicator:()=>jn,createFlexbox:()=>Qo,createPlaceHolder:()=>Ne,expandFlex:()=>Bo,extractResponsiveProps:()=>Gu,findTarget:()=>Fe,followPath:()=>se,followPathToComponent:()=>Gr,followPathToParent:()=>$e,getChild:()=>Es,getChildProp:()=>Kr,getElementsMarkedAsWrapped:()=>Dl,getFlexDimensions:()=>un,getFlexOrIntrinsicStyle:()=>Jo,getFlexStyle:()=>jo,getIntrinsicSize:()=>Te,getManagedDimension:()=>yn,getNonWrappedAndWrappedItems:()=>jt,getPersistentState:()=>mn,getProp:()=>F,getProps:()=>A,hasPersistentState:()=>fn,hasUnboundedFlexStyle:()=>dn,highPriorityItemsHaveWrappedButShouldNotHave:()=>Yn,identifyDropTarget:()=>_o,isContainer:()=>ue,isLayoutComponent:()=>$r,isRegistered:()=>jl,isResponsiveAttribute:()=>$i,isTabstrip:()=>bc,isTypeOf:()=>oc,isView:()=>ds,layoutFromJson:()=>fo,layoutReducer:()=>Dn,layoutToJSON:()=>xn,markElementAsWrapped:()=>wl,nextLeaf:()=>nc,nextStep:()=>Se,overflowIndicatorHasWrappedButShouldNotHave:()=>qn,previousLeaf:()=>sc,processLayoutElement:()=>or,registerComponent:()=>ne,removeOverflowIndicatorIfNoLongerNeeded:()=>Qn,resetPath:()=>ie,resizeObserver:()=>Mn,serializeProps:()=>li,setPersistentState:()=>gn,setRef:()=>ic,sortByScreenOrder:()=>Tl,switchWrappedItemIntoView:()=>Pr,typeOf:()=>_,unmarkItemsWhichAreNoLongerWrapped:()=>Sl,useBreakpoints:()=>Cn,useId:()=>no,useLayoutEffectSkipFirst:()=>Zr,useLayoutProviderDispatch:()=>He,useLayoutProviderVersion:()=>Hi,usePersistentState:()=>yt,useResizeObserver:()=>yo,useViewActionDispatcher:()=>Do,useViewContext:()=>Gd,useViewDispatch:()=>Zn,wrapIntrinsicSizeComponentWithFlexbox:()=>Ot});module.exports=Yl(bp);var _r=require("@vuu-ui/vuu-utils"),gs=W(require("classnames"));var cs={},us={},Ve={};function ue(e){return cs[e]===!0}function ds(e){return us[e]===!0}var $r=e=>ue(e)||ds(e),jl=e=>!!Ve[e];function ne(e,t,o="component"){Ve[e]=t,o==="container"?cs[e]=!0:o==="view"&&(us[e]=!0)}var ro=require("@salt-ds/core"),Fr=W(require("classnames")),ms=require("react");var je=require("react/jsx-runtime"),Ye="vuuDrawer",ps=e=>typeof e=="string"?e:e+"px",Jl=(e,t,o)=>{let r=t!==void 0,n=o!==void 0;if(!(!e&&!n&&!r))return!n&&!r?e:{...e,"--drawer-size":r?ps(t):void 0,"--drawer-peek-size":n?ps(o):void 0}},fs=({children:e,className:t,clickToOpen:o,defaultOpen:r,sizeOpen:n,sizeClosed:s,style:i,open:a,position:l="left",inline:c,onClick:d,peekaboo:p=!1,toggleButton:u,...m})=>{let[f,g]=(0,ro.useControlled)({controlled:a,default:r!=null?r:!1,name:"Drawer",state:"open"}),h=(0,Fr.default)(Ye,t,`${Ye}-${l}`,{[`${Ye}-open`]:f,[`${Ye}-inline`]:c,[`${Ye}-over`]:!c,[`${Ye}-peekaboo`]:p}),b=(0,ms.useCallback)(()=>{g(!f)},[f,g]),T=Jl(i,n,s),E=o?b:d,y=()=>(0,je.jsx)("div",{className:(0,Fr.default)("vuuToggleButton-container"),children:f?(0,je.jsx)(ro.Button,{"aria-label":"close",onClick:b,"data-icon":"close",variant:"secondary"}):(0,je.jsx)(ro.Button,{"aria-label":"open",onClick:b,"data-icon":"close",variant:"secondary"})});return(0,je.jsxs)("div",{...m,className:h,onClick:E,style:T,children:[u=="start"?y():null,(0,je.jsx)("div",{className:`${Ye}-liner`,children:(0,je.jsx)("div",{className:`${Ye}-content`,children:e})}),u=="end"?y():null]})};fs.displayName="Drawer";var Ho=fs;var Ao=require("react/jsx-runtime"),Ql=e=>e.type===Ho,ec=({props:{position:e="left"}})=>e.match(/top|bottom/),Wr=e=>{let{children:t,className:o,id:r,style:n}=e,s="vuuDockLayout",[i,a]=(0,_r.partition)(t,Ql),[l,c]=(0,_r.partition)(i,ec),d=l.length===0?"horizontal":c.length===0?"vertical":"both",p=(0,gs.default)(s,o,`${s}-${d}`);return(0,Ao.jsxs)("div",{className:p,id:r,style:n,children:[i,(0,Ao.jsx)("div",{className:`${s}-content`,children:a})]})};Wr.displayName="DockLayout";var hs=Wr;ne("DockLayout",Wr,"container");var bs=require("react");var ys=require("react/jsx-runtime"),Vr=(0,bs.forwardRef)(function({resizeable:t,...o},r){return(0,ys.jsx)("div",{...o,className:"Component",ref:r})});Vr.displayName="Component";var Oo=Vr;ne("Component",Vr);var De=W(require("react"));var tc={},F=(e,t)=>{var r;let o=A(e);return(r=o[t])!=null?r:o[`data-${t}`]},A=e=>(e==null?void 0:e.props)||e||tc,Kr=e=>{let t=A(e);if(t.children){let{children:[o,...r]}=t;return r.length>0&&console.warn(`getChild expected a single child, found ${r.length+1}`),o}};function _(e){var t;if(e){let o=e.type;if(typeof o=="function"||typeof o=="object"){let r=o.displayName||o.name||((t=o.type)==null?void 0:t.name);if(typeof r=="string")return r}if(typeof e.type=="string")return e.type;if(e.constructor)return e.constructor.displayName;throw Error("typeOf unable to determine type of element")}}var oc=(e,t)=>_(e)===t;var rc=e=>{let t=e.lastIndexOf(".");return t===-1?e:e.slice(0,t)};function $e(e,t){let{"data-path":o,path:r=o}=A(e);return t==="0"||t===r?null:se(e,rc(t),!0)}function Fe(e,t){let{children:o,...r}=A(e);if(t(r))return e;if(De.default.Children.count(o)>0){let n=De.default.isValidElement(o)?[o]:o;for(let s of n){let i=Fe(s,t);if(i)return i}}}function xs(e,t){if(t===e)return null;let{path:o,children:r}=A(e),{idx:n,finalStep:s}=Se(o,F(t,"path"));return s?e:r===void 0||r[n]===void 0?null:xs(r[n],t)}var Es=(e,t)=>{if(De.default.isValidElement(e)&&t==0)return e;if(Array.isArray(e))return e[t]};function Gr(e,t){let o=t.split("."),r=[e],n=s=>De.default.isValidElement(s.props.children)?[s.props.children]:s.props.children;for(let s=0;s<o.length;s++){let i=parseInt(o[s]),a=r[i];if(s===o.length-1)return a;r=n(a)}}var Ts=(e,t,o=!0)=>{let{children:r,id:n}=e.props;if(n===t)return e;if(De.default.Children.count(r)>0){let s=(0,De.isValidElement)(r)?[r]:r;for(let i of s)if((0,De.isValidElement)(i)){let a=Ts(i,t,!1);if(a)return a}}if(o===!0)throw Error(`pathUtils.findTargetById id #${t} not found in source`)};function se(e,t,o=!1){if(t.startsWith("#"))return Ts(e,t.slice(1),o);let{"data-path":r,path:n=r}=A(e);if(t.indexOf(n)!==0)throw Error(`pathUtils.followPath path ${t} is not within source path ${n}`);let s=t.slice(n.length+1);if(s==="")return e;let i=e,a=s.split(".");for(let l=0;l<a.length;l++){if(De.default.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=Es(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 nc(e,t){let o=$e(e,t),r=t.split(".").map(n=>parseInt(n,10));if(o){let n=r.pop(),{children:s}=o.props;if(s.length-1>n)return ko(s[n+1]);{let i=r.pop(),a=$e(e,F(o,"path"));if(a&&typeof i=="number"&&(r=a.props.path.split(".").map(l=>parseInt(l,10)),a.props.children.length-1>i)){let l=a.props.children[i+1];return ue(_(l))?ko(l):l}}}return ko(e)}function sc(e,t){let o=t.split(".").map(s=>parseInt(s,10)),r=o.pop(),n=$e(e,t);if(n!=null&&typeof r=="number"){let{children:s}=n.props;if(r>0)return zo(s[r-1]);for(;o.length>1;)if(r=o.pop(),n=$e(e,F(n,"path")),r>0){let i=n.props.children[r-1];return ue(_(i))?zo(i):i}}return zo(e)}function ko(e){if(ue(_(e))){let{children:t}=e.props||e;return ko(t[0])}return e}function zo(e){if(ue(_(e))){let{children:t}=e.props||e;return zo(t[t.length-1])}return e}function Se(e,t,o=!1){if(e===t)return{idx:-1,finalStep:!0};let r=`${e}.`;if(!t.startsWith(r))throw Error("pathUtils nextStep has strayed from the path");let n=o?0:1,s=t.replace(r,"").split(".").map(i=>parseInt(i,10));return{idx:s[0],finalStep:s.length===n}}function ie(e,t,o){if(F(e,"path")===t)return e;let r=[];De.default.Children.forEach(e.props.children,(s,i)=>{F(s,"path")?r.push(ie(s,`${t}.${i}`)):r.push(s)});let n=e.props["data-path"]?"data-path":"path";return De.default.cloneElement(e,{[n]:t,...o},r)}function ic(e,t){typeof e=="function"?e(t):e&&(e.current=t)}var Ie=require("react"),ac=[],lc=0,mt=e=>{let t=Array.isArray(e),o=t?e.length:Ie.Children.count(e);return t&&e.every(Ie.isValidElement)?e:o===1&&!t&&(0,Ie.isValidElement)(e)?[e]:o>1?e:ac},Zr=(e,t)=>{let o=(0,Ie.useRef)(!1);(0,Ie.useLayoutEffect)(()=>{o.current?e():o.current=!0},t)},no=e=>(0,Ie.useMemo)(()=>e!=null?e:`vuu-${++lc}`,[e]);var Bo=e=>{if(typeof e!="number")throw Error(`"no support yet for flex value ${e}`);return{flexBasis:0,flexGrow:1,flexShrink:1}};var gt={north:1,east:2,south:4,west:8,header:16,centre:32,absolute:64},so={AFTER:"after",BEFORE:"before"},pe=Object.freeze({North:ft("north"),East:ft("east"),South:ft("south"),West:ft("west"),Header:ft("header"),Centre:ft("centre"),Absolute:ft("absolute")});function ft(e){return Object.freeze({offset:e==="north"||e==="west"?0:e==="south"||e==="east"?1:NaN,valueOf:function(){return gt[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 vs=pe.North,ws=pe.South,Ur=pe.East,Xr=pe.West,cc=pe.Header,uc=pe.Centre,Ht=class{static measure(t,o=[]){let r={};return mc(t,r,o),r}static allBoxesContainingPoint(t,o,r,n,s){return Ms(t,o,r,n,s).reverse()}};function qr(e,t,o,r=30){let n=o.right-o.left,s=o.bottom-o.top,i=e-o.left,a=t-o.top,l=0;return i<r&&(l+=8),i>n-r&&(l+=2),a<r&&(l+=1),a>s-r&&(l+=4),{pctX:i/n,pctY:a/s,closeToTheEdge:l}}function Yr(e,t,o,r){let{BEFORE:n,AFTER:s}=so,{pctX:i,pctY:a,closeToTheEdge:l}=qr(e,t,o),c,d;if(r==="row")c=i<.5?Xr:Ur;else if(o.header&&$o(o.header,e,t))if(c=cc,o.Stack){let p=o.Stack.length;if(p===0)d={index:-1,left:o.left,positionRelativeToTab:s,width:0};else{let u=o.Stack.find(({left:m,right:f})=>e>=m&&e<=f);if(u){let m=u.right-u.left;d={index:o.Stack.indexOf(u),left:u.left,positionRelativeToTab:(e-u.left)/m<.5?n:s,width:m}}else d={left:o.Stack[p-1].right,width:0,index:p,positionRelativeToTab:s}}}else if(o.header.titleWidth){let p=o.header.titleWidth;d={index:-1,left:o.left,positionRelativeToTab:(e-o.left)/p<.5?n:s,width:p}}else d={left:o.left,width:0,positionRelativeToTab:n,index:-1};else c=dc(e,t,o,i,a);return{position:c,x:e,y:t,closeToTheEdge:l,tab:d}}function dc(e,t,o,r,n){let s=pc(o,.2);if($o(s,e,t))return uc;switch(`${n<.5?"north":"south"}${r<.5?"west":"east"}`){case"northwest":return r>n?vs:Xr;case"northeast":return 1-r>n?vs:Ur;case"southeast":return r>n?Ur:ws;case"southwest":return 1-r>n?Xr:ws;default:}}function pc({right:e,left:t,top:o,bottom:r},n){let s=(1-n)/2,i=(e-t)*s,a=(r-o)*s;return{left:t+i,top:o+a,right:e-i,bottom:r-a}}function mc(e,t,o){let{id:r,"data-path":n,path:s=n}=A(e),i=_(e);if(r&&s){let[a,l]=Rs(e);Ds(e,a,l,t),ue(i)&&Ss(e,t,o)}}function Ds(e,t,o,r){let{"data-path":n,path:s=n,header:i}=A(e);r[s]=t;let a=_(e);if(i||a==="Stack"){let l=o.querySelector(".vuuHeader");if(l){let{top:c,left:d,right:p,bottom:u}=l.getBoundingClientRect();if(r[s].header={top:Math.round(c),left:Math.round(d),right:Math.round(p),bottom:Math.round(u)},a==="Stack")r[s].Stack=Array.from(l.querySelectorAll(".saltTab")).map(m=>m.getBoundingClientRect()).map(({left:m,right:f})=>({left:m,right:f}));else{let m=l.querySelector('[class^="vuuHeader-title"]'),{header:f}=r[s];m&&f&&(f.titleWidth=m.clientWidth)}}}return r[s]}function Ss(e,t,o,r=0,n=0,s=0,i=0){let{children:a,"data-path":l,path:c=l,style:d,active:p=0}=A(e),u=_(e),m=u==="Flexbox",f=u==="Stack",g=m&&d.flexDirection==="column",h=m&&d.flexDirection==="row",T=(f?a.filter((y,v)=>v===p):a.filter(fc)).map(y=>{let[v,x]=Rs(y);return[{...v,top:v.top-s,right:v.right+n,bottom:v.bottom+i,left:v.left-r},x,y]}),E=T.map(([y,v,x],w,S)=>{let O,H,P,D,I,M,R=S.length-1;h?(I=w===0?0:y.left-S[w-1][0].right,M=w===R?0:S[w+1][0].left-y.right,O=w===0||I===0?0:I,H=w===R||M===0?0:M-M/2,y.left-=O,y.right+=H,P=s,D=i):g&&(I=w===0?0:y.top-S[w-1][0].bottom,M=w===R?0:S[w+1][0].top-y.bottom,P=w===0||I===0?0:I,D=w===R||M===0?0:M-M/2,y.top-=P,y.bottom+=D,O=r,H=n);let L=Ds(x,y,v,t),C=_(x);return ue(C)&&Ss(x,t,o,O,H,P,D),L});T.length&&(t[c].children=E)}function fc(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 Rs(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:r,left:n,right:s,bottom:i,height:a,width:l}=o.getBoundingClientRect(),c,d=_(e);if(ue(d)){let p=o.scrollHeight;p>a&&(c={id:t,scrollHeight:p,scrollTop:o.scrollTop})}return[{top:Math.round(r),left:Math.round(n),right:Math.round(s),bottom:Math.round(i),height:Math.round(a),width:Math.round(l),scrolling:c},o,e]}function Ms(e,t,o,r,n,s=[]){let{children:i,"data-path":a,path:l=a}=A(e),c=_(e),d=t[l];if(!$o(d,o,r))return s;if(n&&n.length){if(n.includes(l))s.push(e);else if(!n.some(p=>p.startsWith(l)))return s}else s.push(e);if(!ue(c)||d.header&&$o(d.header,o,r))return s;d.scrolling&&gc(d,o,r);for(let p=0;p<i.length;p++){if(c==="Stack"&&e.props.active!==p)continue;let u=Ms(i[p],t,o,r,n);if(u.length)return s.concat(u)}return s}function $o(e,t,o){if(e)return t>=e.left&&t<e.right&&o>=e.top&&o<e.bottom}function gc({top:e,bottom:t,scrolling:o},r,n){if(o){let{id:s,scrollTop:i,scrollHeight:a}=o,l=t-e;if(i===0&&t-n<50){let c=a-l;document.getElementById(s).scrollTo({left:0,top:c,behavior:"smooth"}),o.scrollTop=c}else if(i>0&&n-e<50)document.getElementById(s).scrollTo({left:0,top:0,behavior:"smooth"}),o.scrollTop=0;else return!1}else return!1}var hc=.4,Fo=class{constructor(t,o,r,n,s){this.init(t,o,r,n,s)}init(t,o,r,n,s){let{left:i,top:a}=n,{pctX:l,pctY:c}=qr(o,r,n),d=hc,p=l*n.width,u=n.width-p,m=c*n.height,f=n.height-m,g=n.width*d,h=n.height*d,b=1-d,T=p*b,E=m*b,y=u*b,v=f*b;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-T,hi:t.right-n.width+y},y:{lo:t.top-E,hi:t.bottom-n.height+v}},mouse:{x:{lo:t.left+g*l,hi:t.right-g*(1-l)},y:{lo:t.top+h*c,hi:t.bottom-h*(1-c)}}},this.x={pos:i,lo:!1,hi:!1,mousePos:o,mousePct:l},this.y={pos:a,lo:!1,hi:!1,mousePos:r,mousePct:c}}outOfBounds(){return this.x.lo||this.x.hi||this.y.lo||this.y.hi}inBounds(){return!this.outOfBounds()}dropX(){return this.dropXY("x")}dropY(){return this.dropXY("y")}hasIntrinsicSize(){var t,o;return((t=this==null?void 0:this.intrinsicSize)==null?void 0:t.height)&&((o=this==null?void 0:this.intrinsicSize)==null?void 0:o.width)}update(t,o){let r=this[t],n=this.constraint.mouse[t],s=this.constraint.pos[t],i=r.pos,a=o-r.mousePos;return a<0?r.lo||(o<n.lo?(r.lo=!0,r.pos=s.lo):r.hi?o<n.hi&&(r.hi=!1,r.pos+=a):r.pos+=a):a>0&&(r.hi||(o>n.hi?(r.hi=!0,r.pos=s.hi):r.lo?o>n.lo&&(r.lo=!1,r.pos+=a):r.pos+=a)),r.mousePos=o,i!==r.pos}dropXY(t){let o=this[t],r=this.constraint.zone[t];return o.lo?Math.max(r.lo,o.mousePos):o.hi?Math.min(o.mousePos,Math.round(r.hi)-1):o.mousePos}};var bc=e=>e.pos.tab&&_(e.component)==="Stack"&&e.pos.position.Header,{north:yc,south:xc,east:Ec,west:Tc}=gt,vc=Ec+Tc,wc=yc+xc,Ke=class{constructor({component:t,pos:o,clientRect:r,nextDropTarget:n}){this.component=t,this.pos=o,this.clientRect=r,this.nextDropTarget=n,this.active=!1,this.dropRect=void 0}targetTabPos(t){let{left:o,width:r,positionRelativeToTab:n}=t;return n===so.BEFORE?o:o+r}getTargetDropOutline(t,o){if(this.pos.tab)return this.getDropTabOutline(t,this.pos.tab);if(o&&o.hasIntrinsicSize())return this.getIntrinsicDropRect(o);{let[r,n,s,i]=this.getDropRectOutline(t,o);return{l:r,t:n,r:s,b:i}}}getDropTabOutline(t,o){var b,T;let{clientRect:{top:r,left:n,right:s,bottom:i,header:a}}=this,l=0,c=Math.round(t/2)+l,d=Math.round(r),p=Math.round(n+c),u=Math.round(s-c),m=Math.round(i-c),f=this.targetTabPos(o),g=60,h=((b=a==null?void 0:a.bottom)!=null?b:0)-((T=a==null?void 0:a.top)!=null?T:0);return{l:p,t:d,r:u,b:m,tabLeft:f,tabWidth:g,tabHeight:h}}getIntrinsicDropRect(t){var g,h,b,T;let{pos:o,clientRect:r}=this,{x:n,y:s}=t,i=(h=(g=t.intrinsicSize)==null?void 0:g.height)!=null?h:0,a=(T=(b=t.intrinsicSize)==null?void 0:b.height)!=null?T:0;i&&i>r.height?(console.log("DropTarget: we're going to blow the gaff"),i=r.height):a&&a>r.width&&(console.log("DropTarget: we're going to blow the gaff"),a=r.width);let l=Math.min(r.right-a,Math.max(r.left,Math.round(o.x-n.mousePct*a))),c=Math.min(r.bottom-i,Math.max(r.top,Math.round(o.y-s.mousePct*i))),[d,p,u,m]=this.dropRect=[l,c,l+a,c+i],f=o.position.EastOrWest?[d,r.top,d,r.bottom,u,r.top,u,r.bottom]:[r.left,p,r.right,p,r.left,m,r.right,m];return{l:d,r:u,t:p,b:m,guideLines:f}}getDropRectOutline(t,o){var T,E,y;let{pos:r,clientRect:n}=this,{width:s,height:i,position:a}=r,{width:l,height:c}=(T=o==null?void 0:o.intrinsicSize)!=null?T:{},d=(E=c!=null?c:i)!=null?E:0,p=(y=l!=null?l:s)!=null?y:0;this.dropRect=void 0;let{top:u,left:m,right:f,bottom:g}=n,h=0,b=Math.round(t/2)+h;switch(a){case pe.North:case pe.Header:{let v=Math.round((g-u)/2),x=d?Math.min(v,Math.round(d)):v;return p&&m+p<f?[m+b,u+b,m+p-b,u+b+x]:[m+b,u+b,f-b,u+b+x]}case pe.West:{let v=Math.round((f-m)/2),x=p?Math.min(v,Math.round(p)):v;return d&&u+d<g?[m+b,u+b,m-b+x,u+d+b]:[m+b,u+b,m-b+x,g-b]}case pe.East:{let v=Math.round((f-m)/2),x=p?Math.min(v,Math.round(p)):v;return d&&u+d<g?[f-b-x,u+b,f-b,u+d+b]:[f-b-x,u+b,f-b,g-b]}case pe.South:{let v=Math.round((g-u)/2),x=d?Math.min(v,Math.round(d)):v;return p&&m+p<f?[m+b,g-b-x,m+p-b,g-b]:[m+b,g-b-x,f-b,g-b]}case pe.Centre:return[m+b,u+b,f-b,g-b];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:Ke.getActiveDropTarget(t.nextDropTarget)}};function _o(e,t,o,r,n,s){var l;let i=null,a=Ht.allBoxesContainingPoint(o,r,e,t,s);if(a.length){let[c,...d]=a,{"data-path":p,path:u=p,"data-row-placeholder":m}=A(c),f=r[u],h=Yr(e,t,f,n&&m?"row":void 0),b=r[u],T=([E,...y])=>{var v,x;if((v=h.position)!=null&&v.Header||h.closeToTheEdge){let w=Dc(E,h,b,r,e,t);if(w){let[S,O]=w;return new Ke({component:E,pos:S,clientRect:O,nextDropTarget:(x=T(y))!=null?x:null})}else if(y.length)return T(y)}};i=new Ke({component:c,pos:h,clientRect:f,nextDropTarget:(l=T(d))!=null?l:null}).activate()}return i}function Dc(e,{closeToTheEdge:t,position:o},r,n,s,i){if(!e||e.type==="DraggableLayout")return;let a=n[e.props.path],l=t&gt.north,c=t&gt.east,d=t&gt.south,p=t&gt.west,u=(l||o.Header)&&Math.round(r.top)===Math.round(a.top),m=c&&Math.round(r.right)===Math.round(a.right),f=d&&Math.round(r.bottom)===Math.round(a.bottom),g=p&&Math.round(r.left)===Math.round(a.left);if(u||m||f||g){let{"data-path":h,path:b=h}=e.props,T=n[b],E=Yr(s,i,T);if((Sc(e)||Ps(e))&&t&vc)return E.width=120,[E,T];if((Rc(e)||Ps(e))&&(o.Header||t&wc))return E.height=120,[E,T]}}function Ps(e){return _(e)==="Stack"}function Sc(e){return _(e)==="Flexbox"&&e.props.style.flexDirection==="column"}function Rc(e){return _(e)==="Flexbox"&&e.props.style.flexDirection==="row"}var Wo=require("@vuu-ui/vuu-popups");var Ls=W(require("classnames"));var Jr=require("react/jsx-runtime");function Qr(e,t=0,o=0){let{pos:r,clientRect:n}=e,s=20;return r.position.West?[n.left-o+s,r.y-t,"left"]:r.position.South?[r.x-o,n.bottom-t-s,"bottom"]:r.position.East?[n.right-o-s,r.y-t,"right"]:[r.x-o,n.top-t+s,"top"]}var jr="vuuDropMenu",en=({className:e,dropTarget:t,onHover:o,orientation:r})=>{let n=t.toArray();return(0,Jr.jsx)("div",{className:(0,Ls.default)(jr,e,`${jr}-${r}`),onMouseLeave:()=>o(null),children:n.map((s,i)=>(0,Jr.jsx)("div",{className:`${jr}-item`,"data-icon":i===0?"column-2A":"column-2B",onMouseEnter:()=>o(s)},i))})};var Hs=require("react/jsx-runtime"),tn=!1,io=null,Ce=null,Mc=e=>io=e,Pc=([e,t])=>`M${e},${t}`,Lc=([e,t])=>`L${e},${t}`,Is=([e,...t])=>`${Pc(e)} ${t.map(Lc)}Z`,Ic=e=>{if(e){let[t,o,r,n,s,i,a,l]=e;return`M${t},${o} L${r},${n} M${s},${i} L${a},${l}`}else return""};function Cc(){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,10 @@
14
14
  />
15
15
  </path>
16
16
  </svg>
17
- `,document.body.insertBefore(t,e)}}var Zt=class{constructor(){this.currentPath=null;this.tabMode=null;Hl()}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=Qr(n),s=document.getElementById("vuu-drop-outline");s==null||s.setAttribute("d",r),this.currentPath=r}clear(){Kt=null,Ro(),document.body.classList.remove("drawing"),wo.PopupService.hidePopup()}get hoverDropTarget(){return Kt}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=In;if(Kt!==null)this.drawTarget(Kt);else if(In=t.nextDropTarget!=null,t.pos.tab?kl(t):Ie&&Ro(),this.drawTarget(t,o),In){let[s,i,a]=Mn(t);{let l=(0,os.jsx)(Ln,{dropTarget:t,onHover:Il,orientation:a});wo.PopupService.showPopup({left:s,top:i,component:l})}}else wo.PopupService.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=Qr(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",Al(u))}}},es="transition:margin-left .4s ease-out;margin-left: 63px",ts="transition:margin-left .4s ease-out;margin-left: 0px";function kl(e){var a,l;let{AFTER:t,BEFORE:o}=Gt,{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?(Ie===null||Ie!==i)&&(i.style.cssText=es,Ie&&(Ie.style.cssText=ts),Ie=i):Ro()}else if((r==null?void 0:r.positionRelativeToTab)===o){if(Ie===null){let c=".vuuHeader-title";i=(l=document.getElementById(s))==null?void 0:l.querySelector(c),i.style.cssText=es,Ie=i}}else Ro()}function Ro(){Ie&&(Ie.style.cssText=ts,Ie=null)}var Ve,Ut,je,rs,ss,Je,So,Pt=null,On,is,qt,as,Cn,Po=null,zl=3,Mo=new Zt,ns=.4;function Nl(e,t){return t?re(e,t):ze(e,o=>o.dropTarget)}var Co={handleMousedown(e,t,o={}){Ve=t,is=o,rs=e.clientX,ss=e.clientY,Cn=o.dragThreshold===void 0?zl:o.dragThreshold,Cn===0?Ve(e,0,0):(window.addEventListener("mousemove",Lo,!1),window.addEventListener("mouseup",Io,!1),Po=window.setTimeout(()=>{console.log("mousedownTimer fires"),window.removeEventListener("mousemove",Lo,!1),window.removeEventListener("mouseup",Io,!1),Ve==null||Ve(e,0,0)},500)),e.preventDefault()},initDrag(e,t,{top:o,left:n,right:r,bottom:s},i,a,l,c){return{drag:Ut,drop:je}=a,Bl(e,t,{top:o,left:n,right:r,bottom:s},i,l,c)}};function Lo(e){let n=e.clientX-rs,r=e.clientY-ss;Math.max(Math.abs(n),Math.abs(r))>Cn&&(window.removeEventListener("mousemove",Lo,!1),window.removeEventListener("mouseup",Io,!1),Ve==null||Ve(e,n,r),Ve=null)}function Io(){Po&&(window.clearTimeout(Po),Po=null),window.removeEventListener("mousemove",Lo,!1),window.removeEventListener("mouseup",Io,!1)}function Bl(e,t,o,n,r,s){Je=Nl(e,t);let{"data-path":i,path:a=i}=A(Je);s&&(On=s.map(u=>ze(e,m=>m.id===u)).map(u=>u.props.path)),qt=St.measure(Je,s),console.log({_measurements:qt});let l=qt[a];So=new vo(l,n.x,n.y,o,r);let c=Math.round(So.x.mousePct*100),p=Math.round(So.y.mousePct*100);return window.addEventListener("mousemove",ls,!1),window.addEventListener("mouseup",cs,!1),as=!1,Mo.prepare(o,"tab-only"),is.DoNotTransform?"transform:none":`transform:scale(${ns},${ns});transform-origin:${c}% ${p}%;`}function ls(e){let t=e.clientX,o=e.clientY,n=So,r=Pt,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||Ut==null||Ut(i,a),!(as||Je===void 0)&&(n.inBounds()?s=Do(t,o,Je,qt,n.hasIntrinsicSize(),On):s=Do(n.dropX(),n.dropY(),Je,qt),r&&(s==null||s.box!==r.box)&&(Pt=null),s&&(Mo.draw(s,n),Pt=s))}function cs(){$l()}function $l(){if(Pt){let e=Mo.hoverDropTarget||_e.getActiveDropTarget(Pt);je==null||je(e),Pt=null}else je==null||je({component:Je,pos:{position:de.Absolute}});Ut=null,je=null,Je=void 0,Mo.clear(),On=void 0,window.removeEventListener("mousemove",ls,!1),window.removeEventListener("mouseup",cs,!1)}var us=F(require("classnames")),ps=require("react");var ms=require("react/jsx-runtime"),An=(0,ps.forwardRef)(function({children:t,className:o,dropTarget:n,resizeable:r,...s},i){let a=(0,us.default)("DraggableLayout",o);return(0,ms.jsx)("div",{className:a,ref:i,...s,children:t})}),ds="DraggableLayout";An.displayName=ds;Q(ds,An,"container");var Ms=require("@salt-ds/core"),Ls=F(require("classnames")),Is=require("react");var Ss=require("@vuu-ui/vuu-utils"),ee=F(require("react"));var gs=F(require("classnames"));var hs=require("react/jsx-runtime"),fs="vuuPlaceholder",Xt=({className:e,closeable:t,flexFill:o,resizeable:n,shim:r,...s})=>(0,hs.jsx)("div",{className:(0,gs.default)(fs,e,{[`${fs}-shim`]:r}),...s,"data-placeholder":!0,"data-resizeable":!0});Xt.displayName="Placeholder";Q("Placeholder",Xt);var bs=F(require("classnames")),me=F(require("react"));var Hn=require("react/jsx-runtime"),ys=me.default.memo(function({column:t,index:o,onDrag:n,onDragEnd:r,onDragStart:s,style:i}){let a=(0,me.useRef)(),l=(0,me.useRef)(null),c=(0,me.useRef)(0),[p,d]=(0,me.useState)(!1),u=(0,me.useCallback)(({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=(0,me.useCallback)(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=(0,me.useRef)(m),g=E=>h.current(E),b=(0,me.useCallback)(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=(0,me.useCallback)(()=>{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=(0,me.useCallback)(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=(0,bs.default)("Splitter","focusable",{active:p,column:t});return(0,Hn.jsx)("div",{className:v,"data-splitter":!0,ref:l,role:"separator",style:i,onBlur:x,onClick:T,onKeyDown:g,onMouseDown:y,tabIndex:0,children:(0,Hn.jsx)("div",{className:"grab-zone"})})});var zn=require("@vuu-ui/vuu-utils"),Nn=F(require("react"));var Fl={"data-placeholder":!0,"data-resizeable":!0},Oo={},Qe="auto",kn={flexBasis:0,flexGrow:1,flexShrink:1,height:Qe,width:Qe},Es={height:"width",width:"height"},xs=(e="row")=>e==="row"?["width","height","column"]:["height","width","row"],_l=e=>typeof e=="string"&&e.endsWith("%"),we=e=>{let{style:{width:t=Qe,height:o=Qe}=Oo}=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 Bn(e,t,o){let n=Es[t],{style:{[n]:r=Qe,...s}=Oo}=e.props;return o&&o[t]?{...s,...kn,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...s,...kn,[n]:r}}function Ts(e){let{style:{flex:t,flexGrow:o,flexShrink:n,flexBasis:r}=Oo}=e.props;return typeof t=="number"||r===0&&o===1&&n===1?!0:typeof r!="number"}function $n(e,t,o){let n=Es[t],{style:{[t]:r=Qe,[n]:s=Qe,...i}=Oo}=e.props;return r!==Qe?_l(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,...kn,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...i,[n]:s}}function Yt(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(Ne(`${o}.${i++}`,p,{flexGrow:0,flexShrink:0}))}else a=!0;let{version:l=0,style:c}=A(e);return s.push(ie(e,`${o}.${i++}`,{version:l+1,style:{...c,flexBasis:"auto",flexGrow:0,flexShrink:0}})),a&&s.push(Ne(`${o}.${i++}`,0,void 0,{[`data-${t}-placeholder`]:!0})),Fn(t,{resizeable:!1,style:{flexBasis:"auto"}},s,o)}var Vl=(e,t)=>{if(!t)return e===0?1:0};function Fn(e,t,o,n){let r=(0,zn.uuid)(),{flexFill:s,style:i,resizeable:a=!0}=t,{flexBasis:l=s?void 0:"auto"}=i,c=Vl(l,s);return Nn.default.createElement(Fe.Flexbox,{id:r,key:r,path:n,flexFill:s,style:{...i,flexDirection:e,flexBasis:l,flexGrow:c,flexShrink:c},resizeable:a},o)}var Wl={flexGrow:1,flexShrink:1};function Ne(e,t,o,n){let r=(0,zn.uuid)();return Nn.default.createElement("div",{...Fl,...n,"data-path":e,id:r,key:r,style:{...Wl,...o,flexBasis:t}})}var Gl={},jt=1,Jt=2,Kl=e=>typeof e.intrinsicSize=="number",Zl=(e,t)=>{let o={};return e.forEach(n=>{o[n]=B(t,n)}),o},Ao=(e,t,o)=>e.map((n,r)=>{var l;let s=B(n,"resizeable"),{[t]:i}=(l=we(n))!=null?l:Gl,a=Ts(n);return o?{index:r,flexOpen:a,intrinsicSize:i,resizeable:s,...Zl(o,n)}:{index:r,flexOpen:a,intrinsicSize:i,resizeable:s}}),vs=e=>{let t=e.length,o=e.every(Kl),n=Array(t).fill(0);if(o&&t>0&&(n[0]=Jt,n[t-1]=Jt),t<2)return n;for(let r=0,s=0;r<t-1;r++)e[r].resizeable&&!s&&(s=jt),n[r]+=s;for(let r=t-1;r>0&&(n[r]&jt&&(n[r]-=jt),!e[r].resizeable);r--);return n},Ds=(e,t)=>{let o=ql(e,t),n=Xl(e,t),r=o!==-1&&n!==-1?[o,n]:void 0,s=Ul(e,r);return[r,s]};function Ul(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 ql(e,t){let o=t,n=!1;for(;o>=1&&!n;)o=o-1,n=ws(e,o);return o}function Xl(e,t){let o=t,n=!1,r=e.length;for(;o<r-1&&!n;)o=o+1,n=ws(e,o);return o===r?-1:o}function ws(e,t){let{placeholder:o,splitter:n,resizeable:r,intrinsicSize:s}=e[t];return!!(!n&&!s&&(o||r))}var Yl=e=>!e.splitter&&!e.placeholder,Ps=({children:e,onSplitterMoved:t,style:o})=>{let n=(0,ee.useRef)(null),r=(0,ee.useRef)(),s=(0,ee.useRef)(),i=(0,ee.useRef)([]),[,a]=(0,ee.useState)({}),l=b=>{s.current=b,a({})},c=(o==null?void 0:o.flexDirection)==="column",p=c?"height":"width",d=(0,ee.useMemo)(()=>Array.isArray(e)?e:ee.default.isValidElement(e)?[e]:[],[e]),u=(0,ee.useCallback)(b=>{let{current:f}=r;if(f){let[y,T]=Ds(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}=ec(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=(0,ee.useCallback)((b,f)=>{s.current&&r.current&&l(Jl(s.current,r.current,f,p))},[p]),h=(0,ee.useCallback)(()=>{let b=r.current;b&&(t==null||t(b.filter(Yl))),b==null||b.forEach(f=>{f.currentSize=void 0,f.flexBasis=void 0,f.flexOpen=!1})},[t]),g=(0,ee.useCallback)(b=>ee.default.createElement(ys,{column:c,index:b,key:`splitter-${b}`,onDrag:m,onDragEnd:h,onDragStart:u}),[m,h,u,c]);return(0,ee.useMemo)(()=>{let[b,f]=jl(d,p,g,i.current);r.current=f,s.current=b},[d,g,p]),{content:s.current||[],rootRef:n}};function jl(e,t,o,n){let r=Ao(e,t),s=vs(r),i=[],a=[];for(let l=0;l<e.length;l++){let c=e[l];if(l===0&&s[l]&Jt&&(i.push(Rs(l)),a.push({placeholder:!0,shim:!0})),c.key==null){let p=n[l]||(n[l]=(0,Ss.getUniqueId)());i.push(ee.default.cloneElement(c,{key:p}))}else i.push(c);a.push(r[l]),l>0&&s[l]&Jt?(i.push(Rs(l)),a.push({placeholder:!0})):s[l]&jt&&(i.push(o(i.length)),a.push({splitter:!0}))}return[i,a]}function Jl(e,t,o,n){return Ql(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?ee.default.cloneElement(s,{style:{...s.props.style,flexBasis:m,[n]:"auto"}}):s}else return s}):e}function Ql(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 Rs(e){return ee.default.createElement(Xt,{shim:e===0,key:`placeholder-${e}`})}function ec(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}}var Os=require("react/jsx-runtime"),_n="hwFlexbox",Cs=(0,Is.forwardRef)(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}=Ps({children:r,onSplitterMoved:d,style:b}),x=(0,Ls.default)(_n,i,{[`${_n}-column`]:s,[`${_n}-row`]:m,"flex-fill":a,"full-page":c});return(0,Os.jsx)("div",{...f,className:x,"data-resizeable":u||void 0,id:p,ref:(0,Ms.useForkRef)(T,o),style:{...b,gap:l,"--spacing":h},children:y})});Cs.displayName="Flexbox";var Ho=Cs;var li=require("react");var mt={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"};var Ee=require("react");var $o=F(require("react"));var Xn=require("@vuu-ui/vuu-utils"),Mt=F(require("react"));var Zn=require("@vuu-ui/vuu-utils"),et=F(require("react"));var ft=require("react"),fe=new Map,Re=new Map,Vn=e=>fe.get(e),Wn=e=>fe.has(e),Gn=(e,t)=>fe.set(e,t),gt=()=>{let e=(0,ft.useCallback)((i,a)=>{let l=Re.get(i);if(l)return a!==void 0&&l[a]!==void 0?l[a]:a!==void 0?void 0:l},[]),t=(0,ft.useCallback)((i,a,l)=>{if(a===void 0)Re.set(i,l);else if(Re.has(i)){let c=Re.get(i);Re.set(i,{...c,[a]:l})}else Re.set(i,{[a]:l})},[]),o=(0,ft.useCallback)((i,a)=>{if(Re.has(i)){if(a===void 0)Re.delete(i);else if(Re.get(i)[a]){let{[a]:c,...p}=Re.get(i);Object.keys(p).length>0?Re.set(i,p):Re.delete(i)}}},[]),n=(0,ft.useCallback)((i,a)=>{let l=fe.get(i);if(l)return a!==void 0?l[a]:l},[]),r=(0,ft.useCallback)((i,a,l)=>{if(a===void 0)fe.set(i,l);else if(fe.has(i)){let c=fe.get(i);fe.set(i,{...c,[a]:l})}else fe.set(i,{[a]:l})},[]),s=(0,ft.useCallback)((i,a)=>{if(fe.has(i)){if(a===void 0)fe.delete(i);else if(fe.get(i)[a]){let{[a]:c,...p}=fe.get(i);Object.keys(p).length>0?fe.set(i,p):fe.delete(i)}}},[]);return{loadSessionState:e,loadState:n,saveSessionState:t,saveState:r,purgeState:s,purgeSessionState:o}};var As=e=>e.flexDirection==="column"?["height","width"]:["width","height"],tc={},Qt=(e,t="0")=>{let[o,n]=qn($(e),e.props,t);return et.default.cloneElement(e,o,n)},Un=(e,t)=>{let o=$(e),[n,r]=qn(o,e.props,"0",void 0,t);return(0,et.cloneElement)(e,n,r)};function oc(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:(0,Zn.uuid)(),u=e==="Stack"?(b=t.active)!=null?b:s:void 0,m=d,h=p?c:rc(e,t,n);return fn(e)?{id:d,key:m,path:o,style:h,type:e,active:u}:{id:d,key:m,style:h,"data-path":o}}function qn(e,t,o,n=null,r){var c,p;let s=oc(e,t,o,n,r);if(t.layout&&!r)return[s,[ko(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:nc(e,t.children,o,i);return[s,l]}function nc(e,t,o="0",n){let r=Array.isArray(t)?t:et.default.isValidElement(t)?[t]:[];return ce(e)?r.map((s,i)=>{let a=$(s),l=$(n==null?void 0:n[i]);if(!l||a===l){let[c,p]=qn(a,s.props,`${o}.${i}`,e,n==null?void 0:n[i]);return et.default.cloneElement(s,c,p)}return n==null?void 0:n[i]}):t}var rc=(e,t,o)=>{let{style:n=tc}=t;if(e==="Flexbox"&&(n={flexDirection:t.column?"column":"row",...n,display:"flex"}),n.flex){let{flex:r,...s}=n;n={...s,...xo(typeof r=="number"?r:0)}}else o==="Stack"?n={...n,...xo(1)}:o==="Flexbox"&&(n.width||n.height)&&n.flexBasis===void 0&&(n={...n,flexBasis:"auto",flexGrow:0,flexShrink:0});return n};function ko({id:e=(0,Zn.uuid)(),type:t,children:o,props:n,state:r},s){let i=t.match(/^[a-z]/)?t:Fe[t];if(i===void 0)throw Error(`layoutUtils unable to create component from JSON, unknown type ${t}`);return r&&Gn(e,r),et.default.createElement(i,{id:e,...n,key:e,path:s},o?o.map((a,l)=>ko(a,`${s}.${l}`)):void 0)}function Hs(e){return ks(e)}function ks(e){let t=$(e),{id:o,children:n,type:r,...s}=A(e),i=Wn(o)?Vn(o):void 0;return{id:o,type:t,props:sc(s),state:i,children:et.default.Children.map(n,ks)}}function sc(e){if(e){let{path:t,...o}=e,n={};for(let[r,s]of Object.entries(o))n[r]=Kn(s);return n}}function Kn(e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(Kn);if(typeof e=="object"&&e!==null){let t={};for(let[o,n]of Object.entries(e))t[o]=Kn(n);return t}}function zs(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 zo(e,t,o){let{active:n,children:r=[],path:s}=A(e),i=B(t,"path"),{idx:a,finalStep:l}=De(s,i,!0),[c,p]=l?ic(e,r,o):[n,r==null?void 0:r.map((u,m)=>m===a?zo(u,t,o):u)],d=$(e)==="Stack"?Array.isArray(c)?c[0]:c:n;return Mt.default.cloneElement(e,{active:d},p)}function ic(e,t,o){let n=B(e,"path"),r=t==null?void 0:t.length,{id:s=(0,Xn.uuid)()}=A(o);return r?[r,t.concat(ie(o,`${n}.${r}`,{id:s,key:s}))]:[0,[ie(o,`${n}.0`,{id:s})]]}function No(e,t,o,n,r,s,i){let{active:a,children:l,path:c}=A(e),p=B(t,"path"),{idx:d,finalStep:u}=De(c,p),[m,h]=u?ac(e,l,d,o,n,r,s,i):[a,l.map((b,f)=>f===d?No(b,t,o,n,r,s,i):b)],g=$(e)==="Stack"?m:a;return Mt.default.cloneElement(e,{active:g},h)}function ac(e,t,o,n,r,s,i,a){let l=we(n);return l!=null&&l.width&&(l!=null&&l.height)?cc(e,t,o,n,r,i,a):Ns(e,t,o,n,r,(s==null?void 0:s.width)||(s==null?void 0:s.height),i)}var lc=(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 cc(e,t,o,n,r,s,i){let{style:{flexDirection:a}}=A(e),[l,c,p]=xs(a),{[c]:d,[l]:u}=we(n),m=B(t[o],"path"),h=lc(a,r,s,i),[g,b]=d<s[c]?[Yt(n,p,m,s,i),u]:[n,void 0],f=h?Ne(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}=we(y);return T&&T<d?Yt(y,p,B(y,"path")):y}})),Ns(e,t,o,g,r,b,s,f)}function Ns(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]=uc(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:ie(d,`${l}.${u}`));return[c,p]}function uc(e,t,o,n){let r=(0,Xn.uuid)(),{version:s=0}=A(o);if(s+=1,$(e)==="Flexbox"){let[i]=As(e.props.style),a=6,l={[i]:(n[i]-a)/2},c=$n(t,i,l),p=$n(o,i,l);return[Mt.default.cloneElement(t,{style:c}),Mt.default.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,Mt.default.cloneElement(o,{id:r,version:s,style:c})]}}var $s=require("react");var eo=F(require("react"));function Bs(e,{target:t,replacement:o}){return Yn(e,t,o)}function Yn(e,t,o){let n=B(t,"path"),r=B(t,"resizeable"),{style:s}=A(t),i=Qt(eo.default.cloneElement(o,{resizeable:r,style:{...s,...o.props.style}}),n);return ge(e,t,i)}function ge(e,t,o,n){if(e===t)return o;let{idx:r,finalStep:s}=De(B(e,"path"),B(t,"path")),i=e.props.children.slice();return s?n?n===mt.MINIMIZE?i[r]=pc(e,i[r]):n===mt.RESTORE&&(i[r]=dc(i[r])):i[r]=o:i[r]=ge(i[r],t,o,n),eo.default.cloneElement(e,void 0,i)}function pc(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?eo.default.cloneElement(t,{collapsed:u,restoreStyle:p,style:d}):t}function dc(e){let{style:t,restoreStyle:o}=A(e),{flexBasis:n,flexShrink:r,flexGrow:s,...i}=t,a={...i,...o};return eo.default.cloneElement(e,{collapsed:!1,style:a,restoreStyle:void 0})}function Fs(e,{fromIndex:t,path:o,toIndex:n}){let r=re(e,o,!0),{children:s}=A(r),i=mc(s,t,n),a=(0,$s.cloneElement)(r,void 0,i);return ge(e,r,a)}function mc(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 ue={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"};var tt=F(require("react"));function jn(e,{path:t}){let o=re(e,t),n=ke(e,t);if(n===null)return e;let{children:r}=A(n);if(r.length>1&&Vs(r,t)){let{style:{flexBasis:s,display:i,flexDirection:a,...l}}=A(n),c=B(n,"path"),p=ge(e,n,Ne(c,s,l));for(;(n=ke(p,c))&&B(n,"path")!=="0";){let{children:d}=A(n);if(Vs(d)){c=B(n,"path");let{style:{flexBasis:u,display:m,flexDirection:h,...g}}=A(n);p=ge(e,n,Ne(c,u,g))}else if(bc(d))p=Ks(e,n);else break}return p}return Ws(e,o)}function Ws(e,t){let o=A(e),{children:n,path:r,preserve:s}=o,{active:i}=o,{idx:a,finalStep:l}=De(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 fc(e,p[0]);!p.some(gc)&&p.some(Gs)&&(p=hc(p))}else p[a]=Ws(p[a],t);return p=p.map((d,u)=>ie(d,`${r}.${u}`)),tt.default.cloneElement(e,{active:i},p)}function fc(e,t){let o=$(e),{path:n,style:{flexBasis:r,flexGrow:s,flexShrink:i,width:a,height:l}}=A(e),c=ie(t,n);if(n==="0")c=tt.default.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=tt.default.cloneElement(c,{flexFill:void 0,style:{...u,flexGrow:s,flexShrink:i,flexBasis:r,width:a,height:l}})}return c}var gc=e=>e.props.style.flexGrow>0,Gs=e=>{let{width:t,height:o,flexGrow:n}=e.props.style;return n===0&&typeof t!="number"&&typeof o!="number"},hc=e=>e.map(t=>Gs(t)?tt.default.cloneElement(t,{style:{...t.props.style,flexGrow:1}}):t),bc=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}}},Ks=(e,t)=>{let{children:o,path:n}=A(e),{idx:r,finalStep:s}=De(n,B(t,"path")),i=o.slice();return s?i[r]=yc(t):i[r]=Ks(i[r],t),i=i.map((a,l)=>ie(a,`${n}.${l}`)),tt.default.cloneElement(e,void 0,i)},yc=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(_s(n)),n.length=0),o.push(t[s]));n.length===1?o.push(n.pop()):n.length>0&&o.push(_s(n));let r=B(e,"path");return tt.default.cloneElement(e,void 0,o.map((s,i)=>ie(s,`${r}.${i}`)))},_s=([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 tt.default.cloneElement(e,{style:{...o,flexBasis:n,flexGrow:r,flexShrink:s}})},Vs=(e,t)=>e.every(o=>B(o,"placeholder")||t&&B(o,"path")===t);var Bo=F(require("react"));function Zs(e,{path:t,size:o}){let n=re(e,t,!0),{style:r}=A(n),s={...r,width:o},i=Bo.default.cloneElement(n,{style:s});return ge(e,n,i)}function Us(e,{path:t,sizes:o}){let n=re(e,t,!0),{children:r,style:s}=A(n),i=s.flexDirection==="column"?"height":"width",a=Ec(r,o,i),l=Bo.default.cloneElement(n,void 0,a);return ge(e,n,l)}function Ec(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:Bo.default.cloneElement(n,{style:xc(n.props.style,o,d)})})}function xc(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}}var qs=require("@vuu-ui/vuu-utils"),to=F(require("react"));var Xs=e=>{let[t]=$(e);return t===t.toLowerCase()};function oo(e,t,o,n,r,s){let{children:i,path:a}=A(e),l=B(t,"path"),{idx:c,finalStep:p}=De(a,l),d=p?Tc(e,i,t,o,n,r,s):i.map((u,m)=>m===c?oo(u,t,o,n,r,s):u);return to.default.cloneElement(e,void 0,d)}function Tc(e,t,o,n,r,s,i){let a=we(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 Dc(t,o,n,r,s,i)}return vc(e,t,o,n,r)}function vc(e,t,o,n,r){var E;let{version:s=0}=A(n),i=B(o,"path"),{type:a,flexDirection:l,showTabs:c}=js(r),[p,d,u]=wc(a,o,n,l,r),m=Ys(r),h=m?1:0,g={resizeable:!0,style:u,version:s+1},f={[Xs(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=(0,qs.uuid)(),v=to.default.createElement(Fe[a],{active:h,id:x,key:x,path:B(o,"path"),flexFill:B(o,"flexFill"),...T,...y,style:p,resizeable:B(o,"resizeable")},m?[ie(o,`${i}.0`,f),Qt(to.default.cloneElement(n,g),`${i}.1`)]:[Qt(to.default.cloneElement(n,g),`${i}.0`),ie(o,`${i}.1`,f)]);return t.map(D=>D===o?v:D)}function Dc(e,t,o,n,r,s){let{flexDirection:i}=js(n),a=i==="column"?"row":"column",l=Ys(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=Xs(t)?"data-resizeable":"resizeable",y=[];m&&y.push(l?ie(t,`${g}.${b++}`,{[f]:!0,style:{flexBasis:m,flexGrow:1,flexShrink:1}}):Ne(`${g}.${b++}`,m,{flexGrow:0,flexShrink:0})),y.push(Yt(o,a,`${g}.${b++}`,r,s)),h&&y.push(l?Ne(`${g}.${b++}`,0):ie(t,`${g}.${b++}`,{[f]:!0,style:{flexBasis:0,flexGrow:1,flexShrink:1}}));let T=Fn(i,t.props,y,g);return e.map(x=>x===t?T:x)}function wc(e,t,o,n,r){let s={...t.props.style,flexDirection:n},i=e==="Flexbox"&&n==="column"?"height":"width",a=Bn(o,i,r),l=Bn(t,i);return[s,l,a]}var Ys=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 js(e){return e.position.Header?{type:"Stack",flexDirection:"column",showTabs:!0}:{type:"Flexbox",flexDirection:e.position.EastOrWest?"row":"column"}}var oi=(e,t)=>{switch(t.type){case ue.ADD:return Lc(e,t);case ue.DRAG_DROP:return Mc(e,t);case ue.MAXIMIZE:return Pc(e,t);case ue.REMOVE:return jn(e,t);case ue.REPLACE:return Bs(e,t);case ue.SET_PROP:return Js(e,t);case ue.SET_PROPS:return Sc(e,t);case ue.SET_TITLE:return Js(e,{type:"set-prop",path:t.path,propName:"title",propValue:t.title});case ue.SPLITTER_RESIZE:return Us(e,t);case ue.LAYOUT_RESIZE:return Zs(e,t);case ue.SWITCH_TAB:return Rc(e,t);case ue.MOVE_CHILD:return Fs(e,t);default:return e}},Rc=(e,{path:t,nextIdx:o})=>{let n=re(e,t,!0),r=$o.default.cloneElement(n,{active:o});return ge(e,n,r)},Js=(e,{path:t,propName:o,propValue:n})=>{let r=re(e,t,!0),s=$o.default.cloneElement(r,{[o]:n});return ge(e,r,s)},Sc=(e,{path:t,props:o})=>{let n=re(e,t,!0),r=$o.default.cloneElement(n,o);return ge(e,n,r)},Pc=(e,{path:t,type:o})=>{if(t){let n=re(e,t,!0);return ge(e,n,n,o)}else return e},Mc=(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=we(o),d;if(a){let[b,f]=zs(s,i);b===void 0?d=zo(e,s,o):d=No(e,b,o,f)}else!p&&((g=i==null?void 0:i.position)!=null&&g.Centre)?d=Yn(e,s,o):d=Ic(e,r,o);if(n.DoNotRemove)return d;let u=ze(d,b=>b.id===l&&b.version===c),m=B(u,"path");return jn(d,{path:m,type:"remove"})},Lc=(e,{path:t,component:o})=>zo(e,re(e,t),o),Ic=(e,t,o)=>{let{component:n,pos:r,clientRect:s,dropRect:i}=t,a=B(n,"path");if(a==="0.0")return oo(e,n,o,r);let l=ke(e,a);if(Qs(r,l)){let c=r.position.SouthOrEast?"after":"before";return No(e,n,o,c,r,s,i)}if(!Qs(r,l))return oo(e,n,o,r,s,i);if(ce($(l)))return oo(e,n,o,r);throw Error(`no support right now for position = ${r.position}`)},Qs=(e,t)=>e.position.Centre?ti(t)||ei(t):e.position.NorthOrSouth?ei(t):e.position.EastOrWest?ti(t):!1,ei=e=>$(e)==="Flexbox"&&e.props.style.flexDirection==="column",ti=e=>$(e)==="Flexbox"&&e.props.style.flexDirection!=="column";var ni=require("react"),Cc=e=>console.log(`dispatch ${e.type}, have you forgotten to provide a LayoutProvider ?`),Lt=(0,ni.createContext)({dispatchLayoutProvider:Cc,version:-1});var We=require("react");var Oc={},ri=[0,0],Ac=(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]},Hc=e=>{let{offsetParent:t}=e;if(t===null)return ri;{let{left:o,top:n}=t.getBoundingClientRect();return[o,n]}},si=(e,t)=>{let o=(0,We.useRef)(),n=(0,We.useRef)(),r=(0,We.useRef)(),s=(0,We.useCallback)((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=(0,We.useCallback)(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=(0,We.useCallback)(c=>{if(o.current){let{payload:p,dragContainerPath:d,dragElement:u,dragRect:m,instructions:h=Oc,path:g}=o.current,{current:b}=e,f={x:c.clientX,y:c.clientY},y=p!=null?p:re(b,g,!0),{id:T}=y.props,x=we(y),v="",E="",D="",P=-1,k=-1,C=ri,M=document.getElementById(T);if(M===null)[M,E,P,k]=Ac(m,T,u);else{C=Hc(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=Co.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(0,We.useCallback)(c=>{let{evt:p,...d}=c;console.log("prepare to drag",{options:d}),o.current={...d,dragContainerPath:""},Co.handleMousedown(p,a,d.instructions)},[a])};var Jn=require("react/jsx-runtime"),ii=e=>e.dropTarget,kc=e=>["drag-drop","remove","set-title","splitter-resize","switch-tab"].includes(e.type),zc=()=>{let e=ai();return(0,Jn.jsx)("div",{children:`Context: ${e} `})},Nc=e=>{let{children:t,layout:o,onLayoutChange:n}=e,r=(0,Ee.useRef)(void 0),s=(0,Ee.useRef)(t),[,i]=(0,Ee.useState)(null),a=(0,Ee.useCallback)(d=>{if(n){let u=ze(d,ii)||r.current,h=$(u)==="DraggableLayout"?A(u).children[0]:u,g=Hs(h);n(g,"drag-root")}},[n]),l=(0,Ee.useCallback)((d,u=!1)=>{let m=oi(r.current,d);m!==r.current&&(r.current=m,i({}),!u&&kc(d)&&a(m))},[a]),c=(0,Ee.useCallback)(d=>{switch(d.type){case"drag-start":{p(d);break}case"save":{a(r.current);break}default:{l(d);break}}},[l,a]),p=si(r,c);return(0,Ee.useEffect)(()=>{if(o){let d=ze(r.current,ii),u=En(d),m=ko(o,`${d.props.path}.0`),h=u?{type:ue.REPLACE,target:u,replacement:m}:{type:ue.ADD,path:d.props.path,component:m};l(h,!0)}},[l,o]),r.current===void 0?r.current=Un(t):t!==s.current&&(r.current=Un(t,r.current),s.current=t),(0,Jn.jsx)(Lt.Provider,{value:{dispatchLayoutProvider:c,version:0},children:r.current})},xe=()=>{let{dispatchLayoutProvider:e}=(0,Ee.useContext)(Lt);return e},ai=()=>{console.log({LayoutProviderContext:Lt});let{version:e}=(0,Ee.useContext)(Lt);return e};var ci=require("react/jsx-runtime"),Qn=function(t){let{path:o}=t,n=xe(),r=(0,li.useCallback)(s=>{n({type:mt.SPLITTER_RESIZE,path:o,sizes:s})},[n,o]);return(0,ci.jsx)(Ho,{...t,onSplitterMoved:r})};Qn.displayName="Flexbox";Q("Flexbox",Qn,"container");var hi=require("@salt-ds/core"),bi=F(require("classnames")),_o=require("react");var Ce=require("react");var bt=require("react"),Bc=["height","width"],$c=["height"],Fc=["width"],ht=new WeakMap,ui=(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}},er=new ResizeObserver(e=>{for(let t of e){let{target:o,contentRect:n}=t,r=ht.get(o);if(r){let{onResize:s,measurements:i}=r,a=!1;for(let[l,c]of Object.entries(i)){let p=ui(o,n,l);p!==c&&(a=!0,i[l]=p)}a&&s&&s(i)}}});function tr(e,t,o,n=!1){console.log("resizeObserver container",{ref:e.current});let r=(0,bt.useRef)(t),s=(0,bt.useCallback)(i=>{let a=i.getBoundingClientRect();return r.current.reduce((l,c)=>(l[c]=ui(i,a,c),l),{})},[]);(0,bt.useLayoutEffect)(()=>{let i=e.current,a=!1;async function l(){ht.set(i,{measurements:{}}),a=!1;let{fonts:c}=document;if(c&&await c.ready,!a){let p=ht.get(i);if(p){let d=s(i);p.measurements=d,er.observe(i),n&&o(d)}}}if(i){if(ht.has(i))throw Error("useResizeObserver attemping to observe same element twice");l()}return()=>{i&&ht.has(i)&&(er.unobserve(i),ht.delete(i),a=!0)}},[e,s,n,o]),(0,bt.useLayoutEffect)(()=>{let i=e.current,a=ht.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 _c(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 Vc=([,e],[,t])=>t-e,nr=e=>Object.entries(e).sort(Vc).map(([t,o],n,r)=>[t,o,n<r.length-1?r[n+1][1]:9999]),or=null,Wc=(e="salt")=>{let{xs:t,sm:o,md:n,lg:r,xl:s}=_c(e);return nr({xs:t,sm:o,md:n,lg:r,xl:s})},pi=e=>(or===null&&(or=Wc(e)),or);var Gc=[],rr=({breakPoints:e,smallerThan:t},o)=>{let[n,r]=(0,Ce.useState)(t?!1:"lg"),s=(0,Ce.useRef)(document.body),i=(0,Ce.useRef)(e?nr(e):pi()),a=(0,Ce.useRef)("lg"),l=(0,Ce.useCallback)(p=>{if(i.current){for(let[d,u]of i.current)if(p>=u)return d}},[i]),c=(0,Ce.useCallback)(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 tr(o||s,i.current?["width"]:Gc,({width:p})=>{let d=c(p);d!==a.current&&(a.current=d,r(d))},!0),(0,Ce.useEffect)(()=>{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 di="data-collapsible",Kc={[di]:!0,"data-pad-start":!0,"data-pad-end":!0},mi=e=>{var t;return(t=Kc[e])!=null?t:!1},Zc=e=>e===di,Uc={dynamic:"dynamic",instant:"instant",true:"instant"},qc=e=>{var t;return(t=Uc[e])!=null?t:"none"},Xc=e=>Object.keys(e).reduce((t,o)=>{let[n,r]=t;if(mi(o)){let s=Zc(o)?qc(e[o]):e[o];n[o]=s,r[o]=void 0}return t},[{},{}]);var fi=require("@vuu-ui/vuu-utils"),Te=require("react");var Yc=["xs","sm","md","lg","xl"],jc=12,gi=({children:e,cols:t,style:o})=>{let n=(0,Te.useRef)(null),r=(0,Te.useRef)(null),s=(0,Te.useRef)(),i=t!=null?t:jc,l=(o==null?void 0:o.flexDirection)==="column"?"height":"width",c=(0,Te.useMemo)(()=>Array.isArray(e)?e:(0,Te.isValidElement)(e)?[e]:[],[e]),p=(0,Te.useCallback)((d,u)=>{let m=Ao(d,u,Yc),h=[],g=[];for(let b=0;b<d.length;b++){let f=d[b],{style:{flex:y,...T}}=f.props;h.push((0,Te.cloneElement)(f,{key:(0,fi.getUniqueId)(),style:{...T,"--parent-col-count":i}})),g.push(m[b])}return[h,g]},[i]);return(0,Te.useMemo)(()=>{let[d,u]=p(c,l);r.current=u,s.current=d},[p,c,l]),{cols:i,content:s.current,rootRef:n}};var yi=require("react/jsx-runtime"),Fo="hwFluidGrid",Vo=(0,_o.forwardRef)(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=(0,_o.useMemo)(()=>ut(r),[r]),{cols:v,content:E,rootRef:D}=gi({children:x,cols:i,style:y}),P=rr({breakPoints:n},D),k=(0,bi.default)(Fo,a,{[`${Fo}-column`]:s,[`${Fo}-row`]:h,[`${Fo}-show-grid`]:g,"flex-fill":l,"full-page":p}),C={...y,"--spacing":b,"--grid-col-count":v,"--grid-gap":c};return(0,yi.jsx)("div",{...T,className:k,"data-breakpoint":P,"data-cols":v,"data-resizeable":m||void 0,id:d,ref:(0,hi.useForkRef)(D,o),style:C,children:E})});Vo.displayName="FluidGrid";var Ei=require("react/jsx-runtime"),sr=function(t){return(0,Ei.jsx)(Vo,{...t})};sr.displayName="FluidGrid";Q("FluidGrid",sr,"container");var ya=F(require("classnames")),rt=F(require("react"));var ot=require("react");var no=(e,t,o,n)=>{var b;let{loadSessionState:r,purgeSessionState:s,purgeState:i,saveSessionState:a}=gt(),[l,c]=(0,ot.useState)((b=r(e,"contributions"))!=null?b:[]),p=xe(),d=(0,ot.useCallback)((f,y)=>{let T=l.concat([{location:f,content:y}]);a(e,"contributions",T),c(T)},[l,e,a]),u=(0,ot.useCallback)(()=>{s(e,"contributions"),c([])},[e,s]),m=(0,ot.useCallback)(()=>{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=(0,ot.useCallback)(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[(0,ot.useCallback)(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]};var Go=require("@salt-ds/core"),vi=F(require("classnames")),he=F(require("react"));var Oe=require("react");var xi=({id:e,rootRef:t,path:o,dropTargets:n,title:r})=>{let s=xe(),{loadState:i,loadSessionState:a,purgeState:l,saveState:c,saveSessionState:p}=gt(),[d,u]=no(e,t,o,n),m=(0,Oe.useMemo)(()=>{var E;return(E=i("view-title"))!=null?E:r},[i,r]),h=(0,Oe.useCallback)(E=>{o&&s({type:"set-title",path:o,title:E})},[s,o]),g=(0,Oe.useMemo)(()=>i(e),[e,i]),b=(0,Oe.useCallback)(E=>i(e,E),[e,i]),f=(0,Oe.useCallback)(E=>{l(e,E),s({type:"save"})},[e,s,l]),y=(0,Oe.useCallback)((E,D)=>{c(e,D,E),s({type:"save"})},[e,s,c]),T=(0,Oe.useCallback)(E=>a(e,E),[e,a]),x=(0,Oe.useCallback)((E,D)=>p(e,D,E),[e,p]),v=(0,Oe.useCallback)(({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}};var Wo=require("@heswell/salt-lab"),It=require("react"),Jc=[],Ti=({mainRef:e,resize:t="responsive",rootRef:o})=>{let n=t==="defer",r=(0,It.useRef)({}),s=(0,It.useRef)(),i=(0,It.useCallback)(()=>{e.current&&(e.current.style.height=r.current.height+"px",e.current.style.width=r.current.width+"px"),s.current=void 0},[e]),a=(0,It.useCallback)(({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]);(0,Wo.useResizeObserver)(o,n?Wo.WidthHeight:Jc,a,n)};var ro=F(require("react")),Qc={dispatch:null},so=ro.default.createContext(Qc),ir=()=>{var t;let e=(0,ro.useContext)(so);return(t=e==null?void 0:e.dispatch)!=null?t:null},eu=()=>(0,ro.useContext)(so);var Ct=require("react/jsx-runtime"),io="vuuView",tu=(e,t)=>e&&t?{...e,...t}:e||t,Di=(0,he.forwardRef)(function(t,o){let{Header:n=ar,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=(0,Go.useIdMemo)(m),P=(0,he.useRef)(null),k=(0,he.useRef)(null),[C,M]=(0,he.useState)(),{contributions:w,dispatchViewAction:R,load:O,loadSession:I,onConfigChange:S,onEditTitle:L,purge:H,restoredState:K,save:V,saveSession:_,title:U}=xi({id:D,rootRef:P,path:b,dropTargets:p,title:v});Ti({mainRef:k,resize:f,rootRef:P});let se=(0,he.useCallback)(N=>{M(N)},[]),W=()=>he.default.isValidElement(r)&&(K||C)?he.default.cloneElement(r,tu(K,C)):r,Y=(0,he.useMemo)(()=>({dispatch:R,id:D,path:b,title:U,load:O,loadSession:I,onConfigChange:S,purge:H,save:V,saveSession:_,setComponentProps:se}),[R,D,O,I,S,b,H,V,_,se,U]),z=typeof h=="object"?h:{};return(0,Ct.jsx)("div",{...E,className:(0,vi.default)(io,s,{[`${io}-collapsed`]:i,[`${io}-expanded`]:d,[`${io}-resize-defer`]:f==="defer"}),"data-resizeable":y,id:D,ref:(0,Go.useForkRef)(o,P),style:x,tabIndex:-1,children:(0,Ct.jsxs)(so.Provider,{value:Y,children:[h?(0,Ct.jsx)(n,{...z,collapsed:i,contributions:w,expanded:d,closeable:a,onEditTitle:L,orientation:g,tearOut:T,title:U}):null,(0,Ct.jsx)("div",{className:`${io}-main`,ref:k,children:W()})]})})});Di.displayName="View";var Ge=he.default.memo(Di);Ge.displayName="View";Q("View",Ge,"view");var Ue=require("@heswell/salt-lab"),Ea=require("@salt-ds/icons");function wi(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=wi(e[t]))&&(n&&(n+=" "),n+=o);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function Ko(){for(var e,t,o=0,n="";o<arguments.length;)(e=arguments[o++])&&(t=wi(e))&&(n&&(n+=" "),n+=t);return n}var Ae=require("react"),cr=require("@salt-ds/core"),Ri=require("@heswell/salt-lab");var ur=require("react/jsx-runtime"),lr="vuuEditableLabel",Zo=(0,Ae.forwardRef)(function({className:t,defaultEditing:o,defaultValue:n,editing:r,onChange:s,onEnterEditMode:i,onExitEditMode:a,value:l,...c},p){let d=(0,Ae.useRef)(null),u=(0,Ae.useRef)(!1),[m,h]=(0,cr.useControlled)({controlled:l,default:n!=null?n:"",name:"EditableLabel",state:"value"}),[g,b]=(0,cr.useControlled)({controlled:r,default:o!=null?o:!1,name:"EditableLabel",state:"editing"}),f=(0,Ae.useCallback)(C=>{b(u.current=C)},[]),y=(0,Ae.useRef)(m);(0,Ae.useLayoutEffect)(()=>{g&&d.current!==null&&(d.current.select(),d.current.focus())},[g,d]);let T=(0,Ae.useCallback)(()=>{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=Ko(lr,t,{[`${lr}-editing`]:g});return(0,ur.jsx)("div",{...c,className:k,onDoubleClick:E,"data-text":m,ref:p,children:g?(0,ur.jsx)(Ri.Input,{inputProps:{className:`${lr}-input`},value:m,onBlur:D,onChange:v,onKeyDown:P,ref:d,style:{padding:0},textAlign:"left"}):m})});var sa=require("@salt-ds/core"),ia=F(require("classnames")),kt=F(require("react"));var pe=require("react");var Ot=require("react"),su=require("react/jsx-runtime"),ou={isDragSource:!1,isDropTarget:!1,register:()=>{}},nu=()=>console.log("have you forgotten to provide a DragDrop Provider ?"),ru=(0,Ot.createContext)({registerDragDropParty:nu});var Si=e=>{var r,s;let{dragSources:t,dropTargets:o,registerDragDropParty:n}=(0,Ot.useContext)(ru);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 ou};var ae=require("react");var Pe=require("react");var iu=["left","right"],au=["top","bottom"],Uo=":not(.wrapped)",Pi=':not([aria-hidden="true"])',Mi=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"}},Se=e=>cu[e],Li=(e,t)=>{let o=e.find(n=>n.id===t);if(o)return o},Ii=(e,t)=>{e.splice(t,1);for(let o=t;o<e.length;o++)e[o].currentIndex-=1},At=(e,t,o,n,r)=>{var d;let s=[],{DIMENSION:i}=Se(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},ao=e=>e.findIndex(t=>t.isDraggedItem),pr=(e,t)=>{let o=ao(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)}},Ht=(e,t,o)=>{let n=e.length,r=ao(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 Ci(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)}}var Oi=require("@salt-ds/core");var qo=require("react"),Ai=require("@vuu-ui/vuu-popups");var dr=require("react/jsx-runtime"),uu=e=>e.split(" ").map(t=>`vuuDraggable-${t}`),Xo=(0,qo.forwardRef)(function({wrapperClassName:t,element:o,onTransitionEnd:n,style:r,scale:s=1},i){let a=(0,qo.useCallback)(c=>{c&&(c.innerHTML="",c.appendChild(o),s!==1&&(c.style.transform=`scale(${s},${s})`))},[o,s]),l=(0,Oi.useForkRef)(i,a);return(0,dr.jsx)(Ai.Portal,{children:(0,dr.jsx)("div",{className:Ko("vuuDraggable",...uu(t)),ref:l,onTransitionEnd:n,style:r})})}),mr=e=>{let t=document.createElement("div");return t.className="vuuDraggable-spacer",e&&t.addEventListener("transitionend",()=>{e.current=!1}),t},Hi=()=>{let e=document.createElement("div");return e.className="vuuDraggable-dropIndicatorPosition",e},ki=e=>{let t=document.createElement("div");return t.className="vuuDraggable-dropIndicator",e&&t.addEventListener("transitionend",()=>{e.current=!1}),t};var zi=()=>{let e=(0,Pe.useRef)(0),t=(0,Pe.useRef)(!1),o=(0,Pe.useMemo)(()=>[mr(t),mr()],[]),n=(0,Pe.useCallback)(()=>o.forEach(c=>c.remove()),[o]),r=(0,Pe.useCallback)((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=(0,Pe.useCallback)(()=>{e.current&&(cancelAnimationFrame(e.current),e.current=0)},[]),i=(0,Pe.useCallback)(()=>{n()},[n]),a=(0,Pe.useCallback)((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"&&pr(c,m)}},[r,s,n,o]),l=(0,Pe.useCallback)((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"&&pr(c,m)},[r,s,n,o]);return{clearDisplacedItem:i,displaceItem:a,displaceLastItem:l,clearSpacers:n}};var Ni=({draggableRef:e,onDrop:t,orientation:o="horizontal",containerRef:n,itemQuery:r="*",selected:s,viewportRange:i})=>{let a=(0,ae.useRef)(),l=(0,ae.useRef)(!1),c=(0,ae.useRef)(-1),p=(0,ae.useRef)([]),d=(0,ae.useRef)(!1),[u,m]=(0,ae.useState)(!1),{clearDisplacedItem:h,clearSpacers:g,displaceItem:b,displaceLastItem:f}=zi(),y=(0,ae.useRef)(),T=`:is(${r}${Uo}${Pi},.vuuOverflowContainer-OverflowIndicator)`,x=R=>p.current.findIndex(O=>O.id===R.id),v=(0,ae.useRef)();v.current=i;let E=(0,ae.useCallback)(()=>{h()},[h]),D=(0,ae.useCallback)((R,O,I)=>{let{current:S}=n,{current:L}=y;if(S&&L){p.current=At(S,o,T,v.current);let{size:H}=L,V=c.current+H/2,{current:_}=p,U=Ht(_,V,"fwd");if(U){let W=x(U),Y=_[W];I&&R==="fwd"?f(_,_[_.length-1],H,!1,"static",o):b(_,Y,H,!0,"static",o)}}},[n,b,f,T,o]),P=(0,ae.useCallback)(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}=Se(o),{id:K}=I,{[L]:V,[H]:_}=S;l.current=V>_;let U=p.current=At(S,o,T,i,K);console.log({dropTargets:U});let se=ao(U),W=U[se];W&&S&&(y.current=W,(W.isLast?f:b)(U,W,W.size,!1,"static",o))}},[n,b,f,T,r,o,s,i]),[k,C]=(0,ae.useMemo)(()=>{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=(0,ae.useCallback)((R,O)=>{let{current:I}=y;if(I&&e.current&&n.current){c.current=R;let{current:S}=p,L=Ht(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 _=S.at(-1);C(_),m(d.current=!1)}a.current=O}},[n,b,f,e,C,o,k]),w=(0,ae.useCallback)(()=>{var S;g();let{current:R}=p,O=ao(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}};var te=require("react");var lo=require("react");var Bi=()=>{let e=(0,lo.useMemo)(()=>Hi(),[]),t=(0,lo.useCallback)(()=>e.remove(),[e]);return{positionDropIndicator:(0,lo.useCallback)((n,r="end")=>(r==="end"?n.element.after(e):n.element.before(e),e),[e]),clearSpacer:t}};var Fi=require("react/jsx-runtime"),pu=':not([data-overflowed="true"])',du=':not([aria-hidden="true"])',$i=({draggableRef:e,onDrop:t,orientation:o="horizontal",containerRef:n,itemQuery:r="*",selected:s,viewportRange:i})=>{let a=(0,te.useRef)(),l=(0,te.useRef)(null),c=(0,te.useRef)(null),p=(0,te.useRef)(""),d=(0,te.useRef)(!1),u=(0,te.useRef)(-1),m=(0,te.useRef)([]),h=(0,te.useRef)(!1),[g,b]=(0,te.useState)(!1),[f,y]=(0,te.useState)(),{clearSpacer:T,positionDropIndicator:x}=Bi(),v=(0,te.useRef)(),E=`:is(${r}${pu}${du},[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=(0,te.useRef)();k.current=i;let C=(0,te.useCallback)(()=>{T()},[T]),M=(0,te.useCallback)((I,S,L)=>{let{current:H}=n,{current:K}=v;if(H&&K){m.current=At(H,o,E,k.current);let{size:V}=K,U=u.current+V/2,{current:se}=m,W=Ht(se,U,"fwd");W&&x(L&&I==="fwd"?se[se.length-1]:W,"start")}},[n,x,E,o]),w=(0,te.useCallback)(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:K,CLIENT_SIZE:V}=Se(o),{id:_}=L,{[K]:U,[V]:se}=H;d.current=U>se;let W=m.current=At(H,o,E,i),Y=Li(W,_);if(Y&&H){let z=D(Y);Ii(W,z),v.current=Y;let{current:N}=k;if(N!=null&&N.atEnd)for(let j=0;j<W.length;j++)P(W[j],Y.size);for(let j=z;j<W.length;j++)P(W[j],-Y.size,-1);let[q,ye]=Y.isLast?[W[W.length-1],"end"]:[W[z],"start"];c.current=q,p.current=ye;let qe=x(q,ye),{top:G,left:X,width:oe}=qe.getBoundingClientRect(),ne={top:Y.isLast?N!=null&&N.atEnd&&!N.atStart?G+Y.size-2:G-2:G-Y.size-2,left:X,width:oe,height:2};y((0,Fi.jsx)(Xo,{wrapperClassName:"dropIndicatorContainer",style:ne,ref:l,element:ki()}))}}},[r,s,n,o,E,i,x]),R=(0,te.useCallback)((I,S)=>{let{current:L}=c,{current:H}=v;if(H&&e.current&&n.current){let K=o==="horizontal"?"left":"top";u.current=I;let{current:V}=m,_=Ht(V,I,S);if(_&&_.index!==(L==null?void 0:L.index)){if(_.isOverflowIndicator)b(h.current=!0);else if(l.current){if(D(_)===V.length-1){let se=V[V.length-1],Y=x(se,"start").getBoundingClientRect();l.current.style[K]=`${Y.top}px`}else{let W=x(_,"start").getBoundingClientRect();l.current.style[K]=`${W.top}px`}b(h.current=!1)}c.current=_,a.current=S}}},[e,n,o,x]),O=(0,te.useCallback)(()=>{T();let{current:I}=v,{current:S}=c,{current:L}=p,{current:H}=k;if(I&&H&&S){let{index:K}=I,V=L==="start",{index:_,currentIndex:U}=S;c.current=null,a.current=void 0,h.current?t(K,-1):K<_?t(K,V?U:U+1):t(K,V?_:_+1),y(void 0)}b(!1)},[T,t]);return{beginDrag:w,drag:R,drop:O,dropIndicator:f,handleScrollStart:C,handleScrollStop:M,revealOverflowedItems:g}};var Z=require("react");var nt=require("react");var _i=({containerRef:e,onScrollingStopped:t,orientation:o="vertical"})=>{let n=(0,nt.useRef)(null),r=(0,nt.useRef)(!1),s=(0,nt.useRef)(0),i=(0,nt.useRef)("fwd"),a=(0,nt.useCallback)((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=(0,nt.useCallback)((c,p,d=30)=>{let{current:u}=e;if(u){let{SCROLL_POS:m,SCROLL_SIZE:h,CLIENT_SIZE:g}=Se(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}};var Gi=require("react/jsx-runtime"),mu={beginDrag:()=>{},drag:()=>{},draggableRef:{current:null},drop:()=>{},isDragging:!1,isScrolling:!1,handleScrollStart:()=>{},handleScrollStop:()=>{},revealOverflowedItems:!1},Vi={start:0,end:1e3,contraStart:0,contraEnd:1e3},fu=()=>mu,gu=3,hu=(e,t)=>e.closest(t),bu=e=>e.dataset.index==="overflow"&&e.parentElement!==null&&e.parentElement.classList.contains("overflowed"),yu=(e,t)=>{let o=`:is(${t}${Uo},.vuuOverflowContainer-OverflowIndicator)`,r=Array.from(e.querySelectorAll(o)).pop();return[r,bu(r)]},Wi=({allowDragDrop:e,containerRef:t,draggableClassName:o,itemQuery:n="*",onDragStart:r,onDrop:s,onDropSettle:i,orientation:a,...l})=>{let c=(0,Z.useRef)({start:0,end:0,contraStart:0,contraEnd:0}),[p,d]=(0,Z.useState)({draggable:void 0,draggedItemIndex:-1,isDragging:!1}),u=(0,Z.useRef)(null),m=(0,Z.useRef)(),h=(0,Z.useRef)(null),g=(0,Z.useRef)(!1),b=(0,Z.useRef)({x:0,y:0}),f=(0,Z.useRef)({x:0,y:0}),y=(0,Z.useRef)({x:0,y:0}),T=(0,Z.useRef)(null),x=(0,Z.useRef)(-1),v=(0,Z.useRef)(-1),E=(0,Z.useRef)(),{isDragSource:D,isDropTarget:P,register:k}=Si(l.id);l.id&&(D||P)&&k(l.id);let C=(0,Z.useCallback)(()=>{var oe;let{current:G}=v,X=(oe=t.current)==null?void 0:oe.querySelector(`${n}[data-index="${G}"]`);X&&X.classList.remove("vuuDropTarget-settling"),v.current=-1,i==null||i(G),d(ne=>({...ne,draggable:void 0}))},[t,n,i]),M=(0,Z.useCallback)(G=>{if(t.current){let{POS:X,SCROLL_POS:oe,SCROLL_SIZE:ne,CLIENT_SIZE:j}=Se(a),{[oe]:Me,[ne]:$t,[j]:lt}=t.current,vt=$t-lt,Dt=Me<vt,Ft=c.current.end,wt=Me>0&&G-b.current[X]<=c.current.start,Rt=Dt&&G-b.current[X]>=Ft;return wt?"bwd":Rt?"fwd":""}},[t,a]),w=e===!0||e==="natural-movement"?Ni:e==="drop-indicator"?$i:fu,R=(0,Z.useCallback)((G,X,oe)=>{var ne;(ne=E.current)==null||ne.call(E,G,X,oe)},[]),{isScrolling:O,startScrolling:I,stopScrolling:S}=_i({containerRef:t,onScrollingStopped:R,orientation:a}),L=(0,Z.useCallback)((G,X)=>{x.current=X,s==null||s(G,X),v.current=X},[s]),{beginDrag:H,drag:K,drop:V,handleScrollStart:_,handleScrollStop:U,...se}=w({...l,containerRef:t,draggableRef:u,isDragSource:D,isDropTarget:P,itemQuery:n,onDrop:L,orientation:a});E.current=U;let W=(0,Z.useCallback)(G=>{let{CLIENT_POS:X,CONTRA_CLIENT_POS:oe,CONTRA_POS:ne,POS:j}=Se(a),{clientX:Me,clientY:$t}=G,{[X]:lt,[oe]:vt}=G,Dt=f.current[j],Ft=f.current[ne],wt=Math.abs(Dt-lt);if((D?Math.abs(Ft-vt):0)-wt>5&&(c.current=Vi),f.current.x=Me,f.current.y=$t,c.current===Vi&&u.current){let _t=f.current.x-b.current.x,ct=f.current.y-b.current.y;u.current.style.top=`${ct}px`,u.current.style.left=`${_t}px`}else if(wt>0&&u.current){let _t=Dt<lt?"fwd":"bwd",ct=M(lt),dn=f.current[j]-b.current[j];if(ct&&g.current&&!O.current?(_(),I(ct,1)):!ct&&O.current&&S(),!O.current){let po=Math.round(Math.max(c.current.start,Math.min(c.current.end,dn))),$e=a==="horizontal"?"left":"top";u.current.style[$e]=`${po}px`,K(po,_t)}}},[K,u,M,_,D,O,a,I,S]),Y=(0,Z.useCallback)(()=>{document.removeEventListener("mousemove",W,!1),document.removeEventListener("mouseup",Y,!1),T.current=u.current,V(),d(G=>({...G,draggedItemIndex:-1,isDragging:!1})),m.current=void 0},[W,u,V]),z=(0,Z.useCallback)(G=>{let{clientX:X,clientY:oe,target:ne}=G,j=hu(ne,n),{current:Me}=t;if(Me&&j){let{CONTRA:$t,CONTRA_END:lt,DIMENSION:vt,END:Dt,SCROLL_SIZE:Ft,CLIENT_SIZE:wt,START:Rt}=Se(a);m.current=j;let{[Ft]:_t,[wt]:ct}=Me;g.current=_t>ct;let[dn,po]=yu(Me,n),$e=Me.getBoundingClientRect(),mo=j.getBoundingClientRect(),mn=mo[vt],{[Rt]:Ga,[Dt]:Ka}=dn.getBoundingClientRect();b.current.x=X-mo.left,b.current.y=oe-mo.top,c.current.start=$e[Rt],c.current.end=po?Math.max(Ga,$e.right-mn):g.current?$e[Rt]+$e[vt]-mn:Ka-mn,c.current.contraStart=$e[$t],c.current.contraEnd=$e[lt],H(G);let{dataset:{index:Za="-1"}}=j;d({isDragging:!0,draggable:(0,Gi.jsx)(Xo,{element:Mi(j),onTransitionEnd:C,ref:u,style:Ci(mo,$e),wrapperClassName:o}),draggedItemIndex:parseInt(Za)}),r==null||r(),document.addEventListener("mousemove",W,!1),document.addEventListener("mouseup",Y,!1)}},[H,t,W,Y,o,u,n,r,a,C]),N=(0,Z.useCallback)(G=>{let{CLIENT_POS:X,POS:oe}=Se(a),{[X]:ne}=G;Math.abs(ne-y.current[oe])>gu&&t.current&&(h.current&&(window.clearTimeout(h.current),h.current=null),document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",q,!1),z(G))},[t,H,a]),q=(0,Z.useCallback)(()=>{h.current&&(window.clearTimeout(h.current),h.current=null),document.removeEventListener("mousemove",N,!1),document.removeEventListener("mouseup",q,!1)},[N]),ye=(0,Z.useCallback)(G=>{console.log("useDragDropNext onMouseDown");let{current:X}=t;if(X&&!G.defaultPrevented){let{clientX:oe,clientY:ne}=G;f.current.x=y.current.x=oe,f.current.y=y.current.y=ne,document.addEventListener("mousemove",N,!1),document.addEventListener("mouseup",q,!1),G.persist(),h.current=window.setTimeout(()=>{document.removeEventListener("mousemove",N,!1),document.removeEventListener("mouseup",q,!1),z(G.nativeEvent)},500)}},[t,z,N,q]),{current:qe}=T;return(0,Z.useLayoutEffect)(()=>{if(qe&&t.current){let G=x.current,X=t.current.querySelector(`${n}[data-index="${G}"]`);X?(X.classList.add("vuuDropTarget-settling"),requestAnimationFrame(()=>{let{top:oe,left:ne}=X.getBoundingClientRect(),{top:j,left:Me}=qe.getBoundingClientRect();Me!==ne||j!==oe?(qe.classList.add("vuuDraggable-settling"),qe.style.top=`${oe}px`,qe.style.left=`${ne}px`):C()})):console.log(`dont have the dropped item (at ${G})`),T.current=null}},[t,n,qe,C]),{...se,...p,isScrolling:O,onMouseDown:e?ye:void 0}};var Ki=e=>typeof e=="object"&&e!==null&&"tabIndex"in e&&typeof e.tabIndex=="number",Zi=e=>({label:"Close",location:"tab",action:"close-tab",options:e}),Ui=e=>({label:"Rename",location:"tab",action:"rename-tab",options:e});var Eu=e=>{if(e){let t=parseInt(e.dataset.index||"");if(!isNaN(t))return t}return-1},qi=(e,t)=>{if(e){let o=e.querySelector(`[data-index]:has(${t})`);return Eu(o)}return-1},fr=e=>qi(e,'[aria-selected="true"]'),Xi=e=>qi(e,".vuuEditableLabel-editing");var Ke=require("react"),Yi=(e,t)=>{let o=(0,Ke.useRef)(!1),n=(0,Ke.useCallback)(()=>{o.current=!0},[]),r=(0,Ke.useCallback)(()=>{o.current=!1},[]),s=(0,Ke.useCallback)(()=>{var a,l;(a=e.current)==null||a.style.setProperty("--tab-thumb-transition","none"),(l=e.current)==null||l.removeEventListener("transitionend",s)},[e]),i=(0,Ke.useRef)(-1);return(0,Ke.useMemo)(()=>{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])};var Ji=require("@salt-ds/core"),Qi=require("@vuu-ui/vuu-utils"),le=require("react"),be=require("@vuu-ui/vuu-utils");var ea={horizontal:{[be.Home]:"start",[be.End]:"end",[be.ArrowLeft]:"bwd",[be.ArrowRight]:"fwd"},vertical:{[be.Home]:"start",[be.End]:"end",[be.ArrowUp]:"bwd",[be.ArrowDown]:"fwd"}},xu=(e,t="horizontal")=>ea[t][e]!==void 0,Tu=e=>e===be.ArrowDown;function ji(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 vu=e=>e!==null&&!e.classList.contains("wrapped"),Yo=(e,t)=>e?e.querySelector(`[data-index="${t}"]`):null,ta=({containerRef:e,defaultHighlightedIdx:t=-1,highlightedIdx:o,keyBoardActivation:n,orientation:r,selectedIndex:s=0})=>{let i=n==="manual",a=(0,le.useRef)(!1),l=(0,le.useRef)(-1),[c,p]=(0,le.useState)(!1),[,d]=(0,le.useState)({}),[u,m]=(0,Ji.useControlled)({controlled:o,default:t,name:"UseKeyboardNavigation"}),h=(0,le.useCallback)(w=>{m(l.current=w)},[m]),g=(0,le.useRef)(!1),b=(0,le.useCallback)((w,R=!1,O,I=70)=>{h(w),O===!0&&!g.current&&(g.current=!0);let S=()=>{let L=Yo(e.current,w);if(L){let H=(0,Qi.getFocusableElement)(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=Xi(e.current);R!==-1?requestAnimationFrame(()=>{h(R)}):setTimeout(()=>{l.current===-1&&s!==null&&h(s)},200)}},y=(0,le.useCallback)(()=>{var w,R;return(R=(w=e.current)==null?void 0:w.querySelectorAll("[data-index]").length)!=null?R:0},[e]),T=(0,le.useCallback)((w="fwd",R)=>{let O=y(),S=ji(O,w,typeof R=="number"?R:O),L=w==="start"?"fwd":w==="end"?"bwd":w;for(;(L==="fwd"&&S<O||L==="bwd"&&S>0)&&!vu(Yo(e.current,S));){let H=ji(O,L,S);if(H===S)break;S=H}return S},[e,y]),x=(0,le.useCallback)((w,R=!1)=>{let O=ea[r][w.key],I=T(O,u);I!==u?i&&b(I,!0):R&&d({})},[u,i,T,b,r]),v=(0,le.useCallback)(()=>{let w=Yo(e.current,u);return w?w.querySelector(".vuuPopupMenu")!=null:!1},[e,u]),E=(0,le.useCallback)(()=>{let w=Yo(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=(0,le.useCallback)(w=>{y()>0&&xu(w.key,r)?(w.preventDefault(),g.current?x(w):(g.current=!0,x(w,!0))):Tu(w.key)&&v()&&E()},[E,y,v,x,r]),P=(w,R)=>{h(R)},k=(0,le.useCallback)(()=>{c||(p(!0),a.current?a.current=!1:g.current=!0)},[c]),C=(0,le.useCallback)(()=>{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}};var oa=require("@salt-ds/core"),co=require("react"),Du=["Enter"," "],wu=e=>e&&e.matches('[class*="vuuTab "]'),na=({defaultSelected:e,highlightedIdx:t,onSelectionChange:o,selected:n})=>{let[r,s,i]=(0,oa.useControlled)({controlled:n,default:e!=null?e:0,name:"Tabstrip",state:"value"}),a=(0,co.useCallback)(d=>Du.includes(d.key),[]),l=(0,co.useCallback)(d=>{s(d),o==null||o(d)},[o,s]),c=(0,co.useCallback)(d=>{let u=d.target;a(d)&&t!==r&&wu(u)&&(d.stopPropagation(),d.preventDefault(),l(t))},[a,t,r,l]),p=(0,co.useCallback)((d,u)=>{u!==r&&l(u)},[l,r]);return{activateTab:l,isControlled:i,onClick:p,onKeyDown:c,selected:r}};var Ru=new Set(["Enter"," "]),Su=e=>Ru.has(e),Pu=(e,t)=>e?e.querySelector(`[data-index="${t}"]`):null,ra=({activeTabIndex:e,allowDragDrop:t,animateSelectionThumb:o,containerRef:n,onActiveChange:r,onAddTab:s,onCloseTab:i,onExitEditMode:a,onMoveTab:l,orientation:c,keyBoardActivation:p})=>{let d=(0,pe.useRef)(e),{focusTab:u,highlightedIdx:m,onClick:h,onKeyDown:g,setHighlightedIdx:b,...f}=ta({containerRef:n,keyBoardActivation:p,orientation:c,selectedIndex:d.current}),{activateTab:y,onClick:T,onKeyDown:x,selected:v}=na({highlightedIdx:m,onSelectionChange:r,selected:e});d.current=v;let{containerStyle:E,resumeAnimation:D,suspendAnimation:P}=Yi(n,o?v:-1),k=(0,pe.useCallback)((z,N)=>{let{current:q}=d;console.log(`useTabstrip handleDrop ${z} - ${N} ${q}`),l==null||l(z,N);let ye=-1;N!==-1&&(q===z?ye=N:z>q&&N<=q?ye=q+1:z<q&&N>=q&&(ye=q-1),ye!==-1&&(P(),y(ye),requestAnimationFrame(D)),u(N,!1,!1,350))},[u,l,D,y,P]),{onMouseDown:C,...M}=Wi({allowDragDrop:t,containerRef:n,draggableClassName:`tabstrip-${c}`,onDrop:k,orientation:"horizontal",itemQuery:".vuuOverflowContainer-item"}),w=(0,pe.useCallback)((z,N,q,ye)=>{console.log(`handleExitEditMode ${z} ${N} ${q} ${ye}`),a==null||a(z,N,q,ye),q||u(ye,!1,!0)},[u,a]),R=(0,pe.useCallback)((z,N)=>{h(z,N),T(z,N)},[h,T]),O=(0,pe.useCallback)((z=m)=>{let N=Pu(n.current,z);if(N)return N.querySelector(".vuuEditableLabel")},[n,m]),I=(0,pe.useCallback)((z=m)=>{let N=O(z);return N?N.classList.contains("vuuEditableLabel-editing"):!1},[O,m]),S=(0,pe.useCallback)((z=m)=>{let N=O(z);if(N){let q=new MouseEvent("dblclick",{view:window,bubbles:!0,cancelable:!0});N.dispatchEvent(q)}},[O,m]),L=(0,pe.useCallback)(z=>{g(z),z.defaultPrevented||x(z),!z.defaultPrevented&&Su(z.key)&&S()},[S,g,x]),H=(0,pe.useCallback)(z=>{let N=fr(n.current),q=N>z?N-1:N===z?0:N;return P(),i==null||i(z,q),setTimeout(()=>{D()},200),!0},[n,i,D,P]),K=(0,pe.useCallback)(z=>(S(z),!0),[S]),V=(0,pe.useCallback)(z=>{if(Ki(z.options))switch(z.menuId){case"close-tab":return H(z.options.tabIndex);case"rename-tab":return K(z.options.tabIndex);default:console.log(`tab menu action ${z.menuId}`)}return!1},[H,K]),_=(0,pe.useCallback)(()=>{I()?b(m):u(m)},[m,u,b,I]),U=(0,pe.useCallback)(z=>{let N=parseInt(z.index);isNaN(N)||y(N)},[y]),se={onFocus:f.onFocus,onKeyDown:L},W=(0,pe.useCallback)(()=>{s==null||s(),requestAnimationFrame(()=>{let z=fr(n.current);z!==-1&&u(z)})},[n,u,s]),Y={onClick:R,onKeyDown:L,onExitEditMode:w,onMenuAction:V,onMenuClose:_,onMouseDown:C};return{activeTabIndex:v,containerStyle:E,focusVisible:f.focusVisible,containerProps:{...f.containerProps,onSwitchWrappedItemIntoView:U},navigationProps:se,onClickAddTab:W,tabProps:Y,...M}};var zt=require("react/jsx-runtime"),la=require("react"),gr="vuuTabstrip",aa=({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=(0,kt.useRef)(null),{activeTabIndex:v,focusVisible:E,containerStyle:D,draggedItemIndex:P,onClickAddTab:k,tabProps:C,...M}=ra({activeTabIndex:e,allowDragDrop:n,animateSelectionThumb:s,containerRef:x,keyBoardActivation:c,onActiveChange:d,onAddTab:u,onCloseTab:m,onExitEditMode:h,onMoveTab:g,orientation:b}),w=Wt(l),R=(0,ia.default)(gr,`${gr}-${b}`,a),O=y||D?{...y,...D}:void 0,I=(0,kt.useMemo)(()=>ut(i).map((S,L)=>{let{id:H=`${w}-tab-${L}`,closeable:K=o,editable:V=r,showMenuButton:_=f}=S.props,U=L===v;return kt.default.cloneElement(S,{...C,...M.navigationProps,closeable:K,"data-overflow-priority":U?"1":void 0,dragging:P===L,editable:V,focusVisible:E===L,id:H,index:L,location:p,selected:U,showMenuButton:_,tabIndex:U?0:-1})}).concat(t?(0,la.createElement)(sa.Button,{...M.navigationProps,"aria-label":"Create Tab",className:`${gr}-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(0,zt.jsxs)(zt.Fragment,{children:[(0,zt.jsx)(hr,{...T,...M.containerProps,className:R,height:28,id:w,overflowIcon:"more-horiz",ref:x,style:O,children:I}),M.draggable]})};var ga=require("@salt-ds/core"),ha=F(require("classnames")),xt=require("react");var ca=require("@vuu-ui/vuu-popups"),ua=require("react"),pa=F(require("classnames"));var ma=require("react/jsx-runtime"),Mu="vuuTabMenu",da=({allowClose:e,allowRename:t,location:o,onMenuAction:n,onMenuClose:r,index:s})=>{let[i,a]=(0,ua.useMemo)(()=>[(l,c)=>{let p=[];return t&&p.push(Ui(c)),e&&p.push(Zi(c)),p},{tabIndex:s}],[e,t,s]);return(0,ma.jsx)(ca.PopupMenu,{className:Mu,menuBuilder:i,menuActionHandler:n,menuLocation:(0,pa.default)("tab",o),menuOptions:a,onMenuClose:r,tabIndex:-1})};var Et=require("react/jsx-runtime"),yt="vuuTab",fa=()=>{},ba=(0,xt.forwardRef)(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=fa,onExitEditMode:g=fa,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=(0,xt.useRef)(null),M=(0,xt.useRef)(null),w=(0,ga.useForkRef)(k,C),R=(0,xt.useCallback)(H=>{a||(H.preventDefault(),u==null||u(H,c))},[a,c,u]),O=(H="",K="",V=!0)=>g(H,K,V,c),I=H=>{switch(H.key){case"Backspace":case"Delete":r&&(H.stopPropagation(),m&&m(c));break;default:f&&f(H,c)}},S=()=>i?(0,Et.jsx)(Zo,{editing:a,defaultValue:p,onEnterEditMode:h,onExitEditMode:O,ref:M},p):p,L=H=>{if(M.current){let V=M.current.querySelector(".vuuEditableLabel-input");V==null||V.focus()}b==null||b(H)};return(0,Et.jsxs)("div",{...P,"aria-controls":t,"aria-selected":v,className:(0,ha.default)(yt,{[`${yt}-closeable`]:r,"vuuDraggable-dragAway":s,[`${yt}-editing`]:a,[`${yt}-selected`]:v||void 0,[`${yt}-vertical`]:x==="vertical",saltFocusVisible:l}),onClick:R,onFocus:L,onKeyUp:I,ref:w,role:"tab",tabIndex:D,children:[(0,Et.jsx)("div",{className:`${yt}-main`,children:(0,Et.jsx)("span",{className:`${yt}-text`,"data-text":i?void 0:p,children:o!=null?o:S()})}),E?(0,Et.jsx)(da,{allowClose:r,allowRename:i,location:d,onMenuAction:y,onMenuClose:T,index:c}):null]})});var Ze=require("react/jsx-runtime"),ar=({className:e,contributions:t,collapsed:o,closeable:n,onEditTitle:r,orientation:s="horizontal",style:i,title:a="Untitled"})=>{let l=(0,rt.useRef)(null),[c,p]=(0,rt.useState)(a),[d,u]=(0,rt.useState)(!1),m=ir(),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=(0,ya.default)(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(rt.default.cloneElement(M.content,{key:w}));break;default:k.push(rt.default.cloneElement(M.content,{key:w}))}}),a&&P.push((0,Ze.jsx)(Ue.ToolbarField,{className:"vuuHeader-title",children:(0,Ze.jsx)(Zo,{editing:d,value:c,onChange:p,onMouseDownCapture:b,onEnterEditMode:x,onExitEditMode:E,onKeyDown:v,ref:l,tabIndex:0},"title")},"title")),n&&C.push((0,Ze.jsxs)(Ue.ToolbarButton,{onClick:h,onMouseDown:f,children:[(0,Ze.jsx)(Ea.CloseIcon,{})," Close"]},"close")),k.length>0&&P.push((0,Ze.jsx)(Ue.Tooltray,{"data-align-end":!0,children:k},"contributions")),C.length>0&&P.push((0,Ze.jsx)(Ue.Tooltray,{"data-align-end":!0,children:C},"actions")),(0,Ze.jsx)(Ue.Toolbar,{className:T,orientation:s,style:i,onMouseDown:D,children:P})};var on=F(require("react")),tn=F(require("classnames")),Ma=require("@vuu-ui/vuu-popups");var He=require("react");var Lu=".vuuOverflowContainer-item:not(.wrapped)",xa=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}),Jo=[],Nt=e=>{let t=[],o=[],n=-1,r=!1,s=xa(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]},br=(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")}},Iu=(e,{overflowPriority:t})=>Math.max(e,parseInt(t)),Cu=(e,{overflowPriority:t})=>Math.min(e,parseInt(t)),yr=e=>{var t;return e.length>1&&((t=e.at(-1))==null?void 0:t.index)==="overflow"},Ou=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},Er=(e,t)=>{var r;let o=e.reduce(Cu,Number.MAX_SAFE_INTEGER);return t.reduce(Iu,0)>o?!0:t.length>1&&((r=t.at(-1))==null?void 0:r.index)==="overflow"},xr=(e,t)=>new Promise(o=>{requestAnimationFrame(()=>{let[,n]=Nt(e);Au(t,n).forEach(s=>va(e,s)),o(n)})}),Tr=(e,t,o)=>new Promise(n=>{requestAnimationFrame(()=>{let[,r]=Nt(e),s=Ou(r);if(s){let[i,a]=Qo(e,s);n([i,a])}else n([t,o])})}),Ta=(e,t)=>e.querySelector(`[data-index="${t.index}"]`),va=(e,t)=>{let o=Ta(e,t);if(o)o.classList.add("wrapped");else throw Error(`markElementAsWrapped element item with index ${t.index} not found`)},Da=e=>Array.from(e.querySelectorAll(".wrapped")),Au=(e,t)=>{let o=[];for(let n of t)e.find(({index:r})=>r===n.index)||o.push(n);return o},wa=(e,t)=>{Da(e).forEach(n=>{let{dataset:{index:r="?"}}=n;t.find(s=>s.index===r)||n.classList.remove("wrapped")})},Ra=e=>e.querySelector('[data-index="overflow"]'),Hu=e=>e.querySelector(".wrapped"),jo=e=>parseInt(getComputedStyle(e).getPropertyValue("width")),Sa=(e,t)=>{let{right:o}=e.getBoundingClientRect(),n=parseInt(getComputedStyle(e).getPropertyValue("padding-right")),{right:r}=t.getBoundingClientRect();return o-n-r},vr=e=>{let t=Ra(e),o=Sa(e,t),n=jo(t),r=Hu(e);return jo(r)<=o+n?(e.classList.remove("overflowed"),r.classList.remove("wrapped"),!0):!1},ku=(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)},zu=e=>Array.from(e.querySelectorAll(Lu)).sort(ku),Qo=(e,t)=>{let o=zu(e),n=Ta(e,t),r=-1,s=o.at(r),i=jo(s),a=jo(n),l=Ra(e),c=Sa(e,l)+i;if(c>=a)Nu(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]=Nt(e);return wa(e,d),[p,d]},Nu=(e,t)=>{if(!e||!t)throw Error("switchWrapOnElements, element undefined");e.classList.remove("wrapped"),t.classList.add("wrapped")};var Pa=({itemCount:e,onSwitchWrappedItemIntoView:t})=>{let[o,n]=(0,He.useState)(null),r=(0,He.useRef)(Jo),s=(0,He.useCallback)(async()=>{if(o){let[d,u]=Nt(o);for(br(o,u),yr(u)&&(u=await xr(o,u));Er(d,u);)[d,u]=await Tr(o,d,u);u.length===1&&vr(o)&&(u=Jo),r.current=u}},[o]),i=d=>typeof d=="object"&&d!==null&&"overflowItem"in d,[a,l]=(0,He.useMemo)(()=>[()=>{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]=Qo(o,d.overflowItem);r.current=u,t==null||t(d.overflowItem)}return!0}],[o,t]),c=(0,He.useMemo)(()=>{let d=0;return new ResizeObserver(u=>{for(let m of u){let{width:h}=m.contentRect;d!==h&&(d=h,s())}})},[s]);Tn(()=>{s()},[s,e]),(0,He.useMemo)(()=>{o&&c.observe(o)},[o,c]);let p=(0,He.useCallback)(d=>{n(d)},[]);return{menuActionHandler:l,menuBuilder:a,rootRef:p}};var st=require("react/jsx-runtime"),en="vuuOverflowContainer",La=on.default.memo(({children:e,height:t,onSwitchWrappedItemIntoView:o,overflowIcon:n})=>{let r=ut(e),{menuActionHandler:s,menuBuilder:i,rootRef:a}=Pa({itemCount:r.length,onSwitchWrappedItemIntoView:o}),l={"--overflow-container-height":`${t}px`};return(0,st.jsxs)("div",{className:`${en}-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(0,st.jsx)("div",{className:(0,tn.default)(`${en}-item`),"data-index":p,"data-label":m,"data-overflow-priority":d,id:`${u}-wrapper`,children:c},p)}),(0,st.jsx)("div",{className:`${en}-OverflowIndicator`,"data-index":"overflow",children:(0,st.jsx)(Ma.PopupMenu,{icon:n,menuBuilder:i,menuActionHandler:s})})]})});La.displayName="OverflowContainer.InnerContainer";var hr=(0,on.forwardRef)(function({children:t,className:o,height:n=44,onSwitchWrappedItemIntoView:r,overflowIcon:s,...i},a){return(0,st.jsx)("div",{...i,className:(0,tn.default)((0,tn.default)(en,o)),ref:a,children:(0,st.jsx)(La,{height:n,overflowIcon:s,onSwitchWrappedItemIntoView:r,children:t})})});var Ia=require("@vuu-ui/vuu-utils"),rn=require("@heswell/salt-lab"),Dr=F(require("classnames")),sn=require("react");var nn=require("react/jsx-runtime"),Bu=e=>{let t=e.cloneNode(!0);return t.id="",delete t.dataset.idx,t},wr=(0,sn.memo)(({className:e,children:t,idx:o,resizeable:n,header:r,closeable:s,...i})=>(0,nn.jsx)(rn.ListItem,{className:(0,Dr.default)("vuuPaletteItem",e),"data-draggable":!0,...i}));wr.displayName="PaletteItem";var Ca=({children:e,className:t,orientation:o="horizontal",ViewProps:n,...r})=>{let s=xe(),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=(0,Ia.uuid)(),E=h?m:(0,nn.jsx)(Ge,{...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:Bu(p),evt:l.nativeEvent,instructions:{DoNotRemove:!0,DoNotTransform:!0,RemoveDraggableOnDragEnd:!0,dragThreshold:10},path:"*",payload:E,type:"drag-start"})}return(0,nn.jsx)(rn.List,{...r,borderless:!0,className:(0,Dr.default)(i,t,`${i}-${o}`),maxHeight:800,selected:null,children:e.map((l,c)=>l.type===wr?(0,sn.cloneElement)(l,{key:c,onMouseDown:a}):l)})};Q("Palette",Ca,"view");var Oa=require("@vuu-ui/vuu-utils"),ln=require("@heswell/salt-lab"),Aa=F(require("classnames"));var an=require("react/jsx-runtime"),$u="vuuPalette",Fu=e=>{let{children:t,ViewProps:o,label:n,onMouseDown:r,template:s,...i}=e,a=xe();return(0,an.jsx)(ln.ListItem,{onMouseDown:c=>{let{left:p,top:d,width:u}=c.currentTarget.getBoundingClientRect(),m=(0,Oa.uuid)(),g=s?t:(0,an.jsx)(Ge,{...{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})},Ha=({className:e,...t})=>(0,an.jsx)(ln.List,{...t,className:(0,Aa.default)($u,e),height:"100%",selectionStrategy:"none"});Q("PaletteSalt",Ha,"view");var za=F(require("classnames")),it=F(require("react"));var uo=require("react/jsx-runtime"),ka="Tabs",_u=()=>{},Vu=(e,t)=>{var o,n;return(n=(o=e.props)==null?void 0:o.title)!=null?n:`Tab ${t+1}`},Wu=e=>{let t=[];return it.default.Children.forEach(e,o=>{it.default.isValidElement(o)?t.push(o):console.warn("Stack has unexpected child element type")}),t},Gu={allowAddTab:!1,allowCloseTab:!1,allowRenameTab:!1},cn=(0,it.forwardRef)(function({active:t=0,children:o,className:n,getTabIcon:r=_u,getTabLabel:s=Vu,id:i,keyBoardActivation:a="manual",onAddTab:l,onMoveTab:c,onTabClose:p,onTabEdit:d,onTabSelectionChanged:u,showTabs:m=!0,style:h,TabstripProps:g=Gu},b){var P;let f=Wt(i),{allowCloseTab:y,allowRenameTab:T}=g,x=(0,it.useCallback)((k,C,M,w)=>{d==null||d(w,C)},[d]),v=()=>{var k;return it.default.isValidElement(o)?o:Array.isArray(o)&&(k=o[t])!=null?k:null},E=()=>Wu(o).map((k,C)=>{let M=`${f}-${C}`,{closeable:w=y,id:R}=k.props;return(0,uo.jsx)(ba,{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(0,uo.jsxs)("div",{className:(0,za.default)(ka,n,{[`${ka}-horizontal`]:(g==null?void 0:g.orientation)==="vertical"}),style:h,id:f,ref:b,children:[m?(0,uo.jsx)(aa,{...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]})});cn.displayName="Stack";var Na=require("@salt-ds/core"),at=F(require("react"));var un=require("react/jsx-runtime"),Ku=e=>(0,un.jsx)(Ge,{resizeable:!0,title:`Tab ${e}`,style:{flexGrow:1,flexShrink:0,flexBasis:0},header:!0,closeable:!0,children:(0,un.jsx)(bo,{style:{flex:1}})}),Rr=e=>{let t=(0,at.useRef)(null),o=xe(),{loadState:n}=gt(),{createNewChild:r=Ku,id:s,onTabSelectionChanged:i,path:a,...l}=e,{children:c}=e,p=(0,Na.useIdMemo)(s),[d]=no(p,t,a),u=T=>{a&&(o({type:"switch-tab",path:a,nextIdx:T}),i==null||i(T))},m=(0,at.useCallback)(T=>{if(Array.isArray(c)){let{props:{"data-path":x,path:v=x}}=c[T];o({type:"remove",path:v})}},[c,o]),h=(0,at.useCallback)(()=>{if(a){let T=at.default.Children.count(c),x=r(T);o({type:"add",path:a,component:x})}},[c,r,o,a]),g=(0,at.useCallback)((T,x)=>{a&&o({fromIndex:T,toIndex:x,path:a,type:"move-child"})},[o,a]);return(0,un.jsx)(cn,{...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})};Rr.displayName="Stack";Q("Stack",Rr,"container");var Bt=F(require("react"));var Tt=require("react/jsx-runtime"),Zu=({children:e})=>{let[o,n]=(0,Bt.useState)(e),[r,s]=(0,Bt.useState)(e),i=l=>{let c=xn(o,l);s(c)},a=(l,c)=>{console.log(`change ${l} -> ${c}`);let p=Bt.default.cloneElement(r,{style:{...r.props.style,[l]:c}});s(p),n(Bt.default.cloneElement(o,{},p))};return(0,Tt.jsxs)("div",{"data-design-mode":`${!1}`,children:[o,(0,Tt.jsx)("br",{}),(0,Tt.jsxs)("div",{style:{display:"flex"},children:[(0,Tt.jsx)(Sr,{height:300,managedStyle:r.props.style,width:300,onChange:a,style:void 0}),(0,Tt.jsx)(Pr,{layout:o,onSelect:i,style:{width:300,height:300,backgroundColor:"#ccc"}})]})]})};var Be=require("@heswell/salt-lab"),J=require("react/jsx-runtime"),Lr={},Uu={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"}},Mr=({feature:e,children:t,style:o,onChange:n})=>(0,J.jsxs)("div",{className:`LayoutBox layout-${e} layout-outer`,children:[(0,J.jsxs)("div",{className:"layout-top",children:[(0,J.jsx)("span",{className:"layout-title",children:e}),(0,J.jsx)(Be.FormField,{className:"layout-input",style:{width:30},children:(0,J.jsx)(Be.Input,{value:o.top,onChange:(r,s)=>n(e,"top",s)})})]}),(0,J.jsxs)("div",{className:"layout-inner",children:[(0,J.jsx)("div",{className:"layout-left",children:(0,J.jsx)(Be.FormField,{className:"layout-input",style:{width:30},children:(0,J.jsx)(Be.Input,{value:o.left,onChange:(r,s)=>n(e,"left",s)})})}),t,(0,J.jsx)("div",{className:"layout-right",children:(0,J.jsx)(Be.FormField,{className:"layout-input",style:{width:30},children:(0,J.jsx)(Be.Input,{value:o.right,onChange:(r,s)=>n(e,"right",s)})})})]}),(0,J.jsx)("div",{className:"layout-bottom",children:(0,J.jsx)(Be.FormField,{className:"layout-input",style:{width:30},children:(0,J.jsx)(Be.Input,{value:o.bottom,onChange:(r,s)=>n(e,"bottom",s)})})})]}),qu={margin:!0,marginTop:!0,marginRight:!0,marginBottom:!0,marginLeft:!0},Xu={padding:!0,paddingTop:!0,paddingRight:!0,paddingBottom:!0,paddingLeft:!0},Yu={border:!0,borderColor:!0,borderWidth:!0,borderTopWidth:!0,borderRightWidth:!0,borderBottomWidth:!0,borderLeftWidth:!0},pn="(\\d+)(?:px)?",ju=`^(?:${pn}(?:\\s${pn}(?:\\s${pn}(?:\\s${pn})?)?)?)$`,Ba=new RegExp(ju),Ju=/^(?:(\d+)(?:px)\ssolid\s([a-zA-Z,0-9().]+))$/,Sr=({height:e,managedStyle:t,onChange:o,style:n,width:r})=>{let s=$a(t),i=(T,x,v)=>{let E=parseInt(v||"0",10),D=Uu[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(0,J.jsx)("div",{className:"LayoutConfigurator",style:{width:r,height:e,...n},children:(0,J.jsx)(Mr,{feature:"margin",style:{top:a,right:l,bottom:c,left:p},onChange:i,children:(0,J.jsx)(Mr,{feature:"border",style:{top:d,right:u,bottom:m,left:h},onChange:i,children:(0,J.jsx)(Mr,{feature:"padding",style:{top:g,right:b,bottom:f,left:y},onChange:i,children:(0,J.jsx)("div",{className:"layout-content"})})})})})};function Qu(e=Lr,t=Lr){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=Ba.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=Ba.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),$a(u,t)}function $a(e=Lr){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=Ju.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=`
17
+ `,document.body.insertBefore(t,e)}}var ao=class{constructor(){this.currentPath=null;this.tabMode=null;Cc()}prepare(t,o="full-view"){document.body.classList.add("drawing"),this.currentPath=null,this.tabMode=o;let r=this.getPoints(0,0,0,0),n=Is(r),s=document.getElementById("vuu-drop-outline");s==null||s.setAttribute("d",n),this.currentPath=n}clear(){io=null,Vo(),document.body.classList.remove("drawing"),Wo.PopupService.hidePopup()}get hoverDropTarget(){return io}getPoints(t,o,r,n,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+r,o],[t+r,o+n],[t,o+n]];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+r,o+a],[t+r,o+n],[t,o+n]]:[[t,o+a],[t+s,o+a],[t+s,o],[t+s,o],[t+s,o+a],[t+r,o+a],[t+r,o+n],[t,o+n]]}draw(t,o){let n=tn;if(io!==null)this.drawTarget(io);else if(tn=t.nextDropTarget!=null,t.pos.tab?Nc(t):Ce&&Vo(),this.drawTarget(t,o),tn){let[s,i,a]=Qr(t);{let l=(0,Hs.jsx)(en,{dropTarget:t,onHover:Mc,orientation:a});Wo.PopupService.showPopup({left:s,top:i,component:l})}}else Wo.PopupService.hidePopup()}drawTarget(t,o){let n=t.getTargetDropOutline(6,o);if(n){let{l:s,t:i,r:a,b:l,tabLeft:c,tabWidth:d,tabHeight:p,guideLines:u}=n,m=a-s,f=l-i;if(this.currentPath){let E=document.getElementById("vuu-drop-outline");E==null||E.setAttribute("d",this.currentPath)}let g=this.getPoints(s,i,m,f,c,d,p),h=Is(g),b=document.getElementById("hw-drop-outline-animate");b==null||b.setAttribute("to",h),b==null||b.beginElement(),this.currentPath=h;let T=document.getElementById("hw-drop-guides");T==null||T.setAttribute("d",Ic(u))}}},Cs="transition:margin-left .4s ease-out;margin-left: 63px",Ns="transition:margin-left .4s ease-out;margin-left: 0px";function Nc(e){var a,l;let{AFTER:t,BEFORE:o}=so,{clientRect:{Stack:r},pos:{tab:n}}=e,{id:s}=e.component.props,i=null;if(r&&n&&n.positionRelativeToTab!==t){let c=n.positionRelativeToTab===o?1:2,d=`:scope .hwTabstrip > .hwTabstrip-inner > .hwTab:nth-child(${n.index+c})`;i=(a=document.getElementById(s))==null?void 0:a.querySelector(d),i?(Ce===null||Ce!==i)&&(i.style.cssText=Cs,Ce&&(Ce.style.cssText=Ns),Ce=i):Vo()}else if((n==null?void 0:n.positionRelativeToTab)===o){if(Ce===null){let c=".vuuHeader-title";i=(l=document.getElementById(s))==null?void 0:l.querySelector(c),i.style.cssText=Cs,Ce=i}}else Vo()}function Vo(){Ce&&(Ce.style.cssText=Ns,Ce=null)}var Ge,lo,Je,Os,ks,Qe,Ko,At=null,rn,zs,co,Bs,on,Go=null,Hc=3,Zo=new ao,As=.4;function Ac(e,t){return t?se(e,t):Fe(e,o=>o.dropTarget)}var qo={handleMousedown(e,t,o={}){Ge=t,zs=o,Os=e.clientX,ks=e.clientY,on=o.dragThreshold===void 0?Hc:o.dragThreshold,on===0?Ge(e,0,0):(window.addEventListener("mousemove",Uo,!1),window.addEventListener("mouseup",Xo,!1),Go=window.setTimeout(()=>{console.log("mousedownTimer fires"),window.removeEventListener("mousemove",Uo,!1),window.removeEventListener("mouseup",Xo,!1),Ge==null||Ge(e,0,0)},500)),e.preventDefault()},initDrag(e,t,{top:o,left:r,right:n,bottom:s},i,a,l,c){return{drag:lo,drop:Je}=a,Oc(e,t,{top:o,left:r,right:n,bottom:s},i,l,c)}};function Uo(e){let r=e.clientX-Os,n=e.clientY-ks;Math.max(Math.abs(r),Math.abs(n))>on&&(window.removeEventListener("mousemove",Uo,!1),window.removeEventListener("mouseup",Xo,!1),Ge==null||Ge(e,r,n),Ge=null)}function Xo(){Go&&(window.clearTimeout(Go),Go=null),window.removeEventListener("mousemove",Uo,!1),window.removeEventListener("mouseup",Xo,!1)}function Oc(e,t,o,r,n,s){Qe=Ac(e,t);let{"data-path":i,path:a=i}=A(Qe);s&&(rn=s.map(u=>Fe(e,m=>m.id===u)).map(u=>u.props.path)),co=Ht.measure(Qe,s),console.log({_measurements:co});let l=co[a];Ko=new Fo(l,r.x,r.y,o,n);let c=Math.round(Ko.x.mousePct*100),d=Math.round(Ko.y.mousePct*100);return window.addEventListener("mousemove",$s,!1),window.addEventListener("mouseup",Fs,!1),Bs=!1,Zo.prepare(o,"tab-only"),zs.DoNotTransform?"transform:none":`transform:scale(${As},${As});transform-origin:${c}% ${d}%;`}function $s(e){let t=e.clientX,o=e.clientY,r=Ko,n=At,s,i,a;r.update("x",t)&&(i=r.x.pos),r.update("y",o)&&(a=r.y.pos),i===void 0&&a===void 0||lo==null||lo(i,a),!(Bs||Qe===void 0)&&(r.inBounds()?s=_o(t,o,Qe,co,r.hasIntrinsicSize(),rn):s=_o(r.dropX(),r.dropY(),Qe,co),n&&(s==null||s.box!==n.box)&&(At=null),s&&(Zo.draw(s,r),At=s))}function Fs(){kc()}function kc(){if(At){let e=Zo.hoverDropTarget||Ke.getActiveDropTarget(At);Je==null||Je(e),At=null}else Je==null||Je({component:Qe,pos:{position:pe.Absolute}});lo=null,Je=null,Qe=void 0,Zo.clear(),rn=void 0,window.removeEventListener("mousemove",$s,!1),window.removeEventListener("mouseup",Fs,!1)}var _s=W(require("classnames")),Ws=require("react");var Ks=require("react/jsx-runtime"),nn=(0,Ws.forwardRef)(function({children:t,className:o,dropTarget:r,resizeable:n,...s},i){let a=(0,_s.default)("DraggableLayout",o);return(0,Ks.jsx)("div",{className:a,ref:i,...s,children:t})}),Vs="DraggableLayout";nn.displayName=Vs;ne(Vs,nn,"container");var ri=require("@salt-ds/core"),ni=W(require("classnames")),si=require("react");var ti=require("@vuu-ui/vuu-utils"),Q=W(require("react"));var Zs=W(require("classnames"));var Us=require("react/jsx-runtime"),Gs="vuuPlaceholder",uo=({className:e,closeable:t,flexFill:o,resizeable:r,shim:n,...s})=>(0,Us.jsx)("div",{className:(0,Zs.default)(Gs,e,{[`${Gs}-shim`]:n}),...s,"data-placeholder":!0,"data-resizeable":!0});uo.displayName="Placeholder";ne("Placeholder",uo);var Xs=W(require("classnames")),me=W(require("react"));var sn=require("react/jsx-runtime"),qs=me.default.memo(function({column:t,index:o,onDrag:r,onDragEnd:n,onDragStart:s,style:i}){let a=(0,me.useRef)(),l=(0,me.useRef)(null),c=(0,me.useRef)(0),[d,p]=(0,me.useState)(!1),u=(0,me.useCallback)(({key:x,shiftKey:w})=>{let S=w?10:1;t&&x==="ArrowDown"?r(o,S):t&&x==="ArrowUp"||!t&&x==="ArrowLeft"?r(o,-S):!t&&x==="ArrowRight"&&r(o,S)},[t,o,r]),m=(0,me.useCallback)(x=>{let{key:w}=x;(t&&(w==="ArrowUp"||w==="ArrowDown")||!t&&(w==="ArrowLeft"||w==="ArrowRIght"))&&(s(o),u(x),f.current=u)},[t,u,o,s]),f=(0,me.useRef)(m),g=x=>f.current(x),h=(0,me.useCallback)(x=>{a.current=!0;let w=x[t?"clientY":"clientX"],S=w-c.current;w&&w!==c.current&&r(o,S),c.current=w},[t,o,r]),b=(0,me.useCallback)(()=>{var x;window.removeEventListener("mousemove",h,!1),window.removeEventListener("mouseup",b,!1),n(),p(!1),(x=l.current)==null||x.focus()},[h,n,p]),T=(0,me.useCallback)(x=>{c.current=t?x.clientY:x.clientX,s(o),window.addEventListener("mousemove",h,!1),window.addEventListener("mouseup",b,!1),x.preventDefault(),p(!0)},[t,h,b,o,s,p]),E=()=>{var x;a.current?a.current=!1:(x=l.current)==null||x.focus()},y=()=>{f.current=m},v=(0,Xs.default)("Splitter","focusable",{active:d,column:t});return(0,sn.jsx)("div",{className:v,"data-splitter":!0,ref:l,role:"separator",style:i,onBlur:y,onClick:E,onKeyDown:g,onMouseDown:T,tabIndex:0,children:(0,sn.jsx)("div",{className:"grab-zone"})})});var ln=require("@vuu-ui/vuu-utils"),cn=W(require("react"));var zc={"data-placeholder":!0,"data-resizeable":!0},Yo={},et="auto",an={flexBasis:0,flexGrow:1,flexShrink:1,height:et,width:et},Ys={height:"width",width:"height"},un=(e="row")=>e==="row"?["width","height","column"]:["height","width","row"],Bc=e=>typeof e=="string"&&e.endsWith("%"),Te=e=>{let{style:{width:t=et,height:o=et}=Yo}=e.props,r=typeof o=="number",n=typeof t=="number";return r&&n?{height:o,width:t}:r?{height:o}:n?{width:t}:void 0};function jo(e,t,o){let r=Ys[t],{style:{[r]:n=et,...s}=Yo}=e.props;return o&&o[t]?{...s,...an,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...s,...an,[r]:n}}function dn(e){let{style:{flex:t,flexGrow:o,flexShrink:r,flexBasis:n}=Yo}=e.props;return typeof t=="number"||n===0&&o===1&&r===1?!0:typeof n!="number"}function Jo(e,t,o){let r=Ys[t],{style:{[t]:n=et,[r]:s=et,...i}=Yo}=e.props;return n!==et?Bc(n)?{flexBasis:0,flexGrow:1,flexShrink:1,[t]:void 0,[r]:s}:{flexBasis:n,flexGrow:0,flexShrink:0,[t]:n,[r]:s}:o&&o[t]?{...i,...an,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...i,[r]:s}}function Ot(e,t,o,r,n){let s=[],i=0,a;if(r&&n){let d,[p,u,m,f]=n;[d,a]=t==="column"?[u-r.top,r.bottom-f]:[p-r.left,r.right-m],d&&s.push(Ne(`${o}.${i++}`,d,{flexGrow:0,flexShrink:0}))}else a=!0;let{version:l=0,style:c}=A(e);return s.push(ie(e,`${o}.${i++}`,{version:l+1,style:{...c,flexBasis:"auto",flexGrow:0,flexShrink:0}})),a&&s.push(Ne(`${o}.${i++}`,0,void 0,{[`data-${t}-placeholder`]:!0})),Qo(t,{resizeable:!1,style:{flexBasis:"auto"}},s,o)}var $c=(e,t)=>{if(!t)return e===0?1:0};function Qo(e,t,o,r){let n=(0,ln.uuid)(),{flexFill:s,style:i,resizeable:a=!0}=t,{flexBasis:l=s?void 0:"auto"}=i,c=$c(l,s);return cn.default.createElement(Ve.Flexbox,{id:n,key:n,path:r,flexFill:s,style:{...i,flexDirection:e,flexBasis:l,flexGrow:c,flexShrink:c},resizeable:a},o)}var Fc={flexGrow:1,flexShrink:1};function Ne(e,t,o,r){let n=(0,ln.uuid)();return cn.default.createElement("div",{...zc,...r,"data-path":e,id:n,key:n,style:{...Fc,...o,flexBasis:t}})}var _c={},po=1,mo=2,Wc=e=>typeof e.intrinsicSize=="number",Vc=(e,t)=>{let o={};return e.forEach(r=>{o[r]=F(t,r)}),o},er=(e,t,o)=>e.map((r,n)=>{var l;let s=F(r,"resizeable"),{[t]:i}=(l=Te(r))!=null?l:_c,a=dn(r);return o?{index:n,flexOpen:a,intrinsicSize:i,resizeable:s,...Vc(o,r)}:{index:n,flexOpen:a,intrinsicSize:i,resizeable:s}}),js=e=>{let t=e.length,o=e.every(Wc),r=Array(t).fill(0);if(o&&t>0&&(r[0]=mo,r[t-1]=mo),t<2)return r;for(let n=0,s=0;n<t-1;n++)e[n].resizeable&&!s&&(s=po),r[n]+=s;for(let n=t-1;n>0&&(r[n]&po&&(r[n]-=po),!e[n].resizeable);n--);return r},Js=(e,t)=>{let o=Gc(e,t),r=Zc(e,t),n=o!==-1&&r!==-1?[o,r]:void 0,s=Kc(e,n);return[n,s]};function Kc(e,t){if(t){let o=[];for(let r=0;r<e.length;r++)e[r].flexOpen&&!t.includes(r)&&o.push(r);return o}}function Gc(e,t){let o=t,r=!1;for(;o>=1&&!r;)o=o-1,r=Qs(e,o);return o}function Zc(e,t){let o=t,r=!1,n=e.length;for(;o<n-1&&!r;)o=o+1,r=Qs(e,o);return o===n?-1:o}function Qs(e,t){let{placeholder:o,splitter:r,resizeable:n,intrinsicSize:s}=e[t];return!!(!r&&!s&&(o||n))}var Uc=e=>!e.splitter&&!e.placeholder,oi=({children:e,onSplitterMoved:t,style:o})=>{let r=(0,Q.useRef)(null),n=(0,Q.useRef)(),s=(0,Q.useRef)(),i=(0,Q.useRef)([]),[,a]=(0,Q.useState)({}),l=h=>{s.current=h,a({})},c=(o==null?void 0:o.flexDirection)==="column",d=c?"height":"width",p=(0,Q.useMemo)(()=>Array.isArray(e)?e:Q.default.isValidElement(e)?[e]:[],[e]),u=(0,Q.useCallback)(h=>{let{current:b}=n;if(b){let[T,E]=Js(b,h);T&&(T.forEach(y=>{var x;let v=(x=r.current)==null?void 0:x.childNodes[y];if(v){let{size:w,minSize:S}=jc(v,d);b[y].currentSize=w,b[y].minSize=S}}),E&&E.forEach(y=>{var x;let v=(x=r.current)==null?void 0:x.childNodes[y];if(v){let{[d]:w}=v.getBoundingClientRect();b[y].flexBasis=w}}))}},[d]),m=(0,Q.useCallback)((h,b)=>{s.current&&n.current&&l(qc(s.current,n.current,b,d))},[d]),f=(0,Q.useCallback)(()=>{let h=n.current;h&&(t==null||t(h.filter(Uc))),h==null||h.forEach(b=>{b.currentSize=void 0,b.flexBasis=void 0,b.flexOpen=!1})},[t]),g=(0,Q.useCallback)(h=>Q.default.createElement(qs,{column:c,index:h,key:`splitter-${h}`,onDrag:m,onDragEnd:f,onDragStart:u}),[m,f,u,c]);return(0,Q.useMemo)(()=>{let[h,b]=Xc(p,d,g,i.current);n.current=b,s.current=h},[p,g,d]),{content:s.current||[],rootRef:r}};function Xc(e,t,o,r){let n=er(e,t),s=js(n),i=[],a=[];for(let l=0;l<e.length;l++){let c=e[l];if(l===0&&s[l]&mo&&(i.push(ei(l)),a.push({placeholder:!0,shim:!0})),c.key==null){let d=r[l]||(r[l]=(0,ti.getUniqueId)());i.push(Q.default.cloneElement(c,{key:d}))}else i.push(c);a.push(n[l]),l>0&&s[l]&mo?(i.push(ei(l)),a.push({placeholder:!0})):s[l]&po&&(i.push(o(i.length)),a.push({splitter:!0}))}return[i,a]}function qc(e,t,o,r){return Yc(t,o)?e.map((s,i)=>{let a=t[i],{currentSize:l,flexOpen:c,flexBasis:d}=a,p=l!==void 0;if(p||c){let{flexBasis:u}=s.props.style||{},m=p?a.currentSize:d;return m!==u?Q.default.cloneElement(s,{style:{...s.props.style,flexBasis:m,[r]:"auto"}}):s}else return s}):e}function Yc(e,t){let o=[];e.forEach((d,p)=>{d.currentSize!==void 0&&o.push(p)});let r=t<0?o[0]:o[1],{currentSize:n=0,minSize:s=0}=e[r];if(n===s)return!1;if(Math.abs(t)>n-s){let d=t<0?-1:1;t=Math.max(0,n-s)*d}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 ei(e){return Q.default.createElement(uo,{shim:e===0,key:`placeholder-${e}`})}function jc(e,t){let{[t]:o}=e.getBoundingClientRect(),n=getComputedStyle(e).getPropertyValue(`min-${t}`),s=n.endsWith("px")?parseInt(n,10):0;return{size:o,minSize:s}}var ai=require("react/jsx-runtime"),pn="hwFlexbox",ii=(0,si.forwardRef)(function(t,o){let{breakPoints:r,children:n,column:s,className:i,flexFill:a,gap:l,fullPage:c,id:d,onSplitterMoved:p,resizeable:u,row:m,spacing:f,splitterSize:g,style:h,...b}=t,{content:T,rootRef:E}=oi({children:n,onSplitterMoved:p,style:h}),y=(0,ni.default)(pn,i,{[`${pn}-column`]:s,[`${pn}-row`]:m,"flex-fill":a,"full-page":c});return(0,ai.jsx)("div",{...b,className:y,"data-resizeable":u||void 0,id:d,ref:(0,ri.useForkRef)(E,o),style:{...h,gap:l,"--spacing":f},children:T})});ii.displayName="Flexbox";var tr=ii;var Ai=require("react");var ht={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"};var xe=require("react");var ar=W(require("react"));var Tn=require("@vuu-ui/vuu-utils"),zt=W(require("react"));var bn=require("@vuu-ui/vuu-utils"),tt=W(require("react"));var bt=require("react"),fe=new Map,Re=new Map,mn=e=>fe.get(e),fn=e=>fe.has(e),gn=(e,t)=>fe.set(e,t),yt=()=>{let e=(0,bt.useCallback)((i,a)=>{let l=Re.get(i);if(l)return a!==void 0&&l[a]!==void 0?l[a]:a!==void 0?void 0:l},[]),t=(0,bt.useCallback)((i,a,l)=>{if(a===void 0)Re.set(i,l);else if(Re.has(i)){let c=Re.get(i);Re.set(i,{...c,[a]:l})}else Re.set(i,{[a]:l})},[]),o=(0,bt.useCallback)((i,a)=>{if(Re.has(i)){if(a===void 0)Re.delete(i);else if(Re.get(i)[a]){let{[a]:c,...d}=Re.get(i);Object.keys(d).length>0?Re.set(i,d):Re.delete(i)}}},[]),r=(0,bt.useCallback)((i,a)=>{let l=fe.get(i);if(l)return a!==void 0?l[a]:l},[]),n=(0,bt.useCallback)((i,a,l)=>{if(a===void 0)fe.set(i,l);else if(fe.has(i)){let c=fe.get(i);fe.set(i,{...c,[a]:l})}else fe.set(i,{[a]:l})},[]),s=(0,bt.useCallback)((i,a)=>{if(fe.has(i)){if(a===void 0)fe.delete(i);else if(fe.get(i)[a]){let{[a]:c,...d}=fe.get(i);Object.keys(d).length>0?fe.set(i,d):fe.delete(i)}}},[]);return{loadSessionState:e,loadState:r,saveSessionState:t,saveState:n,purgeState:s,purgeSessionState:o}};var yn=e=>e.flexDirection==="column"?["height","width"]:["width","height"],Jc={},kt=(e,t="0")=>{let[o,r]=rr(_(e),e.props,t);return tt.default.cloneElement(e,o,r)},or=(e,t)=>{let o=_(e),[r,n]=rr(o,e.props,"0",void 0,t);return(0,tt.cloneElement)(e,r,n)},Qc=(e,t,o)=>{let[r,n]=rr(e,t,"0",void 0,o);return{...t,...r,type:e,children:n}};function eu(e,t,o="0",r=null,n){var g,h;let{active:s=0,"data-path":i,path:a=i,id:l,style:c}=A(n),d=_(n)===e&&o===a,p=d?l:(g=t.id)!=null?g:(0,bn.uuid)(),u=e==="Stack"?(h=t.active)!=null?h:s:void 0,m=p,f=d?c:ou(e,t,r);return $r(e)?{id:p,key:m,path:o,style:f,type:e,active:u}:{id:p,key:m,style:f,"data-path":o}}function rr(e,t,o,r=null,n){var c,d;let s=eu(e,t,o,r,n);if(t.layout&&!n)return[s,[fo(t.layout,`${o}.0`)]];let i=(d=n==null?void 0:n.children)!=null?d:(c=n==null?void 0:n.props)==null?void 0:c.children,l=t.dropTarget&&i?i:tu(e,t.children,o,i);return[s,l]}function tu(e,t,o="0",r){let n=Array.isArray(t)?t:tt.default.isValidElement(t)?[t]:[];return ue(e)?n.map((s,i)=>{let a=_(s),l=_(r==null?void 0:r[i]);if(!l||a===l){let[c,d]=rr(a,s.props,`${o}.${i}`,e,r==null?void 0:r[i]);return tt.default.cloneElement(s,c,d)}return r==null?void 0:r[i]}):t}var ou=(e,t,o)=>{let{style:r=Jc}=t;if(e==="Flexbox"&&(r={flexDirection:t.column?"column":"row",...r,display:"flex"}),r.flex){let{flex:n,...s}=r;r={...s,...Bo(typeof n=="number"?n:0)}}else o==="Stack"?r={...r,...Bo(1)}:o==="Flexbox"&&(r.width||r.height)&&r.flexBasis===void 0&&(r={...r,flexBasis:"auto",flexGrow:0,flexShrink:0});return r};function fo({id:e=(0,bn.uuid)(),type:t,children:o,props:r,state:n},s){let i=t.match(/^[a-z]/)?t:Ve[t];if(i===void 0)throw Error(`layoutUtils unable to create component from JSON, unknown type ${t}`);return n&&gn(e,n),tt.default.createElement(i,{id:e,...r,key:e,path:s},o?o.map((a,l)=>fo(a,`${s}.${l}`)):void 0)}function xn(e){return En(e)}function En(e){let t=_(e),{id:o,children:r,type:n,...s}=A(e),i=fn(o)?mn(o):void 0;return{id:o,type:t,props:li(s),state:i,children:tt.default.Children.map(r,En)}}function li(e){if(e){let{path:t,...o}=e,r={};for(let[n,s]of Object.entries(o))r[n]=hn(s);return r}}function hn(e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(hn);if(typeof e=="object"&&e!==null){let t={};for(let[o,r]of Object.entries(e))t[o]=hn(r);return t}}function ci(e,t){var i;let o=e.props.children,r=o.length,{index:n=-1,positionRelativeToTab:s="after"}=t.tab||{};return n===-1||n>=r?[o[r-1],"after"]:[(i=o[n])!=null?i:null,s]}function nr(e,t,o){let{active:r,children:n=[],path:s}=A(e),i=F(t,"path"),{idx:a,finalStep:l}=Se(s,i,!0),[c,d]=l?ru(e,n,o):[r,n==null?void 0:n.map((u,m)=>m===a?nr(u,t,o):u)],p=_(e)==="Stack"?Array.isArray(c)?c[0]:c:r;return zt.default.cloneElement(e,{active:p},d)}function ru(e,t,o){let r=F(e,"path"),n=t==null?void 0:t.length,{id:s=(0,Tn.uuid)()}=A(o);return n?[n,t.concat(ie(o,`${r}.${n}`,{id:s,key:s}))]:[0,[ie(o,`${r}.0`,{id:s})]]}function sr(e,t,o,r,n,s,i){let{active:a,children:l,path:c}=A(e),d=F(t,"path"),{idx:p,finalStep:u}=Se(c,d),[m,f]=u?nu(e,l,p,o,r,n,s,i):[a,l.map((h,b)=>b===p?sr(h,t,o,r,n,s,i):h)],g=_(e)==="Stack"?m:a;return zt.default.cloneElement(e,{active:g},f)}function nu(e,t,o,r,n,s,i,a){let l=Te(r);return l!=null&&l.width&&(l!=null&&l.height)?iu(e,t,o,r,n,i,a):ui(e,t,o,r,n,(s==null?void 0:s.width)||(s==null?void 0:s.height),i)}var su=(e,t,{top:o,right:r,bottom:n,left:s},[i,a,l,c])=>{if(e==="column"&&t==="before")return a-o;if(e==="column")return n-c;if(e==="row"&&t==="before")return i-s;if(e==="row")return r-l};function iu(e,t,o,r,n,s,i){let{style:{flexDirection:a}}=A(e),[l,c,d]=un(a),{[c]:p,[l]:u}=Te(r),m=F(t[o],"path"),f=su(a,n,s,i),[g,h]=p<s[c]?[Ot(r,d,m,s,i),u]:[r,void 0],b=f?Ne(m,f,{flexGrow:0,flexShrink:0}):void 0;return p>s[c]&&(t=t.map(T=>{if(F(T,"placeholder"))return T;{let{[c]:E}=Te(T);return E&&E<p?Ot(T,d,F(T,"path")):T}})),ui(e,t,o,g,n,h,s,b)}function ui(e,t,o,r,n,s,i,a){let l=F(e,"path"),c=0,d=!t||t.length===0?[r]:t.reduce((p,u,m)=>{if(o===m){let[f,g]=au(e,u,r,i);n==="before"?a?p.push(a,g,f):p.push(g,f):a?p.push(f,g,a):p.push(f,g),c=p.indexOf(g)}else p.push(u);return p},[]).map((p,u)=>u<c?p:ie(p,`${l}.${u}`));return[c,d]}function au(e,t,o,r){let n=(0,Tn.uuid)(),{version:s=0}=A(o);if(s+=1,_(e)==="Flexbox"){let[i]=yn(e.props.style),a=6,l={[i]:(r[i]-a)/2},c=Jo(t,i,l),d=Jo(o,i,l);return[zt.default.cloneElement(t,{style:c}),zt.default.cloneElement(o,{id:n,version:s,style:d})]}else{let{style:{left:i,top:a,flex:l,...c}={left:void 0,top:void 0,flex:void 0}}=A(o);return[t,zt.default.cloneElement(o,{id:n,version:s,style:c})]}}var pi=require("react");var go=W(require("react"));function di(e,{target:t,replacement:o}){return vn(e,t,o)}function vn(e,t,o){let r=F(t,"path"),n=F(t,"resizeable"),{style:s}=A(t),i=kt(go.default.cloneElement(o,{resizeable:n,style:{...s,...o.props.style}}),r);return ge(e,t,i)}function ge(e,t,o,r){if(e===t)return o;let{idx:n,finalStep:s}=Se(F(e,"path"),F(t,"path")),i=e.props.children.slice();return s?r?r===ht.MINIMIZE?i[n]=lu(e,i[n]):r===ht.RESTORE&&(i[n]=cu(i[n])):i[n]=o:i[n]=ge(i[n],t,o,r),go.default.cloneElement(e,void 0,i)}function lu(e,t){let{style:o}=A(e),{style:r}=A(t),{width:n,height:s,flexBasis:i,flexShrink:a,flexGrow:l,...c}=r,d={width:n,height:s,flexBasis:i,flexShrink:a,flexGrow:l},p={...c,flexBasis:0,flexGrow:0,flexShrink:0},u=o.flexDirection==="row"?"vertical":o.flexDirection==="column"?"horizontal":!1;return u?go.default.cloneElement(t,{collapsed:u,restoreStyle:d,style:p}):t}function cu(e){let{style:t,restoreStyle:o}=A(e),{flexBasis:r,flexShrink:n,flexGrow:s,...i}=t,a={...i,...o};return go.default.cloneElement(e,{collapsed:!1,style:a,restoreStyle:void 0})}function mi(e,{fromIndex:t,path:o,toIndex:r}){let n=se(e,o,!0),{children:s}=A(n),i=uu(s,t,r),a=(0,pi.cloneElement)(n,void 0,i);return ge(e,n,a)}function uu(e,t,o){let r=e.slice(),[n]=r.splice(t,1);return o===-1?r.concat(n):(r.splice(o,0,n),r)}var ce={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"};var ot=W(require("react"));function wn(e,{path:t}){let o=se(e,t),r=$e(e,t);if(r===null)return e;let{children:n}=A(r);if(n.length>1&&gi(n,t)){let{style:{flexBasis:s,display:i,flexDirection:a,...l}}=A(r),c=F(r,"path"),d=ge(e,r,Ne(c,s,l));for(;(r=$e(d,c))&&F(r,"path")!=="0";){let{children:p}=A(r);if(gi(p)){c=F(r,"path");let{style:{flexBasis:u,display:m,flexDirection:f,...g}}=A(r);d=ge(e,r,Ne(c,u,g))}else if(fu(p))d=yi(e,r);else break}return d}return hi(e,o)}function hi(e,t){let o=A(e),{children:r,path:n,preserve:s}=o,{active:i}=o,{idx:a,finalStep:l}=Se(n,F(t,"path")),c=_(e),d=r.slice();if(l){if(d.splice(a,1),i!==void 0&&i>=a&&(i=Math.max(0,i-1)),d.length===1&&!s&&n!=="0"&&c.match(/Flexbox|Stack/))return du(e,d[0]);!d.some(pu)&&d.some(bi)&&(d=mu(d))}else d[a]=hi(d[a],t);return d=d.map((p,u)=>ie(p,`${n}.${u}`)),ot.default.cloneElement(e,{active:i},d)}function du(e,t){let o=_(e),{path:r,style:{flexBasis:n,flexGrow:s,flexShrink:i,width:a,height:l}}=A(e),c=ie(t,r);if(r==="0")c=ot.default.cloneElement(c,{style:{...t.props.style,width:a,height:l}});else if(o==="Flexbox"){let d=e.props.style.flexDirection==="column"?"height":"width",{style:{[d]:p,...u}}=c.props;c=ot.default.cloneElement(c,{flexFill:void 0,style:{...u,flexGrow:s,flexShrink:i,flexBasis:n,width:a,height:l}})}return c}var pu=e=>e.props.style.flexGrow>0,bi=e=>{let{width:t,height:o,flexGrow:r}=e.props.style;return r===0&&typeof t!="number"&&typeof o!="number"},mu=e=>e.map(t=>bi(t)?ot.default.cloneElement(t,{style:{...t.props.style,flexGrow:1}}):t),fu=e=>{if(e&&e.length>0){let t=F(e[0],"placeholder"),o=!1;for(let r=1;r<e.length;r++){if(o=F(e[r],"placeholder"),t&&o)return!0;t=o}}},yi=(e,t)=>{let{children:o,path:r}=A(e),{idx:n,finalStep:s}=Se(r,F(t,"path")),i=o.slice();return s?i[n]=gu(t):i[n]=yi(i[n],t),i=i.map((a,l)=>ie(a,`${r}.${l}`)),ot.default.cloneElement(e,void 0,i)},gu=e=>{let{children:t}=A(e),o=[],r=[];for(let s=0;s<t.length;s++)F(t[s],"placeholder")?r.push(t[s]):(r.length===1?o.push(r.pop()):r.length>0&&(o.push(fi(r)),r.length=0),o.push(t[s]));r.length===1?o.push(r.pop()):r.length>0&&o.push(fi(r));let n=F(e,"path");return ot.default.cloneElement(e,void 0,o.map((s,i)=>ie(s,`${n}.${i}`)))},fi=([e,...t])=>{let o=F(e,"style"),{flexBasis:r,flexGrow:n,flexShrink:s}=o;for(let{props:{style:i}}of t)r+=i.flexBasis,n=Math.max(n,i.flexGrow),s=Math.max(s,i.flexShrink);return ot.default.cloneElement(e,{style:{...o,flexBasis:r,flexGrow:n,flexShrink:s}})},gi=(e,t)=>e.every(o=>F(o,"placeholder")||t&&F(o,"path")===t);var ir=W(require("react"));function xi(e,{path:t,size:o}){let r=se(e,t,!0),{style:n}=A(r),s={...n,width:o},i=ir.default.cloneElement(r,{style:s});return ge(e,r,i)}function Ei(e,{path:t,sizes:o}){let r=se(e,t,!0),{children:n,style:s}=A(r),i=s.flexDirection==="column"?"height":"width",a=hu(n,o,i),l=ir.default.cloneElement(r,void 0,a);return ge(e,r,l)}function hu(e,t,o){return e.map((r,n)=>{let{style:{[o]:s,flexBasis:i}}=A(r),a=t[n],{currentSize:l,flexBasis:c}=a,p=l!==void 0?a.currentSize:c;return p===void 0||s===p||i===p?r:ir.default.cloneElement(r,{style:bu(r.props.style,o,p)})})}function bu(e,t,o){let r=typeof e[t]=="number",{flexShrink:n=1,flexGrow:s=1}=e;return{...e,[t]:r?o:"auto",flexBasis:r?"auto":o,flexShrink:n,flexGrow:s}}var Ti=require("@vuu-ui/vuu-utils"),ho=W(require("react"));var vi=e=>{let[t]=_(e);return t===t.toLowerCase()};function bo(e,t,o,r,n,s){let{children:i,path:a}=A(e),l=F(t,"path"),{idx:c,finalStep:d}=Se(a,l),p=d?yu(e,i,t,o,r,n,s):i.map((u,m)=>m===c?bo(u,t,o,r,n,s):u);return ho.default.cloneElement(e,void 0,p)}function yu(e,t,o,r,n,s,i){let a=Te(r);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 Eu(t,o,r,n,s,i)}return xu(e,t,o,r,n)}function xu(e,t,o,r,n){var x;let{version:s=0}=A(r),i=F(o,"path"),{type:a,flexDirection:l,showTabs:c}=Di(n),[d,p,u]=Tu(a,o,r,l,n),m=wi(n),f=m?1:0,g={resizeable:!0,style:u,version:s+1},b={[vi(o)?"data-resizeable":"resizeable"]:!0,style:p},T=a==="Stack"?{showTabs:c}:void 0,E=a==="Flexbox"?{splitterSize:(x=_(e)==="Flexbox"&&e.props.splitterSize)!=null?x:void 0}:void 0,y=(0,Ti.uuid)(),v=ho.default.createElement(Ve[a],{active:f,id:y,key:y,path:F(o,"path"),flexFill:F(o,"flexFill"),...E,...T,style:d,resizeable:F(o,"resizeable")},m?[ie(o,`${i}.0`,b),kt(ho.default.cloneElement(r,g),`${i}.1`)]:[kt(ho.default.cloneElement(r,g),`${i}.0`),ie(o,`${i}.1`,b)]);return t.map(w=>w===o?v:w)}function Eu(e,t,o,r,n,s){let{flexDirection:i}=Di(r),a=i==="column"?"row":"column",l=wi(r),[c,d,p,u]=s,[m,f]=i==="column"?[d-n.top,n.bottom-u]:[c-n.left,n.right-p],g=F(t,"path"),h=0,b=vi(t)?"data-resizeable":"resizeable",T=[];m&&T.push(l?ie(t,`${g}.${h++}`,{[b]:!0,style:{flexBasis:m,flexGrow:1,flexShrink:1}}):Ne(`${g}.${h++}`,m,{flexGrow:0,flexShrink:0})),T.push(Ot(o,a,`${g}.${h++}`,n,s)),f&&T.push(l?Ne(`${g}.${h++}`,0):ie(t,`${g}.${h++}`,{[b]:!0,style:{flexBasis:0,flexGrow:1,flexShrink:1}}));let E=Qo(i,t.props,T,g);return e.map(y=>y===t?E:y)}function Tu(e,t,o,r,n){let s={...t.props.style,flexDirection:r},i=e==="Flexbox"&&r==="column"?"height":"width",a=jo(o,i,n),l=jo(t,i);return[s,l,a]}var wi=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 Di(e){return e.position.Header?{type:"Stack",flexDirection:"column",showTabs:!0}:{type:"Flexbox",flexDirection:e.position.EastOrWest?"row":"column"}}var Dn=(e,t)=>{switch(t.type){case ce.ADD:return Ru(e,t);case ce.DRAG_DROP:return Su(e,t);case ce.MAXIMIZE:return Du(e,t);case ce.REMOVE:return wn(e,t);case ce.REPLACE:return di(e,t);case ce.SET_PROP:return Si(e,t);case ce.SET_PROPS:return wu(e,t);case ce.SET_TITLE:return Si(e,{type:"set-prop",path:t.path,propName:"title",propValue:t.title});case ce.SPLITTER_RESIZE:return Ei(e,t);case ce.LAYOUT_RESIZE:return xi(e,t);case ce.SWITCH_TAB:return vu(e,t);case ce.MOVE_CHILD:return mi(e,t);default:return e}},vu=(e,{path:t,nextIdx:o})=>{let r=se(e,t,!0),n=ar.default.cloneElement(r,{active:o});return ge(e,r,n)},Si=(e,{path:t,propName:o,propValue:r})=>{let n=se(e,t,!0),s=ar.default.cloneElement(n,{[o]:r});return ge(e,n,s)},wu=(e,{path:t,props:o})=>{let r=se(e,t,!0),n=ar.default.cloneElement(r,o);return ge(e,r,n)},Du=(e,{path:t,type:o})=>{if(t){let r=se(e,t,!0);return ge(e,r,r,o)}else return e},Su=(e,t)=>{var f,g;let{draggedReactElement:o,dragInstructions:r,dropTarget:n}=t,s=n.component,{pos:i}=n,a=((f=i==null?void 0:i.position)==null?void 0:f.Header)&&_(s)==="Stack",{id:l,version:c}=A(o),d=Te(o),p;if(a){let[h,b]=ci(s,i);h===void 0?p=nr(e,s,o):p=sr(e,h,o,b)}else!d&&((g=i==null?void 0:i.position)!=null&&g.Centre)?p=vn(e,s,o):p=Mu(e,n,o);if(r.DoNotRemove)return p;let u=Fe(p,h=>h.id===l&&h.version===c),m=F(u,"path");return wn(p,{path:m,type:"remove"})},Ru=(e,{path:t,component:o})=>nr(e,se(e,t),o),Mu=(e,t,o)=>{let{component:r,pos:n,clientRect:s,dropRect:i}=t,a=F(r,"path");if(a==="0.0")return bo(e,r,o,n);let l=$e(e,a);if(Ri(n,l)){let c=n.position.SouthOrEast?"after":"before";return sr(e,r,o,c,n,s,i)}if(!Ri(n,l))return bo(e,r,o,n,s,i);if(ue(_(l)))return bo(e,r,o,n);throw Error(`no support right now for position = ${n.position}`)},Ri=(e,t)=>e.position.Centre?Pi(t)||Mi(t):e.position.NorthOrSouth?Mi(t):e.position.EastOrWest?Pi(t):!1,Mi=e=>_(e)==="Flexbox"&&e.props.style.flexDirection==="column",Pi=e=>_(e)==="Flexbox"&&e.props.style.flexDirection!=="column";var Li=require("react"),Pu=e=>console.log(`dispatch ${e.type}, have you forgotten to provide a LayoutProvider ?`),Bt=(0,Li.createContext)({dispatchLayoutProvider:Pu,version:-1});var Ze=require("react");var Lu={},Ii=[0,0],Iu=(e,t,o)=>{let r=document.createElement("div");r.className="vuuSimpleDraggableWrapper",r.classList.add("vuuSimpleDraggableWrapper","salt-theme","salt-density-medium"),r.dataset.dragging="true";let n=o!=null?o:document.createElement("div");n.id=t,r.appendChild(n),document.body.appendChild(r);let s=`top:${e.top}px;left:${e.left}px;width:${e.width}px;height:${e.height}px;`;return[r,s,e.left,e.top]},Cu=e=>{let{offsetParent:t}=e;if(t===null)return Ii;{let{left:o,top:r}=t.getBoundingClientRect();return[o,r]}},Ci=(e,t)=>{let o=(0,Ze.useRef)(),r=(0,Ze.useRef)(),n=(0,Ze.useRef)(),s=(0,Ze.useCallback)((c,d)=>{if(r.current&&n.current){let{dragOffsets:[p,u],targetPosition:m}=r.current,f=typeof c=="number"?c-p:m.left,g=typeof d=="number"?d-u:m.top;(f!==m.left||g!==m.top)&&(r.current.targetPosition.left=f,r.current.targetPosition.top=g,n.current.style.top=g+"px",n.current.style.left=f+"px")}},[]),i=(0,Ze.useCallback)(c=>{if(r.current){let{dragInstructions:d,payload:p,originalCSS:u}=r.current;t({type:"drag-drop",draggedReactElement:p,dragInstructions:d,dropTarget:c}),console.log("[useLayoutDragDrop]",{dragInstructions:d}),n.current&&(d.RemoveDraggableOnDragEnd?document.body.removeChild(n.current):(n.current.style.cssText=u,delete n.current.dataset.dragging)),o.current=void 0,r.current=void 0,n.current=void 0}},[t]),a=(0,Ze.useCallback)(c=>{if(o.current){let{payload:d,dragContainerPath:p,dragElement:u,dragRect:m,instructions:f=Lu,path:g}=o.current,{current:h}=e,b={x:c.clientX,y:c.clientY},T=d!=null?d:se(h,g,!0),{id:E}=T.props,y=Te(T),v="",x="",w="",S=-1,O=-1,H=Ii,P=document.getElementById(E);if(P===null)[P,x,S,O]=Iu(m,E,u);else{H=Cu(P);let[D,I]=H,{width:M,height:R,left:L,top:C}=P.getBoundingClientRect();S=L-D,O=C-I,x=`width:${M}px;height:${R}px;left:${S}px;top:${O}px;z-index: 100;background-color:#ccc;opacity: 0.6;`,P.dataset.dragging="true",v=P.style.cssText}w=qo.initDrag(e.current,p,m,b,{drag:s,drop:i},y),P.style.cssText=x+w,n.current=P,r.current={payload:T,originalCSS:v,dragRect:m,dragOffsets:H,dragInstructions:f,targetPosition:{left:S,top:O}}}},[s,i,e]);return(0,Ze.useCallback)(c=>{let{evt:d,...p}=c;console.log("prepare to drag",{options:p}),o.current={...p,dragContainerPath:""},qo.handleMousedown(d,a,p.instructions)},[a])};var Sn=require("react/jsx-runtime"),Ni=e=>e.dropTarget,Nu=e=>["drag-drop","remove","set-title","splitter-resize","switch-tab"].includes(e.type),Hu=()=>{let e=Hi();return(0,Sn.jsx)("div",{children:`Context: ${e} `})},Au=e=>{let{children:t,layout:o,onLayoutChange:r}=e,n=(0,xe.useRef)(void 0),s=(0,xe.useRef)(t),[,i]=(0,xe.useState)(null),a=(0,xe.useCallback)(p=>{if(r){let u=Fe(p,Ni)||n.current,f=_(u)==="DraggableLayout"?A(u).children[0]:u,g=xn(f);r(g,"drag-root")}},[r]),l=(0,xe.useCallback)((p,u=!1)=>{let m=Dn(n.current,p);m!==n.current&&(n.current=m,i({}),!u&&Nu(p)&&a(m))},[a]),c=(0,xe.useCallback)(p=>{switch(p.type){case"drag-start":{d(p);break}case"save":{a(n.current);break}default:{l(p);break}}},[l,a]),d=Ci(n,c);return(0,xe.useEffect)(()=>{if(o){let p=Fe(n.current,Ni),u=Kr(p),m=fo(o,`${p.props.path}.0`),f=u?{type:ce.REPLACE,target:u,replacement:m}:{type:ce.ADD,path:p.props.path,component:m};l(f,!0)}},[l,o]),n.current===void 0?n.current=or(t):t!==s.current&&(n.current=or(t,n.current),s.current=t),(0,Sn.jsx)(Bt.Provider,{value:{dispatchLayoutProvider:c,version:0},children:n.current})},He=()=>{let{dispatchLayoutProvider:e}=(0,xe.useContext)(Bt);return e},Hi=()=>{console.log({LayoutProviderContext:Bt});let{version:e}=(0,xe.useContext)(Bt);return e};var Oi=require("react/jsx-runtime"),Rn=function(t){let{path:o}=t,r=He(),n=(0,Ai.useCallback)(s=>{r({type:ht.SPLITTER_RESIZE,path:o,sizes:s})},[r,o]);return(0,Oi.jsx)(tr,{...t,onSplitterMoved:n})};Rn.displayName="Flexbox";ne("Flexbox",Rn,"container");var Wi=require("@salt-ds/core"),Vi=W(require("classnames")),cr=require("react");var Ae=require("react");var Et=require("react"),Pn=["height","width"],Ou=["height"],ku=["width"],xt=new WeakMap,ki=(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}},Mn=new ResizeObserver(e=>{for(let t of e){let{target:o,contentRect:r}=t,n=xt.get(o);if(n){let{onResize:s,measurements:i}=n,a=!1;for(let[l,c]of Object.entries(i)){let d=ki(o,r,l);d!==c&&(a=!0,i[l]=d)}a&&s&&s(i)}}});function yo(e,t,o,r=!1){console.log("resizeObserver container",{ref:e.current});let n=(0,Et.useRef)(t),s=(0,Et.useCallback)(i=>{let a=i.getBoundingClientRect();return n.current.reduce((l,c)=>(l[c]=ki(i,a,c),l),{})},[]);(0,Et.useLayoutEffect)(()=>{let i=e.current,a=!1;async function l(){xt.set(i,{measurements:{}}),a=!1;let{fonts:c}=document;if(c&&await c.ready,!a){let d=xt.get(i);if(d){let p=s(i);d.measurements=p,Mn.observe(i),r&&o(p)}}}if(i){if(xt.has(i))throw Error("useResizeObserver attemping to observe same element twice");l()}return()=>{i&&xt.has(i)&&(Mn.unobserve(i),xt.delete(i),a=!0)}},[e,s,r,o]),(0,Et.useLayoutEffect)(()=>{let i=e.current,a=xt.get(i);if(a){if(n.current!==t){n.current=t;let l=s(i);a.measurements=l}a.onResize=o}},[t,s,e,o])}function zu(e,t){let o=document.body.querySelector(`.${e}`),r={get:function(n,s){let i=n.getPropertyValue(`--${e}-breakpoint-${s}`);return i?parseInt(i):void 0}};return o?new Proxy(getComputedStyle(o),r):t!=null?t:{}}var Bu=([,e],[,t])=>t-e,In=e=>Object.entries(e).sort(Bu).map(([t,o],r,n)=>[t,o,r<n.length-1?n[r+1][1]:9999]),Ln=null,$u=(e="salt")=>{let{xs:t,sm:o,md:r,lg:n,xl:s}=zu(e);return In({xs:t,sm:o,md:r,lg:n,xl:s})},zi=e=>(Ln===null&&(Ln=$u(e)),Ln);var Fu=[],Cn=({breakPoints:e,smallerThan:t},o)=>{let[r,n]=(0,Ae.useState)(t?!1:"lg"),s=(0,Ae.useRef)(document.body),i=(0,Ae.useRef)(e?In(e):zi()),a=(0,Ae.useRef)("lg"),l=(0,Ae.useCallback)(d=>{if(i.current){for(let[p,u]of i.current)if(d>=u)return p}},[i]),c=(0,Ae.useCallback)(d=>{if(t){let p=i.current.find(([u])=>u===t);if(p){let[,,u]=p;return d<u}}else return l(d);return d},[t,l]);return yo(o||s,i.current?["width"]:Fu,({width:d})=>{let p=c(d);p!==a.current&&(a.current=p,n(p))},!0),(0,Ae.useEffect)(()=>{let d=o||s;if(d.current){let p=a.current;if(i.current){let{clientWidth:u}=d.current,m=c(u);a.current=m,m!==p&&n(m)}}},[n,c,o]),r};var Bi="data-collapsible",_u={[Bi]:!0,"data-pad-start":!0,"data-pad-end":!0},$i=e=>{var t;return(t=_u[e])!=null?t:!1},Wu=e=>e===Bi,Vu={dynamic:"dynamic",instant:"instant",true:"instant"},Ku=e=>{var t;return(t=Vu[e])!=null?t:"none"},Gu=e=>Object.keys(e).reduce((t,o)=>{let[r,n]=t;if($i(o)){let s=Wu(o)?Ku(e[o]):e[o];r[o]=s,n[o]=void 0}return t},[{},{}]);var Fi=require("@vuu-ui/vuu-utils"),ve=require("react");var Zu=["xs","sm","md","lg","xl"],Uu=12,_i=({children:e,cols:t,style:o})=>{let r=(0,ve.useRef)(null),n=(0,ve.useRef)(null),s=(0,ve.useRef)(),i=t!=null?t:Uu,l=(o==null?void 0:o.flexDirection)==="column"?"height":"width",c=(0,ve.useMemo)(()=>Array.isArray(e)?e:(0,ve.isValidElement)(e)?[e]:[],[e]),d=(0,ve.useCallback)((p,u)=>{let m=er(p,u,Zu),f=[],g=[];for(let h=0;h<p.length;h++){let b=p[h],{style:{flex:T,...E}}=b.props;f.push((0,ve.cloneElement)(b,{key:(0,Fi.getUniqueId)(),style:{...E,"--parent-col-count":i}})),g.push(m[h])}return[f,g]},[i]);return(0,ve.useMemo)(()=>{let[p,u]=d(c,l);n.current=u,s.current=p},[d,c,l]),{cols:i,content:s.current,rootRef:r}};var Ki=require("react/jsx-runtime"),lr="hwFluidGrid",ur=(0,cr.forwardRef)(function(t,o){let{breakPoints:r,children:n,column:s,cols:i=12,className:a,flexFill:l,gap:c=3,fullPage:d,id:p,onSplitterMoved:u,resizeable:m,row:f,showGrid:g,spacing:h,splitterSize:b,style:T,...E}=t,y=(0,cr.useMemo)(()=>mt(n),[n]),{cols:v,content:x,rootRef:w}=_i({children:y,cols:i,style:T}),S=Cn({breakPoints:r},w),O=(0,Vi.default)(lr,a,{[`${lr}-column`]:s,[`${lr}-row`]:f,[`${lr}-show-grid`]:g,"flex-fill":l,"full-page":d}),H={...T,"--spacing":h,"--grid-col-count":v,"--grid-gap":c};return(0,Ki.jsx)("div",{...E,className:O,"data-breakpoint":S,"data-cols":v,"data-resizeable":m||void 0,id:p,ref:(0,Wi.useForkRef)(w,o),style:H,children:x})});ur.displayName="FluidGrid";var Gi=require("react/jsx-runtime"),Nn=function(t){return(0,Gi.jsx)(ur,{...t})};Nn.displayName="FluidGrid";ne("FluidGrid",Nn,"container");var $t=require("react"),ju=require("react/jsx-runtime"),Xu={isDragSource:!1,isDropTarget:!1,register:()=>{}},qu=()=>console.log("have you forgotten to provide a DragDrop Provider ?"),Yu=(0,$t.createContext)({registerDragDropParty:qu});var Zi=e=>{var n,s;let{dragSources:t,dropTargets:o,registerDragDropParty:r}=(0,$t.useContext)(Yu);if(e){let i=(n=t==null?void 0:t.has(e))!=null?n:!1,a=(s=o==null?void 0:o.has(e))!=null?s:!1;return{isDragSource:i,isDropTarget:a,register:r}}else return Xu};var ae=require("react");var Oe=require("react");var Ju=["left","right"],Qu=["top","bottom"],dr=":not(.wrapped)",Ui=':not([aria-hidden="true"])',Xi=e=>{let t=e.cloneNode(!0);return t.removeAttribute("id"),t.dataset.index="-1",t},ed=(e,t="width",o=!1)=>{let r=t==="width"?"left":"top",{[t]:n,[r]:s}=e.getBoundingClientRect(),{padEnd:i=!1,padStart:a=!1}=e.dataset,l=getComputedStyle(e),[c,d]=t==="width"?Ju:Qu,p=a&&!o?0:parseInt(l.getPropertyValue(`margin-${c}`),10),u=i&&!o?0:parseInt(l.getPropertyValue(`margin-${d}`),10),m=n;if(parseInt(l.getPropertyValue("flex-shrink"),10)>0){let g=parseInt(l.getPropertyValue("flex-basis"),10);!isNaN(g)&&g>0&&(m=g)}return[s,p+m+u]},td={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=>td[e],qi=(e,t)=>{let o=e.find(r=>r.id===t);if(o)return o},Yi=(e,t)=>{e.splice(t,1);for(let o=t;o<e.length;o++)e[o].currentIndex-=1},Ft=(e,t,o,r,n)=>{var p;let s=[],{DIMENSION:i}=Me(t),a=Array.from(o?e.querySelectorAll(o):e.children),l=a.length,c=typeof(r==null?void 0:r.from)=="number"?r.atEnd?Math.max(0,r.from-1):r.from:0,d=typeof(r==null?void 0:r.to)=="number"?Math.min(r.to+2,l-1):l-1;for(let u=c;u<=d;u++){let m=a[u],[f,g]=ed(m,i),h=u===l-1,b=m.id,T=parseInt((p=m.dataset.index)!=null?p:"-1");s.push({currentIndex:u,dataIndex:isNaN(T)?-1:T,id:b,index:u,isDraggedItem:n===b,isLast:h,isOverflowIndicator:m.dataset.index==="overflow",element:m,start:f,end:f+g,size:g,mid:f+g/2})}return s},xo=e=>e.findIndex(t=>t.isDraggedItem),Hn=(e,t)=>{let o=xo(e),r=t==="fwd"?o+1:o-1;if(r<0||r>=e.length)throw Error("switchDropTargetPosition index out of range");let n=e.at(o),s=e.at(r),i=s.size-n.size;if(t==="fwd"){let a=s.start+i,l=s.end,c={...n,start:a,mid:Math.floor(a+(l-a)/2),end:l},d=n.start,p=n.end+i,u={...s,start:d,mid:Math.floor(d+(p-d)/2),end:p};e.splice(o,2,u,c)}else{let a=s.start,l=s.end-i,c={...n,start:a,mid:Math.floor(a+(l-a)/2),end:l},d=n.start-i,p=n.end,u={...s,start:d,mid:Math.floor(d+(p-d)/2),end:p};e.splice(r,2,c,u)}},_t=(e,t,o)=>{let r=e.length,n=xo(e),s=e[n];if(o==="fwd"){let i=Math.round(t+s.size);for(let a=r-1;a>=0;a--){let l=e[a];if(i>l.mid)return a<n?s:l}}else{let i=Math.round(t);for(let a=0;a<r;a++){let l=e[a];if(i<l.mid)return a>n?s:l}}throw Error("no dropTraget identified")};function ji(e,t){let{height:o,left:r,top:n,width:s}=e,{height:i,width:a}=t;return{height:Math.min(o,i),left:r,top:n,width:Math.min(s,a)}}var Qi=require("@salt-ds/core");function Ji(e){var t,o,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(o=Ji(e[t]))&&(r&&(r+=" "),r+=o);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function pr(){for(var e,t,o=0,r="";o<arguments.length;)(e=arguments[o++])&&(t=Ji(e))&&(r&&(r+=" "),r+=t);return r}var mr=require("react"),ea=require("@vuu-ui/vuu-popups");var An=require("react/jsx-runtime"),od=e=>e.split(" ").map(t=>`vuuDraggable-${t}`),fr=(0,mr.forwardRef)(function({wrapperClassName:t,element:o,onTransitionEnd:r,style:n,scale:s=1},i){let a=(0,mr.useCallback)(c=>{c&&(c.innerHTML="",c.appendChild(o),s!==1&&(c.style.transform=`scale(${s},${s})`))},[o,s]),l=(0,Qi.useForkRef)(i,a);return(0,An.jsx)(ea.Portal,{children:(0,An.jsx)("div",{className:pr("vuuDraggable",...od(t)),ref:l,onTransitionEnd:r,style:n})})}),On=e=>{let t=document.createElement("div");return t.className="vuuDraggable-spacer",e&&t.addEventListener("transitionend",()=>{e.current=!1}),t},ta=()=>{let e=document.createElement("div");return e.className="vuuDraggable-dropIndicatorPosition",e},oa=e=>{let t=document.createElement("div");return t.className="vuuDraggable-dropIndicator",e&&t.addEventListener("transitionend",()=>{e.current=!1}),t};var ra=()=>{let e=(0,Oe.useRef)(0),t=(0,Oe.useRef)(!1),o=(0,Oe.useMemo)(()=>[On(t),On()],[]),r=(0,Oe.useCallback)(()=>o.forEach(l=>l.remove()),[o]),n=(0,Oe.useCallback)((l,c="width")=>{let[d,p]=o;e.current=requestAnimationFrame(()=>{t.current=!0,d.style.cssText=`${c}: 0px`,p.style.cssText=`${c}: ${l}px`,o[0]=p,o[1]=d})},[o]),s=(0,Oe.useCallback)(()=>{e.current&&(cancelAnimationFrame(e.current),e.current=0)},[]),i=(0,Oe.useCallback)((l,c,d,p=!1,u="static",m="horizontal")=>{if(c){let f=m==="horizontal"?"width":"height",[g,h]=o;if(s(),p)t.current?(r(),g.style.cssText=`${f}: ${d}px`,h.style.cssText=`${f}: 0px`,u==="fwd"?(c.element.before(g),c.element.after(h)):(c.element.after(g),c.element.before(h))):u==="fwd"?c.element.after(h):c.element.before(h),n(d,f);else if(u==="static")g.style.cssText=`${f}: ${d}px`,c.element.before(g);else throw Error("useDragDisplacers currently only supports noTransition for static displacement");u!=="static"&&Hn(l,u)}},[n,s,r,o]),a=(0,Oe.useCallback)((l,c,d,p=!1,u="static",m="horizontal")=>{let f=m==="horizontal"?"width":"height",[g,h]=o;s(),p?(t.current?(r(),g.style.cssText=`${f}: ${d}px`,h.style.cssText=`${f}: 0px`,c.element.before(g),c.element.after(h)):u==="fwd"?c.element.after(h):c.element.before(h),n(d,f)):(g.style.cssText=`${f}: ${d}px`,c.element.after(g)),u!=="static"&&Hn(l,u)},[n,s,r,o]);return{displaceItem:i,displaceLastItem:a,clearSpacers:r}};var na=({draggableRef:e,onDrop:t,orientation:o="horizontal",containerRef:r,itemQuery:n="*",selected:s,viewportRange:i})=>{let a=(0,ae.useRef)(),l=(0,ae.useRef)(!1),c=(0,ae.useRef)(-1),d=(0,ae.useRef)([]),p=(0,ae.useRef)(!1),[u,m]=(0,ae.useState)(!1),{clearSpacers:f,displaceItem:g,displaceLastItem:h}=ra(),b=(0,ae.useRef)(),T=`:is(${n}${dr}${Ui},.vuuOverflowContainer-OverflowIndicator)`,E=D=>d.current.findIndex(I=>I.id===D.id),y=(0,ae.useRef)();y.current=i;let v=(0,ae.useCallback)(()=>{f()},[f]),x=(0,ae.useCallback)((D,I,M)=>{let{current:R}=r,{current:L}=b;if(R&&L){d.current=Ft(R,o,T,y.current);let{size:C}=L,$=c.current+C/2,{current:k}=d,V=_t(k,$,"fwd");if(V){let Y=E(V),U=k[Y];M&&D==="fwd"?h(k,k[k.length-1],C,!1,"static",o):g(k,U,C,!0,"static",o)}}},[r,g,h,T,o]),w=(0,ae.useCallback)(D=>{let M=D.target.closest(n);M.ariaSelected&&Array.isArray(s)&&s.length>1&&console.log("its a selected element, and we have a multi select");let{current:R}=r;if(R&&M){let{SCROLL_SIZE:L,CLIENT_SIZE:C}=Me(o),{id:N}=M,{[L]:$,[C]:k}=R;l.current=$>k;let V=d.current=Ft(R,o,T,i,N);console.log({dropTargets:V});let Z=xo(V),Y=V[Z];Y&&R&&(b.current=Y,(Y.isLast?h:g)(V,Y,Y.size,!1,"static",o))}},[r,g,h,T,n,o,s,i]),[S,O]=(0,ae.useMemo)(()=>{let D=!1;return[R=>{if(!D){D=!0;let L=R.element.querySelector(".vuuPopupMenu");if(L){let C=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});L.dispatchEvent(C)}}},R=>{if(D){D=!1;let L=R.element.querySelector(".vuuPopupMenu");if(L){let C=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});L.dispatchEvent(C)}}}]},[]),H=(0,ae.useCallback)((D,I)=>{let{current:M}=b;if(M&&e.current&&r.current){c.current=D;let{current:R}=d,L=_t(R,D,I);if(L&&!L.isDraggedItem)if(L.isOverflowIndicator)m(p.current=!0),S(L);else{let{size:C}=M;(E(L)===R.length-1?h:g)(R,L,C,!0,I,o);let k=R.at(-1);O(k),m(p.current=!1)}a.current=I}},[r,g,h,e,O,o,S]),P=(0,ae.useCallback)(()=>{var R;f();let{current:D}=d,I=xo(D),M=D[I];if(M&&(a.current=void 0,p.current?t(M.index,-1):t(M.index,I)),m(!1),r.current){let L=(R=r.current)==null?void 0:R.scrollTop;I<D.length&&(r.current.scrollTop=L)}},[f,r,t]);return{beginDrag:w,drag:H,drop:P,handleScrollStart:v,handleScrollStop:x,revealOverflowedItems:u}};var ee=require("react");var Eo=require("react");var sa=()=>{let e=(0,Eo.useMemo)(()=>ta(),[]),t=(0,Eo.useCallback)(()=>e.remove(),[e]);return{positionDropIndicator:(0,Eo.useCallback)((r,n="end")=>(n==="end"?r.element.after(e):r.element.before(e),e),[e]),clearSpacer:t}};var aa=require("react/jsx-runtime"),rd=':not([data-overflowed="true"])',nd=':not([aria-hidden="true"])',ia=({draggableRef:e,onDrop:t,orientation:o="horizontal",containerRef:r,itemQuery:n="*",selected:s,viewportRange:i})=>{let a=(0,ee.useRef)(),l=(0,ee.useRef)(null),c=(0,ee.useRef)(null),d=(0,ee.useRef)(""),p=(0,ee.useRef)(!1),u=(0,ee.useRef)(-1),m=(0,ee.useRef)([]),f=(0,ee.useRef)(!1),[g,h]=(0,ee.useState)(!1),[b,T]=(0,ee.useState)(),{clearSpacer:E,positionDropIndicator:y}=sa(),v=(0,ee.useRef)(),x=`:is(${n}${rd}${nd},[data-overflow-indicator])`,w=R=>m.current.findIndex(L=>L.id===R.id),S=(R,L,C)=>{R.start+=L,R.mid+=L,R.end+=L,typeof C=="number"&&(R.currentIndex+=C)},O=(0,ee.useRef)();O.current=i;let H=(0,ee.useCallback)(()=>{E()},[E]),P=(0,ee.useCallback)((R,L,C)=>{let{current:N}=r,{current:$}=v;if(N&&$){m.current=Ft(N,o,x,O.current);let{size:k}=$,Z=u.current+k/2,{current:Y}=m,U=_t(Y,Z,"fwd");U&&y(C&&R==="fwd"?Y[Y.length-1]:U,"start")}},[r,y,x,o]),D=(0,ee.useCallback)(R=>{let C=R.target.closest(n);C.ariaSelected&&Array.isArray(s)&&s.length>1&&console.log("its a selected element, and we have a multi select");let{current:N}=r;if(N&&C){let{SCROLL_SIZE:$,CLIENT_SIZE:k}=Me(o),{id:V}=C,{[$]:Z,[k]:Y}=N;p.current=Z>Y;let U=m.current=Ft(N,o,x,i),te=qi(U,V);if(te&&N){let z=w(te);Yi(U,z),v.current=te;let{current:B}=O;if(B!=null&&B.atEnd)for(let j=0;j<U.length;j++)S(U[j],te.size);for(let j=z;j<U.length;j++)S(U[j],-te.size,-1);let[X,ye]=te.isLast?[U[U.length-1],"end"]:[U[z],"start"];c.current=X,d.current=ye;let qe=y(X,ye),{top:K,left:q,width:oe}=qe.getBoundingClientRect(),re={top:te.isLast?B!=null&&B.atEnd&&!B.atStart?K+te.size-2:K-2:K-te.size-2,left:q,width:oe,height:2};T((0,aa.jsx)(fr,{wrapperClassName:"dropIndicatorContainer",style:re,ref:l,element:oa()}))}}},[n,s,r,o,x,i,y]),I=(0,ee.useCallback)((R,L)=>{let{current:C}=c,{current:N}=v;if(N&&e.current&&r.current){let $=o==="horizontal"?"left":"top";u.current=R;let{current:k}=m,V=_t(k,R,L);if(V&&V.index!==(C==null?void 0:C.index)){if(V.isOverflowIndicator)h(f.current=!0);else if(l.current){if(w(V)===k.length-1){let Y=k[k.length-1],te=y(Y,"start").getBoundingClientRect();l.current.style[$]=`${te.top}px`}else{let U=y(V,"start").getBoundingClientRect();l.current.style[$]=`${U.top}px`}h(f.current=!1)}c.current=V,a.current=L}}},[e,r,o,y]),M=(0,ee.useCallback)(()=>{E();let{current:R}=v,{current:L}=c,{current:C}=d,{current:N}=O;if(R&&N&&L){let{index:$}=R,k=C==="start",{index:V,currentIndex:Z}=L;c.current=null,a.current=void 0,f.current?t($,-1):$<V?t($,k?Z:Z+1):t($,k?V:V+1),T(void 0)}h(!1)},[E,t]);return{beginDrag:D,drag:I,drop:M,dropIndicator:b,handleScrollStart:H,handleScrollStop:P,revealOverflowedItems:g}};var G=require("react");var rt=require("react");var la=({containerRef:e,onScrollingStopped:t,orientation:o="vertical"})=>{let r=(0,rt.useRef)(null),n=(0,rt.useRef)(!1),s=(0,rt.useRef)(0),i=(0,rt.useRef)("fwd"),a=(0,rt.useCallback)((c=!1)=>{console.log("[useAutoScroll] stopScrolling"),r.current!==null&&(clearTimeout(r.current),r.current=null),n.current=!1,t==null||t(i.current,s.current,c)},[t]),l=(0,rt.useCallback)((c,d,p=30)=>{let{current:u}=e;if(u){let{SCROLL_POS:m,SCROLL_SIZE:f,CLIENT_SIZE:g}=Me(o),{[m]:h,[f]:b,[g]:T}=u,E=c==="fwd"?b-T-h:h,y=Math.min(E,p);c==="fwd"?(i.current="fwd",u[m]=s.current=h+y):(i.current="bwd",u[m]=s.current=h-y),y===E?a(!0):(n.current=!0,r.current=window.setTimeout(()=>{l(c,d,p)},100))}},[e,o,a]);return{isScrolling:n,startScrolling:l,stopScrolling:a}};var da=require("react/jsx-runtime"),sd={beginDrag:()=>{},drag:()=>{},draggableRef:{current:null},drop:()=>{},isDragging:!1,isScrolling:!1,handleScrollStart:()=>{},handleScrollStop:()=>{},revealOverflowedItems:!1},ca={start:0,end:1e3,contraStart:0,contraEnd:1e3},id=()=>sd,ad=3,ld=(e,t)=>e.closest(t),cd=e=>e.dataset.index==="overflow"&&e.parentElement!==null&&e.parentElement.classList.contains("overflowed"),ud=(e,t)=>{let o=`:is(${t}${dr},.vuuOverflowContainer-OverflowIndicator)`,n=Array.from(e.querySelectorAll(o)).pop();return[n,cd(n)]},ua=({allowDragDrop:e,containerRef:t,draggableClassName:o,itemQuery:r="*",onDragStart:n,onDrop:s,onDropSettle:i,orientation:a,...l})=>{let c=(0,G.useRef)({start:0,end:0,contraStart:0,contraEnd:0}),[d,p]=(0,G.useState)({draggable:void 0,draggedItemIndex:-1,isDragging:!1}),u=(0,G.useRef)(null),m=(0,G.useRef)(),f=(0,G.useRef)(null),g=(0,G.useRef)(!1),h=(0,G.useRef)({x:0,y:0}),b=(0,G.useRef)({x:0,y:0}),T=(0,G.useRef)({x:0,y:0}),E=(0,G.useRef)(null),y=(0,G.useRef)(-1),v=(0,G.useRef)(-1),x=(0,G.useRef)(),{isDragSource:w,isDropTarget:S,register:O}=Zi(l.id);l.id&&(w||S)&&O(l.id);let H=(0,G.useCallback)(()=>{var oe;let{current:K}=v,q=(oe=t.current)==null?void 0:oe.querySelector(`${r}[data-index="${K}"]`);q&&q.classList.remove("vuuDropTarget-settling"),v.current=-1,i==null||i(K),p(re=>({...re,draggable:void 0}))},[t,r,i]),P=(0,G.useCallback)(K=>{if(t.current){let{POS:q,SCROLL_POS:oe,SCROLL_SIZE:re,CLIENT_SIZE:j}=Me(a),{[oe]:Le,[re]:eo,[j]:dt}=t.current,Lt=eo-dt,It=Le<Lt,to=c.current.end,Ct=Le>0&&K-h.current[q]<=c.current.start,Nt=It&&K-h.current[q]>=to;return Ct?"bwd":Nt?"fwd":""}},[t,a]),D=e===!0||e==="natural-movement"?na:e==="drop-indicator"?ia:id,I=(0,G.useCallback)((K,q,oe)=>{var re;(re=x.current)==null||re.call(x,K,q,oe)},[]),{isScrolling:M,startScrolling:R,stopScrolling:L}=la({containerRef:t,onScrollingStopped:I,orientation:a}),C=(0,G.useCallback)((K,q)=>{y.current=q,s==null||s(K,q),v.current=q},[s]),{beginDrag:N,drag:$,drop:k,handleScrollStart:V,handleScrollStop:Z,...Y}=D({...l,containerRef:t,draggableRef:u,isDragSource:w,isDropTarget:S,itemQuery:r,onDrop:C,orientation:a});x.current=Z;let U=(0,G.useCallback)(K=>{let{CLIENT_POS:q,CONTRA_CLIENT_POS:oe,CONTRA_POS:re,POS:j}=Me(a),{clientX:Le,clientY:eo}=K,{[q]:dt,[oe]:Lt}=K,It=b.current[j],to=b.current[re],Ct=Math.abs(It-dt);if((w?Math.abs(to-Lt):0)-Ct>5&&(c.current=ca),b.current.x=Le,b.current.y=eo,c.current===ca&&u.current){let oo=b.current.x-h.current.x,pt=b.current.y-h.current.y;u.current.style.top=`${pt}px`,u.current.style.left=`${oo}px`}else if(Ct>0&&u.current){let oo=It<dt?"fwd":"bwd",pt=P(dt),zr=b.current[j]-h.current[j];if(pt&&g.current&&!M.current?(V(),R(pt,1)):!pt&&M.current&&L(),!M.current){let Io=Math.round(Math.max(c.current.start,Math.min(c.current.end,zr))),We=a==="horizontal"?"left":"top";u.current.style[We]=`${Io}px`,$(Io,oo)}}},[$,u,P,V,w,M,a,R,L]),te=(0,G.useCallback)(()=>{document.removeEventListener("mousemove",U,!1),document.removeEventListener("mouseup",te,!1),E.current=u.current,k(),p(K=>({...K,draggedItemIndex:-1,isDragging:!1})),m.current=void 0},[U,u,k]),z=(0,G.useCallback)(K=>{let{clientX:q,clientY:oe,target:re}=K,j=ld(re,r),{current:Le}=t;if(Le&&j){let{CONTRA:eo,CONTRA_END:dt,DIMENSION:Lt,END:It,SCROLL_SIZE:to,CLIENT_SIZE:Ct,START:Nt}=Me(a);m.current=j;let{[to]:oo,[Ct]:pt}=Le;g.current=oo>pt;let[zr,Io]=ud(Le,r),We=Le.getBoundingClientRect(),Co=j.getBoundingClientRect(),Br=Co[Lt],{[Nt]:_l,[It]:Wl}=zr.getBoundingClientRect();h.current.x=q-Co.left,h.current.y=oe-Co.top,c.current.start=We[Nt],c.current.end=Io?Math.max(_l,We.right-Br):g.current?We[Nt]+We[Lt]-Br:Wl-Br,c.current.contraStart=We[eo],c.current.contraEnd=We[dt],N(K);let{dataset:{index:Vl="-1"}}=j;p({isDragging:!0,draggable:(0,da.jsx)(fr,{element:Xi(j),onTransitionEnd:H,ref:u,style:ji(Co,We),wrapperClassName:o}),draggedItemIndex:parseInt(Vl)}),n==null||n(),document.addEventListener("mousemove",U,!1),document.addEventListener("mouseup",te,!1)}},[N,t,U,te,o,u,r,n,a,H]),B=(0,G.useCallback)(K=>{let{CLIENT_POS:q,POS:oe}=Me(a),{[q]:re}=K;Math.abs(re-T.current[oe])>ad&&t.current&&(f.current&&(window.clearTimeout(f.current),f.current=null),document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",X,!1),z(K))},[t,N,a]),X=(0,G.useCallback)(()=>{f.current&&(window.clearTimeout(f.current),f.current=null),document.removeEventListener("mousemove",B,!1),document.removeEventListener("mouseup",X,!1)},[B]),ye=(0,G.useCallback)(K=>{console.log("useDragDropNext onMouseDown");let{current:q}=t;if(q&&!K.defaultPrevented){let{clientX:oe,clientY:re}=K;b.current.x=T.current.x=oe,b.current.y=T.current.y=re,document.addEventListener("mousemove",B,!1),document.addEventListener("mouseup",X,!1),K.persist(),f.current=window.setTimeout(()=>{document.removeEventListener("mousemove",B,!1),document.removeEventListener("mouseup",X,!1),z(K.nativeEvent)},500)}},[t,z,B,X]),{current:qe}=E;return(0,G.useLayoutEffect)(()=>{if(qe&&t.current){let K=y.current,q=t.current.querySelector(`${r}[data-index="${K}"]`);q?(q.classList.add("vuuDropTarget-settling"),requestAnimationFrame(()=>{let{top:oe,left:re}=q.getBoundingClientRect(),{top:j,left:Le}=qe.getBoundingClientRect();Le!==re||j!==oe?(qe.classList.add("vuuDraggable-settling"),qe.style.top=`${oe}px`,qe.style.left=`${re}px`):H()})):console.log(`dont have the dropped item (at ${K})`),E.current=null}},[t,r,qe,H]),{...Y,...d,isScrolling:M,onMouseDown:e?ye:void 0}};var ke=require("react"),To=require("@salt-ds/core");var zn=require("react/jsx-runtime"),kn="vuuEditableLabel",gr=(0,ke.forwardRef)(function({className:t,defaultEditing:o,defaultValue:r,editing:n,onChange:s,onEnterEditMode:i,onExitEditMode:a,value:l,...c},d){let p=(0,ke.useRef)(null),u=(0,ke.useRef)(!1),[m,f]=(0,To.useControlled)({controlled:l,default:r!=null?r:"",name:"EditableLabel",state:"value"}),[g,h]=(0,To.useControlled)({controlled:n,default:o!=null?o:!1,name:"EditableLabel",state:"editing"}),b=(0,ke.useCallback)(H=>{h(u.current=H)},[]),T=(0,ke.useRef)(m);(0,ke.useLayoutEffect)(()=>{g&&p.current!==null&&(p.current.select(),p.current.focus())},[g,p]);let E=(0,ke.useCallback)(()=>{b(!0),i&&i()},[i,b]),y=({cancelEdit:H=!1,allowDeactivation:P=!1}={})=>{b(!1);let D=T.current;D!==m&&(H?f(D):T.current=m),a&&a(D,m,P,H)},v=H=>{let{value:P}=H.target;f(P),s&&s(P)},x=()=>{E()},w=()=>{u.current&&y({allowDeactivation:!0})},S=H=>{g&&H.key==="Enter"?(H.stopPropagation(),y()):H.key==="ArrowRight"||H.key==="ArrowLeft"?H.stopPropagation():H.key==="Escape"&&y({cancelEdit:!0})},O=pr(kn,t,{[`${kn}-editing`]:g});return(0,zn.jsx)("div",{...c,className:O,onDoubleClick:x,"data-text":m,ref:d,children:g?(0,zn.jsx)(To.Input,{inputProps:{className:`${kn}-input`},value:m,onBlur:w,onChange:v,onKeyDown:S,inputRef:p,style:{padding:0},textAlign:"left",variant:"secondary"}):m})});var Ra=require("@salt-ds/core"),Ma=W(require("classnames")),Vt=W(require("react"));var de=require("react");var pa=e=>typeof e=="object"&&e!==null&&"tabIndex"in e&&typeof e.tabIndex=="number",ma=e=>({label:"Close",location:"tab",action:"close-tab",options:e}),fa=e=>({label:"Rename",location:"tab",action:"rename-tab",options:e});var dd=e=>{if(e){let t=parseInt(e.dataset.index||"");if(!isNaN(t))return t}return-1},ga=(e,t)=>{if(e){let o=e.querySelector(`[data-index]:has(${t})`);return dd(o)}return-1},Bn=e=>ga(e,'[aria-selected="true"]'),ha=e=>ga(e,".vuuEditableLabel-editing");var Wt=require("@vuu-ui/vuu-utils"),Ue=require("react"),ba=(e,t,o="horizontal")=>{let r=(0,Ue.useRef)(!1),n=(0,Ue.useCallback)(()=>{r.current=!0},[]),s=(0,Ue.useCallback)(()=>{r.current=!1},[]),i=(0,Ue.useCallback)(()=>{var l,c;(l=e.current)==null||l.style.setProperty("--tab-thumb-transition","none"),(c=e.current)==null||c.removeEventListener("transitionend",i)},[e]),a=(0,Ue.useRef)(-1);return(0,Ue.useMemo)(()=>{var d,p;let l=0,c=0;if(a.current!==-1){let u=(d=e.current)==null?void 0:d.querySelector(".vuuTab-selected"),m=(p=e.current)==null?void 0:p.querySelector(`[data-index="${t}"] .vuuTab`),{positionProp:f,sizeProp:g}=Wt.MEASURES[o];if(u&&m&&!r.current){let{[f]:h,[g]:b}=u.getBoundingClientRect(),{[f]:T}=m.getBoundingClientRect();if((0,Wt.isValidNumber)(h)&&(0,Wt.isValidNumber)(T)&&(0,Wt.isValidNumber)(b)){console.log({orientation:o,positionProp:f,oldPosition:h,newPosition:T}),l=h-T,c=b;let y=Math.abs(l/(o==="horizontal"?1100:700));requestAnimationFrame(()=>{var v,x,w,S;(v=e.current)==null||v.style.setProperty("--tab-thumb-offset","0px"),(x=e.current)==null||x.style.setProperty("--tab-thumb-size","100%"),(w=e.current)==null||w.style.setProperty("--tab-thumb-transition",`all ${y}s ease`),(S=e.current)==null||S.addEventListener("transitionend",i)})}}}return a.current=t,r.current?{containerStyle:{"--tab-thumb-offset":"0px","--tab-thumb-size":"100%"},resumeAnimation:s,suspendAnimation:n}:{containerStyle:{"--tab-thumb-offset":`${l}px`,"--tab-thumb-size":c?`${c}px`:void 0},resumeAnimation:s,suspendAnimation:n}},[t,e,o,i,s,n])};var xa=require("@salt-ds/core"),Ea=require("@vuu-ui/vuu-utils"),le=require("react"),he=require("@vuu-ui/vuu-utils");var Ta={horizontal:{[he.Home]:"start",[he.End]:"end",[he.ArrowLeft]:"bwd",[he.ArrowRight]:"fwd"},vertical:{[he.Home]:"start",[he.End]:"end",[he.ArrowUp]:"bwd",[he.ArrowDown]:"fwd"}},pd=(e,t="horizontal")=>Ta[t][e]!==void 0,md=e=>e===he.ArrowDown;function ya(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 fd=e=>e!==null&&!e.classList.contains("wrapped"),hr=(e,t)=>e?e.querySelector(`[data-index="${t}"]`):null,va=({containerRef:e,defaultHighlightedIdx:t=-1,highlightedIdx:o,keyBoardActivation:r,orientation:n,selectedIndex:s=0})=>{let i=r==="manual",a=(0,le.useRef)(!1),l=(0,le.useRef)(-1),[c,d]=(0,le.useState)(!1),[,p]=(0,le.useState)({}),[u,m]=(0,xa.useControlled)({controlled:o,default:t,name:"UseKeyboardNavigation"}),f=(0,le.useCallback)(D=>{m(l.current=D)},[m]),g=(0,le.useRef)(!1),h=(0,le.useCallback)((D,I=!1,M,R=70)=>{f(D),M===!0&&!g.current&&(g.current=!0);let L=()=>{let C=hr(e.current,D);if(C){let N=(0,Ea.getFocusableElement)(C);N==null||N.focus()}};I?L():setTimeout(L,R)},[e,f]),b=D=>{if(l.current===-1&&D.target.tabIndex!==-1){let I=ha(e.current);I!==-1?requestAnimationFrame(()=>{f(I)}):setTimeout(()=>{l.current===-1&&s!==null&&f(s)},200)}},T=(0,le.useCallback)(()=>{var D,I;return(I=(D=e.current)==null?void 0:D.querySelectorAll("[data-index]").length)!=null?I:0},[e]),E=(0,le.useCallback)((D="fwd",I)=>{let M=T(),L=ya(M,D,typeof I=="number"?I:M),C=D==="start"?"fwd":D==="end"?"bwd":D;for(;(C==="fwd"&&L<M||C==="bwd"&&L>0)&&!fd(hr(e.current,L));){let N=ya(M,C,L);if(N===L)break;L=N}return L},[e,T]),y=(0,le.useCallback)((D,I=!1)=>{let M=Ta[n][D.key],R=E(M,u);R!==u?i&&h(R,!0):I&&p({})},[u,i,E,h,n]),v=(0,le.useCallback)(()=>{let D=hr(e.current,u);return D?D.querySelector(".vuuPopupMenu")!=null:!1},[e,u]),x=(0,le.useCallback)(()=>{let D=hr(e.current,u),I=D==null?void 0:D.querySelector(".vuuPopupMenu");if(I){let M=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});I.dispatchEvent(M)}return!1},[e,u]),w=(0,le.useCallback)(D=>{T()>0&&pd(D.key,n)?(D.preventDefault(),g.current?y(D):(g.current=!0,y(D,!0))):md(D.key)&&v()&&x()},[x,T,v,y,n]),S=(D,I)=>{f(I)},O=(0,le.useCallback)(()=>{c||(d(!0),a.current?a.current=!1:g.current=!0)},[c]),H=(0,le.useCallback)(()=>{c||(a.current=!0),g.current=!1},[c]);return{containerProps:{onBlur:D=>{let I=D.target.closest(".vuuTabstrip"),M=D.relatedTarget;I&&!(I!=null&&I.contains(M))&&(f(-1),d(!1))},onMouseDownCapture:H,onFocus:O,onMouseLeave:()=>{g.current=!0,f(-1),a.current=!1}},focusVisible:g.current?u:-1,focusIsWithinComponent:c,highlightedIdx:u,focusTab:h,onClick:S,onFocus:b,onKeyDown:w,setHighlightedIdx:f}};var wa=require("@salt-ds/core"),vo=require("react"),gd=["Enter"," "],hd=e=>e&&e.matches('[class*="vuuTab "]'),Da=({defaultSelected:e,highlightedIdx:t,onSelectionChange:o,selected:r})=>{let[n,s,i]=(0,wa.useControlled)({controlled:r,default:e!=null?e:0,name:"Tabstrip",state:"value"}),a=(0,vo.useCallback)(p=>gd.includes(p.key),[]),l=(0,vo.useCallback)(p=>{s(p),o==null||o(p)},[o,s]),c=(0,vo.useCallback)(p=>{let u=p.target;a(p)&&t!==n&&hd(u)&&(p.stopPropagation(),p.preventDefault(),l(t))},[a,t,n,l]),d=(0,vo.useCallback)((p,u)=>{u!==n&&l(u)},[l,n]);return{activateTab:l,isControlled:i,onClick:d,onKeyDown:c,selected:n}};var bd=new Set(["Enter"," "]),yd=e=>bd.has(e),xd=(e,t)=>e?e.querySelector(`[data-index="${t}"]`):null,Sa=({activeTabIndex:e,allowDragDrop:t,animateSelectionThumb:o,containerRef:r,onActiveChange:n,onAddTab:s,onCloseTab:i,onExitEditMode:a,onMoveTab:l,orientation:c,keyBoardActivation:d})=>{let p=(0,de.useRef)(e),{focusTab:u,highlightedIdx:m,onClick:f,onKeyDown:g,setHighlightedIdx:h,...b}=va({containerRef:r,keyBoardActivation:d,orientation:c,selectedIndex:p.current}),{activateTab:T,onClick:E,onKeyDown:y,selected:v}=Da({highlightedIdx:m,onSelectionChange:n,selected:e});p.current=v;let{containerStyle:x,resumeAnimation:w,suspendAnimation:S}=ba(r,o?v:-1,c),O=(0,de.useCallback)((z,B)=>{let{current:X}=p;console.log(`useTabstrip handleDrop ${z} - ${B} ${X}`),l==null||l(z,B);let ye=-1;B!==-1&&(X===z?ye=B:z>X&&B<=X?ye=X+1:z<X&&B>=X&&(ye=X-1),ye!==-1&&(S(),T(ye),requestAnimationFrame(w)),u(B,!1,!1,350))},[u,l,w,T,S]),{onMouseDown:H,...P}=ua({allowDragDrop:t,containerRef:r,draggableClassName:`tabstrip-${c}`,onDrop:O,orientation:"horizontal",itemQuery:".vuuOverflowContainer-item"}),D=(0,de.useCallback)((z,B,X,ye)=>{console.log(`handleExitEditMode ${z} ${B} ${X} ${ye}`),a==null||a(z,B,X,ye),X||u(ye,!1,!0)},[u,a]),I=(0,de.useCallback)((z,B)=>{f(z,B),E(z,B)},[f,E]),M=(0,de.useCallback)((z=m)=>{let B=xd(r.current,z);if(B)return B.querySelector(".vuuEditableLabel")},[r,m]),R=(0,de.useCallback)((z=m)=>{let B=M(z);return B?B.classList.contains("vuuEditableLabel-editing"):!1},[M,m]),L=(0,de.useCallback)((z=m)=>{let B=M(z);if(B){let X=new MouseEvent("dblclick",{view:window,bubbles:!0,cancelable:!0});B.dispatchEvent(X)}},[M,m]),C=(0,de.useCallback)(z=>{g(z),z.defaultPrevented||y(z),!z.defaultPrevented&&yd(z.key)&&L()},[L,g,y]),N=(0,de.useCallback)(z=>{let B=Bn(r.current),X=B>z?B-1:B===z?0:B;return S(),i==null||i(z,X),setTimeout(()=>{w()},200),!0},[r,i,w,S]),$=(0,de.useCallback)(z=>(L(z),!0),[L]),k=(0,de.useCallback)(z=>{if(pa(z.options))switch(z.menuId){case"close-tab":return N(z.options.tabIndex);case"rename-tab":return $(z.options.tabIndex);default:console.log(`tab menu action ${z.menuId}`)}return!1},[N,$]),V=(0,de.useCallback)(()=>{R()?h(m):u(m)},[m,u,h,R]),Z=(0,de.useCallback)(z=>{let B=parseInt(z.index);isNaN(B)||T(B)},[T]),Y={onFocus:b.onFocus,onKeyDown:C},U=(0,de.useCallback)(()=>{s==null||s(),requestAnimationFrame(()=>{let z=Bn(r.current);z!==-1&&u(z)})},[r,u,s]),te={onClick:I,onKeyDown:C,onExitEditMode:D,onMenuAction:k,onMenuClose:V,onMouseDown:H};return{activeTabIndex:v,containerStyle:x,focusVisible:b.focusVisible,containerProps:{...b.containerProps,onSwitchWrappedItemIntoView:Z},navigationProps:Y,onClickAddTab:U,tabProps:te,...P}};var Kt=require("react/jsx-runtime"),La=require("react"),$n="vuuTabstrip",Pa=({activeTabIndex:e,allowAddTab:t,allowCloseTab:o,allowDragDrop:r=!1,allowRenameTab:n=!1,animateSelectionThumb:s=!1,children:i,className:a,id:l,keyBoardActivation:c="manual",location:d,onActiveChange:p,onAddTab:u,onCloseTab:m,onExitEditMode:f,onMoveTab:g,orientation:h="horizontal",showTabMenuButton:b,style:T,...E})=>{let y=(0,Vt.useRef)(null),{activeTabIndex:v,focusVisible:x,containerStyle:w,draggedItemIndex:S,onClickAddTab:O,tabProps:H,...P}=Sa({activeTabIndex:e,allowDragDrop:r,animateSelectionThumb:s,containerRef:y,keyBoardActivation:c,onActiveChange:p,onAddTab:u,onCloseTab:m,onExitEditMode:f,onMoveTab:g,orientation:h}),D=no(l),I=(0,Ma.default)($n,`${$n}-${h}`,a),M=T||w?{...T,...w}:void 0,R=(0,Vt.useMemo)(()=>mt(i).map((L,C)=>{let{id:N=`${D}-tab-${C}`,closeable:$=o,editable:k=n,showMenuButton:V=b}=L.props,Z=C===v;return Vt.default.cloneElement(L,{...H,...P.navigationProps,closeable:$,"data-overflow-priority":Z?"1":void 0,dragging:S===C,editable:k,focusVisible:x===C,id:N,index:C,key:C,location:d,selected:Z,showMenuButton:V,tabIndex:Z?0:-1})}).concat(t?(0,La.createElement)(Ra.Button,{...P.navigationProps,"aria-label":"Create Tab",className:`${$n}-addTabButton`,"data-icon":"add","data-overflow-priority":"1",key:"addButton",onClick:O,variant:"secondary",tabIndex:-1}):[]),[v,t,o,n,i,x,D,d,O,b,H,S,P.navigationProps]);return(0,Kt.jsxs)(Kt.Fragment,{children:[(0,Kt.jsx)(Fn,{...E,...P.containerProps,className:I,height:28,id:D,orientation:h,overflowIcon:"more-horiz",ref:y,style:M,children:R}),P.draggable]})};var ka=require("@salt-ds/core"),za=W(require("classnames")),wt=require("react");var Ia=require("@vuu-ui/vuu-popups"),Ca=require("react"),Na=W(require("classnames"));var Aa=require("react/jsx-runtime"),Ed="vuuTabMenu",Ha=({allowClose:e,allowRename:t,location:o,onMenuAction:r,onMenuClose:n,index:s})=>{let[i,a]=(0,Ca.useMemo)(()=>[(l,c)=>{let d=[];return t&&d.push(fa(c)),e&&d.push(ma(c)),d},{tabIndex:s}],[e,t,s]);return(0,Aa.jsx)(Ia.PopupMenu,{className:Ed,menuBuilder:i,menuActionHandler:r,menuLocation:(0,Na.default)("tab",o),menuOptions:a,onMenuClose:n,tabIndex:-1})};var vt=require("react/jsx-runtime"),Tt="vuuTab",Oa=()=>{},Ba=(0,wt.forwardRef)(function({ariaControls:t,children:o,className:r,closeable:n=!1,dragging:s,editable:i=!1,editing:a,focusVisible:l,index:c=-1,label:d,location:p,onClick:u,onClose:m,onEnterEditMode:f=Oa,onExitEditMode:g=Oa,onFocus:h,onKeyUp:b,onMenuAction:T,onMenuClose:E,orientation:y,selected:v,showMenuButton:x=n||i,tabIndex:w,...S},O){if(x&&typeof T!="function")throw Error("Tab onMenuAction must be provided if showMenuButton is set");let H=(0,wt.useRef)(null),P=(0,wt.useRef)(null),D=(0,ka.useForkRef)(O,H),I=(0,wt.useCallback)(N=>{a||(N.preventDefault(),u==null||u(N,c))},[a,c,u]),M=(N="",$="",k=!0)=>g(N,$,k,c),R=N=>{switch(N.key){case"Backspace":case"Delete":n&&(N.stopPropagation(),m&&m(c));break;default:b&&b(N,c)}},L=()=>i?(0,vt.jsx)(gr,{editing:a,defaultValue:d,onEnterEditMode:f,onExitEditMode:M,ref:P},d):d,C=N=>{if(P.current){let k=P.current.querySelector(".vuuEditableLabel-input");k==null||k.focus()}h==null||h(N)};return(0,vt.jsxs)("div",{...S,"aria-controls":t,"aria-selected":v,className:(0,za.default)(Tt,{[`${Tt}-closeable`]:n,"vuuDraggable-dragAway":s,[`${Tt}-editing`]:a,[`${Tt}-selected`]:v||void 0,[`${Tt}-vertical`]:y==="vertical",vuuFocusVisible:l}),onClick:I,onFocus:C,onKeyUp:R,ref:D,role:"tab",tabIndex:w,children:[(0,vt.jsx)("div",{className:`${Tt}-main`,children:(0,vt.jsx)("span",{className:`${Tt}-text`,"data-text":i?void 0:d,children:o!=null?o:L()})}),x?(0,vt.jsx)(Ha,{allowClose:n,allowRename:i,location:p,onMenuAction:T,onMenuClose:E,index:c}):null]})});var vr=require("@salt-ds/core"),Tr=W(require("classnames")),wr=require("react");function Td(e){var t;if(e){let o=e.dataset.idx;if(o)return parseInt(o,10);if(o=(t=e.ariaPosInSet)!=null?t:"-1")return parseInt(o,10)-1}}var _n=e=>e.closest("[data-idx],[aria-posinset]");var $a=e=>Td(_n(e));var Gt=require("react"),vd=new Set(["/","-","."]),wd=e=>vd.has(e),Fa=(e,t)=>t.startsWith(e)&&wd(t[e.length]),_a=(e,t="root",{collapsibleHeaders:o=void 0,defaultExpanded:r=!1,revealSelected:n=!1}={})=>{let s=(u,m,f)=>{if(u.childNodes)return u.childNodes.length;if(u.header){let g=f+1,h=0;for(;g<m.length&&!m[g].header;)h++,g++;return h}else return 0},i=(0,Gt.useCallback)(u=>Array.isArray(n)?n.some(m=>Fa(u,m)):r,[r,n]),a=(0,Gt.useCallback)((u,m,f=1,g="",h=[],b=[])=>{let T=0;return u.forEach((E,y,v)=>{var M;let x=E.header&&o,w=E.childNodes&&o===!1,S=!E.childNodes||E.childNodes.length===0,O=w||S&&!x,H=g?`${g}.${y}`:`${y}`,P=(M=E.id)!=null?M:`${t}-${H}`,D=O?void 0:i(P),I={...E,childNodes:void 0,id:P,count:!w&&D===void 0?0:s(E,v,y),expanded:D,index:m.index,level:f};if(h.push(I),b.push(u[y]),T+=1,m.index+=1,E.childNodes){let[R,L]=a(E.childNodes,m,f+1,H,[],b);I.childNodes=L,(D===!0||w)&&(T+=R)}}),[T,h,b]},[o,t,i]),[l,c,d]=(0,Gt.useMemo)(()=>a(e,{index:0}),[a,e]),p=(0,Gt.useCallback)((u,m=c)=>{let f=m.find(g=>{var h;return g.id===u||((h=g==null?void 0:g.childNodes)==null?void 0:h.length)&&Fa(g.id,u)});if((f==null?void 0:f.id)===u)return d[f.index];if(f)return p(u,f.childNodes)},[d,c]);return[l,c,p]};var nt=require("react"),Ka=require("@salt-ds/core"),Wa="single",Dd="checkbox",Sd="multi",Rd="extended",Md=["Enter"," "],Va={},Pd=e=>e.expanded!==void 0,Ga=e=>e&&e!=="none",Za=({defaultSelected:e,highlightedIdx:t,treeNodes:o,onChange:r,selected:n,selection:s=Wa,selectionKeys:i=Md})=>{let a=s===Wa,l=s===Sd||s.startsWith(Dd),c=s===Rd,d=(0,nt.useRef)(-1),p=(0,nt.useCallback)(y=>i.includes(y.key),[i]),[u,m]=(0,Ka.useControlled)({controlled:n,default:e!=null?e:[],name:"selected"}),f=(0,nt.useCallback)((y,v,x,w,S=!1)=>{let{current:O}=d,H=u==null?void 0:u.includes(x),D=a||c&&!S&&(!w||O===-1),I=l||c&&S&&!w,M=[];if(D&&H)M=[];else if(D)M=[x];else if(I&&H)M=u.filter(R=>R!==x);else if(I)M=u.concat(x);else if(c){let[R,L]=v>O?[O,v]:[v,O];M=u.slice();for(let C=R;C<=L;C++){let{id:N}=o[C];u.includes(N)||M.push(N)}}m(M),r&&r(y,M)},[c,o,l,r,u,m,a]),g=(0,nt.useCallback)(y=>{if(~t&&p(y)){y.preventDefault();let v=o[t];f(y,t,v.id,!1,y.ctrlKey||y.metaKey),c&&(d.current=t)}},[c,t,o,p,f]),h=(0,nt.useCallback)((y,v)=>{if(c&&y.shiftKey){let x=o[v];f(y,v,x.id,!0)}},[c,o,f]),b=s==="none"?Va:{onKeyDown:g,onKeyboardNavigation:h},T=(0,nt.useCallback)(y=>{if(t!==-1){let v=o[t];Pd(v)||(y.preventDefault(),y.stopPropagation(),f(y,t,v.id,y.shiftKey,y.ctrlKey||y.metaKey),c&&(d.current=t))}},[c,t,o,f]);return{listHandlers:b,listItemHandlers:s==="none"?Va:{onClick:T},selected:u,setSelected:m}};var Ee=require("react");var St=require("react");var Dt=new Map,Xa=(e,t,o)=>{switch(o){case"height":return t.height;case"clientHeight":return e.clientHeight;case"clientWidth":return e.clientWidth;case"contentHeight":return t.contentHeight;case"contentWidth":return t.contentWidth;case"scrollHeight":return Math.ceil(e.scrollHeight);case"scrollWidth":return Math.ceil(e.scrollWidth);case"width":return t.width;default:return 0}};var Ua=new ResizeObserver(e=>{for(let t of e){let{target:o,borderBoxSize:r,contentBoxSize:n}=t,s=Dt.get(o);if(s){let[{blockSize:i,inlineSize:a}]=r,[{blockSize:l,inlineSize:c}]=n,{onResize:d,measurements:p}=s,u=!1;for(let[m,f]of Object.entries(p)){let g=Xa(o,{height:i,width:a,contentHeight:l,contentWidth:c},m);g!==f&&(u=!0,p[m]=g)}u&&d&&d(p)}}});function qa(e,t,o,r=!1){let n=(0,St.useRef)(t),s=(0,St.useCallback)(i=>{let{width:a,height:l}=i.getBoundingClientRect(),{clientWidth:c,clientHeight:d}=i;return n.current.reduce((p,u)=>(p[u]=Xa(i,{width:a,height:l,contentHeight:d,contentWidth:c},u),p),{})},[]);(0,St.useEffect)(()=>{let i=e.current;async function a(){Dt.set(i,{measurements:{}}),await document.fonts.ready;let l=Dt.get(i);if(l){let c=s(i);l.measurements=c,Ua.observe(i),r&&o(c)}else console.log("%cuseResizeObserver an target expected to be under observation wa snot found. This warrants investigation","font-weight:bold; color:red;")}if(i){if(Dt.has(i))throw Error("useResizeObserver attemping to observe same element twice");a()}return()=>{i&&Dt.has(i)&&(Ua.unobserve(i),Dt.delete(i))}},[s,e]),(0,St.useEffect)(()=>{let i=e.current,a=Dt.get(i);if(a){if(n.current!==t){n.current=t;let l=s(i);a.measurements=l}a.onResize=o}},[t,s,e,o])}var Ld=["height","scrollHeight"],Ya=(e,t,o=!1)=>{let r=(0,Ee.useRef)(0),n=(0,Ee.useRef)(!1),s=(0,Ee.useRef)(0),i=(0,Ee.useRef)(0),a=(0,Ee.useCallback)(d=>{let p=d.ariaExpanded?d.firstChild:d,u=o?30:0,m=p.offsetTop,f=p.offsetHeight,g=r.current+u,h=g+s.current-u;(m+f>h||m<g)&&(r.current=m+f>h?r.current+(m+f)-h:m-u,n.current=!0,e.current&&(e.current.scrollTop=r.current),setTimeout(()=>{n.current=!1}))},[e,o]),l=(0,Ee.useCallback)(d=>{r.current=d.target.scrollTop},[]);(0,Ee.useEffect)(()=>{let{current:d}=e;return d&&d.addEventListener("scroll",l),()=>{d&&d.removeEventListener("scroll",l)}},[e,l]),(0,Ee.useLayoutEffect)(()=>{if(t!==-1&&i.current>s.current&&e.current){let d=e.current.querySelector(`
18
+ [data-idx='${t}'],
19
+ [aria-posinset='${t+1}']
20
+ `);d===null?console.log("[useViewportTracking], is this virtualised ? we're going to have to know rowHeight"):a(d)}},[t,e,a]),(0,Ee.useEffect)(()=>{},[o]);let c=(0,Ee.useCallback)(({height:d,scrollHeight:p})=>{s.current=d,i.current=p},[]);return qa(e,Ld,c,!0),n};var wo=require("react");var Pe=require("react");var ja=({id:e})=>{let t=e.lastIndexOf("-");if(t!==-1){let r=e.slice(t+1).split(".");return r.length===1?null:(r.pop(),`${e.slice(0,t)}-${r.join(".")}`)}else if((t=e.lastIndexOf("/"))!==-1)return e.slice(0,t)},Ja=e=>e.childNodes!==void 0;var Wn=e=>e.header===!0,Id=new Set([".","/"]),Qa=(e,t)=>t.startsWith(e.id)?Id.has(t.charAt(e.id.length)):!1,Rt=(e,t)=>{for(let o of e){if(o.id===t)return o;if(Qa(o,t))return Rt(o.childNodes,t)}},br=(e,t)=>{let o=typeof t=="string"?t:t.id;for(let r=0;r<e.length;r++)if(e[r].id===o)return r},yr=(e,t,o)=>{let r;return e.map(s=>s.id===t?{...s,...o}:Qa(s,t)?(r=yr(s.childNodes,t,o),{...s,childNodes:r}):s)};var il=require("@salt-ds/core");function Cd(e,...t){let o=new Set(e);for(let r of t)for(let n of r)o.add(n);return o}var Vn="ArrowUp",el="ArrowDown",Zt="ArrowLeft";var tl="ArrowRight",xr="Enter";var Nd="Delete",Hd=new Set([xr,Nd]),Ad=new Set(["Tab"]),Od=new Set(["ArrowRight","ArrowLeft"]),ol=new Set(["Home","End","ArrowDown","ArrowUp"]),rl=new Set(["Home","End","ArrowRight","ArrowLeft"]),kd=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),bx=Cd(Hd,rl,ol,Od,kd,Ad);var nl=({key:e},t="vertical")=>(t==="vertical"?ol:rl).has(e);function sl(e,t,o){return t===Vn||t===Zt?o>0?o-1:o:o===null?0:o===e-1?o:o+1}var zd=e=>!e.header&&!e.childNodes,Bd=e=>zd(e)||e.expanded!==void 0,al=({defaultHighlightedIdx:e=-1,highlightedIdx:t,treeNodes:o,onHighlight:r,onKeyboardNavigation:n,selected:s=[]})=>{let{bwd:i,fwd:a}=(0,Pe.useMemo)(()=>({bwd:Vn,fwd:el}),[]),[l,c,d]=(0,il.useControlled)({controlled:t,default:e,name:"highlightedIdx"}),p=(0,Pe.useCallback)(y=>{r==null||r(y),c(y)},[r,c]),u=(0,Pe.useCallback)((y=a,v=y===a?-1:o.length)=>{let x=sl(o.length,y,v);for(;x!==-1&&(y===a&&x<o.length||y===i&&x>0)&&!Bd(o[x]);)x=sl(o.length,y,x);return x},[i,a,o]),m=(0,Pe.useRef)(!0),f=(0,Pe.useRef)(!1),g=y=>f.current=y,h=(0,Pe.useCallback)(()=>{if(f.current)f.current=!1;else if(s.length>0){let y=Rt(o,s[0]);if(y){let v=br(o,y);p(v)}}else p(u())},[o,u,s,p]),b=(0,Pe.useCallback)(y=>{let v=u(y.key,l);v!==l&&(p(v),n==null||n(y,v))},[l,u,n,p]),T=(0,Pe.useCallback)(y=>{o.length>0&&nl(y,"vertical")&&(y.preventDefault(),y.stopPropagation(),m.current=!0,b(y))},[o,b]),E=(0,Pe.useMemo)(()=>({onBlur:()=>{p(-1)},onFocus:h,onKeyDown:T,onMouseDownCapture:()=>{m.current=!1,g(!0)},onMouseMove:()=>{m.current&&(m.current=!1)},onMouseLeave:()=>{m.current=!0,g(!1),p(-1)}}),[h,T,p]);return{focusVisible:m.current?l:-1,controlledHighlighting:d,highlightedIdx:l,hiliteItemAtIndex:p,keyBoardNavigation:m,listProps:E,setIgnoreFocus:g}};var Ut=require("react");var Er=(e,t=[],o={value:0})=>{let r=!1;for(let n of e)r&&!Wn(n)||(t[o.value]=n,o.value+=1,r=!1,Wn(n)&&n.expanded===!1?r=!0:Ja(n)&&Kn(n)&&Er(n.childNodes,t,o));return t},ll=e=>{let t=(0,Ut.useRef)(e),o=(0,Ut.useRef)(e),r=(0,Ut.useRef)(Er(e)),[,n]=(0,Ut.useState)({});e!==t.current&&(t.current=e,o.current=e,r.current=Er(e));let s=i=>{o.current=i,r.current=Er(i),n({})};return{data:o.current,indexPositions:r.current,setData:s}};var Xe=require("react");var $d={},Fd=e=>e&&e.hasAttribute("aria-expanded"),cl=({collapsibleHeaders:e,highlightedIdx:t,treeNodes:o,setVisibleData:r,source:n})=>{let s=(0,Xe.useRef)(n),i=(0,Xe.useRef)(s.current),a=(0,Xe.useCallback)(f=>{r(i.current=f)},[r]),l=(0,Xe.useCallback)((f,{id:g})=>yr(f,g,{expanded:!0}),[]),c=(0,Xe.useCallback)((f,{id:g})=>yr(f,g,{expanded:!1}),[]),d=(0,Xe.useCallback)(f=>{if(f.key===tl||f.key===xr){let g=o[t];g&&g.expanded===!1&&(f.preventDefault(),a(l(i.current,g)))}if(f.key===Zt||f.key===xr){let g=o[t];g&&g.expanded&&(f.preventDefault(),a(c(i.current,g)))}},[c,l,t,o,a]),p=e?{onKeyDown:d}:$d,m={onClick:(0,Xe.useCallback)(f=>{let g=_n(f.target);if(Fd(g)){f.stopPropagation(),f.preventDefault();let h=Rt(n,g.id);(h==null?void 0:h.expanded)===!1?a(l(n,h)):(h==null?void 0:h.expanded)===!0&&a(c(n,h))}},[c,l,a,n])};return{listHandlers:p,listItemHandlers:m}};var ul=require("react");var dl=({highlightedIdx:e,hiliteItemAtIndex:t,indexPositions:o,source:r})=>({listHandlers:{onKeyDown:(0,ul.useCallback)(i=>{if(i.key===Zt){let a=o[e],l=ja(a);if(l){i.preventDefault();let c=Rt(r,l);if(c){let d=br(o,c);d!==void 0&&t(d)}}}},[e,t,o,r])}});var _d=[],pl=({defaultSelected:e,sourceWithIds:t,onChange:o,onHighlight:r,selected:n,selection:s})=>{let i=(0,wo.useRef)(_d),a=ll(t),l=(E,y)=>{var v,x;(x=(v=u.listHandlers).onKeyboardNavigation)==null||x.call(v,E,y)},{highlightedIdx:c,...d}=al({treeNodes:a.indexPositions,onHighlight:r,onKeyboardNavigation:l,selected:i.current}),p=cl({collapsibleHeaders:!0,highlightedIdx:c,treeNodes:a.indexPositions,setVisibleData:a.setData,source:a.data}),u=Za({defaultSelected:e,highlightedIdx:c,treeNodes:a.indexPositions,onChange:o,selected:n,selection:s}),m=dl({source:a.data,highlightedIdx:c,hiliteItemAtIndex:d.hiliteItemAtIndex,indexPositions:a.indexPositions}),f=(0,wo.useCallback)(E=>{var y,v,x;(y=p.listItemHandlers)==null||y.onClick(E),E.defaultPrevented||(x=(v=u.listItemHandlers)==null?void 0:v.onClick)==null||x.call(v,E)},[p,u]),g=(0,wo.useCallback)(E=>{var y,v,x,w,S,O,H,P;(v=(y=d.listProps).onKeyDown)==null||v.call(y,E),E.defaultPrevented||(w=(x=u.listHandlers).onKeyDown)==null||w.call(x,E),E.defaultPrevented||(O=(S=p.listHandlers).onKeyDown)==null||O.call(S,E),E.defaultPrevented||(P=(H=m.listHandlers).onKeyDown)==null||P.call(H,E)},[p.listHandlers,d.listProps,u.listHandlers,m.listHandlers]),h=()=>{var E;return c===void 0||c===-1||(E=a.indexPositions[c])==null?void 0:E.id};i.current=u.selected;let b={"aria-activedescendant":h(),onBlur:d.listProps.onBlur,onFocus:d.listProps.onFocus,onKeyDown:g,onMouseDownCapture:d.listProps.onMouseDownCapture,onMouseLeave:d.listProps.onMouseLeave,onMouseMove:d.listProps.onMouseMove},T={onClick:f};return{focusVisible:d.focusVisible,highlightedIdx:c,hiliteItemAtIndex:d.hiliteItemAtIndex,listProps:b,listItemHandlers:T,selected:u.selected,visibleData:a.data}};var we=require("react/jsx-runtime"),gl=require("react"),st="vuuTree",Kn=e=>e.expanded===!0,ml=({children:e,idx:t,...o})=>(0,we.jsx)("li",{...o,children:e}),fl=(0,wr.forwardRef)(function({allowDragDrop:t,className:o,defaultSelected:r,groupSelection:n="none",id:s,onHighlight:i,onSelectionChange:a,revealSelected:l,selected:c,selection:d="single",source:p,...u},m){var L;let f=(0,vr.useIdMemo)(s),g=(0,wr.useRef)(null),[,h,b]=_a(p,f,{revealSelected:l?(L=c!=null?c:r)!=null?L:!1:void 0}),T=(C,N)=>{if(a){let $=N.map(k=>b(k)).filter(k=>k!==void 0);a($)}},{focusVisible:E,highlightedIdx:y,hiliteItemAtIndex:v,listProps:x,listItemHandlers:w,selected:S,visibleData:O}=pl({defaultSelected:r,groupSelection:n,onChange:T,onHighlight:i,selected:c,selection:d,sourceWithIds:h});Ya(g,y);let P={...{onMouseEnter:C=>{let N=C.target,$=$a(N);v($)}},...w,role:"treeitem"},D=Ga(n);function I(C,N,$){C.push((0,we.jsxs)(ml,{...P,...Wd(N,$,y,S,E),children:[N.icon?(0,we.jsx)("span",{className:`${st}Node-icon`,"data-icon":N.icon}):null,(0,we.jsx)("span",{children:N.label})]})),$.value+=1}function M(C,N,$,k,V){let{value:Z}=$;$.value+=1,C.push((0,gl.createElement)(ml,{...w,"aria-expanded":N.expanded,"aria-level":N.level,"aria-selected":S.includes(k)||void 0,className:(0,Tr.default)(`${st}Node`,{focusVisible:E===Z,[`${st}Node-toggle`]:!D}),"data-idx":Z,"data-highlighted":Z===y||void 0,"data-selectable":!0,id:k,key:`header-${Z}`},D?(0,we.jsxs)("div",{className:`${st}Node-label`,children:[(0,we.jsx)("span",{className:`${st}Node-toggle`}),V]}):(0,we.jsxs)("div",{className:`${st}Node-label`,children:[N.icon?(0,we.jsx)("span",{className:`${st}Node-icon`,"data-icon":N.icon}):null,(0,we.jsx)("span",{children:V})]}),(0,we.jsx)("ul",{role:"group",children:Kn(N)?R(N.childNodes,$):""})))}function R(C,N={value:0}){if((C==null?void 0:C.length)>0){let $=[];for(let k of C)k.childNodes?M($,k,N,k.id,k.label):I($,k,N);return $}}return(0,we.jsx)("ul",{...u,...x,className:(0,Tr.default)(st,o),id:`Tree-${f}`,ref:(0,vr.useForkRef)(g,m),role:"tree",tabIndex:0,children:R(O)})}),Wd=(e,t,o,r,n,s)=>({id:e.id,key:e.id,"aria-level":e.level,"aria-selected":r.includes(e.id)||void 0,"data-idx":t.value,"data-highlighted":t.value===o||void 0,className:(0,Tr.default)("vuuTreeNode",s,{focusVisible:n===t.value})});fl.displayName="Tree";var Gn=fl;var El=require("@salt-ds/core"),Sr=W(require("classnames")),at=W(require("react"));var it=require("react");var Do=(e,t,o,r)=>{var h;let{loadSessionState:n,purgeSessionState:s,purgeState:i,saveSessionState:a}=yt(),[l,c]=(0,it.useState)((h=n(e,"contributions"))!=null?h:[]),d=He(),p=(0,it.useCallback)((b,T)=>{let E=l.concat([{location:b,content:T}]);a(e,"contributions",E),c(E)},[l,e,a]),u=(0,it.useCallback)(()=>{s(e,"contributions"),c([])},[e,s]),m=(0,it.useCallback)(()=>{let b=n(e,"data-source");b&&b.unsubscribe(),s(e),i(e),d({type:"remove",path:o})},[d,e,n,s,i,o]),f=(0,it.useCallback)(async(b,T,E)=>{var v;b.stopPropagation();let y=(v=t.current)==null?void 0:v.getBoundingClientRect();return new Promise((x,w)=>{d({type:"drag-start",evt:b,path:T===void 0?o:`${o}.${T}`,dragRect:y,preDragActivity:E,dropTargets:r,resolveDragStart:x,rejectDragStart:w})})},[t,d,o,r]);return[(0,it.useCallback)(async(b,T)=>{var y;let{type:E}=b;switch(E){case"maximize":case"minimize":case"restore":return d({type:E,path:(y=b.path)!=null?y:o});case"remove":return m();case"mousedown":return f(T,b.index,b.preDragActivity);case"add-toolbar-contribution":return p(b.location,b.content);case"remove-toolbar-contribution":return u();default:return}},[d,o,m,f,p,u]),l]};var Dr=require("@salt-ds/core"),yl=W(require("classnames")),be=W(require("react"));var ze=require("react");var hl=({id:e,rootRef:t,path:o,dropTargets:r,title:n})=>{let s=He(),{loadState:i,loadSessionState:a,purgeState:l,saveState:c,saveSessionState:d}=yt(),[p,u]=Do(e,t,o,r),m=(0,ze.useMemo)(()=>{var x;return(x=i("view-title"))!=null?x:n},[i,n]),f=(0,ze.useCallback)(x=>{o&&s({type:"set-title",path:o,title:x})},[s,o]),g=(0,ze.useMemo)(()=>i(e),[e,i]),h=(0,ze.useCallback)(x=>i(e,x),[e,i]),b=(0,ze.useCallback)(x=>{l(e,x),s({type:"save"})},[e,s,l]),T=(0,ze.useCallback)((x,w)=>{c(e,w,x),s({type:"save"})},[e,s,c]),E=(0,ze.useCallback)(x=>a(e,x),[e,a]),y=(0,ze.useCallback)((x,w)=>d(e,w,x),[e,d]),v=(0,ze.useCallback)(({type:x,...w})=>{let{[x]:S}=w;T(S,x)},[T]);return{contributions:u,dispatchViewAction:p,load:h,loadSession:E,onConfigChange:v,onEditTitle:f,purge:b,restoredState:g,save:T,saveSession:y,title:m}};var Xt=require("react"),Vd=[],bl=({mainRef:e,resize:t="responsive",rootRef:o})=>{let r=t==="defer",n=(0,Xt.useRef)({}),s=(0,Xt.useRef)(),i=(0,Xt.useCallback)(()=>{e.current&&(e.current.style.height=n.current.height+"px",e.current.style.width=n.current.width+"px"),s.current=void 0},[e]),a=(0,Xt.useCallback)(({height:l,width:c})=>{n.current.height=l,n.current.width=c,s.current!==null&&clearTimeout(s.current),s.current=window.setTimeout(i,40)},[i]);yo(o,r?Pn:Vd,a,r)};var So=W(require("react")),Kd={dispatch:null},Ro=So.default.createContext(Kd),Zn=()=>{var t;let e=(0,So.useContext)(Ro);return(t=e==null?void 0:e.dispatch)!=null?t:null},Gd=()=>(0,So.useContext)(Ro);var qt=require("react/jsx-runtime"),Mo="vuuView",Zd=(e,t)=>e&&t?{...e,...t}:e||t,xl=(0,be.forwardRef)(function(t,o){let{Header:r=Un,children:n,className:s,collapsed:i,closeable:a,"data-path":l,"data-resizeable":c,dropTargets:d,expanded:p,flexFill:u,id:m,header:f,orientation:g="horizontal",path:h=l,resize:b="responsive",resizeable:T=c,tearOut:E,style:y={},title:v,...x}=t,w=(0,Dr.useIdMemo)(m),S=(0,be.useRef)(null),O=(0,be.useRef)(null),[H,P]=(0,be.useState)(),{contributions:D,dispatchViewAction:I,load:M,loadSession:R,onConfigChange:L,onEditTitle:C,purge:N,restoredState:$,save:k,saveSession:V,title:Z}=hl({id:w,rootRef:S,path:h,dropTargets:d,title:v});bl({mainRef:O,resize:b,rootRef:S});let Y=(0,be.useCallback)(B=>{P(B)},[]),U=()=>be.default.isValidElement(n)&&($||H)?be.default.cloneElement(n,Zd($,H)):n,te=(0,be.useMemo)(()=>({dispatch:I,id:w,path:h,title:Z,load:M,loadSession:R,onConfigChange:L,purge:N,save:k,saveSession:V,setComponentProps:Y}),[I,w,M,R,L,h,N,k,V,Y,Z]),z=typeof f=="object"?f:{};return(0,qt.jsx)("div",{...x,className:(0,yl.default)(Mo,s,{[`${Mo}-collapsed`]:i,[`${Mo}-expanded`]:p,[`${Mo}-resize-defer`]:b==="defer"}),"data-resizeable":T,id:w,ref:(0,Dr.useForkRef)(o,S),style:y,tabIndex:-1,children:(0,qt.jsxs)(Ro.Provider,{value:te,children:[f?(0,qt.jsx)(r,{...z,collapsed:i,contributions:D,expanded:p,closeable:a,onEditTitle:C,orientation:g,tearOut:E,title:Z}):null,(0,qt.jsx)("div",{className:`${Mo}-main`,ref:O,children:U()})]})})});xl.displayName="View";var Mt=be.default.memo(xl);Mt.displayName="View";ne("View",Mt,"view");var Yt=require("react/jsx-runtime"),Un=({className:e,contributions:t,collapsed:o,closeable:r,onEditTitle:n,orientation:s="horizontal",style:i,title:a="Untitled"})=>{let l=(0,at.useRef)(null),[c,d]=(0,at.useState)(a),[p,u]=(0,at.useState)(!1),m=Zn(),f=P=>m==null?void 0:m({type:"remove"},P),g="vuuHeader",h=()=>{var P;(P=l.current)==null||P.focus()},b=P=>{P.stopPropagation()},E=(0,Sr.default)(g,e,`${g}-${o||s}`),y=()=>{u(!0)},v=P=>{P.key==="Enter"&&u(!0)},x=(P="",D="",I=!0,M=!1)=>{var R;u(!1),M?d(P):D!==P&&(d(D),n==null||n(D)),I===!1&&((R=l.current)==null||R.focus())},w=P=>{m==null||m({type:"mousedown"},P)},S=[],O=[],H=[];return t==null||t.forEach((P,D)=>{switch(P.location){case"pre-title":S.push(at.default.cloneElement(P.content,{key:D}));break;default:O.push(at.default.cloneElement(P.content,{key:D}))}}),a&&S.push((0,Yt.jsx)(gr,{editing:p,value:c,onChange:d,onMouseDownCapture:h,onEnterEditMode:y,onExitEditMode:x,onKeyDown:v,ref:l,tabIndex:0},"title")),r&&H.push((0,Yt.jsx)(El.Button,{"data-icon":"close",onClick:f,onMouseDown:b,variant:"secondary"},"close")),O.length>0&&S.push((0,Yt.jsx)("div",{className:"vuuTooltrayProxy","data-align":"end",children:O},"contributions")),H.length>0&&S.push((0,Yt.jsx)("div",{className:"vuuTooltrayProxy","data-align":"end",children:H},"actions")),(0,Yt.jsx)("div",{className:(0,Sr.default)("vuuToolbarProxy",E),style:i,onMouseDown:w,children:S})};var Ll=require("@vuu-ui/vuu-popups"),Po=W(require("classnames")),Ir=W(require("react"));var Lr=require("@vuu-ui/vuu-utils"),Be=require("react");var Ud=".vuuOverflowContainer-item:not(.wrapped)",Tl=e=>e.sort((t,o)=>{let{dataset:{index:r="?"}}=t,{dataset:{index:n="?"}}=o,s=t.classList.contains("wrapped"),i=o.classList.contains("wrapped"),a=r==="overflow",l=n==="overflow";return s&&!i?1:!s&&i?-1:a?1:l?-1:parseInt(r)>parseInt(n)?1:-1}),Mr=[],jt=(e,t="horizontal")=>{let o=[],r=[],n=-1,s=!1,i=Tl(Array.from(e.children)),a=t==="vertical"?"top":"left";for(let l of i){let c=l,{dataset:{index:d="?",label:p="?",overflowPriority:u="0"}}=c,{[a]:m}=c.getBoundingClientRect();m<=n?(d==="overflow"?r.push(o.pop()):r.push({index:d,label:p,overflowPriority:u}),s=!0):s?r.push({index:d,label:p,overflowPriority:u}):o.push({index:d,label:p,overflowPriority:u}),n=m}return[o,r]},Xn=(e,t)=>{let o=!1;t.find(({index:r})=>r==="overflow")&&t.length===1&&(o=!0);for(let r of e.children){let{dataset:{index:n="?"}}=r;t.length===0||o?e.classList.remove("overflowed"):e.classList.add("overflowed"),n!=="overflow"&&t.find(s=>s.index===n)?r.classList.add("wrapped"):r.classList.remove("wrapped")}},Xd=(e,{overflowPriority:t})=>Math.max(e,parseInt(t)),qd=(e,{overflowPriority:t})=>Math.min(e,parseInt(t)),qn=e=>{var t;return e.length>1&&((t=e.at(-1))==null?void 0:t.index)==="overflow"},Yd=e=>{let[t]=e;for(let o=1;o<e.length;o++){let r=e[o];parseInt(r.overflowPriority)>parseInt(t.overflowPriority)&&(t=r)}return t},Yn=(e,t)=>{var n;let o=e.reduce(qd,Number.MAX_SAFE_INTEGER);return t.reduce(Xd,0)>o?!0:t.length>1&&((n=t.at(-1))==null?void 0:n.index)==="overflow"},jn=(e,t)=>new Promise(o=>{requestAnimationFrame(()=>{let[,r]=jt(e);jd(t,r).forEach(s=>wl(e,s)),o(r)})}),Jn=(e,t,o)=>new Promise(r=>{requestAnimationFrame(()=>{let[,n]=jt(e),s=Yd(n);if(s){let[i,a]=Pr(e,s);r([i,a])}else r([t,o])})}),vl=(e,t)=>e.querySelector(`[data-index="${t.index}"]`),wl=(e,t)=>{let o=vl(e,t);if(o)o.classList.add("wrapped");else throw Error(`markElementAsWrapped element item with index ${t.index} not found`)},Dl=e=>Array.from(e.querySelectorAll(".wrapped")),jd=(e,t)=>{let o=[];for(let r of t)e.find(({index:n})=>n===r.index)||o.push(r);return o},Sl=(e,t)=>{Dl(e).forEach(r=>{let{dataset:{index:n="?"}}=r;t.find(s=>s.index===n)||r.classList.remove("wrapped")})},Rl=e=>e.querySelector('[data-index="overflow"]'),Jd=e=>e.querySelector(".wrapped"),Rr=e=>parseInt(getComputedStyle(e).getPropertyValue("width")),Ml=(e,t)=>{let{right:o}=e.getBoundingClientRect(),r=parseInt(getComputedStyle(e).getPropertyValue("padding-right")),{right:n}=t.getBoundingClientRect();return o-r-n},Qn=e=>{let t=Rl(e),o=Ml(e,t),r=Rr(t),n=Jd(e);return Rr(n)<=o+r?(e.classList.remove("overflowed"),n.classList.remove("wrapped"),!0):!1},Qd=(e,t)=>{let{dataset:{index:o="0",overflowPriority:r="0"}}=e,{dataset:{index:n="0",overflowPriority:s="0"}}=t;return r>s?-1:r<s?1:parseInt(o)-parseInt(n)},ep=e=>Array.from(e.querySelectorAll(Ud)).sort(Qd),Pr=(e,t)=>{let o=ep(e),r=vl(e,t),n=-1,s=o.at(n),i=Rr(s),a=Rr(r),l=Rl(e),c=Ml(e,l)+i;if(c>=a)tp(r,s);else{let{left:u}=s.getBoundingClientRect(),m=c,f=[s];for(;c<a;){n-=1,s=o.at(n),f.push(s);let{left:g}=s.getBoundingClientRect(),h=u-g;c=m+h}r==null||r.classList.remove("wrapped"),f.forEach(g=>{g.classList.add("wrapped")})}let[d,p]=jt(e);return Sl(e,p),[d,p]},tp=(e,t)=>{if(!e||!t)throw Error("switchWrapOnElements, element undefined");e.classList.remove("wrapped"),t.classList.add("wrapped")};var Pl=({itemCount:e,onSwitchWrappedItemIntoView:t,orientation:o="horizontal"})=>{let[r,n]=(0,Be.useState)(null),s=(0,Be.useRef)(Mr),i=(0,Be.useCallback)(async()=>{if(r){let[u,m]=jt(r,o);for(console.log({nonWrapped:u,wrapped:m}),Xn(r,m),qn(m)&&(m=await jn(r,m));Yn(u,m);)[u,m]=await Jn(r,u,m);m.length===1&&Qn(r)&&(m=Mr),s.current=m}},[r,o]),a=u=>typeof u=="object"&&u!==null&&"overflowItem"in u,[l,c]=(0,Be.useMemo)(()=>[()=>{let{current:u}=s;return u.map(m=>({label:m.label,action:`activate-item-${m.index}`,options:{overflowItem:m}}))},({options:u})=>{if(r&&a(u)){let[,m]=Pr(r,u.overflowItem);s.current=m,t==null||t(u.overflowItem)}return!0}],[r,t]),d=(0,Be.useMemo)(()=>{let{sizeProp:u}=Lr.MEASURES[o],m=0;return new ResizeObserver(f=>{for(let g of f){let{[u]:h}=g.contentRect;(0,Lr.isValidNumber)(h)&&m!==h&&(m=h,i())}})},[i,o]);Zr(()=>{i()},[i,e]),(0,Be.useMemo)(()=>{r&&d.observe(r)},[r,d]);let p=(0,Be.useCallback)(u=>{n(u)},[]);return{menuActionHandler:c,menuBuilder:l,rootRef:p}};var lt=require("react/jsx-runtime"),Jt="vuuOverflowContainer",Il=Ir.default.memo(({children:e,className:t,height:o,onSwitchWrappedItemIntoView:r,orientation:n="horizontal",overflowIcon:s})=>{let i=mt(e),{menuActionHandler:a,menuBuilder:l,rootRef:c}=Pl({itemCount:i.length,onSwitchWrappedItemIntoView:r,orientation:n}),p={"--overflow-container-height":`${n==="vertical"?"100%":`${o}px`}`},u=(0,Po.default)(`${Jt}-wrapContainer`,t,{[`${Jt}-horizontal`]:n==="horizontal",[`${Jt}-vertical`]:n==="vertical"});return(0,lt.jsxs)("div",{className:u,ref:c,style:p,children:[i.map((m,f)=>{let{"data-overflow-priority":g="0",id:h,label:b=`Item ${f+1}`}=m.props;return(0,lt.jsx)("div",{className:(0,Po.default)(`${Jt}-item`),"data-index":f,"data-label":b,"data-overflow-priority":g,id:`${h}-wrapper`,children:m},f)}),(0,lt.jsx)("div",{className:`${Jt}-OverflowIndicator`,"data-index":"overflow",children:(0,lt.jsx)(Ll.PopupMenu,{icon:s,menuBuilder:l,menuActionHandler:a})})]})});Il.displayName="OverflowContainer.InnerContainer";var Fn=(0,Ir.forwardRef)(function({children:t,className:o,height:r=44,onSwitchWrappedItemIntoView:n,orientation:s,overflowIcon:i,...a},l){return(0,lt.jsx)("div",{...a,className:(0,Po.default)((0,Po.default)(Jt,o)),ref:l,children:(0,lt.jsx)(Il,{height:r,orientation:s,overflowIcon:i,onSwitchWrappedItemIntoView:n,children:t})})});var Cl=require("@vuu-ui/vuu-utils"),Nr=require("@salt-ds/lab"),es=W(require("classnames")),Hr=require("react");var Cr=require("react/jsx-runtime"),op=e=>{let t=e.cloneNode(!0);return t.id="",delete t.dataset.idx,t},ts=(0,Hr.memo)(({className:e,children:t,idx:o,resizeable:r,header:n,closeable:s,...i})=>(0,Cr.jsx)(Nr.ListItem,{className:(0,es.default)("vuuPaletteItem",e),"data-draggable":!0,...i}));ts.displayName="PaletteItem";var Nl=({children:e,className:t,orientation:o="horizontal",ViewProps:r,...n})=>{let s=He(),i="vuuPalette";function a(l){var w;let d=l.target.closest(".vuuPaletteItem"),p=parseInt((w=d.dataset.idx)!=null?w:"-1");p!==-1&&console.log({children:e,idx:p,listItemElement:d});let{props:{caption:u,children:m,template:f,...g}}=e[p],{height:h,left:b,top:T,width:E}=d.getBoundingClientRect(),y=(0,Cl.uuid)(),x=f?m:(0,Cr.jsx)(Mt,{...r,...{id:y,key:y},...g,title:g.label,children:m});s({dragRect:{left:b,top:T,right:b+E,bottom:T+150,width:E,height:h},dragElement:op(d),evt:l.nativeEvent,instructions:{DoNotRemove:!0,DoNotTransform:!0,RemoveDraggableOnDragEnd:!0,dragThreshold:10},path:"*",payload:x,type:"drag-start"})}return(0,Cr.jsx)(Nr.List,{...n,borderless:!0,className:(0,es.default)(i,t,`${i}-${o}`),maxHeight:800,selected:null,children:e.map((l,c)=>l.type===ts?(0,Hr.cloneElement)(l,{key:c,onMouseDown:a}):l)})};ne("Palette",Nl,"view");var Al=W(require("classnames")),ct=W(require("react"));var Lo=require("react/jsx-runtime"),Hl="Tabs",rp=()=>{},np=(e,t)=>{var o,r;return(r=(o=e.props)==null?void 0:o.title)!=null?r:`Tab ${t+1}`},sp=e=>{let t=[];return ct.default.Children.forEach(e,o=>{ct.default.isValidElement(o)?t.push(o):console.warn("Stack has unexpected child element type")}),t},ip={allowAddTab:!1,allowCloseTab:!1,allowRenameTab:!1},Ar=(0,ct.forwardRef)(function({active:t=0,children:o,className:r,getTabIcon:n=rp,getTabLabel:s=np,id:i,keyBoardActivation:a="manual",onAddTab:l,onMoveTab:c,onTabClose:d,onTabEdit:p,onTabSelectionChanged:u,showTabs:m="top",style:f,TabstripProps:g=ip},h){var H;let b=no(i),{allowCloseTab:T,allowRenameTab:E}=g,y=(0,ct.useCallback)((P,D,I,M)=>{p==null||p(M,D)},[p]),v=()=>{var P;return ct.default.isValidElement(o)?o:Array.isArray(o)&&(P=o[t])!=null?P:null},x=()=>sp(o).map((P,D)=>{let I=`${b}-${D}`,{closeable:M=T,id:R}=P.props;return(0,Lo.jsx)(Ba,{ariaControls:`${I}-tab`,"data-icon":n(P,D),id:I,index:D,label:s(P,D),closeable:M,editable:E},R!=null?R:D)}),w=v(),S=m==="left"||m==="right",O=S?"vertical":"horizontal";return(0,Lo.jsxs)("div",{className:(0,Al.default)(Hl,r,{[`${Hl}-horizontal`]:S}),style:f,id:b,ref:h,children:[m?(0,Lo.jsx)(Pa,{...g,activeTabIndex:(H=g==null?void 0:g.activeTabIndex)!=null?H:w===null?-1:t,allowDragDrop:g.allowDragDrop!==!1,animateSelectionThumb:!0,className:"vuuTabHeader",keyBoardActivation:a,onActiveChange:u,onAddTab:l,onCloseTab:d,onExitEditMode:y,onMoveTab:c,orientation:O,children:x()}):null,w]})});Ar.displayName="Stack";var Ol=require("@salt-ds/core"),ut=W(require("react"));var Or=require("react/jsx-runtime"),ap=e=>(0,Or.jsx)(Mt,{resizeable:!0,title:`Tab ${e}`,style:{flexGrow:1,flexShrink:0,flexBasis:0},header:!0,closeable:!0,children:(0,Or.jsx)(Oo,{style:{flex:1}})}),os=e=>{let t=(0,ut.useRef)(null),o=He(),{loadState:r}=yt(),{createNewChild:n=ap,id:s,onTabSelectionChanged:i,path:a,...l}=e,{children:c}=e,d=(0,Ol.useIdMemo)(s),[p]=Do(d,t,a),u=E=>{a&&(o({type:"switch-tab",path:a,nextIdx:E}),i==null||i(E))},m=(0,ut.useCallback)(E=>{if(Array.isArray(c)){let{props:{"data-path":y,path:v=y}}=c[E];o({type:"remove",path:v})}},[c,o]),f=(0,ut.useCallback)(()=>{if(a){let E=ut.default.Children.count(c),y=n(E);o({type:"add",path:a,component:y})}},[c,n,o,a]),g=(0,ut.useCallback)((E,y)=>{a&&o({fromIndex:E,toIndex:y,path:a,type:"move-child"})},[o,a]);return(0,Or.jsx)(Ar,{...l,id:d,getTabLabel:(E,y)=>{let{id:v,title:x}=E.props;return r(v,"view-title")||x||`Tab ${y+1}`},onMouseDown:async(E,y)=>{let v;await p({type:"mousedown",index:y,preDragActivity:async()=>new Promise(S=>{console.log("preDragActivity: Ok, gonna release the drag"),v=S})},E)&&(v==null||v(void 0))},onMoveTab:g,onAddTab:f,onTabClose:m,onTabEdit:(E,y)=>{o({type:"set-title",path:`${a}.${E}`,title:y})},onTabSelectionChanged:u,ref:t})};os.displayName="Stack";ne("Stack",os,"container");var Qt=W(require("react"));var Pt=require("react/jsx-runtime"),lp=({children:e})=>{let[o,r]=(0,Qt.useState)(e),[n,s]=(0,Qt.useState)(e),i=l=>{let c=Gr(o,l);s(c)},a=(l,c)=>{console.log(`change ${l} -> ${c}`);let d=Qt.default.cloneElement(n,{style:{...n.props.style,[l]:c}});s(d),r(Qt.default.cloneElement(o,{},d))};return(0,Pt.jsxs)("div",{"data-design-mode":`${!1}`,children:[o,(0,Pt.jsx)("br",{}),(0,Pt.jsxs)("div",{style:{display:"flex"},children:[(0,Pt.jsx)(rs,{height:300,managedStyle:n.props.style,width:300,onChange:a,style:void 0}),(0,Pt.jsx)(ns,{layout:o,onSelect:i,style:{width:300,height:300,backgroundColor:"#ccc"}})]})]})};var _e=require("@salt-ds/core"),J=require("react/jsx-runtime"),is={},cp={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"}},ss=({feature:e,children:t,style:o,onChange:r})=>(0,J.jsxs)("div",{className:`LayoutBox layout-${e} layout-outer`,children:[(0,J.jsxs)("div",{className:"layout-top",children:[(0,J.jsx)("span",{className:"layout-title",children:e}),(0,J.jsx)(_e.FormField,{className:"layout-input",style:{width:30},children:(0,J.jsx)(_e.Input,{value:o.top,onChange:(n,s)=>r(e,"top",s)})})]}),(0,J.jsxs)("div",{className:"layout-inner",children:[(0,J.jsx)("div",{className:"layout-left",children:(0,J.jsx)(_e.FormField,{className:"layout-input",style:{width:30},children:(0,J.jsx)(_e.Input,{value:o.left,onChange:(n,s)=>r(e,"left",s)})})}),t,(0,J.jsx)("div",{className:"layout-right",children:(0,J.jsx)(_e.FormField,{className:"layout-input",style:{width:30},children:(0,J.jsx)(_e.Input,{value:o.right,onChange:(n,s)=>r(e,"right",s)})})})]}),(0,J.jsx)("div",{className:"layout-bottom",children:(0,J.jsx)(_e.FormField,{className:"layout-input",style:{width:30},children:(0,J.jsx)(_e.Input,{value:o.bottom,onChange:(n,s)=>r(e,"bottom",s)})})})]}),up={margin:!0,marginTop:!0,marginRight:!0,marginBottom:!0,marginLeft:!0},dp={padding:!0,paddingTop:!0,paddingRight:!0,paddingBottom:!0,paddingLeft:!0},pp={border:!0,borderColor:!0,borderWidth:!0,borderTopWidth:!0,borderRightWidth:!0,borderBottomWidth:!0,borderLeftWidth:!0},kr="(\\d+)(?:px)?",mp=`^(?:${kr}(?:\\s${kr}(?:\\s${kr}(?:\\s${kr})?)?)?)$`,kl=new RegExp(mp),fp=/^(?:(\d+)(?:px)\ssolid\s([a-zA-Z,0-9().]+))$/,rs=({height:e,managedStyle:t,onChange:o,style:r,width:n})=>{let s=zl(t),i=(E,y,v)=>{let x=parseInt(v||"0",10),w=cp[E][y];o(w,x)},{marginTop:a=0,marginRight:l=0,marginBottom:c=0,marginLeft:d=0}=s,{borderTopWidth:p=0,borderRightWidth:u=0,borderBottomWidth:m=0,borderLeftWidth:f=0}=s,{paddingTop:g=0,paddingRight:h=0,paddingBottom:b=0,paddingLeft:T=0}=s;return(0,J.jsx)("div",{className:"LayoutConfigurator",style:{width:n,height:e,...r},children:(0,J.jsx)(ss,{feature:"margin",style:{top:a,right:l,bottom:c,left:d},onChange:i,children:(0,J.jsx)(ss,{feature:"border",style:{top:p,right:u,bottom:m,left:f},onChange:i,children:(0,J.jsx)(ss,{feature:"padding",style:{top:g,right:h,bottom:b,left:T},onChange:i,children:(0,J.jsx)("div",{className:"layout-content"})})})})})};function gp(e=is,t=is){let{margin:o,marginTop:r,marginRight:n,marginBottom:s,marginLeft:i,padding:a,paddingTop:l,paddingRight:c,paddingBottom:d,paddingLeft:p,...u}=e;if(typeof o=="number")u.marginTop=u.marginRight=u.marginBottom=u.marginLeft=o;else if(typeof o=="string"){let m=kl.exec(o);if(m===null)console.error(`Invalid css value for margin '${o}'`);else{let[,f,g,h,b]=m,T=f&&g&&h;T&&b?(u.marginTop=parseInt(f,10),u.marginRight=parseInt(g,10),u.marginBottom=parseInt(h,10),u.marginLeft=parseInt(b,10)):T?(u.marginTop=parseInt(f,10),u.marginRight=u.marginLeft=parseInt(g,10),u.marginBottom=parseInt(h,10)):f&&g?(u.marginTop=u.marginBottom=parseInt(f,10),u.marginRight=u.marginLeft=parseInt(g,10)):u.marginTop=u.marginRight=u.marginBottom=u.marginLeft=parseInt(f,10)}}if(typeof r=="number"&&(u.marginTop=r),typeof n=="number"&&(u.marginRight=n),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=kl.exec(a);if(m===null)console.error(`Invalid css value for padding '${a}'`);else{let[,f,g,h,b]=m,T=f&&g&&h;T&&b?(u.paddingTop=parseInt(f,10),u.paddingRight=parseInt(g,10),u.paddingBottom=parseInt(h,10),u.paddingLeft=parseInt(b,10)):T?(u.paddingTop=parseInt(f,10),u.paddingRight=u.paddingLeft=parseInt(g,10),u.paddingBottom=parseInt(h,10)):f&&g?(u.paddingTop=u.paddingBottom=parseInt(f,10),u.paddingRight=u.paddingLeft=parseInt(g,10)):u.paddingTop=u.paddingRight=u.paddingBottom=u.paddinggLeft=parseInt(f,10)}}return typeof l=="number"&&(u.paddingTop=l),typeof c=="number"&&(u.paddingRight=c),typeof d=="number"&&(u.paddingBottom=d),typeof p=="number"&&(u.paddingLeft=p),zl(u,t)}function zl(e=is){let t={...e},o,{border:r,borderWidth:n,borderTopWidth:s,borderRightWidth:i,borderBottomWidth:a,borderLeftWidth:l,borderColor:c,margin:d,marginTop:p,marginRight:u,marginBottom:m,marginLeft:f,padding:g,paddingTop:h,paddingRight:b,paddingBottom:T,paddingLeft:E,...y}=t,v={},x={};if(typeof d=="number"&&(t.marginTop=t.marginRight=t.marginBottom=t.marginLeft=d,v={marginTop:d,marginRight:d,marginBottom:d,marginLeft:d}),typeof g=="number"&&(t.paddingTop=t.paddingRight=t.paddingBottom=t.paddingLeft=g,x={paddingTop:g,paddingRight:g,paddingBottom:g,paddingLeft:g}),r||n||s||i||a||l){typeof r=="string"&&(o=fp.exec(r))&&([,n,c]=o,n=parseInt(n,10)),n&&(s=s===void 0?n:s,i=i===void 0?n:i,a=a===void 0?n:a,l=l===void 0?n:l),c=c||"black";let w=`
18
21
  ${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}var Fa=F(require("react")),_a=F(require("classnames"));var Va=require("@heswell/salt-lab"),Ir=require("react/jsx-runtime"),ep="hwLayoutTreeViewer",Wa=(e,t="0")=>({label:$(e),path:t,childNodes:Fa.default.Children.map(e.props.children,(o,n)=>Wa(o,t?`${t}.${n}`:`${n}`))}),Pr=({layout:e,onSelect:t,style:o})=>{let n=[Wa(e)],r=(s,[{path:i}])=>{t(i)};return(0,Ir.jsx)("div",{className:(0,_a.default)(ep),style:o,children:(0,Ir.jsx)(Va.Tree,{source:n,groupSelection:"single",onSelectionChange:r})})};
22
+ ${c} ${-i||0}px ${-a||0}px 0 0 inset`;return{...y,...v,...x,borderTopWidth:s,borderRightWidth:i,borderBottomWidth:a,borderLeftWidth:l,borderColor:c,borderStyle:"solid",boxShadow:w}}else return t}var Bl=W(require("react")),$l=W(require("classnames"));var as=require("react/jsx-runtime"),hp="hwLayoutTreeViewer",Fl=(e,t="0")=>({label:_(e),path:t,childNodes:Bl.default.Children.map(e.props.children,(o,r)=>Fl(o,t?`${t}.${r}`:`${r}`))}),ns=({layout:e,onSelect:t,style:o})=>{let r=[Fl(e)],n=(s,[{path:i}])=>{t(i)};return(0,as.jsx)("div",{className:(0,$l.default)(hp),style:o,children:(0,as.jsx)(Gn,{source:r,groupSelection:"single",onSelectionChange:n})})};
20
23
  //# sourceMappingURL=index.js.map