@vuu-ui/vuu-layout 0.8.7 → 0.8.8

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 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=`
1
+ "use strict";var ad=Object.create;var In=Object.defineProperty;var ld=Object.getOwnPropertyDescriptor;var cd=Object.getOwnPropertyNames;var ud=Object.getPrototypeOf,dd=Object.prototype.hasOwnProperty;var md=(e,t)=>{for(var o in t)In(e,o,{get:t[o],enumerable:!0})},Ri=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of cd(t))!dd.call(e,r)&&r!==o&&In(e,r,{get:()=>t[r],enumerable:!(n=ld(t,r))||n.enumerable});return e};var X=(e,t,o)=>(o=e!=null?ad(ud(e)):{},Ri(t||!e||!e.__esModule?In(o,"default",{value:e,enumerable:!0}):o,e)),pd=e=>Ri(In({},"__esModule",{value:!0}),e);var Tg={};md(Tg,{Action:()=>Gt,BORDER_STYLES:()=>yg,Component:()=>vn,ComponentRegistry:()=>Tt,ConfigWrapper:()=>fg,DockLayout:()=>Ai,Draggable:()=>Fn,DraggableLayout:()=>ls,Drawer:()=>Sn,DropMenu:()=>rs,DropTarget:()=>bt,Flexbox:()=>Wn,FlexboxLayout:()=>Ms,FluidGrid:()=>Qn,FluidGridLayout:()=>As,Header:()=>ui,HeightOnly:()=>qm,LayoutActionType:()=>Ee,LayoutConfigurator:()=>Ei,LayoutProvider:()=>Ym,LayoutProviderContext:()=>ho,LayoutProviderVersion:()=>jm,LayoutTreeViewer:()=>Ii,MARGIN_STYLES:()=>hg,NO_WRAPPED_ITEMS:()=>Nr,OverflowContainer:()=>ni,PADDING_STYLES:()=>bg,Palette:()=>Uu,PaletteItem:()=>yi,Placeholder:()=>Uo,Stack:()=>$r,StackLayout:()=>xi,View:()=>lo,ViewContext:()=>fn,WidthHeight:()=>Cs,WidthOnly:()=>Jm,XXXnormalizeStyles:()=>Ig,applyLayout:()=>gm,applyLayoutProps:()=>fo,applyOverflowClassToWrappedItems:()=>di,asReactElements:()=>Kt,componentToJson:()=>Ts,computeMenuPosition:()=>ns,containerOf:()=>Fi,correctForWrappedHighPriorityItems:()=>gi,correctForWrappedOverflowIndicator:()=>fi,createFlexbox:()=>Vn,createPlaceHolder:()=>et,expandFlex:()=>Rn,extractResponsiveProps:()=>ap,findTarget:()=>ut,followPath:()=>ge,followPathToComponent:()=>jr,followPathToParent:()=>ct,getChild:()=>Bi,getChildProp:()=>Xr,getElementsMarkedAsWrapped:()=>Fu,getFlexDimensions:()=>ps,getFlexOrIntrinsicStyle:()=>Kn,getFlexStyle:()=>$n,getIntrinsicSize:()=>$e,getManagedDimension:()=>Is,getNonWrappedAndWrappedItems:()=>Ao,getPersistentState:()=>hs,getProp:()=>G,getProps:()=>$,hasPersistentState:()=>bs,hasUnboundedFlexStyle:()=>fs,highPriorityItemsHaveWrappedButShouldNotHave:()=>pi,identifyDropTarget:()=>Pn,isContainer:()=>Se,isLayoutComponent:()=>_r,isResponsiveAttribute:()=>rl,isTabstrip:()=>Nd,isTypeOf:()=>yd,isView:()=>Pi,layoutFromJson:()=>jo,layoutReducer:()=>Rs,layoutToJSON:()=>Ss,markElementAsWrapped:()=>zu,nextLeaf:()=>Ed,nextStep:()=>Ze,overflowIndicatorHasWrappedButShouldNotHave:()=>mi,previousLeaf:()=>Id,processLayoutElement:()=>Gn,registerComponent:()=>fe,removeOverflowIndicatorIfNoLongerNeeded:()=>hi,resetPath:()=>he,resizeObserver:()=>Ps,serializeProps:()=>Ra,setPersistentState:()=>ys,setRef:()=>Sd,sortByScreenOrder:()=>Au,switchWrappedItemIntoView:()=>kr,typeOf:()=>U,unmarkItemsWhichAreNoLongerWrapped:()=>Bu,useBreakpoints:()=>ks,useId:()=>Vt,useLayoutEffectSkipFirst:()=>Yr,useLayoutProviderDispatch:()=>tt,useLayoutProviderVersion:()=>Ja,usePersistentState:()=>Zt,useResizeObserver:()=>Qo,useViewActionDispatcher:()=>mn,useViewContext:()=>qf,useViewDispatch:()=>ci,wrapIntrinsicSizeComponentWithFlexbox:()=>po});module.exports=pd(Tg);var Gr=require("@vuu-ui/vuu-utils"),ki=X(require("classnames"));var Li={},Mi={},Tt={};function Se(e){return Li[e]===!0}function Pi(e){return Mi[e]===!0}var _r=e=>Se(e)||Pi(e);function fe(e,t,o="component"){Tt[e]=t,o==="container"?Li[e]=!0:o==="view"&&(Mi[e]=!0)}var $o=require("@salt-ds/core"),Wr=X(require("classnames")),Hi=require("react");var wt=require("react/jsx-runtime"),vt="vuuDrawer",Ci=e=>typeof e=="string"?e:e+"px",fd=(e,t,o)=>{let n=t!==void 0,r=o!==void 0;if(!(!e&&!r&&!n))return!r&&!n?e:{...e,"--drawer-size":n?Ci(t):void 0,"--drawer-peek-size":r?Ci(o):void 0}},Ni=({children:e,className:t,clickToOpen:o,defaultOpen:n,sizeOpen:r,sizeClosed:s,style:i,open:a,position:l="left",inline:c,onClick:d,peekaboo:m=!1,toggleButton:u,...p})=>{let[f,g]=(0,$o.useControlled)({controlled:a,default:n!=null?n:!1,name:"Drawer",state:"open"}),h=(0,Wr.default)(vt,t,`${vt}-${l}`,{[`${vt}-open`]:f,[`${vt}-inline`]:c,[`${vt}-over`]:!c,[`${vt}-peekaboo`]:m}),b=(0,Hi.useCallback)(()=>{g(!f)},[f,g]),x=fd(i,r,s),I=o?b:d,y=()=>(0,wt.jsx)("div",{className:(0,Wr.default)("vuuToggleButton-container"),children:f?(0,wt.jsx)($o.Button,{"aria-label":"close",onClick:b,"data-icon":"close",variant:"secondary"}):(0,wt.jsx)($o.Button,{"aria-label":"open",onClick:b,"data-icon":"close",variant:"secondary"})});return(0,wt.jsxs)("div",{...p,className:h,onClick:I,style:x,children:[u=="start"?y():null,(0,wt.jsx)("div",{className:`${vt}-liner`,children:(0,wt.jsx)("div",{className:`${vt}-content`,children:e})}),u=="end"?y():null]})};Ni.displayName="Drawer";var Sn=Ni;var Tn=require("react/jsx-runtime"),gd=e=>e.type===Sn,hd=({props:{position:e="left"}})=>e.match(/top|bottom/),Ur=e=>{let{children:t,className:o,id:n,style:r}=e,s="vuuDockLayout",[i,a]=(0,Gr.partition)(t,gd),[l,c]=(0,Gr.partition)(i,hd),d=l.length===0?"horizontal":c.length===0?"vertical":"both",m=(0,ki.default)(s,o,`${s}-${d}`);return(0,Tn.jsxs)("div",{className:m,id:n,style:r,children:[i,(0,Tn.jsx)("div",{className:`${s}-content`,children:a})]})};Ur.displayName="DockLayout";var Ai=Ur;fe("DockLayout",Ur,"container");var Oi=require("react");var zi=require("react/jsx-runtime"),Zr=(0,Oi.forwardRef)(function({resizeable:t,...o},n){return(0,zi.jsx)("div",{...o,className:"Component",ref:n})});Zr.displayName="Component";var vn=Zr;fe("Component",Zr);var Ue=X(require("react"));var bd={},G=(e,t)=>{var n;let o=$(e);return(n=o[t])!=null?n:o[`data-${t}`]},$=e=>(e==null?void 0:e.props)||e||bd,Xr=e=>{let t=$(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 U(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 yd=(e,t)=>U(e)===t;var xd=e=>{let t=e.lastIndexOf(".");return t===-1?e:e.slice(0,t)};function ct(e,t){let{"data-path":o,path:n=o}=$(e);return t==="0"||t===n?null:ge(e,xd(t),!0)}function ut(e,t){let{children:o,...n}=$(e);if(t(n))return e;if(Ue.default.Children.count(o)>0){let r=Ue.default.isValidElement(o)?[o]:o;for(let s of r){let i=ut(s,t);if(i)return i}}}function Fi(e,t){if(t===e)return null;let{path:o,children:n}=$(e),{idx:r,finalStep:s}=Ze(o,G(t,"path"));return s?e:n===void 0||n[r]===void 0?null:Fi(n[r],t)}var Bi=(e,t)=>{if(Ue.default.isValidElement(e)&&t==0)return e;if(Array.isArray(e))return e[t]};function jr(e,t){let o=t.split("."),n=[e],r=s=>Ue.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 $i=(e,t,o=!0)=>{let{children:n,id:r}=e.props;if(r===t)return e;if(Ue.default.Children.count(n)>0){let s=(0,Ue.isValidElement)(n)?[n]:n;for(let i of s)if((0,Ue.isValidElement)(i)){let a=$i(i,t,!1);if(a)return a}}if(o===!0)throw Error(`pathUtils.findTargetById id #${t} not found in source`)};function ge(e,t,o=!1){if(t.startsWith("#"))return $i(e,t.slice(1),o);let{"data-path":n,path:r=n}=$(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(Ue.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=Bi(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 Ed(e,t){let o=ct(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 wn(s[r+1]);{let i=n.pop(),a=ct(e,G(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 Se(U(l))?wn(l):l}}}return wn(e)}function Id(e,t){let o=t.split(".").map(s=>parseInt(s,10)),n=o.pop(),r=ct(e,t);if(r!=null&&typeof n=="number"){let{children:s}=r.props;if(n>0)return Dn(s[n-1]);for(;o.length>1;)if(n=o.pop(),r=ct(e,G(r,"path")),n>0){let i=r.props.children[n-1];return Se(U(i))?Dn(i):i}}return Dn(e)}function wn(e){if(Se(U(e))){let{children:t}=e.props||e;return wn(t[0])}return e}function Dn(e){if(Se(U(e))){let{children:t}=e.props||e;return Dn(t[t.length-1])}return e}function Ze(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 he(e,t,o){if(G(e,"path")===t)return e;let n=[];Ue.default.Children.forEach(e.props.children,(s,i)=>{G(s,"path")?n.push(he(s,`${t}.${i}`)):n.push(s)});let r=e.props["data-path"]?"data-path":"path";return Ue.default.cloneElement(e,{[r]:t,...o},n)}function Sd(e,t){typeof e=="function"?e(t):e&&(e.current=t)}var Je=require("react"),Td=[],vd=0,Kt=e=>{let t=Array.isArray(e),o=t?e.length:Je.Children.count(e);return t&&e.every(Je.isValidElement)?e:o===1&&!t&&(0,Je.isValidElement)(e)?[e]:o>1?e:Td},Yr=(e,t)=>{let o=(0,Je.useRef)(!1);(0,Je.useLayoutEffect)(()=>{o.current?e():o.current=!0},t)},Vt=e=>(0,Je.useMemo)(()=>e!=null?e:`vuu-${++vd}`,[e]);var Rn=e=>{if(typeof e!="number")throw Error(`"no support yet for flex value ${e}`);return{flexBasis:0,flexGrow:1,flexShrink:1}};var Wt={north:1,east:2,south:4,west:8,header:16,centre:32,absolute:64},Ko={AFTER:"after",BEFORE:"before"},De=Object.freeze({North:_t("north"),East:_t("east"),South:_t("south"),West:_t("west"),Header:_t("header"),Centre:_t("centre"),Absolute:_t("absolute")});function _t(e){return Object.freeze({offset:e==="north"||e==="west"?0:e==="south"||e==="east"?1:NaN,valueOf:function(){return Wt[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 Ki=De.North,Vi=De.South,qr=De.East,Jr=De.West,wd=De.Header,Dd=De.Centre,uo=class{static measure(t,o=[]){let n={};return Md(t,n,o),n}static allBoxesContainingPoint(t,o,n,r,s){return Ui(t,o,n,r,s).reverse()}};function Qr(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 es(e,t,o,n){let{BEFORE:r,AFTER:s}=Ko,{pctX:i,pctY:a,closeToTheEdge:l}=Qr(e,t,o),c,d;if(n==="row")c=i<.5?Jr:qr;else if(o.header&&Ln(o.header,e,t))if(c=wd,o.Stack){let m=o.Stack.length;if(m===0)d={index:-1,left:o.left,positionRelativeToTab:s,width:0};else{let u=o.Stack.find(({left:p,right:f})=>e>=p&&e<=f);if(u){let p=u.right-u.left;d={index:o.Stack.indexOf(u),left:u.left,positionRelativeToTab:(e-u.left)/p<.5?r:s,width:p}}else d={left:o.Stack[m-1].right,width:0,index:m,positionRelativeToTab:s}}}else if(o.header.titleWidth){let m=o.header.titleWidth;d={index:-1,left:o.left,positionRelativeToTab:(e-o.left)/m<.5?r:s,width:m}}else d={left:o.left,width:0,positionRelativeToTab:r,index:-1};else c=Rd(e,t,o,i,a);return{position:c,x:e,y:t,closeToTheEdge:l,tab:d}}function Rd(e,t,o,n,r){let s=Ld(o,.2);if(Ln(s,e,t))return Dd;switch(`${r<.5?"north":"south"}${n<.5?"west":"east"}`){case"northwest":return n>r?Ki:Jr;case"northeast":return 1-n>r?Ki:qr;case"southeast":return n>r?qr:Vi;case"southwest":return 1-n>r?Jr:Vi;default:}}function Ld({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 Md(e,t,o){let{id:n,"data-path":r,path:s=r}=$(e),i=U(e);if(n&&s){let[a,l]=Gi(e);_i(e,a,l,t),Se(i)&&Wi(e,t,o)}}function _i(e,t,o,n){let{"data-path":r,path:s=r,header:i}=$(e);n[s]=t;let a=U(e);if(i||a==="Stack"){let l=o.querySelector(".vuuHeader");if(l){let{top:c,left:d,right:m,bottom:u}=l.getBoundingClientRect();if(n[s].header={top:Math.round(c),left:Math.round(d),right:Math.round(m),bottom:Math.round(u)},a==="Stack")n[s].Stack=Array.from(l.querySelectorAll(".saltTab")).map(p=>p.getBoundingClientRect()).map(({left:p,right:f})=>({left:p,right:f}));else{let p=l.querySelector('[class^="vuuHeader-title"]'),{header:f}=n[s];p&&f&&(f.titleWidth=p.clientWidth)}}}return n[s]}function Wi(e,t,o,n=0,r=0,s=0,i=0){let{children:a,"data-path":l,path:c=l,style:d,active:m=0}=$(e),u=U(e),p=u==="Flexbox",f=u==="Stack",g=p&&d.flexDirection==="column",h=p&&d.flexDirection==="row",x=(f?a.filter((y,S)=>S===m):a.filter(Pd)).map(y=>{let[S,E]=Gi(y);return[{...S,top:S.top-s,right:S.right+r,bottom:S.bottom+i,left:S.left-n},E,y]}),I=x.map(([y,S,E],v,D)=>{let P,A,C,T,R,L,H=D.length-1;h?(R=v===0?0:y.left-D[v-1][0].right,L=v===H?0:D[v+1][0].left-y.right,P=v===0||R===0?0:R,A=v===H||L===0?0:L-L/2,y.left-=P,y.right+=A,C=s,T=i):g&&(R=v===0?0:y.top-D[v-1][0].bottom,L=v===H?0:D[v+1][0].top-y.bottom,C=v===0||R===0?0:R,T=v===H||L===0?0:L-L/2,y.top-=C,y.bottom+=T,P=n,A=r);let N=_i(E,y,S,t),w=U(E);return Se(w)&&Wi(E,t,o,P,A,C,T),N});x.length&&(t[c].children=I)}function Pd(e){let{id:t}=$(e),o=document.getElementById(t);return o?o.dataset.dragging!=="true":(console.warn(`BoxModel: no element found with id #${t}`),!1)}function Gi(e){let{id:t}=$(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,d=U(e);if(Se(d)){let m=o.scrollHeight;m>a&&(c={id:t,scrollHeight:m,scrollTop:o.scrollTop})}return[{top:Math.round(n),left:Math.round(r),right:Math.round(s),bottom:Math.round(i),height:Math.round(a),width:Math.round(l),scrolling:c},o,e]}function Ui(e,t,o,n,r,s=[]){let{children:i,"data-path":a,path:l=a}=$(e),c=U(e),d=t[l];if(!Ln(d,o,n))return s;if(r&&r.length){if(r.includes(l))s.push(e);else if(!r.some(m=>m.startsWith(l)))return s}else s.push(e);if(!Se(c)||d.header&&Ln(d.header,o,n))return s;d.scrolling&&Cd(d,o,n);for(let m=0;m<i.length;m++){if(c==="Stack"&&e.props.active!==m)continue;let u=Ui(i[m],t,o,n,r);if(u.length)return s.concat(u)}return s}function Ln(e,t,o){if(e)return t>=e.left&&t<e.right&&o>=e.top&&o<e.bottom}function Cd({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 Hd=.4,Mn=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}=Qr(o,n,r),d=Hd,m=l*r.width,u=r.width-m,p=c*r.height,f=r.height-p,g=r.width*d,h=r.height*d,b=1-d,x=m*b,I=p*b,y=u*b,S=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-x,hi:t.right-r.width+y},y:{lo:t.top-I,hi:t.bottom-r.height+S}},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: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 Nd=e=>e.pos.tab&&U(e.component)==="Stack"&&e.pos.position.Header,{north:kd,south:Ad,east:Od,west:zd}=Wt,Fd=Od+zd,Bd=kd+Ad,bt=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===Ko.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 b,x;let{clientRect:{top:n,left:r,right:s,bottom:i,header:a}}=this,l=0,c=Math.round(t/2)+l,d=Math.round(n),m=Math.round(r+c),u=Math.round(s-c),p=Math.round(i-c),f=this.targetTabPos(o),g=60,h=((b=a==null?void 0:a.bottom)!=null?b:0)-((x=a==null?void 0:a.top)!=null?x:0);return{l:m,t:d,r:u,b:p,tabLeft:f,tabWidth:g,tabHeight:h}}getIntrinsicDropRect(t){var g,h,b,x;let{pos:o,clientRect:n}=this,{x:r,y:s}=t,i=(h=(g=t.intrinsicSize)==null?void 0:g.height)!=null?h:0,a=(x=(b=t.intrinsicSize)==null?void 0:b.height)!=null?x: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))),[d,m,u,p]=this.dropRect=[l,c,l+a,c+i],f=o.position.EastOrWest?[d,n.top,d,n.bottom,u,n.top,u,n.bottom]:[n.left,m,n.right,m,n.left,p,n.right,p];return{l:d,r:u,t:m,b:p,guideLines:f}}getDropRectOutline(t,o){var x,I,y;let{pos:n,clientRect:r}=this,{width:s,height:i,position:a}=n,{width:l,height:c}=(x=o==null?void 0:o.intrinsicSize)!=null?x:{},d=(I=c!=null?c:i)!=null?I:0,m=(y=l!=null?l:s)!=null?y:0;this.dropRect=void 0;let{top:u,left:p,right:f,bottom:g}=r,h=0,b=Math.round(t/2)+h;switch(a){case De.North:case De.Header:{let S=Math.round((g-u)/2),E=d?Math.min(S,Math.round(d)):S;return m&&p+m<f?[p+b,u+b,p+m-b,u+b+E]:[p+b,u+b,f-b,u+b+E]}case De.West:{let S=Math.round((f-p)/2),E=m?Math.min(S,Math.round(m)):S;return d&&u+d<g?[p+b,u+b,p-b+E,u+d+b]:[p+b,u+b,p-b+E,g-b]}case De.East:{let S=Math.round((f-p)/2),E=m?Math.min(S,Math.round(m)):S;return d&&u+d<g?[f-b-E,u+b,f-b,u+d+b]:[f-b-E,u+b,f-b,g-b]}case De.South:{let S=Math.round((g-u)/2),E=d?Math.min(S,Math.round(d)):S;return m&&p+m<f?[p+b,g-b-E,p+m-b,g-b]:[p+b,g-b-E,f-b,g-b]}case De.Centre:return[p+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:bt.getActiveDropTarget(t.nextDropTarget)}};function Pn(e,t,o,n,r,s){var l;let i=null,a=uo.allBoxesContainingPoint(o,n,e,t,s);if(a.length){let[c,...d]=a,{"data-path":m,path:u=m,"data-row-placeholder":p}=$(c),f=n[u],h=es(e,t,f,r&&p?"row":void 0),b=n[u],x=([I,...y])=>{var S,E;if((S=h.position)!=null&&S.Header||h.closeToTheEdge){let v=$d(I,h,b,n,e,t);if(v){let[D,P]=v;return new bt({component:I,pos:D,clientRect:P,nextDropTarget:(E=x(y))!=null?E:null})}else if(y.length)return x(y)}};i=new bt({component:c,pos:h,clientRect:f,nextDropTarget:(l=x(d))!=null?l:null}).activate()}return i}function $d(e,{closeToTheEdge:t,position:o},n,r,s,i){if(!e||e.type==="DraggableLayout")return;let a=r[e.props.path],l=t&Wt.north,c=t&Wt.east,d=t&Wt.south,m=t&Wt.west,u=(l||o.Header)&&Math.round(n.top)===Math.round(a.top),p=c&&Math.round(n.right)===Math.round(a.right),f=d&&Math.round(n.bottom)===Math.round(a.bottom),g=m&&Math.round(n.left)===Math.round(a.left);if(u||p||f||g){let{"data-path":h,path:b=h}=e.props,x=r[b],I=es(s,i,x);if((Kd(e)||Zi(e))&&t&Fd)return I.width=120,[I,x];if((Vd(e)||Zi(e))&&(o.Header||t&Bd))return I.height=120,[I,x]}}function Zi(e){return U(e)==="Stack"}function Kd(e){return U(e)==="Flexbox"&&e.props.style.flexDirection==="column"}function Vd(e){return U(e)==="Flexbox"&&e.props.style.flexDirection==="row"}var Cn=require("@vuu-ui/vuu-popups");var Xi=X(require("classnames"));var os=require("react/jsx-runtime");function ns(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 ts="vuuDropMenu",rs=({className:e,dropTarget:t,onHover:o,orientation:n})=>{let r=t.toArray();return(0,os.jsx)("div",{className:(0,Xi.default)(ts,e,`${ts}-${n}`),onMouseLeave:()=>o(null),children:r.map((s,i)=>(0,os.jsx)("div",{className:`${ts}-item`,"data-icon":i===0?"column-2A":"column-2B",onMouseEnter:()=>o(s)},i))})};var Ji=require("react/jsx-runtime"),ss=!1,Vo=null,Qe=null,_d=e=>Vo=e,Wd=([e,t])=>`M${e},${t}`,Gd=([e,t])=>`L${e},${t}`,ji=([e,...t])=>`${Wd(e)} ${t.map(Gd)}Z`,Ud=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 Zd(){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,10 +14,11 @@
14
14
  />
15
15
  </path>
16
16
  </svg>
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(`
17
+ `,document.body.insertBefore(t,e)}}var _o=class{constructor(){this.currentPath=null;this.tabMode=null;Zd()}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=ji(n),s=document.getElementById("vuu-drop-outline");s==null||s.setAttribute("d",r),this.currentPath=r}clear(){Vo=null,Hn(),document.body.classList.remove("drawing"),Cn.PopupService.hidePopup()}get hoverDropTarget(){return Vo}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=ss;if(Vo!==null)this.drawTarget(Vo);else if(ss=t.nextDropTarget!=null,t.pos.tab?Xd(t):Qe&&Hn(),this.drawTarget(t,o),ss){let[s,i,a]=ns(t);{let l=(0,Ji.jsx)(rs,{dropTarget:t,onHover:_d,orientation:a});Cn.PopupService.showPopup({left:s,top:i,component:l})}}else Cn.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:d,tabHeight:m,guideLines:u}=r,p=a-s,f=l-i;if(this.currentPath){let I=document.getElementById("vuu-drop-outline");I==null||I.setAttribute("d",this.currentPath)}let g=this.getPoints(s,i,p,f,c,d,m),h=ji(g),b=document.getElementById("hw-drop-outline-animate");b==null||b.setAttribute("to",h),b==null||b.beginElement(),this.currentPath=h;let x=document.getElementById("hw-drop-guides");x==null||x.setAttribute("d",Ud(u))}}},Yi="transition:margin-left .4s ease-out;margin-left: 63px",qi="transition:margin-left .4s ease-out;margin-left: 0px";function Xd(e){var a,l;let{AFTER:t,BEFORE:o}=Ko,{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,d=`:scope .hwTabstrip > .hwTabstrip-inner > .hwTab:nth-child(${r.index+c})`;i=(a=document.getElementById(s))==null?void 0:a.querySelector(d),i?(Qe===null||Qe!==i)&&(i.style.cssText=Yi,Qe&&(Qe.style.cssText=qi),Qe=i):Hn()}else if((r==null?void 0:r.positionRelativeToTab)===o){if(Qe===null){let c=".vuuHeader-title";i=(l=document.getElementById(s))==null?void 0:l.querySelector(c),i.style.cssText=Yi,Qe=i}}else Hn()}function Hn(){Qe&&(Qe.style.cssText=qi,Qe=null)}var yt,Wo,Dt,ea,ta,Rt,Nn,mo=null,as,oa,Go,na,is,kn=null,jd=3,An=new _o,Qi=.4;function Yd(e,t){return t?ge(e,t):ut(e,o=>o.dropTarget)}var Fn={handleMousedown(e,t,o={}){yt=t,oa=o,ea=e.clientX,ta=e.clientY,is=o.dragThreshold===void 0?jd:o.dragThreshold,is===0?yt(e,0,0):(window.addEventListener("mousemove",On,!1),window.addEventListener("mouseup",zn,!1),kn=window.setTimeout(()=>{console.log("mousedownTimer fires"),window.removeEventListener("mousemove",On,!1),window.removeEventListener("mouseup",zn,!1),yt==null||yt(e,0,0)},500)),e.preventDefault()},initDrag(e,t,{top:o,left:n,right:r,bottom:s},i,a,l,c){return{drag:Wo,drop:Dt}=a,qd(e,t,{top:o,left:n,right:r,bottom:s},i,l,c)}};function On(e){let n=e.clientX-ea,r=e.clientY-ta;Math.max(Math.abs(n),Math.abs(r))>is&&(window.removeEventListener("mousemove",On,!1),window.removeEventListener("mouseup",zn,!1),yt==null||yt(e,n,r),yt=null)}function zn(){kn&&(window.clearTimeout(kn),kn=null),window.removeEventListener("mousemove",On,!1),window.removeEventListener("mouseup",zn,!1)}function qd(e,t,o,n,r,s){Rt=Yd(e,t);let{"data-path":i,path:a=i}=$(Rt);s&&(as=s.map(u=>ut(e,p=>p.id===u)).map(u=>u.props.path)),Go=uo.measure(Rt,s),console.log({_measurements:Go});let l=Go[a];Nn=new Mn(l,n.x,n.y,o,r);let c=Math.round(Nn.x.mousePct*100),d=Math.round(Nn.y.mousePct*100);return window.addEventListener("mousemove",ra,!1),window.addEventListener("mouseup",sa,!1),na=!1,An.prepare(o,"tab-only"),oa.DoNotTransform?"transform:none":`transform:scale(${Qi},${Qi});transform-origin:${c}% ${d}%;`}function ra(e){let t=e.clientX,o=e.clientY,n=Nn,r=mo,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||Wo==null||Wo(i,a),!(na||Rt===void 0)&&(n.inBounds()?s=Pn(t,o,Rt,Go,n.hasIntrinsicSize(),as):s=Pn(n.dropX(),n.dropY(),Rt,Go),r&&(s==null||s.box!==r.box)&&(mo=null),s&&(An.draw(s,n),mo=s))}function sa(){Jd()}function Jd(){if(mo){let e=An.hoverDropTarget||bt.getActiveDropTarget(mo);Dt==null||Dt(e),mo=null}else Dt==null||Dt({component:Rt,pos:{position:De.Absolute}});Wo=null,Dt=null,Rt=void 0,An.clear(),as=void 0,window.removeEventListener("mousemove",ra,!1),window.removeEventListener("mouseup",sa,!1)}var ia=X(require("classnames")),aa=require("react");var ca=require("react/jsx-runtime"),ls=(0,aa.forwardRef)(function({children:t,className:o,dropTarget:n,resizeable:r,...s},i){let a=(0,ia.default)("DraggableLayout",o);return(0,ca.jsx)("div",{className:a,ref:i,...s,children:t})}),la="DraggableLayout";ls.displayName=la;fe(la,ls,"container");var Sa=require("@salt-ds/core"),Ta=X(require("classnames")),va=require("react");var Ea=require("@vuu-ui/vuu-utils"),ce=X(require("react"));var da=X(require("classnames"));var ma=require("react/jsx-runtime"),ua="vuuPlaceholder",Uo=({className:e,closeable:t,flexFill:o,resizeable:n,shim:r,...s})=>(0,ma.jsx)("div",{className:(0,da.default)(ua,e,{[`${ua}-shim`]:r}),...s,"data-placeholder":!0,"data-resizeable":!0});Uo.displayName="Placeholder";fe("Placeholder",Uo);var pa=X(require("classnames")),Re=X(require("react"));var cs=require("react/jsx-runtime"),fa=Re.default.memo(function({column:t,index:o,onDrag:n,onDragEnd:r,onDragStart:s,style:i}){let a=(0,Re.useRef)(),l=(0,Re.useRef)(null),c=(0,Re.useRef)(0),[d,m]=(0,Re.useState)(!1),u=(0,Re.useCallback)(({key:E,shiftKey:v})=>{let D=v?10:1;t&&E==="ArrowDown"?n(o,D):t&&E==="ArrowUp"||!t&&E==="ArrowLeft"?n(o,-D):!t&&E==="ArrowRight"&&n(o,D)},[t,o,n]),p=(0,Re.useCallback)(E=>{let{key:v}=E;(t&&(v==="ArrowUp"||v==="ArrowDown")||!t&&(v==="ArrowLeft"||v==="ArrowRIght"))&&(s(o),u(E),f.current=u)},[t,u,o,s]),f=(0,Re.useRef)(p),g=E=>f.current(E),h=(0,Re.useCallback)(E=>{a.current=!0;let v=E[t?"clientY":"clientX"],D=v-c.current;v&&v!==c.current&&n(o,D),c.current=v},[t,o,n]),b=(0,Re.useCallback)(()=>{var E;window.removeEventListener("mousemove",h,!1),window.removeEventListener("mouseup",b,!1),r(),m(!1),(E=l.current)==null||E.focus()},[h,r,m]),x=(0,Re.useCallback)(E=>{c.current=t?E.clientY:E.clientX,s(o),window.addEventListener("mousemove",h,!1),window.addEventListener("mouseup",b,!1),E.preventDefault(),m(!0)},[t,h,b,o,s,m]),I=()=>{var E;a.current?a.current=!1:(E=l.current)==null||E.focus()},y=()=>{f.current=p},S=(0,pa.default)("Splitter","focusable",{active:d,column:t});return(0,cs.jsx)("div",{className:S,"data-splitter":!0,ref:l,role:"separator",style:i,onBlur:y,onClick:I,onKeyDown:g,onMouseDown:x,tabIndex:0,children:(0,cs.jsx)("div",{className:"grab-zone"})})});var ds=require("@vuu-ui/vuu-utils"),ms=X(require("react"));var Qd={"data-placeholder":!0,"data-resizeable":!0},Bn={},Lt="auto",us={flexBasis:0,flexGrow:1,flexShrink:1,height:Lt,width:Lt},ga={height:"width",width:"height"},ps=(e="row")=>e==="row"?["width","height","column"]:["height","width","row"],em=e=>typeof e=="string"&&e.endsWith("%"),$e=e=>{let{style:{width:t=Lt,height:o=Lt}=Bn}=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 $n(e,t,o){let n=ga[t],{style:{[n]:r=Lt,...s}=Bn}=e.props;return o&&o[t]?{...s,...us,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...s,...us,[n]:r}}function fs(e){let{style:{flex:t,flexGrow:o,flexShrink:n,flexBasis:r}=Bn}=e.props;return typeof t=="number"||r===0&&o===1&&n===1?!0:typeof r!="number"}function Kn(e,t,o){let n=ga[t],{style:{[t]:r=Lt,[n]:s=Lt,...i}=Bn}=e.props;return r!==Lt?em(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,...us,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...i,[n]:s}}function po(e,t,o,n,r){let s=[],i=0,a;if(n&&r){let d,[m,u,p,f]=r;[d,a]=t==="column"?[u-n.top,n.bottom-f]:[m-n.left,n.right-p],d&&s.push(et(`${o}.${i++}`,d,{flexGrow:0,flexShrink:0}))}else a=!0;let{version:l=0,style:c}=$(e);return s.push(he(e,`${o}.${i++}`,{version:l+1,style:{...c,flexBasis:"auto",flexGrow:0,flexShrink:0}})),a&&s.push(et(`${o}.${i++}`,0,void 0,{[`data-${t}-placeholder`]:!0})),Vn(t,{resizeable:!1,style:{flexBasis:"auto"}},s,o)}var tm=(e,t)=>{if(!t)return e===0?1:0};function Vn(e,t,o,n){let r=(0,ds.uuid)(),{flexFill:s,style:i,resizeable:a=!0}=t,{flexBasis:l=s?void 0:"auto"}=i,c=tm(l,s);return ms.default.createElement(Tt.Flexbox,{id:r,key:r,path:n,flexFill:s,style:{...i,flexDirection:e,flexBasis:l,flexGrow:c,flexShrink:c},resizeable:a},o)}var om={flexGrow:1,flexShrink:1};function et(e,t,o,n){let r=(0,ds.uuid)();return ms.default.createElement("div",{...Qd,...n,"data-path":e,id:r,key:r,style:{...om,...o,flexBasis:t}})}var nm={},Zo=1,Xo=2,rm=e=>typeof e.intrinsicSize=="number",sm=(e,t)=>{let o={};return e.forEach(n=>{o[n]=G(t,n)}),o},_n=(e,t,o)=>e.map((n,r)=>{var l;let s=G(n,"resizeable"),{[t]:i}=(l=$e(n))!=null?l:nm,a=fs(n);return o?{index:r,flexOpen:a,intrinsicSize:i,resizeable:s,...sm(o,n)}:{index:r,flexOpen:a,intrinsicSize:i,resizeable:s}}),ha=e=>{let t=e.length,o=e.every(rm),n=Array(t).fill(0);if(o&&t>0&&(n[0]=Xo,n[t-1]=Xo),t<2)return n;for(let r=0,s=0;r<t-1;r++)e[r].resizeable&&!s&&(s=Zo),n[r]+=s;for(let r=t-1;r>0&&(n[r]&Zo&&(n[r]-=Zo),!e[r].resizeable);r--);return n},ba=(e,t)=>{let o=am(e,t),n=lm(e,t),r=o!==-1&&n!==-1?[o,n]:void 0,s=im(e,r);return[r,s]};function im(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 am(e,t){let o=t,n=!1;for(;o>=1&&!n;)o=o-1,n=ya(e,o);return o}function lm(e,t){let o=t,n=!1,r=e.length;for(;o<r-1&&!n;)o=o+1,n=ya(e,o);return o===r?-1:o}function ya(e,t){let{placeholder:o,splitter:n,resizeable:r,intrinsicSize:s}=e[t];return!!(!n&&!s&&(o||r))}var cm=e=>!e.splitter&&!e.placeholder,Ia=({children:e,onSplitterMoved:t,style:o})=>{let n=(0,ce.useRef)(null),r=(0,ce.useRef)(),s=(0,ce.useRef)(),i=(0,ce.useRef)([]),[,a]=(0,ce.useState)({}),l=h=>{s.current=h,a({})},c=(o==null?void 0:o.flexDirection)==="column",d=c?"height":"width",m=(0,ce.useMemo)(()=>Array.isArray(e)?e:ce.default.isValidElement(e)?[e]:[],[e]),u=(0,ce.useCallback)(h=>{let{current:b}=r;if(b){let[x,I]=ba(b,h);x&&(x.forEach(y=>{var E;let S=(E=n.current)==null?void 0:E.childNodes[y];if(S){let{size:v,minSize:D}=pm(S,d);b[y].currentSize=v,b[y].minSize=D}}),I&&I.forEach(y=>{var E;let S=(E=n.current)==null?void 0:E.childNodes[y];if(S){let{[d]:v}=S.getBoundingClientRect();b[y].flexBasis=v}}))}},[d]),p=(0,ce.useCallback)((h,b)=>{s.current&&r.current&&l(dm(s.current,r.current,b,d))},[d]),f=(0,ce.useCallback)(()=>{let h=r.current;h&&(t==null||t(h.filter(cm))),h==null||h.forEach(b=>{b.currentSize=void 0,b.flexBasis=void 0,b.flexOpen=!1})},[t]),g=(0,ce.useCallback)(h=>ce.default.createElement(fa,{column:c,index:h,key:`splitter-${h}`,onDrag:p,onDragEnd:f,onDragStart:u}),[p,f,u,c]);return(0,ce.useMemo)(()=>{let[h,b]=um(m,d,g,i.current);r.current=b,s.current=h},[m,g,d]),{content:s.current||[],rootRef:n}};function um(e,t,o,n){let r=_n(e,t),s=ha(r),i=[],a=[];for(let l=0;l<e.length;l++){let c=e[l];if(l===0&&s[l]&Xo&&(i.push(xa(l)),a.push({placeholder:!0,shim:!0})),c.key==null){let d=n[l]||(n[l]=(0,Ea.getUniqueId)());i.push(ce.default.cloneElement(c,{key:d}))}else i.push(c);a.push(r[l]),l>0&&s[l]&Xo?(i.push(xa(l)),a.push({placeholder:!0})):s[l]&Zo&&(i.push(o(i.length)),a.push({splitter:!0}))}return[i,a]}function dm(e,t,o,n){return mm(t,o)?e.map((s,i)=>{let a=t[i],{currentSize:l,flexOpen:c,flexBasis:d}=a,m=l!==void 0;if(m||c){let{flexBasis:u}=s.props.style||{},p=m?a.currentSize:d;return p!==u?ce.default.cloneElement(s,{style:{...s.props.style,flexBasis:p,[n]:"auto"}}):s}else return s}):e}function mm(e,t){let o=[];e.forEach((d,m)=>{d.currentSize!==void 0&&o.push(m)});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 d=t<0?-1:1;t=Math.max(0,r-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 xa(e){return ce.default.createElement(Uo,{shim:e===0,key:`placeholder-${e}`})}function pm(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 Da=require("react/jsx-runtime"),gs="hwFlexbox",wa=(0,va.forwardRef)(function(t,o){let{breakPoints:n,children:r,column:s,className:i,flexFill:a,gap:l,fullPage:c,id:d,onSplitterMoved:m,resizeable:u,row:p,spacing:f,splitterSize:g,style:h,...b}=t,{content:x,rootRef:I}=Ia({children:r,onSplitterMoved:m,style:h}),y=(0,Ta.default)(gs,i,{[`${gs}-column`]:s,[`${gs}-row`]:p,"flex-fill":a,"full-page":c});return(0,Da.jsx)("div",{...b,className:y,"data-resizeable":u||void 0,id:d,ref:(0,Sa.useForkRef)(I,o),style:{...h,gap:l,"--spacing":f},children:x})});wa.displayName="Flexbox";var Wn=wa;var Qa=require("react");var Gt={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 ke=require("react");var Yn=X(require("react"));var vs=require("@vuu-ui/vuu-utils"),go=X(require("react"));var Es=require("@vuu-ui/vuu-utils"),Mt=X(require("react"));var Ut=require("react"),Le=new Map,Xe=new Map,hs=e=>Le.get(e),bs=e=>Le.has(e),ys=(e,t)=>Le.set(e,t),Zt=()=>{let e=(0,Ut.useCallback)((i,a)=>{let l=Xe.get(i);if(l)return a!==void 0&&l[a]!==void 0?l[a]:a!==void 0?void 0:l},[]),t=(0,Ut.useCallback)((i,a,l)=>{if(a===void 0)Xe.set(i,l);else if(Xe.has(i)){let c=Xe.get(i);Xe.set(i,{...c,[a]:l})}else Xe.set(i,{[a]:l})},[]),o=(0,Ut.useCallback)((i,a)=>{if(Xe.has(i)){if(a===void 0)Xe.delete(i);else if(Xe.get(i)[a]){let{[a]:c,...d}=Xe.get(i);Object.keys(d).length>0?Xe.set(i,d):Xe.delete(i)}}},[]),n=(0,Ut.useCallback)((i,a)=>{let l=Le.get(i);if(l)return a!==void 0?l[a]:l},[]),r=(0,Ut.useCallback)((i,a,l)=>{if(a===void 0)Le.set(i,l);else if(Le.has(i)){let c=Le.get(i);Le.set(i,{...c,[a]:l})}else Le.set(i,{[a]:l})},[]),s=(0,Ut.useCallback)((i,a)=>{if(Le.has(i)){if(a===void 0)Le.delete(i);else if(Le.get(i)[a]){let{[a]:c,...d}=Le.get(i);Object.keys(d).length>0?Le.set(i,d):Le.delete(i)}}},[]);return{loadSessionState:e,loadState:n,saveSessionState:t,saveState:r,purgeState:s,purgeSessionState:o}};var Is=e=>e.flexDirection==="column"?["height","width"]:["width","height"],fm={},fo=(e,t="0")=>{let[o,n]=Un(U(e),e.props,t);return Mt.default.cloneElement(e,o,n)},Gn=(e,t)=>{let o=U(e),[n,r]=Un(o,e.props,"0",void 0,t);return(0,Mt.cloneElement)(e,n,r)},gm=(e,t,o)=>{let[n,r]=Un(e,t,"0",void 0,o);return{...t,...n,type:e,children:r}};function hm(e,t,o="0",n=null,r){var g,h;let{active:s=0,"data-path":i,path:a=i,id:l,style:c}=$(r),d=U(r)===e&&o===a,m=d?l:(g=t.id)!=null?g:(0,Es.uuid)(),u=e==="Stack"?(h=t.active)!=null?h:s:void 0,p=m,f=d?c:ym(e,t,n);return _r(e)?{id:m,key:p,path:o,style:f,type:e,active:u}:{id:m,key:p,style:f,"data-path":o}}function Un(e,t,o,n=null,r){var c,d;let s=hm(e,t,o,n,r);if(t.layout&&!r)return[s,[jo(t.layout,`${o}.0`)]];let i=(d=r==null?void 0:r.children)!=null?d:(c=r==null?void 0:r.props)==null?void 0:c.children,l=t.dropTarget&&i?i:bm(e,t.children,o,i);return[s,l]}function bm(e,t,o="0",n){let r=Array.isArray(t)?t:Mt.default.isValidElement(t)?[t]:[];return Se(e)?r.map((s,i)=>{let a=U(s),l=U(n==null?void 0:n[i]);if(!l||a===l){let[c,d]=Un(a,s.props,`${o}.${i}`,e,n==null?void 0:n[i]);return Mt.default.cloneElement(s,c,d)}return n==null?void 0:n[i]}):t}var ym=(e,t,o)=>{let{style:n=fm}=t;if(e==="Flexbox"&&(n={flexDirection:t.column?"column":"row",...n,display:"flex"}),n.flex){let{flex:r,...s}=n;n={...s,...Rn(typeof r=="number"?r:0)}}else o==="Stack"?n={...n,...Rn(1)}:o==="Flexbox"&&(n.width||n.height)&&n.flexBasis===void 0&&(n={...n,flexBasis:"auto",flexGrow:0,flexShrink:0});return n};function jo({id:e=(0,Es.uuid)(),type:t,children:o,props:n,state:r},s){let i=t.match(/^[a-z]/)?t:Tt[t];if(i===void 0)throw Error(`layoutUtils unable to create component from JSON, unknown type ${t}`);return r&&ys(e,r),Mt.default.createElement(i,{id:e,...n,key:e,path:s},o?o.map((a,l)=>jo(a,`${s}.${l}`)):void 0)}function Ss(e){return Ts(e)}function Ts(e){let t=U(e),{id:o,children:n,type:r,...s}=$(e),i=bs(o)?hs(o):void 0;return{id:o,type:t,props:Ra(s),state:i,children:Mt.default.Children.map(n,Ts)}}function Ra(e){if(e){let{path:t,...o}=e,n={};for(let[r,s]of Object.entries(o))n[r]=xs(s);return n}}function xs(e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(xs);if(typeof e=="object"&&e!==null){let t={};for(let[o,n]of Object.entries(e))t[o]=xs(n);return t}}function La(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 Zn(e,t,o){let{active:n,children:r=[],path:s}=$(e),i=G(t,"path"),{idx:a,finalStep:l}=Ze(s,i,!0),[c,d]=l?xm(e,r,o):[n,r==null?void 0:r.map((u,p)=>p===a?Zn(u,t,o):u)],m=U(e)==="Stack"?Array.isArray(c)?c[0]:c:n;return go.default.cloneElement(e,{active:m},d)}function xm(e,t,o){let n=G(e,"path"),r=t==null?void 0:t.length,{id:s=(0,vs.uuid)()}=$(o);return r?[r,t.concat(he(o,`${n}.${r}`,{id:s,key:s}))]:[0,[he(o,`${n}.0`,{id:s})]]}function Xn(e,t,o,n,r,s,i){let{active:a,children:l,path:c}=$(e),d=G(t,"path"),{idx:m,finalStep:u}=Ze(c,d),[p,f]=u?Em(e,l,m,o,n,r,s,i):[a,l.map((h,b)=>b===m?Xn(h,t,o,n,r,s,i):h)],g=U(e)==="Stack"?p:a;return go.default.cloneElement(e,{active:g},f)}function Em(e,t,o,n,r,s,i,a){let l=$e(n);return l!=null&&l.width&&(l!=null&&l.height)?Sm(e,t,o,n,r,i,a):Ma(e,t,o,n,r,(s==null?void 0:s.width)||(s==null?void 0:s.height),i)}var Im=(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 Sm(e,t,o,n,r,s,i){let{style:{flexDirection:a}}=$(e),[l,c,d]=ps(a),{[c]:m,[l]:u}=$e(n),p=G(t[o],"path"),f=Im(a,r,s,i),[g,h]=m<s[c]?[po(n,d,p,s,i),u]:[n,void 0],b=f?et(p,f,{flexGrow:0,flexShrink:0}):void 0;return m>s[c]&&(t=t.map(x=>{if(G(x,"placeholder"))return x;{let{[c]:I}=$e(x);return I&&I<m?po(x,d,G(x,"path")):x}})),Ma(e,t,o,g,r,h,s,b)}function Ma(e,t,o,n,r,s,i,a){let l=G(e,"path"),c=0,d=!t||t.length===0?[n]:t.reduce((m,u,p)=>{if(o===p){let[f,g]=Tm(e,u,n,i);r==="before"?a?m.push(a,g,f):m.push(g,f):a?m.push(f,g,a):m.push(f,g),c=m.indexOf(g)}else m.push(u);return m},[]).map((m,u)=>u<c?m:he(m,`${l}.${u}`));return[c,d]}function Tm(e,t,o,n){let r=(0,vs.uuid)(),{version:s=0}=$(o);if(s+=1,U(e)==="Flexbox"){let[i]=Is(e.props.style),a=6,l={[i]:(n[i]-a)/2},c=Kn(t,i,l),d=Kn(o,i,l);return[go.default.cloneElement(t,{style:c}),go.default.cloneElement(o,{id:r,version:s,style:d})]}else{let{style:{left:i,top:a,flex:l,...c}={left:void 0,top:void 0,flex:void 0}}=$(o);return[t,go.default.cloneElement(o,{id:r,version:s,style:c})]}}var Ca=require("react");var Yo=X(require("react"));function Pa(e,{target:t,replacement:o}){return ws(e,t,o)}function ws(e,t,o){let n=G(t,"path"),r=G(t,"resizeable"),{style:s}=$(t),i=fo(Yo.default.cloneElement(o,{resizeable:r,style:{...s,...o.props.style}}),n);return Me(e,t,i)}function Me(e,t,o,n){if(e===t)return o;let{idx:r,finalStep:s}=Ze(G(e,"path"),G(t,"path")),i=e.props.children.slice();return s?n?n===Gt.MINIMIZE?i[r]=vm(e,i[r]):n===Gt.RESTORE&&(i[r]=wm(i[r])):i[r]=o:i[r]=Me(i[r],t,o,n),Yo.default.cloneElement(e,void 0,i)}function vm(e,t){let{style:o}=$(e),{style:n}=$(t),{width:r,height:s,flexBasis:i,flexShrink:a,flexGrow:l,...c}=n,d={width:r,height:s,flexBasis:i,flexShrink:a,flexGrow:l},m={...c,flexBasis:0,flexGrow:0,flexShrink:0},u=o.flexDirection==="row"?"vertical":o.flexDirection==="column"?"horizontal":!1;return u?Yo.default.cloneElement(t,{collapsed:u,restoreStyle:d,style:m}):t}function wm(e){let{style:t,restoreStyle:o}=$(e),{flexBasis:n,flexShrink:r,flexGrow:s,...i}=t,a={...i,...o};return Yo.default.cloneElement(e,{collapsed:!1,style:a,restoreStyle:void 0})}function Ha(e,{fromIndex:t,path:o,toIndex:n}){let r=ge(e,o,!0),{children:s}=$(r),i=Dm(s,t,n),a=(0,Ca.cloneElement)(r,void 0,i);return Me(e,r,a)}function Dm(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 Ee={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 Pt=X(require("react"));function Ds(e,{path:t}){let o=ge(e,t),n=ct(e,t);if(n===null)return e;let{children:r}=$(n);if(r.length>1&&ka(r,t)){let{style:{flexBasis:s,display:i,flexDirection:a,...l}}=$(n),c=G(n,"path"),d=Me(e,n,et(c,s,l));for(;(n=ct(d,c))&&G(n,"path")!=="0";){let{children:m}=$(n);if(ka(m)){c=G(n,"path");let{style:{flexBasis:u,display:p,flexDirection:f,...g}}=$(n);d=Me(e,n,et(c,u,g))}else if(Pm(m))d=za(e,n);else break}return d}return Aa(e,o)}function Aa(e,t){let o=$(e),{children:n,path:r,preserve:s}=o,{active:i}=o,{idx:a,finalStep:l}=Ze(r,G(t,"path")),c=U(e),d=n.slice();if(l){if(d.splice(a,1),i!==void 0&&i>=a&&(i=Math.max(0,i-1)),d.length===1&&!s&&r!=="0"&&c.match(/Flexbox|Stack/))return Rm(e,d[0]);!d.some(Lm)&&d.some(Oa)&&(d=Mm(d))}else d[a]=Aa(d[a],t);return d=d.map((m,u)=>he(m,`${r}.${u}`)),Pt.default.cloneElement(e,{active:i},d)}function Rm(e,t){let o=U(e),{path:n,style:{flexBasis:r,flexGrow:s,flexShrink:i,width:a,height:l}}=$(e),c=he(t,n);if(n==="0")c=Pt.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]:m,...u}}=c.props;c=Pt.default.cloneElement(c,{flexFill:void 0,style:{...u,flexGrow:s,flexShrink:i,flexBasis:r,width:a,height:l}})}return c}var Lm=e=>e.props.style.flexGrow>0,Oa=e=>{let{width:t,height:o,flexGrow:n}=e.props.style;return n===0&&typeof t!="number"&&typeof o!="number"},Mm=e=>e.map(t=>Oa(t)?Pt.default.cloneElement(t,{style:{...t.props.style,flexGrow:1}}):t),Pm=e=>{if(e&&e.length>0){let t=G(e[0],"placeholder"),o=!1;for(let n=1;n<e.length;n++){if(o=G(e[n],"placeholder"),t&&o)return!0;t=o}}},za=(e,t)=>{let{children:o,path:n}=$(e),{idx:r,finalStep:s}=Ze(n,G(t,"path")),i=o.slice();return s?i[r]=Cm(t):i[r]=za(i[r],t),i=i.map((a,l)=>he(a,`${n}.${l}`)),Pt.default.cloneElement(e,void 0,i)},Cm=e=>{let{children:t}=$(e),o=[],n=[];for(let s=0;s<t.length;s++)G(t[s],"placeholder")?n.push(t[s]):(n.length===1?o.push(n.pop()):n.length>0&&(o.push(Na(n)),n.length=0),o.push(t[s]));n.length===1?o.push(n.pop()):n.length>0&&o.push(Na(n));let r=G(e,"path");return Pt.default.cloneElement(e,void 0,o.map((s,i)=>he(s,`${r}.${i}`)))},Na=([e,...t])=>{let o=G(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 Pt.default.cloneElement(e,{style:{...o,flexBasis:n,flexGrow:r,flexShrink:s}})},ka=(e,t)=>e.every(o=>G(o,"placeholder")||t&&G(o,"path")===t);var jn=X(require("react"));function Fa(e,{path:t,size:o}){let n=ge(e,t,!0),{style:r}=$(n),s={...r,width:o},i=jn.default.cloneElement(n,{style:s});return Me(e,n,i)}function Ba(e,{path:t,sizes:o}){let n=ge(e,t,!0),{children:r,style:s}=$(n),i=s.flexDirection==="column"?"height":"width",a=Hm(r,o,i),l=jn.default.cloneElement(n,void 0,a);return Me(e,n,l)}function Hm(e,t,o){return e.map((n,r)=>{let{style:{[o]:s,flexBasis:i}}=$(n),a=t[r],{currentSize:l,flexBasis:c}=a,m=l!==void 0?a.currentSize:c;return m===void 0||s===m||i===m?n:jn.default.cloneElement(n,{style:Nm(n.props.style,o,m)})})}function Nm(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 $a=require("@vuu-ui/vuu-utils"),qo=X(require("react"));var Ka=e=>{let[t]=U(e);return t===t.toLowerCase()};function Jo(e,t,o,n,r,s){let{children:i,path:a}=$(e),l=G(t,"path"),{idx:c,finalStep:d}=Ze(a,l),m=d?km(e,i,t,o,n,r,s):i.map((u,p)=>p===c?Jo(u,t,o,n,r,s):u);return qo.default.cloneElement(e,void 0,m)}function km(e,t,o,n,r,s,i){let a=$e(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 Om(t,o,n,r,s,i)}return Am(e,t,o,n,r)}function Am(e,t,o,n,r){var E;let{version:s=0}=$(n),i=G(o,"path"),{type:a,flexDirection:l,showTabs:c}=_a(r),[d,m,u]=zm(a,o,n,l,r),p=Va(r),f=p?1:0,g={resizeable:!0,style:u,version:s+1},b={[Ka(o)?"data-resizeable":"resizeable"]:!0,style:m},x=a==="Stack"?{showTabs:c}:void 0,I=a==="Flexbox"?{splitterSize:(E=U(e)==="Flexbox"&&e.props.splitterSize)!=null?E:void 0}:void 0,y=(0,$a.uuid)(),S=qo.default.createElement(Tt[a],{active:f,id:y,key:y,path:G(o,"path"),flexFill:G(o,"flexFill"),...I,...x,style:d,resizeable:G(o,"resizeable")},p?[he(o,`${i}.0`,b),fo(qo.default.cloneElement(n,g),`${i}.1`)]:[fo(qo.default.cloneElement(n,g),`${i}.0`),he(o,`${i}.1`,b)]);return t.map(v=>v===o?S:v)}function Om(e,t,o,n,r,s){let{flexDirection:i}=_a(n),a=i==="column"?"row":"column",l=Va(n),[c,d,m,u]=s,[p,f]=i==="column"?[d-r.top,r.bottom-u]:[c-r.left,r.right-m],g=G(t,"path"),h=0,b=Ka(t)?"data-resizeable":"resizeable",x=[];p&&x.push(l?he(t,`${g}.${h++}`,{[b]:!0,style:{flexBasis:p,flexGrow:1,flexShrink:1}}):et(`${g}.${h++}`,p,{flexGrow:0,flexShrink:0})),x.push(po(o,a,`${g}.${h++}`,r,s)),f&&x.push(l?et(`${g}.${h++}`,0):he(t,`${g}.${h++}`,{[b]:!0,style:{flexBasis:0,flexGrow:1,flexShrink:1}}));let I=Vn(i,t.props,x,g);return e.map(y=>y===t?I:y)}function zm(e,t,o,n,r){let s={...t.props.style,flexDirection:n},i=e==="Flexbox"&&n==="column"?"height":"width",a=$n(o,i,r),l=$n(t,i);return[s,l,a]}var Va=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 _a(e){return e.position.Header?{type:"Stack",flexDirection:"column",showTabs:!0}:{type:"Flexbox",flexDirection:e.position.EastOrWest?"row":"column"}}var Rs=(e,t)=>{switch(t.type){case Ee.ADD:return Vm(e,t);case Ee.DRAG_DROP:return Km(e,t);case Ee.MAXIMIZE:return $m(e,t);case Ee.REMOVE:return Ds(e,t);case Ee.REPLACE:return Pa(e,t);case Ee.SET_PROP:return Wa(e,t);case Ee.SET_PROPS:return Bm(e,t);case Ee.SET_TITLE:return Wa(e,{type:"set-prop",path:t.path,propName:"title",propValue:t.title});case Ee.SPLITTER_RESIZE:return Ba(e,t);case Ee.LAYOUT_RESIZE:return Fa(e,t);case Ee.SWITCH_TAB:return Fm(e,t);case Ee.MOVE_CHILD:return Ha(e,t);default:return e}},Fm=(e,{path:t,nextIdx:o})=>{let n=ge(e,t,!0),r=Yn.default.cloneElement(n,{active:o});return Me(e,n,r)},Wa=(e,{path:t,propName:o,propValue:n})=>{let r=ge(e,t,!0),s=Yn.default.cloneElement(r,{[o]:n});return Me(e,r,s)},Bm=(e,{path:t,props:o})=>{let n=ge(e,t,!0),r=Yn.default.cloneElement(n,o);return Me(e,n,r)},$m=(e,{path:t,type:o})=>{if(t){let n=ge(e,t,!0);return Me(e,n,n,o)}else return e},Km=(e,t)=>{var f,g;let{draggedReactElement:o,dragInstructions:n,dropTarget:r}=t,s=r.component,{pos:i}=r,a=((f=i==null?void 0:i.position)==null?void 0:f.Header)&&U(s)==="Stack",{id:l,version:c}=$(o),d=$e(o),m;if(a){let[h,b]=La(s,i);h===void 0?m=Zn(e,s,o):m=Xn(e,h,o,b)}else!d&&((g=i==null?void 0:i.position)!=null&&g.Centre)?m=ws(e,s,o):m=_m(e,r,o);if(n.DoNotRemove)return m;let u=ut(m,h=>h.id===l&&h.version===c),p=G(u,"path");return Ds(m,{path:p,type:"remove"})},Vm=(e,{path:t,component:o})=>Zn(e,ge(e,t),o),_m=(e,t,o)=>{let{component:n,pos:r,clientRect:s,dropRect:i}=t,a=G(n,"path");if(a==="0.0")return Jo(e,n,o,r);let l=ct(e,a);if(Ga(r,l)){let c=r.position.SouthOrEast?"after":"before";return Xn(e,n,o,c,r,s,i)}if(!Ga(r,l))return Jo(e,n,o,r,s,i);if(Se(U(l)))return Jo(e,n,o,r);throw Error(`no support right now for position = ${r.position}`)},Ga=(e,t)=>e.position.Centre?Za(t)||Ua(t):e.position.NorthOrSouth?Ua(t):e.position.EastOrWest?Za(t):!1,Ua=e=>U(e)==="Flexbox"&&e.props.style.flexDirection==="column",Za=e=>U(e)==="Flexbox"&&e.props.style.flexDirection!=="column";var Xa=require("react"),Wm=e=>console.log(`dispatch ${e.type}, have you forgotten to provide a LayoutProvider ?`),ho=(0,Xa.createContext)({dispatchLayoutProvider:Wm,version:-1});var xt=require("react");var Gm={},ja=[0,0],Um=(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]},Zm=e=>{let{offsetParent:t}=e;if(t===null)return ja;{let{left:o,top:n}=t.getBoundingClientRect();return[o,n]}},Ya=(e,t)=>{let o=(0,xt.useRef)(),n=(0,xt.useRef)(),r=(0,xt.useRef)(),s=(0,xt.useCallback)((c,d)=>{if(n.current&&r.current){let{dragOffsets:[m,u],targetPosition:p}=n.current,f=typeof c=="number"?c-m:p.left,g=typeof d=="number"?d-u:p.top;(f!==p.left||g!==p.top)&&(n.current.targetPosition.left=f,n.current.targetPosition.top=g,r.current.style.top=g+"px",r.current.style.left=f+"px")}},[]),i=(0,xt.useCallback)(c=>{if(n.current){let{dragInstructions:d,payload:m,originalCSS:u}=n.current;t({type:"drag-drop",draggedReactElement:m,dragInstructions:d,dropTarget:c}),console.log("[useLayoutDragDrop]",{dragInstructions:d}),r.current&&(d.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,xt.useCallback)(c=>{if(o.current){let{payload:d,dragContainerPath:m,dragElement:u,dragRect:p,instructions:f=Gm,path:g}=o.current,{current:h}=e,b={x:c.clientX,y:c.clientY},x=d!=null?d:ge(h,g,!0),{id:I}=x.props,y=$e(x),S="",E="",v="",D=-1,P=-1,A=ja,C=document.getElementById(I);if(C===null)[C,E,D,P]=Um(p,I,u);else{A=Zm(C);let[T,R]=A,{width:L,height:H,left:N,top:w}=C.getBoundingClientRect();D=N-T,P=w-R,E=`width:${L}px;height:${H}px;left:${D}px;top:${P}px;z-index: 100;background-color:#ccc;opacity: 0.6;`,C.dataset.dragging="true",S=C.style.cssText}v=Fn.initDrag(e.current,m,p,b,{drag:s,drop:i},y),C.style.cssText=E+v,r.current=C,n.current={payload:x,originalCSS:S,dragRect:p,dragOffsets:A,dragInstructions:f,targetPosition:{left:D,top:P}}}},[s,i,e]);return(0,xt.useCallback)(c=>{let{evt:d,...m}=c;console.log("prepare to drag",{options:m}),o.current={...m,dragContainerPath:""},Fn.handleMousedown(d,a,m.instructions)},[a])};var Ls=require("react/jsx-runtime"),qa=e=>e.dropTarget,Xm=e=>["drag-drop","remove","set-title","splitter-resize","switch-tab"].includes(e.type),jm=()=>{let e=Ja();return(0,Ls.jsx)("div",{children:`Context: ${e} `})},Ym=e=>{let{children:t,layout:o,onLayoutChange:n}=e,r=(0,ke.useRef)(void 0),s=(0,ke.useRef)(t),[,i]=(0,ke.useState)(null),a=(0,ke.useCallback)(m=>{if(n){let u=ut(m,qa)||r.current,f=U(u)==="DraggableLayout"?$(u).children[0]:u,g=Ss(f);n(g,"drag-root")}},[n]),l=(0,ke.useCallback)((m,u=!1)=>{let p=Rs(r.current,m);p!==r.current&&(r.current=p,i({}),!u&&Xm(m)&&a(p))},[a]),c=(0,ke.useCallback)(m=>{switch(m.type){case"drag-start":{d(m);break}case"save":{a(r.current);break}default:{l(m);break}}},[l,a]),d=Ya(r,c);return(0,ke.useEffect)(()=>{if(o){let m=ut(r.current,qa),u=Xr(m),p=jo(o,`${m.props.path}.0`),f=u?{type:Ee.REPLACE,target:u,replacement:p}:{type:Ee.ADD,path:m.props.path,component:p};l(f,!0)}},[l,o]),r.current===void 0?r.current=Gn(t):t!==s.current&&(r.current=Gn(t,r.current),s.current=t),(0,Ls.jsx)(ho.Provider,{value:{dispatchLayoutProvider:c,version:0},children:r.current})},tt=()=>{let{dispatchLayoutProvider:e}=(0,ke.useContext)(ho);return e},Ja=()=>{console.log({LayoutProviderContext:ho});let{version:e}=(0,ke.useContext)(ho);return e};var el=require("react/jsx-runtime"),Ms=function(t){let{path:o}=t,n=tt(),r=(0,Qa.useCallback)(s=>{n({type:Gt.SPLITTER_RESIZE,path:o,sizes:s})},[n,o]);return(0,el.jsx)(Wn,{...t,onSplitterMoved:r})};Ms.displayName="Flexbox";fe("Flexbox",Ms,"container");var al=require("@salt-ds/core"),ll=X(require("classnames")),Jn=require("react");var ot=require("react");var jt=require("react"),Cs=["height","width"],qm=["height"],Jm=["width"],Xt=new WeakMap,tl=(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}},Ps=new ResizeObserver(e=>{for(let t of e){let{target:o,contentRect:n}=t,r=Xt.get(o);if(r){let{onResize:s,measurements:i}=r,a=!1;for(let[l,c]of Object.entries(i)){let d=tl(o,n,l);d!==c&&(a=!0,i[l]=d)}a&&s&&s(i)}}});function Qo(e,t,o,n=!1){console.log("resizeObserver container",{ref:e.current});let r=(0,jt.useRef)(t),s=(0,jt.useCallback)(i=>{let a=i.getBoundingClientRect();return r.current.reduce((l,c)=>(l[c]=tl(i,a,c),l),{})},[]);(0,jt.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 m=s(i);d.measurements=m,Ps.observe(i),n&&o(m)}}}if(i){if(Xt.has(i))throw Error("useResizeObserver attemping to observe same element twice");l()}return()=>{i&&Xt.has(i)&&(Ps.unobserve(i),Xt.delete(i),a=!0)}},[e,s,n,o]),(0,jt.useLayoutEffect)(()=>{let i=e.current,a=Xt.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 Qm(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 ep=([,e],[,t])=>t-e,Ns=e=>Object.entries(e).sort(ep).map(([t,o],n,r)=>[t,o,n<r.length-1?r[n+1][1]:9999]),Hs=null,tp=(e="salt")=>{let{xs:t,sm:o,md:n,lg:r,xl:s}=Qm(e);return Ns({xs:t,sm:o,md:n,lg:r,xl:s})},ol=e=>(Hs===null&&(Hs=tp(e)),Hs);var op=[],ks=({breakPoints:e,smallerThan:t},o)=>{let[n,r]=(0,ot.useState)(t?!1:"lg"),s=(0,ot.useRef)(document.body),i=(0,ot.useRef)(e?Ns(e):ol()),a=(0,ot.useRef)("lg"),l=(0,ot.useCallback)(d=>{if(i.current){for(let[m,u]of i.current)if(d>=u)return m}},[i]),c=(0,ot.useCallback)(d=>{if(t){let m=i.current.find(([u])=>u===t);if(m){let[,,u]=m;return d<u}}else return l(d);return d},[t,l]);return Qo(o||s,i.current?["width"]:op,({width:d})=>{let m=c(d);m!==a.current&&(a.current=m,r(m))},!0),(0,ot.useEffect)(()=>{let d=o||s;if(d.current){let m=a.current;if(i.current){let{clientWidth:u}=d.current,p=c(u);a.current=p,p!==m&&r(p)}}},[r,c,o]),n};var nl="data-collapsible",np={[nl]:!0,"data-pad-start":!0,"data-pad-end":!0},rl=e=>{var t;return(t=np[e])!=null?t:!1},rp=e=>e===nl,sp={dynamic:"dynamic",instant:"instant",true:"instant"},ip=e=>{var t;return(t=sp[e])!=null?t:"none"},ap=e=>Object.keys(e).reduce((t,o)=>{let[n,r]=t;if(rl(o)){let s=rp(o)?ip(e[o]):e[o];n[o]=s,r[o]=void 0}return t},[{},{}]);var sl=require("@vuu-ui/vuu-utils"),Ke=require("react");var lp=["xs","sm","md","lg","xl"],cp=12,il=({children:e,cols:t,style:o})=>{let n=(0,Ke.useRef)(null),r=(0,Ke.useRef)(null),s=(0,Ke.useRef)(),i=t!=null?t:cp,l=(o==null?void 0:o.flexDirection)==="column"?"height":"width",c=(0,Ke.useMemo)(()=>Array.isArray(e)?e:(0,Ke.isValidElement)(e)?[e]:[],[e]),d=(0,Ke.useCallback)((m,u)=>{let p=_n(m,u,lp),f=[],g=[];for(let h=0;h<m.length;h++){let b=m[h],{style:{flex:x,...I}}=b.props;f.push((0,Ke.cloneElement)(b,{key:(0,sl.getUniqueId)(),style:{...I,"--parent-col-count":i}})),g.push(p[h])}return[f,g]},[i]);return(0,Ke.useMemo)(()=>{let[m,u]=d(c,l);r.current=u,s.current=m},[d,c,l]),{cols:i,content:s.current,rootRef:n}};var cl=require("react/jsx-runtime"),qn="hwFluidGrid",Qn=(0,Jn.forwardRef)(function(t,o){let{breakPoints:n,children:r,column:s,cols:i=12,className:a,flexFill:l,gap:c=3,fullPage:d,id:m,onSplitterMoved:u,resizeable:p,row:f,showGrid:g,spacing:h,splitterSize:b,style:x,...I}=t,y=(0,Jn.useMemo)(()=>Kt(r),[r]),{cols:S,content:E,rootRef:v}=il({children:y,cols:i,style:x}),D=ks({breakPoints:n},v),P=(0,ll.default)(qn,a,{[`${qn}-column`]:s,[`${qn}-row`]:f,[`${qn}-show-grid`]:g,"flex-fill":l,"full-page":d}),A={...x,"--spacing":h,"--grid-col-count":S,"--grid-gap":c};return(0,cl.jsx)("div",{...I,className:P,"data-breakpoint":D,"data-cols":S,"data-resizeable":p||void 0,id:m,ref:(0,al.useForkRef)(v,o),style:A,children:E})});Qn.displayName="FluidGrid";var ul=require("react/jsx-runtime"),As=function(t){return(0,ul.jsx)(Qn,{...t})};As.displayName="FluidGrid";fe("FluidGrid",As,"container");var bo=require("react"),pp=require("react/jsx-runtime"),up={isDragSource:!1,isDropTarget:!1,register:()=>{}},dp=()=>console.log("have you forgotten to provide a DragDrop Provider ?"),mp=(0,bo.createContext)({registerDragDropParty:dp});var dl=e=>{var r,s;let{dragSources:t,dropTargets:o,registerDragDropParty:n}=(0,bo.useContext)(mp);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 up};var be=require("react");var nt=require("react");var fp=["left","right"],gp=["top","bottom"],er=":not(.wrapped)",ml=':not([aria-hidden="true"])',pl=e=>{let t=e.cloneNode(!0);return t.removeAttribute("id"),t.dataset.index="-1",t},hp=(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,d]=t==="width"?fp:gp,m=a&&!o?0:parseInt(l.getPropertyValue(`margin-${c}`),10),u=i&&!o?0:parseInt(l.getPropertyValue(`margin-${d}`),10),p=r;if(parseInt(l.getPropertyValue("flex-shrink"),10)>0){let g=parseInt(l.getPropertyValue("flex-basis"),10);!isNaN(g)&&g>0&&(p=g)}return[s,m+p+u]},bp={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"}},je=e=>bp[e],fl=(e,t)=>{let o=e.find(n=>n.id===t);if(o)return o},gl=(e,t)=>{e.splice(t,1);for(let o=t;o<e.length;o++)e[o].currentIndex-=1},yo=(e,t,o,n,r)=>{var m;let s=[],{DIMENSION:i}=je(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,d=typeof(n==null?void 0:n.to)=="number"?Math.min(n.to+2,l-1):l-1;for(let u=c;u<=d;u++){let p=a[u],[f,g]=hp(p,i),h=u===l-1,b=p.id,x=parseInt((m=p.dataset.index)!=null?m:"-1");s.push({currentIndex:u,dataIndex:isNaN(x)?-1:x,id:b,index:u,isDraggedItem:r===b,isLast:h,isOverflowIndicator:p.dataset.index==="overflow",element:p,start:f,end:f+g,size:g,mid:f+g/2})}return s},xo=(e,t=!1)=>{let o=e.findIndex(r=>r.isDraggedItem),{index:n}=e[o];if(t){let r=e.filter(i=>!i.isDraggedItem).reduce((i,a)=>Math.min(i,a.index),Number.MAX_SAFE_INTEGER);if(r>0&&!(n===0&&r===1))return r+o}return o},Os=(e,t)=>{let o=xo(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},d=r.start,m=r.end+i,u={...s,start:d,mid:Math.floor(d+(m-d)/2),end:m};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},d=r.start-i,m=r.end,u={...s,start:d,mid:Math.floor(d+(m-d)/2),end:m};e.splice(n,2,c,u)}},Eo=(e,t,o)=>{let n=e.length,r=xo(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 hl(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 bl=require("@salt-ds/core"),yl=X(require("classnames")),tr=require("react"),xl=require("@vuu-ui/vuu-popups");var zs=require("react/jsx-runtime"),yp=e=>e.split(" ").map(t=>`vuuDraggable-${t}`),or=(0,tr.forwardRef)(function({wrapperClassName:t,element:o,onTransitionEnd:n,style:r,scale:s=1},i){let a=(0,tr.useCallback)(c=>{c&&(c.innerHTML="",c.appendChild(o),s!==1&&(c.style.transform=`scale(${s},${s})`))},[o,s]),l=(0,bl.useForkRef)(i,a);return(0,zs.jsx)(xl.Portal,{children:(0,zs.jsx)("div",{className:(0,yl.default)("vuuDraggable",...yp(t)),ref:l,onTransitionEnd:n,style:r})})}),Fs=e=>{let t=document.createElement("div");return t.className="vuuDraggable-spacer",e&&t.addEventListener("transitionend",()=>{e.current=!1}),t},El=()=>{let e=document.createElement("div");return e.className="vuuDraggable-dropIndicatorPosition",e},Il=e=>{let t=document.createElement("div");return t.className="vuuDraggable-dropIndicator",e&&t.addEventListener("transitionend",()=>{e.current=!1}),t};var Sl=()=>{let e=(0,nt.useRef)(0),t=(0,nt.useRef)(!1),o=(0,nt.useMemo)(()=>[Fs(t),Fs()],[]),n=(0,nt.useCallback)(()=>o.forEach(l=>l.remove()),[o]),r=(0,nt.useCallback)((l,c="width")=>{let[d,m]=o;e.current=requestAnimationFrame(()=>{t.current=!0,d.style.cssText=`${c}: 0px`,m.style.cssText=`${c}: ${l}px`,o[0]=m,o[1]=d})},[o]),s=(0,nt.useCallback)(()=>{e.current&&(cancelAnimationFrame(e.current),e.current=0)},[]),i=(0,nt.useCallback)((l,c,d,m=!1,u="static",p="horizontal")=>{if(c){let f=p==="horizontal"?"width":"height",[g,h]=o;if(s(),m)t.current?(n(),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),r(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"&&Os(l,u)}},[r,s,n,o]),a=(0,nt.useCallback)((l,c,d,m=!1,u="static",p="horizontal")=>{let f=p==="horizontal"?"width":"height",[g,h]=o;s(),m?(t.current?(n(),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),r(d,f)):(g.style.cssText=`${f}: ${d}px`,c.element.after(g)),u!=="static"&&Os(l,u)},[r,s,n,o]);return{displaceItem:i,displaceLastItem:a,clearSpacers:n}};var Tl=({draggableRef:e,onDrop:t,orientation:o="horizontal",containerRef:n,itemQuery:r="*",selected:s,viewportRange:i})=>{let a=(0,be.useRef)(),l=(0,be.useRef)(!1),c=(0,be.useRef)(-1),d=(0,be.useRef)([]),m=(0,be.useRef)(!1),[u,p]=(0,be.useState)(!1),{clearSpacers:f,displaceItem:g,displaceLastItem:h}=Sl(),b=(0,be.useRef)(),x=`:is(${r}${er}${ml},.vuuOverflowContainer-OverflowIndicator)`,I=T=>d.current.findIndex(R=>R.id===T.id),y=(0,be.useRef)();y.current=i;let S=(0,be.useCallback)(()=>{f()},[f]),E=(0,be.useCallback)((T,R,L)=>{let{current:H}=n,{current:N}=b;if(H&&N){d.current=yo(H,o,x,y.current),T==="fwd"?d.current.push(N):d.current.unshift(N);let{size:w}=N,O=c.current+w/2,{current:k}=d,z=Eo(k,O,"fwd");if(z){let Z=I(z),V=k[Z];L&&T==="fwd"?h(k,k[k.length-1],w,!1,"static",o):g(k,V,w,!0,"static",o)}}},[n,g,h,x,o]),v=(0,be.useCallback)(T=>{let L=T.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:N,CLIENT_SIZE:w}=je(o),{id:M}=L,{[N]:O,[w]:k}=H;l.current=O>k;let z=d.current=yo(H,o,x,i,M),K=xo(z),Z=z[K];if(Z&&H){b.current=Z;let V=Z.isLast?h:g;console.log({indexOfDraggedItem:K,draggedItem:Z}),V(z,Z,Z.size,!1,"static",o)}}},[n,g,h,x,r,o,s,i]),[D,P]=(0,be.useMemo)(()=>{let T=!1;return[H=>{if(!T){T=!0;let N=H.element.querySelector(".vuuPopupMenu");if(N){let w=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});N.dispatchEvent(w)}}},H=>{if(T){T=!1;let N=H.element.querySelector(".vuuPopupMenu");if(N){let w=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});N.dispatchEvent(w)}}}]},[]),A=(0,be.useCallback)((T,R)=>{let{current:L}=b;if(L&&e.current&&n.current){c.current=T;let{current:H}=d,N=Eo(H,T,R);if(N&&!N.isDraggedItem)if(N.isOverflowIndicator)p(m.current=!0),D(N);else{let{size:w}=L;(I(N)===H.length-1?h:g)(H,N,w,!0,R,o);let k=H.at(-1);P(k),p(m.current=!1)}a.current=R}},[n,g,h,e,P,o,D]),C=(0,be.useCallback)(()=>{var H;f();let{current:T}=d,R=xo(T),L=T[R];if(L)if(a.current=void 0,m.current)t(L.index,-1);else{let N=xo(T,!0);t(L.index,N)}if(p(!1),n.current){let N=(H=n.current)==null?void 0:H.scrollTop;R<T.length&&(n.current.scrollTop=N)}},[f,n,t]);return{beginDrag:v,drag:A,drop:C,handleScrollStart:S,handleScrollStop:E,revealOverflowedItems:u}};var de=require("react");var en=require("react");var vl=()=>{let e=(0,en.useMemo)(()=>El(),[]),t=(0,en.useCallback)(()=>e.remove(),[e]);return{positionDropIndicator:(0,en.useCallback)((n,r="end")=>(r==="end"?n.element.after(e):n.element.before(e),e),[e]),clearSpacer:t}};var Dl=require("react/jsx-runtime"),xp=':not([data-overflowed="true"])',Ep=':not([aria-hidden="true"])',wl=({draggableRef:e,onDrop:t,orientation:o="horizontal",containerRef:n,itemQuery:r="*",selected:s,viewportRange:i})=>{let a=(0,de.useRef)(),l=(0,de.useRef)(null),c=(0,de.useRef)(null),d=(0,de.useRef)(""),m=(0,de.useRef)(!1),u=(0,de.useRef)(-1),p=(0,de.useRef)([]),f=(0,de.useRef)(!1),[g,h]=(0,de.useState)(!1),[b,x]=(0,de.useState)(),{clearSpacer:I,positionDropIndicator:y}=vl(),S=(0,de.useRef)(),E=`:is(${r}${xp}${Ep},[data-overflow-indicator])`,v=H=>p.current.findIndex(N=>N.id===H.id),D=(H,N,w)=>{H.start+=N,H.mid+=N,H.end+=N,typeof w=="number"&&(H.currentIndex+=w)},P=(0,de.useRef)();P.current=i;let A=(0,de.useCallback)(()=>{I()},[I]),C=(0,de.useCallback)((H,N,w)=>{let{current:M}=n,{current:O}=S;if(M&&O){p.current=yo(M,o,E,P.current);let{size:k}=O,K=u.current+k/2,{current:Z}=p,V=Eo(Z,K,"fwd");V&&y(w&&H==="fwd"?Z[Z.length-1]:V,"start")}},[n,y,E,o]),T=(0,de.useCallback)(H=>{let w=H.target.closest(r);w.ariaSelected&&Array.isArray(s)&&s.length>1&&console.log("its a selected element, and we have a multi select");let{current:M}=n;if(M&&w){let{SCROLL_SIZE:O,CLIENT_SIZE:k}=je(o),{id:z}=w,{[O]:K,[k]:Z}=M;m.current=K>Z;let V=p.current=yo(M,o,E,i),Y=fl(V,z);if(Y&&M){let F=v(Y);gl(V,F),S.current=Y;let{current:B}=P;if(B!=null&&B.atEnd)for(let Q=0;Q<V.length;Q++)D(V[Q],Y.size);for(let Q=F;Q<V.length;Q++)D(V[Q],-Y.size,-1);let[J,ee]=Y.isLast?[V[V.length-1],"end"]:[V[F],"start"];c.current=J,d.current=ee;let pe=y(J,ee),{top:j,left:q,width:te}=pe.getBoundingClientRect(),ne={top:Y.isLast?B!=null&&B.atEnd&&!B.atStart?j+Y.size-2:j-2:j-Y.size-2,left:q,width:te,height:2};x((0,Dl.jsx)(or,{wrapperClassName:"dropIndicatorContainer",style:ne,ref:l,element:Il()}))}}},[r,s,n,o,E,i,y]),R=(0,de.useCallback)((H,N)=>{let{current:w}=c,{current:M}=S;if(M&&e.current&&n.current){let O=o==="horizontal"?"left":"top";u.current=H;let{current:k}=p,z=Eo(k,H,N);if(z&&z.index!==(w==null?void 0:w.index)){if(z.isOverflowIndicator)h(f.current=!0);else if(l.current){if(v(z)===k.length-1){let Z=k[k.length-1],Y=y(Z,"start").getBoundingClientRect();l.current.style[O]=`${Y.top}px`}else{let V=y(z,"start").getBoundingClientRect();l.current.style[O]=`${V.top}px`}h(f.current=!1)}c.current=z,a.current=N}}},[e,n,o,y]),L=(0,de.useCallback)(()=>{I();let{current:H}=S,{current:N}=c,{current:w}=d,{current:M}=P;if(H&&M&&N){let{index:O}=H,k=w==="start",{index:z,currentIndex:K}=N;c.current=null,a.current=void 0,f.current?t(O,-1):O<z?t(O,k?K:K+1):t(O,k?z:z+1),x(void 0)}h(!1)},[I,t]);return{beginDrag:T,drag:R,drop:L,dropIndicator:b,handleScrollStart:A,handleScrollStop:C,revealOverflowedItems:g}};var se=require("react");var Ct=require("react");var Rl=({containerRef:e,onScrollingStopped:t,orientation:o="vertical"})=>{let n=(0,Ct.useRef)(null),r=(0,Ct.useRef)(!1),s=(0,Ct.useRef)(0),i=(0,Ct.useRef)("fwd"),a=(0,Ct.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,Ct.useCallback)((c,d,m=30)=>{let{current:u}=e;if(u){let{SCROLL_POS:p,SCROLL_SIZE:f,CLIENT_SIZE:g}=je(o),{[p]:h,[f]:b,[g]:x}=u,I=c==="fwd"?b-x-h:h,y=Math.min(I,m);c==="fwd"?(i.current="fwd",u[p]=s.current=h+y):(i.current="bwd",u[p]=s.current=h-y),y===I?a(!0):(r.current=!0,n.current=window.setTimeout(()=>{l(c,d,m)},100))}},[e,o,a]);return{isScrolling:r,startScrolling:l,stopScrolling:a}};var Ml=require("react/jsx-runtime"),Ip={beginDrag:()=>{},drag:()=>{},draggableRef:{current:null},drop:()=>{},isDragging:!1,isScrolling:!1,handleScrollStart:()=>{},handleScrollStop:()=>{},revealOverflowedItems:!1},Ll={start:0,end:1e3,contraStart:0,contraEnd:1e3},Sp=()=>Ip,Tp=3,vp=(e,t)=>e.closest(t),wp=e=>e.dataset.index==="overflow"&&e.parentElement!==null&&e.parentElement.classList.contains("overflowed"),Dp=(e,t)=>{let o=`:is(${t}${er},.vuuOverflowContainer-OverflowIndicator)`,r=Array.from(e.querySelectorAll(o)).pop();return[r,wp(r)]},nr=({allowDragDrop:e,containerRef:t,draggableClassName:o,itemQuery:n="*",onDragStart:r,onDrop:s,onDropSettle:i,orientation:a,...l})=>{let c=(0,se.useRef)({start:0,end:0,contraStart:0,contraEnd:0}),[d,m]=(0,se.useState)({draggable:void 0,draggedItemIndex:-1,isDragging:!1}),u=(0,se.useRef)(null),p=(0,se.useRef)(),f=(0,se.useRef)(null),g=(0,se.useRef)(!1),h=(0,se.useRef)({x:0,y:0}),b=(0,se.useRef)({x:0,y:0}),x=(0,se.useRef)({x:0,y:0}),I=(0,se.useRef)(null),y=(0,se.useRef)(-1),S=(0,se.useRef)(-1),E=(0,se.useRef)(),{isDragSource:v,isDropTarget:D,register:P}=dl(l.id);l.id&&(v||D)&&P(l.id);let A=(0,se.useCallback)(()=>{var te;let{current:j}=S,q=(te=t.current)==null?void 0:te.querySelector(`${n}[data-index="${j}"]`);q&&q.classList.remove("vuuDropTarget-settling"),S.current=-1,i==null||i(j),m(ne=>({...ne,draggable:void 0}))},[t,n,i]),C=(0,se.useCallback)(j=>{if(t.current){let{POS:q,SCROLL_POS:te,SCROLL_SIZE:ne,CLIENT_SIZE:Q}=je(a),{[te]:re,[ne]:ve,[Q]:we}=t.current,ze=ve-we,Fe=re<ze,_e=c.current.end,We=re>0&&j-h.current[q]<=c.current.start,Ge=Fe&&j-h.current[q]>=_e;return We?"bwd":Ge?"fwd":""}},[t,a]),T=e===!0||e==="natural-movement"?Tl:e==="drop-indicator"?wl:Sp,R=(0,se.useCallback)((j,q,te)=>{var ne;(ne=E.current)==null||ne.call(E,j,q,te)},[]),{isScrolling:L,startScrolling:H,stopScrolling:N}=Rl({containerRef:t,onScrollingStopped:R,orientation:a}),w=(0,se.useCallback)((j,q)=>{y.current=q,s==null||s(j,q),S.current=q},[s]),{beginDrag:M,drag:O,drop:k,handleScrollStart:z,handleScrollStop:K,...Z}=T({...l,containerRef:t,draggableRef:u,isDragSource:v,isDropTarget:D,itemQuery:n,onDrop:w,orientation:a});E.current=K;let V=(0,se.useCallback)(j=>{let{CLIENT_POS:q,CONTRA_CLIENT_POS:te,CONTRA_POS:ne,POS:Q}=je(a),{clientX:re,clientY:ve}=j,{[q]:we,[te]:ze}=j,Fe=b.current[Q],_e=b.current[ne],We=Math.abs(Fe-we);if((v?Math.abs(_e-ze):0)-We>5&&(c.current=Ll),b.current.x=re,b.current.y=ve,c.current===Ll&&u.current){let _=b.current.x-h.current.x,W=b.current.y-h.current.y;u.current.style.top=`${W}px`,u.current.style.left=`${_}px`}else if(We>0&&u.current){let _=Fe<we?"fwd":"bwd",W=C(we),oe=b.current[Q]-h.current[Q];if(W&&g.current&&!L.current?(z(),H(W,1)):!W&&L.current&&N(),!L.current){let ae=Math.round(Math.max(c.current.start,Math.min(c.current.end,oe))),xe=a==="horizontal"?"left":"top";u.current.style[xe]=`${ae}px`,O(ae,_)}}},[O,u,C,z,v,L,a,H,N]),Y=(0,se.useCallback)(()=>{document.removeEventListener("mousemove",V,!1),document.removeEventListener("mouseup",Y,!1),I.current=u.current,k(),m(j=>({...j,draggedItemIndex:-1,isDragging:!1})),p.current=void 0},[V,u,k]),F=(0,se.useCallback)(j=>{let{clientX:q,clientY:te,target:ne}=j,Q=vp(ne,n),{current:re}=t;if(re&&Q){let{CONTRA:ve,CONTRA_END:we,DIMENSION:ze,END:Fe,SCROLL_SIZE:_e,CLIENT_SIZE:We,START:Ge}=je(a);p.current=Q;let{[_e]:_,[We]:W}=re;g.current=_>W;let[oe,ae]=Dp(re,n),xe=re.getBoundingClientRect(),at=Q.getBoundingClientRect(),lt=at[ze],{[Ge]:St,[Fe]:Bt}=oe.getBoundingClientRect();h.current.x=q-at.left,h.current.y=te-at.top,c.current.start=xe[Ge],c.current.end=ae?Math.max(St,xe.right-lt):g.current?xe[Ge]+xe[ze]-lt:Bt-lt,c.current.contraStart=xe[ve],c.current.contraEnd=xe[we],M(j);let{dataset:{index:gt="-1"}}=Q;m({isDragging:!0,draggable:(0,Ml.jsx)(or,{element:pl(Q),onTransitionEnd:A,ref:u,style:hl(at,xe),wrapperClassName:o}),draggedItemIndex:parseInt(gt)}),r==null||r(),document.addEventListener("mousemove",V,!1),document.addEventListener("mouseup",Y,!1)}},[M,t,V,Y,o,u,n,r,a,A]),B=(0,se.useCallback)(j=>{let{CLIENT_POS:q,POS:te}=je(a),{[q]:ne}=j;Math.abs(ne-x.current[te])>Tp&&t.current&&(f.current&&(window.clearTimeout(f.current),f.current=null),document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",J,!1),F(j))},[t,M,a]),J=(0,se.useCallback)(()=>{f.current&&(window.clearTimeout(f.current),f.current=null),document.removeEventListener("mousemove",B,!1),document.removeEventListener("mouseup",J,!1)},[B]),ee=(0,se.useCallback)(j=>{let{current:q}=t;if(q&&!j.defaultPrevented){let{clientX:te,clientY:ne}=j;b.current.x=x.current.x=te,b.current.y=x.current.y=ne,document.addEventListener("mousemove",B,!1),document.addEventListener("mouseup",J,!1),j.persist(),f.current=window.setTimeout(()=>{document.removeEventListener("mousemove",B,!1),document.removeEventListener("mouseup",J,!1),F(j.nativeEvent)},500)}},[t,F,B,J]),{current:pe}=I;return(0,se.useLayoutEffect)(()=>{if(pe&&t.current){let j=y.current,q=t.current.querySelector(`${n}[data-index="${j}"]`);q?(q.classList.add("vuuDropTarget-settling"),requestAnimationFrame(()=>{let{top:te,left:ne}=q.getBoundingClientRect(),{top:Q,left:re}=pe.getBoundingClientRect();re!==ne||Q!==te?(pe.classList.add("vuuDraggable-settling"),pe.style.top=`${te}px`,pe.style.left=`${ne}px`):A()})):console.log(`dont have the dropped item (at ${j})`),I.current=null}},[t,n,pe,A]),{...Z,...d,isScrolling:L,onMouseDown:e?ee:void 0}};var Pl=X(require("classnames")),rt=require("react"),tn=require("@salt-ds/core");var $s=require("react/jsx-runtime"),Bs="vuuEditableLabel",rr=(0,rt.forwardRef)(function({className:t,defaultEditing:o,defaultValue:n,editing:r,onChange:s,onEnterEditMode:i,onExitEditMode:a,value:l,...c},d){let m=(0,rt.useRef)(null),u=(0,rt.useRef)(!1),[p,f]=(0,tn.useControlled)({controlled:l,default:n!=null?n:"",name:"EditableLabel",state:"value"}),[g,h]=(0,tn.useControlled)({controlled:r,default:o!=null?o:!1,name:"EditableLabel",state:"editing"}),b=(0,rt.useCallback)(A=>{h(u.current=A)},[]),x=(0,rt.useRef)(p);(0,rt.useLayoutEffect)(()=>{g&&m.current!==null&&(m.current.select(),m.current.focus())},[g,m]);let I=(0,rt.useCallback)(()=>{b(!0),i&&i()},[i,b]),y=({cancelEdit:A=!1,allowDeactivation:C=!1}={})=>{b(!1);let T=x.current;T!==p&&(A?f(T):x.current=p),a&&a(T,p,C,A)},S=A=>{let{value:C}=A.target;f(C),s&&s(C)},E=()=>{I()},v=()=>{u.current&&y({allowDeactivation:!0})},D=A=>{g&&A.key==="Enter"?(A.stopPropagation(),y()):A.key==="ArrowRight"||A.key==="ArrowLeft"?A.stopPropagation():A.key==="Escape"&&y({cancelEdit:!0})},P=(0,Pl.default)(Bs,t,{[`${Bs}-editing`]:g});return(0,$s.jsx)("div",{...c,className:P,onDoubleClick:E,"data-text":p,ref:d,children:g?(0,$s.jsx)(tn.Input,{inputProps:{className:`${Bs}-input`},value:p,onBlur:v,onChange:S,onKeyDown:D,inputRef:m,style:{padding:0},textAlign:"left",variant:"secondary"}):p})});var Cl=require("@salt-ds/core");var Rp=/[.*+?^${}()|[\]\\]/g;function sr(e){return e.replace(Rp,"\\$&")}var Io=require("react/jsx-runtime"),Lp=(0,Cl.makePrefixer)("saltHighlighter"),Hl=e=>{let{matchPattern:t,text:o=""}=e,n=typeof t=="string"?new RegExp(`(${sr(t)})`,"gi"):t;return n===void 0?(0,Io.jsx)(Io.Fragment,{children:o}):(0,Io.jsx)("span",{children:o.split(n).map((r,s)=>r.match(n)?(0,Io.jsx)("strong",{className:Lp("highlight"),children:r},`${s}-${r}`):r)})};var Ks=require("react"),Vs=X(require("classnames"));var kl=X(require("classnames"));var Ol=require("react/jsx-runtime"),Nl="vuuCheckboxIcon",Al=({checked:e=!1,...t})=>(0,Ol.jsx)("span",{...t,className:(0,kl.default)(Nl,{[`${Nl}-checked`]:e})});var Yt=require("react/jsx-runtime"),on="vuuListItem",ir=(0,Ks.forwardRef)(function(t,o){return(0,Yt.jsx)("div",{"aria-hidden":!0,className:(0,Vs.default)(on,`${on}-proxy`),ref:o})}),ar=(0,Ks.forwardRef)(function({children:t,className:o,disabled:n,tabIndex:r,item:s,itemHeight:i,itemTextHighlightPattern:a,label:l,selectable:c,selected:d,showCheckbox:m,style:u,...p},f){let g=(0,Vs.default)(on,o,{vuuDisabled:n,[`${on}-checkbox`]:m}),h=i!==void 0?{...u,height:i}:u;return(0,Yt.jsxs)("div",{className:g,...p,"aria-disabled":n||void 0,"aria-selected":d||void 0,ref:f,style:h,children:[m&&(0,Yt.jsx)(Al,{"aria-hidden":!0,checked:d}),t&&typeof t!="string"?t:a==null?(0,Yt.jsx)("span",{className:`${on}-textWrapper`,children:l||t}):(0,Yt.jsx)(Hl,{matchPattern:a,text:l||t})]})});var Tc=require("@salt-ds/core"),xr=X(require("classnames")),pt=require("react");var nn=require("react"),Pp=require("react/jsx-runtime"),Mp=(0,nn.createContext)(void 0);function zl(){let e=(0,nn.useContext)(Mp);if(e)return e}var Cp=e=>Object.prototype.toString.call(e)==="[object Object]";function So(e){return typeof e=="string"?e:Cp(e)?Object.prototype.hasOwnProperty.call(e,"label")?String(e.label):(console.warn(["itemToString: you've likely forgotten to set the label prop on the item object.","You can also provide your own `itemToString` implementation."].join(`
18
+ `)),""):String(e)}function Hp(e,...t){let o=new Set(e);for(let n of t)for(let r of n)o.add(r);return o}var rn="ArrowUp",sn="ArrowDown",Fl="ArrowLeft",Bl="ArrowRight",_s="Enter";var lr="Home",an="End",Ws="PageUp",cr="PageDown",$l=" ";var Np=new Set(["Enter","Delete"," "]),kp=new Set(["Tab"]),Ap=new Set(["ArrowRight","ArrowLeft"]),Kl=new Set([lr,an,Ws,cr,sn,rn]),Op=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),zp=Hp(Np,Kl,Ap,Op,kp),ur=e=>zp.has(e.key)?!1:e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey,Vl=({key:e})=>Kl.has(e);var Gs=require("react");var Fp={},Bp=e=>Array.isArray(e.childNodes),$p=e=>!0,Kp=e=>e.closest("[data-toggle],[aria-expanded]").dataset.toggle==="true",_l=({collapsibleHeaders:e,collectionHook:t,highlightedIdx:o,onToggle:n})=>{let r=(0,Gs.useCallback)(a=>{if(a.key===Bl||a.key===_s){let l=t.data[o];l&&l.expanded===!1&&l.value&&(a.preventDefault(),t.expandGroupItem(l),n==null||n(l.value))}if(a.key===Fl||a.key===_s){let l=t.data[o];l&&l.expanded&&l.value&&(a.preventDefault(),t.collapseGroupItem(l),n==null||n(l.value))}},[t.collapseGroupItem,t.data,t.expandGroupItem,o]),i={onClick:(0,Gs.useCallback)(a=>{console.log(`useCollapsibleGroups idx=${o}`);let l=t.data[o];console.log(a.target,a.currentTarget),l&&Bp(l)&&(!$p(l)||Kp(a.target))&&(a.stopPropagation(),a.preventDefault(),l.expanded===!1&&l.value?(t.expandGroupItem(l),n==null||n(l.value)):l.expanded===!0&&l.value&&(t.collapseGroupItem(l),n==null||n(l.value)))},[t.collapseGroupItem,t.data,t.expandGroupItem,o]),onKeyDown:r};return e?i:Fp};function Vp(e){if(e){let t=e.dataset.idx;if(t)return parseInt(t,10);if(t=e.ariaPosInSet)return parseInt(t,10)-1}return-1}var _p=e=>e.closest("[data-idx],[aria-posinset]");var Wl=e=>Vp(_p(e));var Gl=e=>e==="none",To=e=>Array.isArray(e)?e.length>0:e!=null,Ul=e=>Array.isArray(e)?e[0]:e;var ie=require("react");var vo=require("react");var Zl=e=>null;var Xl=e=>null;var Us=(e,t)=>e!==null&&Object.prototype.hasOwnProperty.call(e,t),Zs=e=>Us(e,"header"),jl=e=>Us(e,"childNodes"),ln=(e,t)=>e&&Object.prototype.hasOwnProperty.call(e.props,t),Yl=e=>{if((0,vo.isValidElement)(e)){if(ln(e,"disabled"))return e.props.disabled===!0}else if(Us(e,"disabled"))return e.disabled===!0;return!1},ql=e=>(0,vo.isValidElement)(e)&&ln(e,"focusable")?e.props.focusable:!0,Jl=(e,t,o)=>{if(e.childNodes)return e.childNodes.length;if(e.header){let n=o+1,r=0;for(;n<t.length&&!t[n].header;)r++,n++;return r}else return 0},Wp=e=>{if(typeof e.props.children=="string")return e.props.children;if(e.props.title)return e.props.title;if(e.props.label)return e.props.label},Ql=e=>e.type===Xl||ln(e,"data-header"),ec=e=>e.type===Zl||ln(e,"data-group"),Gp=e=>ln(e,"selectable")?e.props.selectable===!0:!ec(e)&&!Ql(e),Up=e=>{if(ec(e)){let{props:{children:t}}=e;if(typeof t!="string")return js(t)}},Zp=(e,t)=>{let o=[];return vo.Children.forEach(e,n=>{(0,vo.isValidElement)(n)&&o.push(t(n))}),o},Xs=(e,t)=>{if(Array.isArray(e))return e.length===0&&(t!=null&&t.noChildrenLabel)?[{label:t.noChildrenLabel,value:null}]:e.map((o,n)=>{var r,s;return{childNodes:Xs(o.childNodes,t),description:o.description,expanded:o.expanded,value:o,label:(s=(r=t==null?void 0:t.itemToString)==null?void 0:r.call(t,o))!=null?s:So(o)}});if(e)throw Error("list-child-items expects source to be an array")},js=e=>{if(e)return Zp(e,t=>{let{"data-id":o,disabled:n,id:r=o,"data-expanded":s,expanded:i=s}=t.props;return{childNodes:Up(t),disabled:n,expanded:i,header:Ql(t),id:r,label:Wp(t),selectable:Gp(t),value:t}})},Xp=new Set(["/","-","."]),jp=e=>Xp.has(e),tc=(e,t)=>t.startsWith(e)&&jp(t[e.length]),Yp=new Set([".","/"]);function qp(e,t){return t.startsWith(e)?Yp.has(t.charAt(e.length)):!1}function dr(e,t,o){let n;return e.map(s=>s.id===t?{...s,...o}:qp(s.id,t)&&s.childNodes?(n=dr(s.childNodes,t,o),{...s,childNodes:n}):s)}var Jp=e=>e&&e.replace(/^\s+/g,""),Ys=e=>new RegExp(`(${sr(Jp(e))})`,"gi"),oc=(e="",t=Ys)=>(o="")=>!!o.length&&!!e.length&&o.match(t(e))!==null;function mr(e,t){return Array.isArray(e)?e.includes(t):e===t}var Qp={},pr=({children:e,id:t,label:o="",options:n=Qp,source:r})=>{var N;let{getItemId:s}=n,[,i]=(0,ie.useState)(null),a=zl(),l=(0,ie.useRef)([]),c=(0,ie.useRef)([]),d=(0,ie.useMemo)(()=>[],[]),m=(0,ie.useRef)((N=n.filterPattern)!=null?N:""),{getFilterRegex:u=Ys,noChildrenLabel:p,itemToString:f=So}=n,g=(0,ie.useCallback)(w=>n.defaultExpanded||!1,[n.defaultExpanded]),h=(0,ie.useCallback)((w,M,O=1,k="",z=[],K=[],Z=[])=>(w.forEach((V,Y,F)=>{var Q,re;let B=V.header&&n.collapsibleHeaders,J=V.childNodes&&n.collapsibleHeaders===!1,ee=!V.childNodes||V.childNodes.length===0,pe=J||ee&&!B,j=k?`${k}.${Y}`:`item-${Y}`,q=(Q=V.id)!=null?Q:s?s(Y):`${t}-${j}`,te=pe?void 0:(re=V.expanded)!=null?re:g(q),ne={...V,childNodes:void 0,count:!J&&te===void 0?0:Jl(V,F,Y),description:V.description,disabled:Yl(V.value),focusable:ql(V.value)?void 0:!1,id:q,index:M.value,expanded:te,level:O};if(z.push(ne),K.push(ne),Z.push(w[Y].value),M.value+=1,V.childNodes){let[ve]=h(V.childNodes,M,O+1,j,[],K,Z);ne.childNodes=ve}}),[z,Z,K]),[n.collapsibleHeaders,s,t,g]),b=(0,ie.useCallback)(()=>m.current?oc(m.current,u):null,[u]),x=(0,ie.useCallback)((w,M=b(),O=[],k={value:0})=>{let z=!1;for(let K of w)z&&!Zs(K)||(K.value!==null&&(M===null||M(f(K.value)))&&(O[k.value]=K,k.value+=1),z=!1,Zs(K)&&K.expanded===!1?z=!0:jl(K)&&K.expanded!==!1&&K.childNodes&&x(K.childNodes,M,O,k));return O},[b,f]),I=(0,ie.useMemo)(()=>a?d:Xs(r,{itemToString:f,noChildrenLabel:p})||js(e)||[],[a,d,r,f,p,e]),[y,S,E]=(0,ie.useMemo)(()=>a?[d,d,d]:h(I,{value:0}),[d,h,a,I]);c.current=E,(0,ie.useMemo)(()=>a?d:l.current=x(y),[d,x,y,a]);let v=(0,ie.useRef)(y),D=(0,ie.useCallback)((w="")=>{typeof w=="string"&&(m.current=w,l.current=x(y),i({}))},[y,x]),P=(0,ie.useCallback)((w,M=y)=>{let O=M.find(k=>{var z;return k.id===w||((z=k==null?void 0:k.childNodes)==null?void 0:z.length)&&tc(k.id,w)});if((O==null?void 0:O.id)===w)return S==null?void 0:S[O.index];if(O)return P(w,O.childNodes);throw Error(`useCollectionData itemById, id ${w} not found `)},[S,y]),A=(0,ie.useCallback)(w=>{let M=c.current.find(O=>(0,ie.isValidElement)(O.value)?O.label===w:O.value===w);if(M)return M;throw Error("useCollectionData toCollectionItem, item not found ")},[]),C=(0,ie.useCallback)(w=>{if(w===null)return null;if(Array.isArray(w)){let M=[];for(let O of w){let k=A(O);M.push(k)}return M}else if(w!==void 0)return A(w)},[A]),T=(0,ie.useCallback)(w=>{let M=O=>{let k=c.current.find(z=>(0,ie.isValidElement)(z.value)?z.label===O:z.value!==null&&f(z.value)===O);if(k)return k};if(w===null)return null;if(Array.isArray(w)){let O=[];for(let k of w){let z=M(k);z&&O.push(z)}return O}else if(w!==void 0)return M(w)},[f]),R=(0,ie.useCallback)(w=>{for(let M of v.current)if(w===M.value)return M.id;throw Error("useCollectionData itemToId, item not found")},[]),L=(0,ie.useCallback)(w=>{v.current=dr(v.current,w.id,{expanded:!1}),l.current=x(v.current),i({})},[x]),H=(0,ie.useCallback)(w=>{v.current=dr(v.current,w.id,{expanded:!0}),l.current=x(v.current),i({})},[x]);return a||{collapseGroupItem:L,data:l.current,expandGroupItem:H,setFilterPattern:D,itemById:P,itemToId:R,toCollectionItem:A,itemToCollectionItem:C,stringToCollectionItem:T}};var fr=require("react"),ef={scrollToIndex:e=>{},scrollToItem:e=>{},scrollTo:e=>{}},gr=({collectionHook:e,forwardedRef:t,scrollableRef:o,scrollIntoView:n})=>{let r=(0,fr.useMemo)(()=>({scrollToIndex:s=>{let i=e.data[s];i&&(n==null||n(i))},scrollToItem:s=>{let i=e.toCollectionItem(s);i&&(n==null||n(i))},scrollTo:s=>{o!=null&&o.current&&(o.current.scrollTop=s)}}),[e.data,e.toCollectionItem,n]);(0,fr.useImperativeHandle)(t,()=>o.current?r:ef,[r])};var sc=require("@salt-ds/core"),Pe=require("react");var Js=-2;function nc(e,t,o){return t===rn||t===an?o>0?o-1:o:o===null?0:o===e-1?o:o+1}var qs=(e,t)=>{let o=Ul(t);return o?e.indexOf(o):-1},tf=(e,t,o,n)=>e===an?n:e===lr?-1:t!==-1?t:o,ic=e=>{let t=document.getElementById(e.id);if(t)return t.getBoundingClientRect();throw Error(`useKeyboardNavigation.getItemRect no element found for item #${e==null?void 0:e.id}`)},of=(e,t,o,n)=>{let{top:r}=t.getBoundingClientRect(),{scrollTop:s,clientHeight:i,scrollHeight:a}=e,l=o.length-1,c=Math.min(s+i,a-i);if(c!==s&&n<l){e.scrollTo(0,c);let d=n,m;do d+=1,m=ic(o[d]);while(m.top<r&&d<l);return d}},nf=async(e,t,o,n)=>{let{top:r}=t.getBoundingClientRect(),{scrollTop:s,clientHeight:i}=e,a=Math.max(s-i,0);if(a!==s&&n>0)return e.scrollTo(0,a),new Promise(l=>{requestAnimationFrame(()=>{let c=n,d;do c-=1,d=ic(o[c]);while(d.top>r&&c>0);l(c)})})},rf=e=>!e.header&&!e.childNodes,rc=e=>rf(e)||e.expanded!==void 0,ac=({containerRef:e,defaultHighlightedIndex:t=-1,disableHighlightOnFocus:o,highlightedIndex:n,indexPositions:r,onHighlight:s,onKeyboardNavigation:i,restoreLastFocus:a,selected:l})=>{let c=(0,Pe.useRef)(-1),[,d]=(0,Pe.useState)({}),[m,u,p]=(0,sc.useControlled)({controlled:n,default:t,name:"UseKeyboardNavigation"}),f=(0,Pe.useCallback)((D,P=!1)=>{s==null||s(D),u(D),P&&(c.current=D)},[s,u]),g=(0,Pe.useCallback)(async(D,P)=>{let{id:A}=r[P],C;if(A){let T=document.getElementById(A),{current:R}=e;T&&R&&(C=D.key===cr?of(R,T,r,P):await nf(R,T,r,P))}return C!=null?C:P},[e,r]),h=(0,Pe.useCallback)((D=sn,P=D===sn?-1:r.length)=>{if(r.length===0)return-1;{let A=qs(r,l),C=tf(D,P,A,r.length),T=nc(r.length,D,C);if(T===0&&D===rn&&!rc(r[0]))return P;for(;((D===sn||D===lr)&&T<r.length||(D===rn||D===an)&&T>0)&&!rc(r[T]);)T=nc(r.length,D,T);return T}},[r,l]),b=(0,Pe.useRef)(!1),x=(0,Pe.useRef)(!1),I=D=>x.current=D,y=(0,Pe.useCallback)(D=>{if(x.current)x.current=!1;else if(b.current=!0,r.length===0)f(Js);else if(m!==-1)d({});else if(a)if(c.current!==-1)f(c.current);else{let P=qs(r,l);f(P!==-1?P:0)}else if(To(l)){let P=qs(r,l);f(P)}else o!==!0&&f(h())},[o,m,r,h,a,l,f]),S=(0,Pe.useCallback)(async D=>{let P=D.key===cr||D.key===Ws?await g(D,m):h(D.key,m);P!==m&&f(P,!0),i==null||i(D,P)},[m,h,g,i,f]),E=(0,Pe.useCallback)(D=>{r.length>0&&Vl(D)?(D.preventDefault(),D.stopPropagation(),b.current=!0,S(D)):ur(D)&&(b.current=!0)},[r,S]),v=(0,Pe.useMemo)(()=>({onBlur:D=>{let P=D.target.closest(".saltList"),A=D.relatedTarget;P&&!(P!=null&&P.contains(A))&&(b.current=!1,u(-1),a||(c.current=-1))},onFocus:y,onKeyDown:E,onMouseDownCapture:()=>{b.current=!1,I(!0)},onMouseMove:()=>{b.current&&(b.current=!1)},onMouseLeave:()=>{b.current=!1,I(!1),f(-1)}}),[y,E,a,u,f]);return{focusVisible:b.current?m:-1,controlledHighlighting:p,highlightedIndex:m,setHighlightedIndex:f,keyboardNavigation:b,listProps:v,setIgnoreFocus:I}};var cc=require("@salt-ds/core"),Ae=require("react");var sf={},af=["Enter"," "],Qs=e=>e&&e.disabled!==!0&&e.selectable!==!1,lc=(e,t)=>{var o,n;return((o=e.index)!=null?o:0)-((n=t.index)!=null?n:0)};var uc=({defaultSelected:e,disableSelection:t=!1,highlightedIdx:o,indexPositions:n,onSelect:r,onSelectionChange:s,selected:i,selectionStrategy:a,selectionKeys:l=af,tabToSelect:c})=>{let d=a==="deselectable",m=a==="multiple",u=a==="extended",p=(0,Ae.useRef)(-1),f=(0,Ae.useCallback)(T=>l.includes(T.key),[l]),g=(0,Ae.useCallback)(()=>m||u?[]:null,[m,u]),[h,b]=(0,cc.useControlled)({controlled:i,default:e!=null?e:g(),name:"UseSelection",state:"selected"}),x=(0,Ae.useCallback)(T=>Array.isArray(h)?h.includes(T):h===T,[h]),I=(0,Ae.useCallback)(T=>T,[]),y=(0,Ae.useCallback)(T=>x(T)?null:T,[x]),S=(0,Ae.useCallback)(T=>{let R=x(T)?h.filter(L=>L!==T):h.concat(T);return R.sort(lc),R},[x,h]),E=(0,Ae.useCallback)((T,R)=>{let L=R?h:[],[H]=h.slice(-1),N=H?n.indexOf(H):0,w=Math.min(T,N),M=Math.max(T,N),O=n.slice(w,M+1),k=[...new Set([...L,...O])];return k.sort(lc),k},[n,h]),v=(0,Ae.useCallback)((T,R,L,H,N)=>{let w;m?w=S(L):u?N&&!H?w=S(L):H?w=E(R,N):w=[L]:d?w=y(L):w=I(L),w!==h&&b(w),r==null||r(T,L),w!==h&&s&&s(T,w)},[m,u,d,h,r,S,E,y,I,b,s]),D=(0,Ae.useCallback)(T=>{let R=n[o];Qs(R)&&(f(T)||c&&T.key==="Tab")&&(T.key!=="Tab"&&T.preventDefault(),v(T,o,R,!1,T.ctrlKey||T.metaKey),u&&(p.current=o))},[n,o,f,c,v,u]),P=(0,Ae.useCallback)((T,R)=>{if(u&&T.shiftKey){let L=n[R];Qs(L)&&v(T,R,L,!0)}},[u,n,v]),A=(0,Ae.useCallback)(T=>{let R=n[o];!t&&Qs(R)&&(T.preventDefault(),T.stopPropagation(),v(T,o,R,T.shiftKey,T.ctrlKey||T.metaKey),u&&(p.current=o))},[t,u,o,n,v]);return{listHandlers:Gl(a)?sf:{onClick:A,onKeyDown:D,onKeyboardNavigation:P},selected:h,setSelected:b}};var qt=require("react");var dc=({disableTypeToSelect:e,highlightedIdx:t,highlightItemAtIndex:o,typeToNavigate:n,items:r,applyIncrementalSearch:s=!0})=>{let i=(0,qt.useRef)(null),a=(0,qt.useRef)(""),l=(0,qt.useRef)(-1),c=(0,qt.useCallback)(m=>{if(m||!s){let u=new RegExp(`^${a.current}`,"i"),p=r.findIndex(({label:f},g)=>g>l.current&&u.test(f));p===-1&&(p=r.findIndex(({label:f},g)=>g<=l.current&&u.test(f))),p!==-1&&o(p)}else a.current="",i.current=null,l.current=-1},[s,o,r]),d=(0,qt.useCallback)(m=>{let u=l.current!==-1;(ur(m)||u&&m.key===$l)&&n&&(m.preventDefault(),m.stopPropagation(),(l.current===-1||m.key===a.current)&&(l.current=t),i.current!==null&&(clearTimeout(i.current),i.current=null),m.key!==a.current&&(a.current+=m.key),s&&c(!0),i.current=window.setTimeout(()=>{c()},100))},[n,s,t,c]);return{onKeyDown:e?void 0:d}};var dt=require("react");var Qt=require("react");var pc=["height"],Jt=new Map,fc=(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 mc=new ResizeObserver(e=>{for(let t of e){let{target:o,borderBoxSize:n,contentBoxSize:r}=t,s=Jt.get(o);if(s){let[{blockSize:i,inlineSize:a}]=n,[{blockSize:l,inlineSize:c}]=r,{onResize:d,measurements:m}=s,u=!1;for(let[p,f]of Object.entries(m)){let g=fc(o,{height:i,width:a,contentHeight:l,contentWidth:c},p);g!==f&&(u=!0,m[p]=g)}u&&d&&d(m)}}});function eo(e,t,o,n=!1){let r=(0,Qt.useRef)(t),s=(0,Qt.useCallback)(i=>{let{width:a,height:l}=i.getBoundingClientRect(),{clientWidth:c,clientHeight:d}=i;return r.current.reduce((m,u)=>(m[u]=fc(i,{width:a,height:l,contentHeight:d,contentWidth:c},u),m),{})},[]);(0,Qt.useEffect)(()=>{let i=e.current;async function a(){Jt.set(i,{measurements:{}}),await document.fonts.ready;let l=Jt.get(i);if(l){let c=s(i);l.measurements=c,mc.observe(i),n&&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(Jt.has(i))throw Error("useResizeObserver attemping to observe same element twice");a()}return()=>{i&&Jt.has(i)&&(mc.unobserve(i),Jt.delete(i))}},[s,e]),(0,Qt.useEffect)(()=>{let i=e.current,a=Jt.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])}var yc=require("@salt-ds/core"),gc=["height"],lf=["height","scrollHeight"],cf=[],hc={containerOnly:[lf,cf],withContent:[gc,gc]},uf=e=>e?hc.containerOnly:hc.withContent,bc={current:null},df=(e,t)=>{let{transform:o="none"}=getComputedStyle(e);if(o.startsWith("matrix")){let n=o.lastIndexOf(",");return parseInt(o.slice(n+1))}else{let n=e.offsetParent;if(n===t||t===null)return e.offsetTop;{let r=e.offsetTop;for(;n!==null&&n!==t;)r+=n.offsetTop,n=n.offsetParent;return r}}},xc=({containerRef:e,contentRef:t=bc,highlightedIdx:o=-1,indexPositions:n,stickyHeaders:r=!1})=>{let s=(0,dt.useRef)(!1),i=(0,dt.useRef)({height:0,contentHeight:0}),a=(0,dt.useCallback)(g=>{s.current=!0,e.current&&(e.current.scrollTop=g),setTimeout(()=>{s.current=!1})},[]),l=(0,dt.useCallback)(()=>a(0),[a]),c=(0,dt.useCallback)(()=>{a(i.current.contentHeight-i.current.height)},[a]),d=(0,dt.useCallback)(g=>{let h=t.current||e.current;if(g.id){let b=document.getElementById(g.id);if(b&&e.current){let{height:x}=i.current,I=b.ariaExpanded&&b.firstChild?b.firstChild:b,y=r?36:0,S=df(I,h),E=I.offsetHeight,{scrollTop:v}=e.current,D=v+y,P=D+x-y;if(S+E>P||S<D){let A=S+E>P?v+(S+E)-P:S-y;a(A)}}}},[e,t,a,r]);(0,yc.useIsomorphicLayoutEffect)(()=>{let{height:g,contentHeight:h}=i.current,b=n[o];if(h>g&&b){let[x]=n,[I]=n.slice(-1);b===x?l():b===I?c():d(n[o])}},[o,n,d,c,l]);let m=(0,dt.useCallback)(({height:g,scrollHeight:h})=>{typeof g=="number"&&(i.current.height=g),typeof h=="number"&&(i.current.contentHeight=h)},[]),u=(0,dt.useCallback)(({height:g})=>{typeof g=="number"&&(i.current.contentHeight=g)},[]),[p,f]=uf(t===bc);return eo(e,p,m,!0),eo(t,f,u,!0),{isScrolling:s,scrollIntoView:d}};var me=require("react");var hr=({allowDragDrop:e=!1,collapsibleHeaders:t,collectionHook:o,containerRef:n,contentRef:r,defaultHighlightedIndex:s,defaultSelected:i,disabled:a,disableAriaActiveDescendant:l,disableHighlightOnFocus:c,disableTypeToSelect:d,highlightedIndex:m,id:u,label:p="",listHandlers:f,onHighlight:g,onKeyboardNavigation:h,onKeyDown:b,onMoveListItem:x,onSelect:I,onSelectionChange:y,restoreLastFocus:S,selected:E,selectionStrategy:v,selectionKeys:D,stickyHeaders:P,tabToSelect:A,viewportRange:C})=>{let T=(0,me.useRef)(null),R=(0,me.useRef)(E||i),L=(_,W)=>{var oe,ae;(ae=(oe=Y.listHandlers).onKeyboardNavigation)==null||ae.call(oe,_,W),h==null||h(_,W)},H=(0,me.useCallback)((_,W)=>{I&&((0,me.isValidElement)(W.value)?I(_,W.label):W.value!==null&&I(_,W.value))},[I]),N=(0,me.useCallback)((_,W)=>{y&&y(_,Array.isArray(W)?W.map(oe=>(0,me.isValidElement)(oe.value)?oe.label:oe.value):W&&((0,me.isValidElement)(W.value)?W.label:W.value))},[y]),{highlightedIndex:w,listProps:{onKeyDown:M,onMouseMove:O,...k},setHighlightedIndex:z,...K}=ac({containerRef:n,defaultHighlightedIndex:s,disableHighlightOnFocus:c,highlightedIndex:m,indexPositions:o.data,label:p,onHighlight:g,onKeyboardNavigation:L,restoreLastFocus:S,selected:R.current}),Z=_l({collapsibleHeaders:t,highlightedIdx:w,collectionHook:o}),V=(0,me.useCallback)(()=>{z(-1)},[z]),Y=uc({defaultSelected:i,highlightedIdx:w,indexPositions:o.data,label:p,onSelect:H,onSelectionChange:N,selected:E,selectionStrategy:v,selectionKeys:D,tabToSelect:A}),F=(0,me.useCallback)((_,W,oe)=>{let ae=o.data.indexOf(_);return ae===W?oe:ae<Math.min(W,oe)||ae>Math.max(W,oe)?ae:W<ae?ae-1:ae+1},[o.data]),B=(0,me.useCallback)((_,W,oe)=>Array.isArray(_)?_.map(ae=>F(ae,W,oe)):F(_,W,oe),[F]),J=(0,me.useCallback)((_,W)=>{To(Y.selected)&&(T.current=B(Y.selected,_,W)),x==null||x(_,W),z(-1)},[Y.selected,x,z,B]),ee=(0,me.useCallback)(_=>{z(_)},[z]),{setSelected:pe}=Y;(0,me.useEffect)(()=>{let{current:_}=T;if(To(_)){let W=Array.isArray(_)?_.map(oe=>o.data[oe]):o.data[_];pe(W)}},[o.data,pe]),(0,me.useEffect)(()=>{To(R.current)&&pe(Array.isArray(R.current)?[]:null)},[pe,o.data]);let{onMouseDown:j,isDragging:q,isScrolling:te,...ne}=nr({allowDragDrop:e,draggableClassName:"list-item",orientation:"vertical",containerRef:n,id:u,itemQuery:".vuuListItem",onDragStart:V,onDrop:J,onDropSettle:ee,viewportRange:C}),{onKeyDown:Q}=dc({disableTypeToSelect:d,highlightedIdx:w,highlightItemAtIndex:z,typeToNavigate:!0,items:o.data}),re=(0,me.useCallback)(_=>{var W,oe,ae;_.defaultPrevented||Q==null||Q(_),M(_),_.defaultPrevented||(oe=(W=Y.listHandlers).onKeyDown)==null||oe.call(W,_),_.defaultPrevented||(ae=Z==null?void 0:Z.onKeyDown)==null||ae.call(Z,_),_.defaultPrevented||b==null||b(_)},[Z,M,b,Y.listHandlers,Q]),{isScrolling:ve,scrollIntoView:we}=xc({containerRef:n,contentRef:r,highlightedIdx:w,indexPositions:o.data,stickyHeaders:P}),ze=ve.current||te.current,Fe=(0,me.useCallback)(_=>{if(!ze&&!a&&!q){O();let W=Wl(_.target);if(W!==-1&&W!==w){let oe=o.data[W];!oe||oe.disabled?z(-1):z(W)}}},[q,ze,a,z,O,w,o.data]),_e=()=>{var _;return w===void 0||w===-1||l||(_=o.data[w])==null?void 0:_.id};R.current=Y.selected;let We={"aria-activedescendant":_e(),onBlur:k.onBlur,onFocus:k.onFocus,onKeyDown:re,onMouseDown:j,onMouseDownCapture:k.onMouseDownCapture,onMouseLeave:k.onMouseLeave},Ge=f||{onClick:Y.listHandlers.onClick,onMouseMove:Fe};return{focusVisible:K.focusVisible,controlledHighlighting:K.controlledHighlighting,highlightedIndex:w,keyboardNavigation:K.keyboardNavigation,listHandlers:Ge,listItemHeaderHandlers:Z,listControlProps:We,scrollIntoView:we,selected:Y.selected,setHighlightedIndex:z,setIgnoreFocus:K.setIgnoreFocus,setSelected:Y.setSelected,...ne}};var Ec=require("@salt-ds/core"),to=require("react");var mf=(e,t,o=0)=>e===0?0:o===0?e*t:e-1*(t+o)+t,br=({borderless:e,displayedItemCount:t,getItemHeight:o,height:n,itemCount:r,itemGapSize:s,itemHeight:i,rootRef:a,rowHeightRef:l})=>{let[c,d]=(0,to.useState)(36),[m,u]=(0,to.useState)(),[p,f]=(0,to.useMemo)(()=>{let h=e?0:2,b=i!=null?i:c,x=mf(r,b,s);if(n!==void 0&&typeof n=="number"||typeof n=="string")return[x,n];let I=Math.min(t,r)||t;return typeof o=="function"?h+=Array(I).fill(0).reduce((S,E,v)=>S+o(v)+s,0)-s:h+=I*Number(b)+(I-1)*s,[x,h,m]},[e,m,t,o,n,r,s,i,c]);(0,Ec.useIsomorphicLayoutEffect)(()=>{if(a.current){let{clientHeight:h}=a.current;u(h)}},[a]);let g=(0,to.useCallback)(({height:h})=>{typeof h=="number"&&d(h)},[]);return eo(l,pc,g,!0),{contentHeight:p,listClientHeight:m,listItemHeight:c,listHeight:f}};var Sc=require("@salt-ds/core"),mt=require("react"),Ic=(e,t,o,n)=>{let r=Math.ceil(t/n),s=Math.floor(e/n),i=Math.ceil(s+r-1);return{atStart:s===0,atEnd:i===o-1,from:s,to:i}},yr=({containerSize:e,itemCount:t,itemGapSize:o=0,itemSize:n,onViewportScroll:r})=>{let s=(0,mt.useRef)(0),i=(0,mt.useRef)(0),a=(0,mt.useRef)(0),l=(0,mt.useMemo)(()=>Ic(a.current,e,t,n+o),[e,t,n,o]),[c,d]=(0,mt.useState)(l);return(0,Sc.useIsomorphicLayoutEffect)(()=>{d(l)},[l]),{onVerticalScroll:(0,mt.useCallback)(u=>{let p=u.target.scrollTop;if(p!==a.current){a.current=p;let f=n+o,g=Ic(p,e,t,f);(g.from!==s.current||g.to!==i.current)&&(s.current=g.from,i.current=g.to,r==null||r(g.from,g.to),d(g))}},[n,o,e,t,r]),viewportRange:c}};var Ye=require("react/jsx-runtime"),vc=require("react"),pf="No data to display",cn="vuuList",vT=(0,pt.forwardRef)(function({ListItem:t=ar,ListPlaceholder:o,allowDragDrop:n,borderless:r,children:s,className:i,collapsibleHeaders:a=!1,defaultHighlightedIndex:l,defaultSelected:c,disabled:d=!1,disableFocus:m=!1,disableTypeToSelect:u,displayedItemCount:p=10,emptyMessage:f,focusVisible:g,getItemHeight:h,getItemId:b,height:x,highlightedIndex:I,id:y,itemGapSize:S=0,itemHeight:E,itemTextHighlightPattern:v,itemToString:D=So,listHandlers:P,maxHeight:A,maxWidth:C,minHeight:T,minWidth:R,onMoveListItem:L,onSelect:H,onSelectionChange:N,onHighlight:w,restoreLastFocus:M,selected:O,selectionStrategy:k,checkable:z=k==="multiple",scrollingApiRef:K,selectionKeys:Z,showEmptyMessage:V=!1,source:Y,style:F,stickyHeaders:B,tabToSelect:J,width:ee,...pe},j){let q=Vt(y),te=(0,pt.useRef)(null),ne=(0,pt.useRef)(null),Q=(0,pt.useRef)(null),re=pr({id:q,label:"List",source:Y,children:s,options:{collapsibleHeaders:a,getItemId:b,itemToString:D}}),{listClientHeight:ve,listHeight:we,listItemHeight:ze}=br({borderless:r,displayedItemCount:p,getItemHeight:h,height:x,itemCount:re.data.length,itemGapSize:S,itemHeight:E,rootRef:te,rowHeightRef:Q}),{onVerticalScroll:Fe,viewportRange:_e}=yr({containerSize:ve!=null?ve:typeof we=="number"?we:0,itemCount:re.data.length,itemGapSize:S,itemSize:ze}),{draggable:We,draggedItemIndex:Ge,dropIndicator:_,focusVisible:W,highlightedIndex:oe,listControlProps:ae,listHandlers:xe,listItemHeaderHandlers:at,scrollIntoView:lt,selected:St}=hr({allowDragDrop:n,collapsibleHeaders:a,collectionHook:re,containerRef:te,contentRef:ne,defaultHighlightedIndex:l,defaultSelected:re.itemToCollectionItem(c),disabled:d,disableTypeToSelect:u,highlightedIndex:I,id:q,label:q,listHandlers:P,onMoveListItem:L,onSelect:H,onSelectionChange:N,onHighlight:w,restoreLastFocus:M,selected:re.itemToCollectionItem(O),selectionStrategy:k,selectionKeys:Z,stickyHeaders:B,tabToSelect:J,viewportRange:_e});gr({collectionHook:re,forwardedRef:K,scrollableRef:te,scrollIntoView:lt});let Bt=g!=null?g:W,gt=function(ue,Ne,Be,Ie){let $t=(0,vc.createElement)(t,{...at,className:(0,xr.default)(`${cn}Header`,{focusVisible:a&&Bt===ue.value}),"aria-expanded":Ie,"data-idx":a?ue.value:void 0,"data-index":a?ue.value:void 0,"data-highlighted":ue.value===oe||void 0,"data-sticky":B,"data-selectable":!1,id:Ne,key:`header-${ue.value}`,label:Be});return ue.value+=1,$t},Fo=h===void 0?()=>E:h;function td(ht,ue,Ne){var En,Di;let{disabled:Be,value:Ie,id:$t,label:yn}=ue,xn=(0,pt.isValidElement)(Ie),Bo={className:(0,xr.default)((En=Ie==null?void 0:Ie.props)==null?void 0:En.className,{vuuHighlighted:Ne.value===oe,vuuFocusVisible:Bt===Ne.value,["vuuDraggable-dragAway"]:Ge===Ne.value}),disabled:Be||d,id:$t,item:xn?void 0:(Di=ue==null?void 0:ue.value)!=null?Di:void 0,itemHeight:Fo(Ne.value),itemTextHighlightPattern:v,key:$t,"data-idx":Ne.value,"data-index":Ne.value,label:yn,role:"option",selected:mr(St,ue),showCheckbox:z};ht.push(xn?(0,pt.cloneElement)(Ie,Bo):(0,Ye.jsx)(t,{...Bo})),Ne.value+=1}let od=function(ue,Ne,Be){let{count:Ie=0,id:$t,expanded:yn,label:xn=""}=Ne[Be.value],Bo=gt(Be,$t,xn,yn),En=yn!==!1?[Bo].concat(wi(Ne,Be,Be.value+Ie)||[]):Bo;ue.push((0,Ye.jsx)("div",{role:"group",children:En},$t))},wi=(ht,ue={value:0},Ne=ht.length)=>{let Be=[];for(;ue.value<Ne;){let Ie=ht[ue.value];Ie.header?Be.push(gt(ue,Ie.id,Ie.label,Ie.expanded===!1)):Ie.childNodes?od(Be,ht,ue):td(Be,Ie,ue)}return Be};function nd(){return f||V?(0,Ye.jsx)("span",{className:`${cn}-empty-message`,children:f!=null?f:pf}):null}let rd=()=>{if(re.data.length){let ht=re.data;return wi(ht)}else nd()},sd="auto",id={"--list-item-gap":S?`${S}px`:void 0,minWidth:R,minHeight:T,width:ee!=null?ee:"100%",height:x!=null?x:"100%",maxWidth:C!=null?C:ee,maxHeight:A!=null?A:we};return(0,Ye.jsxs)("div",{"aria-multiselectable":k==="multiple"||k==="extended"||k==="extended-multi-range"||void 0,...pe,...xe,...ae,className:(0,xr.default)(cn,i,{[`${cn}-collapsible`]:a,vuuFocusVisible:oe===Js}),id:`${q}`,ref:(0,Tc.useForkRef)(te,j),role:"listbox",onScroll:Fe,style:{...F,...id},tabIndex:d||m?void 0:0,children:[(0,Ye.jsx)(ir,{ref:Q}),re.data.length===0&&o!==void 0?(0,Ye.jsx)(Ye.Fragment,{children:(0,Ye.jsx)(o,{})}):(0,Ye.jsxs)("div",{className:`${cn}-scrollingContentContainer`,ref:ne,style:{height:sd},children:[rd(),_,We]})]})});var wo=require("@salt-ds/core");function wc(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=wc(e[t]))&&(n&&(n+=" "),n+=o);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function ei(){for(var e,t,o=0,n="";o<arguments.length;)(e=arguments[o++])&&(t=wc(e))&&(n&&(n+=" "),n+=t);return n}var no=require("react");var Rc=require("react");var Er=class{constructor(t=0,o=0){this.keys=new Map,this.free=[],this.nextKeyValue=0,this.reset(t,o)}next(){return this.free.length?this.free.pop():this.nextKeyValue++}reset(t,o){this.keys.forEach((r,s)=>{(s<t||s>=o)&&(this.free.push(r),this.keys.delete(s))});let n=o-t;this.keys.size+this.free.length>n&&(this.free.length=n-this.keys.size);for(let r=t;r<o;r++)if(!this.keys.has(r)){let s=this.next();this.keys.set(r,s)}}keyFor(t){return this.keys.get(t)}};var ff=([e],[t])=>e-t,Dc=5,Lc=({data:e,listItemGapSize:t=0,listItemHeight:o,viewportRange:n})=>{let r=(0,Rc.useMemo)(()=>new Er(0,1),[]),s=o+t,i=Math.max(0,n.from-Dc),a=Math.min(e.length,n.to+Dc);return r.reset(i,a),e.slice(i,a).map((c,d)=>[r.keyFor(d+i),(d+i)*s,d+i+1,c]).sort(ff)};var oo=require("react/jsx-runtime"),gf="No data to display",Ir=(0,wo.makePrefixer)("saltList"),hf=(0,no.memo)(ar),_T=(0,no.forwardRef)(function({borderless:t,children:o,className:n,collapsibleHeaders:r=!1,defaultHighlightedIndex:s,defaultSelected:i,disabled:a=!1,disableFocus:l=!1,disableTypeToSelect:c,displayedItemCount:d=10,emptyMessage:m,getItemHeight:u,getItemId:p,height:f,highlightedIndex:g,id:h,itemGapSize:b=0,itemHeight:x,itemTextHighlightPattern:I,itemToString:y,maxHeight:S,maxWidth:E,minHeight:v,minWidth:D,onSelect:P,onSelectionChange:A,onViewportScroll:C,onHighlight:T,restoreLastFocus:R,selected:L,selectionStrategy:H,scrollingApiRef:N,selectionKeys:w,showEmptyMessage:M=!1,source:O,style:k,stickyHeaders:z,tabToSelect:K,width:Z,...V},Y){let F=(0,wo.useIdMemo)(h),B=(0,no.useRef)(null),J=(0,no.useRef)(null),ee=pr({id:F,label:"List",source:O,children:o,options:{collapsibleHeaders:r,getItemId:p,itemToString:y}}),{contentHeight:pe,listItemHeight:j,listHeight:q}=br({borderless:t,displayedItemCount:d,height:f,itemCount:ee.data.length,itemGapSize:b,itemHeight:x,rootRef:B,rowHeightRef:J}),{focusVisible:te,highlightedIndex:ne,listControlProps:Q,listHandlers:re,scrollIntoView:ve,selected:we}=hr({collapsibleHeaders:r,collectionHook:ee,containerRef:B,defaultHighlightedIndex:s,defaultSelected:ee.itemToCollectionItem(i),disabled:a,disableTypeToSelect:c,highlightedIndex:g,label:F,onSelect:P,onSelectionChange:A,onHighlight:T,restoreLastFocus:R,selected:ee.itemToCollectionItem(L),selectionStrategy:H,selectionKeys:w,stickyHeaders:z,tabToSelect:K}),{onVerticalScroll:ze,viewportRange:Fe}=yr({containerSize:typeof q=="number"?q:0,itemCount:ee.data.length,itemGapSize:b,itemSize:j});console.log({viewPortRange:Fe});let _e=Lc({data:ee.data,listItemGapSize:b,listItemHeight:j,viewportRange:Fe});gr({collectionHook:ee,forwardedRef:N,scrollableRef:B,scrollIntoView:ve});function We(ae,xe,at){let[lt,St,Bt,gt]=xe,Fo=Bt-1;ae.push((0,oo.jsx)(hf,{"aria-setsize":ee.data.length,"aria-posinset":Bt,className:ei(n,{saltHighlighted:Fo===ne,saltFocusVisible:te===Fo}),"data-idx":Fo,item:gt,label:gt.label,"data-offset":St,role:"option",selected:mr(we,gt),id:gt.id,translate3d:St},lt)),at.value+=1}function Ge(ae,xe={value:0},at=ae.length){let lt=[];for(;xe.value<at;){let St=ae[xe.value];We(lt,St,xe)}return lt}function _(){return m||M?(0,oo.jsx)("span",{className:Ir("empty-message"),children:m!=null?m:gf}):null}let W=()=>{if(_e.length)return Ge(_e);_()},oe={"--list-item-gap":b?`${b}px`:void 0,minWidth:D,minHeight:v,width:Z!=null?Z:"100%",height:f!=null?f:"100%",maxWidth:E!=null?E:Z,maxHeight:S!=null?S:q};return(0,oo.jsx)("div",{...V,...re,...Q,className:ei(Ir(),n,Ir("virtualized")),id:`${F}`,ref:(0,wo.useForkRef)(B,Y),role:"listbox",onScroll:ze,style:{...k,...oe},tabIndex:a||l?void 0:0,children:(0,oo.jsxs)("div",{className:Ir("scrollingContentContainer"),style:{height:pe},children:[(0,oo.jsx)(ir,{ref:J}),W()]})})});var _c=require("@salt-ds/core"),Wc=X(require("classnames")),Ro=X(require("react"));var Te=require("react");var Mc=e=>typeof e=="object"&&e!==null&&"tabIndex"in e&&typeof e.tabIndex=="number",Pc=e=>({label:"Close",location:"tab",action:"close-tab",options:e}),Cc=e=>({label:"Rename",location:"tab",action:"rename-tab",options:e});var bf=e=>{if(e){let t=parseInt(e.dataset.index||"");if(!isNaN(t))return t}return-1},Hc=(e,t)=>{if(e){let o=e.querySelector(`[data-index]:has(${t})`);return bf(o)}return-1},ti=e=>Hc(e,'[aria-selected="true"]'),Nc=e=>Hc(e,".vuuEditableLabel-editing");var Do=require("@vuu-ui/vuu-utils"),Et=require("react"),kc=(e,t,o="horizontal")=>{let n=(0,Et.useRef)(!1),r=(0,Et.useCallback)(()=>{n.current=!0},[]),s=(0,Et.useCallback)(()=>{n.current=!1},[]),i=(0,Et.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,Et.useRef)(-1);return(0,Et.useMemo)(()=>{var d,m;let l=0,c=0;if(a.current!==-1){let u=(d=e.current)==null?void 0:d.querySelector(".vuuTab-selected"),p=(m=e.current)==null?void 0:m.querySelector(`[data-index="${t}"] .vuuTab`),{positionProp:f,sizeProp:g}=Do.MEASURES[o];if(u&&p&&!n.current){let{[f]:h,[g]:b}=u.getBoundingClientRect(),{[f]:x}=p.getBoundingClientRect();if((0,Do.isValidNumber)(h)&&(0,Do.isValidNumber)(x)&&(0,Do.isValidNumber)(b)){console.log({orientation:o,positionProp:f,oldPosition:h,newPosition:x}),l=h-x,c=b;let y=Math.abs(l/(o==="horizontal"?1100:700));requestAnimationFrame(()=>{var S,E,v,D;(S=e.current)==null||S.style.setProperty("--tab-thumb-offset","0px"),(E=e.current)==null||E.style.setProperty("--tab-thumb-size","100%"),(v=e.current)==null||v.style.setProperty("--tab-thumb-transition",`all ${y}s ease`),(D=e.current)==null||D.addEventListener("transitionend",i)})}}}return a.current=t,n.current?{containerStyle:{"--tab-thumb-offset":"0px","--tab-thumb-size":"100%"},resumeAnimation:s,suspendAnimation:r}:{containerStyle:{"--tab-thumb-offset":`${l}px`,"--tab-thumb-size":c?`${c}px`:void 0},resumeAnimation:s,suspendAnimation:r}},[t,e,o,i,s,r])};var Oc=require("@salt-ds/core"),zc=require("@vuu-ui/vuu-utils"),ye=require("react"),Ce=require("@vuu-ui/vuu-utils");var Fc={horizontal:{[Ce.Home]:"start",[Ce.End]:"end",[Ce.ArrowLeft]:"bwd",[Ce.ArrowRight]:"fwd"},vertical:{[Ce.Home]:"start",[Ce.End]:"end",[Ce.ArrowUp]:"bwd",[Ce.ArrowDown]:"fwd"}},yf=(e,t="horizontal")=>Fc[t][e]!==void 0,xf=e=>e===Ce.ArrowDown;function Ac(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 Ef=e=>e!==null&&!e.classList.contains("wrapped"),Sr=(e,t)=>e?e.querySelector(`[data-index="${t}"]`):null,Bc=({containerRef:e,defaultHighlightedIdx:t=-1,highlightedIdx:o,keyBoardActivation:n,orientation:r,selectedIndex:s=0})=>{let i=n==="manual",a=(0,ye.useRef)(!1),l=(0,ye.useRef)(-1),[c,d]=(0,ye.useState)(!1),[,m]=(0,ye.useState)({}),[u,p]=(0,Oc.useControlled)({controlled:o,default:t,name:"UseKeyboardNavigation"}),f=(0,ye.useCallback)(T=>{p(l.current=T)},[p]),g=(0,ye.useRef)(!1),h=(0,ye.useCallback)((T,R=!1,L,H=70)=>{f(T),L===!0&&!g.current&&(g.current=!0);let N=()=>{let w=Sr(e.current,T);if(w){let M=(0,zc.getFocusableElement)(w);M==null||M.focus()}};R?N():setTimeout(N,H)},[e,f]),b=T=>{if(l.current===-1&&T.target.tabIndex!==-1){let R=Nc(e.current);R!==-1?requestAnimationFrame(()=>{f(R)}):setTimeout(()=>{l.current===-1&&s!==null&&f(s)},200)}},x=(0,ye.useCallback)(()=>{var T,R;return(R=(T=e.current)==null?void 0:T.querySelectorAll("[data-index]").length)!=null?R:0},[e]),I=(0,ye.useCallback)((T="fwd",R)=>{let L=x(),N=Ac(L,T,typeof R=="number"?R:L),w=T==="start"?"fwd":T==="end"?"bwd":T;for(;(w==="fwd"&&N<L||w==="bwd"&&N>0)&&!Ef(Sr(e.current,N));){let M=Ac(L,w,N);if(M===N)break;N=M}return N},[e,x]),y=(0,ye.useCallback)((T,R=!1)=>{let L=Fc[r][T.key],H=I(L,u);H!==u?i&&h(H,!0):R&&m({})},[u,i,I,h,r]),S=(0,ye.useCallback)(()=>{let T=Sr(e.current,u);return T?T.querySelector(".vuuPopupMenu")!=null:!1},[e,u]),E=(0,ye.useCallback)(()=>{let T=Sr(e.current,u),R=T==null?void 0:T.querySelector(".vuuPopupMenu");if(R){let L=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});R.dispatchEvent(L)}return!1},[e,u]),v=(0,ye.useCallback)(T=>{x()>0&&yf(T.key,r)?(T.preventDefault(),g.current?y(T):(g.current=!0,y(T,!0))):xf(T.key)&&S()&&E()},[E,x,S,y,r]),D=(T,R)=>{f(R)},P=(0,ye.useCallback)(()=>{c||(d(!0),a.current?a.current=!1:g.current=!0)},[c]),A=(0,ye.useCallback)(()=>{c||(a.current=!0),g.current=!1},[c]);return{containerProps:{onBlur:T=>{let R=T.target.closest(".vuuTabstrip"),L=T.relatedTarget;R&&!(R!=null&&R.contains(L))&&(f(-1),d(!1))},onMouseDownCapture:A,onFocus:P,onMouseLeave:()=>{g.current=!0,f(-1),a.current=!1}},focusVisible:g.current?u:-1,focusIsWithinComponent:c,highlightedIdx:u,focusTab:h,onClick:D,onFocus:b,onKeyDown:v,setHighlightedIdx:f}};var $c=require("@salt-ds/core"),un=require("react"),If=["Enter"," "],Sf=e=>e&&e.matches('[class*="vuuTab "]'),Kc=({defaultSelected:e,highlightedIdx:t,onSelectionChange:o,selected:n})=>{let[r,s,i]=(0,$c.useControlled)({controlled:n,default:e!=null?e:0,name:"Tabstrip",state:"value"}),a=(0,un.useCallback)(m=>If.includes(m.key),[]),l=(0,un.useCallback)(m=>{s(m),o==null||o(m)},[o,s]),c=(0,un.useCallback)(m=>{let u=m.target;a(m)&&t!==r&&Sf(u)&&(m.stopPropagation(),m.preventDefault(),l(t))},[a,t,r,l]),d=(0,un.useCallback)((m,u)=>{u!==r&&l(u)},[l,r]);return{activateTab:l,isControlled:i,onClick:d,onKeyDown:c,selected:r}};var Tf=new Set(["Enter"," "]),vf=e=>Tf.has(e),wf=(e,t)=>e?e.querySelector(`[data-index="${t}"]`):null,Vc=({activeTabIndex:e,allowDragDrop:t,animateSelectionThumb:o,containerRef:n,onActiveChange:r,onAddTab:s,onCloseTab:i,onExitEditMode:a,onMoveTab:l,orientation:c,keyBoardActivation:d})=>{let m=(0,Te.useRef)(e),{focusTab:u,highlightedIdx:p,onClick:f,onKeyDown:g,setHighlightedIdx:h,...b}=Bc({containerRef:n,keyBoardActivation:d,orientation:c,selectedIndex:m.current}),{activateTab:x,onClick:I,onKeyDown:y,selected:S}=Kc({highlightedIdx:p,onSelectionChange:r,selected:e});m.current=S;let{containerStyle:E,resumeAnimation:v,suspendAnimation:D}=kc(n,o?S:-1,c),P=(0,Te.useCallback)((F,B)=>{let{current:J}=m;console.log(`useTabstrip handleDrop ${F} - ${B} ${J}`),l==null||l(F,B);let ee=-1;B!==-1&&(J===F?ee=B:F>J&&B<=J?ee=J+1:F<J&&B>=J&&(ee=J-1),ee!==-1&&(D(),x(ee),requestAnimationFrame(v)),u(B,!1,!1,350))},[u,l,v,x,D]),{onMouseDown:A,...C}=nr({allowDragDrop:t,containerRef:n,draggableClassName:`tabstrip-${c}`,onDrop:P,orientation:"horizontal",itemQuery:".vuuOverflowContainer-item"}),T=(0,Te.useCallback)((F,B,J,ee)=>{console.log(`handleExitEditMode ${F} ${B} ${J} ${ee}`),a==null||a(F,B,J,ee),J||u(ee,!1,!0)},[u,a]),R=(0,Te.useCallback)((F,B)=>{f(F,B),I(F,B)},[f,I]),L=(0,Te.useCallback)((F=p)=>{let B=wf(n.current,F);if(B)return B.querySelector(".vuuEditableLabel")},[n,p]),H=(0,Te.useCallback)((F=p)=>{let B=L(F);return B?B.classList.contains("vuuEditableLabel-editing"):!1},[L,p]),N=(0,Te.useCallback)((F=p)=>{let B=L(F);if(B){let J=new MouseEvent("dblclick",{view:window,bubbles:!0,cancelable:!0});B.dispatchEvent(J)}},[L,p]),w=(0,Te.useCallback)(F=>{g(F),F.defaultPrevented||y(F),!F.defaultPrevented&&vf(F.key)&&N()},[N,g,y]),M=(0,Te.useCallback)(F=>{let B=ti(n.current),J=B>F?B-1:B===F?0:B;return D(),i==null||i(F,J),setTimeout(()=>{v()},200),!0},[n,i,v,D]),O=(0,Te.useCallback)(F=>(N(F),!0),[N]),k=(0,Te.useCallback)(F=>{if(Mc(F.options))switch(F.menuId){case"close-tab":return M(F.options.tabIndex);case"rename-tab":return O(F.options.tabIndex);default:console.log(`tab menu action ${F.menuId}`)}return!1},[M,O]),z=(0,Te.useCallback)(()=>{H()?h(p):u(p)},[p,u,h,H]),K=(0,Te.useCallback)(F=>{let B=parseInt(F.index);isNaN(B)||x(B)},[x]),Z={onFocus:b.onFocus,onKeyDown:w},V=(0,Te.useCallback)(()=>{s==null||s(),requestAnimationFrame(()=>{let F=ti(n.current);F!==-1&&u(F)})},[n,u,s]),Y={onClick:R,onKeyDown:w,onExitEditMode:T,onMenuAction:k,onMenuClose:z,onMouseDown:A};return{activeTabIndex:S,containerStyle:E,focusVisible:b.focusVisible,containerProps:{...b.containerProps,onSwitchWrappedItemIntoView:K},navigationProps:Z,onClickAddTab:V,tabProps:Y,...C}};var Lo=require("react/jsx-runtime"),Uc=require("react"),oi="vuuTabstrip",Gc=({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:d,onActiveChange:m,onAddTab:u,onCloseTab:p,onExitEditMode:f,onMoveTab:g,orientation:h="horizontal",showTabMenuButton:b,style:x,...I})=>{let y=(0,Ro.useRef)(null),{activeTabIndex:S,focusVisible:E,containerStyle:v,draggedItemIndex:D,onClickAddTab:P,tabProps:A,...C}=Vc({activeTabIndex:e,allowDragDrop:n,animateSelectionThumb:s,containerRef:y,keyBoardActivation:c,onActiveChange:m,onAddTab:u,onCloseTab:p,onExitEditMode:f,onMoveTab:g,orientation:h}),T=Vt(l),R=(0,Wc.default)(oi,`${oi}-${h}`,a),L=x||v?{...x,...v}:void 0,H=(0,Ro.useMemo)(()=>Kt(i).map((N,w)=>{let{id:M=`${T}-tab-${w}`,closeable:O=o,editable:k=r,showMenuButton:z=b}=N.props,K=w===S;return Ro.default.cloneElement(N,{...A,...C.navigationProps,closeable:O,"data-overflow-priority":K?"1":void 0,dragging:D===w,editable:k,focusVisible:E===w,id:M,index:w,key:w,location:d,selected:K,showMenuButton:z,tabIndex:K?0:-1})}).concat(t?(0,Uc.createElement)(_c.Button,{...C.navigationProps,"aria-label":"Create Tab",className:`${oi}-addTabButton`,"data-icon":"add","data-overflow-priority":"1",key:"addButton",onClick:P,variant:"secondary",tabIndex:-1}):[]),[S,t,o,r,i,E,T,d,P,b,A,D,C.navigationProps]);return(0,Lo.jsxs)(Lo.Fragment,{children:[(0,Lo.jsx)(ni,{...I,...C.containerProps,className:R,height:28,id:T,orientation:h,overflowIcon:"more-horiz",ref:y,style:L,children:H}),C.draggable]})};var Qc=require("@salt-ds/core"),eu=X(require("classnames")),io=require("react");var Zc=require("@vuu-ui/vuu-popups"),Xc=require("react"),jc=X(require("classnames"));var qc=require("react/jsx-runtime"),Df="vuuTabMenu",Yc=({allowClose:e,allowRename:t,location:o,onMenuAction:n,onMenuClose:r,index:s})=>{let[i,a]=(0,Xc.useMemo)(()=>[(l,c)=>{let d=[];return t&&d.push(Cc(c)),e&&d.push(Pc(c)),d},{tabIndex:s}],[e,t,s]);return(0,qc.jsx)(Zc.PopupMenu,{className:Df,menuBuilder:i,menuActionHandler:n,menuLocation:(0,jc.default)("tab",o),menuOptions:a,onMenuClose:r,tabIndex:-1})};var so=require("react/jsx-runtime"),ro="vuuTab",Jc=()=>{},tu=(0,io.forwardRef)(function({ariaControls:t,children:o,className:n,closeable:r=!1,dragging:s,editable:i=!1,editing:a,focusVisible:l,index:c=-1,label:d,location:m,onClick:u,onClose:p,onEnterEditMode:f=Jc,onExitEditMode:g=Jc,onFocus:h,onKeyUp:b,onMenuAction:x,onMenuClose:I,orientation:y,selected:S,showMenuButton:E=r||i,tabIndex:v,...D},P){if(E&&typeof x!="function")throw Error("Tab onMenuAction must be provided if showMenuButton is set");let A=(0,io.useRef)(null),C=(0,io.useRef)(null),T=(0,Qc.useForkRef)(P,A),R=(0,io.useCallback)(M=>{a||(M.preventDefault(),u==null||u(M,c))},[a,c,u]),L=(M="",O="",k=!0)=>g(M,O,k,c),H=M=>{switch(M.key){case"Backspace":case"Delete":r&&(M.stopPropagation(),p&&p(c));break;default:b&&b(M,c)}},N=()=>i?(0,so.jsx)(rr,{editing:a,defaultValue:d,onEnterEditMode:f,onExitEditMode:L,ref:C},d):d,w=M=>{if(C.current){let k=C.current.querySelector(".vuuEditableLabel-input");k==null||k.focus()}h==null||h(M)};return(0,so.jsxs)("div",{...D,"aria-controls":t,"aria-selected":S,className:(0,eu.default)(ro,{[`${ro}-closeable`]:r,"vuuDraggable-dragAway":s,[`${ro}-editing`]:a,[`${ro}-selected`]:S||void 0,[`${ro}-vertical`]:y==="vertical",vuuFocusVisible:l}),onClick:R,onFocus:w,onKeyUp:H,ref:T,role:"tab",tabIndex:v,children:[(0,so.jsx)("div",{className:`${ro}-main`,children:(0,so.jsx)("span",{className:`${ro}-text`,"data-text":i?void 0:d,children:o!=null?o:N()})}),E?(0,so.jsx)(Yc,{allowClose:r,allowRename:i,location:m,onMenuAction:x,onMenuClose:I,index:c}):null]})});var Lr=require("@salt-ds/core"),Rr=X(require("classnames")),Mr=require("react");function Rf(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 ri=e=>e.closest("[data-idx],[aria-posinset]");var ou=e=>Rf(ri(e));var Mo=require("react"),Lf=new Set(["/","-","."]),Mf=e=>Lf.has(e),nu=(e,t)=>t.startsWith(e)&&Mf(t[e.length]),ru=(e,t="root",{collapsibleHeaders:o=void 0,defaultExpanded:n=!1,revealSelected:r=!1}={})=>{let s=(u,p,f)=>{if(u.childNodes)return u.childNodes.length;if(u.header){let g=f+1,h=0;for(;g<p.length&&!p[g].header;)h++,g++;return h}else return 0},i=(0,Mo.useCallback)(u=>Array.isArray(r)?r.some(p=>nu(u,p)):n,[n,r]),a=(0,Mo.useCallback)((u,p,f=1,g="",h=[],b=[])=>{let x=0;return u.forEach((I,y,S)=>{var L;let E=I.header&&o,v=I.childNodes&&o===!1,D=!I.childNodes||I.childNodes.length===0,P=v||D&&!E,A=g?`${g}.${y}`:`${y}`,C=(L=I.id)!=null?L:`${t}-${A}`,T=P?void 0:i(C),R={...I,childNodes:void 0,id:C,count:!v&&T===void 0?0:s(I,S,y),expanded:T,index:p.index,level:f};if(h.push(R),b.push(u[y]),x+=1,p.index+=1,I.childNodes){let[H,N]=a(I.childNodes,p,f+1,A,[],b);R.childNodes=N,(T===!0||v)&&(x+=H)}}),[x,h,b]},[o,t,i]),[l,c,d]=(0,Mo.useMemo)(()=>a(e,{index:0}),[a,e]),m=(0,Mo.useCallback)((u,p=c)=>{let f=p.find(g=>{var h;return g.id===u||((h=g==null?void 0:g.childNodes)==null?void 0:h.length)&&nu(g.id,u)});if((f==null?void 0:f.id)===u)return d[f.index];if(f)return m(u,f.childNodes)},[d,c]);return[l,c,m]};var Ht=require("react"),au=require("@salt-ds/core"),su="single",Pf="checkbox",Cf="multi",Hf="extended",Nf=["Enter"," "],iu={},kf=e=>e.expanded!==void 0,lu=e=>e&&e!=="none",cu=({defaultSelected:e,highlightedIdx:t,treeNodes:o,onChange:n,selected:r,selection:s=su,selectionKeys:i=Nf})=>{let a=s===su,l=s===Cf||s.startsWith(Pf),c=s===Hf,d=(0,Ht.useRef)(-1),m=(0,Ht.useCallback)(y=>i.includes(y.key),[i]),[u,p]=(0,au.useControlled)({controlled:r,default:e!=null?e:[],name:"selected"}),f=(0,Ht.useCallback)((y,S,E,v,D=!1)=>{let{current:P}=d,A=u==null?void 0:u.includes(E),T=a||c&&!D&&(!v||P===-1),R=l||c&&D&&!v,L=[];if(T&&A)L=[];else if(T)L=[E];else if(R&&A)L=u.filter(H=>H!==E);else if(R)L=u.concat(E);else if(c){let[H,N]=S>P?[P,S]:[S,P];L=u.slice();for(let w=H;w<=N;w++){let{id:M}=o[w];u.includes(M)||L.push(M)}}p(L),n&&n(y,L)},[c,o,l,n,u,p,a]),g=(0,Ht.useCallback)(y=>{if(~t&&m(y)){y.preventDefault();let S=o[t];f(y,t,S.id,!1,y.ctrlKey||y.metaKey),c&&(d.current=t)}},[c,t,o,m,f]),h=(0,Ht.useCallback)((y,S)=>{if(c&&y.shiftKey){let E=o[S];f(y,S,E.id,!0)}},[c,o,f]),b=s==="none"?iu:{onKeyDown:g,onKeyboardNavigation:h},x=(0,Ht.useCallback)(y=>{if(t!==-1){let S=o[t];kf(S)||(y.preventDefault(),y.stopPropagation(),f(y,t,S.id,y.shiftKey,y.ctrlKey||y.metaKey),c&&(d.current=t))}},[c,t,o,f]);return{listHandlers:b,listItemHandlers:s==="none"?iu:{onClick:x},selected:u,setSelected:p}};var Oe=require("react");var Af=["height","scrollHeight"],uu=(e,t,o=!1)=>{let n=(0,Oe.useRef)(0),r=(0,Oe.useRef)(!1),s=(0,Oe.useRef)(0),i=(0,Oe.useRef)(0),a=(0,Oe.useCallback)(d=>{let m=d.ariaExpanded?d.firstChild:d,u=o?30:0,p=m.offsetTop,f=m.offsetHeight,g=n.current+u,h=g+s.current-u;(p+f>h||p<g)&&(n.current=p+f>h?n.current+(p+f)-h:p-u,r.current=!0,e.current&&(e.current.scrollTop=n.current),setTimeout(()=>{r.current=!1}))},[e,o]),l=(0,Oe.useCallback)(d=>{n.current=d.target.scrollTop},[]);(0,Oe.useEffect)(()=>{let{current:d}=e;return d&&d.addEventListener("scroll",l),()=>{d&&d.removeEventListener("scroll",l)}},[e,l]),(0,Oe.useLayoutEffect)(()=>{if(t!==-1&&i.current>s.current&&e.current){let d=e.current.querySelector(`
18
19
  [data-idx='${t}'],
19
20
  [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=`
21
+ `);d===null?console.log("[useViewportTracking], is this virtualised ? we're going to have to know rowHeight"):a(d)}},[t,e,a]),(0,Oe.useEffect)(()=>{},[o]);let c=(0,Oe.useCallback)(({height:d,scrollHeight:m})=>{s.current=d,i.current=m},[]);return eo(e,Af,c,!0),r};var dn=require("react");var qe=require("react");var du=({id:e})=>{let t=e.lastIndexOf("-");if(t!==-1){let n=e.slice(t+1).split(".");return n.length===1?null:(n.pop(),`${e.slice(0,t)}-${n.join(".")}`)}else if((t=e.lastIndexOf("/"))!==-1)return e.slice(0,t)},mu=e=>e.childNodes!==void 0;var si=e=>e.header===!0,Of=new Set([".","/"]),pu=(e,t)=>t.startsWith(e.id)?Of.has(t.charAt(e.id.length)):!1,ao=(e,t)=>{for(let o of e){if(o.id===t)return o;if(pu(o,t))return ao(o.childNodes,t)}},Tr=(e,t)=>{let o=typeof t=="string"?t:t.id;for(let n=0;n<e.length;n++)if(e[n].id===o)return n},vr=(e,t,o)=>{let n;return e.map(s=>s.id===t?{...s,...o}:pu(s,t)?(n=vr(s.childNodes,t,o),{...s,childNodes:n}):s)};var Eu=require("@salt-ds/core");function zf(e,...t){let o=new Set(e);for(let n of t)for(let r of n)o.add(r);return o}var ii="ArrowUp",fu="ArrowDown",Po="ArrowLeft";var gu="ArrowRight",wr="Enter";var Ff="Delete",Bf=new Set([wr,Ff]),$f=new Set(["Tab"]),Kf=new Set(["ArrowRight","ArrowLeft"]),hu=new Set(["Home","End","ArrowDown","ArrowUp"]),bu=new Set(["Home","End","ArrowRight","ArrowLeft"]),Vf=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),pw=zf(Bf,bu,hu,Kf,Vf,$f);var yu=({key:e},t="vertical")=>(t==="vertical"?hu:bu).has(e);function xu(e,t,o){return t===ii||t===Po?o>0?o-1:o:o===null?0:o===e-1?o:o+1}var _f=e=>!e.header&&!e.childNodes,Wf=e=>_f(e)||e.expanded!==void 0,Iu=({defaultHighlightedIdx:e=-1,highlightedIdx:t,treeNodes:o,onHighlight:n,onKeyboardNavigation:r,selected:s=[]})=>{let{bwd:i,fwd:a}=(0,qe.useMemo)(()=>({bwd:ii,fwd:fu}),[]),[l,c,d]=(0,Eu.useControlled)({controlled:t,default:e,name:"highlightedIdx"}),m=(0,qe.useCallback)(y=>{n==null||n(y),c(y)},[n,c]),u=(0,qe.useCallback)((y=a,S=y===a?-1:o.length)=>{let E=xu(o.length,y,S);for(;E!==-1&&(y===a&&E<o.length||y===i&&E>0)&&!Wf(o[E]);)E=xu(o.length,y,E);return E},[i,a,o]),p=(0,qe.useRef)(!0),f=(0,qe.useRef)(!1),g=y=>f.current=y,h=(0,qe.useCallback)(()=>{if(f.current)f.current=!1;else if(s.length>0){let y=ao(o,s[0]);if(y){let S=Tr(o,y);m(S)}}else m(u())},[o,u,s,m]),b=(0,qe.useCallback)(y=>{let S=u(y.key,l);S!==l&&(m(S),r==null||r(y,S))},[l,u,r,m]),x=(0,qe.useCallback)(y=>{o.length>0&&yu(y,"vertical")&&(y.preventDefault(),y.stopPropagation(),p.current=!0,b(y))},[o,b]),I=(0,qe.useMemo)(()=>({onBlur:()=>{m(-1)},onFocus:h,onKeyDown:x,onMouseDownCapture:()=>{p.current=!1,g(!0)},onMouseMove:()=>{p.current&&(p.current=!1)},onMouseLeave:()=>{p.current=!0,g(!1),m(-1)}}),[h,x,m]);return{focusVisible:p.current?l:-1,controlledHighlighting:d,highlightedIdx:l,hiliteItemAtIndex:m,keyBoardNavigation:p,listProps:I,setIgnoreFocus:g}};var Co=require("react");var Dr=(e,t=[],o={value:0})=>{let n=!1;for(let r of e)n&&!si(r)||(t[o.value]=r,o.value+=1,n=!1,si(r)&&r.expanded===!1?n=!0:mu(r)&&ai(r)&&Dr(r.childNodes,t,o));return t},Su=e=>{let t=(0,Co.useRef)(e),o=(0,Co.useRef)(e),n=(0,Co.useRef)(Dr(e)),[,r]=(0,Co.useState)({});e!==t.current&&(t.current=e,o.current=e,n.current=Dr(e));let s=i=>{o.current=i,n.current=Dr(i),r({})};return{data:o.current,indexPositions:n.current,setData:s}};var It=require("react");var Gf={},Uf=e=>e&&e.hasAttribute("aria-expanded"),Tu=({collapsibleHeaders:e,highlightedIdx:t,treeNodes:o,setVisibleData:n,source:r})=>{let s=(0,It.useRef)(r),i=(0,It.useRef)(s.current),a=(0,It.useCallback)(f=>{n(i.current=f)},[n]),l=(0,It.useCallback)((f,{id:g})=>vr(f,g,{expanded:!0}),[]),c=(0,It.useCallback)((f,{id:g})=>vr(f,g,{expanded:!1}),[]),d=(0,It.useCallback)(f=>{if(f.key===gu||f.key===wr){let g=o[t];g&&g.expanded===!1&&(f.preventDefault(),a(l(i.current,g)))}if(f.key===Po||f.key===wr){let g=o[t];g&&g.expanded&&(f.preventDefault(),a(c(i.current,g)))}},[c,l,t,o,a]),m=e?{onKeyDown:d}:Gf,p={onClick:(0,It.useCallback)(f=>{let g=ri(f.target);if(Uf(g)){f.stopPropagation(),f.preventDefault();let h=ao(r,g.id);(h==null?void 0:h.expanded)===!1?a(l(r,h)):(h==null?void 0:h.expanded)===!0&&a(c(r,h))}},[c,l,a,r])};return{listHandlers:m,listItemHandlers:p}};var vu=require("react");var wu=({highlightedIdx:e,hiliteItemAtIndex:t,indexPositions:o,source:n})=>({listHandlers:{onKeyDown:(0,vu.useCallback)(i=>{if(i.key===Po){let a=o[e],l=du(a);if(l){i.preventDefault();let c=ao(n,l);if(c){let d=Tr(o,c);d!==void 0&&t(d)}}}},[e,t,o,n])}});var Zf=[],Du=({defaultSelected:e,sourceWithIds:t,onChange:o,onHighlight:n,selected:r,selection:s})=>{let i=(0,dn.useRef)(Zf),a=Su(t),l=(I,y)=>{var S,E;(E=(S=u.listHandlers).onKeyboardNavigation)==null||E.call(S,I,y)},{highlightedIdx:c,...d}=Iu({treeNodes:a.indexPositions,onHighlight:n,onKeyboardNavigation:l,selected:i.current}),m=Tu({collapsibleHeaders:!0,highlightedIdx:c,treeNodes:a.indexPositions,setVisibleData:a.setData,source:a.data}),u=cu({defaultSelected:e,highlightedIdx:c,treeNodes:a.indexPositions,onChange:o,selected:r,selection:s}),p=wu({source:a.data,highlightedIdx:c,hiliteItemAtIndex:d.hiliteItemAtIndex,indexPositions:a.indexPositions}),f=(0,dn.useCallback)(I=>{var y,S,E;(y=m.listItemHandlers)==null||y.onClick(I),I.defaultPrevented||(E=(S=u.listItemHandlers)==null?void 0:S.onClick)==null||E.call(S,I)},[m,u]),g=(0,dn.useCallback)(I=>{var y,S,E,v,D,P,A,C;(S=(y=d.listProps).onKeyDown)==null||S.call(y,I),I.defaultPrevented||(v=(E=u.listHandlers).onKeyDown)==null||v.call(E,I),I.defaultPrevented||(P=(D=m.listHandlers).onKeyDown)==null||P.call(D,I),I.defaultPrevented||(C=(A=p.listHandlers).onKeyDown)==null||C.call(A,I)},[m.listHandlers,d.listProps,u.listHandlers,p.listHandlers]),h=()=>{var I;return c===void 0||c===-1||(I=a.indexPositions[c])==null?void 0:I.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},x={onClick:f};return{focusVisible:d.focusVisible,highlightedIdx:c,hiliteItemAtIndex:d.hiliteItemAtIndex,listProps:b,listItemHandlers:x,selected:u.selected,visibleData:a.data}};var Ve=require("react/jsx-runtime"),Mu=require("react"),Nt="vuuTree",ai=e=>e.expanded===!0,Ru=({children:e,idx:t,...o})=>(0,Ve.jsx)("li",{...o,children:e}),Lu=(0,Mr.forwardRef)(function({allowDragDrop:t,className:o,defaultSelected:n,groupSelection:r="none",id:s,onHighlight:i,onSelectionChange:a,revealSelected:l,selected:c,selection:d="single",source:m,...u},p){var N;let f=(0,Lr.useIdMemo)(s),g=(0,Mr.useRef)(null),[,h,b]=ru(m,f,{revealSelected:l?(N=c!=null?c:n)!=null?N:!1:void 0}),x=(w,M)=>{if(a){let O=M.map(k=>b(k)).filter(k=>k!==void 0);a(O)}},{focusVisible:I,highlightedIdx:y,hiliteItemAtIndex:S,listProps:E,listItemHandlers:v,selected:D,visibleData:P}=Du({defaultSelected:n,groupSelection:r,onChange:x,onHighlight:i,selected:c,selection:d,sourceWithIds:h});uu(g,y);let C={...{onMouseEnter:w=>{let M=w.target,O=ou(M);S(O)}},...v,role:"treeitem"},T=lu(r);function R(w,M,O){w.push((0,Ve.jsxs)(Ru,{...C,...Xf(M,O,y,D,I),children:[M.icon?(0,Ve.jsx)("span",{className:`${Nt}Node-icon`,"data-icon":M.icon}):null,(0,Ve.jsx)("span",{children:M.label})]})),O.value+=1}function L(w,M,O,k,z){let{value:K}=O;O.value+=1,w.push((0,Mu.createElement)(Ru,{...v,"aria-expanded":M.expanded,"aria-level":M.level,"aria-selected":D.includes(k)||void 0,className:(0,Rr.default)(`${Nt}Node`,{focusVisible:I===K,[`${Nt}Node-toggle`]:!T}),"data-idx":K,"data-highlighted":K===y||void 0,"data-selectable":!0,id:k,key:`header-${K}`},T?(0,Ve.jsxs)("div",{className:`${Nt}Node-label`,children:[(0,Ve.jsx)("span",{className:`${Nt}Node-toggle`}),z]}):(0,Ve.jsxs)("div",{className:`${Nt}Node-label`,children:[M.icon?(0,Ve.jsx)("span",{className:`${Nt}Node-icon`,"data-icon":M.icon}):null,(0,Ve.jsx)("span",{children:z})]}),(0,Ve.jsx)("ul",{role:"group",children:ai(M)?H(M.childNodes,O):""})))}function H(w,M={value:0}){if((w==null?void 0:w.length)>0){let O=[];for(let k of w)k.childNodes?L(O,k,M,k.id,k.label):R(O,k,M);return O}}return(0,Ve.jsx)("ul",{...u,...E,className:(0,Rr.default)(Nt,o),id:`Tree-${f}`,ref:(0,Lr.useForkRef)(g,p),role:"tree",tabIndex:0,children:H(P)})}),Xf=(e,t,o,n,r,s)=>({id:e.id,key:e.id,"aria-level":e.level,"aria-selected":n.includes(e.id)||void 0,"data-idx":t.value,"data-highlighted":t.value===o||void 0,className:(0,Rr.default)("vuuTreeNode",s,{focusVisible:r===t.value})});Lu.displayName="Tree";var li=Lu;var ku=require("@salt-ds/core"),Cr=X(require("classnames")),At=X(require("react"));var kt=require("react");var mn=(e,t,o,n)=>{var h;let{loadSessionState:r,purgeSessionState:s,purgeState:i,saveSessionState:a}=Zt(),[l,c]=(0,kt.useState)((h=r(e,"contributions"))!=null?h:[]),d=tt(),m=(0,kt.useCallback)((b,x)=>{let I=l.concat([{location:b,content:x}]);a(e,"contributions",I),c(I)},[l,e,a]),u=(0,kt.useCallback)(()=>{s(e,"contributions"),c([])},[e,s]),p=(0,kt.useCallback)(()=>{let b=r(e,"data-source");b&&b.unsubscribe(),s(e),i(e),d({type:"remove",path:o})},[d,e,r,s,i,o]),f=(0,kt.useCallback)(async(b,x,I)=>{var S;b.stopPropagation();let y=(S=t.current)==null?void 0:S.getBoundingClientRect();return new Promise((E,v)=>{d({type:"drag-start",evt:b,path:x===void 0?o:`${o}.${x}`,dragRect:y,preDragActivity:I,dropTargets:n,resolveDragStart:E,rejectDragStart:v})})},[t,d,o,n]);return[(0,kt.useCallback)(async(b,x)=>{var y;let{type:I}=b;switch(I){case"maximize":case"minimize":case"restore":return d({type:I,path:(y=b.path)!=null?y:o});case"remove":return p();case"mousedown":return f(x,b.index,b.preDragActivity);case"add-toolbar-contribution":return m(b.location,b.content);case"remove-toolbar-contribution":return u();default:return}},[d,o,p,f,m,u]),l]};var Pr=require("@salt-ds/core"),Hu=X(require("classnames")),He=X(require("react"));var st=require("react");var Pu=({id:e,rootRef:t,path:o,dropTargets:n,title:r})=>{let s=tt(),{loadState:i,loadSessionState:a,purgeState:l,saveState:c,saveSessionState:d}=Zt(),[m,u]=mn(e,t,o,n),p=(0,st.useMemo)(()=>{var E;return(E=i("view-title"))!=null?E:r},[i,r]),f=(0,st.useCallback)(E=>{o&&s({type:"set-title",path:o,title:E})},[s,o]),g=(0,st.useMemo)(()=>i(e),[e,i]),h=(0,st.useCallback)(E=>i(e,E),[e,i]),b=(0,st.useCallback)(E=>{l(e,E),s({type:"save"})},[e,s,l]),x=(0,st.useCallback)((E,v)=>{c(e,v,E),s({type:"save"})},[e,s,c]),I=(0,st.useCallback)(E=>a(e,E),[e,a]),y=(0,st.useCallback)((E,v)=>d(e,v,E),[e,d]),S=(0,st.useCallback)(({type:E,...v})=>{let{[E]:D}=v;x(D,E)},[x]);return{contributions:u,dispatchViewAction:m,load:h,loadSession:I,onConfigChange:S,onEditTitle:f,purge:b,restoredState:g,save:x,saveSession:y,title:p}};var Ho=require("react"),jf=[],Cu=({mainRef:e,resize:t="responsive",rootRef:o})=>{let n=t==="defer",r=(0,Ho.useRef)({}),s=(0,Ho.useRef)(),i=(0,Ho.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,Ho.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]);Qo(o,n?Cs:jf,a,n)};var pn=X(require("react")),Yf={dispatch:null},fn=pn.default.createContext(Yf),ci=()=>{var t;let e=(0,pn.useContext)(fn);return(t=e==null?void 0:e.dispatch)!=null?t:null},qf=()=>(0,pn.useContext)(fn);var No=require("react/jsx-runtime"),gn="vuuView",Jf=(e,t)=>e&&t?{...e,...t}:e||t,Nu=(0,He.forwardRef)(function(t,o){let{Header:n=ui,children:r,className:s,collapsed:i,closeable:a,"data-path":l,"data-resizeable":c,dropTargets:d,expanded:m,flexFill:u,id:p,header:f,orientation:g="horizontal",path:h=l,resize:b="responsive",resizeable:x=c,tearOut:I,style:y={},title:S,...E}=t,v=(0,Pr.useIdMemo)(p),D=(0,He.useRef)(null),P=(0,He.useRef)(null),[A,C]=(0,He.useState)(),{contributions:T,dispatchViewAction:R,load:L,loadSession:H,onConfigChange:N,onEditTitle:w,purge:M,restoredState:O,save:k,saveSession:z,title:K}=Pu({id:v,rootRef:D,path:h,dropTargets:d,title:S});Cu({mainRef:P,resize:b,rootRef:D});let Z=(0,He.useCallback)(B=>{C(B)},[]),V=()=>He.default.isValidElement(r)&&(O||A)?He.default.cloneElement(r,Jf(O,A)):r,Y=(0,He.useMemo)(()=>({dispatch:R,id:v,path:h,title:K,load:L,loadSession:H,onConfigChange:N,purge:M,save:k,saveSession:z,setComponentProps:Z}),[R,v,L,H,N,h,M,k,z,Z,K]),F=typeof f=="object"?f:{};return(0,No.jsx)("div",{...E,className:(0,Hu.default)(gn,s,{[`${gn}-collapsed`]:i,[`${gn}-expanded`]:m,[`${gn}-resize-defer`]:b==="defer"}),"data-resizeable":x,id:v,ref:(0,Pr.useForkRef)(o,D),style:y,tabIndex:-1,children:(0,No.jsxs)(fn.Provider,{value:Y,children:[f?(0,No.jsx)(n,{...F,collapsed:i,contributions:T,expanded:m,closeable:a,onEditTitle:w,orientation:g,tearOut:I,title:K}):null,(0,No.jsx)("div",{className:`${gn}-main`,ref:P,children:V()})]})})});Nu.displayName="View";var lo=He.default.memo(Nu);lo.displayName="View";fe("View",lo,"view");var ko=require("react/jsx-runtime"),ui=({className:e,contributions:t,collapsed:o,closeable:n,onEditTitle:r,orientation:s="horizontal",style:i,title:a="Untitled"})=>{let l=(0,At.useRef)(null),[c,d]=(0,At.useState)(a),[m,u]=(0,At.useState)(!1),p=ci(),f=C=>p==null?void 0:p({type:"remove"},C),g="vuuHeader",h=()=>{var C;(C=l.current)==null||C.focus()},b=C=>{C.stopPropagation()},I=(0,Cr.default)(g,e,`${g}-${o||s}`),y=()=>{u(!0)},S=C=>{C.key==="Enter"&&u(!0)},E=(C="",T="",R=!0,L=!1)=>{var H;u(!1),L?d(C):T!==C&&(d(T),r==null||r(T)),R===!1&&((H=l.current)==null||H.focus())},v=C=>{p==null||p({type:"mousedown"},C)},D=[],P=[],A=[];return t==null||t.forEach((C,T)=>{switch(C.location){case"pre-title":D.push(At.default.cloneElement(C.content,{key:T}));break;default:P.push(At.default.cloneElement(C.content,{key:T}))}}),a&&D.push((0,ko.jsx)(rr,{editing:m,value:c,onChange:d,onMouseDownCapture:h,onEnterEditMode:y,onExitEditMode:E,onKeyDown:S,ref:l,tabIndex:0},"title")),n&&A.push((0,ko.jsx)(ku.Button,{"data-icon":"close",onClick:f,onMouseDown:b,variant:"secondary"},"close")),P.length>0&&D.push((0,ko.jsx)("div",{className:"vuuTooltrayProxy","data-align":"end",children:P},"contributions")),A.length>0&&D.push((0,ko.jsx)("div",{className:"vuuTooltrayProxy","data-align":"end",children:A},"actions")),(0,ko.jsx)("div",{className:(0,Cr.default)("vuuToolbarProxy",I),style:i,onMouseDown:v,children:D})};var _u=require("@vuu-ui/vuu-popups"),hn=X(require("classnames")),Or=X(require("react"));var Ar=require("@vuu-ui/vuu-utils"),it=require("react");var Qf=".vuuOverflowContainer-item:not(.wrapped)",Au=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}),Nr=[],Ao=(e,t="horizontal")=>{let o=[],n=[],r=-1,s=!1,i=Au(Array.from(e.children)),a=t==="vertical"?"top":"left";for(let l of i){let c=l,{dataset:{index:d="?",label:m="?",overflowPriority:u="0"}}=c,{[a]:p}=c.getBoundingClientRect();p<=r?(d==="overflow"?n.push(o.pop()):n.push({index:d,label:m,overflowPriority:u}),s=!0):s?n.push({index:d,label:m,overflowPriority:u}):o.push({index:d,label:m,overflowPriority:u}),r=p}return[o,n]},di=(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")}},eg=(e,{overflowPriority:t})=>Math.max(e,parseInt(t)),tg=(e,{overflowPriority:t})=>Math.min(e,parseInt(t)),mi=e=>{var t;return e.length>1&&((t=e.at(-1))==null?void 0:t.index)==="overflow"},og=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},pi=(e,t)=>{var r;let o=e.reduce(tg,Number.MAX_SAFE_INTEGER);return t.reduce(eg,0)>o?!0:t.length>1&&((r=t.at(-1))==null?void 0:r.index)==="overflow"},fi=(e,t)=>new Promise(o=>{requestAnimationFrame(()=>{let[,n]=Ao(e);ng(t,n).forEach(s=>zu(e,s)),o(n)})}),gi=(e,t,o)=>new Promise(n=>{requestAnimationFrame(()=>{let[,r]=Ao(e),s=og(r);if(s){let[i,a]=kr(e,s);n([i,a])}else n([t,o])})}),Ou=(e,t)=>e.querySelector(`[data-index="${t.index}"]`),zu=(e,t)=>{let o=Ou(e,t);if(o)o.classList.add("wrapped");else throw Error(`markElementAsWrapped element item with index ${t.index} not found`)},Fu=e=>Array.from(e.querySelectorAll(".wrapped")),ng=(e,t)=>{let o=[];for(let n of t)e.find(({index:r})=>r===n.index)||o.push(n);return o},Bu=(e,t)=>{Fu(e).forEach(n=>{let{dataset:{index:r="?"}}=n;t.find(s=>s.index===r)||n.classList.remove("wrapped")})},$u=e=>e.querySelector('[data-index="overflow"]'),rg=e=>e.querySelector(".wrapped"),Hr=e=>parseInt(getComputedStyle(e).getPropertyValue("width")),Ku=(e,t)=>{let{right:o}=e.getBoundingClientRect(),n=parseInt(getComputedStyle(e).getPropertyValue("padding-right")),{right:r}=t.getBoundingClientRect();return o-n-r},hi=e=>{let t=$u(e),o=Ku(e,t),n=Hr(t),r=rg(e);return Hr(r)<=o+n?(e.classList.remove("overflowed"),r.classList.remove("wrapped"),!0):!1},sg=(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)},ig=e=>Array.from(e.querySelectorAll(Qf)).sort(sg),kr=(e,t)=>{let o=ig(e),n=Ou(e,t),r=-1,s=o.at(r),i=Hr(s),a=Hr(n),l=$u(e),c=Ku(e,l)+i;if(c>=a)ag(n,s);else{let{left:u}=s.getBoundingClientRect(),p=c,f=[s];for(;c<a;){r-=1,s=o.at(r),f.push(s);let{left:g}=s.getBoundingClientRect(),h=u-g;c=p+h}n==null||n.classList.remove("wrapped"),f.forEach(g=>{g.classList.add("wrapped")})}let[d,m]=Ao(e);return Bu(e,m),[d,m]},ag=(e,t)=>{if(!e||!t)throw Error("switchWrapOnElements, element undefined");e.classList.remove("wrapped"),t.classList.add("wrapped")};var Vu=({itemCount:e,onSwitchWrappedItemIntoView:t,orientation:o="horizontal"})=>{let[n,r]=(0,it.useState)(null),s=(0,it.useRef)(Nr),i=(0,it.useCallback)(async()=>{if(n){let[u,p]=Ao(n,o);for(di(n,p),mi(p)&&(p=await fi(n,p));pi(u,p);)[u,p]=await gi(n,u,p);p.length===1&&hi(n)&&(p=Nr),s.current=p}},[n,o]),a=u=>typeof u=="object"&&u!==null&&"overflowItem"in u,[l,c]=(0,it.useMemo)(()=>[()=>{let{current:u}=s;return u.map(p=>({label:p.label,action:`activate-item-${p.index}`,options:{overflowItem:p}}))},({options:u})=>{if(n&&a(u)){let[,p]=kr(n,u.overflowItem);s.current=p,t==null||t(u.overflowItem)}return!0}],[n,t]),d=(0,it.useMemo)(()=>{let{sizeProp:u}=Ar.MEASURES[o],p=0;return new ResizeObserver(f=>{for(let g of f){let{[u]:h}=g.contentRect;(0,Ar.isValidNumber)(h)&&p!==h&&(p=h,i())}})},[i,o]);Yr(()=>{i()},[i,e]),(0,it.useMemo)(()=>{n&&d.observe(n)},[n,d]);let m=(0,it.useCallback)(u=>{r(u)},[]);return{menuActionHandler:c,menuBuilder:l,rootRef:m}};var Ot=require("react/jsx-runtime"),Oo="vuuOverflowContainer",Wu=Or.default.memo(({children:e,className:t,height:o,onSwitchWrappedItemIntoView:n,orientation:r="horizontal",overflowIcon:s})=>{let i=Kt(e),{menuActionHandler:a,menuBuilder:l,rootRef:c}=Vu({itemCount:i.length,onSwitchWrappedItemIntoView:n,orientation:r}),m={"--overflow-container-height":`${r==="vertical"?"100%":`${o}px`}`},u=(0,hn.default)(`${Oo}-wrapContainer`,t,{[`${Oo}-horizontal`]:r==="horizontal",[`${Oo}-vertical`]:r==="vertical"});return(0,Ot.jsxs)("div",{className:u,ref:c,style:m,children:[i.map((p,f)=>{let{"data-overflow-priority":g="0",id:h,label:b=`Item ${f+1}`}=p.props;return(0,Ot.jsx)("div",{className:(0,hn.default)(`${Oo}-item`),"data-index":f,"data-label":b,"data-overflow-priority":g,id:`${h}-wrapper`,children:p},f)}),(0,Ot.jsx)("div",{className:`${Oo}-OverflowIndicator`,"data-index":"overflow",children:(0,Ot.jsx)(_u.PopupMenu,{icon:s,menuBuilder:l,menuActionHandler:a})})]})});Wu.displayName="OverflowContainer.InnerContainer";var ni=(0,Or.forwardRef)(function({children:t,className:o,height:n=44,onSwitchWrappedItemIntoView:r,orientation:s,overflowIcon:i,...a},l){return(0,Ot.jsx)("div",{...a,className:(0,hn.default)((0,hn.default)(Oo,o)),ref:l,children:(0,Ot.jsx)(Wu,{height:n,orientation:s,overflowIcon:i,onSwitchWrappedItemIntoView:r,children:t})})});var Gu=require("@vuu-ui/vuu-utils"),Fr=require("@salt-ds/lab"),bi=X(require("classnames")),Br=require("react");var zr=require("react/jsx-runtime"),lg=e=>{let t=e.cloneNode(!0);return t.id="",delete t.dataset.idx,t},yi=(0,Br.memo)(({className:e,children:t,idx:o,resizeable:n,header:r,closeable:s,...i})=>(0,zr.jsx)(Fr.ListItem,{className:(0,bi.default)("vuuPaletteItem",e),"data-draggable":!0,...i}));yi.displayName="PaletteItem";var Uu=({children:e,className:t,orientation:o="horizontal",ViewProps:n,...r})=>{let s=tt(),i="vuuPalette";function a(l){var v;let d=l.target.closest(".vuuPaletteItem"),m=parseInt((v=d.dataset.idx)!=null?v:"-1");m!==-1&&console.log({children:e,idx:m,listItemElement:d});let{props:{caption:u,children:p,template:f,...g}}=e[m],{height:h,left:b,top:x,width:I}=d.getBoundingClientRect(),y=(0,Gu.uuid)(),E=f?p:(0,zr.jsx)(lo,{...n,...{id:y,key:y},...g,title:g.label,children:p});s({dragRect:{left:b,top:x,right:b+I,bottom:x+150,width:I,height:h},dragElement:lg(d),evt:l.nativeEvent,instructions:{DoNotRemove:!0,DoNotTransform:!0,RemoveDraggableOnDragEnd:!0,dragThreshold:10},path:"*",payload:E,type:"drag-start"})}return(0,zr.jsx)(Fr.List,{...r,borderless:!0,className:(0,bi.default)(i,t,`${i}-${o}`),maxHeight:800,selected:null,children:e.map((l,c)=>l.type===yi?(0,Br.cloneElement)(l,{key:c,onMouseDown:a}):l)})};fe("Palette",Uu,"view");var Xu=X(require("classnames")),zt=X(require("react"));var bn=require("react/jsx-runtime"),Zu="Tabs",cg=()=>{},ug=(e,t)=>{var o,n;return(n=(o=e.props)==null?void 0:o.title)!=null?n:`Tab ${t+1}`},dg=e=>{let t=[];return zt.default.Children.forEach(e,o=>{zt.default.isValidElement(o)?t.push(o):console.warn("Stack has unexpected child element type")}),t},mg={allowAddTab:!1,allowCloseTab:!1,allowRenameTab:!1},$r=(0,zt.forwardRef)(function({active:t=0,children:o,className:n,getTabIcon:r=cg,getTabLabel:s=ug,id:i,keyBoardActivation:a="manual",onAddTab:l,onMoveTab:c,onTabClose:d,onTabEdit:m,onTabSelectionChanged:u,showTabs:p="top",style:f,TabstripProps:g=mg},h){var A;let b=Vt(i),{allowCloseTab:x,allowRenameTab:I}=g,y=(0,zt.useCallback)((C,T,R,L)=>{m==null||m(L,T)},[m]),S=()=>{var C;return zt.default.isValidElement(o)?o:Array.isArray(o)&&(C=o[t])!=null?C:null},E=()=>dg(o).map((C,T)=>{let R=`${b}-${T}`,{closeable:L=x,id:H}=C.props;return(0,bn.jsx)(tu,{ariaControls:`${R}-tab`,"data-icon":r(C,T),id:R,index:T,label:s(C,T),closeable:L,editable:I},H!=null?H:T)}),v=S(),D=p==="left"||p==="right",P=D?"vertical":"horizontal";return(0,bn.jsxs)("div",{className:(0,Xu.default)(Zu,n,{[`${Zu}-horizontal`]:D}),style:f,id:b,ref:h,children:[p?(0,bn.jsx)(Gc,{...g,activeTabIndex:(A=g==null?void 0:g.activeTabIndex)!=null?A:v===null?-1:t,allowDragDrop:g.allowDragDrop!==!1,animateSelectionThumb:!0,className:"vuuTabHeader",keyBoardActivation:a,onActiveChange:u,onAddTab:l,onCloseTab:d,onExitEditMode:y,onMoveTab:c,orientation:P,children:E()}):null,v]})});$r.displayName="Stack";var ju=require("@salt-ds/core"),Ft=X(require("react"));var Kr=require("react/jsx-runtime"),pg=e=>(0,Kr.jsx)(lo,{resizeable:!0,title:`Tab ${e}`,style:{flexGrow:1,flexShrink:0,flexBasis:0},header:!0,closeable:!0,children:(0,Kr.jsx)(vn,{style:{flex:1}})}),xi=e=>{let t=(0,Ft.useRef)(null),o=tt(),{loadState:n}=Zt(),{createNewChild:r=pg,id:s,onTabSelectionChanged:i,path:a,...l}=e,{children:c}=e,d=(0,ju.useIdMemo)(s),[m]=mn(d,t,a),u=I=>{a&&(o({type:"switch-tab",path:a,nextIdx:I}),i==null||i(I))},p=(0,Ft.useCallback)(I=>{if(Array.isArray(c)){let{props:{"data-path":y,path:S=y}}=c[I];o({type:"remove",path:S})}},[c,o]),f=(0,Ft.useCallback)(()=>{if(a){let I=Ft.default.Children.count(c),y=r(I);o({type:"add",path:a,component:y})}},[c,r,o,a]),g=(0,Ft.useCallback)((I,y)=>{a&&o({fromIndex:I,toIndex:y,path:a,type:"move-child"})},[o,a]);return(0,Kr.jsx)($r,{...l,id:d,getTabLabel:(I,y)=>{let{id:S,title:E}=I.props;return n(S,"view-title")||E||`Tab ${y+1}`},onMouseDown:async(I,y)=>{let S;await m({type:"mousedown",index:y,preDragActivity:async()=>new Promise(D=>{console.log("preDragActivity: Ok, gonna release the drag"),S=D})},I)&&(S==null||S(void 0))},onMoveTab:g,onAddTab:f,onTabClose:p,onTabEdit:(I,y)=>{o({type:"set-title",path:`${a}.${I}`,title:y})},onTabSelectionChanged:u,ref:t})};xi.displayName="Stack";fe("Stack",xi,"container");var zo=X(require("react"));var co=require("react/jsx-runtime"),fg=({children:e})=>{let[o,n]=(0,zo.useState)(e),[r,s]=(0,zo.useState)(e),i=l=>{let c=jr(o,l);s(c)},a=(l,c)=>{console.log(`change ${l} -> ${c}`);let d=zo.default.cloneElement(r,{style:{...r.props.style,[l]:c}});s(d),n(zo.default.cloneElement(o,{},d))};return(0,co.jsxs)("div",{"data-design-mode":`${!1}`,children:[o,(0,co.jsx)("br",{}),(0,co.jsxs)("div",{style:{display:"flex"},children:[(0,co.jsx)(Ei,{height:300,managedStyle:r.props.style,width:300,onChange:a,style:void 0}),(0,co.jsx)(Ii,{layout:o,onSelect:i,style:{width:300,height:300,backgroundColor:"#ccc"}})]})]})};var ft=require("@salt-ds/core"),le=require("react/jsx-runtime"),Ti={},gg={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"}},Si=({feature:e,children:t,style:o,onChange:n})=>(0,le.jsxs)("div",{className:`LayoutBox layout-${e} layout-outer`,children:[(0,le.jsxs)("div",{className:"layout-top",children:[(0,le.jsx)("span",{className:"layout-title",children:e}),(0,le.jsx)(ft.FormField,{className:"layout-input",style:{width:30},children:(0,le.jsx)(ft.Input,{value:o.top,onChange:(r,s)=>n(e,"top",s)})})]}),(0,le.jsxs)("div",{className:"layout-inner",children:[(0,le.jsx)("div",{className:"layout-left",children:(0,le.jsx)(ft.FormField,{className:"layout-input",style:{width:30},children:(0,le.jsx)(ft.Input,{value:o.left,onChange:(r,s)=>n(e,"left",s)})})}),t,(0,le.jsx)("div",{className:"layout-right",children:(0,le.jsx)(ft.FormField,{className:"layout-input",style:{width:30},children:(0,le.jsx)(ft.Input,{value:o.right,onChange:(r,s)=>n(e,"right",s)})})})]}),(0,le.jsx)("div",{className:"layout-bottom",children:(0,le.jsx)(ft.FormField,{className:"layout-input",style:{width:30},children:(0,le.jsx)(ft.Input,{value:o.bottom,onChange:(r,s)=>n(e,"bottom",s)})})})]}),hg={margin:!0,marginTop:!0,marginRight:!0,marginBottom:!0,marginLeft:!0},bg={padding:!0,paddingTop:!0,paddingRight:!0,paddingBottom:!0,paddingLeft:!0},yg={border:!0,borderColor:!0,borderWidth:!0,borderTopWidth:!0,borderRightWidth:!0,borderBottomWidth:!0,borderLeftWidth:!0},Vr="(\\d+)(?:px)?",xg=`^(?:${Vr}(?:\\s${Vr}(?:\\s${Vr}(?:\\s${Vr})?)?)?)$`,Yu=new RegExp(xg),Eg=/^(?:(\d+)(?:px)\ssolid\s([a-zA-Z,0-9().]+))$/,Ei=({height:e,managedStyle:t,onChange:o,style:n,width:r})=>{let s=qu(t),i=(I,y,S)=>{let E=parseInt(S||"0",10),v=gg[I][y];o(v,E)},{marginTop:a=0,marginRight:l=0,marginBottom:c=0,marginLeft:d=0}=s,{borderTopWidth:m=0,borderRightWidth:u=0,borderBottomWidth:p=0,borderLeftWidth:f=0}=s,{paddingTop:g=0,paddingRight:h=0,paddingBottom:b=0,paddingLeft:x=0}=s;return(0,le.jsx)("div",{className:"LayoutConfigurator",style:{width:r,height:e,...n},children:(0,le.jsx)(Si,{feature:"margin",style:{top:a,right:l,bottom:c,left:d},onChange:i,children:(0,le.jsx)(Si,{feature:"border",style:{top:m,right:u,bottom:p,left:f},onChange:i,children:(0,le.jsx)(Si,{feature:"padding",style:{top:g,right:h,bottom:b,left:x},onChange:i,children:(0,le.jsx)("div",{className:"layout-content"})})})})})};function Ig(e=Ti,t=Ti){let{margin:o,marginTop:n,marginRight:r,marginBottom:s,marginLeft:i,padding:a,paddingTop:l,paddingRight:c,paddingBottom:d,paddingLeft:m,...u}=e;if(typeof o=="number")u.marginTop=u.marginRight=u.marginBottom=u.marginLeft=o;else if(typeof o=="string"){let p=Yu.exec(o);if(p===null)console.error(`Invalid css value for margin '${o}'`);else{let[,f,g,h,b]=p,x=f&&g&&h;x&&b?(u.marginTop=parseInt(f,10),u.marginRight=parseInt(g,10),u.marginBottom=parseInt(h,10),u.marginLeft=parseInt(b,10)):x?(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 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 p=Yu.exec(a);if(p===null)console.error(`Invalid css value for padding '${a}'`);else{let[,f,g,h,b]=p,x=f&&g&&h;x&&b?(u.paddingTop=parseInt(f,10),u.paddingRight=parseInt(g,10),u.paddingBottom=parseInt(h,10),u.paddingLeft=parseInt(b,10)):x?(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 m=="number"&&(u.paddingLeft=m),qu(u,t)}function qu(e=Ti){let t={...e},o,{border:n,borderWidth:r,borderTopWidth:s,borderRightWidth:i,borderBottomWidth:a,borderLeftWidth:l,borderColor:c,margin:d,marginTop:m,marginRight:u,marginBottom:p,marginLeft:f,padding:g,paddingTop:h,paddingRight:b,paddingBottom:x,paddingLeft:I,...y}=t,S={},E={};if(typeof d=="number"&&(t.marginTop=t.marginRight=t.marginBottom=t.marginLeft=d,S={marginTop:d,marginRight:d,marginBottom:d,marginLeft:d}),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=Eg.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 v=`
21
22
  ${c} ${l||0}px ${s||0}px 0 0 inset,
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})})};
23
+ ${c} ${-i||0}px ${-a||0}px 0 0 inset`;return{...y,...S,...E,borderTopWidth:s,borderRightWidth:i,borderBottomWidth:a,borderLeftWidth:l,borderColor:c,borderStyle:"solid",boxShadow:v}}else return t}var Ju=X(require("react")),Qu=X(require("classnames"));var vi=require("react/jsx-runtime"),Sg="hwLayoutTreeViewer",ed=(e,t="0")=>({label:U(e),path:t,childNodes:Ju.default.Children.map(e.props.children,(o,n)=>ed(o,t?`${t}.${n}`:`${n}`))}),Ii=({layout:e,onSelect:t,style:o})=>{let n=[ed(e)],r=(s,[{path:i}])=>{t(i)};return(0,vi.jsx)("div",{className:(0,Qu.default)(Sg),style:o,children:(0,vi.jsx)(li,{source:n,groupSelection:"single",onSelectionChange:r})})};
23
24
  //# sourceMappingURL=index.js.map