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