@vuu-ui/vuu-ui-controls 0.8.7 → 0.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.js +4 -214
- package/cjs/index.js.map +4 -4
- package/esm/index.js +4 -214
- package/esm/index.js.map +4 -4
- package/index.css +1 -1
- package/index.css.map +3 -3
- package/package.json +7 -6
- package/types/common-hooks/index.d.ts +1 -0
- package/types/{tree → common-hooks}/use-resize-observer.d.ts +1 -0
- package/types/drag-drop/drop-target-utils.d.ts +10 -1
- package/types/drag-drop/index.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/list/CheckboxIcon.d.ts +6 -0
- package/types/list/Highlighter.d.ts +7 -0
- package/types/list/List.d.ts +7 -0
- package/types/list/ListItem.d.ts +5 -0
- package/types/list/ListItemGroup.d.ts +6 -0
- package/types/list/ListItemHeader.d.ts +5 -0
- package/types/list/VirtualizedList.d.ts +7 -0
- package/types/list/common-hooks/collectionProvider.d.ts +13 -0
- package/types/list/common-hooks/collectionTypes.d.ts +56 -0
- package/types/list/common-hooks/index.d.ts +15 -0
- package/types/list/common-hooks/itemToString.d.ts +2 -0
- package/types/list/common-hooks/keyUtils.d.ts +15 -0
- package/types/list/common-hooks/list-dom-utils.d.ts +6 -0
- package/types/list/common-hooks/navigationTypes.d.ts +37 -0
- package/types/list/common-hooks/selectionTypes.d.ts +42 -0
- package/types/list/common-hooks/useCollapsibleGroups.d.ts +14 -0
- package/types/list/common-hooks/useCollectionItems.d.ts +2 -0
- package/types/list/common-hooks/useImperativeScrollingAPI.d.ts +14 -0
- package/types/list/common-hooks/useKeyboardNavigation.d.ts +4 -0
- package/types/list/common-hooks/useSelection.d.ts +8 -0
- package/types/list/common-hooks/useTypeahead.d.ts +15 -0
- package/types/list/common-hooks/useViewportTracking.d.ts +14 -0
- package/types/list/common-hooks/utils/collection-item-utils.d.ts +21 -0
- package/types/list/common-hooks/utils/filter-utils.d.ts +4 -0
- package/types/list/common-hooks/utils/index.d.ts +3 -0
- package/types/list/common-hooks/utils/isSelected.d.ts +2 -0
- package/types/list/index.d.ts +8 -0
- package/types/list/keyset.d.ts +9 -0
- package/types/list/listTypes.d.ts +206 -0
- package/types/list/useList.d.ts +3 -0
- package/types/list/useListHeight.d.ts +19 -0
- package/types/list/useScrollPosition.d.ts +19 -0
- package/types/list/useVirtualization.d.ts +15 -0
- package/types/utils/escapeRegExp.d.ts +1 -0
- package/types/utils/index.d.ts +1 -0
package/cjs/index.js
CHANGED
|
@@ -1,217 +1,7 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
${t.isDraggedItem?"*":" "}[${o}] width : ${Math.floor(t.size)} ${Math.floor(t.start)} - ${Math.floor(t.end)} (mid ${Math.floor(t.mid)})`).join("");var Si=require("@salt-ds/core");function Qr(e){var t,o,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(o=Qr(e[t]))&&(r&&(r+=" "),r+=o);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function co(){for(var e,t,o=0,r="";o<arguments.length;)(e=arguments[o++])&&(t=Qr(e))&&(r&&(r+=" "),r+=t);return r}var Po=require("react");function en(e){var t,o,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(o=en(e[t]))&&(r&&(r+=" "),r+=o);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function st(){for(var e,t,o=0,r="";o<arguments.length;)(e=arguments[o++])&&(t=en(e))&&(r&&(r+=" "),r+=t);return r}var Za=/[.*+?^${}()|[\]\\]/g;function uo(e){return e.replace(Za,"\\$&")}var Ja=require("react/jsx-runtime"),mo=require("react"),ja=(0,mo.createContext)(typeof window<"u"?window:null);function ke(){return(0,mo.useContext)(ja)}var po=J(require("react"));var Ya=require("react/jsx-runtime"),Bt=require("react"),Xa=(0,Bt.createContext)(null);function tn(){return(0,Bt.useContext)(Xa)}var on,Qa=(on=po.useInsertionEffect)!=null?on:po.useLayoutEffect,Qo=new WeakMap;function Re({testId:e,css:t,window:o}){let r=tn();Qa(()=>{var n,a;if(!o)return;let i=(n=Qo.get(o))!=null?n:new Map,l=(a=i.get(t))!=null?a:{styleElement:null,count:0};return l.styleElement==null?(l.styleElement=o.document.createElement("style"),l.styleElement.setAttribute("type","text/css"),l.styleElement.setAttribute("data-salt-style",e||""),l.styleElement.textContent=t,l.count=1,o.document.head.insertBefore(l.styleElement,r||o.document.head.firstChild)):(l.styleElement.textContent=t,l.count++),i.set(t,l),Qo.set(o,i),()=>{let c=Qo.get(o),s=c==null?void 0:c.get(t);s!=null&&s.styleElement&&(s.count--,s.count<1&&(o.document.head.removeChild(s.styleElement),s.styleElement=null,c==null||c.delete(t)))}},[e,t,o])}var Hm=require("@salt-ds/core"),km=require("react");var er=require("react/jsx-runtime"),an=require("react");function rn(e){var t,o,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(o=rn(e[t]))&&(r&&(r+=" "),r+=o);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function nn(){for(var e,t,o=0,r="";o<arguments.length;)(e=arguments[o++])&&(t=rn(e))&&(r&&(r+=" "),r+=t);return r}var sn=`/* Style applied to the root element */
|
|
3
|
-
.saltIcon {
|
|
4
|
-
--icon-color: var(--saltIcon-color, var(--salt-text-secondary-foreground));
|
|
5
|
-
--icon-size-multiplier: var(--saltIcon-size-multiplier, 1);
|
|
6
|
-
--icon-base-size: var(--salt-icon-size-base, 12px);
|
|
7
|
-
/**
|
|
8
|
-
* Icon size will be the multiplier (an integer from the size prop) * the base size (set by the theme per density)
|
|
9
|
-
* Icons should never be smaller than 12px for readability so we've added a max() to enforce this
|
|
10
|
-
* Consumers can use --saltIcon-size variable to override this rule as an escape hatch
|
|
11
|
-
*/
|
|
12
|
-
--icon-size: var(--saltIcon-size, max(calc(var(--icon-base-size) * var(--icon-size-multiplier)), 12px));
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.saltIcon {
|
|
16
|
-
fill: var(--saltIcon-color, var(--icon-color));
|
|
17
|
-
display: inline-block;
|
|
18
|
-
margin: var(--saltIcon-margin, 0);
|
|
19
|
-
position: relative;
|
|
20
|
-
width: var(--icon-size);
|
|
21
|
-
height: var(--icon-size);
|
|
22
|
-
min-width: var(--icon-size);
|
|
23
|
-
min-height: var(--icon-size);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.saltIcon:hover {
|
|
27
|
-
--icon-color: var(--saltIcon-color-hover, var(--salt-text-secondary-foreground));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.saltIcon:active {
|
|
31
|
-
--icon-color: var(--saltIcon-color-active, var(--salt-text-secondary-foreground));
|
|
32
|
-
}
|
|
33
|
-
`;var el=e=>(...t)=>[e,...t].join("-"),tl=el("saltIcon"),ol=1,ln=(0,an.forwardRef)(function({children:t,className:o,size:r=ol,style:n,...a},i){let l=ke();Re({testId:"salt-icon",css:sn,window:l});let c={...n,"--saltIcon-size-multiplier":`${r}`};return(0,er.jsx)("svg",{className:nn(tl(),o),style:c,role:"img",...a,ref:i,children:(0,er.jsx)("g",{"aria-hidden":!0,children:t})})});var $t=require("react/jsx-runtime"),cn=require("react");var tr=(0,cn.forwardRef)(function(t,o){return(0,$t.jsxs)(ln,{"data-testid":"ExportIcon","aria-label":"export",viewBox:"0 0 12 12",ref:o,...t,children:[(0,$t.jsx)("path",{d:"M5 1H1v10h4v-1H2V2h3V1Z"}),(0,$t.jsx)("path",{d:"M3 5h5V3l4 3-4 3V7H3V5Z"})]})});var rl=require("react/jsx-runtime"),Vt=require("react"),nl=(0,Vt.createContext)(void 0);function un(){let e=(0,Vt.useContext)(nl);if(e)return e}function sl(e,...t){let o=new Set(e);for(let r of t)for(let n of r)o.add(n);return o}var zt="ArrowUp",Ut="ArrowDown",dn="ArrowLeft",mn="ArrowRight",or="Enter",fo="Home",_t="End",rr="PageUp",go="PageDown",pn=" ",il=new Set(["Enter","Delete"," "]),al=new Set(["Tab"]),ll=new Set(["ArrowRight","ArrowLeft"]),fn=new Set([fo,_t,rr,go,Ut,zt]),cl=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),ul=sl(il,fn,ll,cl,al),ho=e=>ul.has(e.key)?!1:e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey,gn=({key:e})=>fn.has(e);var j=require("react");var yt=require("react");var hn=e=>null;var xn=e=>null;var dl=e=>Object.prototype.toString.call(e)==="[object Object]";function vt(e){return typeof e=="string"?e:dl(e)?Object.prototype.hasOwnProperty.call(e,"label")?String(e.label):(console.warn(["itemToString: you've likely forgotten to set the label prop on the item object.","You can also provide your own `itemToString` implementation."].join(`
|
|
34
|
-
`)),""):String(e)}var nr=(e,t)=>e!==null&&Object.prototype.hasOwnProperty.call(e,t),sr=e=>nr(e,"header"),bn=e=>nr(e,"childNodes"),Wt=(e,t)=>e&&Object.prototype.hasOwnProperty.call(e.props,t),In=e=>{if((0,yt.isValidElement)(e)){if(Wt(e,"disabled"))return e.props.disabled===!0}else if(nr(e,"disabled"))return e.disabled===!0;return!1},vn=e=>(0,yt.isValidElement)(e)&&Wt(e,"focusable")?e.props.focusable:!0,yn=(e,t,o)=>{if(e.childNodes)return e.childNodes.length;if(e.header){let r=o+1,n=0;for(;r<t.length&&!t[r].header;)n++,r++;return n}else return 0},ml=e=>{if(typeof e.props.children=="string")return e.props.children;if(e.props.title)return e.props.title;if(e.props.label)return e.props.label},Sn=e=>e.type===xn||Wt(e,"data-header"),Tn=e=>e.type===hn||Wt(e,"data-group"),pl=e=>Wt(e,"selectable")?e.props.selectable===!0:!Tn(e)&&!Sn(e),fl=e=>{if(Tn(e)){let{props:{children:t}}=e;if(typeof t!="string")return ar(t)}},gl=(e,t)=>{let o=[];return yt.Children.forEach(e,r=>{(0,yt.isValidElement)(r)&&o.push(t(r))}),o},ir=(e,t)=>{if(Array.isArray(e))return e.length===0&&(t!=null&&t.noChildrenLabel)?[{label:t.noChildrenLabel,value:null}]:e.map((o,r)=>{var n,a;return{childNodes:ir(o.childNodes,t),description:o.description,expanded:o.expanded,value:o,label:(a=(n=t==null?void 0:t.itemToString)==null?void 0:n.call(t,o))!=null?a:vt(o)}});if(e)throw Error("list-child-items expects source to be an array")},ar=e=>{if(e)return gl(e,t=>{let{"data-id":o,disabled:r,id:n=o,"data-expanded":a,expanded:i=a}=t.props;return{childNodes:fl(t),disabled:r,expanded:i,header:Sn(t),id:n,label:ml(t),selectable:pl(t),value:t}})},hl=new Set(["/","-","."]),xl=e=>hl.has(e),Cn=(e,t)=>t.startsWith(e)&&xl(t[e.length]),bl=new Set([".","/"]);function Il(e,t){return t.startsWith(e)?bl.has(t.charAt(e.length)):!1}function xo(e,t,o){let r;return e.map(a=>a.id===t?{...a,...o}:Il(a.id,t)&&a.childNodes?(r=xo(a.childNodes,t,o),{...a,childNodes:r}):a)}var Sd=require("react"),Td=require("@salt-ds/core"),vl=e=>e&&e.replace(/^\s+/g,""),lr=e=>new RegExp(`(${uo(vl(e))})`,"gi"),wn=(e="",t=lr)=>(o="")=>!!o.length&&!!e.length&&o.match(t(e))!==null;var yl={},Mn=({children:e,id:t,label:o="",options:r=yl,source:n})=>{var a;let{getItemId:i}=r,[,l]=(0,j.useState)(null),c=un(),s=(0,j.useRef)([]),m=(0,j.useRef)([]),d=(0,j.useMemo)(()=>[],[]),u=(0,j.useRef)((a=r.filterPattern)!=null?a:""),{getFilterRegex:g=lr,noChildrenLabel:f,itemToString:p=vt}=r,x=(0,j.useCallback)(C=>r.defaultExpanded||!1,[r.defaultExpanded]),y=(0,j.useCallback)((C,T,R=1,A="",F=[],V=[],G=[])=>(C.forEach((z,q,K)=>{var B,$;let _=z.header&&r.collapsibleHeaders,X=z.childNodes&&r.collapsibleHeaders===!1,U=!z.childNodes||z.childNodes.length===0,Z=X||U&&!_,Q=A?`${A}.${q}`:`item-${q}`,ee=(B=z.id)!=null?B:i?i(q):`${t}-${Q}`,W=Z?void 0:($=z.expanded)!=null?$:x(ee),le={...z,childNodes:void 0,count:!X&&W===void 0?0:yn(z,K,q),description:z.description,disabled:In(z.value),focusable:vn(z.value)?void 0:!1,id:ee,index:T.value,expanded:W,level:R};if(F.push(le),V.push(le),G.push(C[q].value),T.value+=1,z.childNodes){let[Pe]=y(z.childNodes,T,R+1,Q,[],V,G);le.childNodes=Pe}}),[F,G,V]),[r.collapsibleHeaders,i,t,x]),D=(0,j.useCallback)(()=>u.current?wn(u.current,g):null,[g]),I=(0,j.useCallback)((C,T=D(),R=[],A={value:0})=>{let F=!1;for(let V of C)F&&!sr(V)||(V.value!==null&&(T===null||T(p(V.value)))&&(R[A.value]=V,A.value+=1),F=!1,sr(V)&&V.expanded===!1?F=!0:bn(V)&&V.expanded!==!1&&V.childNodes&&I(V.childNodes,T,R,A));return R},[D,p]),v=(0,j.useMemo)(()=>c?d:ir(n,{itemToString:p,noChildrenLabel:f})||ar(e)||[],[c,d,n,p,f,e]),[L,w,M]=(0,j.useMemo)(()=>c?[d,d,d]:y(v,{value:0}),[d,y,c,v]);m.current=M,(0,j.useMemo)(()=>c?d:s.current=I(L),[d,I,L,c]);let h=(0,j.useRef)(L),E=(0,j.useCallback)((C="")=>{typeof C=="string"&&(u.current=C,s.current=I(L),l({}))},[L,I]),H=(0,j.useCallback)((C,T=L)=>{let R=T.find(A=>{var F;return A.id===C||((F=A==null?void 0:A.childNodes)==null?void 0:F.length)&&Cn(A.id,C)});if((R==null?void 0:R.id)===C)return w==null?void 0:w[R.index];if(R)return H(C,R.childNodes);throw Error(`useCollectionData itemById, id ${C} not found `)},[w,L]),O=(0,j.useCallback)(C=>{let T=m.current.find(R=>(0,j.isValidElement)(R.value)?R.label===C:R.value===C);if(T)return T;throw Error("useCollectionData toCollectionItem, item not found ")},[]),b=(0,j.useCallback)(C=>{if(C===null)return null;if(Array.isArray(C)){let T=[];for(let R of C){let A=O(R);T.push(A)}return T}else if(C!==void 0)return O(C)},[O]),S=(0,j.useCallback)(C=>{let T=R=>{let A=m.current.find(F=>(0,j.isValidElement)(F.value)?F.label===R:F.value!==null&&p(F.value)===R);if(A)return A};if(C===null)return null;if(Array.isArray(C)){let R=[];for(let A of C){let F=T(A);F&&R.push(F)}return R}else if(C!==void 0)return T(C)},[p]),N=(0,j.useCallback)(C=>{for(let T of h.current)if(C===T.value)return T.id;throw Error("useCollectionData itemToId, item not found")},[]),P=(0,j.useCallback)(C=>{h.current=xo(h.current,C.id,{expanded:!1}),s.current=I(h.current),l({})},[I]),k=(0,j.useCallback)(C=>{h.current=xo(h.current,C.id,{expanded:!0}),s.current=I(h.current),l({})},[I]);return c||{collapseGroupItem:P,data:s.current,expandGroupItem:k,setFilterPattern:E,itemById:H,itemToId:N,toCollectionItem:O,itemToCollectionItem:b,stringToCollectionItem:S}};var cr=require("@salt-ds/core"),Io=require("react");var En=["height"];var it=new WeakMap,Ln=(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}},bo=typeof ResizeObserver<"u"?new ResizeObserver(e=>{for(let t of e){let{target:o,contentRect:r}=t,n=it.get(o);if(n){let{onResize:a,measurements:i}=n,l=!1;for(let[c,s]of Object.entries(i)){let m=Ln(o,r,c);m!==s&&(l=!0,i[c]=m)}l&&a&&a(i)}}}):null;function Gt(e,t,o,r=!1){let n=(0,Io.useRef)(t),a=(0,Io.useCallback)(i=>{let l=i.getBoundingClientRect();return n.current.reduce((c,s)=>(c[s]=Ln(i,l,s),c),{})},[]);(0,cr.useIsomorphicLayoutEffect)(()=>{if(!bo)return;let i=e.current,l=!1;async function c(){it.set(i,{measurements:{}}),l=!1;let{fonts:s}=document;if(s&&await s.ready,!l&&bo){let m=it.get(i);if(m){let d=a(i);m.measurements=d,bo.observe(i),r&&o(d)}}}if(i){if(it.has(i))throw Error("useResizeObserver attemping to observe same element twice");c()}return()=>{i&&it.has(i)&&(bo.unobserve(i),it.delete(i),l=!0)}},[e,a]),(0,cr.useIsomorphicLayoutEffect)(()=>{let i=e.current,l=it.get(i);if(l){if(n.current!==t){n.current=t;let c=a(i);l.measurements=c}l.onResize=o}},[t,a,e,o])}var ve=require("react/jsx-runtime"),ye=require("react"),Ct=require("@salt-ds/core");var vo=require("react"),Sl={scrollToIndex:e=>{},scrollToItem:e=>{},scrollTo:e=>{}},Dn=({collectionHook:e,forwardedRef:t,scrollableRef:o,scrollIntoView:r})=>{let n=(0,vo.useMemo)(()=>({scrollToIndex:a=>{let i=e.data[a];i&&(r==null||r(i))},scrollToItem:a=>{let i=e.toCollectionItem(a);i&&(r==null||r(i))},scrollTo:a=>{o!=null&&o.current&&(o.current.scrollTop=a)}}),[e.data,e.toCollectionItem,r]);(0,vo.useImperativeHandle)(t,()=>o.current?n:Sl,[n])};var Rn=require("@salt-ds/core"),ue=require("react");var Nn=e=>Array.isArray(e)?e.length>0:e!=null,Pn=e=>Array.isArray(e)?e[0]:e;var dr=-2;function Hn(e,t,o){return t===zt||t===_t?o>0?o-1:o:o===null?0:o===e-1?o:o+1}var ur=(e,t)=>{let o=Pn(t);return o?e.indexOf(o):-1},Tl=(e,t,o,r)=>e===_t?r:e===fo?-1:t!==-1?t:o,An=e=>{let t=document.getElementById(e.id);if(t)return t.getBoundingClientRect();throw Error(`useKeyboardNavigation.getItemRect no element found for item #${e==null?void 0:e.id}`)},Cl=(e,t,o,r)=>{let{top:n}=t.getBoundingClientRect(),{scrollTop:a,clientHeight:i,scrollHeight:l}=e,c=o.length-1,s=Math.min(a+i,l-i);if(s!==a&&r<c){e.scrollTo(0,s);let m=r,d;do m+=1,d=An(o[m]);while(d.top<n&&m<c);return m}},wl=async(e,t,o,r)=>{let{top:n}=t.getBoundingClientRect(),{scrollTop:a,clientHeight:i}=e,l=Math.max(a-i,0);if(l!==a&&r>0)return e.scrollTo(0,l),new Promise(c=>{requestAnimationFrame(()=>{let s=r,m;do s-=1,m=An(o[s]);while(m.top>n&&s>0);c(s)})})},Ml=e=>!e.header&&!e.childNodes,kn=e=>Ml(e)||e.expanded!==void 0,On=({containerRef:e,defaultHighlightedIndex:t=-1,disableHighlightOnFocus:o,highlightedIndex:r,indexPositions:n,onHighlight:a,onKeyboardNavigation:i,restoreLastFocus:l,selected:c})=>{let s=(0,ue.useRef)(-1),[,m]=(0,ue.useState)({}),[d,u,g]=(0,Rn.useControlled)({controlled:r,default:t,name:"UseKeyboardNavigation"}),f=(0,ue.useCallback)((h,E=!1)=>{a==null||a(h),u(h),E&&(s.current=h)},[a,u]),p=(0,ue.useCallback)(async(h,E)=>{let{id:H}=n[E],O;if(H){let b=document.getElementById(H),{current:S}=e;b&&S&&(O=h.key===go?Cl(S,b,n,E):await wl(S,b,n,E))}return O!=null?O:E},[e,n]),x=(0,ue.useCallback)((h=Ut,E=h===Ut?-1:n.length)=>{if(n.length===0)return-1;{let H=ur(n,c),O=Tl(h,E,H,n.length),b=Hn(n.length,h,O);if(b===0&&h===zt&&!kn(n[0]))return E;for(;((h===Ut||h===fo)&&b<n.length||(h===zt||h===_t)&&b>0)&&!kn(n[b]);)b=Hn(n.length,h,b);return b}},[n,c]),y=(0,ue.useRef)(!1),D=(0,ue.useRef)(!1),I=h=>D.current=h,v=(0,ue.useCallback)(h=>{if(D.current)D.current=!1;else if(y.current=!0,n.length===0)f(dr);else if(d!==-1)m({});else if(l)if(s.current!==-1)f(s.current);else{let E=ur(n,c);f(E!==-1?E:0)}else if(Nn(c)){let E=ur(n,c);f(E)}else o!==!0&&f(x())},[o,d,n,x,l,c,f]),L=(0,ue.useCallback)(async h=>{let E=h.key===go||h.key===rr?await p(h,d):x(h.key,d);E!==d&&f(E,!0),i==null||i(h,E)},[d,x,p,i,f]),w=(0,ue.useCallback)(h=>{n.length>0&&gn(h)?(h.preventDefault(),h.stopPropagation(),y.current=!0,L(h)):ho(h)&&(y.current=!0)},[n,L]),M=(0,ue.useMemo)(()=>({onBlur:h=>{let E=h.target.closest(".saltList"),H=h.relatedTarget;E&&!(E!=null&&E.contains(H))&&(y.current=!1,u(-1),l||(s.current=-1))},onFocus:v,onKeyDown:w,onMouseDownCapture:()=>{y.current=!1,I(!0)},onMouseMove:()=>{y.current&&(y.current=!1)},onMouseLeave:()=>{y.current=!1,I(!1),f(-1)}}),[v,w,l,u,f]);return{focusVisible:y.current?d:-1,controlledHighlighting:g,highlightedIndex:d,setHighlightedIndex:f,keyboardNavigation:y,listProps:M,setIgnoreFocus:I}};function Fn(e,t){return Array.isArray(e)?e.includes(t):e===t}var at=require("react/jsx-runtime"),mr=require("react");var yo=require("@salt-ds/core");var St=require("react/jsx-runtime"),Bn=require("@salt-ds/core");var Bd=require("react");var Kn=`.saltHighlighter-highlight {
|
|
35
|
-
font-weight: var(--salt-text-fontWeight-strong); /* TODO: Check with design */
|
|
36
|
-
}
|
|
37
|
-
`;var El=(0,Bn.makePrefixer)("saltHighlighter"),$n=e=>{let{matchPattern:t,text:o=""}=e,r=ke();Re({testId:"salt-hightligher",css:Kn,window:r});let n=typeof t=="string"?new RegExp(`(${uo(t)})`,"gi"):t;return n===void 0?(0,St.jsx)(St.Fragment,{children:o}):(0,St.jsx)("span",{children:o.split(n).map((a,i)=>a.match(n)?(0,St.jsx)("strong",{className:El("highlight"),children:a},`${i}-${a}`):a)})};var Vn=`.saltListItem {
|
|
38
|
-
/* Color */
|
|
39
|
-
--list-item-text-color: var(--salt-text-primary-foreground);
|
|
40
|
-
--list-item-background: var(--saltList-item-background, var(--salt-selectable-background));
|
|
41
|
-
/* --list-item-selected-focus-outlineColor: var(--salt-color-white); TODO: Check token with design */
|
|
42
|
-
--list-item-text-color-active: var(--salt-text-primary-foreground);
|
|
43
|
-
--list-item-background-active: var(--salt-selectable-background-selected);
|
|
44
|
-
--list-item-alignItems: center;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.saltListItem.saltHighlighted {
|
|
48
|
-
--saltCheckbox-icon-stroke: var(--salt-selectable-borderColor-hover);
|
|
49
|
-
--list-item-background: var(--salt-selectable-background-hover);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.saltListItemHeader {
|
|
53
|
-
font-weight: var(--salt-text-fontWeight-strong); /* TODO: Check token with design */
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.saltListItemHeader[data-sticky] {
|
|
57
|
-
position: sticky;
|
|
58
|
-
top: 0;
|
|
59
|
-
z-index: 1;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.saltListItem {
|
|
63
|
-
color: var(--list-item-text-color);
|
|
64
|
-
cursor: var(--saltList-item-cursor, pointer);
|
|
65
|
-
background: var(--saltList-item-background, var(--list-item-background));
|
|
66
|
-
font-size: var(--salt-text-fontSize);
|
|
67
|
-
text-align: var(--salt-text-textAlign);
|
|
68
|
-
line-height: var(--salt-text-lineHeight);
|
|
69
|
-
height: var(--saltList-item-height, var(--list-item-height, auto));
|
|
70
|
-
/* Replaced border-bottom with margin. In design spec, the height of the items should not include gap */
|
|
71
|
-
margin-bottom: var(--list-item-gap);
|
|
72
|
-
padding: 0 var(--salt-size-unit);
|
|
73
|
-
left: 0;
|
|
74
|
-
right: 0;
|
|
75
|
-
display: flex;
|
|
76
|
-
position: relative;
|
|
77
|
-
align-items: var(--list-item-alignItems);
|
|
78
|
-
white-space: nowrap;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.saltListItem:last-child {
|
|
82
|
-
margin-bottom: 0px;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.saltListItem-checkbox {
|
|
86
|
-
--list-item-background-active: var(--salt-selectable-background);
|
|
87
|
-
--list-item-text-color-active: var(--salt-text-primary-foreground);
|
|
88
|
-
--list-item-text-padding: 0 0 0 var(--salt-size-unit);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.saltListItem[aria-selected="true"]:not(.saltListItem-checkbox) {
|
|
92
|
-
--list-item-background: var(--list-item-background-active);
|
|
93
|
-
color: var(--list-item-text-color-active);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.saltListItem.saltDisabled {
|
|
97
|
-
--list-item-text-color: var(--salt-text-primary-foreground-disabled);
|
|
98
|
-
cursor: var(--salt-selectable-cursor-disabled);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.saltListItem.saltFocusVisible {
|
|
102
|
-
outline-style: var(--salt-focused-outlineStyle);
|
|
103
|
-
outline-width: var(--salt-focused-outlineWidth);
|
|
104
|
-
outline-offset: -2px;
|
|
105
|
-
outline-color: var(--salt-focused-outlineColor);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.saltListItem.saltFocusVisible:after {
|
|
109
|
-
content: none;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.saltListItem[aria-selected="true"]:not(.saltListItem-checkbox).saltFocusVisible {
|
|
113
|
-
outline-color: var(--list-item-selected-focus-outlineColor);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.saltListItem-textWrapper {
|
|
117
|
-
flex: 1;
|
|
118
|
-
overflow: hidden;
|
|
119
|
-
padding: var(--list-item-text-padding, 0px);
|
|
120
|
-
white-space: nowrap;
|
|
121
|
-
text-overflow: ellipsis;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.saltListItem-proxy {
|
|
125
|
-
position: absolute !important;
|
|
126
|
-
visibility: hidden;
|
|
127
|
-
}
|
|
128
|
-
`;var qt=(0,yo.makePrefixer)("saltListItem"),pr=(0,mr.forwardRef)(function(t,o){return(0,at.jsx)("div",{"aria-hidden":!0,className:st(qt(),qt("proxy")),ref:o})}),Zt=(0,mr.forwardRef)(function({children:t,className:o,disabled:r,tabIndex:n,item:a,itemHeight:i,itemTextHighlightPattern:l,label:c,selectable:s,selected:m,showCheckbox:d,style:u,...g},f){let p=ke();Re({testId:"salt-list-item",css:Vn,window:p});let x=st(qt(),o,{saltDisabled:r,[qt("checkbox")]:d}),y=i!==void 0?{...u,height:i}:u;return(0,at.jsxs)("div",{className:x,...g,"aria-disabled":r||void 0,"aria-selected":m||void 0,ref:f,style:y,children:[d&&(0,at.jsx)(yo.CheckboxIcon,{"aria-hidden":!0,checked:m}),t&&typeof t!="string"?t:l==null?(0,at.jsx)("span",{className:qt("textWrapper"),children:c||t}):(0,at.jsx)($n,{matchPattern:l,text:c||t})]})});var Me=require("react"),im=require("@salt-ds/core");var fr=require("react");var Ll={},Dl=e=>Array.isArray(e.childNodes),Nl=e=>e.closest("[data-toggle],[aria-expanded]").dataset.toggle==="true",zn=({collapsibleHeaders:e,collectionHook:t,highlightedIdx:o,onToggle:r})=>{let n=(0,fr.useCallback)(l=>{if(l.key===mn||l.key===or){let c=t.data[o];c&&c.expanded===!1&&c.value&&(l.preventDefault(),t.expandGroupItem(c),r==null||r(c.value))}if(l.key===dn||l.key===or){let c=t.data[o];c&&c.expanded&&c.value&&(l.preventDefault(),t.collapseGroupItem(c),r==null||r(c.value))}},[t.collapseGroupItem,t.data,t.expandGroupItem,o]),i={onClick:(0,fr.useCallback)(l=>{console.log(`useCollapsibleGroups idx=${o}`);let c=t.data[o];console.log(l.target,l.currentTarget),c&&Dl(c)&&Nl(l.target)&&(l.stopPropagation(),l.preventDefault(),c.expanded===!1&&c.value?(t.expandGroupItem(c),r==null||r(c.value)):c.expanded===!0&&c.value&&(t.collapseGroupItem(c),r==null||r(c.value)))},[t.collapseGroupItem,t.data,t.expandGroupItem,o]),onKeyDown:n};return e?i:Ll};function Pl(e){if(e){let t=e.dataset.idx;if(t)return parseInt(t,10);if(t=e.ariaPosInSet)return parseInt(t,10)-1}return-1}var Hl=e=>e.closest("[data-idx],[aria-posinset]"),Un=e=>Pl(Hl(e));var Wn=require("@salt-ds/core"),pe=require("react");var kl=["Enter"," "],gr=e=>e&&e.disabled!==!0&&e.selectable!==!1,_n=(e,t)=>{var o,r;return((o=e.index)!=null?o:0)-((r=t.index)!=null?r:0)},Gn=({defaultSelected:e,disableSelection:t=!1,highlightedIdx:o,indexPositions:r,label:n="",onSelect:a,onSelectionChange:i,selected:l,selectionStrategy:c,selectionKeys:s=kl,tabToSelect:m})=>{let d=c==="deselectable",u=c==="multiple",g=c==="extended",f=(0,pe.useRef)(-1),p=(0,pe.useCallback)(S=>s.includes(S.key),[s]),x=(0,pe.useCallback)(()=>u||g?[]:null,[u,g]),[y,D]=(0,Wn.useControlled)({controlled:l,default:e!=null?e:x(),name:"UseSelection",state:"selected"}),I=(0,pe.useCallback)(S=>Array.isArray(y)?y.includes(S):y===S,[y]),v=(0,pe.useCallback)(S=>S,[]),L=(0,pe.useCallback)(S=>I(S)?null:S,[I]),w=(0,pe.useCallback)(S=>{let N=I(S)?y.filter(P=>P!==S):y.concat(S);return N.sort(_n),N},[I,y]),M=(0,pe.useCallback)((S,N)=>{let P=N?y:[],[k]=y.slice(-1),C=k?r.indexOf(k):0,T=Math.min(S,C),R=Math.max(S,C),A=r.slice(T,R+1),F=[...new Set([...P,...A])];return F.sort(_n),F},[r,y]),h=(0,pe.useCallback)((S,N,P,k,C)=>{let T;u?T=w(P):g?C&&!k?T=w(P):k?T=M(N,C):T=[P]:d?T=L(P):T=v(P),T!==y&&D(T),a==null||a(S,P),T!==y&&i&&i(S,T)},[u,g,d,y,a,w,M,L,v,D,i]),E=(0,pe.useCallback)(S=>{let N=r[o];gr(N)&&(p(S)||m&&S.key==="Tab")&&(S.key!=="Tab"&&S.preventDefault(),h(S,o,N,!1,S.ctrlKey||S.metaKey),g&&(f.current=o))},[r,o,p,m,h,g]),H=(0,pe.useCallback)((S,N)=>{if(g&&S.shiftKey){let P=r[N];gr(P)&&h(S,N,P,!0)}},[g,r,h]);return{listHandlers:{onClick:(0,pe.useCallback)(S=>{let N=r[o];!t&&gr(N)&&(S.preventDefault(),S.stopPropagation(),h(S,o,N,S.shiftKey,S.ctrlKey||S.metaKey),g&&(f.current=o))},[t,g,o,r,h]),onKeyDown:E,onKeyboardNavigation:H},selected:y,setSelected:D}};var lt=require("react");var qn=({disableTypeToSelect:e,highlightedIdx:t,highlightItemAtIndex:o,typeToNavigate:r,items:n,applyIncrementalSearch:a=!0})=>{let i=(0,lt.useRef)(null),l=(0,lt.useRef)(""),c=(0,lt.useRef)(-1),s=(0,lt.useCallback)(d=>{if(d||!a){let u=new RegExp(`^${l.current}`,"i"),g=n.findIndex(({label:f},p)=>p>c.current&&u.test(f));g===-1&&(g=n.findIndex(({label:f},p)=>p<=c.current&&u.test(f))),g!==-1&&o(g)}else l.current="",i.current=null,c.current=-1},[a,o,n]),m=(0,lt.useCallback)(d=>{let u=c.current!==-1;(ho(d)||u&&d.key===pn)&&r&&(d.preventDefault(),d.stopPropagation(),(c.current===-1||d.key===l.current)&&(c.current=t),i.current!==null&&(clearTimeout(i.current),i.current=null),d.key!==l.current&&(l.current+=d.key),a&&s(!0),i.current=window.setTimeout(()=>{s()},100))},[r,a,t,s]);return{onKeyDown:e?void 0:m}};var Ne=require("react"),Yn=require("@salt-ds/core"),rm=require("react/jsx-runtime");var Zn=["height"],Rl=["height","scrollHeight"],Al=[],Jn={containerOnly:[Rl,Al],withContent:[Zn,Zn]},Ol=e=>e?Jn.containerOnly:Jn.withContent,jn={current:null},Fl=(e,t)=>{let{transform:o="none"}=getComputedStyle(e);if(o.startsWith("matrix")){let r=o.lastIndexOf(",");return parseInt(o.slice(r+1))}else{let r=e.offsetParent;if(r===t||t===null)return e.offsetTop;{let n=e.offsetTop;for(;r!==null&&r!==t;)n+=r.offsetTop,r=r.offsetParent;return n}}},Xn=({containerRef:e,contentRef:t=jn,highlightedIdx:o=-1,indexPositions:r,stickyHeaders:n=!1})=>{let a=(0,Ne.useRef)(!1),i=(0,Ne.useRef)({height:0,contentHeight:0}),l=(0,Ne.useCallback)(p=>{a.current=!0,e.current&&(e.current.scrollTop=p),setTimeout(()=>{a.current=!1})},[]),c=(0,Ne.useCallback)(()=>l(0),[l]),s=(0,Ne.useCallback)(()=>{l(i.current.contentHeight-i.current.height)},[l]),m=(0,Ne.useCallback)(p=>{let x=t.current||e.current;if(p.id){let y=document.getElementById(p.id);if(y&&e.current){let{height:D}=i.current,I=y.ariaExpanded&&y.firstChild?y.firstChild:y,v=n?36:0,L=Fl(I,x),w=I.offsetHeight,{scrollTop:M}=e.current,h=M+v,E=h+D-v;if(L+w>E||L<h){let H=L+w>E?M+(L+w)-E:L-v;l(H)}}}},[e,t,l,n]);(0,Yn.useIsomorphicLayoutEffect)(()=>{let{height:p,contentHeight:x}=i.current,y=r[o];if(x>p&&y){let[D]=r,[I]=r.slice(-1);y===D?c():y===I?s():m(r[o])}},[o,r,m,s,c]);let d=(0,Ne.useCallback)(({height:p,scrollHeight:x})=>{typeof p=="number"&&(i.current.height=p),typeof x=="number"&&(i.current.contentHeight=x)},[]),u=(0,Ne.useCallback)(({height:p})=>{typeof p=="number"&&(i.current.contentHeight=p)},[]),[g,f]=Ol(t===jn);return Gt(e,g,d,!0),Gt(t,f,u,!0),{isScrolling:a,scrollIntoView:m}};var Qn=({collapsibleHeaders:e,collectionHook:t,containerRef:o,contentRef:r,defaultHighlightedIndex:n,defaultSelected:a,disabled:i,disableAriaActiveDescendant:l,disableHighlightOnFocus:c,disableTypeToSelect:s,highlightedIndex:m,label:d="",listHandlers:u,onSelect:g,onSelectionChange:f,onHighlight:p,onKeyboardNavigation:x,onKeyDown:y,restoreLastFocus:D,selected:I,selectionStrategy:v,selectionKeys:L,stickyHeaders:w,tabToSelect:M})=>{let h=(0,Me.useRef)(I||a),E=($,_)=>{var X,U;(U=(X=R.listHandlers).onKeyboardNavigation)==null||U.call(X,$,_),x==null||x($,_)},H=(0,Me.useCallback)(($,_)=>{g&&((0,Me.isValidElement)(_.value)?g($,_.label):_.value!==null&&g($,_.value))},[g]),O=(0,Me.useCallback)(($,_)=>{f&&f($,Array.isArray(_)?_.map(X=>(0,Me.isValidElement)(X.value)?X.label:X.value):_&&((0,Me.isValidElement)(_.value)?_.label:_.value))},[f]),{highlightedIndex:b,listProps:{onKeyDown:S,onMouseMove:N,...P},setHighlightedIndex:k,...C}=On({containerRef:o,defaultHighlightedIndex:n,disableHighlightOnFocus:c,highlightedIndex:m,indexPositions:t.data,label:d,onHighlight:p,onKeyboardNavigation:E,restoreLastFocus:D,selected:h.current}),T=zn({collapsibleHeaders:e,highlightedIdx:b,collectionHook:t}),R=Gn({defaultSelected:a,highlightedIdx:b,indexPositions:t.data,label:d,onSelect:H,onSelectionChange:O,selected:I,selectionStrategy:v,selectionKeys:L,tabToSelect:M}),{onKeyDown:A}=qn({disableTypeToSelect:s,highlightedIdx:b,highlightItemAtIndex:k,typeToNavigate:!0,items:t.data}),F=(0,Me.useCallback)($=>{var _,X,U;$.defaultPrevented||A==null||A($),S($),$.defaultPrevented||(X=(_=R.listHandlers).onKeyDown)==null||X.call(_,$),$.defaultPrevented||(U=T==null?void 0:T.onKeyDown)==null||U.call(T,$),$.defaultPrevented||y==null||y($)},[T,S,y,R.listHandlers,A]),{isScrolling:V,scrollIntoView:G}=Xn({containerRef:o,contentRef:r,highlightedIdx:b,indexPositions:t.data,stickyHeaders:w}),z=(0,Me.useCallback)($=>{if(!V.current&&!i){N();let _=Un($.target);if(_!==b){let X=t.data[_];!X||X.disabled?k(-1):k(_)}}},[V,i,k,N,b,t.data]),q=()=>{var $;return b===void 0||b===-1||l||($=t.data[b])==null?void 0:$.id};h.current=R.selected;let K={"aria-activedescendant":q(),onBlur:P.onBlur,onFocus:P.onFocus,onKeyDown:F,onMouseDownCapture:P.onMouseDownCapture,onMouseLeave:P.onMouseLeave},B=u||{onClick:R.listHandlers.onClick,onMouseMove:z};return{focusVisible:C.focusVisible,controlledHighlighting:C.controlledHighlighting,highlightedIndex:b,keyboardNavigation:C.keyboardNavigation,listHandlers:B,listItemHeaderHandlers:T,listControlProps:K,scrollIntoView:G,selected:R.selected,setHighlightedIndex:k,setIgnoreFocus:C.setIgnoreFocus,setSelected:R.setSelected}};var Tt=require("react"),fm=require("@salt-ds/core"),gm=require("react/jsx-runtime");var es=({borderless:e,displayedItemCount:t,getItemHeight:o,height:r,itemCount:n,itemGapSize:a,itemHeight:i,rowHeightRef:l})=>{let[c,s]=(0,Tt.useState)(36),m=(0,Tt.useMemo)(()=>{let u=e?0:2,g=i!=null?i:c,f=Math.min(t,n)||t;return typeof o=="function"?u+=Array(f).fill(0).reduce((p,x,y)=>p+o(y)+a,0)-a:u+=f*Number(g)+(f-1)*a,isNaN(u)?void 0:u},[e,t,o,n,a,i,c]),d=(0,Tt.useCallback)(({height:u})=>{s(u)},[]);return Gt(l,En,d,!0),{preferredHeight:m}};var ts=`.saltList {
|
|
129
|
-
--list-background: var(--salt-container-primary-background);
|
|
130
|
-
--list-borderStyle: var(--salt-container-borderStyle);
|
|
131
|
-
--list-borderWidth: var(--salt-size-border);
|
|
132
|
-
--list-height: auto;
|
|
133
|
-
--list-item-height: var(--salt-size-stackable);
|
|
134
|
-
--list-item-gap: 0px;
|
|
135
|
-
--list-maxHeight: 100%;
|
|
136
|
-
|
|
137
|
-
background: var(--list-background);
|
|
138
|
-
border-color: var(--salt-container-primary-borderColor);
|
|
139
|
-
border-style: var(--list-borderStyle);
|
|
140
|
-
border-width: var(--list-borderWidth);
|
|
141
|
-
height: var(--saltList-height, var(--list-height));
|
|
142
|
-
max-height: var(--list-maxHeight);
|
|
143
|
-
outline: none;
|
|
144
|
-
overflow-y: auto;
|
|
145
|
-
position: relative;
|
|
146
|
-
user-select: none;
|
|
147
|
-
width: var(--saltList-width, auto);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
.saltList-borderless {
|
|
151
|
-
--list-borderStyle: none;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/* virtualised list */
|
|
155
|
-
.saltList-viewport {
|
|
156
|
-
--list-item-height: 30px;
|
|
157
|
-
max-height: calc(var(--list-maxHeight) - 2 * var(--list-borderWidth));
|
|
158
|
-
overflow: auto;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.saltListItemHeader {
|
|
162
|
-
--saltList-item-background: var(--list-item-header-background);
|
|
163
|
-
color: var(--list-item-header-color);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.saltListItemHeader[data-sticky="true"] {
|
|
167
|
-
--saltList-item-background: var(--list-background);
|
|
168
|
-
position: sticky;
|
|
169
|
-
top: 0;
|
|
170
|
-
z-index: 1;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.saltList-collapsible .saltListItemHeader:after {
|
|
174
|
-
border-width: var(--checkbox-borderWidth);
|
|
175
|
-
border-color: var(--checkbox-borderColor);
|
|
176
|
-
content: var(--list-item-header-twisty-content);
|
|
177
|
-
-webkit-mask: var(--list-svg-chevron-down) center center/12px 12px no-repeat;
|
|
178
|
-
mask: var(--list-svg-chevron-down) center center/12px 12px no-repeat;
|
|
179
|
-
background: var(--list-item-header-twisty-color);
|
|
180
|
-
height: 12px;
|
|
181
|
-
left: var(--list-item-header-twisty-left);
|
|
182
|
-
right: var(--list-item-header-twisty-right);
|
|
183
|
-
margin-top: -8px;
|
|
184
|
-
position: absolute;
|
|
185
|
-
top: var(--list-item-header-twisty-top);
|
|
186
|
-
transition: transform 0.3s;
|
|
187
|
-
width: 12px;
|
|
188
|
-
}
|
|
189
|
-
.saltListItemHeader[aria-expanded="false"]:after {
|
|
190
|
-
transform: rotate(-90deg);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/* Selection */
|
|
194
|
-
|
|
195
|
-
.saltList-scrollingContentContainer {
|
|
196
|
-
box-sizing: inherit;
|
|
197
|
-
position: relative;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.saltList-virtualized .saltListItem {
|
|
201
|
-
line-height: 30px;
|
|
202
|
-
position: absolute;
|
|
203
|
-
top: 0;
|
|
204
|
-
left: 0;
|
|
205
|
-
right: 0;
|
|
206
|
-
will-change: transform;
|
|
207
|
-
}
|
|
208
|
-
.saltList.saltFocusVisible:after {
|
|
209
|
-
inset: 2px;
|
|
210
|
-
}
|
|
211
|
-
`;var Kl="No data to display",Jt=(0,Ct.makePrefixer)("saltList"),hr=(0,ye.forwardRef)(function({ListItem:t=Zt,ListPlaceholder:o,borderless:r,children:n,className:a,collapsibleHeaders:i=!1,defaultHighlightedIndex:l,defaultSelected:c,disabled:s=!1,disableFocus:m=!1,disableTypeToSelect:d,displayedItemCount:u=10,emptyMessage:g,focusVisible:f,getItemHeight:p,getItemId:x,height:y,highlightedIndex:D,id:I,itemGapSize:v=0,itemHeight:L,itemTextHighlightPattern:w,itemToString:M=vt,listHandlers:h,maxHeight:E,maxWidth:H,minHeight:O,minWidth:b,onSelect:S,onSelectionChange:N,onHighlight:P,restoreLastFocus:k,selected:C,selectionStrategy:T,checkable:R=T==="multiple",scrollingApiRef:A,selectionKeys:F,showEmptyMessage:V=!1,source:G,style:z,stickyHeaders:q,tabToSelect:K,width:B,...$},_){let X=ke();Re({testId:"salt-list",css:ts,window:X});let U=(0,Ct.useIdMemo)(I),Z=(0,ye.useRef)(null),Q=(0,ye.useRef)(null),ee=(0,ye.useRef)(null),W=Mn({id:U,label:"List",source:G,children:n,options:{collapsibleHeaders:i,getItemId:x,itemToString:M}}),{preferredHeight:le}=es({borderless:r,displayedItemCount:u,getItemHeight:p,height:y,itemCount:W.data.length,itemGapSize:v,itemHeight:L,rowHeightRef:ee}),{focusVisible:Pe,highlightedIndex:Ce,listControlProps:Ve,listHandlers:ze,listItemHeaderHandlers:Qe,scrollIntoView:Ue,selected:_e}=Qn({collapsibleHeaders:i,collectionHook:W,containerRef:Z,contentRef:Q,defaultHighlightedIndex:l,defaultSelected:W.itemToCollectionItem(c),disabled:s,disableTypeToSelect:d,highlightedIndex:D,label:U,listHandlers:h,onSelect:S,onSelectionChange:N,onHighlight:P,restoreLastFocus:k,selected:W.itemToCollectionItem(C),selectionStrategy:T,selectionKeys:F,stickyHeaders:q,tabToSelect:K});Dn({collectionHook:W,forwardedRef:A,scrollableRef:Z,scrollIntoView:Ue});let We=f!=null?f:Pe,De=function(se,be,me,Ie){let ot=(0,ye.createElement)(t,{...Qe,className:st("saltListItemHeader",{focusVisible:i&&We===se.value}),"aria-expanded":Ie,"data-idx":i?se.value:void 0,"data-highlighted":se.value===Ce||void 0,"data-sticky":q,"data-selectable":!1,id:be,key:`header-${se.value}`,label:me});return se.value+=1,ot},Rt=p===void 0?()=>L:p;function bt(tt,se,be){var me;let{disabled:Ie,value:ot,id:Ot,label:Go}=se,Ft=(0,ye.isValidElement)(ot),io={className:st({saltHighlighted:be.value===Ce,saltFocusVisible:We===be.value}),disabled:Ie||s,id:Ot,item:Ft?void 0:(me=se==null?void 0:se.value)!=null?me:void 0,itemHeight:Rt(be.value),itemTextHighlightPattern:w,key:Ot,"data-idx":be.value,label:Go,role:"option",selected:Fn(_e,se),showCheckbox:R};tt.push(Ft?(0,ye.cloneElement)(ot,io):(0,ve.jsx)(t,{...io})),be.value+=1}let we=function(se,be,me){let{count:Ie=0,id:ot,expanded:Ot,label:Go=""}=be[me.value],Ft=De(me,ot,Go,Ot),io=Ot!==!1?[Ft].concat(et(be,me,me.value+Ie)||[]):Ft;se.push((0,ve.jsx)("div",{role:"group",children:io},ot))},et=(tt,se={value:0},be=tt.length)=>{let me=[];for(;se.value<be;){let Ie=tt[se.value];Ie.header?me.push(De(se,Ie.id,Ie.label,Ie.expanded===!1)):Ie.childNodes?we(me,tt,se):bt(me,Ie,se)}return me};function At(){return g||V?(0,ve.jsx)("span",{className:Jt("empty-message"),children:g!=null?g:Kl}):null}let Uo=()=>{if(W.data.length)return et(W.data);At()},_o="auto",Wo={"--list-item-gap":v?`${v}px`:void 0,minWidth:b,minHeight:O,width:B!=null?B:"100%",height:y!=null?y:"100%",maxWidth:H!=null?H:B,maxHeight:E!=null?E:le};return(0,ve.jsxs)("div",{"aria-multiselectable":T==="multiple"||T==="extended"||T==="extended-multi-range"||void 0,...$,...ze,...Ve,className:st(Jt(),a,{[Jt("borderless")]:r,saltDisabled:s,[Jt("collapsible")]:i,saltFocusVisible:Ce===dr}),id:`${U}`,ref:(0,Ct.useForkRef)(Z,_),role:"listbox",style:{...z,...Wo},tabIndex:s||m?void 0:0,children:[(0,ve.jsx)(pr,{ref:ee}),W.data.length===0&&o!==void 0?(0,ve.jsx)(ve.Fragment,{children:(0,ve.jsx)(o,{})}):(0,ve.jsx)("div",{className:Jt("scrollingContentContainer"),ref:Q,style:{height:_o},children:Uo()})]})});var Ks=require("@salt-ds/core"),Tc=J(require("classnames")),Dr=require("react");var Qt=require("react"),Os=J(require("react-dom"));var os=J(require("react-dom")),rs=J(require("classnames")),Bl=1,$l=({className:e,dataMode:t,x:o=0,y:r=0,win:n=window})=>{let a=n.document.createElement("div");return a.className=(0,rs.default)(`vuuPopup ${Bl++}`,e),a.style.cssText=`left:${o}px; top:${r}px;`,t&&(a.dataset.mode=t),n.document.body.appendChild(a),a},ns=e=>$l(e),So=(e,t,o,r,n)=>{t.style.cssText=`left:${o}px; top:${r}px;position: absolute;`,os.render(e,t,n)};var xr=J(require("react")),Vl=J(require("classnames"));var br=require("react/jsx-runtime");var zl=require("react"),Ul=J(require("classnames")),_l=require("react/jsx-runtime");var Ge=J(require("react")),cs=require("@vuu-ui/vuu-layout");var ss=J(require("react")),ct=require("react/jsx-runtime"),To=class extends ss.default.Component{constructor(t){super(t),this.state={errorMessage:null}}static getDerivedStateFromError(t){return{errorMessage:t.message}}componentDidCatch(t,o){console.log(t,o)}render(){return this.state.errorMessage?(0,ct.jsxs)(ct.Fragment,{children:[(0,ct.jsx)("h1",{children:"Something went wrong."}),(0,ct.jsx)("p",{children:this.state.errorMessage})]}):this.props.children}};var as=require("react/jsx-runtime"),is=()=>(0,as.jsx)("div",{className:"hwLoader",children:"loading"});var ls=async e=>{let t=new CSSStyleSheet;return fetch(e).then(o=>o.text()).then(o=>t.replace(o))};var jt=require("react/jsx-runtime"),Co=new Map,Wl=e=>((0,Ge.useEffect)(()=>()=>{Co.delete(e)},[e]),Co.has(e)||Co.set(e,Ge.default.lazy(()=>import(e))),Co.get(e));function Gl({url:e,css:t,params:o,...r}){console.log("Feature render",{css:t,url:e,props:r}),(0,Ge.useEffect)(()=>(console.log("%cFeature mount","color: green;"),()=>{console.log("%cFeature unmount","color:red;")}),[]),t&&ls(t).then(a=>{document.adoptedStyleSheets=[...document.adoptedStyleSheets,a]});let n=Wl(e);return(0,jt.jsx)(To,{children:(0,jt.jsx)(Ge.Suspense,{fallback:(0,jt.jsx)(is,{}),children:(0,jt.jsx)(n,{...r,...o})})})}var us=Ge.default.memo(Gl);us.displayName="Feature";(0,cs.registerComponent)("Feature",us,"view");var ql=require("react/jsx-runtime");var ds=require("react"),re=require("react/jsx-runtime"),ms=(0,ds.memo)(()=>(0,re.jsxs)("svg",{width:"44",height:"45",viewBox:"0 0 44 45",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,re.jsxs)("g",{clipPath:"url(#clip0_217_6990)",children:[(0,re.jsx)("path",{d:"M39.8642 15.5509L35.9196 7.58974L34.3369 6.85464L24.6235 22.0825L39.1628 30.618L42.3152 25.6347L39.8642 15.5509Z",fill:"url(#paint0_linear_217_6990)"}),(0,re.jsx)("path",{d:"M42.6246 24.8716C41.9199 25.9157 40.9625 26.824 39.767 27.4905C38.424 28.2396 36.9563 28.597 35.5081 28.597C32.7541 28.597 30.0715 27.3094 28.4466 24.9855L15.772 3.90967L15.7655 3.9206C13.3615 0.137431 8.25372 -1.13143 4.24754 1.10507C0.178173 3.37435 -1.20852 8.39359 1.14854 12.3125L18.3445 40.9095C19.1108 42.1846 20.1816 43.1834 21.4144 43.8764C21.4241 43.8826 21.4338 43.8889 21.4435 43.8951C21.4484 43.8982 21.4549 43.9013 21.4597 43.9045C22.0332 44.2228 22.6423 44.471 23.2725 44.6536C23.3194 44.6677 23.368 44.6817 23.415 44.6942C23.6418 44.7551 23.8702 44.8097 24.1019 44.8534C24.1456 44.8612 24.1894 44.8659 24.2331 44.8737C24.4194 44.9049 24.6073 44.9314 24.7952 44.9501C24.8698 44.9579 24.9443 44.9658 25.0188 44.9704C25.2342 44.9876 25.4497 44.9985 25.6668 45.0001C25.6781 45.0001 25.6895 45.0001 25.6992 45.0001C25.7024 45.0001 25.704 45.0001 25.7073 45.0001C25.7105 45.0001 25.7121 45.0001 25.7154 45.0001C25.9503 45.0001 26.1868 44.9876 26.4217 44.9689C26.4751 44.9642 26.5286 44.9595 26.5837 44.9533C26.8137 44.9299 27.0438 44.9002 27.2738 44.8596C27.277 44.8596 27.2803 44.8596 27.2835 44.8596C27.5362 44.8144 27.7889 44.7551 28.0384 44.6864C28.0546 44.6817 28.0692 44.677 28.0854 44.6723C28.4483 44.5709 28.8063 44.4445 29.1594 44.2931C29.1659 44.29 29.174 44.2868 29.1805 44.2837C29.4494 44.1682 29.7151 44.0418 29.9759 43.8967C30.24 43.75 30.491 43.5908 30.7308 43.4206C30.9398 43.2739 31.1407 43.1179 31.3367 42.9524C31.5748 42.7495 31.8 42.5373 32.009 42.3141C32.1661 42.1471 32.3168 41.9723 32.4609 41.7913C32.5079 41.732 32.5517 41.6711 32.5954 41.6118C32.6942 41.4807 32.7882 41.3465 32.8789 41.2091C32.9259 41.1373 32.9728 41.0671 33.0182 40.9953C33.036 40.9672 33.0555 40.9407 33.0717 40.9126L42.7153 24.8763H42.6214L42.6246 24.8716Z",fill:"url(#paint1_linear_217_6990)"}),(0,re.jsx)("path",{d:"M42.8402 16.4218L42.1112 15.2232L38.9636 9.58433L37.504 7.19644C37.2286 6.56123 36.579 6.11331 35.8176 6.11331C34.8083 6.11331 33.9919 6.90147 33.9919 7.87223C33.9919 8.20154 34.0907 8.50432 34.2543 8.76808L34.2349 8.78056L39.9048 18.0808C40.5884 19.2186 40.7715 20.5437 40.4199 21.8141C40.0684 23.0845 39.226 24.1458 38.045 24.806C37.2675 25.2398 36.3846 25.4693 35.4936 25.4693C33.6727 25.4693 31.9766 24.5281 31.0662 23.0143L22.9161 9.63271H22.9323L19.4899 3.90958L19.4834 3.92051C19.4235 3.8253 19.3538 3.73947 19.2907 3.64738L19.1935 3.48663C19.1935 3.48663 19.1854 3.49131 19.1821 3.49443C17.5654 1.27666 14.9799 0.0390178 12.3118 0.00936427V0H7.91199V0.02185C10.9851 -0.184164 14.0582 1.23296 15.7656 3.92051L15.7721 3.90958L28.4451 24.987C30.0699 27.3093 32.7542 28.5985 35.5066 28.5985C36.9548 28.5985 38.4225 28.2426 39.7655 27.4919C40.961 26.8255 41.9168 25.9156 42.6231 24.8731H42.717L42.6846 24.9261C43.1366 24.2347 43.4833 23.4731 43.7068 22.6615C44.2916 20.5452 43.9871 18.3352 42.8369 16.4234L42.8402 16.4218Z",fill:"#F37880"}),(0,re.jsxs)("g",{opacity:"0.86",children:[(0,re.jsx)("path",{d:"M34.2332 8.78212L39.9031 18.0824C40.5868 19.2202 40.7698 20.5452 40.4183 21.8156C40.2044 22.5897 39.8059 23.2858 39.2616 23.8617C39.9744 23.2343 40.4879 22.4243 40.7423 21.5035C41.0938 20.2331 40.9107 18.908 40.2271 17.7703L34.5572 8.46998L34.5767 8.4575C34.413 8.19374 34.3142 7.89096 34.3142 7.56165C34.3142 7.15586 34.4584 6.78285 34.6982 6.48476C34.2672 6.80626 33.9902 7.30881 33.9902 7.87379C33.9902 8.2031 34.0891 8.50588 34.2527 8.76964L34.2332 8.78212Z",fill:"white"}),(0,re.jsx)("path",{d:"M42.6917 24.9169L42.6863 24.9256C42.6863 24.9256 42.6899 24.9187 42.6935 24.9152C42.6935 24.9152 42.6935 24.9152 42.6935 24.9169H42.6917Z",fill:"white"}),(0,re.jsx)("path",{d:"M40.0911 27.1798C38.7481 27.9289 37.2804 28.2863 35.8322 28.2863C33.0782 28.2863 30.3955 26.9988 28.7707 24.6749L16.0961 3.59744L16.0896 3.60837C14.9281 1.78077 13.1364 0.543128 11.1422 0H7.91199V0.02185C10.9851 -0.184164 14.0582 1.23296 15.7656 3.92051L15.7721 3.90958L28.4451 24.987C30.0699 27.3093 32.7542 28.5985 35.5066 28.5985C36.9548 28.5985 38.4225 28.2426 39.7655 27.4919C40.4815 27.0924 41.1084 26.6055 41.6511 26.0561C41.1862 26.479 40.6662 26.8583 40.0894 27.1798H40.0911Z",fill:"white"})]})]}),(0,re.jsxs)("defs",{children:[(0,re.jsxs)("linearGradient",{id:"paint0_linear_217_6990",x1:"24.6235",y1:"18.7363",x2:"42.3152",y2:"18.7363",gradientUnits:"userSpaceOnUse",children:[(0,re.jsx)("stop",{stopColor:"#4906A5"}),(0,re.jsx)("stop",{offset:"1",stopColor:"#D3423A"})]}),(0,re.jsxs)("linearGradient",{id:"paint1_linear_217_6990",x1:"-2.35794e-05",y1:"22.5009",x2:"42.7186",y2:"22.5009",gradientUnits:"userSpaceOnUse",children:[(0,re.jsx)("stop",{stopColor:"#7C06A5"}),(0,re.jsx)("stop",{offset:"1",stopColor:"#D3423A"})]}),(0,re.jsx)("clipPath",{id:"clip0_217_6990",children:(0,re.jsx)("rect",{width:"44",height:"45",fill:"white"})})]})]}));ms.displayName="VuuLogo";var vr=require("@vuu-ui/vuu-layout");var Ql=J(require("classnames")),yr=require("react");var Ae=require("react"),ps=J(require("classnames")),gs=require("react/jsx-runtime"),Zl="medium",Jl="salt-theme",jl="light",Ir=(0,Ae.createContext)({density:"high",theme:"salt",themeMode:"light"}),Yl=["salt","salt-density-high","light"],wt=()=>{let e=(0,Ae.useContext)(Ir);return e?[`${e.theme}-theme`,`salt-density-${e.density}`,e.themeMode]:Yl},Xl=(e,t,o,r)=>{var n;return(0,Ae.isValidElement)(e)?(0,Ae.cloneElement)(e,{className:(0,ps.default)((n=e.props)==null?void 0:n.className,`${t}-theme`,`${t}-density-${r}`),"data-mode":o}):(console.warn(`
|
|
212
|
-
ThemeProvider can only apply CSS classes for theming to a single nested child element of the ThemeProvider.
|
|
213
|
-
Wrap elements with a single container`),e)},fs=({applyThemeClasses:e=!1,children:t,theme:o,themeMode:r,density:n})=>{var u,g,f;let{density:a,themeMode:i,theme:l}=(0,Ae.useContext)(Ir),c=(u=n!=null?n:a)!=null?u:Zl,s=(g=r!=null?r:i)!=null?g:jl,m=(f=o!=null?o:l)!=null?f:Jl,d=e?Xl(t,m,s,c):t;return(0,gs.jsx)(Ir.Provider,{value:{themeMode:s,density:c,theme:m},children:d})};fs.displayName="ThemeProvider";var hs=require("react/jsx-runtime");var ec=require("react"),wo=require("@salt-ds/core");var Is=require("react/jsx-runtime");var vs=require("@vuu-ui/vuu-utils"),tc=()=>{let e=(0,vs.getCookieValue)("vuu-auth-mode");return e!=null?e:""};var oc=()=>tc()==="login"?"login.html":"demo.html",rc=(e=oc())=>{window.location.href=e},ys=e=>{document.cookie="vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",document.cookie="vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",rc(e)};var Yt=require("react"),nc=J(require("classnames")),sc=require("@salt-ds/core"),ic=require("@salt-ds/core"),Sr=require("@vuu-ui/vuu-data"),Tr=require("@vuu-ui/vuu-utils");var Ss=require("react/jsx-runtime");var Ic=require("@vuu-ui/vuu-data"),vc=J(require("classnames")),Er=require("react");var Cr=require("react");var ks=require("@vuu-ui/vuu-layout");var pc=require("react");var uc=require("@salt-ds/core");var Cs=require("@vuu-ui/vuu-utils");var ws=require("@salt-ds/core");var Oe=require("react");var Ts=async e=>await fetch(`api/vui/${e.username}`,{}).then(o=>o.ok?o.json():null).catch(()=>{console.log("error getting history")});var qe=require("react/jsx-runtime"),ac=({lastUpdate:e},{lastUpdate:t})=>t===e?0:t<e?-1:1,lc=e=>(0,qe.jsx)(Zt,{...e}),cc=(0,Oe.forwardRef)(function({loginUrl:t,onNavigate:o,user:r,layoutId:n="latest"},a){let[i,l]=(0,Oe.useState)([]);(0,Oe.useEffect)(()=>{async function d(){let g=(await Ts(r)).filter(f=>f.id!=="latest").sort(ac).map(({id:f,lastUpdate:p})=>({lastUpdate:p,id:f,label:`Saved at ${(0,Cs.formatDate)(new Date(p),"kk:mm:ss")}`}));console.log({sortedHistory:g}),l(g)}d()},[r]);let c=(0,Oe.useCallback)((d,u)=>{u&&o(u.id)},[o]),s=(0,Oe.useCallback)(()=>{ys(t)},[t]),m=i.length===0?null:n==="latest"?i[0]:i.find(d=>d.id===n);return(0,qe.jsxs)("div",{className:"vuuUserPanel",ref:a,children:[(0,qe.jsx)(hr,{ListItem:lc,className:"vuuUserPanel-history",onSelect:c,selected:m,source:i}),(0,qe.jsx)("div",{className:"vuuUserPanel-buttonBar",children:(0,qe.jsxs)(ws.Button,{"aria-label":"logout",onClick:s,children:[(0,qe.jsx)(tr,{})," Logout"]})})]})});var Ms=require("react/jsx-runtime");var dc=J(require("classnames")),wr=require("@salt-ds/core"),mc=require("react");var Es=require("react/jsx-runtime");var fc=J(require("classnames"));var Ls=require("react/jsx-runtime");var Rs=require("@vuu-ui/vuu-utils");var gc=require("@salt-ds/core"),hc=J(require("classnames")),xc=require("react"),bc=require("@vuu-ui/vuu-layout");var Ds=require("react/jsx-runtime");var Ns=require("@vuu-ui/vuu-layout");var Ps=require("react/jsx-runtime");var Xt=require("@vuu-ui/vuu-layout"),Mr=require("react"),Hs=require("react/jsx-runtime");var As=require("react/jsx-runtime"),{error:Eg}=(0,Rs.logger)("Shell");var Lr=require("react"),Sc=require("react/jsx-runtime"),yc={},Pg=(0,Lr.createContext)(yc);var Fs=J(require("classnames")),eo=function({children:t,x:o=0,y:r=0,onRender:n}){let[a,i,l]=wt(),c=(0,Qt.useMemo)(()=>ns({className:(0,Fs.default)(a,i),dataMode:l}),[l,i,a]);return(0,Qt.useLayoutEffect)(()=>{So(t,c,o,r,n)},[t,n,c,o,r]),(0,Qt.useLayoutEffect)(()=>()=>{var s;c&&(Os.unmountComponentAtNode(c),c.classList.contains("vuuPopup")&&((s=c.parentElement)==null||s.removeChild(c)))},[c]),null};var Bs=require("react/jsx-runtime");var dt=require("react");var Ke=J(require("react")),Hr=J(require("classnames")),Js=require("@vuu-ui/vuu-layout");var he=require("react");var $s=e=>e.closest("[data-root='true']")!==null,Vs=(e,t)=>{var o;return e.ariaHasPopup==="true"&&((o=e.dataset)==null?void 0:o.idx)===`${t}`||e.querySelector(`:scope > [data-idx='${t}'][aria-haspopup='true']`)!==null};function Cc(e,...t){let o=new Set(e);for(let r of t)for(let n of r)o.add(n);return o}var wc="Enter";var Mc="Delete",Ec=new Set([wc,Mc]),Lc=new Set(["Tab"]),Dc=new Set(["ArrowRight","ArrowLeft"]),zs=new Set(["Home","End","ArrowDown","ArrowUp"]),Us=new Set(["Home","End","ArrowRight","ArrowLeft"]),Nc=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),dh=Cc(Ec,Us,zs,Dc,Nc,Lc);var _s=({key:e},t="vertical")=>(t==="vertical"?zs:Us).has(e);var Ws=({autoHighlightFirstItem:e=!1,count:t,highlightedIndex:o,onActivate:r,onHighlight:n,onCloseMenu:a,onOpenMenu:i})=>{let l=(0,he.useRef)((o!=null?o:e)?0:-1),[,c]=(0,he.useState)(null),s=o!==void 0,m=(0,he.useCallback)(I=>{l.current=I,n==null||n(I),c({})},[n]),d=(0,he.useCallback)(I=>{I!==l.current&&(s||m(I))},[s,m]),u=(0,he.useRef)(!0),g=(0,he.useRef)(!1),f=I=>g.current=I,p=s?o:l.current,x=(0,he.useCallback)(I=>{let v=Pc(t,I.key,l.current);v!==l.current&&d(v)},[t,d]),y=(0,he.useCallback)(I=>{if(_s(I))I.preventDefault(),I.stopPropagation(),u.current=!0,x(I);else if((I.key==="ArrowRight"||I.key==="Enter")&&Vs(I.target,p)){let L=I.target.querySelector(`:scope > [data-idx='${p}']`);L&&(i==null||i(L))}else I.key==="ArrowLeft"&&!$s(I.target)?a(p):I.key==="Enter"?r&&r(p):I.key==="Tab"&&a(-1)},[p,x,r,a,i]),D=(0,he.useMemo)(()=>({onFocus:()=>{p===-1&&m(0)},onKeyDown:y,onMouseDownCapture:()=>{u.current=!1,f(!0)},onMouseMove:()=>{u.current&&(u.current=!1)},onMouseLeave:()=>{u.current=!0,f(!1),d(-1)}}),[y,p,m,d]);return{focusVisible:u.current?p:-1,controlledHighlighting:s,highlightedIndex:p,setHighlightedIndex:d,listProps:D,setIgnoreFocus:f}};function Pc(e,t,o){return t==="ArrowUp"?o>0?o-1:o:o===null?0:o===e-1?o:o+1}var ut=J(require("react"));var Nr=e=>e.type===Mo||!!e.props["data-group"],Hc=e=>{if(Array.isArray(e)&&Pr(e[0]))return e[0]},kc=(e,t,o,r=!1)=>{let{props:{children:n}}=e;return{childWithId:ut.default.cloneElement(e,{hasSeparator:r,id:`${t}`,key:t,children:o?Hc(n):n}),grandChildren:o?n:void 0}},Gs=(e,t)=>{let o=(0,ut.useCallback)(()=>{let a=(i,l=t,c={},s={})=>{let m=c[l]=[],d=0,u=!1;return ut.default.Children.forEach(i,g=>{if(!Pr(g))if(g.type===qs)u=!0;else{let f=Nr(g),p=`${l}-${d}`,{props:{action:x,options:y}}=g,{childWithId:D,grandChildren:I}=kc(g,p,f,u);m.push(D),I?a(I,p,c,s):s[p]={action:x,options:y},d+=1,u=!1}}),[c,s]};return a(e)},[t,e]),[r,n]=(0,ut.useMemo)(()=>o(),[o]);return[r,n]};var Fe=require("react/jsx-runtime"),Zs="vuuMenuList",qs=()=>(0,Fe.jsx)("li",{className:"vuuMenuItem-divider"}),Mo=()=>null,Eo=({children:e,idx:t,...o})=>(0,Fe.jsx)("div",{...o,children:e}),js=({children:e})=>(0,Fe.jsx)(Fe.Fragment,{children:e});js.displayName="MenuItemLabel";Eo.Label=js;var Rc=e=>Ke.default.isValidElement(e)&&typeof e.type!="string"&&"displayName"in e.type?e.type.displayName:void 0,Pr=e=>Rc(e)==="MenuItemLabel",Ac=e=>e.props["data-icon"],Ys=({activatedByKeyboard:e,childMenuShowing:t,children:o,className:r,highlightedIdx:n,id:a,isRoot:i,listItemProps:l,onHighlightMenuItem:c,onActivate:s,onCloseMenu:m,onOpenMenu:d,...u})=>{let g=(0,Js.useId)(a),f=(0,Ke.useRef)(null),p=(0,Ke.useMemo)(()=>new Map,[]),x=M=>{var E;let h=(E=f.current)==null?void 0:E.querySelector(`:scope > [data-idx='${M}']`);h!=null&&h.id&&(s==null||s(h.id))},{focusVisible:y,highlightedIndex:D,listProps:I}=Ws({count:Ke.default.Children.count(o),highlightedIndex:n,onActivate:x,onHighlight:c,onOpenMenu:d,onCloseMenu:m}),v=t==null?y:-1;(0,Ke.useLayoutEffect)(()=>{var M;t===void 0&&e&&((M=f.current)==null||M.focus())},[e,t]);let L=()=>D===void 0||D===-1?void 0:p.get(D);function w(){let M={...l,role:"menuitem"},h=(O,b,S)=>b?[(0,Fe.jsx)("span",{className:"vuuIconContainer","data-icon":S},"icon")].concat(O):O;function E(O,b,S,N){var q;let{children:P,className:k,"data-icon":C,id:T,hasSeparator:R,label:A,...F}=b.props,V=Nr(b),G=V&&t===T,z=G?`${g}-${T}`:void 0;O.push((0,Fe.jsx)(Eo,{...F,...M,...Oc(T,S,(q=b.key)!=null?q:T,D,v,k,R),"aria-controls":z,"aria-haspopup":V||void 0,"aria-expanded":G||void 0,children:h(V&&A!=null?A:P,N,C)}))}let H=[];if(o.length>0){let O=o.some(Ac);o.forEach((b,S)=>{E(H,b,S,O)})}return H}return(0,Fe.jsx)("div",{...u,...I,"aria-activedescendant":L(),className:(0,Hr.default)(Zs,r,{[`${Zs}-childMenuShowing`]:t!==void 0}),"data-root":i||void 0,id:g,ref:f,role:"menu",children:w()})},Oc=(e,t,o,r,n,a,i)=>({id:`menuitem-${e}`,key:o!=null?o:t,"data-idx":t,"data-highlighted":t===r||void 0,className:(0,Hr.default)("vuuMenuItem",a,{"vuuMenuItem-separator":i,focusVisible:n===t})});Ys.displayName="MenuList";var Xs=Ys;var oe=require("react");var kr=e=>e==null?void 0:e.closest("[data-idx],[aria-posinset]");var ei=(e,t,o)=>e.map((r,n)=>n===e.length-1?{...r,[o]:r[o]-t}:r),Fc=(e,t)=>ei(e,t,"left"),Kc=(e,t)=>ei(e,t,"top"),Bc=(e,t)=>{let[o,r]=t.slice(-2),n=document.getElementById(`${e}-${r.id}`);if(n===null)throw Error(`useCascade.flipSides element with id ${r.id} not found`);let{width:a}=n.getBoundingClientRect();return t.map(i=>i===r?{...i,left:o.left-(a-2)}:i)},$c=(e,t)=>{let[{left:o,top:r}]=t.slice(-1),{offsetWidth:n,offsetTop:a}=e;return{left:o+n,top:a+r}},ti=(e,t)=>{let o=e.lastIndexOf("-");return o>-1?e.slice(9,o):t},Vc=e=>e.slice(9),Qs=({ariaExpanded:e,ariaHasPopup:t,id:o},r)=>{if(o.startsWith("menuitem"))return{hostMenuId:ti(o,r),targetMenuId:Vc(o),menuItemId:o,isGroup:t==="true",isOpen:e==="true"};throw Error(`getMenuItemDetails #${o} is not a menuitem`)},oi=({id:e,onActivate:t,onMouseEnterItem:o,position:{x:r,y:n}})=>{let[,a]=(0,oe.useState)({}),i=(0,oe.useRef)([{id:e,left:r,top:n}]),l=(0,oe.useCallback)(w=>i.current.findIndex(M=>M.id===w)!==-1,[]),c=(0,oe.useCallback)(w=>{let M=u.current[w];if(M===void 0)throw Error(`getOpenMenuState no entry for menu ${w}`);return M},[]),s=(0,oe.useCallback)(w=>{i.current=w,a({})},[]),m=(0,oe.useRef)(),d=(0,oe.useRef)(),u=(0,oe.useRef)({[e]:"no-popup"}),g=(0,oe.useCallback)((w=e,M,h=null)=>{if(w===e&&h===null)s([{id:e,left:r,top:n}]);else{u.current[w]="popup-open";let E=document.getElementById(h);if(E!==null){let{left:H,top:O}=$c(E,i.current);s(i.current.concat({id:M,left:H,top:O}))}else throw Error(`openMenu no menuItem ${h}`)}},[e,r,n,s]),f=(0,oe.useCallback)(w=>{if(w===e)s([]);else{let M=i.current.slice(),h=M.pop();u.current[h.id]="no-popup";let E=M.at(-1);E&&(u.current[E.id]="no-popup"),s(M)}},[e,s]),p=(0,oe.useCallback)(w=>{let M=i.current.slice(),h=w.slice(9),{id:E}=M.at(-1);for(;M.length>1&&!h.startsWith(E);){let H=ti(E,e);M.pop(),u.current[E]="no-popup",u.current[H]="no-popup",{id:E}=M[M.length-1]}M.length<i.current.length&&s(M)},[e,s]),x=(0,oe.useCallback)(()=>{m.current&&(clearTimeout(m.current),m.current=void 0)},[]),y=(0,oe.useCallback)((w,M,h)=>{x(),m.current=window.setTimeout(()=>{console.log(`scheduleOpen<timeout> opening menu ${M} from menu ${w} via menuitem ${h}`),p(h),u.current[w]="popup-open",u.current[M]="no-popup",g(w,M,h)},400)},[x,p,g]),D=(0,oe.useCallback)((w,M,h)=>{console.log(`scheduleClose openMenuId ${M} from parent menu ${w} itemId ${h}`),u.current[M]="pending-close",d.current=window.setTimeout(()=>{p(h)},400)},[p]),I=(0,oe.useCallback)(()=>{let{current:w}=i,[M]=w.slice(-1),h=document.getElementById(M.id);if(console.log(`handle render ${JSON.stringify(M)} tabindex ${h==null?void 0:h.tabIndex}`),h){let{right:E,bottom:H}=h.getBoundingClientRect(),{clientHeight:O,clientWidth:b}=document.body;if(E>b){let S=w.length>1?Bc(e,w):Fc(w,E-b);s(S)}else if(H>O){let S=Kc(w,H-O);s(S)}typeof h.tabIndex=="number"&&(console.log(`focus el ${h.id}`),h.focus())}else console.log(`no element found with if ${M.id}`)},[e,s]),v=(0,oe.useCallback)(w=>{let{hostMenuId:M,targetMenuId:h,menuItemId:E,isGroup:H,isOpen:O}=Qs(w,e),{current:{[M]:b}}=u;if(console.log(`trigger child menu ${E}`),b==="no-popup"&&H)u.current[M]="popup-pending",y(M,h,E);else if(b==="popup-pending"&&!H)u.current[M]="no-popup",clearTimeout(m.current),m.current=void 0;else if(b==="popup-pending"&&H)clearTimeout(m.current),y(M,h,E);else if(b==="popup-open")if(l(h)){let S=c(h);switch(console.log({menuStatus:S}),p(E),S){case"pending-close":clearTimeout(d.current),d.current=void 0,u.current[h]="no-popup",x();break;default:}}else{let[S,N]=i.current.slice(-2);S.id===M&&u.current[N.id]!=="pending-close"?(D(M,N.id,E),H&&!O&&y(M,h,E)):S.id===M&&H&&E!==N.id&&u.current[N.id]==="pending-close"||H?y(M,h,E):u.current[N.id]!=="pending-close"&&p(E)}b==="pending-close"&&(x(),clearTimeout(d.current),d.current=void 0,u.current[M]="popup-open")},[x,p,c,l,e,D,y]),L=(0,oe.useMemo)(()=>({onMouseEnter:w=>{let M=kr(w.target);v(M),o(w,M.id)},onClick:w=>{let M=kr(w.target),{isGroup:h,menuItemId:E}=Qs(M,e);h?v(M):t(E)}}),[t,o,e,v]);return{closeMenu:f,handleRender:I,listItemProps:L,openMenu:v,openMenus:i.current}};var ri=require("@vuu-ui/vuu-layout"),to=require("react/jsx-runtime"),ni=require("react"),zc=()=>{},Rr=({activatedByKeyboard:e,children:t,className:o,id:r,onClose:n=()=>{},position:a={x:0,y:0},style:i,...l})=>{let c=(0,dt.useRef)(n);c.current=n;let s=(0,ri.useId)(r),m=(0,dt.useRef)(zc),[d,u]=Gs(t,s),g=(0,dt.useRef)(e),f=(0,dt.useCallback)(()=>{g.current=!1},[]);console.log({actions:u,menus:d});let p=(0,dt.useCallback)(E=>{let H=E.slice(9),{action:O,options:b}=u[H];m.current(s),n({type:"menu-action",menuId:O,options:b})},[u,s,n]),{closeMenu:x,listItemProps:y,openMenu:D,openMenus:I,handleRender:v}=oi({id:`${s}`,onActivate:p,onMouseEnterItem:f,position:a});m.current=x;let L=()=>{console.log("handleCloseMenu"),g.current=!0,x()},w=()=>{},M=I.length-1,h=E=>{if(!(E>=M)){let{id:H}=I[E+1];return H}};return(0,to.jsx)(to.Fragment,{children:I.map(({id:E,left:H,top:O},b,S)=>{let N=h(b);return(0,to.jsx)(eo,{x:H,y:O,onRender:v,children:(0,ni.createElement)(Xs,{...l,activatedByKeyboard:g.current,childMenuShowing:N,className:o,id:E,isRoot:b===0,key:b,listItemProps:y,onActivate:p,onHighlightMenuItem:w,onCloseMenu:L,onOpenMenu:D,style:i,tabIndex:b===S.length-1?0:void 0},d[E])},b)})})};Rr.displayName="ContextMenu";var Lo=require("react"),Uc=require("react/jsx-runtime"),si=(0,Lo.createContext)(null);var pi=require("@vuu-ui/vuu-utils"),fi=J(require("classnames")),Ze=require("react");var ii=J(require("classnames")),Mt=J(require("react")),Do=J(require("react-dom"));var Ar=!1,Se=[],ai=e=>(e==null?void 0:e.type)==="menu-action",li=e=>(e==null?void 0:e.type)==="click-away";function ci(e){if(e.key==="Esc"){if(Se.length)di();else if(Ar){let t=document.body.querySelector(".vuuDialog");t&&Do.default.unmountComponentAtNode(t)}}}function ui(e){if(Se.length){console.log("Popup.outsideClickHandler ... ");let t=document.body.querySelectorAll(".vuuPopup");for(let o=0;o<t.length;o++)if(t[o].contains(e.target)){console.log(" ... its ok, he's one of us");return}console.log(" ... close all"),di({mouseEvt:e,type:"click-away"})}}function di(e){if(Se.length===1)te.hidePopup(e,"anon","all");else if(Se.length){let t=document.body.querySelectorAll(".vuuPopup");for(let o=0;o<t.length;o++)Do.default.unmountComponentAtNode(t[o]);mi("*")}}function _c(e){Se.indexOf(e)===-1&&(Se.push(e),Ar===!1&&(window.addEventListener("keydown",ci,!0),window.addEventListener("click",ui,!0)))}function mi(e){if(Se.length){if(e==="*")Se.length=0;else{let t=Se.indexOf(e);t!==-1&&Se.splice(t,1)}Se.length===0&&Ar===!1&&(window.removeEventListener("keydown",ci,!0),window.removeEventListener("click",ui,!0))}}var Wc=({children:e,position:t,style:o})=>{let r=(0,ii.default)("hwPopup","hwPopupContainer",t);return(0,Mt.createElement)("div",{className:r,style:o},e)},Gc=1,te=class{static showPopup({group:t="all",name:o="anon",left:r=0,position:n="",right:a="auto",top:i=0,width:l="auto",component:c}){if(!c)throw Error("PopupService showPopup, no component supplied");typeof c.props.onClose=="function"?te.onClose=c.props.onClose:te.onClose=void 0,_c(o),document.addEventListener("keydown",te.escapeKeyListener,!0);let s=document.body.querySelector(".vuuPopup."+t);s===null&&(s=document.createElement("div"),s.className="vuuPopup "+t,document.body.appendChild(s));let m={width:l};So((0,Mt.createElement)(Wc,{key:Gc++,position:n,style:m},c),s,r,i,()=>{te.keepWithinThePage(s,a)})}static escapeKeyListener(t){t.key==="Escape"&&(console.log("%cESC listener","color:green;font-weight:bold;"),te.hidePopup())}static hidePopup(t,o="anon",r="all"){var n;if(console.log("PopupService.hidePopup",{reason:t}),Se.indexOf(o)!==-1){mi(o);let a=document.body.querySelector(`.vuuPopup.${r}`);a&&Do.default.unmountComponentAtNode(a)}document.removeEventListener("keydown",te.escapeKeyListener,!0),console.log(`PopupService will call onClose if found ${typeof(te==null?void 0:te.onClose)}`),(n=te==null?void 0:te.onClose)==null||n.call(te,t)}static keepWithinThePage(t,o="auto"){let r=t.querySelector(".vuuPopupContainer > *");if(r){let{top:n,left:a,width:i,height:l,right:c}=r.getBoundingClientRect(),s=window.innerWidth,d=window.innerHeight-(n+l);d<0&&(r.style.top=Math.round(n)+d+"px");let u=s-(a+i);if(u<0&&(r.style.left=Math.round(a)+u+"px"),typeof o=="number"&&o!==c){let g=o-c;r.style.left=a+g+"px"}}}};var No=require("react/jsx-runtime"),gi=(e,t)=>{let o=(0,Ze.useContext)(si),[r,n,a]=wt(),i=(0,Ze.useCallback)((s,m,d)=>{let u=[];for(let g of s)u=u.concat(g(m,d));return u},[]),l=(0,Ze.useCallback)((s,m,{ContextMenuProps:d,contextMenu:u,...g})=>{if(s.stopPropagation(),s.preventDefault(),u)return Zc(s,u);let f=[];if(e&&f.push(e),o&&Array.isArray(o==null?void 0:o.menuBuilders)&&o.menuBuilders.length>0&&f.push(...o.menuBuilders),f.length>0){let p=i(f,m,g),x=y=>(t==null?void 0:t(y))===!0?!0:o==null?void 0:o.menuActionHandler(y);p.length&&x&&(console.log(`showContextMenu ${m}`,{options:g}),Jc(s,p,x,{...d,className:(0,fi.default)(d==null?void 0:d.className,r,n),"data-mode":a}))}else console.warn("useContextMenu, no menuBuilders configured. These should be supplied via the ContextMenuProvider(s)")},[i,o,a,n,t,e,r]),c=(0,Ze.useCallback)(()=>{console.log("hide comnytext menu")},[]);return[l,c]},qc={},Zc=(e,t)=>{let o={x:e.clientX,y:e.clientY};te.showPopup({focus:!0,left:0,top:0,component:(0,Ze.cloneElement)(t,{position:o})})},Jc=(e,t,o,{position:r,...n}=qc)=>{let a=s=>{let m=(d,u)=>(0,pi.isGroupMenuItemDescriptor)(d)?(0,No.jsx)(Mo,{label:d.label,children:d.children.map(m)},u):(0,No.jsx)(Eo,{action:d.action,"data-icon":d.icon,options:d.options,children:d.label},u);return s.map(m)},i=s=>{var m;ai(s)&&(o(s),te.hidePopup()),(m=n==null?void 0:n.onClose)==null||m.call(n,s)},l=r!=null?r:{x:e.clientX,y:e.clientY},c=(0,No.jsx)(Rr,{...n,onClose:i,position:l,children:a(t)});te.showPopup({left:0,top:0,component:c,focus:!0})};var Je=require("react");var xi=J(require("classnames")),bi=require("@salt-ds/core"),Ii=require("@vuu-ui/vuu-layout");var yi=require("react/jsx-runtime"),hi="vuuPopupMenu",jc=e=>{if(e){let{bottom:t,left:o}=e.getBoundingClientRect();return{x:o,y:t+6}}},vi=({className:e,icon:t="more-vert",id:o,menuActionHandler:r,menuBuilder:n,menuLocation:a="header",menuOptions:i,onMenuClose:l,tabIndex:c=0,...s})=>{let m=(0,Je.useRef)(null),d=(0,Je.useRef)(!1),[u,g]=(0,Je.useState)(!1),f=(0,Ii.useId)(o),[p]=gi(n,r),x=(0,Je.useCallback)(D=>{console.log("PopupMenu popup closed",{reason:D}),g(!1),li(D)?D.mouseEvt.target===m.current&&(d.current=!0):requestAnimationFrame(()=>{var I;l==null||l(),c!==-1&&((I=m.current)==null||I.focus())})},[l,c]),y=(0,Je.useCallback)(D=>{d.current?d.current=!1:(g(!0),p(D,a,{ContextMenuProps:{id:`${f}-menu`,onClose:x,position:jc(m.current)},...i}))},[x,f,a,i,p]);return(0,yi.jsx)(bi.Button,{...s,"aria-controls":`${f}-menu-root`,"aria-expanded":u,"aria-haspopup":"menu",className:(0,xi.default)(hi,e,{[`${hi}-open`]:u}),"data-icon":t,id:f,onClick:y,ref:m,tabIndex:c,variant:"secondary"})};var Or=require("react/jsx-runtime"),Yc=e=>e.split(" ").map(t=>`vuuDraggable-${t}`),Ho=(0,Po.forwardRef)(function({wrapperClassName:t,element:o,onTransitionEnd:r,style:n,scale:a=1},i){let l=(0,Po.useCallback)(s=>{s&&(s.innerHTML="",s.appendChild(o),a!==1&&(s.style.transform=`scale(${a},${a})`))},[o,a]),c=(0,Si.useForkRef)(i,l);return(0,Or.jsx)(eo,{children:(0,Or.jsx)("div",{className:co("vuuDraggable",...Yc(t)),ref:c,onTransitionEnd:r,style:n})})}),Fr=e=>{let t=document.createElement("div");return t.className="vuuDraggable-spacer",e&&t.addEventListener("transitionend",()=>{e.current=!1}),t},Ti=()=>{let e=document.createElement("div");return e.className="vuuDraggable-dropIndicatorPosition",e},Ci=e=>{let t=document.createElement("div");return t.className="vuuDraggable-dropIndicator",e&&t.addEventListener("transitionend",()=>{e.current=!1}),t};var wi=()=>{let e=(0,Ee.useRef)(0),t=(0,Ee.useRef)(!1),o=(0,Ee.useMemo)(()=>[Fr(t),Fr()],[]),r=(0,Ee.useCallback)(()=>o.forEach(c=>c.remove()),[o]),n=(0,Ee.useCallback)((c,s="width")=>{let[m,d]=o;e.current=requestAnimationFrame(()=>{t.current=!0,m.style.cssText=`${s}: 0px`,d.style.cssText=`${s}: ${c}px`,o[0]=d,o[1]=m})},[o]),a=(0,Ee.useCallback)(()=>{e.current&&(cancelAnimationFrame(e.current),e.current=0)},[]),i=(0,Ee.useCallback)((c,s,m,d=!1,u="static",g="horizontal")=>{if(s){let f=g==="horizontal"?"width":"height",[p,x]=o;if(a(),d)t.current?(r(),p.style.cssText=`${f}: ${m}px`,x.style.cssText=`${f}: 0px`,u==="fwd"?(s.element.before(p),s.element.after(x)):(s.element.after(p),s.element.before(x))):u==="fwd"?s.element.after(x):s.element.before(x),n(m,f);else if(u==="static")p.style.cssText=`${f}: ${m}px`,s.element.before(p);else throw Error("useDragDisplacers currently only supports noTransition for static displacement");u!=="static"&&lo(c,u)}},[n,a,r,o]),l=(0,Ee.useCallback)((c,s,m,d=!1,u="static",g="horizontal")=>{let f=g==="horizontal"?"width":"height",[p,x]=o;a(),d?(t.current?(r(),p.style.cssText=`${f}: ${m}px`,x.style.cssText=`${f}: 0px`,s.element.before(p),s.element.after(x)):u==="fwd"?s.element.after(x):s.element.before(x),n(m,f)):(p.style.cssText=`${f}: ${m}px`,s.element.after(p)),u!=="static"&&lo(c,u)},[n,a,r,o]);return{displaceItem:i,displaceLastItem:l,clearSpacers:r}};var Mi=({draggableRef:e,onDrop:t,orientation:o="horizontal",containerRef:r,itemQuery:n="*",selected:a,viewportRange:i})=>{let l=(0,ie.useRef)(),c=(0,ie.useRef)(!1),s=(0,ie.useRef)(-1),m=(0,ie.useRef)([]),d=(0,ie.useRef)(!1),[u,g]=(0,ie.useState)(!1),{clearSpacers:f,displaceItem:p,displaceLastItem:x}=wi(),y=(0,ie.useRef)(),D=`:is(${n}${Kt}${Zo},.vuuOverflowContainer-OverflowIndicator)`,I=b=>m.current.findIndex(S=>S.id===b.id),v=(0,ie.useRef)();v.current=i;let L=(0,ie.useCallback)(()=>{f()},[f]),w=(0,ie.useCallback)((b,S,N)=>{let{current:P}=r,{current:k}=y;if(P&&k){m.current=rt(P,o,D,v.current);let{size:C}=k,R=s.current+C/2,{current:A}=m,F=nt(A,R,"fwd");if(F){let G=I(F),z=A[G];N&&b==="fwd"?x(A,A[A.length-1],C,!1,"static",o):p(A,z,C,!0,"static",o)}}},[r,p,x,D,o]),M=(0,ie.useCallback)(b=>{let N=b.target.closest(n);N.ariaSelected&&Array.isArray(a)&&a.length>1&&console.log("its a selected element, and we have a multi select");let{current:P}=r;if(P&&N){let{SCROLL_SIZE:k,CLIENT_SIZE:C}=ge(o),{id:T}=N,{[k]:R,[C]:A}=P;c.current=R>A;let F=m.current=rt(P,o,D,i,T);console.log({dropTargets:F});let V=It(F),G=F[V];G&&P&&(y.current=G,(G.isLast?x:p)(F,G,G.size,!1,"static",o))}},[r,p,x,D,n,o,a,i]),[h,E]=(0,ie.useMemo)(()=>{let b=!1;return[P=>{if(!b){b=!0;let k=P.element.querySelector(".vuuPopupMenu");if(k){let C=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});k.dispatchEvent(C)}}},P=>{if(b){b=!1;let k=P.element.querySelector(".vuuPopupMenu");if(k){let C=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});k.dispatchEvent(C)}}}]},[]),H=(0,ie.useCallback)((b,S)=>{let{current:N}=y;if(N&&e.current&&r.current){s.current=b;let{current:P}=m,k=nt(P,b,S);if(k&&!k.isDraggedItem)if(k.isOverflowIndicator)g(d.current=!0),h(k);else{let{size:C}=N;(I(k)===P.length-1?x:p)(P,k,C,!0,S,o);let A=P.at(-1);E(A),g(d.current=!1)}l.current=S}},[r,p,x,e,E,o,h]),O=(0,ie.useCallback)(()=>{var P;f();let{current:b}=m,S=It(b),N=b[S];if(N&&(l.current=void 0,d.current?t(N.index,-1):t(N.index,S)),g(!1),r.current){let k=(P=r.current)==null?void 0:P.scrollTop;S<b.length&&(r.current.scrollTop=k)}},[f,r,t]);return{beginDrag:M,drag:H,drop:O,handleScrollStart:L,handleScrollStop:w,revealOverflowedItems:u}};var ne=require("react");var oo=require("react");var Ei=()=>{let e=(0,oo.useMemo)(()=>Ti(),[]),t=(0,oo.useCallback)(()=>e.remove(),[e]);return{positionDropIndicator:(0,oo.useCallback)((r,n="end")=>(n==="end"?r.element.after(e):r.element.before(e),e),[e]),clearSpacer:t}};var Di=require("react/jsx-runtime"),Xc=':not([data-overflowed="true"])',Qc=':not([aria-hidden="true"])',Li=({draggableRef:e,onDrop:t,orientation:o="horizontal",containerRef:r,itemQuery:n="*",selected:a,viewportRange:i})=>{let l=(0,ne.useRef)(),c=(0,ne.useRef)(null),s=(0,ne.useRef)(null),m=(0,ne.useRef)(""),d=(0,ne.useRef)(!1),u=(0,ne.useRef)(-1),g=(0,ne.useRef)([]),f=(0,ne.useRef)(!1),[p,x]=(0,ne.useState)(!1),[y,D]=(0,ne.useState)(),{clearSpacer:I,positionDropIndicator:v}=Ei(),L=(0,ne.useRef)(),w=`:is(${n}${Xc}${Qc},[data-overflow-indicator])`,M=P=>g.current.findIndex(k=>k.id===P.id),h=(P,k,C)=>{P.start+=k,P.mid+=k,P.end+=k,typeof C=="number"&&(P.currentIndex+=C)},E=(0,ne.useRef)();E.current=i;let H=(0,ne.useCallback)(()=>{I()},[I]),O=(0,ne.useCallback)((P,k,C)=>{let{current:T}=r,{current:R}=L;if(T&&R){g.current=rt(T,o,w,E.current);let{size:A}=R,V=u.current+A/2,{current:G}=g,z=nt(G,V,"fwd");z&&v(C&&P==="fwd"?G[G.length-1]:z,"start")}},[r,v,w,o]),b=(0,ne.useCallback)(P=>{let C=P.target.closest(n);C.ariaSelected&&Array.isArray(a)&&a.length>1&&console.log("its a selected element, and we have a multi select");let{current:T}=r;if(T&&C){let{SCROLL_SIZE:R,CLIENT_SIZE:A}=ge(o),{id:F}=C,{[R]:V,[A]:G}=T;d.current=V>G;let z=g.current=rt(T,o,w,i),q=jo(z,F);if(q&&T){let K=M(q);Yo(z,K),L.current=q;let{current:B}=E;if(B!=null&&B.atEnd)for(let W=0;W<z.length;W++)h(z[W],q.size);for(let W=K;W<z.length;W++)h(z[W],-q.size,-1);let[$,_]=q.isLast?[z[z.length-1],"end"]:[z[K],"start"];s.current=$,m.current=_;let X=v($,_),{top:U,left:Z,width:Q}=X.getBoundingClientRect(),ee={top:q.isLast?B!=null&&B.atEnd&&!B.atStart?U+q.size-2:U-2:U-q.size-2,left:Z,width:Q,height:2};D((0,Di.jsx)(Ho,{wrapperClassName:"dropIndicatorContainer",style:ee,ref:c,element:Ci()}))}}},[n,a,r,o,w,i,v]),S=(0,ne.useCallback)((P,k)=>{let{current:C}=s,{current:T}=L;if(T&&e.current&&r.current){let R=o==="horizontal"?"left":"top";u.current=P;let{current:A}=g,F=nt(A,P,k);if(F&&F.index!==(C==null?void 0:C.index)){if(F.isOverflowIndicator)x(f.current=!0);else if(c.current){if(M(F)===A.length-1){let G=A[A.length-1],q=v(G,"start").getBoundingClientRect();c.current.style[R]=`${q.top}px`}else{let z=v(F,"start").getBoundingClientRect();c.current.style[R]=`${z.top}px`}x(f.current=!1)}s.current=F,l.current=k}}},[e,r,o,v]),N=(0,ne.useCallback)(()=>{I();let{current:P}=L,{current:k}=s,{current:C}=m,{current:T}=E;if(P&&T&&k){let{index:R}=P,A=C==="start",{index:F,currentIndex:V}=k;s.current=null,l.current=void 0,f.current?t(R,-1):R<F?t(R,A?V:V+1):t(R,A?F:F+1),D(void 0)}x(!1)},[I,t]);return{beginDrag:b,drag:S,drop:N,dropIndicator:y,handleScrollStart:H,handleScrollStop:O,revealOverflowedItems:p}};var Y=require("react");var je=require("react");var Ni=({containerRef:e,onScrollingStopped:t,orientation:o="vertical"})=>{let r=(0,je.useRef)(null),n=(0,je.useRef)(!1),a=(0,je.useRef)(0),i=(0,je.useRef)("fwd"),l=(0,je.useCallback)((s=!1)=>{console.log("[useAutoScroll] stopScrolling"),r.current!==null&&(clearTimeout(r.current),r.current=null),n.current=!1,t==null||t(i.current,a.current,s)},[t]),c=(0,je.useCallback)((s,m,d=30)=>{let{current:u}=e;if(u){let{SCROLL_POS:g,SCROLL_SIZE:f,CLIENT_SIZE:p}=ge(o),{[g]:x,[f]:y,[p]:D}=u,I=s==="fwd"?y-D-x:x,v=Math.min(I,d);s==="fwd"?(i.current="fwd",u[g]=a.current=x+v):(i.current="bwd",u[g]=a.current=x-v),v===I?l(!0):(n.current=!0,r.current=window.setTimeout(()=>{c(s,m,d)},100))}},[e,o,l]);return{isScrolling:n,startScrolling:c,stopScrolling:l}};var Hi=require("react/jsx-runtime"),eu={beginDrag:()=>{},drag:()=>{},draggableRef:{current:null},drop:()=>{},isDragging:!1,isScrolling:!1,handleScrollStart:()=>{},handleScrollStop:()=>{},revealOverflowedItems:!1},Pi={start:0,end:1e3,contraStart:0,contraEnd:1e3},tu=()=>eu,ou=3,ru=(e,t)=>e.closest(t),nu=e=>e.dataset.index==="overflow"&&e.parentElement!==null&&e.parentElement.classList.contains("overflowed"),su=(e,t)=>{let o=`:is(${t}${Kt},.vuuOverflowContainer-OverflowIndicator)`,n=Array.from(e.querySelectorAll(o)).pop();return[n,nu(n)]},Kr=({allowDragDrop:e,containerRef:t,draggableClassName:o,itemQuery:r="*",onDragStart:n,onDrop:a,onDropSettle:i,orientation:l,...c})=>{let s=(0,Y.useRef)({start:0,end:0,contraStart:0,contraEnd:0}),[m,d]=(0,Y.useState)({draggable:void 0,draggedItemIndex:-1,isDragging:!1}),u=(0,Y.useRef)(null),g=(0,Y.useRef)(),f=(0,Y.useRef)(null),p=(0,Y.useRef)(!1),x=(0,Y.useRef)({x:0,y:0}),y=(0,Y.useRef)({x:0,y:0}),D=(0,Y.useRef)({x:0,y:0}),I=(0,Y.useRef)(null),v=(0,Y.useRef)(-1),L=(0,Y.useRef)(-1),w=(0,Y.useRef)(),{isDragSource:M,isDropTarget:h,register:E}=qo(c.id);c.id&&(M||h)&&E(c.id);let H=(0,Y.useCallback)(()=>{var Q;let{current:U}=L,Z=(Q=t.current)==null?void 0:Q.querySelector(`${r}[data-index="${U}"]`);Z&&Z.classList.remove("vuuDropTarget-settling"),L.current=-1,i==null||i(U),d(ee=>({...ee,draggable:void 0}))},[t,r,i]),O=(0,Y.useCallback)(U=>{if(t.current){let{POS:Z,SCROLL_POS:Q,SCROLL_SIZE:ee,CLIENT_SIZE:W}=ge(l),{[Q]:le,[ee]:Pe,[W]:Ce}=t.current,Ve=Pe-Ce,ze=le<Ve,Qe=s.current.end,Ue=le>0&&U-x.current[Z]<=s.current.start,_e=ze&&U-x.current[Z]>=Qe;return Ue?"bwd":_e?"fwd":""}},[t,l]),b=e===!0||e==="natural-movement"?Mi:e==="drop-indicator"?Li:tu,S=(0,Y.useCallback)((U,Z,Q)=>{var ee;(ee=w.current)==null||ee.call(w,U,Z,Q)},[]),{isScrolling:N,startScrolling:P,stopScrolling:k}=Ni({containerRef:t,onScrollingStopped:S,orientation:l}),C=(0,Y.useCallback)((U,Z)=>{v.current=Z,a==null||a(U,Z),L.current=Z},[a]),{beginDrag:T,drag:R,drop:A,handleScrollStart:F,handleScrollStop:V,...G}=b({...c,containerRef:t,draggableRef:u,isDragSource:M,isDropTarget:h,itemQuery:r,onDrop:C,orientation:l});w.current=V;let z=(0,Y.useCallback)(U=>{let{CLIENT_POS:Z,CONTRA_CLIENT_POS:Q,CONTRA_POS:ee,POS:W}=ge(l),{clientX:le,clientY:Pe}=U,{[Z]:Ce,[Q]:Ve}=U,ze=y.current[W],Qe=y.current[ee],Ue=Math.abs(ze-Ce);if((M?Math.abs(Qe-Ve):0)-Ue>5&&(s.current=Pi),y.current.x=le,y.current.y=Pe,s.current===Pi&&u.current){let We=y.current.x-x.current.x,De=y.current.y-x.current.y;u.current.style.top=`${De}px`,u.current.style.left=`${We}px`}else if(Ue>0&&u.current){let We=ze<Ce?"fwd":"bwd",De=O(Ce),Rt=y.current[W]-x.current[W];if(De&&p.current&&!N.current?(F(),P(De,1)):!De&&N.current&&k(),!N.current){let bt=Math.round(Math.max(s.current.start,Math.min(s.current.end,Rt))),we=l==="horizontal"?"left":"top";u.current.style[we]=`${bt}px`,R(bt,We)}}},[R,u,O,F,M,N,l,P,k]),q=(0,Y.useCallback)(()=>{document.removeEventListener("mousemove",z,!1),document.removeEventListener("mouseup",q,!1),I.current=u.current,A(),d(U=>({...U,draggedItemIndex:-1,isDragging:!1})),g.current=void 0},[z,u,A]),K=(0,Y.useCallback)(U=>{let{clientX:Z,clientY:Q,target:ee}=U,W=ru(ee,r),{current:le}=t;if(le&&W){let{CONTRA:Pe,CONTRA_END:Ce,DIMENSION:Ve,END:ze,SCROLL_SIZE:Qe,CLIENT_SIZE:Ue,START:_e}=ge(l);g.current=W;let{[Qe]:We,[Ue]:De}=le;p.current=We>De;let[Rt,bt]=su(le,r),we=le.getBoundingClientRect(),et=W.getBoundingClientRect(),At=et[Ve],{[_e]:Uo,[ze]:_o}=Rt.getBoundingClientRect();x.current.x=Z-et.left,x.current.y=Q-et.top,s.current.start=we[_e],s.current.end=bt?Math.max(Uo,we.right-At):p.current?we[_e]+we[Ve]-At:_o-At,s.current.contraStart=we[Pe],s.current.contraEnd=we[Ce],T(U);let{dataset:{index:Wo="-1"}}=W;d({isDragging:!0,draggable:(0,Hi.jsx)(Ho,{element:Jo(W),onTransitionEnd:H,ref:u,style:Xo(et,we),wrapperClassName:o}),draggedItemIndex:parseInt(Wo)}),n==null||n(),document.addEventListener("mousemove",z,!1),document.addEventListener("mouseup",q,!1)}},[T,t,z,q,o,u,r,n,l,H]),B=(0,Y.useCallback)(U=>{let{CLIENT_POS:Z,POS:Q}=ge(l),{[Z]:ee}=U;Math.abs(ee-D.current[Q])>ou&&t.current&&(f.current&&(window.clearTimeout(f.current),f.current=null),document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",$,!1),K(U))},[t,T,l]),$=(0,Y.useCallback)(()=>{f.current&&(window.clearTimeout(f.current),f.current=null),document.removeEventListener("mousemove",B,!1),document.removeEventListener("mouseup",$,!1)},[B]),_=(0,Y.useCallback)(U=>{console.log("useDragDropNext onMouseDown");let{current:Z}=t;if(Z&&!U.defaultPrevented){let{clientX:Q,clientY:ee}=U;y.current.x=D.current.x=Q,y.current.y=D.current.y=ee,document.addEventListener("mousemove",B,!1),document.addEventListener("mouseup",$,!1),U.persist(),f.current=window.setTimeout(()=>{document.removeEventListener("mousemove",B,!1),document.removeEventListener("mouseup",$,!1),K(U.nativeEvent)},500)}},[t,K,B,$]),{current:X}=I;return(0,Y.useLayoutEffect)(()=>{if(X&&t.current){let U=v.current,Z=t.current.querySelector(`${r}[data-index="${U}"]`);Z?(Z.classList.add("vuuDropTarget-settling"),requestAnimationFrame(()=>{let{top:Q,left:ee}=Z.getBoundingClientRect(),{top:W,left:le}=X.getBoundingClientRect();le!==ee||W!==Q?(X.classList.add("vuuDraggable-settling"),X.style.top=`${Q}px`,X.style.left=`${ee}px`):H()})):console.log(`dont have the dropped item (at ${U})`),I.current=null}},[t,r,X,H]),{...G,...m,isScrolling:N,onMouseDown:e?_:void 0}};var Le=require("react"),ro=require("@salt-ds/core");var $r=require("react/jsx-runtime"),Br="vuuEditableLabel",Vr=(0,Le.forwardRef)(function({className:t,defaultEditing:o,defaultValue:r,editing:n,onChange:a,onEnterEditMode:i,onExitEditMode:l,value:c,...s},m){let d=(0,Le.useRef)(null),u=(0,Le.useRef)(!1),[g,f]=(0,ro.useControlled)({controlled:c,default:r!=null?r:"",name:"EditableLabel",state:"value"}),[p,x]=(0,ro.useControlled)({controlled:n,default:o!=null?o:!1,name:"EditableLabel",state:"editing"}),y=(0,Le.useCallback)(H=>{x(u.current=H)},[]),D=(0,Le.useRef)(g);(0,Le.useLayoutEffect)(()=>{p&&d.current!==null&&(d.current.select(),d.current.focus())},[p,d]);let I=(0,Le.useCallback)(()=>{y(!0),i&&i()},[i,y]),v=({cancelEdit:H=!1,allowDeactivation:O=!1}={})=>{y(!1);let b=D.current;b!==g&&(H?f(b):D.current=g),l&&l(b,g,O,H)},L=H=>{let{value:O}=H.target;f(O),a&&a(O)},w=()=>{I()},M=()=>{u.current&&v({allowDeactivation:!0})},h=H=>{p&&H.key==="Enter"?(H.stopPropagation(),v()):H.key==="ArrowRight"||H.key==="ArrowLeft"?H.stopPropagation():H.key==="Escape"&&v({cancelEdit:!0})},E=co(Br,t,{[`${Br}-editing`]:p});return(0,$r.jsx)("div",{...s,className:E,onDoubleClick:w,"data-text":g,ref:m,children:p?(0,$r.jsx)(ro.Input,{inputProps:{className:`${Br}-input`},value:g,onBlur:M,onChange:L,onKeyDown:h,inputRef:d,style:{padding:0},textAlign:"left",variant:"secondary"}):g})});var Lt=require("@vuu-ui/vuu-layout"),qi=require("@salt-ds/core"),Zi=J(require("classnames")),Dt=J(require("react"));var ce=require("react");var ki=e=>typeof e=="object"&&e!==null&&"tabIndex"in e&&typeof e.tabIndex=="number",Ri=e=>({label:"Close",location:"tab",action:"close-tab",options:e}),Ai=e=>({label:"Rename",location:"tab",action:"rename-tab",options:e});var Oi=e=>{if(e){let t=parseInt(e.dataset.index||"");if(!isNaN(t))return t}return-1},Fi=(e,t)=>{if(e){let o=e.querySelector(`[data-index]:has(${t})`);return Oi(o)}return-1},ko=e=>Fi(e,'[aria-selected="true"]'),zr=e=>Fi(e,".vuuEditableLabel-editing");var Et=require("@vuu-ui/vuu-utils"),Be=require("react"),Ki=(e,t,o="horizontal")=>{let r=(0,Be.useRef)(!1),n=(0,Be.useCallback)(()=>{r.current=!0},[]),a=(0,Be.useCallback)(()=>{r.current=!1},[]),i=(0,Be.useCallback)(()=>{var c,s;(c=e.current)==null||c.style.setProperty("--tab-thumb-transition","none"),(s=e.current)==null||s.removeEventListener("transitionend",i)},[e]),l=(0,Be.useRef)(-1);return(0,Be.useMemo)(()=>{var m,d;let c=0,s=0;if(l.current!==-1){let u=(m=e.current)==null?void 0:m.querySelector(".vuuTab-selected"),g=(d=e.current)==null?void 0:d.querySelector(`[data-index="${t}"] .vuuTab`),{positionProp:f,sizeProp:p}=Et.MEASURES[o];if(u&&g&&!r.current){let{[f]:x,[p]:y}=u.getBoundingClientRect(),{[f]:D}=g.getBoundingClientRect();if((0,Et.isValidNumber)(x)&&(0,Et.isValidNumber)(D)&&(0,Et.isValidNumber)(y)){console.log({orientation:o,positionProp:f,oldPosition:x,newPosition:D}),c=x-D,s=y;let v=Math.abs(c/(o==="horizontal"?1100:700));requestAnimationFrame(()=>{var L,w,M,h;(L=e.current)==null||L.style.setProperty("--tab-thumb-offset","0px"),(w=e.current)==null||w.style.setProperty("--tab-thumb-size","100%"),(M=e.current)==null||M.style.setProperty("--tab-thumb-transition",`all ${v}s ease`),(h=e.current)==null||h.addEventListener("transitionend",i)})}}}return l.current=t,r.current?{containerStyle:{"--tab-thumb-offset":"0px","--tab-thumb-size":"100%"},resumeAnimation:a,suspendAnimation:n}:{containerStyle:{"--tab-thumb-offset":`${c}px`,"--tab-thumb-size":s?`${s}px`:void 0},resumeAnimation:a,suspendAnimation:n}},[t,e,o,i,a,n])};var $i=require("@salt-ds/core"),Vi=require("@vuu-ui/vuu-utils"),ae=require("react"),de=require("@vuu-ui/vuu-utils");var zi={horizontal:{[de.Home]:"start",[de.End]:"end",[de.ArrowLeft]:"bwd",[de.ArrowRight]:"fwd"},vertical:{[de.Home]:"start",[de.End]:"end",[de.ArrowUp]:"bwd",[de.ArrowDown]:"fwd"}},iu=(e,t="horizontal")=>zi[t][e]!==void 0,au=e=>e===de.ArrowDown;function Bi(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 lu=e=>e!==null&&!e.classList.contains("wrapped"),Ro=(e,t)=>e?e.querySelector(`[data-index="${t}"]`):null,Ui=({containerRef:e,defaultHighlightedIdx:t=-1,highlightedIdx:o,keyBoardActivation:r,orientation:n,selectedIndex:a=0})=>{let i=r==="manual",l=(0,ae.useRef)(!1),c=(0,ae.useRef)(-1),[s,m]=(0,ae.useState)(!1),[,d]=(0,ae.useState)({}),[u,g]=(0,$i.useControlled)({controlled:o,default:t,name:"UseKeyboardNavigation"}),f=(0,ae.useCallback)(b=>{g(c.current=b)},[g]),p=(0,ae.useRef)(!1),x=(0,ae.useCallback)((b,S=!1,N,P=70)=>{f(b),N===!0&&!p.current&&(p.current=!0);let k=()=>{let C=Ro(e.current,b);if(C){let T=(0,Vi.getFocusableElement)(C);T==null||T.focus()}};S?k():setTimeout(k,P)},[e,f]),y=b=>{if(c.current===-1&&b.target.tabIndex!==-1){let S=zr(e.current);S!==-1?requestAnimationFrame(()=>{f(S)}):setTimeout(()=>{c.current===-1&&a!==null&&f(a)},200)}},D=(0,ae.useCallback)(()=>{var b,S;return(S=(b=e.current)==null?void 0:b.querySelectorAll("[data-index]").length)!=null?S:0},[e]),I=(0,ae.useCallback)((b="fwd",S)=>{let N=D(),k=Bi(N,b,typeof S=="number"?S:N),C=b==="start"?"fwd":b==="end"?"bwd":b;for(;(C==="fwd"&&k<N||C==="bwd"&&k>0)&&!lu(Ro(e.current,k));){let T=Bi(N,C,k);if(T===k)break;k=T}return k},[e,D]),v=(0,ae.useCallback)((b,S=!1)=>{let N=zi[n][b.key],P=I(N,u);P!==u?i&&x(P,!0):S&&d({})},[u,i,I,x,n]),L=(0,ae.useCallback)(()=>{let b=Ro(e.current,u);return b?b.querySelector(".vuuPopupMenu")!=null:!1},[e,u]),w=(0,ae.useCallback)(()=>{let b=Ro(e.current,u),S=b==null?void 0:b.querySelector(".vuuPopupMenu");if(S){let N=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});S.dispatchEvent(N)}return!1},[e,u]),M=(0,ae.useCallback)(b=>{D()>0&&iu(b.key,n)?(b.preventDefault(),p.current?v(b):(p.current=!0,v(b,!0))):au(b.key)&&L()&&w()},[w,D,L,v,n]),h=(b,S)=>{f(S)},E=(0,ae.useCallback)(()=>{s||(m(!0),l.current?l.current=!1:p.current=!0)},[s]),H=(0,ae.useCallback)(()=>{s||(l.current=!0),p.current=!1},[s]);return{containerProps:{onBlur:b=>{let S=b.target.closest(".vuuTabstrip"),N=b.relatedTarget;S&&!(S!=null&&S.contains(N))&&(f(-1),m(!1))},onMouseDownCapture:H,onFocus:E,onMouseLeave:()=>{p.current=!0,f(-1),l.current=!1}},focusVisible:p.current?u:-1,focusIsWithinComponent:s,highlightedIdx:u,focusTab:x,onClick:h,onFocus:y,onKeyDown:M,setHighlightedIdx:f}};var _i=require("@salt-ds/core"),no=require("react"),cu=["Enter"," "],uu=e=>e&&e.matches('[class*="vuuTab "]'),Wi=({defaultSelected:e,highlightedIdx:t,onSelectionChange:o,selected:r})=>{let[n,a,i]=(0,_i.useControlled)({controlled:r,default:e!=null?e:0,name:"Tabstrip",state:"value"}),l=(0,no.useCallback)(d=>cu.includes(d.key),[]),c=(0,no.useCallback)(d=>{a(d),o==null||o(d)},[o,a]),s=(0,no.useCallback)(d=>{let u=d.target;l(d)&&t!==n&&uu(u)&&(d.stopPropagation(),d.preventDefault(),c(t))},[l,t,n,c]),m=(0,no.useCallback)((d,u)=>{u!==n&&c(u)},[c,n]);return{activateTab:c,isControlled:i,onClick:m,onKeyDown:s,selected:n}};var du=new Set(["Enter"," "]),mu=e=>du.has(e),pu=(e,t)=>e?e.querySelector(`[data-index="${t}"]`):null,Gi=({activeTabIndex:e,allowDragDrop:t,animateSelectionThumb:o,containerRef:r,onActiveChange:n,onAddTab:a,onCloseTab:i,onExitEditMode:l,onMoveTab:c,orientation:s,keyBoardActivation:m})=>{let d=(0,ce.useRef)(e),{focusTab:u,highlightedIdx:g,onClick:f,onKeyDown:p,setHighlightedIdx:x,...y}=Ui({containerRef:r,keyBoardActivation:m,orientation:s,selectedIndex:d.current}),{activateTab:D,onClick:I,onKeyDown:v,selected:L}=Wi({highlightedIdx:g,onSelectionChange:n,selected:e});d.current=L;let{containerStyle:w,resumeAnimation:M,suspendAnimation:h}=Ki(r,o?L:-1,s),E=(0,ce.useCallback)((K,B)=>{let{current:$}=d;console.log(`useTabstrip handleDrop ${K} - ${B} ${$}`),c==null||c(K,B);let _=-1;B!==-1&&($===K?_=B:K>$&&B<=$?_=$+1:K<$&&B>=$&&(_=$-1),_!==-1&&(h(),D(_),requestAnimationFrame(M)),u(B,!1,!1,350))},[u,c,M,D,h]),{onMouseDown:H,...O}=Kr({allowDragDrop:t,containerRef:r,draggableClassName:`tabstrip-${s}`,onDrop:E,orientation:"horizontal",itemQuery:".vuuOverflowContainer-item"}),b=(0,ce.useCallback)((K,B,$,_)=>{console.log(`handleExitEditMode ${K} ${B} ${$} ${_}`),l==null||l(K,B,$,_),$||u(_,!1,!0)},[u,l]),S=(0,ce.useCallback)((K,B)=>{f(K,B),I(K,B)},[f,I]),N=(0,ce.useCallback)((K=g)=>{let B=pu(r.current,K);if(B)return B.querySelector(".vuuEditableLabel")},[r,g]),P=(0,ce.useCallback)((K=g)=>{let B=N(K);return B?B.classList.contains("vuuEditableLabel-editing"):!1},[N,g]),k=(0,ce.useCallback)((K=g)=>{let B=N(K);if(B){let $=new MouseEvent("dblclick",{view:window,bubbles:!0,cancelable:!0});B.dispatchEvent($)}},[N,g]),C=(0,ce.useCallback)(K=>{p(K),K.defaultPrevented||v(K),!K.defaultPrevented&&mu(K.key)&&k()},[k,p,v]),T=(0,ce.useCallback)(K=>{let B=ko(r.current),$=B>K?B-1:B===K?0:B;return h(),i==null||i(K,$),setTimeout(()=>{M()},200),!0},[r,i,M,h]),R=(0,ce.useCallback)(K=>(k(K),!0),[k]),A=(0,ce.useCallback)(K=>{if(ki(K.options))switch(K.menuId){case"close-tab":return T(K.options.tabIndex);case"rename-tab":return R(K.options.tabIndex);default:console.log(`tab menu action ${K.menuId}`)}return!1},[T,R]),F=(0,ce.useCallback)(()=>{P()?x(g):u(g)},[g,u,x,P]),V=(0,ce.useCallback)(K=>{let B=parseInt(K.index);isNaN(B)||D(B)},[D]),G={onFocus:y.onFocus,onKeyDown:C},z=(0,ce.useCallback)(()=>{a==null||a(),requestAnimationFrame(()=>{let K=ko(r.current);K!==-1&&u(K)})},[r,u,a]),q={onClick:S,onKeyDown:C,onExitEditMode:b,onMenuAction:A,onMenuClose:F,onMouseDown:H};return{activeTabIndex:L,containerStyle:w,focusVisible:y.focusVisible,containerProps:{...y.containerProps,onSwitchWrappedItemIntoView:V},navigationProps:G,onClickAddTab:z,tabProps:q,...O}};var Nt=require("react/jsx-runtime"),Ji=require("react"),Ur="vuuTabstrip",xs=({activeTabIndex:e,allowAddTab:t,allowCloseTab:o,allowDragDrop:r=!1,allowRenameTab:n=!1,animateSelectionThumb:a=!1,children:i,className:l,id:c,keyBoardActivation:s="manual",location:m,onActiveChange:d,onAddTab:u,onCloseTab:g,onExitEditMode:f,onMoveTab:p,orientation:x="horizontal",showTabMenuButton:y,style:D,...I})=>{let v=(0,Dt.useRef)(null),{activeTabIndex:L,focusVisible:w,containerStyle:M,draggedItemIndex:h,onClickAddTab:E,tabProps:H,...O}=Gi({activeTabIndex:e,allowDragDrop:r,animateSelectionThumb:a,containerRef:v,keyBoardActivation:s,onActiveChange:d,onAddTab:u,onCloseTab:g,onExitEditMode:f,onMoveTab:p,orientation:x}),b=(0,Lt.useId)(c),S=(0,Zi.default)(Ur,`${Ur}-${x}`,l),N=D||M?{...D,...M}:void 0,P=(0,Dt.useMemo)(()=>(0,Lt.asReactElements)(i).map((k,C)=>{let{id:T=`${b}-tab-${C}`,closeable:R=o,editable:A=n,showMenuButton:F=y}=k.props,V=C===L;return Dt.default.cloneElement(k,{...H,...O.navigationProps,closeable:R,"data-overflow-priority":V?"1":void 0,dragging:h===C,editable:A,focusVisible:w===C,id:T,index:C,key:C,location:m,selected:V,showMenuButton:F,tabIndex:V?0:-1})}).concat(t?(0,Ji.createElement)(qi.Button,{...O.navigationProps,"aria-label":"Create Tab",className:`${Ur}-addTabButton`,"data-icon":"add","data-overflow-priority":"1",key:"addButton",onClick:E,variant:"secondary",tabIndex:-1}):[]),[L,t,o,n,i,w,b,m,E,y,H,h,O.navigationProps]);return(0,Nt.jsxs)(Nt.Fragment,{children:[(0,Nt.jsx)(Lt.OverflowContainer,{...I,...O.containerProps,className:S,height:28,id:b,orientation:x,overflowIcon:"more-horiz",ref:v,style:N,children:P}),O.draggable]})};var ta=require("@salt-ds/core"),oa=J(require("classnames")),ft=require("react");var ji=require("react"),Yi=J(require("classnames"));var Qi=require("react/jsx-runtime"),fu="vuuTabMenu",Xi=({allowClose:e,allowRename:t,location:o,onMenuAction:r,onMenuClose:n,index:a})=>{let[i,l]=(0,ji.useMemo)(()=>[(c,s)=>{let m=[];return t&&m.push(Ai(s)),e&&m.push(Ri(s)),m},{tabIndex:a}],[e,t,a]);return(0,Qi.jsx)(vi,{className:fu,menuBuilder:i,menuActionHandler:r,menuLocation:(0,Yi.default)("tab",o),menuOptions:l,onMenuClose:n,tabIndex:-1})};var pt=require("react/jsx-runtime"),mt="vuuTab",ea=()=>{},bs=(0,ft.forwardRef)(function({ariaControls:t,children:o,className:r,closeable:n=!1,dragging:a,editable:i=!1,editing:l,focusVisible:c,index:s=-1,label:m,location:d,onClick:u,onClose:g,onEnterEditMode:f=ea,onExitEditMode:p=ea,onFocus:x,onKeyUp:y,onMenuAction:D,onMenuClose:I,orientation:v,selected:L,showMenuButton:w=n||i,tabIndex:M,...h},E){if(w&&typeof D!="function")throw Error("Tab onMenuAction must be provided if showMenuButton is set");let H=(0,ft.useRef)(null),O=(0,ft.useRef)(null),b=(0,ta.useForkRef)(E,H),S=(0,ft.useCallback)(T=>{l||(T.preventDefault(),u==null||u(T,s))},[l,s,u]),N=(T="",R="",A=!0)=>p(T,R,A,s),P=T=>{switch(T.key){case"Backspace":case"Delete":n&&(T.stopPropagation(),g&&g(s));break;default:y&&y(T,s)}},k=()=>i?(0,pt.jsx)(Vr,{editing:l,defaultValue:m,onEnterEditMode:f,onExitEditMode:N,ref:O},m):m,C=T=>{if(O.current){let A=O.current.querySelector(".vuuEditableLabel-input");A==null||A.focus()}x==null||x(T)};return(0,pt.jsxs)("div",{...h,"aria-controls":t,"aria-selected":L,className:(0,oa.default)(mt,{[`${mt}-closeable`]:n,"vuuDraggable-dragAway":a,[`${mt}-editing`]:l,[`${mt}-selected`]:L||void 0,[`${mt}-vertical`]:v==="vertical",vuuFocusVisible:c}),onClick:S,onFocus:C,onKeyUp:P,ref:b,role:"tab",tabIndex:M,children:[(0,pt.jsx)("div",{className:`${mt}-main`,children:(0,pt.jsx)("span",{className:`${mt}-text`,"data-text":i?void 0:m,children:o!=null?o:k()})}),w?(0,pt.jsx)(Xi,{allowClose:n,allowRename:i,location:d,onMenuAction:D,onMenuClose:I,index:s}):null]})});var Vo=require("@salt-ds/core"),$o=J(require("classnames")),zo=require("react");function gu(e){var t;if(e){let o=e.dataset.idx;if(o)return parseInt(o,10);if(o=(t=e.ariaPosInSet)!=null?t:"-1")return parseInt(o,10)-1}}var _r=e=>e.closest("[data-idx],[aria-posinset]");var ra=e=>gu(_r(e));var Pt=require("react"),hu=new Set(["/","-","."]),xu=e=>hu.has(e),na=(e,t)=>t.startsWith(e)&&xu(t[e.length]),Wr=(e,t="root",{collapsibleHeaders:o=void 0,defaultExpanded:r=!1,revealSelected:n=!1}={})=>{let a=(u,g,f)=>{if(u.childNodes)return u.childNodes.length;if(u.header){let p=f+1,x=0;for(;p<g.length&&!g[p].header;)x++,p++;return x}else return 0},i=(0,Pt.useCallback)(u=>Array.isArray(n)?n.some(g=>na(u,g)):r,[r,n]),l=(0,Pt.useCallback)((u,g,f=1,p="",x=[],y=[])=>{let D=0;return u.forEach((I,v,L)=>{var N;let w=I.header&&o,M=I.childNodes&&o===!1,h=!I.childNodes||I.childNodes.length===0,E=M||h&&!w,H=p?`${p}.${v}`:`${v}`,O=(N=I.id)!=null?N:`${t}-${H}`,b=E?void 0:i(O),S={...I,childNodes:void 0,id:O,count:!M&&b===void 0?0:a(I,L,v),expanded:b,index:g.index,level:f};if(x.push(S),y.push(u[v]),D+=1,g.index+=1,I.childNodes){let[P,k]=l(I.childNodes,g,f+1,H,[],y);S.childNodes=k,(b===!0||M)&&(D+=P)}}),[D,x,y]},[o,t,i]),[c,s,m]=(0,Pt.useMemo)(()=>l(e,{index:0}),[l,e]),d=(0,Pt.useCallback)((u,g=s)=>{let f=g.find(p=>{var x;return p.id===u||((x=p==null?void 0:p.childNodes)==null?void 0:x.length)&&na(p.id,u)});if((f==null?void 0:f.id)===u)return m[f.index];if(f)return d(u,f.childNodes)},[m,s]);return[c,s,d]};var Ye=require("react"),aa=require("@salt-ds/core"),sa="single",bu="checkbox",Iu="multi",vu="extended",yu=["Enter"," "],ia={},Su=e=>e.expanded!==void 0,la=e=>e&&e!=="none",ca=({defaultSelected:e,highlightedIdx:t,treeNodes:o,onChange:r,selected:n,selection:a=sa,selectionKeys:i=yu})=>{let l=a===sa,c=a===Iu||a.startsWith(bu),s=a===vu,m=(0,Ye.useRef)(-1),d=(0,Ye.useCallback)(v=>i.includes(v.key),[i]),[u,g]=(0,aa.useControlled)({controlled:n,default:e!=null?e:[],name:"selected"}),f=(0,Ye.useCallback)((v,L,w,M,h=!1)=>{let{current:E}=m,H=u==null?void 0:u.includes(w),b=l||s&&!h&&(!M||E===-1),S=c||s&&h&&!M,N=[];if(b&&H)N=[];else if(b)N=[w];else if(S&&H)N=u.filter(P=>P!==w);else if(S)N=u.concat(w);else if(s){let[P,k]=L>E?[E,L]:[L,E];N=u.slice();for(let C=P;C<=k;C++){let{id:T}=o[C];u.includes(T)||N.push(T)}}g(N),r&&r(v,N)},[s,o,c,r,u,g,l]),p=(0,Ye.useCallback)(v=>{if(~t&&d(v)){v.preventDefault();let L=o[t];f(v,t,L.id,!1,v.ctrlKey||v.metaKey),s&&(m.current=t)}},[s,t,o,d,f]),x=(0,Ye.useCallback)((v,L)=>{if(s&&v.shiftKey){let w=o[L];f(v,L,w.id,!0)}},[s,o,f]),y=a==="none"?ia:{onKeyDown:p,onKeyboardNavigation:x},D=(0,Ye.useCallback)(v=>{if(t!==-1){let L=o[t];Su(L)||(v.preventDefault(),v.stopPropagation(),f(v,t,L.id,v.shiftKey,v.ctrlKey||v.metaKey),s&&(m.current=t))}},[s,t,o,f]);return{listHandlers:y,listItemHandlers:a==="none"?ia:{onClick:D},selected:u,setSelected:g}};var fe=require("react");var ht=require("react");var gt=new Map,da=(e,t,o)=>{switch(o){case"height":return t.height;case"clientHeight":return e.clientHeight;case"clientWidth":return e.clientWidth;case"contentHeight":return t.contentHeight;case"contentWidth":return t.contentWidth;case"scrollHeight":return Math.ceil(e.scrollHeight);case"scrollWidth":return Math.ceil(e.scrollWidth);case"width":return t.width;default:return 0}};var ua=new ResizeObserver(e=>{for(let t of e){let{target:o,borderBoxSize:r,contentBoxSize:n}=t,a=gt.get(o);if(a){let[{blockSize:i,inlineSize:l}]=r,[{blockSize:c,inlineSize:s}]=n,{onResize:m,measurements:d}=a,u=!1;for(let[g,f]of Object.entries(d)){let p=da(o,{height:i,width:l,contentHeight:c,contentWidth:s},g);p!==f&&(u=!0,d[g]=p)}u&&m&&m(d)}}});function ma(e,t,o,r=!1){let n=(0,ht.useRef)(t),a=(0,ht.useCallback)(i=>{let{width:l,height:c}=i.getBoundingClientRect(),{clientWidth:s,clientHeight:m}=i;return n.current.reduce((d,u)=>(d[u]=da(i,{width:l,height:c,contentHeight:m,contentWidth:s},u),d),{})},[]);(0,ht.useEffect)(()=>{let i=e.current;async function l(){gt.set(i,{measurements:{}}),await document.fonts.ready;let c=gt.get(i);if(c){let s=a(i);c.measurements=s,ua.observe(i),r&&o(s)}else console.log("%cuseResizeObserver an target expected to be under observation wa snot found. This warrants investigation","font-weight:bold; color:red;")}if(i){if(gt.has(i))throw Error("useResizeObserver attemping to observe same element twice");l()}return()=>{i&>.has(i)&&(ua.unobserve(i),gt.delete(i))}},[a,e]),(0,ht.useEffect)(()=>{let i=e.current,l=gt.get(i);if(l){if(n.current!==t){n.current=t;let c=a(i);l.measurements=c}l.onResize=o}},[t,a,e,o])}var Tu=["height","scrollHeight"],pa=(e,t,o=!1)=>{let r=(0,fe.useRef)(0),n=(0,fe.useRef)(!1),a=(0,fe.useRef)(0),i=(0,fe.useRef)(0),l=(0,fe.useCallback)(m=>{let d=m.ariaExpanded?m.firstChild:m,u=o?30:0,g=d.offsetTop,f=d.offsetHeight,p=r.current+u,x=p+a.current-u;(g+f>x||g<p)&&(r.current=g+f>x?r.current+(g+f)-x:g-u,n.current=!0,e.current&&(e.current.scrollTop=r.current),setTimeout(()=>{n.current=!1}))},[e,o]),c=(0,fe.useCallback)(m=>{r.current=m.target.scrollTop},[]);(0,fe.useEffect)(()=>{let{current:m}=e;return m&&m.addEventListener("scroll",c),()=>{m&&m.removeEventListener("scroll",c)}},[e,c]),(0,fe.useLayoutEffect)(()=>{if(t!==-1&&i.current>a.current&&e.current){let m=e.current.querySelector(`
|
|
1
|
+
"use strict";var Ss=Object.create;var Vt=Object.defineProperty;var ys=Object.getOwnPropertyDescriptor;var Ts=Object.getOwnPropertyNames;var Es=Object.getPrototypeOf,vs=Object.prototype.hasOwnProperty;var Ds=(e,t)=>{for(var n in t)Vt(e,n,{get:t[n],enumerable:!0})},to=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ts(t))!vs.call(e,r)&&r!==n&&Vt(e,r,{get:()=>t[r],enumerable:!(o=ys(t,r))||o.enumerable});return e};var Pe=(e,t,n)=>(n=e!=null?Ss(Es(e)):{},to(t||!e||!e.__esModule?Vt(n,"default",{value:e,enumerable:!0}):n,e)),ws=e=>to(Vt({},"__esModule",{value:!0}),e);var bi={};Ds(bi,{BWD:()=>Ms,DragDropProvider:()=>Ls,EditableLabel:()=>Mn,FWD:()=>Hs,Highlighter:()=>Cn,List:()=>Rl,ListItem:()=>Nt,ListItemGroup:()=>On,ListItemHeader:()=>An,ListItemProxy:()=>Ct,NOT_HIDDEN:()=>xn,NOT_OVERFLOWED:()=>vt,Tab:()=>jl,Tabstrip:()=>Wl,Tree:()=>ms,TreeNode:()=>Jn,VirtualizedList:()=>Al,cloneElement:()=>Sn,constrainRect:()=>En,dimensions:()=>Ee,dropTargetsDebugString:()=>As,getElementIndex:()=>xr,getIndexOfDraggedItem:()=>Xe,getIndexOfEditedItem:()=>Un,getIndexOfSelectedTab:()=>an,getItemById:()=>yn,getNextDropTarget:()=>Ye,isExpanded:()=>pn,measureDropTargets:()=>qe,measureElementSizeAndPosition:()=>ro,moveItem:()=>Os,mutateDropTargetsSwitchDropTargetPosition:()=>Gt,removeDraggedItem:()=>Tn,useDragDropNext:()=>wt,useDragDropProvider:()=>hn,useItemsWithIds:()=>qn,useList:()=>At});module.exports=ws(bi);var Hs="fwd",Ms="bwd";var ze=require("react"),oo=require("react/jsx-runtime"),Cs={isDragSource:!1,isDropTarget:!1,register:()=>{}},Ns=()=>console.log("have you forgotten to provide a DragDrop Provider ?"),no=(0,ze.createContext)({registerDragDropParty:Ns}),Ls=({children:e,dragSources:t})=>{let[n,o]=(0,ze.useMemo)(()=>{let i=new Map,s=new Map;for(let[a,{dropTargets:c}]of Object.entries(t)){let d=i.get(a),f=Array.isArray(c)?c:[c];d?d.push(...f):i.set(a,f);for(let u of f){let I=s.get(u);I?I.push(a):s.set(u,[a])}}return[i,s]},[t]);console.log({dragSources:n,dropTargets:o});let r=(0,ze.useCallback)(i=>{console.log(`registerDragDropParty ${i}`)},[]),l=(0,ze.useMemo)(()=>({dragSources:n,dropTargets:o,registerDragDropParty:r}),[n,o,r]);return(0,oo.jsx)(no.Provider,{value:l,children:e})},hn=e=>{var r,l;let{dragSources:t,dropTargets:n,registerDragDropParty:o}=(0,ze.useContext)(no);if(e){let i=(r=t==null?void 0:t.has(e))!=null?r:!1,s=(l=n==null?void 0:n.has(e))!=null?l:!1;return{isDragSource:i,isDropTarget:s,register:o}}else return Cs};var ae=require("react");var Ne=require("react");var Rs=["left","right"],ks=["top","bottom"],vt=":not(.wrapped)",xn=':not([aria-hidden="true"])',Sn=e=>{let t=e.cloneNode(!0);return t.removeAttribute("id"),t.dataset.index="-1",t},ro=(e,t="width",n=!1)=>{let o=t==="width"?"left":"top",{[t]:r,[o]:l}=e.getBoundingClientRect(),{padEnd:i=!1,padStart:s=!1}=e.dataset,a=getComputedStyle(e),[c,d]=t==="width"?Rs:ks,f=s&&!n?0:parseInt(a.getPropertyValue(`margin-${c}`),10),u=i&&!n?0:parseInt(a.getPropertyValue(`margin-${d}`),10),I=r;if(parseInt(a.getPropertyValue("flex-shrink"),10)>0){let p=parseInt(a.getPropertyValue("flex-basis"),10);!isNaN(p)&&p>0&&(I=p)}return[l,f+I+u]},Ps={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"}},Ee=e=>Ps[e],yn=(e,t)=>{let n=e.find(o=>o.id===t);if(n)return n},Tn=(e,t)=>{e.splice(t,1);for(let n=t;n<e.length;n++)e[n].currentIndex-=1},qe=(e,t,n,o,r)=>{var f;let l=[],{DIMENSION:i}=Ee(t),s=Array.from(n?e.querySelectorAll(n):e.children),a=s.length,c=typeof(o==null?void 0:o.from)=="number"?o.atEnd?Math.max(0,o.from-1):o.from:0,d=typeof(o==null?void 0:o.to)=="number"?Math.min(o.to+2,a-1):a-1;for(let u=c;u<=d;u++){let I=s[u],[m,p]=ro(I,i),g=u===a-1,S=I.id,E=parseInt((f=I.dataset.index)!=null?f:"-1");l.push({currentIndex:u,dataIndex:isNaN(E)?-1:E,id:S,index:u,isDraggedItem:r===S,isLast:g,isOverflowIndicator:I.dataset.index==="overflow",element:I,start:m,end:m+p,size:p,mid:m+p/2})}return l},Xe=(e,t=!1)=>{let n=e.findIndex(r=>r.isDraggedItem),{index:o}=e[n];if(t){let r=e.filter(i=>!i.isDraggedItem).reduce((i,s)=>Math.min(i,s.index),Number.MAX_SAFE_INTEGER);if(r>0&&!(o===0&&r===1))return r+n}return n},Gt=(e,t)=>{let n=Xe(e),o=t==="fwd"?n+1:n-1;if(o<0||o>=e.length)throw Error("switchDropTargetPosition index out of range");let r=e.at(n),l=e.at(o),i=l.size-r.size;if(t==="fwd"){let s=l.start+i,a=l.end,c={...r,start:s,mid:Math.floor(s+(a-s)/2),end:a},d=r.start,f=r.end+i,u={...l,start:d,mid:Math.floor(d+(f-d)/2),end:f};e.splice(n,2,u,c)}else{let s=l.start,a=l.end-i,c={...r,start:s,mid:Math.floor(s+(a-s)/2),end:a},d=r.start-i,f=r.end,u={...l,start:d,mid:Math.floor(d+(f-d)/2),end:f};e.splice(o,2,c,u)}},Ye=(e,t,n)=>{let o=e.length,r=Xe(e),l=e[r];if(n==="fwd"){let i=Math.round(t+l.size);for(let s=o-1;s>=0;s--){let a=e[s];if(i>a.mid)return s<r?l:a}}else{let i=Math.round(t);for(let s=0;s<o;s++){let a=e[s];if(i<a.mid)return s>r?l:a}}throw Error("no dropTraget identified")};function En(e,t){let{height:n,left:o,top:r,width:l}=e,{height:i,width:s}=t;return{height:Math.min(n,i),left:o,top:r,width:Math.min(l,s)}}var Os=(e,t,n)=>{if(t===n)return e;{let o=e.slice(),[r]=o.splice(t,1);if(n===-1)return o.concat(r);{let l=(n>t,0);return o.splice(n+l,0,r),o}}},As=e=>e.map((t,n)=>`
|
|
2
|
+
${t.isDraggedItem?"*":" "}[${n}] width : ${Math.floor(t.size)} ${Math.floor(t.start)} - ${Math.floor(t.end)} (mid ${Math.floor(t.mid)})`).join("");var so=require("@salt-ds/core"),lo=Pe(require("classnames")),Wt=require("react"),io=require("@vuu-ui/vuu-popups");var vn=require("react/jsx-runtime"),Ks=e=>e.split(" ").map(t=>`vuuDraggable-${t}`),Ut=(0,Wt.forwardRef)(function({wrapperClassName:t,element:n,onTransitionEnd:o,style:r,scale:l=1},i){let s=(0,Wt.useCallback)(c=>{c&&(c.innerHTML="",c.appendChild(n),l!==1&&(c.style.transform=`scale(${l},${l})`))},[n,l]),a=(0,so.useForkRef)(i,s);return(0,vn.jsx)(io.Portal,{children:(0,vn.jsx)("div",{className:(0,lo.default)("vuuDraggable",...Ks(t)),ref:a,onTransitionEnd:o,style:r})})}),Dn=e=>{let t=document.createElement("div");return t.className="vuuDraggable-spacer",e&&t.addEventListener("transitionend",()=>{e.current=!1}),t},ao=()=>{let e=document.createElement("div");return e.className="vuuDraggable-dropIndicatorPosition",e},co=e=>{let t=document.createElement("div");return t.className="vuuDraggable-dropIndicator",e&&t.addEventListener("transitionend",()=>{e.current=!1}),t};var uo=()=>{let e=(0,Ne.useRef)(0),t=(0,Ne.useRef)(!1),n=(0,Ne.useMemo)(()=>[Dn(t),Dn()],[]),o=(0,Ne.useCallback)(()=>n.forEach(a=>a.remove()),[n]),r=(0,Ne.useCallback)((a,c="width")=>{let[d,f]=n;e.current=requestAnimationFrame(()=>{t.current=!0,d.style.cssText=`${c}: 0px`,f.style.cssText=`${c}: ${a}px`,n[0]=f,n[1]=d})},[n]),l=(0,Ne.useCallback)(()=>{e.current&&(cancelAnimationFrame(e.current),e.current=0)},[]),i=(0,Ne.useCallback)((a,c,d,f=!1,u="static",I="horizontal")=>{if(c){let m=I==="horizontal"?"width":"height",[p,g]=n;if(l(),f)t.current?(o(),p.style.cssText=`${m}: ${d}px`,g.style.cssText=`${m}: 0px`,u==="fwd"?(c.element.before(p),c.element.after(g)):(c.element.after(p),c.element.before(g))):u==="fwd"?c.element.after(g):c.element.before(g),r(d,m);else if(u==="static")p.style.cssText=`${m}: ${d}px`,c.element.before(p);else throw Error("useDragDisplacers currently only supports noTransition for static displacement");u!=="static"&&Gt(a,u)}},[r,l,o,n]),s=(0,Ne.useCallback)((a,c,d,f=!1,u="static",I="horizontal")=>{let m=I==="horizontal"?"width":"height",[p,g]=n;l(),f?(t.current?(o(),p.style.cssText=`${m}: ${d}px`,g.style.cssText=`${m}: 0px`,c.element.before(p),c.element.after(g)):u==="fwd"?c.element.after(g):c.element.before(g),r(d,m)):(p.style.cssText=`${m}: ${d}px`,c.element.after(p)),u!=="static"&&Gt(a,u)},[r,l,o,n]);return{displaceItem:i,displaceLastItem:s,clearSpacers:o}};var mo=({draggableRef:e,onDrop:t,orientation:n="horizontal",containerRef:o,itemQuery:r="*",selected:l,viewportRange:i})=>{let s=(0,ae.useRef)(),a=(0,ae.useRef)(!1),c=(0,ae.useRef)(-1),d=(0,ae.useRef)([]),f=(0,ae.useRef)(!1),[u,I]=(0,ae.useState)(!1),{clearSpacers:m,displaceItem:p,displaceLastItem:g}=uo(),S=(0,ae.useRef)(),E=`:is(${r}${vt}${xn},.vuuOverflowContainer-OverflowIndicator)`,v=b=>d.current.findIndex(M=>M.id===b.id),x=(0,ae.useRef)();x.current=i;let T=(0,ae.useCallback)(()=>{m()},[m]),N=(0,ae.useCallback)((b,M,C)=>{let{current:R}=o,{current:D}=S;if(R&&D){d.current=qe(R,n,E,x.current),b==="fwd"?d.current.push(D):d.current.unshift(D);let{size:h}=D,L=c.current+h/2,{current:w}=d,A=Ye(w,L,"fwd");if(A){let W=v(A),V=w[W];C&&b==="fwd"?g(w,w[w.length-1],h,!1,"static",n):p(w,V,h,!0,"static",n)}}},[o,p,g,E,n]),P=(0,ae.useCallback)(b=>{let C=b.target.closest(r);C.ariaSelected&&Array.isArray(l)&&l.length>1&&console.log("its a selected element, and we have a multi select");let{current:R}=o;if(R&&C){let{SCROLL_SIZE:D,CLIENT_SIZE:h}=Ee(n),{id:y}=C,{[D]:L,[h]:w}=R;a.current=L>w;let A=d.current=qe(R,n,E,i,y),z=Xe(A),W=A[z];if(W&&R){S.current=W;let V=W.isLast?g:p;console.log({indexOfDraggedItem:z,draggedItem:W}),V(A,W,W.size,!1,"static",n)}}},[o,p,g,E,r,n,l,i]),[H,k]=(0,ae.useMemo)(()=>{let b=!1;return[R=>{if(!b){b=!0;let D=R.element.querySelector(".vuuPopupMenu");if(D){let h=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});D.dispatchEvent(h)}}},R=>{if(b){b=!1;let D=R.element.querySelector(".vuuPopupMenu");if(D){let h=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});D.dispatchEvent(h)}}}]},[]),O=(0,ae.useCallback)((b,M)=>{let{current:C}=S;if(C&&e.current&&o.current){c.current=b;let{current:R}=d,D=Ye(R,b,M);if(D&&!D.isDraggedItem)if(D.isOverflowIndicator)I(f.current=!0),H(D);else{let{size:h}=C;(v(D)===R.length-1?g:p)(R,D,h,!0,M,n);let w=R.at(-1);k(w),I(f.current=!1)}s.current=M}},[o,p,g,e,k,n,H]),$=(0,ae.useCallback)(()=>{var R;m();let{current:b}=d,M=Xe(b),C=b[M];if(C)if(s.current=void 0,f.current)t(C.index,-1);else{let D=Xe(b,!0);t(C.index,D)}if(I(!1),o.current){let D=(R=o.current)==null?void 0:R.scrollTop;M<b.length&&(o.current.scrollTop=D)}},[m,o,t]);return{beginDrag:P,drag:O,drop:$,handleScrollStart:T,handleScrollStop:N,revealOverflowedItems:u}};var se=require("react");var Dt=require("react");var fo=()=>{let e=(0,Dt.useMemo)(()=>ao(),[]),t=(0,Dt.useCallback)(()=>e.remove(),[e]);return{positionDropIndicator:(0,Dt.useCallback)((o,r="end")=>(r==="end"?o.element.after(e):o.element.before(e),e),[e]),clearSpacer:t}};var go=require("react/jsx-runtime"),Fs=':not([data-overflowed="true"])',$s=':not([aria-hidden="true"])',po=({draggableRef:e,onDrop:t,orientation:n="horizontal",containerRef:o,itemQuery:r="*",selected:l,viewportRange:i})=>{let s=(0,se.useRef)(),a=(0,se.useRef)(null),c=(0,se.useRef)(null),d=(0,se.useRef)(""),f=(0,se.useRef)(!1),u=(0,se.useRef)(-1),I=(0,se.useRef)([]),m=(0,se.useRef)(!1),[p,g]=(0,se.useState)(!1),[S,E]=(0,se.useState)(),{clearSpacer:v,positionDropIndicator:x}=fo(),T=(0,se.useRef)(),N=`:is(${r}${Fs}${$s},[data-overflow-indicator])`,P=R=>I.current.findIndex(D=>D.id===R.id),H=(R,D,h)=>{R.start+=D,R.mid+=D,R.end+=D,typeof h=="number"&&(R.currentIndex+=h)},k=(0,se.useRef)();k.current=i;let O=(0,se.useCallback)(()=>{v()},[v]),$=(0,se.useCallback)((R,D,h)=>{let{current:y}=o,{current:L}=T;if(y&&L){I.current=qe(y,n,N,k.current);let{size:w}=L,z=u.current+w/2,{current:W}=I,V=Ye(W,z,"fwd");V&&x(h&&R==="fwd"?W[W.length-1]:V,"start")}},[o,x,N,n]),b=(0,se.useCallback)(R=>{let h=R.target.closest(r);h.ariaSelected&&Array.isArray(l)&&l.length>1&&console.log("its a selected element, and we have a multi select");let{current:y}=o;if(y&&h){let{SCROLL_SIZE:L,CLIENT_SIZE:w}=Ee(n),{id:A}=h,{[L]:z,[w]:W}=y;f.current=z>W;let V=I.current=qe(y,n,N,i),j=yn(V,A);if(j&&y){let K=P(j);Tn(V,K),T.current=j;let{current:F}=k;if(F!=null&&F.atEnd)for(let q=0;q<V.length;q++)H(V[q],j.size);for(let q=K;q<V.length;q++)H(V[q],-j.size,-1);let[Z,X]=j.isLast?[V[V.length-1],"end"]:[V[K],"start"];c.current=Z,d.current=X;let ie=x(Z,X),{top:G,left:U,width:Y}=ie.getBoundingClientRect(),Q={top:j.isLast?F!=null&&F.atEnd&&!F.atStart?G+j.size-2:G-2:G-j.size-2,left:U,width:Y,height:2};E((0,go.jsx)(Ut,{wrapperClassName:"dropIndicatorContainer",style:Q,ref:a,element:co()}))}}},[r,l,o,n,N,i,x]),M=(0,se.useCallback)((R,D)=>{let{current:h}=c,{current:y}=T;if(y&&e.current&&o.current){let L=n==="horizontal"?"left":"top";u.current=R;let{current:w}=I,A=Ye(w,R,D);if(A&&A.index!==(h==null?void 0:h.index)){if(A.isOverflowIndicator)g(m.current=!0);else if(a.current){if(P(A)===w.length-1){let W=w[w.length-1],j=x(W,"start").getBoundingClientRect();a.current.style[L]=`${j.top}px`}else{let V=x(A,"start").getBoundingClientRect();a.current.style[L]=`${V.top}px`}g(m.current=!1)}c.current=A,s.current=D}}},[e,o,n,x]),C=(0,se.useCallback)(()=>{v();let{current:R}=T,{current:D}=c,{current:h}=d,{current:y}=k;if(R&&y&&D){let{index:L}=R,w=h==="start",{index:A,currentIndex:z}=D;c.current=null,s.current=void 0,m.current?t(L,-1):L<A?t(L,w?z:z+1):t(L,w?A:A+1),E(void 0)}g(!1)},[v,t]);return{beginDrag:b,drag:M,drop:C,dropIndicator:S,handleScrollStart:O,handleScrollStop:$,revealOverflowedItems:p}};var te=require("react");var Ge=require("react");var bo=({containerRef:e,onScrollingStopped:t,orientation:n="vertical"})=>{let o=(0,Ge.useRef)(null),r=(0,Ge.useRef)(!1),l=(0,Ge.useRef)(0),i=(0,Ge.useRef)("fwd"),s=(0,Ge.useCallback)((c=!1)=>{console.log("[useAutoScroll] stopScrolling"),o.current!==null&&(clearTimeout(o.current),o.current=null),r.current=!1,t==null||t(i.current,l.current,c)},[t]),a=(0,Ge.useCallback)((c,d,f=30)=>{let{current:u}=e;if(u){let{SCROLL_POS:I,SCROLL_SIZE:m,CLIENT_SIZE:p}=Ee(n),{[I]:g,[m]:S,[p]:E}=u,v=c==="fwd"?S-E-g:g,x=Math.min(v,f);c==="fwd"?(i.current="fwd",u[I]=l.current=g+x):(i.current="bwd",u[I]=l.current=g-x),x===v?s(!0):(r.current=!0,o.current=window.setTimeout(()=>{a(c,d,f)},100))}},[e,n,s]);return{isScrolling:r,startScrolling:a,stopScrolling:s}};var ho=require("react/jsx-runtime"),zs={beginDrag:()=>{},drag:()=>{},draggableRef:{current:null},drop:()=>{},isDragging:!1,isScrolling:!1,handleScrollStart:()=>{},handleScrollStop:()=>{},revealOverflowedItems:!1},Io={start:0,end:1e3,contraStart:0,contraEnd:1e3},Bs=()=>zs,_s=3,Vs=(e,t)=>e.closest(t),Gs=e=>e.dataset.index==="overflow"&&e.parentElement!==null&&e.parentElement.classList.contains("overflowed"),Ws=(e,t)=>{let n=`:is(${t}${vt},.vuuOverflowContainer-OverflowIndicator)`,r=Array.from(e.querySelectorAll(n)).pop();return[r,Gs(r)]},wt=({allowDragDrop:e,containerRef:t,draggableClassName:n,itemQuery:o="*",onDragStart:r,onDrop:l,onDropSettle:i,orientation:s,...a})=>{let c=(0,te.useRef)({start:0,end:0,contraStart:0,contraEnd:0}),[d,f]=(0,te.useState)({draggable:void 0,draggedItemIndex:-1,isDragging:!1}),u=(0,te.useRef)(null),I=(0,te.useRef)(),m=(0,te.useRef)(null),p=(0,te.useRef)(!1),g=(0,te.useRef)({x:0,y:0}),S=(0,te.useRef)({x:0,y:0}),E=(0,te.useRef)({x:0,y:0}),v=(0,te.useRef)(null),x=(0,te.useRef)(-1),T=(0,te.useRef)(-1),N=(0,te.useRef)(),{isDragSource:P,isDropTarget:H,register:k}=hn(a.id);a.id&&(P||H)&&k(a.id);let O=(0,te.useCallback)(()=>{var Y;let{current:G}=T,U=(Y=t.current)==null?void 0:Y.querySelector(`${o}[data-index="${G}"]`);U&&U.classList.remove("vuuDropTarget-settling"),T.current=-1,i==null||i(G),f(Q=>({...Q,draggable:void 0}))},[t,o,i]),$=(0,te.useCallback)(G=>{if(t.current){let{POS:U,SCROLL_POS:Y,SCROLL_SIZE:Q,CLIENT_SIZE:q}=Ee(s),{[Y]:ee,[Q]:fe,[q]:pe}=t.current,Se=fe-pe,ye=ee<Se,De=c.current.end,we=ee>0&&G-g.current[U]<=c.current.start,He=ye&&G-g.current[U]>=De;return we?"bwd":He?"fwd":""}},[t,s]),b=e===!0||e==="natural-movement"?mo:e==="drop-indicator"?po:Bs,M=(0,te.useCallback)((G,U,Y)=>{var Q;(Q=N.current)==null||Q.call(N,G,U,Y)},[]),{isScrolling:C,startScrolling:R,stopScrolling:D}=bo({containerRef:t,onScrollingStopped:M,orientation:s}),h=(0,te.useCallback)((G,U)=>{x.current=U,l==null||l(G,U),T.current=U},[l]),{beginDrag:y,drag:L,drop:w,handleScrollStart:A,handleScrollStop:z,...W}=b({...a,containerRef:t,draggableRef:u,isDragSource:P,isDropTarget:H,itemQuery:o,onDrop:h,orientation:s});N.current=z;let V=(0,te.useCallback)(G=>{let{CLIENT_POS:U,CONTRA_CLIENT_POS:Y,CONTRA_POS:Q,POS:q}=Ee(s),{clientX:ee,clientY:fe}=G,{[U]:pe,[Y]:Se}=G,ye=S.current[q],De=S.current[Q],we=Math.abs(ye-pe);if((P?Math.abs(De-Se):0)-we>5&&(c.current=Io),S.current.x=ee,S.current.y=fe,c.current===Io&&u.current){let B=S.current.x-g.current.x,_=S.current.y-g.current.y;u.current.style.top=`${_}px`,u.current.style.left=`${B}px`}else if(we>0&&u.current){let B=ye<pe?"fwd":"bwd",_=$(pe),J=S.current[q]-g.current[q];if(_&&p.current&&!C.current?(A(),R(_,1)):!_&&C.current&&D(),!C.current){let oe=Math.round(Math.max(c.current.start,Math.min(c.current.end,J))),ue=s==="horizontal"?"left":"top";u.current.style[ue]=`${oe}px`,L(oe,B)}}},[L,u,$,A,P,C,s,R,D]),j=(0,te.useCallback)(()=>{document.removeEventListener("mousemove",V,!1),document.removeEventListener("mouseup",j,!1),v.current=u.current,w(),f(G=>({...G,draggedItemIndex:-1,isDragging:!1})),I.current=void 0},[V,u,w]),K=(0,te.useCallback)(G=>{let{clientX:U,clientY:Y,target:Q}=G,q=Vs(Q,o),{current:ee}=t;if(ee&&q){let{CONTRA:fe,CONTRA_END:pe,DIMENSION:Se,END:ye,SCROLL_SIZE:De,CLIENT_SIZE:we,START:He}=Ee(s);I.current=q;let{[De]:B,[we]:_}=ee;p.current=B>_;let[J,oe]=Ws(ee,o),ue=ee.getBoundingClientRect(),Re=q.getBoundingClientRect(),ke=Re[Se],{[He]:Ve,[ye]:je}=J.getBoundingClientRect();g.current.x=U-Re.left,g.current.y=Y-Re.top,c.current.start=ue[He],c.current.end=oe?Math.max(Ve,ue.right-ke):p.current?ue[He]+ue[Se]-ke:je-ke,c.current.contraStart=ue[fe],c.current.contraEnd=ue[pe],y(G);let{dataset:{index:Fe="-1"}}=q;f({isDragging:!0,draggable:(0,ho.jsx)(Ut,{element:Sn(q),onTransitionEnd:O,ref:u,style:En(Re,ue),wrapperClassName:n}),draggedItemIndex:parseInt(Fe)}),r==null||r(),document.addEventListener("mousemove",V,!1),document.addEventListener("mouseup",j,!1)}},[y,t,V,j,n,u,o,r,s,O]),F=(0,te.useCallback)(G=>{let{CLIENT_POS:U,POS:Y}=Ee(s),{[U]:Q}=G;Math.abs(Q-E.current[Y])>_s&&t.current&&(m.current&&(window.clearTimeout(m.current),m.current=null),document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",Z,!1),K(G))},[t,y,s]),Z=(0,te.useCallback)(()=>{m.current&&(window.clearTimeout(m.current),m.current=null),document.removeEventListener("mousemove",F,!1),document.removeEventListener("mouseup",Z,!1)},[F]),X=(0,te.useCallback)(G=>{let{current:U}=t;if(U&&!G.defaultPrevented){let{clientX:Y,clientY:Q}=G;S.current.x=E.current.x=Y,S.current.y=E.current.y=Q,document.addEventListener("mousemove",F,!1),document.addEventListener("mouseup",Z,!1),G.persist(),m.current=window.setTimeout(()=>{document.removeEventListener("mousemove",F,!1),document.removeEventListener("mouseup",Z,!1),K(G.nativeEvent)},500)}},[t,K,F,Z]),{current:ie}=v;return(0,te.useLayoutEffect)(()=>{if(ie&&t.current){let G=x.current,U=t.current.querySelector(`${o}[data-index="${G}"]`);U?(U.classList.add("vuuDropTarget-settling"),requestAnimationFrame(()=>{let{top:Y,left:Q}=U.getBoundingClientRect(),{top:q,left:ee}=ie.getBoundingClientRect();ee!==Q||q!==Y?(ie.classList.add("vuuDraggable-settling"),ie.style.top=`${Y}px`,ie.style.left=`${Q}px`):O()})):console.log(`dont have the dropped item (at ${G})`),v.current=null}},[t,o,ie,O]),{...W,...d,isScrolling:C,onMouseDown:e?X:void 0}};var xo=Pe(require("classnames")),Le=require("react"),Ht=require("@salt-ds/core");var Hn=require("react/jsx-runtime"),wn="vuuEditableLabel",Mn=(0,Le.forwardRef)(function({className:t,defaultEditing:n,defaultValue:o,editing:r,onChange:l,onEnterEditMode:i,onExitEditMode:s,value:a,...c},d){let f=(0,Le.useRef)(null),u=(0,Le.useRef)(!1),[I,m]=(0,Ht.useControlled)({controlled:a,default:o!=null?o:"",name:"EditableLabel",state:"value"}),[p,g]=(0,Ht.useControlled)({controlled:r,default:n!=null?n:!1,name:"EditableLabel",state:"editing"}),S=(0,Le.useCallback)(O=>{g(u.current=O)},[]),E=(0,Le.useRef)(I);(0,Le.useLayoutEffect)(()=>{p&&f.current!==null&&(f.current.select(),f.current.focus())},[p,f]);let v=(0,Le.useCallback)(()=>{S(!0),i&&i()},[i,S]),x=({cancelEdit:O=!1,allowDeactivation:$=!1}={})=>{S(!1);let b=E.current;b!==I&&(O?m(b):E.current=I),s&&s(b,I,$,O)},T=O=>{let{value:$}=O.target;m($),l&&l($)},N=()=>{v()},P=()=>{u.current&&x({allowDeactivation:!0})},H=O=>{p&&O.key==="Enter"?(O.stopPropagation(),x()):O.key==="ArrowRight"||O.key==="ArrowLeft"?O.stopPropagation():O.key==="Escape"&&x({cancelEdit:!0})},k=(0,xo.default)(wn,t,{[`${wn}-editing`]:p});return(0,Hn.jsx)("div",{...c,className:k,onDoubleClick:N,"data-text":I,ref:d,children:p?(0,Hn.jsx)(Ht.Input,{inputProps:{className:`${wn}-input`},value:I,onBlur:P,onChange:T,onKeyDown:H,inputRef:f,style:{padding:0},textAlign:"left",variant:"secondary"}):I})});var So=require("@salt-ds/core");var Us=/[.*+?^${}()|[\]\\]/g;function jt(e){return e.replace(Us,"\\$&")}var ut=require("react/jsx-runtime"),js=(0,So.makePrefixer)("saltHighlighter"),Cn=e=>{let{matchPattern:t,text:n=""}=e,o=typeof t=="string"?new RegExp(`(${jt(t)})`,"gi"):t;return o===void 0?(0,ut.jsx)(ut.Fragment,{children:n}):(0,ut.jsx)("span",{children:n.split(o).map((r,l)=>r.match(o)?(0,ut.jsx)("strong",{className:js("highlight"),children:r},`${l}-${r}`):r)})};var Nn=require("react"),Ln=Pe(require("classnames"));var To=Pe(require("classnames"));var vo=require("react/jsx-runtime"),yo="vuuCheckboxIcon",Eo=({checked:e=!1,...t})=>(0,vo.jsx)("span",{...t,className:(0,To.default)(yo,{[`${yo}-checked`]:e})});var Je=require("react/jsx-runtime"),Mt="vuuListItem",Ct=(0,Nn.forwardRef)(function(t,n){return(0,Je.jsx)("div",{"aria-hidden":!0,className:(0,Ln.default)(Mt,`${Mt}-proxy`),ref:n})}),Nt=(0,Nn.forwardRef)(function({children:t,className:n,disabled:o,tabIndex:r,item:l,itemHeight:i,itemTextHighlightPattern:s,label:a,selectable:c,selected:d,showCheckbox:f,style:u,...I},m){let p=(0,Ln.default)(Mt,n,{vuuDisabled:o,[`${Mt}-checkbox`]:f}),g=i!==void 0?{...u,height:i}:u;return(0,Je.jsxs)("div",{className:p,...I,"aria-disabled":o||void 0,"aria-selected":d||void 0,ref:m,style:g,children:[f&&(0,Je.jsx)(Eo,{"aria-hidden":!0,checked:d}),t&&typeof t!="string"?t:s==null?(0,Je.jsx)("span",{className:`${Mt}-textWrapper`,children:a||t}):(0,Je.jsx)(Cn,{matchPattern:s,text:a||t})]})});var cr=require("@vuu-ui/vuu-layout"),ur=require("@salt-ds/core"),rn=Pe(require("classnames")),Ke=require("react");var Lt=require("react"),qs=require("react/jsx-runtime"),Zs=(0,Lt.createContext)(void 0);function Do(){let e=(0,Lt.useContext)(Zs);if(e)return e}var Xs=e=>Object.prototype.toString.call(e)==="[object Object]";function dt(e){return typeof e=="string"?e:Xs(e)?Object.prototype.hasOwnProperty.call(e,"label")?String(e.label):(console.warn(["itemToString: you've likely forgotten to set the label prop on the item object.","You can also provide your own `itemToString` implementation."].join(`
|
|
3
|
+
`)),""):String(e)}function Ys(e,...t){let n=new Set(e);for(let o of t)for(let r of o)n.add(r);return n}var Rt="ArrowUp",kt="ArrowDown",wo="ArrowLeft",Ho="ArrowRight",Rn="Enter";var Zt="Home",Pt="End",kn="PageUp",qt="PageDown",Mo=" ";var Js=new Set(["Enter","Delete"," "]),Qs=new Set(["Tab"]),el=new Set(["ArrowRight","ArrowLeft"]),Co=new Set([Zt,Pt,kn,qt,kt,Rt]),tl=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),nl=Ys(Js,Co,el,tl,Qs),Xt=e=>nl.has(e.key)?!1:e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey,No=({key:e})=>Co.has(e);var Pn=require("react");var ol={},rl=e=>Array.isArray(e.childNodes),sl=e=>!0,ll=e=>e.closest("[data-toggle],[aria-expanded]").dataset.toggle==="true",Lo=({collapsibleHeaders:e,collectionHook:t,highlightedIdx:n,onToggle:o})=>{let r=(0,Pn.useCallback)(s=>{if(s.key===Ho||s.key===Rn){let a=t.data[n];a&&a.expanded===!1&&a.value&&(s.preventDefault(),t.expandGroupItem(a),o==null||o(a.value))}if(s.key===wo||s.key===Rn){let a=t.data[n];a&&a.expanded&&a.value&&(s.preventDefault(),t.collapseGroupItem(a),o==null||o(a.value))}},[t.collapseGroupItem,t.data,t.expandGroupItem,n]),i={onClick:(0,Pn.useCallback)(s=>{console.log(`useCollapsibleGroups idx=${n}`);let a=t.data[n];console.log(s.target,s.currentTarget),a&&rl(a)&&(!sl(a)||ll(s.target))&&(s.stopPropagation(),s.preventDefault(),a.expanded===!1&&a.value?(t.expandGroupItem(a),o==null||o(a.value)):a.expanded===!0&&a.value&&(t.collapseGroupItem(a),o==null||o(a.value)))},[t.collapseGroupItem,t.data,t.expandGroupItem,n]),onKeyDown:r};return e?i:ol};function il(e){if(e){let t=e.dataset.idx;if(t)return parseInt(t,10);if(t=e.ariaPosInSet)return parseInt(t,10)-1}return-1}var al=e=>e.closest("[data-idx],[aria-posinset]");var Ro=e=>il(al(e));var ko=e=>e==="none",mt=e=>Array.isArray(e)?e.length>0:e!=null,Po=e=>Array.isArray(e)?e[0]:e;var ne=require("react");var ft=require("react");var On=e=>null;var An=e=>null;var Kn=(e,t)=>e!==null&&Object.prototype.hasOwnProperty.call(e,t),Fn=e=>Kn(e,"header"),Oo=e=>Kn(e,"childNodes"),Ot=(e,t)=>e&&Object.prototype.hasOwnProperty.call(e.props,t),Ao=e=>{if((0,ft.isValidElement)(e)){if(Ot(e,"disabled"))return e.props.disabled===!0}else if(Kn(e,"disabled"))return e.disabled===!0;return!1},Ko=e=>(0,ft.isValidElement)(e)&&Ot(e,"focusable")?e.props.focusable:!0,Fo=(e,t,n)=>{if(e.childNodes)return e.childNodes.length;if(e.header){let o=n+1,r=0;for(;o<t.length&&!t[o].header;)r++,o++;return r}else return 0},cl=e=>{if(typeof e.props.children=="string")return e.props.children;if(e.props.title)return e.props.title;if(e.props.label)return e.props.label},$o=e=>e.type===An||Ot(e,"data-header"),zo=e=>e.type===On||Ot(e,"data-group"),ul=e=>Ot(e,"selectable")?e.props.selectable===!0:!zo(e)&&!$o(e),dl=e=>{if(zo(e)){let{props:{children:t}}=e;if(typeof t!="string")return zn(t)}},ml=(e,t)=>{let n=[];return ft.Children.forEach(e,o=>{(0,ft.isValidElement)(o)&&n.push(t(o))}),n},$n=(e,t)=>{if(Array.isArray(e))return e.length===0&&(t!=null&&t.noChildrenLabel)?[{label:t.noChildrenLabel,value:null}]:e.map((n,o)=>{var r,l;return{childNodes:$n(n.childNodes,t),description:n.description,expanded:n.expanded,value:n,label:(l=(r=t==null?void 0:t.itemToString)==null?void 0:r.call(t,n))!=null?l:dt(n)}});if(e)throw Error("list-child-items expects source to be an array")},zn=e=>{if(e)return ml(e,t=>{let{"data-id":n,disabled:o,id:r=n,"data-expanded":l,expanded:i=l}=t.props;return{childNodes:dl(t),disabled:o,expanded:i,header:$o(t),id:r,label:cl(t),selectable:ul(t),value:t}})},fl=new Set(["/","-","."]),pl=e=>fl.has(e),Bo=(e,t)=>t.startsWith(e)&&pl(t[e.length]),gl=new Set([".","/"]);function bl(e,t){return t.startsWith(e)?gl.has(t.charAt(e.length)):!1}function Yt(e,t,n){let o;return e.map(l=>l.id===t?{...l,...n}:bl(l.id,t)&&l.childNodes?(o=Yt(l.childNodes,t,n),{...l,childNodes:o}):l)}var Il=e=>e&&e.replace(/^\s+/g,""),Bn=e=>new RegExp(`(${jt(Il(e))})`,"gi"),_o=(e="",t=Bn)=>(n="")=>!!n.length&&!!e.length&&n.match(t(e))!==null;function Jt(e,t){return Array.isArray(e)?e.includes(t):e===t}var hl={},Qt=({children:e,id:t,label:n="",options:o=hl,source:r})=>{var D;let{getItemId:l}=o,[,i]=(0,ne.useState)(null),s=Do(),a=(0,ne.useRef)([]),c=(0,ne.useRef)([]),d=(0,ne.useMemo)(()=>[],[]),f=(0,ne.useRef)((D=o.filterPattern)!=null?D:""),{getFilterRegex:u=Bn,noChildrenLabel:I,itemToString:m=dt}=o,p=(0,ne.useCallback)(h=>o.defaultExpanded||!1,[o.defaultExpanded]),g=(0,ne.useCallback)((h,y,L=1,w="",A=[],z=[],W=[])=>(h.forEach((V,j,K)=>{var q,ee;let F=V.header&&o.collapsibleHeaders,Z=V.childNodes&&o.collapsibleHeaders===!1,X=!V.childNodes||V.childNodes.length===0,ie=Z||X&&!F,G=w?`${w}.${j}`:`item-${j}`,U=(q=V.id)!=null?q:l?l(j):`${t}-${G}`,Y=ie?void 0:(ee=V.expanded)!=null?ee:p(U),Q={...V,childNodes:void 0,count:!Z&&Y===void 0?0:Fo(V,K,j),description:V.description,disabled:Ao(V.value),focusable:Ko(V.value)?void 0:!1,id:U,index:y.value,expanded:Y,level:L};if(A.push(Q),z.push(Q),W.push(h[j].value),y.value+=1,V.childNodes){let[fe]=g(V.childNodes,y,L+1,G,[],z,W);Q.childNodes=fe}}),[A,W,z]),[o.collapsibleHeaders,l,t,p]),S=(0,ne.useCallback)(()=>f.current?_o(f.current,u):null,[u]),E=(0,ne.useCallback)((h,y=S(),L=[],w={value:0})=>{let A=!1;for(let z of h)A&&!Fn(z)||(z.value!==null&&(y===null||y(m(z.value)))&&(L[w.value]=z,w.value+=1),A=!1,Fn(z)&&z.expanded===!1?A=!0:Oo(z)&&z.expanded!==!1&&z.childNodes&&E(z.childNodes,y,L,w));return L},[S,m]),v=(0,ne.useMemo)(()=>s?d:$n(r,{itemToString:m,noChildrenLabel:I})||zn(e)||[],[s,d,r,m,I,e]),[x,T,N]=(0,ne.useMemo)(()=>s?[d,d,d]:g(v,{value:0}),[d,g,s,v]);c.current=N,(0,ne.useMemo)(()=>s?d:a.current=E(x),[d,E,x,s]);let P=(0,ne.useRef)(x),H=(0,ne.useCallback)((h="")=>{typeof h=="string"&&(f.current=h,a.current=E(x),i({}))},[x,E]),k=(0,ne.useCallback)((h,y=x)=>{let L=y.find(w=>{var A;return w.id===h||((A=w==null?void 0:w.childNodes)==null?void 0:A.length)&&Bo(w.id,h)});if((L==null?void 0:L.id)===h)return T==null?void 0:T[L.index];if(L)return k(h,L.childNodes);throw Error(`useCollectionData itemById, id ${h} not found `)},[T,x]),O=(0,ne.useCallback)(h=>{let y=c.current.find(L=>(0,ne.isValidElement)(L.value)?L.label===h:L.value===h);if(y)return y;throw Error("useCollectionData toCollectionItem, item not found ")},[]),$=(0,ne.useCallback)(h=>{if(h===null)return null;if(Array.isArray(h)){let y=[];for(let L of h){let w=O(L);y.push(w)}return y}else if(h!==void 0)return O(h)},[O]),b=(0,ne.useCallback)(h=>{let y=L=>{let w=c.current.find(A=>(0,ne.isValidElement)(A.value)?A.label===L:A.value!==null&&m(A.value)===L);if(w)return w};if(h===null)return null;if(Array.isArray(h)){let L=[];for(let w of h){let A=y(w);A&&L.push(A)}return L}else if(h!==void 0)return y(h)},[m]),M=(0,ne.useCallback)(h=>{for(let y of P.current)if(h===y.value)return y.id;throw Error("useCollectionData itemToId, item not found")},[]),C=(0,ne.useCallback)(h=>{P.current=Yt(P.current,h.id,{expanded:!1}),a.current=E(P.current),i({})},[E]),R=(0,ne.useCallback)(h=>{P.current=Yt(P.current,h.id,{expanded:!0}),a.current=E(P.current),i({})},[E]);return s||{collapseGroupItem:C,data:a.current,expandGroupItem:R,setFilterPattern:H,itemById:k,itemToId:M,toCollectionItem:O,itemToCollectionItem:$,stringToCollectionItem:b}};var en=require("react"),xl={scrollToIndex:e=>{},scrollToItem:e=>{},scrollTo:e=>{}},tn=({collectionHook:e,forwardedRef:t,scrollableRef:n,scrollIntoView:o})=>{let r=(0,en.useMemo)(()=>({scrollToIndex:l=>{let i=e.data[l];i&&(o==null||o(i))},scrollToItem:l=>{let i=e.toCollectionItem(l);i&&(o==null||o(i))},scrollTo:l=>{n!=null&&n.current&&(n.current.scrollTop=l)}}),[e.data,e.toCollectionItem,o]);(0,en.useImperativeHandle)(t,()=>n.current?r:xl,[r])};var Wo=require("@salt-ds/core"),ge=require("react");var Vn=-2;function Vo(e,t,n){return t===Rt||t===Pt?n>0?n-1:n:n===null?0:n===e-1?n:n+1}var _n=(e,t)=>{let n=Po(t);return n?e.indexOf(n):-1},Sl=(e,t,n,o)=>e===Pt?o:e===Zt?-1:t!==-1?t:n,Uo=e=>{let t=document.getElementById(e.id);if(t)return t.getBoundingClientRect();throw Error(`useKeyboardNavigation.getItemRect no element found for item #${e==null?void 0:e.id}`)},yl=(e,t,n,o)=>{let{top:r}=t.getBoundingClientRect(),{scrollTop:l,clientHeight:i,scrollHeight:s}=e,a=n.length-1,c=Math.min(l+i,s-i);if(c!==l&&o<a){e.scrollTo(0,c);let d=o,f;do d+=1,f=Uo(n[d]);while(f.top<r&&d<a);return d}},Tl=async(e,t,n,o)=>{let{top:r}=t.getBoundingClientRect(),{scrollTop:l,clientHeight:i}=e,s=Math.max(l-i,0);if(s!==l&&o>0)return e.scrollTo(0,s),new Promise(a=>{requestAnimationFrame(()=>{let c=o,d;do c-=1,d=Uo(n[c]);while(d.top>r&&c>0);a(c)})})},El=e=>!e.header&&!e.childNodes,Go=e=>El(e)||e.expanded!==void 0,jo=({containerRef:e,defaultHighlightedIndex:t=-1,disableHighlightOnFocus:n,highlightedIndex:o,indexPositions:r,onHighlight:l,onKeyboardNavigation:i,restoreLastFocus:s,selected:a})=>{let c=(0,ge.useRef)(-1),[,d]=(0,ge.useState)({}),[f,u,I]=(0,Wo.useControlled)({controlled:o,default:t,name:"UseKeyboardNavigation"}),m=(0,ge.useCallback)((H,k=!1)=>{l==null||l(H),u(H),k&&(c.current=H)},[l,u]),p=(0,ge.useCallback)(async(H,k)=>{let{id:O}=r[k],$;if(O){let b=document.getElementById(O),{current:M}=e;b&&M&&($=H.key===qt?yl(M,b,r,k):await Tl(M,b,r,k))}return $!=null?$:k},[e,r]),g=(0,ge.useCallback)((H=kt,k=H===kt?-1:r.length)=>{if(r.length===0)return-1;{let O=_n(r,a),$=Sl(H,k,O,r.length),b=Vo(r.length,H,$);if(b===0&&H===Rt&&!Go(r[0]))return k;for(;((H===kt||H===Zt)&&b<r.length||(H===Rt||H===Pt)&&b>0)&&!Go(r[b]);)b=Vo(r.length,H,b);return b}},[r,a]),S=(0,ge.useRef)(!1),E=(0,ge.useRef)(!1),v=H=>E.current=H,x=(0,ge.useCallback)(H=>{if(E.current)E.current=!1;else if(S.current=!0,r.length===0)m(Vn);else if(f!==-1)d({});else if(s)if(c.current!==-1)m(c.current);else{let k=_n(r,a);m(k!==-1?k:0)}else if(mt(a)){let k=_n(r,a);m(k)}else n!==!0&&m(g())},[n,f,r,g,s,a,m]),T=(0,ge.useCallback)(async H=>{let k=H.key===qt||H.key===kn?await p(H,f):g(H.key,f);k!==f&&m(k,!0),i==null||i(H,k)},[f,g,p,i,m]),N=(0,ge.useCallback)(H=>{r.length>0&&No(H)?(H.preventDefault(),H.stopPropagation(),S.current=!0,T(H)):Xt(H)&&(S.current=!0)},[r,T]),P=(0,ge.useMemo)(()=>({onBlur:H=>{let k=H.target.closest(".saltList"),O=H.relatedTarget;k&&!(k!=null&&k.contains(O))&&(S.current=!1,u(-1),s||(c.current=-1))},onFocus:x,onKeyDown:N,onMouseDownCapture:()=>{S.current=!1,v(!0)},onMouseMove:()=>{S.current&&(S.current=!1)},onMouseLeave:()=>{S.current=!1,v(!1),m(-1)}}),[x,N,s,u,m]);return{focusVisible:S.current?f:-1,controlledHighlighting:I,highlightedIndex:f,setHighlightedIndex:m,keyboardNavigation:S,listProps:P,setIgnoreFocus:v}};var qo=require("@salt-ds/core"),he=require("react");var vl={},Dl=["Enter"," "],Gn=e=>e&&e.disabled!==!0&&e.selectable!==!1,Zo=(e,t)=>{var n,o;return((n=e.index)!=null?n:0)-((o=t.index)!=null?o:0)};var Xo=({defaultSelected:e,disableSelection:t=!1,highlightedIdx:n,indexPositions:o,onSelect:r,onSelectionChange:l,selected:i,selectionStrategy:s,selectionKeys:a=Dl,tabToSelect:c})=>{let d=s==="deselectable",f=s==="multiple",u=s==="extended",I=(0,he.useRef)(-1),m=(0,he.useCallback)(b=>a.includes(b.key),[a]),p=(0,he.useCallback)(()=>f||u?[]:null,[f,u]),[g,S]=(0,qo.useControlled)({controlled:i,default:e!=null?e:p(),name:"UseSelection",state:"selected"}),E=(0,he.useCallback)(b=>Array.isArray(g)?g.includes(b):g===b,[g]),v=(0,he.useCallback)(b=>b,[]),x=(0,he.useCallback)(b=>E(b)?null:b,[E]),T=(0,he.useCallback)(b=>{let M=E(b)?g.filter(C=>C!==b):g.concat(b);return M.sort(Zo),M},[E,g]),N=(0,he.useCallback)((b,M)=>{let C=M?g:[],[R]=g.slice(-1),D=R?o.indexOf(R):0,h=Math.min(b,D),y=Math.max(b,D),L=o.slice(h,y+1),w=[...new Set([...C,...L])];return w.sort(Zo),w},[o,g]),P=(0,he.useCallback)((b,M,C,R,D)=>{let h;f?h=T(C):u?D&&!R?h=T(C):R?h=N(M,D):h=[C]:d?h=x(C):h=v(C),h!==g&&S(h),r==null||r(b,C),h!==g&&l&&l(b,h)},[f,u,d,g,r,T,N,x,v,S,l]),H=(0,he.useCallback)(b=>{let M=o[n];Gn(M)&&(m(b)||c&&b.key==="Tab")&&(b.key!=="Tab"&&b.preventDefault(),P(b,n,M,!1,b.ctrlKey||b.metaKey),u&&(I.current=n))},[o,n,m,c,P,u]),k=(0,he.useCallback)((b,M)=>{if(u&&b.shiftKey){let C=o[M];Gn(C)&&P(b,M,C,!0)}},[u,o,P]),O=(0,he.useCallback)(b=>{let M=o[n];!t&&Gn(M)&&(b.preventDefault(),b.stopPropagation(),P(b,n,M,b.shiftKey,b.ctrlKey||b.metaKey),u&&(I.current=n))},[t,u,n,o,P]);return{listHandlers:ko(s)?vl:{onClick:O,onKeyDown:H,onKeyboardNavigation:k},selected:g,setSelected:S}};var Qe=require("react");var Yo=({disableTypeToSelect:e,highlightedIdx:t,highlightItemAtIndex:n,typeToNavigate:o,items:r,applyIncrementalSearch:l=!0})=>{let i=(0,Qe.useRef)(null),s=(0,Qe.useRef)(""),a=(0,Qe.useRef)(-1),c=(0,Qe.useCallback)(f=>{if(f||!l){let u=new RegExp(`^${s.current}`,"i"),I=r.findIndex(({label:m},p)=>p>a.current&&u.test(m));I===-1&&(I=r.findIndex(({label:m},p)=>p<=a.current&&u.test(m))),I!==-1&&n(I)}else s.current="",i.current=null,a.current=-1},[l,n,r]),d=(0,Qe.useCallback)(f=>{let u=a.current!==-1;(Xt(f)||u&&f.key===Mo)&&o&&(f.preventDefault(),f.stopPropagation(),(a.current===-1||f.key===s.current)&&(a.current=t),i.current!==null&&(clearTimeout(i.current),i.current=null),f.key!==s.current&&(s.current+=f.key),l&&c(!0),i.current=window.setTimeout(()=>{c()},100))},[o,l,t,c]);return{onKeyDown:e?void 0:d}};var Oe=require("react");var tt=require("react");var Qo=["height"],et=new Map,er=(e,t,n)=>{switch(n){case"height":return t.height;case"clientHeight":return e.clientHeight;case"clientWidth":return e.clientWidth;case"contentHeight":return t.contentHeight;case"contentWidth":return t.contentWidth;case"scrollHeight":return Math.ceil(e.scrollHeight);case"scrollWidth":return Math.ceil(e.scrollWidth);case"width":return t.width;default:return 0}};var Jo=new ResizeObserver(e=>{for(let t of e){let{target:n,borderBoxSize:o,contentBoxSize:r}=t,l=et.get(n);if(l){let[{blockSize:i,inlineSize:s}]=o,[{blockSize:a,inlineSize:c}]=r,{onResize:d,measurements:f}=l,u=!1;for(let[I,m]of Object.entries(f)){let p=er(n,{height:i,width:s,contentHeight:a,contentWidth:c},I);p!==m&&(u=!0,f[I]=p)}u&&d&&d(f)}}});function nt(e,t,n,o=!1){let r=(0,tt.useRef)(t),l=(0,tt.useCallback)(i=>{let{width:s,height:a}=i.getBoundingClientRect(),{clientWidth:c,clientHeight:d}=i;return r.current.reduce((f,u)=>(f[u]=er(i,{width:s,height:a,contentHeight:d,contentWidth:c},u),f),{})},[]);(0,tt.useEffect)(()=>{let i=e.current;async function s(){et.set(i,{measurements:{}}),await document.fonts.ready;let a=et.get(i);if(a){let c=l(i);a.measurements=c,Jo.observe(i),o&&n(c)}else console.log("%cuseResizeObserver an target expected to be under observation wa snot found. This warrants investigation","font-weight:bold; color:red;")}if(i){if(et.has(i))throw Error("useResizeObserver attemping to observe same element twice");s()}return()=>{i&&et.has(i)&&(Jo.unobserve(i),et.delete(i))}},[l,e]),(0,tt.useEffect)(()=>{let i=e.current,s=et.get(i);if(s){if(r.current!==t){r.current=t;let a=l(i);s.measurements=a}s.onResize=n}},[t,l,e,n])}var rr=require("@salt-ds/core"),tr=["height"],wl=["height","scrollHeight"],Hl=[],nr={containerOnly:[wl,Hl],withContent:[tr,tr]},Ml=e=>e?nr.containerOnly:nr.withContent,or={current:null},Cl=(e,t)=>{let{transform:n="none"}=getComputedStyle(e);if(n.startsWith("matrix")){let o=n.lastIndexOf(",");return parseInt(n.slice(o+1))}else{let o=e.offsetParent;if(o===t||t===null)return e.offsetTop;{let r=e.offsetTop;for(;o!==null&&o!==t;)r+=o.offsetTop,o=o.offsetParent;return r}}},sr=({containerRef:e,contentRef:t=or,highlightedIdx:n=-1,indexPositions:o,stickyHeaders:r=!1})=>{let l=(0,Oe.useRef)(!1),i=(0,Oe.useRef)({height:0,contentHeight:0}),s=(0,Oe.useCallback)(p=>{l.current=!0,e.current&&(e.current.scrollTop=p),setTimeout(()=>{l.current=!1})},[]),a=(0,Oe.useCallback)(()=>s(0),[s]),c=(0,Oe.useCallback)(()=>{s(i.current.contentHeight-i.current.height)},[s]),d=(0,Oe.useCallback)(p=>{let g=t.current||e.current;if(p.id){let S=document.getElementById(p.id);if(S&&e.current){let{height:E}=i.current,v=S.ariaExpanded&&S.firstChild?S.firstChild:S,x=r?36:0,T=Cl(v,g),N=v.offsetHeight,{scrollTop:P}=e.current,H=P+x,k=H+E-x;if(T+N>k||T<H){let O=T+N>k?P+(T+N)-k:T-x;s(O)}}}},[e,t,s,r]);(0,rr.useIsomorphicLayoutEffect)(()=>{let{height:p,contentHeight:g}=i.current,S=o[n];if(g>p&&S){let[E]=o,[v]=o.slice(-1);S===E?a():S===v?c():d(o[n])}},[n,o,d,c,a]);let f=(0,Oe.useCallback)(({height:p,scrollHeight:g})=>{typeof p=="number"&&(i.current.height=p),typeof g=="number"&&(i.current.contentHeight=g)},[]),u=(0,Oe.useCallback)(({height:p})=>{typeof p=="number"&&(i.current.contentHeight=p)},[]),[I,m]=Ml(t===or);return nt(e,I,f,!0),nt(t,m,u,!0),{isScrolling:l,scrollIntoView:d}};var le=require("react");var At=({allowDragDrop:e=!1,collapsibleHeaders:t,collectionHook:n,containerRef:o,contentRef:r,defaultHighlightedIndex:l,defaultSelected:i,disabled:s,disableAriaActiveDescendant:a,disableHighlightOnFocus:c,disableTypeToSelect:d,highlightedIndex:f,id:u,label:I="",listHandlers:m,onHighlight:p,onKeyboardNavigation:g,onKeyDown:S,onMoveListItem:E,onSelect:v,onSelectionChange:x,restoreLastFocus:T,selected:N,selectionStrategy:P,selectionKeys:H,stickyHeaders:k,tabToSelect:O,viewportRange:$})=>{let b=(0,le.useRef)(null),M=(0,le.useRef)(N||i),C=(B,_)=>{var J,oe;(oe=(J=j.listHandlers).onKeyboardNavigation)==null||oe.call(J,B,_),g==null||g(B,_)},R=(0,le.useCallback)((B,_)=>{v&&((0,le.isValidElement)(_.value)?v(B,_.label):_.value!==null&&v(B,_.value))},[v]),D=(0,le.useCallback)((B,_)=>{x&&x(B,Array.isArray(_)?_.map(J=>(0,le.isValidElement)(J.value)?J.label:J.value):_&&((0,le.isValidElement)(_.value)?_.label:_.value))},[x]),{highlightedIndex:h,listProps:{onKeyDown:y,onMouseMove:L,...w},setHighlightedIndex:A,...z}=jo({containerRef:o,defaultHighlightedIndex:l,disableHighlightOnFocus:c,highlightedIndex:f,indexPositions:n.data,label:I,onHighlight:p,onKeyboardNavigation:C,restoreLastFocus:T,selected:M.current}),W=Lo({collapsibleHeaders:t,highlightedIdx:h,collectionHook:n}),V=(0,le.useCallback)(()=>{A(-1)},[A]),j=Xo({defaultSelected:i,highlightedIdx:h,indexPositions:n.data,label:I,onSelect:R,onSelectionChange:D,selected:N,selectionStrategy:P,selectionKeys:H,tabToSelect:O}),K=(0,le.useCallback)((B,_,J)=>{let oe=n.data.indexOf(B);return oe===_?J:oe<Math.min(_,J)||oe>Math.max(_,J)?oe:_<oe?oe-1:oe+1},[n.data]),F=(0,le.useCallback)((B,_,J)=>Array.isArray(B)?B.map(oe=>K(oe,_,J)):K(B,_,J),[K]),Z=(0,le.useCallback)((B,_)=>{mt(j.selected)&&(b.current=F(j.selected,B,_)),E==null||E(B,_),A(-1)},[j.selected,E,A,F]),X=(0,le.useCallback)(B=>{A(B)},[A]),{setSelected:ie}=j;(0,le.useEffect)(()=>{let{current:B}=b;if(mt(B)){let _=Array.isArray(B)?B.map(J=>n.data[J]):n.data[B];ie(_)}},[n.data,ie]),(0,le.useEffect)(()=>{mt(M.current)&&ie(Array.isArray(M.current)?[]:null)},[ie,n.data]);let{onMouseDown:G,isDragging:U,isScrolling:Y,...Q}=wt({allowDragDrop:e,draggableClassName:"list-item",orientation:"vertical",containerRef:o,id:u,itemQuery:".vuuListItem",onDragStart:V,onDrop:Z,onDropSettle:X,viewportRange:$}),{onKeyDown:q}=Yo({disableTypeToSelect:d,highlightedIdx:h,highlightItemAtIndex:A,typeToNavigate:!0,items:n.data}),ee=(0,le.useCallback)(B=>{var _,J,oe;B.defaultPrevented||q==null||q(B),y(B),B.defaultPrevented||(J=(_=j.listHandlers).onKeyDown)==null||J.call(_,B),B.defaultPrevented||(oe=W==null?void 0:W.onKeyDown)==null||oe.call(W,B),B.defaultPrevented||S==null||S(B)},[W,y,S,j.listHandlers,q]),{isScrolling:fe,scrollIntoView:pe}=sr({containerRef:o,contentRef:r,highlightedIdx:h,indexPositions:n.data,stickyHeaders:k}),Se=fe.current||Y.current,ye=(0,le.useCallback)(B=>{if(!Se&&!s&&!U){L();let _=Ro(B.target);if(_!==-1&&_!==h){let J=n.data[_];!J||J.disabled?A(-1):A(_)}}},[U,Se,s,A,L,h,n.data]),De=()=>{var B;return h===void 0||h===-1||a||(B=n.data[h])==null?void 0:B.id};M.current=j.selected;let we={"aria-activedescendant":De(),onBlur:w.onBlur,onFocus:w.onFocus,onKeyDown:ee,onMouseDown:G,onMouseDownCapture:w.onMouseDownCapture,onMouseLeave:w.onMouseLeave},He=m||{onClick:j.listHandlers.onClick,onMouseMove:ye};return{focusVisible:z.focusVisible,controlledHighlighting:z.controlledHighlighting,highlightedIndex:h,keyboardNavigation:z.keyboardNavigation,listHandlers:He,listItemHeaderHandlers:W,listControlProps:we,scrollIntoView:pe,selected:j.selected,setHighlightedIndex:A,setIgnoreFocus:z.setIgnoreFocus,setSelected:j.setSelected,...Q}};var lr=require("@salt-ds/core"),ot=require("react");var Nl=(e,t,n=0)=>e===0?0:n===0?e*t:e-1*(t+n)+t,nn=({borderless:e,displayedItemCount:t,getItemHeight:n,height:o,itemCount:r,itemGapSize:l,itemHeight:i,rootRef:s,rowHeightRef:a})=>{let[c,d]=(0,ot.useState)(36),[f,u]=(0,ot.useState)(),[I,m]=(0,ot.useMemo)(()=>{let g=e?0:2,S=i!=null?i:c,E=Nl(r,S,l);if(o!==void 0&&typeof o=="number"||typeof o=="string")return[E,o];let v=Math.min(t,r)||t;return typeof n=="function"?g+=Array(v).fill(0).reduce((T,N,P)=>T+n(P)+l,0)-l:g+=v*Number(S)+(v-1)*l,[E,g,f]},[e,f,t,n,o,r,l,i,c]);(0,lr.useIsomorphicLayoutEffect)(()=>{if(s.current){let{clientHeight:g}=s.current;u(g)}},[s]);let p=(0,ot.useCallback)(({height:g})=>{typeof g=="number"&&d(g)},[]);return nt(a,Qo,p,!0),{contentHeight:I,listClientHeight:f,listItemHeight:c,listHeight:m}};var ar=require("@salt-ds/core"),Ae=require("react"),ir=(e,t,n,o)=>{let r=Math.ceil(t/o),l=Math.floor(e/o),i=Math.ceil(l+r-1);return{atStart:l===0,atEnd:i===n-1,from:l,to:i}},on=({containerSize:e,itemCount:t,itemGapSize:n=0,itemSize:o,onViewportScroll:r})=>{let l=(0,Ae.useRef)(0),i=(0,Ae.useRef)(0),s=(0,Ae.useRef)(0),a=(0,Ae.useMemo)(()=>ir(s.current,e,t,o+n),[e,t,o,n]),[c,d]=(0,Ae.useState)(a);return(0,ar.useIsomorphicLayoutEffect)(()=>{d(a)},[a]),{onVerticalScroll:(0,Ae.useCallback)(u=>{let I=u.target.scrollTop;if(I!==s.current){s.current=I;let m=o+n,p=ir(I,e,t,m);(p.from!==l.current||p.to!==i.current)&&(l.current=p.from,i.current=p.to,r==null||r(p.from,p.to),d(p))}},[o,n,e,t,r]),viewportRange:c}};var Me=require("react/jsx-runtime"),dr=require("react"),Ll="No data to display",Kt="vuuList",Rl=(0,Ke.forwardRef)(function({ListItem:t=Nt,ListPlaceholder:n,allowDragDrop:o,borderless:r,children:l,className:i,collapsibleHeaders:s=!1,defaultHighlightedIndex:a,defaultSelected:c,disabled:d=!1,disableFocus:f=!1,disableTypeToSelect:u,displayedItemCount:I=10,emptyMessage:m,focusVisible:p,getItemHeight:g,getItemId:S,height:E,highlightedIndex:v,id:x,itemGapSize:T=0,itemHeight:N,itemTextHighlightPattern:P,itemToString:H=dt,listHandlers:k,maxHeight:O,maxWidth:$,minHeight:b,minWidth:M,onMoveListItem:C,onSelect:R,onSelectionChange:D,onHighlight:h,restoreLastFocus:y,selected:L,selectionStrategy:w,checkable:A=w==="multiple",scrollingApiRef:z,selectionKeys:W,showEmptyMessage:V=!1,source:j,style:K,stickyHeaders:F,tabToSelect:Z,width:X,...ie},G){let U=(0,cr.useId)(x),Y=(0,Ke.useRef)(null),Q=(0,Ke.useRef)(null),q=(0,Ke.useRef)(null),ee=Qt({id:U,label:"List",source:j,children:l,options:{collapsibleHeaders:s,getItemId:S,itemToString:H}}),{listClientHeight:fe,listHeight:pe,listItemHeight:Se}=nn({borderless:r,displayedItemCount:I,getItemHeight:g,height:E,itemCount:ee.data.length,itemGapSize:T,itemHeight:N,rootRef:Y,rowHeightRef:q}),{onVerticalScroll:ye,viewportRange:De}=on({containerSize:fe!=null?fe:typeof pe=="number"?pe:0,itemCount:ee.data.length,itemGapSize:T,itemSize:Se}),{draggable:we,draggedItemIndex:He,dropIndicator:B,focusVisible:_,highlightedIndex:J,listControlProps:oe,listHandlers:ue,listItemHeaderHandlers:Re,scrollIntoView:ke,selected:Ve}=At({allowDragDrop:o,collapsibleHeaders:s,collectionHook:ee,containerRef:Y,contentRef:Q,defaultHighlightedIndex:a,defaultSelected:ee.itemToCollectionItem(c),disabled:d,disableTypeToSelect:u,highlightedIndex:v,id:U,label:U,listHandlers:k,onMoveListItem:C,onSelect:R,onSelectionChange:D,onHighlight:h,restoreLastFocus:y,selected:ee.itemToCollectionItem(L),selectionStrategy:w,selectionKeys:W,stickyHeaders:F,tabToSelect:Z,viewportRange:De});tn({collectionHook:ee,forwardedRef:z,scrollableRef:Y,scrollIntoView:ke});let je=p!=null?p:_,Fe=function(re,Ie,Te,de){let Ze=(0,dr.createElement)(t,{...Re,className:(0,rn.default)(`${Kt}Header`,{focusVisible:s&&je===re.value}),"aria-expanded":de,"data-idx":s?re.value:void 0,"data-index":s?re.value:void 0,"data-highlighted":re.value===J||void 0,"data-sticky":F,"data-selectable":!1,id:Ie,key:`header-${re.value}`,label:Te});return re.value+=1,Ze},Tt=g===void 0?()=>N:g;function ps($e,re,Ie){var _t,eo;let{disabled:Te,value:de,id:Ze,label:zt}=re,Bt=(0,Ke.isValidElement)(de),Et={className:(0,rn.default)((_t=de==null?void 0:de.props)==null?void 0:_t.className,{vuuHighlighted:Ie.value===J,vuuFocusVisible:je===Ie.value,["vuuDraggable-dragAway"]:He===Ie.value}),disabled:Te||d,id:Ze,item:Bt?void 0:(eo=re==null?void 0:re.value)!=null?eo:void 0,itemHeight:Tt(Ie.value),itemTextHighlightPattern:P,key:Ze,"data-idx":Ie.value,"data-index":Ie.value,label:zt,role:"option",selected:Jt(Ve,re),showCheckbox:A};$e.push(Bt?(0,Ke.cloneElement)(de,Et):(0,Me.jsx)(t,{...Et})),Ie.value+=1}let gs=function(re,Ie,Te){let{count:de=0,id:Ze,expanded:zt,label:Bt=""}=Ie[Te.value],Et=Fe(Te,Ze,Bt,zt),_t=zt!==!1?[Et].concat(Qn(Ie,Te,Te.value+de)||[]):Et;re.push((0,Me.jsx)("div",{role:"group",children:_t},Ze))},Qn=($e,re={value:0},Ie=$e.length)=>{let Te=[];for(;re.value<Ie;){let de=$e[re.value];de.header?Te.push(Fe(re,de.id,de.label,de.expanded===!1)):de.childNodes?gs(Te,$e,re):ps(Te,de,re)}return Te};function bs(){return m||V?(0,Me.jsx)("span",{className:`${Kt}-empty-message`,children:m!=null?m:Ll}):null}let Is=()=>{if(ee.data.length){let $e=ee.data;return Qn($e)}else bs()},hs="auto",xs={"--list-item-gap":T?`${T}px`:void 0,minWidth:M,minHeight:b,width:X!=null?X:"100%",height:E!=null?E:"100%",maxWidth:$!=null?$:X,maxHeight:O!=null?O:pe};return(0,Me.jsxs)("div",{"aria-multiselectable":w==="multiple"||w==="extended"||w==="extended-multi-range"||void 0,...ie,...ue,...oe,className:(0,rn.default)(Kt,i,{[`${Kt}-collapsible`]:s,vuuFocusVisible:J===Vn}),id:`${U}`,ref:(0,ur.useForkRef)(Y,G),role:"listbox",onScroll:ye,style:{...K,...xs},tabIndex:d||f?void 0:0,children:[(0,Me.jsx)(Ct,{ref:q}),ee.data.length===0&&n!==void 0?(0,Me.jsx)(Me.Fragment,{children:(0,Me.jsx)(n,{})}):(0,Me.jsxs)("div",{className:`${Kt}-scrollingContentContainer`,ref:Q,style:{height:hs},children:[Is(),B,we]})]})});var pt=require("@salt-ds/core");function mr(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=mr(e[t]))&&(o&&(o+=" "),o+=n);else for(t in e)e[t]&&(o&&(o+=" "),o+=t);return o}function Wn(){for(var e,t,n=0,o="";n<arguments.length;)(e=arguments[n++])&&(t=mr(e))&&(o&&(o+=" "),o+=t);return o}var st=require("react");var pr=require("react");var sn=class{constructor(t=0,n=0){this.keys=new Map,this.free=[],this.nextKeyValue=0,this.reset(t,n)}next(){return this.free.length?this.free.pop():this.nextKeyValue++}reset(t,n){this.keys.forEach((r,l)=>{(l<t||l>=n)&&(this.free.push(r),this.keys.delete(l))});let o=n-t;this.keys.size+this.free.length>o&&(this.free.length=o-this.keys.size);for(let r=t;r<n;r++)if(!this.keys.has(r)){let l=this.next();this.keys.set(r,l)}}keyFor(t){return this.keys.get(t)}};var kl=([e],[t])=>e-t,fr=5,gr=({data:e,listItemGapSize:t=0,listItemHeight:n,viewportRange:o})=>{let r=(0,pr.useMemo)(()=>new sn(0,1),[]),l=n+t,i=Math.max(0,o.from-fr),s=Math.min(e.length,o.to+fr);return r.reset(i,s),e.slice(i,s).map((c,d)=>[r.keyFor(d+i),(d+i)*l,d+i+1,c]).sort(kl)};var rt=require("react/jsx-runtime"),Pl="No data to display",ln=(0,pt.makePrefixer)("saltList"),Ol=(0,st.memo)(Nt),Al=(0,st.forwardRef)(function({borderless:t,children:n,className:o,collapsibleHeaders:r=!1,defaultHighlightedIndex:l,defaultSelected:i,disabled:s=!1,disableFocus:a=!1,disableTypeToSelect:c,displayedItemCount:d=10,emptyMessage:f,getItemHeight:u,getItemId:I,height:m,highlightedIndex:p,id:g,itemGapSize:S=0,itemHeight:E,itemTextHighlightPattern:v,itemToString:x,maxHeight:T,maxWidth:N,minHeight:P,minWidth:H,onSelect:k,onSelectionChange:O,onViewportScroll:$,onHighlight:b,restoreLastFocus:M,selected:C,selectionStrategy:R,scrollingApiRef:D,selectionKeys:h,showEmptyMessage:y=!1,source:L,style:w,stickyHeaders:A,tabToSelect:z,width:W,...V},j){let K=(0,pt.useIdMemo)(g),F=(0,st.useRef)(null),Z=(0,st.useRef)(null),X=Qt({id:K,label:"List",source:L,children:n,options:{collapsibleHeaders:r,getItemId:I,itemToString:x}}),{contentHeight:ie,listItemHeight:G,listHeight:U}=nn({borderless:t,displayedItemCount:d,height:m,itemCount:X.data.length,itemGapSize:S,itemHeight:E,rootRef:F,rowHeightRef:Z}),{focusVisible:Y,highlightedIndex:Q,listControlProps:q,listHandlers:ee,scrollIntoView:fe,selected:pe}=At({collapsibleHeaders:r,collectionHook:X,containerRef:F,defaultHighlightedIndex:l,defaultSelected:X.itemToCollectionItem(i),disabled:s,disableTypeToSelect:c,highlightedIndex:p,label:K,onSelect:k,onSelectionChange:O,onHighlight:b,restoreLastFocus:M,selected:X.itemToCollectionItem(C),selectionStrategy:R,selectionKeys:h,stickyHeaders:A,tabToSelect:z}),{onVerticalScroll:Se,viewportRange:ye}=on({containerSize:typeof U=="number"?U:0,itemCount:X.data.length,itemGapSize:S,itemSize:G});console.log({viewPortRange:ye});let De=gr({data:X.data,listItemGapSize:S,listItemHeight:G,viewportRange:ye});tn({collectionHook:X,forwardedRef:D,scrollableRef:F,scrollIntoView:fe});function we(oe,ue,Re){let[ke,Ve,je,Fe]=ue,Tt=je-1;oe.push((0,rt.jsx)(Ol,{"aria-setsize":X.data.length,"aria-posinset":je,className:Wn(o,{saltHighlighted:Tt===Q,saltFocusVisible:Y===Tt}),"data-idx":Tt,item:Fe,label:Fe.label,"data-offset":Ve,role:"option",selected:Jt(pe,Fe),id:Fe.id,translate3d:Ve},ke)),Re.value+=1}function He(oe,ue={value:0},Re=oe.length){let ke=[];for(;ue.value<Re;){let Ve=oe[ue.value];we(ke,Ve,ue)}return ke}function B(){return f||y?(0,rt.jsx)("span",{className:ln("empty-message"),children:f!=null?f:Pl}):null}let _=()=>{if(De.length)return He(De);B()},J={"--list-item-gap":S?`${S}px`:void 0,minWidth:H,minHeight:P,width:W!=null?W:"100%",height:m!=null?m:"100%",maxWidth:N!=null?N:W,maxHeight:T!=null?T:U};return(0,rt.jsx)("div",{...V,...ee,...q,className:Wn(ln(),o,ln("virtualized")),id:`${K}`,ref:(0,pt.useForkRef)(F,j),role:"listbox",onScroll:Se,style:{...w,...J},tabIndex:s||a?void 0:0,children:(0,rt.jsxs)("div",{className:ln("scrollingContentContainer"),style:{height:ie},children:[(0,rt.jsx)(Ct,{ref:Z}),_()]})})});var bt=require("@vuu-ui/vuu-layout"),Nr=require("@salt-ds/core"),Lr=Pe(require("classnames")),It=Pe(require("react"));var me=require("react");var br=e=>typeof e=="object"&&e!==null&&"tabIndex"in e&&typeof e.tabIndex=="number",Ir=e=>({label:"Close",location:"tab",action:"close-tab",options:e}),hr=e=>({label:"Rename",location:"tab",action:"rename-tab",options:e});var xr=e=>{if(e){let t=parseInt(e.dataset.index||"");if(!isNaN(t))return t}return-1},Sr=(e,t)=>{if(e){let n=e.querySelector(`[data-index]:has(${t})`);return xr(n)}return-1},an=e=>Sr(e,'[aria-selected="true"]'),Un=e=>Sr(e,".vuuEditableLabel-editing");var gt=require("@vuu-ui/vuu-utils"),Be=require("react"),yr=(e,t,n="horizontal")=>{let o=(0,Be.useRef)(!1),r=(0,Be.useCallback)(()=>{o.current=!0},[]),l=(0,Be.useCallback)(()=>{o.current=!1},[]),i=(0,Be.useCallback)(()=>{var a,c;(a=e.current)==null||a.style.setProperty("--tab-thumb-transition","none"),(c=e.current)==null||c.removeEventListener("transitionend",i)},[e]),s=(0,Be.useRef)(-1);return(0,Be.useMemo)(()=>{var d,f;let a=0,c=0;if(s.current!==-1){let u=(d=e.current)==null?void 0:d.querySelector(".vuuTab-selected"),I=(f=e.current)==null?void 0:f.querySelector(`[data-index="${t}"] .vuuTab`),{positionProp:m,sizeProp:p}=gt.MEASURES[n];if(u&&I&&!o.current){let{[m]:g,[p]:S}=u.getBoundingClientRect(),{[m]:E}=I.getBoundingClientRect();if((0,gt.isValidNumber)(g)&&(0,gt.isValidNumber)(E)&&(0,gt.isValidNumber)(S)){console.log({orientation:n,positionProp:m,oldPosition:g,newPosition:E}),a=g-E,c=S;let x=Math.abs(a/(n==="horizontal"?1100:700));requestAnimationFrame(()=>{var T,N,P,H;(T=e.current)==null||T.style.setProperty("--tab-thumb-offset","0px"),(N=e.current)==null||N.style.setProperty("--tab-thumb-size","100%"),(P=e.current)==null||P.style.setProperty("--tab-thumb-transition",`all ${x}s ease`),(H=e.current)==null||H.addEventListener("transitionend",i)})}}}return s.current=t,o.current?{containerStyle:{"--tab-thumb-offset":"0px","--tab-thumb-size":"100%"},resumeAnimation:l,suspendAnimation:r}:{containerStyle:{"--tab-thumb-offset":`${a}px`,"--tab-thumb-size":c?`${c}px`:void 0},resumeAnimation:l,suspendAnimation:r}},[t,e,n,i,l,r])};var Er=require("@salt-ds/core"),vr=require("@vuu-ui/vuu-utils"),ce=require("react"),be=require("@vuu-ui/vuu-utils");var Dr={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"}},Kl=(e,t="horizontal")=>Dr[t][e]!==void 0,Fl=e=>e===be.ArrowDown;function Tr(e,t,n){return t==="start"?0:t==="end"?e-1:t==="bwd"?n>0?n-1:n:n===null?0:n===e-1?n:n+1}var $l=e=>e!==null&&!e.classList.contains("wrapped"),cn=(e,t)=>e?e.querySelector(`[data-index="${t}"]`):null,wr=({containerRef:e,defaultHighlightedIdx:t=-1,highlightedIdx:n,keyBoardActivation:o,orientation:r,selectedIndex:l=0})=>{let i=o==="manual",s=(0,ce.useRef)(!1),a=(0,ce.useRef)(-1),[c,d]=(0,ce.useState)(!1),[,f]=(0,ce.useState)({}),[u,I]=(0,Er.useControlled)({controlled:n,default:t,name:"UseKeyboardNavigation"}),m=(0,ce.useCallback)(b=>{I(a.current=b)},[I]),p=(0,ce.useRef)(!1),g=(0,ce.useCallback)((b,M=!1,C,R=70)=>{m(b),C===!0&&!p.current&&(p.current=!0);let D=()=>{let h=cn(e.current,b);if(h){let y=(0,vr.getFocusableElement)(h);y==null||y.focus()}};M?D():setTimeout(D,R)},[e,m]),S=b=>{if(a.current===-1&&b.target.tabIndex!==-1){let M=Un(e.current);M!==-1?requestAnimationFrame(()=>{m(M)}):setTimeout(()=>{a.current===-1&&l!==null&&m(l)},200)}},E=(0,ce.useCallback)(()=>{var b,M;return(M=(b=e.current)==null?void 0:b.querySelectorAll("[data-index]").length)!=null?M:0},[e]),v=(0,ce.useCallback)((b="fwd",M)=>{let C=E(),D=Tr(C,b,typeof M=="number"?M:C),h=b==="start"?"fwd":b==="end"?"bwd":b;for(;(h==="fwd"&&D<C||h==="bwd"&&D>0)&&!$l(cn(e.current,D));){let y=Tr(C,h,D);if(y===D)break;D=y}return D},[e,E]),x=(0,ce.useCallback)((b,M=!1)=>{let C=Dr[r][b.key],R=v(C,u);R!==u?i&&g(R,!0):M&&f({})},[u,i,v,g,r]),T=(0,ce.useCallback)(()=>{let b=cn(e.current,u);return b?b.querySelector(".vuuPopupMenu")!=null:!1},[e,u]),N=(0,ce.useCallback)(()=>{let b=cn(e.current,u),M=b==null?void 0:b.querySelector(".vuuPopupMenu");if(M){let C=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});M.dispatchEvent(C)}return!1},[e,u]),P=(0,ce.useCallback)(b=>{E()>0&&Kl(b.key,r)?(b.preventDefault(),p.current?x(b):(p.current=!0,x(b,!0))):Fl(b.key)&&T()&&N()},[N,E,T,x,r]),H=(b,M)=>{m(M)},k=(0,ce.useCallback)(()=>{c||(d(!0),s.current?s.current=!1:p.current=!0)},[c]),O=(0,ce.useCallback)(()=>{c||(s.current=!0),p.current=!1},[c]);return{containerProps:{onBlur:b=>{let M=b.target.closest(".vuuTabstrip"),C=b.relatedTarget;M&&!(M!=null&&M.contains(C))&&(m(-1),d(!1))},onMouseDownCapture:O,onFocus:k,onMouseLeave:()=>{p.current=!0,m(-1),s.current=!1}},focusVisible:p.current?u:-1,focusIsWithinComponent:c,highlightedIdx:u,focusTab:g,onClick:H,onFocus:S,onKeyDown:P,setHighlightedIdx:m}};var Hr=require("@salt-ds/core"),Ft=require("react"),zl=["Enter"," "],Bl=e=>e&&e.matches('[class*="vuuTab "]'),Mr=({defaultSelected:e,highlightedIdx:t,onSelectionChange:n,selected:o})=>{let[r,l,i]=(0,Hr.useControlled)({controlled:o,default:e!=null?e:0,name:"Tabstrip",state:"value"}),s=(0,Ft.useCallback)(f=>zl.includes(f.key),[]),a=(0,Ft.useCallback)(f=>{l(f),n==null||n(f)},[n,l]),c=(0,Ft.useCallback)(f=>{let u=f.target;s(f)&&t!==r&&Bl(u)&&(f.stopPropagation(),f.preventDefault(),a(t))},[s,t,r,a]),d=(0,Ft.useCallback)((f,u)=>{u!==r&&a(u)},[a,r]);return{activateTab:a,isControlled:i,onClick:d,onKeyDown:c,selected:r}};var _l=new Set(["Enter"," "]),Vl=e=>_l.has(e),Gl=(e,t)=>e?e.querySelector(`[data-index="${t}"]`):null,Cr=({activeTabIndex:e,allowDragDrop:t,animateSelectionThumb:n,containerRef:o,onActiveChange:r,onAddTab:l,onCloseTab:i,onExitEditMode:s,onMoveTab:a,orientation:c,keyBoardActivation:d})=>{let f=(0,me.useRef)(e),{focusTab:u,highlightedIdx:I,onClick:m,onKeyDown:p,setHighlightedIdx:g,...S}=wr({containerRef:o,keyBoardActivation:d,orientation:c,selectedIndex:f.current}),{activateTab:E,onClick:v,onKeyDown:x,selected:T}=Mr({highlightedIdx:I,onSelectionChange:r,selected:e});f.current=T;let{containerStyle:N,resumeAnimation:P,suspendAnimation:H}=yr(o,n?T:-1,c),k=(0,me.useCallback)((K,F)=>{let{current:Z}=f;console.log(`useTabstrip handleDrop ${K} - ${F} ${Z}`),a==null||a(K,F);let X=-1;F!==-1&&(Z===K?X=F:K>Z&&F<=Z?X=Z+1:K<Z&&F>=Z&&(X=Z-1),X!==-1&&(H(),E(X),requestAnimationFrame(P)),u(F,!1,!1,350))},[u,a,P,E,H]),{onMouseDown:O,...$}=wt({allowDragDrop:t,containerRef:o,draggableClassName:`tabstrip-${c}`,onDrop:k,orientation:"horizontal",itemQuery:".vuuOverflowContainer-item"}),b=(0,me.useCallback)((K,F,Z,X)=>{console.log(`handleExitEditMode ${K} ${F} ${Z} ${X}`),s==null||s(K,F,Z,X),Z||u(X,!1,!0)},[u,s]),M=(0,me.useCallback)((K,F)=>{m(K,F),v(K,F)},[m,v]),C=(0,me.useCallback)((K=I)=>{let F=Gl(o.current,K);if(F)return F.querySelector(".vuuEditableLabel")},[o,I]),R=(0,me.useCallback)((K=I)=>{let F=C(K);return F?F.classList.contains("vuuEditableLabel-editing"):!1},[C,I]),D=(0,me.useCallback)((K=I)=>{let F=C(K);if(F){let Z=new MouseEvent("dblclick",{view:window,bubbles:!0,cancelable:!0});F.dispatchEvent(Z)}},[C,I]),h=(0,me.useCallback)(K=>{p(K),K.defaultPrevented||x(K),!K.defaultPrevented&&Vl(K.key)&&D()},[D,p,x]),y=(0,me.useCallback)(K=>{let F=an(o.current),Z=F>K?F-1:F===K?0:F;return H(),i==null||i(K,Z),setTimeout(()=>{P()},200),!0},[o,i,P,H]),L=(0,me.useCallback)(K=>(D(K),!0),[D]),w=(0,me.useCallback)(K=>{if(br(K.options))switch(K.menuId){case"close-tab":return y(K.options.tabIndex);case"rename-tab":return L(K.options.tabIndex);default:console.log(`tab menu action ${K.menuId}`)}return!1},[y,L]),A=(0,me.useCallback)(()=>{R()?g(I):u(I)},[I,u,g,R]),z=(0,me.useCallback)(K=>{let F=parseInt(K.index);isNaN(F)||E(F)},[E]),W={onFocus:S.onFocus,onKeyDown:h},V=(0,me.useCallback)(()=>{l==null||l(),requestAnimationFrame(()=>{let K=an(o.current);K!==-1&&u(K)})},[o,u,l]),j={onClick:M,onKeyDown:h,onExitEditMode:b,onMenuAction:w,onMenuClose:A,onMouseDown:O};return{activeTabIndex:T,containerStyle:N,focusVisible:S.focusVisible,containerProps:{...S.containerProps,onSwitchWrappedItemIntoView:z},navigationProps:W,onClickAddTab:V,tabProps:j,...$}};var ht=require("react/jsx-runtime"),Rr=require("react"),jn="vuuTabstrip",Wl=({activeTabIndex:e,allowAddTab:t,allowCloseTab:n,allowDragDrop:o=!1,allowRenameTab:r=!1,animateSelectionThumb:l=!1,children:i,className:s,id:a,keyBoardActivation:c="manual",location:d,onActiveChange:f,onAddTab:u,onCloseTab:I,onExitEditMode:m,onMoveTab:p,orientation:g="horizontal",showTabMenuButton:S,style:E,...v})=>{let x=(0,It.useRef)(null),{activeTabIndex:T,focusVisible:N,containerStyle:P,draggedItemIndex:H,onClickAddTab:k,tabProps:O,...$}=Cr({activeTabIndex:e,allowDragDrop:o,animateSelectionThumb:l,containerRef:x,keyBoardActivation:c,onActiveChange:f,onAddTab:u,onCloseTab:I,onExitEditMode:m,onMoveTab:p,orientation:g}),b=(0,bt.useId)(a),M=(0,Lr.default)(jn,`${jn}-${g}`,s),C=E||P?{...E,...P}:void 0,R=(0,It.useMemo)(()=>(0,bt.asReactElements)(i).map((D,h)=>{let{id:y=`${b}-tab-${h}`,closeable:L=n,editable:w=r,showMenuButton:A=S}=D.props,z=h===T;return It.default.cloneElement(D,{...O,...$.navigationProps,closeable:L,"data-overflow-priority":z?"1":void 0,dragging:H===h,editable:w,focusVisible:N===h,id:y,index:h,key:h,location:d,selected:z,showMenuButton:A,tabIndex:z?0:-1})}).concat(t?(0,Rr.createElement)(Nr.Button,{...$.navigationProps,"aria-label":"Create Tab",className:`${jn}-addTabButton`,"data-icon":"add","data-overflow-priority":"1",key:"addButton",onClick:k,variant:"secondary",tabIndex:-1}):[]),[T,t,n,r,i,N,b,d,k,S,O,H,$.navigationProps]);return(0,ht.jsxs)(ht.Fragment,{children:[(0,ht.jsx)(bt.OverflowContainer,{...v,...$.containerProps,className:M,height:28,id:b,orientation:g,overflowIcon:"more-horiz",ref:x,style:C,children:R}),$.draggable]})};var $r=require("@salt-ds/core"),zr=Pe(require("classnames")),at=require("react");var kr=require("@vuu-ui/vuu-popups"),Pr=require("react"),Or=Pe(require("classnames"));var Kr=require("react/jsx-runtime"),Ul="vuuTabMenu",Ar=({allowClose:e,allowRename:t,location:n,onMenuAction:o,onMenuClose:r,index:l})=>{let[i,s]=(0,Pr.useMemo)(()=>[(a,c)=>{let d=[];return t&&d.push(hr(c)),e&&d.push(Ir(c)),d},{tabIndex:l}],[e,t,l]);return(0,Kr.jsx)(kr.PopupMenu,{className:Ul,menuBuilder:i,menuActionHandler:o,menuLocation:(0,Or.default)("tab",n),menuOptions:s,onMenuClose:r,tabIndex:-1})};var it=require("react/jsx-runtime"),lt="vuuTab",Fr=()=>{},jl=(0,at.forwardRef)(function({ariaControls:t,children:n,className:o,closeable:r=!1,dragging:l,editable:i=!1,editing:s,focusVisible:a,index:c=-1,label:d,location:f,onClick:u,onClose:I,onEnterEditMode:m=Fr,onExitEditMode:p=Fr,onFocus:g,onKeyUp:S,onMenuAction:E,onMenuClose:v,orientation:x,selected:T,showMenuButton:N=r||i,tabIndex:P,...H},k){if(N&&typeof E!="function")throw Error("Tab onMenuAction must be provided if showMenuButton is set");let O=(0,at.useRef)(null),$=(0,at.useRef)(null),b=(0,$r.useForkRef)(k,O),M=(0,at.useCallback)(y=>{s||(y.preventDefault(),u==null||u(y,c))},[s,c,u]),C=(y="",L="",w=!0)=>p(y,L,w,c),R=y=>{switch(y.key){case"Backspace":case"Delete":r&&(y.stopPropagation(),I&&I(c));break;default:S&&S(y,c)}},D=()=>i?(0,it.jsx)(Mn,{editing:s,defaultValue:d,onEnterEditMode:m,onExitEditMode:C,ref:$},d):d,h=y=>{if($.current){let w=$.current.querySelector(".vuuEditableLabel-input");w==null||w.focus()}g==null||g(y)};return(0,it.jsxs)("div",{...H,"aria-controls":t,"aria-selected":T,className:(0,zr.default)(lt,{[`${lt}-closeable`]:r,"vuuDraggable-dragAway":l,[`${lt}-editing`]:s,[`${lt}-selected`]:T||void 0,[`${lt}-vertical`]:x==="vertical",vuuFocusVisible:a}),onClick:M,onFocus:h,onKeyUp:R,ref:b,role:"tab",tabIndex:P,children:[(0,it.jsx)("div",{className:`${lt}-main`,children:(0,it.jsx)("span",{className:`${lt}-text`,"data-text":i?void 0:d,children:n!=null?n:D()})}),N?(0,it.jsx)(Ar,{allowClose:r,allowRename:i,location:f,onMenuAction:E,onMenuClose:v,index:c}):null]})});var bn=require("@salt-ds/core"),gn=Pe(require("classnames")),In=require("react");function Zl(e){var t;if(e){let n=e.dataset.idx;if(n)return parseInt(n,10);if(n=(t=e.ariaPosInSet)!=null?t:"-1")return parseInt(n,10)-1}}var Zn=e=>e.closest("[data-idx],[aria-posinset]");var Br=e=>Zl(Zn(e));var xt=require("react"),ql=new Set(["/","-","."]),Xl=e=>ql.has(e),_r=(e,t)=>t.startsWith(e)&&Xl(t[e.length]),qn=(e,t="root",{collapsibleHeaders:n=void 0,defaultExpanded:o=!1,revealSelected:r=!1}={})=>{let l=(u,I,m)=>{if(u.childNodes)return u.childNodes.length;if(u.header){let p=m+1,g=0;for(;p<I.length&&!I[p].header;)g++,p++;return g}else return 0},i=(0,xt.useCallback)(u=>Array.isArray(r)?r.some(I=>_r(u,I)):o,[o,r]),s=(0,xt.useCallback)((u,I,m=1,p="",g=[],S=[])=>{let E=0;return u.forEach((v,x,T)=>{var C;let N=v.header&&n,P=v.childNodes&&n===!1,H=!v.childNodes||v.childNodes.length===0,k=P||H&&!N,O=p?`${p}.${x}`:`${x}`,$=(C=v.id)!=null?C:`${t}-${O}`,b=k?void 0:i($),M={...v,childNodes:void 0,id:$,count:!P&&b===void 0?0:l(v,T,x),expanded:b,index:I.index,level:m};if(g.push(M),S.push(u[x]),E+=1,I.index+=1,v.childNodes){let[R,D]=s(v.childNodes,I,m+1,O,[],S);M.childNodes=D,(b===!0||P)&&(E+=R)}}),[E,g,S]},[n,t,i]),[a,c,d]=(0,xt.useMemo)(()=>s(e,{index:0}),[s,e]),f=(0,xt.useCallback)((u,I=c)=>{let m=I.find(p=>{var g;return p.id===u||((g=p==null?void 0:p.childNodes)==null?void 0:g.length)&&_r(p.id,u)});if((m==null?void 0:m.id)===u)return d[m.index];if(m)return f(u,m.childNodes)},[d,c]);return[a,c,f]};var We=require("react"),Wr=require("@salt-ds/core"),Vr="single",Yl="checkbox",Jl="multi",Ql="extended",ei=["Enter"," "],Gr={},ti=e=>e.expanded!==void 0,Ur=e=>e&&e!=="none",jr=({defaultSelected:e,highlightedIdx:t,treeNodes:n,onChange:o,selected:r,selection:l=Vr,selectionKeys:i=ei})=>{let s=l===Vr,a=l===Jl||l.startsWith(Yl),c=l===Ql,d=(0,We.useRef)(-1),f=(0,We.useCallback)(x=>i.includes(x.key),[i]),[u,I]=(0,Wr.useControlled)({controlled:r,default:e!=null?e:[],name:"selected"}),m=(0,We.useCallback)((x,T,N,P,H=!1)=>{let{current:k}=d,O=u==null?void 0:u.includes(N),b=s||c&&!H&&(!P||k===-1),M=a||c&&H&&!P,C=[];if(b&&O)C=[];else if(b)C=[N];else if(M&&O)C=u.filter(R=>R!==N);else if(M)C=u.concat(N);else if(c){let[R,D]=T>k?[k,T]:[T,k];C=u.slice();for(let h=R;h<=D;h++){let{id:y}=n[h];u.includes(y)||C.push(y)}}I(C),o&&o(x,C)},[c,n,a,o,u,I,s]),p=(0,We.useCallback)(x=>{if(~t&&f(x)){x.preventDefault();let T=n[t];m(x,t,T.id,!1,x.ctrlKey||x.metaKey),c&&(d.current=t)}},[c,t,n,f,m]),g=(0,We.useCallback)((x,T)=>{if(c&&x.shiftKey){let N=n[T];m(x,T,N.id,!0)}},[c,n,m]),S=l==="none"?Gr:{onKeyDown:p,onKeyboardNavigation:g},E=(0,We.useCallback)(x=>{if(t!==-1){let T=n[t];ti(T)||(x.preventDefault(),x.stopPropagation(),m(x,t,T.id,x.shiftKey,x.ctrlKey||x.metaKey),c&&(d.current=t))}},[c,t,n,m]);return{listHandlers:S,listItemHandlers:l==="none"?Gr:{onClick:E},selected:u,setSelected:I}};var xe=require("react");var ni=["height","scrollHeight"],Zr=(e,t,n=!1)=>{let o=(0,xe.useRef)(0),r=(0,xe.useRef)(!1),l=(0,xe.useRef)(0),i=(0,xe.useRef)(0),s=(0,xe.useCallback)(d=>{let f=d.ariaExpanded?d.firstChild:d,u=n?30:0,I=f.offsetTop,m=f.offsetHeight,p=o.current+u,g=p+l.current-u;(I+m>g||I<p)&&(o.current=I+m>g?o.current+(I+m)-g:I-u,r.current=!0,e.current&&(e.current.scrollTop=o.current),setTimeout(()=>{r.current=!1}))},[e,n]),a=(0,xe.useCallback)(d=>{o.current=d.target.scrollTop},[]);(0,xe.useEffect)(()=>{let{current:d}=e;return d&&d.addEventListener("scroll",a),()=>{d&&d.removeEventListener("scroll",a)}},[e,a]),(0,xe.useLayoutEffect)(()=>{if(t!==-1&&i.current>l.current&&e.current){let d=e.current.querySelector(`
|
|
214
4
|
[data-idx='${t}'],
|
|
215
5
|
[aria-posinset='${t+1}']
|
|
216
|
-
`);
|
|
6
|
+
`);d===null?console.log("[useViewportTracking], is this virtualised ? we're going to have to know rowHeight"):s(d)}},[t,e,s]),(0,xe.useEffect)(()=>{},[n]);let c=(0,xe.useCallback)(({height:d,scrollHeight:f})=>{l.current=d,i.current=f},[]);return nt(e,ni,c,!0),r};var $t=require("react");var Ce=require("react");var qr=({id:e})=>{let t=e.lastIndexOf("-");if(t!==-1){let o=e.slice(t+1).split(".");return o.length===1?null:(o.pop(),`${e.slice(0,t)}-${o.join(".")}`)}else if((t=e.lastIndexOf("/"))!==-1)return e.slice(0,t)},Xr=e=>e.childNodes!==void 0;var Xn=e=>e.header===!0,oi=new Set([".","/"]),Yr=(e,t)=>t.startsWith(e.id)?oi.has(t.charAt(e.id.length)):!1,ct=(e,t)=>{for(let n of e){if(n.id===t)return n;if(Yr(n,t))return ct(n.childNodes,t)}},un=(e,t)=>{let n=typeof t=="string"?t:t.id;for(let o=0;o<e.length;o++)if(e[o].id===n)return o},dn=(e,t,n)=>{let o;return e.map(l=>l.id===t?{...l,...n}:Yr(l,t)?(o=dn(l.childNodes,t,n),{...l,childNodes:o}):l)};var rs=require("@salt-ds/core");function ri(e,...t){let n=new Set(e);for(let o of t)for(let r of o)n.add(r);return n}var Yn="ArrowUp",Jr="ArrowDown",St="ArrowLeft";var Qr="ArrowRight",mn="Enter";var si="Delete",li=new Set([mn,si]),ii=new Set(["Tab"]),ai=new Set(["ArrowRight","ArrowLeft"]),es=new Set(["Home","End","ArrowDown","ArrowUp"]),ts=new Set(["Home","End","ArrowRight","ArrowLeft"]),ci=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),Em=ri(li,ts,es,ai,ci,ii);var ns=({key:e},t="vertical")=>(t==="vertical"?es:ts).has(e);function os(e,t,n){return t===Yn||t===St?n>0?n-1:n:n===null?0:n===e-1?n:n+1}var ui=e=>!e.header&&!e.childNodes,di=e=>ui(e)||e.expanded!==void 0,ss=({defaultHighlightedIdx:e=-1,highlightedIdx:t,treeNodes:n,onHighlight:o,onKeyboardNavigation:r,selected:l=[]})=>{let{bwd:i,fwd:s}=(0,Ce.useMemo)(()=>({bwd:Yn,fwd:Jr}),[]),[a,c,d]=(0,rs.useControlled)({controlled:t,default:e,name:"highlightedIdx"}),f=(0,Ce.useCallback)(x=>{o==null||o(x),c(x)},[o,c]),u=(0,Ce.useCallback)((x=s,T=x===s?-1:n.length)=>{let N=os(n.length,x,T);for(;N!==-1&&(x===s&&N<n.length||x===i&&N>0)&&!di(n[N]);)N=os(n.length,x,N);return N},[i,s,n]),I=(0,Ce.useRef)(!0),m=(0,Ce.useRef)(!1),p=x=>m.current=x,g=(0,Ce.useCallback)(()=>{if(m.current)m.current=!1;else if(l.length>0){let x=ct(n,l[0]);if(x){let T=un(n,x);f(T)}}else f(u())},[n,u,l,f]),S=(0,Ce.useCallback)(x=>{let T=u(x.key,a);T!==a&&(f(T),r==null||r(x,T))},[a,u,r,f]),E=(0,Ce.useCallback)(x=>{n.length>0&&ns(x,"vertical")&&(x.preventDefault(),x.stopPropagation(),I.current=!0,S(x))},[n,S]),v=(0,Ce.useMemo)(()=>({onBlur:()=>{f(-1)},onFocus:g,onKeyDown:E,onMouseDownCapture:()=>{I.current=!1,p(!0)},onMouseMove:()=>{I.current&&(I.current=!1)},onMouseLeave:()=>{I.current=!0,p(!1),f(-1)}}),[g,E,f]);return{focusVisible:I.current?a:-1,controlledHighlighting:d,highlightedIdx:a,hiliteItemAtIndex:f,keyBoardNavigation:I,listProps:v,setIgnoreFocus:p}};var yt=require("react");var fn=(e,t=[],n={value:0})=>{let o=!1;for(let r of e)o&&!Xn(r)||(t[n.value]=r,n.value+=1,o=!1,Xn(r)&&r.expanded===!1?o=!0:Xr(r)&&pn(r)&&fn(r.childNodes,t,n));return t},ls=e=>{let t=(0,yt.useRef)(e),n=(0,yt.useRef)(e),o=(0,yt.useRef)(fn(e)),[,r]=(0,yt.useState)({});e!==t.current&&(t.current=e,n.current=e,o.current=fn(e));let l=i=>{n.current=i,o.current=fn(i),r({})};return{data:n.current,indexPositions:o.current,setData:l}};var _e=require("react");var mi={},fi=e=>e&&e.hasAttribute("aria-expanded"),is=({collapsibleHeaders:e,highlightedIdx:t,treeNodes:n,setVisibleData:o,source:r})=>{let l=(0,_e.useRef)(r),i=(0,_e.useRef)(l.current),s=(0,_e.useCallback)(m=>{o(i.current=m)},[o]),a=(0,_e.useCallback)((m,{id:p})=>dn(m,p,{expanded:!0}),[]),c=(0,_e.useCallback)((m,{id:p})=>dn(m,p,{expanded:!1}),[]),d=(0,_e.useCallback)(m=>{if(m.key===Qr||m.key===mn){let p=n[t];p&&p.expanded===!1&&(m.preventDefault(),s(a(i.current,p)))}if(m.key===St||m.key===mn){let p=n[t];p&&p.expanded&&(m.preventDefault(),s(c(i.current,p)))}},[c,a,t,n,s]),f=e?{onKeyDown:d}:mi,I={onClick:(0,_e.useCallback)(m=>{let p=Zn(m.target);if(fi(p)){m.stopPropagation(),m.preventDefault();let g=ct(r,p.id);(g==null?void 0:g.expanded)===!1?s(a(r,g)):(g==null?void 0:g.expanded)===!0&&s(c(r,g))}},[c,a,s,r])};return{listHandlers:f,listItemHandlers:I}};var as=require("react");var cs=({highlightedIdx:e,hiliteItemAtIndex:t,indexPositions:n,source:o})=>({listHandlers:{onKeyDown:(0,as.useCallback)(i=>{if(i.key===St){let s=n[e],a=qr(s);if(a){i.preventDefault();let c=ct(o,a);if(c){let d=un(n,c);d!==void 0&&t(d)}}}},[e,t,n,o])}});var pi=[],us=({defaultSelected:e,sourceWithIds:t,onChange:n,onHighlight:o,selected:r,selection:l})=>{let i=(0,$t.useRef)(pi),s=ls(t),a=(v,x)=>{var T,N;(N=(T=u.listHandlers).onKeyboardNavigation)==null||N.call(T,v,x)},{highlightedIdx:c,...d}=ss({treeNodes:s.indexPositions,onHighlight:o,onKeyboardNavigation:a,selected:i.current}),f=is({collapsibleHeaders:!0,highlightedIdx:c,treeNodes:s.indexPositions,setVisibleData:s.setData,source:s.data}),u=jr({defaultSelected:e,highlightedIdx:c,treeNodes:s.indexPositions,onChange:n,selected:r,selection:l}),I=cs({source:s.data,highlightedIdx:c,hiliteItemAtIndex:d.hiliteItemAtIndex,indexPositions:s.indexPositions}),m=(0,$t.useCallback)(v=>{var x,T,N;(x=f.listItemHandlers)==null||x.onClick(v),v.defaultPrevented||(N=(T=u.listItemHandlers)==null?void 0:T.onClick)==null||N.call(T,v)},[f,u]),p=(0,$t.useCallback)(v=>{var x,T,N,P,H,k,O,$;(T=(x=d.listProps).onKeyDown)==null||T.call(x,v),v.defaultPrevented||(P=(N=u.listHandlers).onKeyDown)==null||P.call(N,v),v.defaultPrevented||(k=(H=f.listHandlers).onKeyDown)==null||k.call(H,v),v.defaultPrevented||($=(O=I.listHandlers).onKeyDown)==null||$.call(O,v)},[f.listHandlers,d.listProps,u.listHandlers,I.listHandlers]),g=()=>{var v;return c===void 0||c===-1||(v=s.indexPositions[c])==null?void 0:v.id};i.current=u.selected;let S={"aria-activedescendant":g(),onBlur:d.listProps.onBlur,onFocus:d.listProps.onFocus,onKeyDown:p,onMouseDownCapture:d.listProps.onMouseDownCapture,onMouseLeave:d.listProps.onMouseLeave,onMouseMove:d.listProps.onMouseMove},E={onClick:m};return{focusVisible:d.focusVisible,highlightedIdx:c,hiliteItemAtIndex:d.hiliteItemAtIndex,listProps:S,listItemHandlers:E,selected:u.selected,visibleData:s.data}};var ve=require("react/jsx-runtime"),fs=require("react"),Ue="vuuTree",pn=e=>e.expanded===!0,Jn=({children:e,idx:t,...n})=>(0,ve.jsx)("li",{...n,children:e}),ds=(0,In.forwardRef)(function({allowDragDrop:t,className:n,defaultSelected:o,groupSelection:r="none",id:l,onHighlight:i,onSelectionChange:s,revealSelected:a,selected:c,selection:d="single",source:f,...u},I){var D;let m=(0,bn.useIdMemo)(l),p=(0,In.useRef)(null),[,g,S]=qn(f,m,{revealSelected:a?(D=c!=null?c:o)!=null?D:!1:void 0}),E=(h,y)=>{if(s){let L=y.map(w=>S(w)).filter(w=>w!==void 0);s(L)}},{focusVisible:v,highlightedIdx:x,hiliteItemAtIndex:T,listProps:N,listItemHandlers:P,selected:H,visibleData:k}=us({defaultSelected:o,groupSelection:r,onChange:E,onHighlight:i,selected:c,selection:d,sourceWithIds:g});Zr(p,x);let $={...{onMouseEnter:h=>{let y=h.target,L=Br(y);T(L)}},...P,role:"treeitem"},b=Ur(r);function M(h,y,L){h.push((0,ve.jsxs)(Jn,{...$,...gi(y,L,x,H,v),children:[y.icon?(0,ve.jsx)("span",{className:`${Ue}Node-icon`,"data-icon":y.icon}):null,(0,ve.jsx)("span",{children:y.label})]})),L.value+=1}function C(h,y,L,w,A){let{value:z}=L;L.value+=1,h.push((0,fs.createElement)(Jn,{...P,"aria-expanded":y.expanded,"aria-level":y.level,"aria-selected":H.includes(w)||void 0,className:(0,gn.default)(`${Ue}Node`,{focusVisible:v===z,[`${Ue}Node-toggle`]:!b}),"data-idx":z,"data-highlighted":z===x||void 0,"data-selectable":!0,id:w,key:`header-${z}`},b?(0,ve.jsxs)("div",{className:`${Ue}Node-label`,children:[(0,ve.jsx)("span",{className:`${Ue}Node-toggle`}),A]}):(0,ve.jsxs)("div",{className:`${Ue}Node-label`,children:[y.icon?(0,ve.jsx)("span",{className:`${Ue}Node-icon`,"data-icon":y.icon}):null,(0,ve.jsx)("span",{children:A})]}),(0,ve.jsx)("ul",{role:"group",children:pn(y)?R(y.childNodes,L):""})))}function R(h,y={value:0}){if((h==null?void 0:h.length)>0){let L=[];for(let w of h)w.childNodes?C(L,w,y,w.id,w.label):M(L,w,y);return L}}return(0,ve.jsx)("ul",{...u,...N,className:(0,gn.default)(Ue,n),id:`Tree-${m}`,ref:(0,bn.useForkRef)(p,I),role:"tree",tabIndex:0,children:R(k)})}),gi=(e,t,n,o,r,l)=>({id:e.id,key:e.id,"aria-level":e.level,"aria-selected":o.includes(e.id)||void 0,"data-idx":t.value,"data-highlighted":t.value===n||void 0,className:(0,gn.default)("vuuTreeNode",l,{focusVisible:r===t.value})});ds.displayName="Tree";var ms=ds;
|
|
217
7
|
//# sourceMappingURL=index.js.map
|