v-float 0.9.1 → 0.11.0

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.
Files changed (52) hide show
  1. package/README.md +44 -175
  2. package/dist/index.d.mts +688 -0
  3. package/dist/index.d.mts.map +1 -0
  4. package/dist/index.mjs +2038 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/package.json +74 -74
  7. package/dist/composables/index.d.ts +0 -4
  8. package/dist/composables/index.d.ts.map +0 -1
  9. package/dist/composables/interactions/index.d.ts +0 -7
  10. package/dist/composables/interactions/index.d.ts.map +0 -1
  11. package/dist/composables/interactions/navigation-strategies.d.ts +0 -36
  12. package/dist/composables/interactions/navigation-strategies.d.ts.map +0 -1
  13. package/dist/composables/interactions/polygon.d.ts +0 -38
  14. package/dist/composables/interactions/polygon.d.ts.map +0 -1
  15. package/dist/composables/interactions/use-click.d.ts +0 -120
  16. package/dist/composables/interactions/use-click.d.ts.map +0 -1
  17. package/dist/composables/interactions/use-escape-key.d.ts +0 -57
  18. package/dist/composables/interactions/use-escape-key.d.ts.map +0 -1
  19. package/dist/composables/interactions/use-focus-trap.d.ts +0 -41
  20. package/dist/composables/interactions/use-focus-trap.d.ts.map +0 -1
  21. package/dist/composables/interactions/use-focus.d.ts +0 -60
  22. package/dist/composables/interactions/use-focus.d.ts.map +0 -1
  23. package/dist/composables/interactions/use-hover.d.ts +0 -78
  24. package/dist/composables/interactions/use-hover.d.ts.map +0 -1
  25. package/dist/composables/interactions/use-list-navigation.d.ts +0 -109
  26. package/dist/composables/interactions/use-list-navigation.d.ts.map +0 -1
  27. package/dist/composables/middlewares/arrow.d.ts +0 -25
  28. package/dist/composables/middlewares/arrow.d.ts.map +0 -1
  29. package/dist/composables/middlewares/index.d.ts +0 -4
  30. package/dist/composables/middlewares/index.d.ts.map +0 -1
  31. package/dist/composables/positioning/index.d.ts +0 -5
  32. package/dist/composables/positioning/index.d.ts.map +0 -1
  33. package/dist/composables/positioning/use-arrow.d.ts +0 -55
  34. package/dist/composables/positioning/use-arrow.d.ts.map +0 -1
  35. package/dist/composables/positioning/use-client-point.d.ts +0 -218
  36. package/dist/composables/positioning/use-client-point.d.ts.map +0 -1
  37. package/dist/composables/positioning/use-floating-tree.d.ts +0 -240
  38. package/dist/composables/positioning/use-floating-tree.d.ts.map +0 -1
  39. package/dist/composables/positioning/use-floating.d.ts +0 -162
  40. package/dist/composables/positioning/use-floating.d.ts.map +0 -1
  41. package/dist/composables/utils/is-using-keyboard.d.ts +0 -2
  42. package/dist/composables/utils/is-using-keyboard.d.ts.map +0 -1
  43. package/dist/composables/utils/use-active-descendant.d.ts +0 -8
  44. package/dist/composables/utils/use-active-descendant.d.ts.map +0 -1
  45. package/dist/index.d.ts +0 -2
  46. package/dist/index.d.ts.map +0 -1
  47. package/dist/types.d.ts +0 -18
  48. package/dist/types.d.ts.map +0 -1
  49. package/dist/utils.d.ts +0 -92
  50. package/dist/utils.d.ts.map +0 -1
  51. package/dist/v-float.es.js +0 -3520
  52. package/dist/v-float.umd.js +0 -4
@@ -1,4 +0,0 @@
1
- (function(X,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],s):(X=typeof globalThis<"u"?globalThis:X||self,s(X.VFloat={},X.Vue))})(this,(function(X,s){"use strict";var gr=Object.defineProperty;var vr=(X,s,Re)=>s in X?gr(X,s,{enumerable:!0,configurable:!0,writable:!0,value:Re}):X[s]=Re;var He=(X,s,Re)=>vr(X,typeof s!="symbol"?s+"":s,Re);function Re(t,e,n={}){const{offset:o="-4px"}=n,{middlewareData:r,placement:a,refs:i}=e;s.watch(t,d=>{i.arrowEl.value=d});const c=s.computed(()=>{var d;return((d=r.value.arrow)==null?void 0:d.x)??0}),h=s.computed(()=>{var d;return((d=r.value.arrow)==null?void 0:d.y)??0}),l=s.computed(()=>{if(!(t.value||i.arrowEl.value)||!r.value.arrow)return{};const u=s.toValue(a).split("-")[0],p=c.value,m=h.value;return u==="bottom"?{"inset-inline-start":`${p}px`,"inset-block-start":o}:u==="top"?{"inset-inline-start":`${p}px`,"inset-block-end":o}:u==="right"?{"inset-block-start":`${m}px`,"inset-inline-start":o}:u==="left"?{"inset-block-start":`${m}px`,"inset-inline-end":o}:{}});return{arrowX:c,arrowY:h,arrowStyles:l}}let vn=0;function Et(){return s.useId()||`id-${++vn}`}function We(t){return t instanceof Element&&t instanceof HTMLElement}function wn(){return typeof navigator>"u"?!1:navigator.platform.toUpperCase().indexOf("MAC")>=0}function bn(){return typeof navigator>"u"?!1:/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function yn(t){return typeof(t==null?void 0:t.matches)!="function"?!1:t.matches(":focus-visible")}function xt(t,e){if(t===void 0)return!1;const n=t==="mouse";return e?n:n||t==="pen"}function lt(t){return!t||!(t instanceof HTMLElement)?!1:t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t.isContentEditable&&t.contentEditable!=="false"}function Ct(t){const e=t.target;return e instanceof HTMLElement?e.tagName==="BUTTON"||e.tagName==="INPUT"&&e.getAttribute("type")==="button"||e.getAttribute("role")==="button":!1}function Tt(t){return lt(t)}function St(t,e){return e?"composedPath"in t&&typeof t.composedPath=="function"?t.composedPath().includes(e):e.contains(t.target):!1}function En(t,e){const n=e.getBoundingClientRect(),o=e.offsetWidth-e.clientWidth,r=e.offsetHeight-e.clientHeight,a=t.clientX-n.left,i=t.clientY-n.top;if(o>0){const c=e.clientWidth;if(a>=c&&a<=e.offsetWidth)return!0}if(r>0){const c=e.clientHeight;if(i>=c&&i<=e.offsetHeight)return!0}return!1}function st(t,e){return t.contains(e)}function xn(t){return t.target}function At(){return typeof performance<"u"?performance.now():Date.now()}function Ot(t){t!==-1&&clearTimeout(t)}function Cn(t){return t!==null&&typeof t=="object"&&"data"in t&&"id"in t&&"children"in t&&"parent"in t}function Be(t){return Cn(t)?{floatingContext:t.data,treeContext:t}:{floatingContext:t,treeContext:null}}function le(t,e){if(!e)return!1;if(typeof e=="object"&&e!==null&&"contextElement"in e){const n=e.contextElement;return n instanceof Element?n.contains(t):!1}return e instanceof Element?e.contains(t):!1}function Ue(t,e){for(const n of t.children.value)if(n.data.open.value){if(le(e,n.data.refs.anchorEl.value)||le(e,n.data.refs.floatingEl.value))return n;const o=Ue(n,e);if(o)return o}return null}const _e=t=>typeof t=="number"&&Number.isFinite(t)?t:null,De=class De{create(e){const n=this.buildConfiguration(e);return{contextElement:n.referenceElement||void 0,getBoundingClientRect:()=>this.buildBoundingRect(n)}}buildConfiguration(e){return{coordinates:e.coordinates,referenceElement:e.referenceElement??null,baselineCoordinates:e.baselineCoordinates??null,axis:e.axis??"both"}}buildBoundingRect(e){const n=this.getReferenceRect(e.referenceElement),o=this.resolvePosition(e,n),r=this.calculateSize(e.axis,n);return this.buildDOMRect({x:o.x,y:o.y,width:r.width,height:r.height})}getReferenceRect(e){if(e)try{return e.getBoundingClientRect()}catch(n){console.warn("VirtualElementFactory: Failed to get element bounds",{element:e,error:n})}return this.buildDOMRect({x:0,y:0,width:De.DEFAULT_DIMENSIONS.width,height:De.DEFAULT_DIMENSIONS.height})}resolvePosition(e,n){var o,r;return{x:this.resolveAxisCoordinate({current:e.coordinates.x,baseline:((o=e.baselineCoordinates)==null?void 0:o.x)??null,fallback:n.x,isAxisEnabled:e.axis==="x"||e.axis==="both"}),y:this.resolveAxisCoordinate({current:e.coordinates.y,baseline:((r=e.baselineCoordinates)==null?void 0:r.y)??null,fallback:n.y,isAxisEnabled:e.axis==="y"||e.axis==="both"})}}resolveAxisCoordinate(e){const{current:n,baseline:o,fallback:r,isAxisEnabled:a}=e;return a&&n!==null?n:o!==null?o:r}calculateSize(e,n){const o=(r,a)=>Math.max(0,r||a);switch(e){case"both":return{width:0,height:0};case"x":return{width:o(n.width,De.DEFAULT_DIMENSIONS.width),height:0};case"y":return{width:0,height:o(n.height,De.DEFAULT_DIMENSIONS.height)}}}buildDOMRect(e){const{x:n,y:o,width:r,height:a}=e,i=Math.max(0,r),c=Math.max(0,a);return{x:n,y:o,width:i,height:c,top:o,right:n+i,bottom:o+c,left:n,toJSON:()=>({x:n,y:o,width:i,height:c})}}};He(De,"DEFAULT_DIMENSIONS",{width:100,height:30});let je=De;class at{constructor(){He(this,"lastKnownCoordinates",null)}getCoordinatesForOpening(){return this.lastKnownCoordinates}onClose(){this.lastKnownCoordinates=null}reset(){this.lastKnownCoordinates=null}}class Lt extends at{constructor(){super(...arguments);He(this,"name","follow")}getRequiredEvents(){return["pointerdown","pointermove","pointerenter"]}process(n,o){const r=n.coordinates;switch(this.lastKnownCoordinates=r,n.type){case"pointerdown":return r;case"pointermove":return o.isOpen&&xt(n.originalEvent.pointerType,!0)?r:null;case"pointerenter":return r;default:return null}}}class Dt extends at{constructor(){super(...arguments);He(this,"name","static");He(this,"triggerCoordinates",null)}getRequiredEvents(){return["pointerdown"]}process(n,o){const r=n.coordinates;return this.triggerCoordinates=r,this.lastKnownCoordinates=r,o.isOpen?r:null}getCoordinatesForOpening(){return this.triggerCoordinates?this.triggerCoordinates:this.lastKnownCoordinates}reset(){super.reset(),this.triggerCoordinates=null}onClose(){this.triggerCoordinates=null}}function Tn(t,e,n={}){const{open:o,refs:r}=e,a=new je,i=s.ref({x:null,y:null}),c=s.ref(null),h=s.computed(()=>s.toValue(n.axis??"both")),l=s.computed(()=>s.toValue(n.enabled??!0)),d=s.computed(()=>_e(s.toValue(n.x??null))),u=s.computed(()=>_e(s.toValue(n.y??null))),p=s.computed(()=>d.value!==null&&u.value!==null),m=s.computed(()=>p.value?{x:d.value,y:u.value}:i.value),w=s.computed(()=>{const C=m.value;switch(h.value){case"x":return{x:C.x,y:null};case"y":return{x:null,y:C.y};case"both":return C}}),b=(n.trackingMode??"follow")==="follow"?new Lt:new Dt,v=(C,P)=>{p.value||(i.value={x:_e(C),y:_e(P)})},g=()=>{p.value||(i.value={x:null,y:null})},E=(C,P)=>{const K={type:P,coordinates:{x:C.clientX,y:C.clientY},originalEvent:C},N=b.process(K,{isOpen:o.value});N&&v(N.x,N.y)};s.watch([w,c,h,t],()=>{r.anchorEl.value=a.create({coordinates:w.value,referenceElement:t.value,baselineCoordinates:c.value,axis:h.value})},{immediate:!0}),s.watch(o,C=>{if(!(!l.value||p.value))if(C){const P=b.getCoordinatesForOpening();P?(v(P.x,P.y),c.value={...P}):c.value={...i.value}}else b.onClose(),g(),c.value=null});const L=C=>{E(C,"pointerdown")},R=C=>{E(C,"pointerenter")},D=C=>{E(C,"pointermove")};return s.watchEffect(()=>{if(p.value||!l.value)return;const C=t.value;if(!C)return;const P=b.getRequiredEvents(),K={pointerenter:R,pointerdown:L,pointermove:D};P.forEach(N=>{const V=K[N];V&&C.addEventListener(N,V)}),s.onWatcherCleanup(()=>{P.forEach(N=>{const V=K[N];V&&C.removeEventListener(N,V)})})}),{coordinates:s.readonly(w),updatePosition:(C,P)=>v(C,P)}}const Pt=["top","right","bottom","left"],Rt=["start","end"],Mt=Pt.reduce((t,e)=>t.concat(e,e+"-"+Rt[0],e+"-"+Rt[1]),[]),xe=Math.min,se=Math.max,qe=Math.round,Ge=Math.floor,ge=t=>({x:t,y:t}),Sn={left:"right",right:"left",bottom:"top",top:"bottom"},An={start:"end",end:"start"};function ct(t,e,n){return se(t,xe(e,n))}function Ce(t,e){return typeof t=="function"?t(e):t}function ve(t){return t.split("-")[0]}function fe(t){return t.split("-")[1]}function Vt(t){return t==="x"?"y":"x"}function ut(t){return t==="y"?"height":"width"}const On=new Set(["top","bottom"]);function Ee(t){return On.has(ve(t))?"y":"x"}function ft(t){return Vt(Ee(t))}function Ft(t,e,n){n===void 0&&(n=!1);const o=fe(t),r=ft(t),a=ut(r);let i=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(i=Je(i)),[i,Je(i)]}function Ln(t){const e=Je(t);return[Ze(t),e,Ze(e)]}function Ze(t){return t.replace(/start|end/g,e=>An[e])}const Nt=["left","right"],It=["right","left"],Dn=["top","bottom"],Pn=["bottom","top"];function Rn(t,e,n){switch(t){case"top":case"bottom":return n?e?It:Nt:e?Nt:It;case"left":case"right":return e?Dn:Pn;default:return[]}}function Mn(t,e,n,o){const r=fe(t);let a=Rn(ve(t),n==="start",o);return r&&(a=a.map(i=>i+"-"+r),e&&(a=a.concat(a.map(Ze)))),a}function Je(t){return t.replace(/left|right|bottom|top/g,e=>Sn[e])}function Vn(t){return{top:0,right:0,bottom:0,left:0,...t}}function kt(t){return typeof t!="number"?Vn(t):{top:t,right:t,bottom:t,left:t}}function Qe(t){const{x:e,y:n,width:o,height:r}=t;return{width:o,height:r,top:n,left:e,right:e+o,bottom:n+r,x:e,y:n}}function Ht(t,e,n){let{reference:o,floating:r}=t;const a=Ee(e),i=ft(e),c=ut(i),h=ve(e),l=a==="y",d=o.x+o.width/2-r.width/2,u=o.y+o.height/2-r.height/2,p=o[c]/2-r[c]/2;let m;switch(h){case"top":m={x:d,y:o.y-r.height};break;case"bottom":m={x:d,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:u};break;case"left":m={x:o.x-r.width,y:u};break;default:m={x:o.x,y:o.y}}switch(fe(e)){case"start":m[i]-=p*(n&&l?-1:1);break;case"end":m[i]+=p*(n&&l?-1:1);break}return m}const Fn=async(t,e,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:a=[],platform:i}=n,c=a.filter(Boolean),h=await(i.isRTL==null?void 0:i.isRTL(e));let l=await i.getElementRects({reference:t,floating:e,strategy:r}),{x:d,y:u}=Ht(l,o,h),p=o,m={},w=0;for(let b=0;b<c.length;b++){const{name:v,fn:g}=c[b],{x:E,y:L,data:R,reset:D}=await g({x:d,y:u,initialPlacement:o,placement:p,strategy:r,middlewareData:m,rects:l,platform:i,elements:{reference:t,floating:e}});d=E??d,u=L??u,m={...m,[v]:{...m[v],...R}},D&&w<=50&&(w++,typeof D=="object"&&(D.placement&&(p=D.placement),D.rects&&(l=D.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:r}):D.rects),{x:d,y:u}=Ht(l,p,h)),b=-1)}return{x:d,y:u,placement:p,strategy:r,middlewareData:m}};async function Me(t,e){var n;e===void 0&&(e={});const{x:o,y:r,platform:a,rects:i,elements:c,strategy:h}=t,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:p=!1,padding:m=0}=Ce(e,t),w=kt(m),v=c[p?u==="floating"?"reference":"floating":u],g=Qe(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(v)))==null||n?v:v.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:l,rootBoundary:d,strategy:h})),E=u==="floating"?{x:o,y:r,width:i.floating.width,height:i.floating.height}:i.reference,L=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c.floating)),R=await(a.isElement==null?void 0:a.isElement(L))?await(a.getScale==null?void 0:a.getScale(L))||{x:1,y:1}:{x:1,y:1},D=Qe(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:E,offsetParent:L,strategy:h}):E);return{top:(g.top-D.top+w.top)/R.y,bottom:(D.bottom-g.bottom+w.bottom)/R.y,left:(g.left-D.left+w.left)/R.x,right:(D.right-g.right+w.right)/R.x}}const Nn=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:r,rects:a,platform:i,elements:c,middlewareData:h}=e,{element:l,padding:d=0}=Ce(t,e)||{};if(l==null)return{};const u=kt(d),p={x:n,y:o},m=ft(r),w=ut(m),b=await i.getDimensions(l),v=m==="y",g=v?"top":"left",E=v?"bottom":"right",L=v?"clientHeight":"clientWidth",R=a.reference[w]+a.reference[m]-p[m]-a.floating[w],D=p[m]-a.reference[m],C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l));let P=C?C[L]:0;(!P||!await(i.isElement==null?void 0:i.isElement(C)))&&(P=c.floating[L]||a.floating[w]);const K=R/2-D/2,N=P/2-b[w]/2-1,V=xe(u[g],N),H=xe(u[E],N),Y=V,z=P-b[w]-H,B=P/2-b[w]/2+K,T=ct(Y,B,z),f=!h.arrow&&fe(r)!=null&&B!==T&&a.reference[w]/2-(B<Y?V:H)-b[w]/2<0,W=f?B<Y?B-Y:B-z:0;return{[m]:p[m]+W,data:{[m]:T,centerOffset:B-T-W,...f&&{alignmentOffset:W}},reset:f}}});function In(t,e,n){return(t?[...n.filter(r=>fe(r)===t),...n.filter(r=>fe(r)!==t)]:n.filter(r=>ve(r)===r)).filter(r=>t?fe(r)===t||(e?Ze(r)!==r:!1):!0)}const kn=function(t){return t===void 0&&(t={}),{name:"autoPlacement",options:t,async fn(e){var n,o,r;const{rects:a,middlewareData:i,placement:c,platform:h,elements:l}=e,{crossAxis:d=!1,alignment:u,allowedPlacements:p=Mt,autoAlignment:m=!0,...w}=Ce(t,e),b=u!==void 0||p===Mt?In(u||null,m,p):p,v=await Me(e,w),g=((n=i.autoPlacement)==null?void 0:n.index)||0,E=b[g];if(E==null)return{};const L=Ft(E,a,await(h.isRTL==null?void 0:h.isRTL(l.floating)));if(c!==E)return{reset:{placement:b[0]}};const R=[v[ve(E)],v[L[0]],v[L[1]]],D=[...((o=i.autoPlacement)==null?void 0:o.overflows)||[],{placement:E,overflows:R}],C=b[g+1];if(C)return{data:{index:g+1,overflows:D},reset:{placement:C}};const P=D.map(V=>{const H=fe(V.placement);return[V.placement,H&&d?V.overflows.slice(0,2).reduce((Y,z)=>Y+z,0):V.overflows[0],V.overflows]}).sort((V,H)=>V[1]-H[1]),N=((r=P.filter(V=>V[2].slice(0,fe(V[0])?2:3).every(H=>H<=0))[0])==null?void 0:r[0])||P[0][0];return N!==c?{data:{index:g+1,overflows:D},reset:{placement:N}}:{}}}},Hn=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:r,middlewareData:a,rects:i,initialPlacement:c,platform:h,elements:l}=e,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:b=!0,...v}=Ce(t,e);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const g=ve(r),E=Ee(c),L=ve(c)===c,R=await(h.isRTL==null?void 0:h.isRTL(l.floating)),D=p||(L||!b?[Je(c)]:Ln(c)),C=w!=="none";!p&&C&&D.push(...Mn(c,b,w,R));const P=[c,...D],K=await Me(e,v),N=[];let V=((o=a.flip)==null?void 0:o.overflows)||[];if(d&&N.push(K[g]),u){const B=Ft(r,i,R);N.push(K[B[0]],K[B[1]])}if(V=[...V,{placement:r,overflows:N}],!N.every(B=>B<=0)){var H,Y;const B=(((H=a.flip)==null?void 0:H.index)||0)+1,T=P[B];if(T&&(!(u==="alignment"?E!==Ee(T):!1)||V.every(y=>Ee(y.placement)===E?y.overflows[0]>0:!0)))return{data:{index:B,overflows:V},reset:{placement:T}};let f=(Y=V.filter(W=>W.overflows[0]<=0).sort((W,y)=>W.overflows[1]-y.overflows[1])[0])==null?void 0:Y.placement;if(!f)switch(m){case"bestFit":{var z;const W=(z=V.filter(y=>{if(C){const U=Ee(y.placement);return U===E||U==="y"}return!0}).map(y=>[y.placement,y.overflows.filter(U=>U>0).reduce((U,ne)=>U+ne,0)]).sort((y,U)=>y[1]-U[1])[0])==null?void 0:z[0];W&&(f=W);break}case"initialPlacement":f=c;break}if(r!==f)return{reset:{placement:f}}}return{}}}};function Wt(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Bt(t){return Pt.some(e=>t[e]>=0)}const Wn=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:o="referenceHidden",...r}=Ce(t,e);switch(o){case"referenceHidden":{const a=await Me(e,{...r,elementContext:"reference"}),i=Wt(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Bt(i)}}}case"escaped":{const a=await Me(e,{...r,altBoundary:!0}),i=Wt(a,n.floating);return{data:{escapedOffsets:i,escaped:Bt(i)}}}default:return{}}}}},Bn=new Set(["left","top"]);async function $n(t,e){const{placement:n,platform:o,elements:r}=t,a=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=ve(n),c=fe(n),h=Ee(n)==="y",l=Bn.has(i)?-1:1,d=a&&h?-1:1,u=Ce(e,t);let{mainAxis:p,crossAxis:m,alignmentAxis:w}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof w=="number"&&(m=c==="end"?w*-1:w),h?{x:m*d,y:p*l}:{x:p*l,y:m*d}}const Kn=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:r,y:a,placement:i,middlewareData:c}=e,h=await $n(e,t);return i===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+h.x,y:a+h.y,data:{...h,placement:i}}}}},zn=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:r}=e,{mainAxis:a=!0,crossAxis:i=!1,limiter:c={fn:v=>{let{x:g,y:E}=v;return{x:g,y:E}}},...h}=Ce(t,e),l={x:n,y:o},d=await Me(e,h),u=Ee(ve(r)),p=Vt(u);let m=l[p],w=l[u];if(a){const v=p==="y"?"top":"left",g=p==="y"?"bottom":"right",E=m+d[v],L=m-d[g];m=ct(E,m,L)}if(i){const v=u==="y"?"top":"left",g=u==="y"?"bottom":"right",E=w+d[v],L=w-d[g];w=ct(E,w,L)}const b=c.fn({...e,[p]:m,[u]:w});return{...b,data:{x:b.x-n,y:b.y-o,enabled:{[p]:a,[u]:i}}}}}},Xn=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:r,rects:a,platform:i,elements:c}=e,{apply:h=()=>{},...l}=Ce(t,e),d=await Me(e,l),u=ve(r),p=fe(r),m=Ee(r)==="y",{width:w,height:b}=a.floating;let v,g;u==="top"||u==="bottom"?(v=u,g=p===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(g=u,v=p==="end"?"top":"bottom");const E=b-d.top-d.bottom,L=w-d.left-d.right,R=xe(b-d[v],E),D=xe(w-d[g],L),C=!e.middlewareData.shift;let P=R,K=D;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(K=L),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(P=E),C&&!p){const V=se(d.left,0),H=se(d.right,0),Y=se(d.top,0),z=se(d.bottom,0);m?K=w-2*(V!==0||H!==0?V+H:se(d.left,d.right)):P=b-2*(Y!==0||z!==0?Y+z:se(d.top,d.bottom))}await h({...e,availableWidth:K,availableHeight:P});const N=await i.getDimensions(c.floating);return w!==N.width||b!==N.height?{reset:{rects:!0}}:{}}}};function et(){return typeof window<"u"}function Ve(t){return $t(t)?(t.nodeName||"").toLowerCase():"#document"}function ae(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function we(t){var e;return(e=($t(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function $t(t){return et()?t instanceof Node||t instanceof ae(t).Node:!1}function de(t){return et()?t instanceof Element||t instanceof ae(t).Element:!1}function be(t){return et()?t instanceof HTMLElement||t instanceof ae(t).HTMLElement:!1}function Kt(t){return!et()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ae(t).ShadowRoot}const Yn=new Set(["inline","contents"]);function $e(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=he(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!Yn.has(r)}const Un=new Set(["table","td","th"]);function _n(t){return Un.has(Ve(t))}const jn=[":popover-open",":modal"];function tt(t){return jn.some(e=>{try{return t.matches(e)}catch{return!1}})}const qn=["transform","translate","scale","rotate","perspective"],Gn=["transform","translate","scale","rotate","perspective","filter"],Zn=["paint","layout","strict","content"];function dt(t){const e=ht(),n=de(t)?he(t):t;return qn.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||Gn.some(o=>(n.willChange||"").includes(o))||Zn.some(o=>(n.contain||"").includes(o))}function Jn(t){let e=Te(t);for(;be(e)&&!Fe(e);){if(dt(e))return e;if(tt(e))return null;e=Te(e)}return null}function ht(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Qn=new Set(["html","body","#document"]);function Fe(t){return Qn.has(Ve(t))}function he(t){return ae(t).getComputedStyle(t)}function nt(t){return de(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Te(t){if(Ve(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Kt(t)&&t.host||we(t);return Kt(e)?e.host:e}function zt(t){const e=Te(t);return Fe(e)?t.ownerDocument?t.ownerDocument.body:t.body:be(e)&&$e(e)?e:zt(e)}function Ke(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=zt(t),a=r===((o=t.ownerDocument)==null?void 0:o.body),i=ae(r);if(a){const c=pt(i);return e.concat(i,i.visualViewport||[],$e(r)?r:[],c&&n?Ke(c):[])}return e.concat(r,Ke(r,[],n))}function pt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Xt(t){const e=he(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=be(t),a=r?t.offsetWidth:n,i=r?t.offsetHeight:o,c=qe(n)!==a||qe(o)!==i;return c&&(n=a,o=i),{width:n,height:o,$:c}}function mt(t){return de(t)?t:t.contextElement}function Ne(t){const e=mt(t);if(!be(e))return ge(1);const n=e.getBoundingClientRect(),{width:o,height:r,$:a}=Xt(e);let i=(a?qe(n.width):n.width)/o,c=(a?qe(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const eo=ge(0);function Yt(t){const e=ae(t);return!ht()||!e.visualViewport?eo:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function to(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==ae(t)?!1:e}function Oe(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),a=mt(t);let i=ge(1);e&&(o?de(o)&&(i=Ne(o)):i=Ne(t));const c=to(a,n,o)?Yt(a):ge(0);let h=(r.left+c.x)/i.x,l=(r.top+c.y)/i.y,d=r.width/i.x,u=r.height/i.y;if(a){const p=ae(a),m=o&&de(o)?ae(o):o;let w=p,b=pt(w);for(;b&&o&&m!==w;){const v=Ne(b),g=b.getBoundingClientRect(),E=he(b),L=g.left+(b.clientLeft+parseFloat(E.paddingLeft))*v.x,R=g.top+(b.clientTop+parseFloat(E.paddingTop))*v.y;h*=v.x,l*=v.y,d*=v.x,u*=v.y,h+=L,l+=R,w=ae(b),b=pt(w)}}return Qe({width:d,height:u,x:h,y:l})}function ot(t,e){const n=nt(t).scrollLeft;return e?e.left+n:Oe(we(t)).left+n}function Ut(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-ot(t,n),r=n.top+e.scrollTop;return{x:o,y:r}}function no(t){let{elements:e,rect:n,offsetParent:o,strategy:r}=t;const a=r==="fixed",i=we(o),c=e?tt(e.floating):!1;if(o===i||c&&a)return n;let h={scrollLeft:0,scrollTop:0},l=ge(1);const d=ge(0),u=be(o);if((u||!u&&!a)&&((Ve(o)!=="body"||$e(i))&&(h=nt(o)),be(o))){const m=Oe(o);l=Ne(o),d.x=m.x+o.clientLeft,d.y=m.y+o.clientTop}const p=i&&!u&&!a?Ut(i,h):ge(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-h.scrollLeft*l.x+d.x+p.x,y:n.y*l.y-h.scrollTop*l.y+d.y+p.y}}function oo(t){return Array.from(t.getClientRects())}function ro(t){const e=we(t),n=nt(t),o=t.ownerDocument.body,r=se(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),a=se(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let i=-n.scrollLeft+ot(t);const c=-n.scrollTop;return he(o).direction==="rtl"&&(i+=se(e.clientWidth,o.clientWidth)-r),{width:r,height:a,x:i,y:c}}const _t=25;function io(t,e){const n=ae(t),o=we(t),r=n.visualViewport;let a=o.clientWidth,i=o.clientHeight,c=0,h=0;if(r){a=r.width,i=r.height;const d=ht();(!d||d&&e==="fixed")&&(c=r.offsetLeft,h=r.offsetTop)}const l=ot(o);if(l<=0){const d=o.ownerDocument,u=d.body,p=getComputedStyle(u),m=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,w=Math.abs(o.clientWidth-u.clientWidth-m);w<=_t&&(a-=w)}else l<=_t&&(a+=l);return{width:a,height:i,x:c,y:h}}const lo=new Set(["absolute","fixed"]);function so(t,e){const n=Oe(t,!0,e==="fixed"),o=n.top+t.clientTop,r=n.left+t.clientLeft,a=be(t)?Ne(t):ge(1),i=t.clientWidth*a.x,c=t.clientHeight*a.y,h=r*a.x,l=o*a.y;return{width:i,height:c,x:h,y:l}}function jt(t,e,n){let o;if(e==="viewport")o=io(t,n);else if(e==="document")o=ro(we(t));else if(de(e))o=so(e,n);else{const r=Yt(t);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return Qe(o)}function qt(t,e){const n=Te(t);return n===e||!de(n)||Fe(n)?!1:he(n).position==="fixed"||qt(n,e)}function ao(t,e){const n=e.get(t);if(n)return n;let o=Ke(t,[],!1).filter(c=>de(c)&&Ve(c)!=="body"),r=null;const a=he(t).position==="fixed";let i=a?Te(t):t;for(;de(i)&&!Fe(i);){const c=he(i),h=dt(i);!h&&c.position==="fixed"&&(r=null),(a?!h&&!r:!h&&c.position==="static"&&!!r&&lo.has(r.position)||$e(i)&&!h&&qt(t,i))?o=o.filter(d=>d!==i):r=c,i=Te(i)}return e.set(t,o),o}function co(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t;const i=[...n==="clippingAncestors"?tt(e)?[]:ao(e,this._c):[].concat(n),o],c=i[0],h=i.reduce((l,d)=>{const u=jt(e,d,r);return l.top=se(u.top,l.top),l.right=xe(u.right,l.right),l.bottom=xe(u.bottom,l.bottom),l.left=se(u.left,l.left),l},jt(e,c,r));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function uo(t){const{width:e,height:n}=Xt(t);return{width:e,height:n}}function fo(t,e,n){const o=be(e),r=we(e),a=n==="fixed",i=Oe(t,!0,a,e);let c={scrollLeft:0,scrollTop:0};const h=ge(0);function l(){h.x=ot(r)}if(o||!o&&!a)if((Ve(e)!=="body"||$e(r))&&(c=nt(e)),o){const m=Oe(e,!0,a,e);h.x=m.x+e.clientLeft,h.y=m.y+e.clientTop}else r&&l();a&&!o&&r&&l();const d=r&&!o&&!a?Ut(r,c):ge(0),u=i.left+c.scrollLeft-h.x-d.x,p=i.top+c.scrollTop-h.y-d.y;return{x:u,y:p,width:i.width,height:i.height}}function gt(t){return he(t).position==="static"}function Gt(t,e){if(!be(t)||he(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return we(t)===n&&(n=n.ownerDocument.body),n}function Zt(t,e){const n=ae(t);if(tt(t))return n;if(!be(t)){let r=Te(t);for(;r&&!Fe(r);){if(de(r)&&!gt(r))return r;r=Te(r)}return n}let o=Gt(t,e);for(;o&&_n(o)&&gt(o);)o=Gt(o,e);return o&&Fe(o)&&gt(o)&&!dt(o)?n:o||Jn(t)||n}const ho=async function(t){const e=this.getOffsetParent||Zt,n=this.getDimensions,o=await n(t.floating);return{reference:fo(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function po(t){return he(t).direction==="rtl"}const mo={convertOffsetParentRelativeRectToViewportRelativeRect:no,getDocumentElement:we,getClippingRect:co,getOffsetParent:Zt,getElementRects:ho,getClientRects:oo,getDimensions:uo,getScale:Ne,isElement:de,isRTL:po};function Jt(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function go(t,e){let n=null,o;const r=we(t);function a(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function i(c,h){c===void 0&&(c=!1),h===void 0&&(h=1),a();const l=t.getBoundingClientRect(),{left:d,top:u,width:p,height:m}=l;if(c||e(),!p||!m)return;const w=Ge(u),b=Ge(r.clientWidth-(d+p)),v=Ge(r.clientHeight-(u+m)),g=Ge(d),L={rootMargin:-w+"px "+-b+"px "+-v+"px "+-g+"px",threshold:se(0,xe(1,h))||1};let R=!0;function D(C){const P=C[0].intersectionRatio;if(P!==h){if(!R)return i();P?i(!1,P):o=setTimeout(()=>{i(!1,1e-7)},1e3)}P===1&&!Jt(l,t.getBoundingClientRect())&&i(),R=!1}try{n=new IntersectionObserver(D,{...L,root:r.ownerDocument})}catch{n=new IntersectionObserver(D,L)}n.observe(t)}return i(!0),a}function vo(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:h=!1}=o,l=mt(t),d=r||a?[...l?Ke(l):[],...Ke(e)]:[];d.forEach(g=>{r&&g.addEventListener("scroll",n,{passive:!0}),a&&g.addEventListener("resize",n)});const u=l&&c?go(l,n):null;let p=-1,m=null;i&&(m=new ResizeObserver(g=>{let[E]=g;E&&E.target===l&&m&&(m.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var L;(L=m)==null||L.observe(e)})),n()}),l&&!h&&m.observe(l),m.observe(e));let w,b=h?Oe(t):null;h&&v();function v(){const g=Oe(t);b&&!Jt(b,g)&&n(),b=g,w=requestAnimationFrame(v)}return n(),()=>{var g;d.forEach(E=>{r&&E.removeEventListener("scroll",n),a&&E.removeEventListener("resize",n)}),u==null||u(),(g=m)==null||g.disconnect(),m=null,h&&cancelAnimationFrame(w)}}const wo=Kn,bo=kn,yo=zn,Eo=Hn,xo=Xn,Co=Wn,To=Nn,So=(t,e,n)=>{const o=new Map,r={platform:mo,...n},a={...r.platform,_c:o};return Fn(t,e,{...r,platform:a})};function Qt(t){return{name:"arrow",options:t,fn(e){const n=s.toValue(t.element);return n==null?{}:To({element:n,padding:t.padding}).fn(e)}}}function en(t,e,n={}){const{transform:o=!0,middlewares:r,autoUpdate:a=!0,open:i=s.ref(!1),onOpenChange:c}=n,h=(C,P,K)=>{if(i.value===C)return;i.value=C;const N=P??"programmatic";c==null||c(C,N,K)},l=s.computed(()=>s.toValue(n.placement)??"bottom"),d=s.computed(()=>s.toValue(n.strategy)??"absolute"),u=s.ref(0),p=s.ref(0),m=s.ref(l.value),w=s.ref(d.value),b=s.shallowRef({}),v=s.ref(!1),g=s.ref(null),E=s.computed(()=>{const C=s.toValue(r)||[];return g.value&&!C.some(K=>K.name==="arrow")?[...C,Qt({element:g})]:C}),L=async()=>{if(!(!t.value||!e.value))try{const C=await So(t.value,e.value,{placement:l.value,strategy:d.value,middleware:E.value});u.value=C.x,p.value=C.y,m.value=C.placement,w.value=C.strategy,b.value=C.middlewareData,v.value=i.value}catch{}};s.watch([l,d,E],()=>{i.value&&L()});let R;s.watch([t,e,i],([C,P,K])=>{!K||!C||!P||(a&&(R=vo(C,P,L,typeof a=="object"?a:void 0)),s.onWatcherCleanup(()=>{R==null||R(),R=void 0}))},{immediate:!0}),s.onScopeDispose(()=>R==null?void 0:R()),s.watch(i,C=>{C||(v.value=!1)});const D=s.ref({position:d.value,left:"0",top:"0"});return s.watch([u,p,()=>s.toValue(o)],([C,P,K])=>{const N=e.value;if(!N)return;const V={position:w.value,left:"0",top:"0"},H=tn(N,C),Y=tn(N,P);K?D.value={...V,transform:`translate(${H}px, ${Y}px)`,...nn(N)>=1.5&&{"will-change":"transform"}}:D.value={...V,left:`${H}px`,top:`${Y}px`}},{immediate:!0}),{id:n.id,x:u,y:p,strategy:w,placement:m,middlewareData:b,isPositioned:v,floatingStyles:D,update:L,refs:{anchorEl:t,floatingEl:e,arrowEl:g},open:i,setOpen:h}}function tn(t,e){const n=nn(t);return Math.round(e*n)/n}function nn(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Ao(t={}){let e;return e=on(t),{...e,get root(){return e.root},addNode:(i,c,h={})=>{const{parentId:l,...d}=h,u=Et(),p=d.onOpenChange,m=en(i,c,{...d,id:u,onOpenChange:(b,v,g)=>{if(p==null||p(b,v,g),!b){const E=e.findNodeById(u);if(E){const L=E.children.value;for(const R of L)R.data.open.value&&R.data.setOpen(!1,"tree-ancestor-close",g)}}}});return e.addNode(m,l,{id:u})},getAllOpenNodes:()=>{const i=[];for(const c of e.nodeMap.values())c.data.open.value&&i.push(c);return i},getDeepestOpenNode:()=>{let i=null,c=-1;for(const h of e.nodeMap.values())if(h.data.open.value){const l=h.getPath().length;l>c&&(c=l,i=h)}return i},applyToNodes:(i,c,h={})=>{const{relationship:l="self-and-children",applyToMatching:d=!0}=h,u=e.findNodeById(i);if(!u)return;const p=[],m=new Set,w=v=>{v&&!m.has(v.id)&&(p.push(v),m.add(v.id))},b=v=>{for(const g of v)w(g)};if(l==="ancestors-only")for(const v of u.getPath())v.id!==u.id&&w(v);else if(l==="siblings-only"){if(u.parent.value)for(const v of u.parent.value.children.value)v.id!==u.id&&w(v)}else if(l==="descendants-only")for(const v of e.traverse("dfs",u))v.id!==u.id&&w(v);else if(l==="children-only")b(u.children.value);else if(l==="self-and-ancestors")b(u.getPath());else if(l==="self-and-children")w(u),b(u.children.value);else if(l==="self-and-descendants")b(e.traverse("dfs",u));else if(l==="self-and-siblings")w(u),u.parent.value&&b(u.parent.value.children.value);else if(l==="self-ancestors-and-children")b(u.getPath()),b(u.children.value);else if(l==="full-branch")b(u.getPath()),b(e.traverse("dfs",u));else if(l==="all-except-branch"){const v=new Set;for(const g of u.getPath())v.add(g.id);for(const g of e.traverse("dfs",u))v.add(g.id);for(const g of e.nodeMap.values())!v.has(g.id)===d&&c(g);return}else{console.warn(`applyToNodes: Unknown relationship "${l}".`);return}if(d)for(const v of p)c(v);else for(const v of e.nodeMap.values())m.has(v.id)||c(v)}}}function vt(t,e=null,n={},o=!1){const r=n.id??Et(),a=s.shallowRef(e),i=s.shallowRef([]),c=s.computed(()=>i.value.length===0),h={id:r,data:t,parent:a,children:i,isRoot:o,isLeaf:c,addChild:l=>{i.value=[...i.value,l]},_removeChildInstance:l=>i.value.includes(l)?(i.value=i.value.filter(d=>d.id!==l.id),l.parent.value=null,!0):!1,findChild:l=>i.value.find(l)??null,findDescendant:l=>{const d=[h];for(;d.length>0;){const u=d.pop();if(l(u))return u;for(let p=u.children.value.length-1;p>=0;p--)d.push(u.children.value[p])}return null},isDescendantOf:l=>{let d=a.value;for(;d;){if(d.id===l.id)return!0;d=d.parent.value}return!1},getPath:()=>{const l=[];let d=h;for(;d;)l.push(d),d=d.parent.value;return l.reverse()}};return Object.freeze(h)}function on(t){const e=(t==null?void 0:t.deleteStrategy)??"recursive",n=s.shallowReactive(new Map);let o=null;const r=u=>n.get(u)??null,a=(u,p=null,m={})=>{if(!o){if(p!=null)return console.error(`Tree addNode: Cannot add a non-root node before a root exists. Received parentId=${p}.`),null;const v=vt(u,null,m,!0);return n.set(v.id,v),o=v,v}const w=p?r(p):o;if(!w)return console.error(`Tree addNode: Parent node with ID ${p} not found.`),null;m.id&&n.has(m.id)&&(m.id=void 0);const b=vt(u,w,m);return n.set(b.id,b),w.addChild(b),b},i=(u,p)=>{const m=p??e,w=r(u);if(!w)return!1;if(w.isRoot)return console.error("Tree removeNode: Cannot remove the root node."),!1;const b=w.parent.value;if(m==="recursive")d(w);else{for(const v of w.children.value)v.parent.value=null;w.children.value=[],n.delete(w.id)}return b._removeChildInstance(w)},c=(u,p)=>{const m=r(u);if(!m)return console.error(`Tree moveNode: Node with ID ${u} not found.`),!1;if(m.isRoot)return console.error("Tree moveNode: Cannot move the root node."),!1;if(u===p)return console.error("Tree moveNode: Cannot move a node to be a child of itself."),!1;const w=p?r(p):o;if(!w)return console.error(`Tree moveNode: New parent node with ID ${p} not found.`),!1;if(w.isDescendantOf(m))return console.error("Tree moveNode: Cannot move a node to become its own descendant."),!1;const b=m.parent.value;if(b){if(!b._removeChildInstance(m))return console.error("Tree moveNode: Failed to remove node from its original parent."),!1}else if(m.isRoot){if(m.isRoot)return console.error("Tree moveNode: Attempting to move the root node, which is not allowed."),!1}return w.addChild(m),m.parent.value=w,!0},h=(u="dfs",p=o)=>{const m=[];if(!p)return console.warn("Tree traverse: Start node is null, returning empty array."),m;if(u==="dfs"){const w=[p];for(;w.length>0;){const b=w.pop();m.push(b);for(let v=b.children.value.length-1;v>=0;v--)w.push(b.children.value[v])}}else{const w=[p];for(;w.length>0;){const b=w.shift();m.push(b);for(const v of b.children.value)w.push(v)}}return m},l=()=>{n.clear()},d=u=>{const p=[...u.children.value];for(const m of p)d(m);n.delete(u.id),u.children.value=[]};return Object.freeze({get root(){return o},get nodeMap(){return n},findNodeById:r,addNode:a,removeNode:i,moveNode:c,traverse:h,dispose:l})}function Oo(t){return s.getCurrentScope()?(s.onScopeDispose(t),!0):!1}const Lo=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Do=Object.prototype.toString,Po=t=>Do.call(t)==="[object Object]";function wt(t){return Array.isArray(t)?t:[t]}function Ro(t,e,n){return s.watch(t,e,{...n,immediate:!0})}const Mo=Lo?window:void 0;function Vo(t){var e;const n=s.toValue(t);return(e=n==null?void 0:n.$el)!=null?e:n}function te(...t){const e=[],n=()=>{e.forEach(c=>c()),e.length=0},o=(c,h,l,d)=>(c.addEventListener(h,l,d),()=>c.removeEventListener(h,l,d)),r=s.computed(()=>{const c=wt(s.toValue(t[0])).filter(h=>h!=null);return c.every(h=>typeof h!="string")?c:void 0}),a=Ro(()=>{var c,h;return[(h=(c=r.value)==null?void 0:c.map(l=>Vo(l)))!=null?h:[Mo].filter(l=>l!=null),wt(s.toValue(r.value?t[1]:t[0])),wt(s.unref(r.value?t[2]:t[1])),s.toValue(r.value?t[3]:t[2])]},([c,h,l,d])=>{if(n(),!(c!=null&&c.length)||!(h!=null&&h.length)||!(l!=null&&l.length))return;const u=Po(d)?{...d}:d;e.push(...c.flatMap(p=>h.flatMap(m=>l.map(w=>o(p,m,w,u)))))},{flush:"post"}),i=()=>{a(),n()};return Oo(n),i}function Fo(t,e={}){const{floatingContext:n,treeContext:o}=Be(t),{open:r,setOpen:a,refs:i}=n,{enabled:c=!0,event:h="click",toggle:l=!0,ignoreMouse:d=!1,ignoreKeyboard:u=!1,ignoreTouch:p=!1,outsideClick:m=!1,outsideEvent:w="pointerdown",outsideCapture:b=!0,onOutsideClick:v,preventScrollbarClick:g=!0,handleDragEvents:E=!0}=e;let L,R=!1,D=!1,C=!1;const P=s.computed(()=>s.toValue(c)),K=s.computed(()=>s.toValue(m)),N=s.computed(()=>{const A=i.anchorEl.value;return A instanceof HTMLElement?A:null}),V=s.computed(()=>i.floatingEl.value);function H(A,j){C=!0;try{r.value?s.toValue(l)&&a(!1,A,j):a(!0,A,j)}finally{Promise.resolve().then(()=>{C=!1})}}function Y(){L=void 0,R=!1,D=!1}function z(A){L=A.pointerType}function B(A){A.button===0&&s.toValue(h)!=="click"&&(J(L)||H("anchor-click",A))}function T(A){if(s.toValue(u)&&A.detail===0){Y();return}if(s.toValue(h)==="mousedown"&&L){Y();return}if(J(L)){Y();return}H("anchor-click",A),Y()}function f(A){if(L=void 0,A.defaultPrevented||s.toValue(u)||Ct(A))return;const j=N.value;j&&(A.key===" "&&!Tt(j)&&(A.preventDefault(),R=!0),A.key==="Enter"&&H("keyboard-activate",A))}function W(A){const j=N.value;j&&(A.defaultPrevented||s.toValue(u)||Ct(A)||Tt(j)||A.key===" "&&R&&(R=!1,H("keyboard-activate",A)))}function y(A){if(!P.value||!K.value||!r.value)return;if(s.toValue(w)==="click"&&s.toValue(E)&&D){D=!1;return}if(C)return;const j=A.target;if(j&&!(s.toValue(g)&&We(j)&&V.value&&En(A,j))){if(o){if(!No(o,j))return}else if(St(A,N.value)||St(A,V.value))return;v?v(A,n):a(!1,"outside-pointer",A)}}function U(){D=!0}function ne(){setTimeout(()=>{D=!1},0)}function J(A){return!!(xt(A,!0)&&s.toValue(d)||A==="touch"&&s.toValue(p))}s.watchPostEffect(()=>{const A=N.value;!P.value||!A||(A.addEventListener("pointerdown",z),A.addEventListener("mousedown",B),A.addEventListener("click",T),A.addEventListener("keydown",f),A.addEventListener("keyup",W),s.onWatcherCleanup(()=>{A.removeEventListener("pointerdown",z),A.removeEventListener("mousedown",B),A.removeEventListener("click",T),A.removeEventListener("keydown",f),A.removeEventListener("keyup",W),Y()}))}),te(()=>P.value&&K.value?document:null,()=>s.toValue(w),y,{capture:s.toValue(b)}),te(()=>P.value&&K.value&&s.toValue(E)?V.value:null,"mousedown",U,{capture:!0}),te(()=>P.value&&K.value&&s.toValue(E)?V.value:null,"mouseup",ne,{capture:!0})}function No(t,e){return!(le(e,t.data.refs.anchorEl.value)||le(e,t.data.refs.floatingEl.value)||Ue(t,e))}function Io(t,e={}){const{floatingContext:n,treeContext:o}=Be(t),{enabled:r=!0,capture:a=!1,onEscape:i}=e,{isComposing:c}=Ho();te(document,"keydown",l=>{if(!(l.key!=="Escape"||!s.toValue(r)||c())){if(i){i(l);return}if(o){const d=ko(o);d&&d.data.setOpen(!1,"escape-key",l)}else n.setOpen(!1,"escape-key",l)}},a)}function ko(t){var a;let e=t;for(;(a=e.parent)!=null&&a.value&&!e.isRoot;)e=e.parent.value;let n=null,o=-1;const r=i=>{var h;if(i.data.open.value){const l=i.getPath().length;l>o&&(o=l,n=i)}const c=((h=i.children)==null?void 0:h.value)??[];for(const l of c)r(l)};return r(e),n}function Ho(){const t=s.ref(!1);return te(document,"compositionstart",()=>{t.value=!0}),te(document,"compositionend",()=>{t.value=!1}),{isComposing:()=>t.value}}const rt=s.ref(!1);typeof window<"u"&&(te(window,"keydown",()=>{rt.value=!0},{capture:!0}),te(window,"pointerdown",()=>{rt.value=!1},{capture:!0}),te(window,"pointermove",()=>{rt.value=!1},{capture:!0}));const rn=s.readonly(rt),Wo=0;function Bo(t,e={}){const{open:n,setOpen:o,refs:{floatingEl:r,anchorEl:a}}=t,{enabled:i=!0,requireFocusVisible:c=!0,tree:h}=e,l=s.computed(()=>a.value?a.value instanceof HTMLElement?a.value:a.value.contextElement:null);let d=!1;const u=wn()&&bn();let p,m=new $o(r);if(h){let g=null;if(t.id&&(g=h.findNodeById(t.id)),!g){for(const E of h.nodeMap.values())if(E.data===t){g=E;break}}g&&(m=new Ko(g))}te(window,"blur",()=>{!n.value&&l.value&&l.value===document.activeElement&&(d=!0)}),te(window,"focus",()=>{d=!1});function w(g){if(d){d=!1;return}const E=g.target instanceof Element?g.target:null;if(s.toValue(c)&&E){if(u&&!g.relatedTarget){if(!rn.value&&!lt(E))return}else if(!yn(E))return}try{o(!0,"focus",g)}catch(L){console.error("[useFocus] Error in onFocus handler:",L)}}function b(g){clearTimeout(p),p=window.setTimeout(()=>{var R;const L=(((R=l.value)==null?void 0:R.ownerDocument)??document).activeElement;if(!(!g.relatedTarget&&L===l.value)&&!m.shouldRemainOpen(L))try{if(L instanceof Element){const D=m.getAncestorsToClose(L);for(const C of D)try{C.data.setOpen(!1,"tree-ancestor-close",g)}catch(P){console.error("[useFocus] Error closing ancestor on blur:",P)}}o(!1,"blur",g)}catch(D){console.error("[useFocus] Error in onBlur handler:",D)}},Wo)}te(document,"focusin",g=>{if(!s.toValue(i))return;const E=g.target;if(!(E instanceof Element))return;const L=l.value;if(!(L&&le(E,L))&&!m.shouldRemainOpen(E))try{const R=m.getAncestorsToClose(E);for(const D of R)try{D.data.setOpen(!1,"tree-ancestor-close",g)}catch(C){console.error("[useFocus] Error closing ancestor on focusin:",C)}o(!1,"blur",g)}catch(R){console.error("[useFocus] Error in document focusin handler:",R)}},{capture:!0});const v=s.watchPostEffect(()=>{if(!s.toValue(i))return;const g=l.value;!g||!(g instanceof HTMLElement)||(g.addEventListener("focus",w),g.addEventListener("blur",b),s.onWatcherCleanup(()=>{g.removeEventListener("focus",w),g.removeEventListener("blur",b)}))});return s.onScopeDispose(()=>{clearTimeout(p)}),{cleanup:()=>{clearTimeout(p),v()}}}class $o{constructor(e){this.floatingEl=e}shouldRemainOpen(e){return!e||!this.floatingEl.value?!1:this.floatingEl.value.contains(e)}getAncestorsToClose(e){return[]}}class Ko{constructor(e){this.treeContext=e}shouldRemainOpen(e){return e?this.isFocusWithinNodeHierarchy(this.treeContext,e):!1}getAncestorsToClose(e){const n=[];let o=this.treeContext.parent.value;for(;o;){if(!this.isFocusWithinNodeHierarchy(o,e)){n.push(o),o=o.parent.value;continue}break}return n}isFocusWithinNodeHierarchy(e,n){return le(n,e.data.refs.anchorEl.value)||le(n,e.data.refs.floatingEl.value)?!0:this.findDescendantContainingFocus(e,n)!==null}findDescendantContainingFocus(e,n){for(const o of e.children.value)if(o.data.open.value){if(le(n,o.data.refs.anchorEl.value)||le(n,o.data.refs.floatingEl.value))return o;const r=this.findDescendantContainingFocus(o,n);if(r)return r}return null}}function ln(t){return t.children.value.some(e=>e.data.open.value||ln(e))}function zo(t,e){return t[0]>=e.x&&t[0]<=e.x+e.width&&t[1]>=e.y&&t[1]<=e.y+e.height}function sn(t,e){const[n,o]=t;let r=!1;const a=e.length;for(let i=0,c=a-1;i<a;c=i++){const[h,l]=e[i]||[0,0],[d,u]=e[c]||[0,0];l>=o!=u>=o&&n<=(d-h)*(o-l)/(u-l)+h&&(r=!r)}return r}function Xo(t={}){const{blockPointerEvents:e=!1,requireIntent:n=!0}=t;let o=-1,r=!1;function a(c,h,l,d,u){const p=At(),m=p-u;if(l===null||d===null||m===0)return{speed:null,lastX:c,lastY:h,lastCursorTime:p};const w=c-l,b=h-d;return{speed:Math.sqrt(w*w+b*b)/m,lastX:c,lastY:h,lastCursorTime:p}}const i=function(h){const{x:l,y:d,placement:u,elements:p,buffer:m,onClose:w,nodeId:b,tree:v}=h,g=s.computed(()=>{const D=p.domReference;return We(D)?D:(D==null?void 0:D.contextElement)??null});let E=null,L=null,R=At();return function(C){var ye,Ie,Se,Ae,ke,O,M;function P(){Ot(o),o=-1,w()}if(Ot(o),o=-1,!p.domReference||!p.floating||u==null||l==null||d==null)return;const{clientX:K,clientY:N}=C,V=[K,N],H=xn(C),Y=C.type==="mouseleave",z=p.floating&&st(p.floating,H),B=g.value&&st(g.value,H),T=(ye=g.value)==null?void 0:ye.getBoundingClientRect(),f=(Ie=p.floating)==null?void 0:Ie.getBoundingClientRect(),W=u.split("-")[0],y=l>((f==null?void 0:f.right)??0)-((f==null?void 0:f.width)??0)/2,U=d>((f==null?void 0:f.bottom)??0)-((f==null?void 0:f.height)??0)/2,ne=T?zo(V,T):!1,J=((f==null?void 0:f.width)??0)>((T==null?void 0:T.width)??0),A=((f==null?void 0:f.height)??0)>((T==null?void 0:T.height)??0),j=((Se=J?T:f)==null?void 0:Se.left)??0,pe=((Ae=J?T:f)==null?void 0:Ae.right)??0,oe=((ke=A?T:f)==null?void 0:ke.top)??0,me=((O=A?T:f)==null?void 0:O.bottom)??0;if(z&&(r=!0,!Y))return;if(B&&(r=!1),B&&!Y){r=!0;return}if(Y&&We(C.relatedTarget)&&p.floating&&st(p.floating,C.relatedTarget))return;if(v&&b){const F=v.nodes.get(b);if(F&&ln(F))return}if(W==="top"&&d>=((T==null?void 0:T.bottom)??0)-1||W==="bottom"&&d<=((T==null?void 0:T.top)??0)+1||W==="left"&&l>=((T==null?void 0:T.right)??0)-1||W==="right"&&l<=((T==null?void 0:T.left)??0)+1)return P();let ie=[];switch(W){case"top":ie=[[j,((T==null?void 0:T.top)??0)+1],[j,((f==null?void 0:f.bottom)??0)-1],[pe,((f==null?void 0:f.bottom)??0)-1],[pe,((T==null?void 0:T.top)??0)+1]];break;case"bottom":ie=[[j,((f==null?void 0:f.top)??0)+1],[j,((T==null?void 0:T.bottom)??0)-1],[pe,((T==null?void 0:T.bottom)??0)-1],[pe,((f==null?void 0:f.top)??0)+1]];break;case"left":ie=[[((f==null?void 0:f.right)??0)-1,me],[((f==null?void 0:f.right)??0)-1,oe],[((T==null?void 0:T.left)??0)+1,oe],[((T==null?void 0:T.left)??0)+1,me]];break;case"right":ie=[[((T==null?void 0:T.right)??0)-1,me],[((T==null?void 0:T.right)??0)-1,oe],[((f==null?void 0:f.left)??0)+1,oe],[((f==null?void 0:f.left)??0)+1,me]];break}function re([F,$]){const S=m;switch(W){case"top":{const q=[J?F+S/2:y?F+S*4:F-S*4,$+S+1],ee=[J?F-S/2:y?F+S*4:F-S*4,$+S+1],Q=[[(f==null?void 0:f.left)??0,y||J?((f==null?void 0:f.bottom)??0)-S:(f==null?void 0:f.top)??0],[(f==null?void 0:f.right)??0,y?J?((f==null?void 0:f.bottom)??0)-S:(f==null?void 0:f.top)??0:((f==null?void 0:f.bottom)??0)-S]];return[q,ee,...Q]}case"bottom":{const q=[J?F+S/2:y?F+S*4:F-S*4,$-S],ee=[J?F-S/2:y?F+S*4:F-S*4,$-S],Q=[[(f==null?void 0:f.left)??0,y||J?((f==null?void 0:f.top)??0)+S:(f==null?void 0:f.bottom)??0],[(f==null?void 0:f.right)??0,y?J?((f==null?void 0:f.top)??0)+S:(f==null?void 0:f.bottom)??0:((f==null?void 0:f.top)??0)+S]];return[q,ee,...Q]}case"left":{const q=[F+S+1,A?$+S/2:U?$+S*4:$-S*4],ee=[F+S+1,A?$-S/2:U?$+S*4:$-S*4];return[...[[U||A?((f==null?void 0:f.right)??0)-S:(f==null?void 0:f.left)??0,(f==null?void 0:f.top)??0],[U?A?((f==null?void 0:f.right)??0)-S:(f==null?void 0:f.left)??0:((f==null?void 0:f.right)??0)-S,(f==null?void 0:f.bottom)??0]],q,ee]}case"right":{const q=[F-S,A?$+S/2:U?$+S*4:$-S*4],ee=[F-S,A?$-S/2:U?$+S*4:$-S*4],Q=[[U||A?((f==null?void 0:f.left)??0)+S:(f==null?void 0:f.right)??0,(f==null?void 0:f.top)??0],[U?A?((f==null?void 0:f.left)??0)+S:(f==null?void 0:f.right)??0:((f==null?void 0:f.left)??0)+S,(f==null?void 0:f.bottom)??0]];return[q,ee,...Q]}}}const ue=re([l,d]);if((M=t.onPolygonChange)==null||M.call(t,ue),!sn(V,ie)){if(sn(V,ue)){if(!r&&n){const F=a(C.clientX,C.clientY,E,L,R);E=F.lastX,L=F.lastY,R=F.lastCursorTime,F.speed!==null&&F.speed<.1&&(o=window.setTimeout(P,40))}return}if(r&&!ne)return P();P()}}};return i.__options={blockPointerEvents:e},i}const an=10;function Yo(t,e,n){const{delay:o}=n,r=s.computed(()=>{const l=s.toValue(o);return(typeof l=="number"?l:l.open)??0}),a=s.computed(()=>{const l=s.toValue(o);return(typeof l=="number"?l:l.close)??0});let i,c;const h=()=>{clearTimeout(i),clearTimeout(c)};return s.onScopeDispose(h),{show:(l,d)=>{h();const u=l??r.value;u===0?t(d):i=setTimeout(()=>t(d),u)},hide:(l,d)=>{h();const u=l??a.value;u===0?e(d):c=setTimeout(()=>e(d),u)},showDelay:r,hideDelay:a,clearTimeouts:h}}function Uo(t,e={}){const{floatingContext:n,treeContext:o}=Be(t),{open:r,setOpen:a,refs:{anchorEl:i,floatingEl:c}}=n,{enabled:h=!0,delay:l=0,restMs:d=0,mouseOnly:u=!1,safePolygon:p=!1}=e,m=s.computed(()=>s.toValue(h)),w=s.computed(()=>s.toValue(d)),b=s.computed(()=>{const y=i.value;return!y||y instanceof HTMLElement?y:y.contextElement??null}),{hide:v,show:g,showDelay:E,clearTimeouts:L}=Yo(y=>{r.value||a(!0,"hover",y)},y=>{r.value&&a(!1,"hover",y)},{delay:l});let R=null,D;const C=s.computed(()=>E.value===0&&w.value>0);function P(y){if(!m.value||!V(y)||!C.value||!R)return;const U={x:y.clientX,y:y.clientY},ne=Math.abs(U.x-R.x),J=Math.abs(U.y-R.y);(ne>an||J>an)&&(R=U,clearTimeout(D),D=setTimeout(()=>{g(0,y)},w.value))}function K(y){!m.value||!V(y)||!C.value||(R={x:y.clientX,y:y.clientY},D=setTimeout(()=>{g(0,y)},w.value))}function N(){clearTimeout(D),R=null}s.watchPostEffect(()=>{const y=b.value;!y||!m.value||!C.value||(y.addEventListener("pointerenter",K),y.addEventListener("pointermove",P),y.addEventListener("pointerleave",N),s.onWatcherCleanup(()=>{y.removeEventListener("pointerenter",K),y.removeEventListener("pointermove",P),y.removeEventListener("pointerleave",N)}))}),s.onScopeDispose(()=>{clearTimeout(D)});function V(y){return s.toValue(u)?y.pointerType==="mouse":!0}function H(y){!m.value||!V(y)||C.value||(B(),g(void 0,y))}function Y(y){!m.value||!V(y)||(L(),B())}let z=null;function B(){z&&(document.removeEventListener("pointermove",z),z=null);const y=f.value;y!=null&&y.onPolygonChange&&y.onPolygonChange([])}const T=s.computed(()=>!!s.toValue(p)),f=s.computed(()=>{const y=s.toValue(p);if(typeof y=="object"&&y)return y;if(y===!0)return{}});function W(y){var A;if(!m.value||!V(y))return;const{clientX:U,clientY:ne}=y,J=y.relatedTarget;if(T.value)setTimeout(()=>{var ie;B();const j=b.value,pe=c.value;if(!j||!pe){v(void 0,y);return}let oe,me;if(o){oe=new Map;const re=ue=>{oe==null||oe.set(ue.id,ue);for(const ye of ue.children.value)re(ye)};re(o),me=o.id}z=Xo(f.value)({x:U,y:ne,placement:n.placement.value,elements:{domReference:j,floating:pe},buffer:((ie=f.value)==null?void 0:ie.buffer)??1,onClose:()=>{B(),v(void 0)},nodeId:me,tree:oe?{nodes:oe}:void 0}),z&&document.addEventListener("pointermove",z)},0);else{if(o){if(!_o(o,J))return}else if((A=c.value)!=null&&A.contains(J))return;v(void 0,y)}}s.watchPostEffect(()=>{const y=b.value;!y||!m.value||(y.addEventListener("pointerenter",H),y.addEventListener("pointerleave",W),s.onWatcherCleanup(()=>{y.removeEventListener("pointerenter",H),y.removeEventListener("pointerleave",W)}))}),s.watchPostEffect(()=>{const y=c.value;!y||!m.value||(y.addEventListener("pointerenter",Y),y.addEventListener("pointerleave",W),s.onWatcherCleanup(()=>{y.removeEventListener("pointerenter",Y),y.removeEventListener("pointerleave",W)}))}),s.onScopeDispose(()=>{B()})}function _o(t,e){return e?!(le(e,t.data.refs.anchorEl.value)||le(e,t.data.refs.floatingEl.value)||Ue(t,e)):!0}function jo(t,e,n,o){const r=s.computed(()=>!!s.toValue(o.virtual));s.watch([r,o.open,s.computed(()=>s.toValue(n))],([a,i,c])=>{const h=t.value;if(!h)return;if(!a||!i||c==null){h.removeAttribute("aria-activedescendant");return}const l=e.value[c];l&&(l.id||(l.id=`vfloat-option-${Math.random().toString(16).slice(2,10)}`),h.setAttribute("aria-activedescendant",l.id),o.virtualItemRef&&(o.virtualItemRef.value=l))})}function Le(t,e,n){const{items:o,loop:r,allowEscape:a,isVirtual:i,findNextEnabled:c,getFirstEnabledIndex:h,getLastEnabledIndex:l}=n,d=o.length,u=t==null?e===1?0:d-1:t+e;let p=c(u,e,r);if(p==null&&r){if(a&&i)return{type:"navigate",index:null};p=e===1?h():l()}return p!=null?{type:"navigate",index:p}:null}class qo{handleKey(e,n){const{isRtl:o,nested:r}=n;return e==="ArrowDown"?Le(n.current,1,n):e==="ArrowUp"?Le(n.current,-1,n):r&&e===(o?"ArrowRight":"ArrowLeft")?{type:"close"}:null}}class Go{handleKey(e,n){const{isRtl:o,nested:r}=n;return e==="ArrowRight"?Le(n.current,o?-1:1,n):e==="ArrowLeft"?Le(n.current,o?1:-1,n):r&&e==="ArrowUp"?{type:"close"}:null}}class cn{constructor(e=!1,n="row"){this.fallbackToLinear=e,this.loopDirection=n}handleKey(e,n){const{current:o,items:r,isDisabled:a,loop:i,allowEscape:c,isVirtual:h,getFirstEnabledIndex:l,getLastEnabledIndex:d,cols:u}=n;if(e==="ArrowRight"||e==="ArrowLeft"){const p=e==="ArrowRight"?1:-1;if(o===null)return Le(o,p,n);const m=o+p,w=Math.floor(o/u),b=Math.floor(m/u);if(m>=0&&m<r.length&&w===b&&!a(m))return{type:"navigate",index:m};if(i){if(c&&h){const g=o===0,E=o===r.length-1;if(p===-1&&g||p===1&&E)return{type:"navigate",index:null}}let v;if(this.loopDirection==="next"?p===1?(v=o+1,v>=r.length&&(v=0)):(v=o-1,v<0&&(v=r.length-1)):p===1?v=w*u:v=Math.min((w+1)*u-1,r.length-1),this.loopDirection==="next"){let g=v;for(let E=0;E<r.length;E++){if(!a(g))return{type:"navigate",index:g};if(g+=p,g>=r.length&&(g=0),g<0&&(g=r.length-1),g===v)break}}else{const g=p,E=w*u,L=Math.min((w+1)*u-1,r.length-1);for(;v>=E&&v<=L;){if(!a(v))return{type:"navigate",index:v};if(v+=g,v<E||v>L)break}}}return Le(o,p,n)}if(e==="ArrowDown"||e==="ArrowUp"){if(u<=1)return null;const p=e==="ArrowDown"?u:-u,m=p>0?u:-u;let b=(o??(p>0?-u:r.length))+p;for(;b>=0&&b<r.length&&a(b);)b+=m;if(b>=0&&b<r.length)return{type:"navigate",index:b};if(i){if(c&&h)return{type:"navigate",index:null};if(o===null){const E=p>0?l():d();return E!=null?{type:"navigate",index:E}:null}const v=o%u;let g;for(p>0?g=v:(g=(Math.ceil(r.length/u)-1)*u+v,g>=r.length&&(g-=u));g>=0&&g<r.length&&a(g);)g+=m;if(g>=0&&g<r.length)return{type:"navigate",index:g}}if(this.fallbackToLinear)return Le(o,e==="ArrowDown"?1:-1,n)}return null}}function Zo(t,e){const{floatingContext:n,treeContext:o}=Be(t),{refs:r,open:a,setOpen:i}=n,{listRef:c,activeIndex:h,onNavigate:l,enabled:d=!0,loop:u=!1,orientation:p="vertical",disabledIndices:m,focusItemOnHover:w=!0,openOnArrowKeyDown:b=!0,scrollItemIntoView:v=!0,selectedIndex:g=null,focusItemOnOpen:E="auto",nested:L=!1,rtl:R=!1,virtual:D=!1,virtualItemRef:C,cols:P=1,allowEscape:K=!1}=e,N={isEnabled:s.computed(()=>s.toValue(d)),anchorEl:s.computed(()=>{const O=r.anchorEl.value;return O instanceof HTMLElement?O:O&&"contextElement"in O&&O.contextElement instanceof HTMLElement?O.contextElement:null}),floatingEl:s.computed(()=>r.floatingEl.value),isVirtual:s.computed(()=>!!s.toValue(D)),isRtl:s.computed(()=>!!s.toValue(R)),gridCols:s.computed(()=>Math.max(1,Number(s.toValue(P)??1)))},{isEnabled:V,anchorEl:H,floatingEl:Y,isVirtual:z,isRtl:B,gridCols:T}=N,f=()=>h!==void 0?s.toValue(h):null,W=O=>m?Array.isArray(m)?m.includes(O):!!m(O):!1,y=()=>{const O=c.value;for(let M=0;M<O.length;M++)if(O[M]&&!W(M))return M;return null},U=[],ne=O=>(U.push(O),O),J=()=>{var O;for(;U.length;)(O=U.pop())==null||O()},A=()=>{const O=c.value;for(let M=O.length-1;M>=0;M--)if(O[M]&&!W(M))return M;return null};function j(O,M,F){switch(O){case"vertical":return M;case"horizontal":return F;default:return M||F}}function pe(O,M){return j(M,O==="ArrowUp"||O==="ArrowDown",O==="ArrowLeft"||O==="ArrowRight")}function oe(O,M,F){return j(M,O==="ArrowDown",F?O==="ArrowLeft":O==="ArrowRight")||O==="Enter"||O===" "||O===""}const me=(O,M,F)=>{const $=c.value,S=$.length;let q=O;for(let ee=0;ee<S;ee++){if(q<0||q>=S){if(!F)return null;q=(q+S)%S}if($[q]&&!W(q))return q;q+=M}return null},ie=(O,M=!1)=>{var $;if(O==null)return;const F=c.value[O];if(F&&!z.value){F.focus({preventScroll:!0});const S=v;!!S&&(M||rn.value)&&(($=F.scrollIntoView)==null||$.call(F,typeof S=="boolean"?{block:"nearest",inline:"nearest"}:S))}};let re=null;const ue=O=>{if(O.defaultPrevented)return;const M=O.target;if(M&&lt(M)&&M!==H.value)return;const F=O.key,$=s.toValue(p);if(re=F,a.value&&z.value){ye(O);return}if(!pe(F,$)||a.value||!s.toValue(b))return;O.preventDefault(),i(!0,"keyboard-activate",O);const q=(g!==void 0?s.toValue(g):null)??(oe(F,$,B.value)?y():A());q!=null&&(l==null||l(q))},ye=O=>{if(O.defaultPrevented)return;const M=O.key,F=s.toValue(p),$=c.value;if(!$.length)return;if(!z.value){if(M==="Home"){O.preventDefault();const Q=y();Q!=null&&(l==null||l(Q));return}if(M==="End"){O.preventDefault();const Q=A();Q!=null&&(l==null||l(Q));return}}let S;F==="vertical"?S=new qo:F==="horizontal"?S=T.value>1?new cn(!1,s.toValue(e.gridLoopDirection)??"row"):new Go:S=new cn(!0,s.toValue(e.gridLoopDirection)??"row");const q={current:f(),items:$,isRtl:B.value,loop:!!s.toValue(u),allowEscape:!!s.toValue(K),isVirtual:z.value,cols:T.value,nested:!!s.toValue(L),isDisabled:W,findNextEnabled:me,getFirstEnabledIndex:y,getLastEnabledIndex:A},ee=S.handleKey(M,q);if(ee){if(ee.type==="navigate")O.preventDefault(),l==null||l(ee.index);else if(ee.type==="close"){O.preventDefault(),i(!1,"programmatic",O);const Q=o==null?void 0:o.parent.value,ce=Q==null?void 0:Q.data.refs.anchorEl.value;ce instanceof HTMLElement?ce.focus({preventScroll:!0}):ce&&"contextElement"in ce&&ce.contextElement instanceof HTMLElement&&ce.contextElement.focus({preventScroll:!0})}}},Ie=s.watch([a,s.computed(()=>f())],([O,M])=>{V.value&&O&&M!=null&&ie(M)},{flush:"post"});ne(Ie),ne(te(()=>V.value?H.value:null,"keydown",ue)),ne(te(()=>V.value?Y.value:null,"keydown",ye));const Se=s.watchPostEffect(()=>{if(!V.value||!s.toValue(w))return;const O=Y.value;if(!O)return;let M=null,F=null;const $=S=>{if(M===S.clientX&&F===S.clientY)return;M=S.clientX,F=S.clientY;const q=S.target;if(!q)return;const ee=c.value;let Q=-1;for(let ce=0;ce<ee.length;ce++){const x=ee[ce];if(x&&(x===q||x.contains(q))){Q=ce;break}}Q>=0&&(l==null||l(Q))};O.addEventListener("mousemove",$),s.onWatcherCleanup(()=>{O.removeEventListener("mousemove",$)})});ne(Se);const Ae=s.ref(!1),ke=s.watch(()=>a.value,O=>{if(V.value){if(O&&!Ae.value){const M=s.toValue(E);if(M===!0||M==="auto"&&re!=null){const $=(g!==void 0?s.toValue(g):null)??(re&&oe(re,s.toValue(p),B.value)?y():A());$!=null&&(l==null||l($),ie($,!0))}}Ae.value=O}},{flush:"post",immediate:!0});return ne(ke),jo(H,c,s.computed(()=>f()),{virtual:D,open:a,virtualItemRef:C}),{cleanup:J}}/*!
2
- * tabbable 6.3.0
3
- * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
4
- */var Jo=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],bt=Jo.join(","),un=typeof Element>"u",ze=un?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,it=!un&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t==null?void 0:t.ownerDocument},Xe=function(e,n){var o;n===void 0&&(n=!0);var r=e==null||(o=e.getAttribute)===null||o===void 0?void 0:o.call(e,"inert"),a=r===""||r==="true",i=a||n&&e&&Xe(e.parentNode);return i},Qo=function(e){var n,o=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return o===""||o==="true"},er=function(e,n,o){if(Xe(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(bt));return n&&ze.call(e,bt)&&r.unshift(e),r=r.filter(o),r},yt=function(e,n,o){for(var r=[],a=Array.from(e);a.length;){var i=a.shift();if(!Xe(i,!1))if(i.tagName==="SLOT"){var c=i.assignedElements(),h=c.length?c:i.children,l=yt(h,!0,o);o.flatten?r.push.apply(r,l):r.push({scopeParent:i,candidates:l})}else{var d=ze.call(i,bt);d&&o.filter(i)&&(n||!e.includes(i))&&r.push(i);var u=i.shadowRoot||typeof o.getShadowRoot=="function"&&o.getShadowRoot(i),p=!Xe(u,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(i));if(u&&p){var m=yt(u===!0?i.children:u.children,!0,o);o.flatten?r.push.apply(r,m):r.push({scopeParent:i,candidates:m})}else a.unshift.apply(a,i.children)}}return r},fn=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},dn=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||Qo(e))&&!fn(e)?0:e.tabIndex},tr=function(e,n){var o=dn(e);return o<0&&n&&!fn(e)?0:o},nr=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},hn=function(e){return e.tagName==="INPUT"},or=function(e){return hn(e)&&e.type==="hidden"},rr=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(o){return o.tagName==="SUMMARY"});return n},ir=function(e,n){for(var o=0;o<e.length;o++)if(e[o].checked&&e[o].form===n)return e[o]},lr=function(e){if(!e.name)return!0;var n=e.form||it(e),o=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=o(window.CSS.escape(e.name));else try{r=o(e.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var a=ir(r,e.form);return!a||a===e},sr=function(e){return hn(e)&&e.type==="radio"},ar=function(e){return sr(e)&&!lr(e)},cr=function(e){var n,o=e&&it(e),r=(n=o)===null||n===void 0?void 0:n.host,a=!1;if(o&&o!==e){var i,c,h;for(a=!!((i=r)!==null&&i!==void 0&&(c=i.ownerDocument)!==null&&c!==void 0&&c.contains(r)||e!=null&&(h=e.ownerDocument)!==null&&h!==void 0&&h.contains(e));!a&&r;){var l,d,u;o=it(r),r=(l=o)===null||l===void 0?void 0:l.host,a=!!((d=r)!==null&&d!==void 0&&(u=d.ownerDocument)!==null&&u!==void 0&&u.contains(r))}}return a},pn=function(e){var n=e.getBoundingClientRect(),o=n.width,r=n.height;return o===0&&r===0},ur=function(e,n){var o=n.displayCheck,r=n.getShadowRoot;if(o==="full-native"&&"checkVisibility"in e){var a=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!a}if(getComputedStyle(e).visibility==="hidden")return!0;var i=ze.call(e,"details>summary:first-of-type"),c=i?e.parentElement:e;if(ze.call(c,"details:not([open]) *"))return!0;if(!o||o==="full"||o==="full-native"||o==="legacy-full"){if(typeof r=="function"){for(var h=e;e;){var l=e.parentElement,d=it(e);if(l&&!l.shadowRoot&&r(l)===!0)return pn(e);e.assignedSlot?e=e.assignedSlot:!l&&d!==e.ownerDocument?e=d.host:e=l}e=h}if(cr(e))return!e.getClientRects().length;if(o!=="legacy-full")return!0}else if(o==="non-zero-area")return pn(e);return!1},fr=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var o=0;o<n.children.length;o++){var r=n.children.item(o);if(r.tagName==="LEGEND")return ze.call(n,"fieldset[disabled] *")?!0:!r.contains(e)}return!0}n=n.parentElement}return!1},dr=function(e,n){return!(n.disabled||Xe(n)||or(n)||ur(n,e)||rr(n)||fr(n))},mn=function(e,n){return!(ar(n)||dn(n)<0||!dr(e,n))},hr=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},gn=function(e){var n=[],o=[];return e.forEach(function(r,a){var i=!!r.scopeParent,c=i?r.scopeParent:r,h=tr(c,i),l=i?gn(r.candidates):c;h===0?i?n.push.apply(n,l):n.push(c):o.push({documentOrder:a,tabIndex:h,item:r,isScope:i,content:l})}),o.sort(nr).reduce(function(r,a){return a.isScope?r.push.apply(r,a.content):r.push(a.content),r},[]).concat(n)},pr=function(e,n){n=n||{};var o;return n.getShadowRoot?o=yt([e],n.includeContainer,{filter:mn.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:hr}):o=er(e,n.includeContainer,mn.bind(null,n)),gn(o)};function mr(t,e={}){const{floatingContext:n,treeContext:o}=Be(t),{refs:{floatingEl:r,anchorEl:a},open:i,setOpen:c}=n,{enabled:h=!0,modal:l=!1,guards:d=!0,order:u=["content"],initialFocus:p="first",returnFocus:m=!0,restoreFocus:w=!1,closeOnFocusOut:b=!1,preventScroll:v=!0,outsideElementsInert:g=!1}=e,E=s.computed(()=>!!s.toValue(h)),L=s.computed(()=>!!s.toValue(l)),R=s.computed(()=>!!s.toValue(d)),D=s.computed(()=>Array.isArray(s.toValue(u))?s.toValue(u):["content"]),C=s.computed(()=>!!s.toValue(m)),P=s.computed(()=>!!s.toValue(w)),K=s.computed(()=>!!s.toValue(b)),N=s.computed(()=>!!s.toValue(v)),V=s.computed(()=>!!s.toValue(g)),H=s.computed(()=>r.value),Y=s.ref(null);let z=null,B=null,T=null,f=null,W=null,y=null,U=null;const ne=s.ref(-1);let J=!1;const A=typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype,j=[];function pe(x){!x||!x.isConnected||x!==x.ownerDocument.body&&(j.push(x),j.length>20&&j.shift())}function oe(){for(;j.length;){const x=j.pop();if(x.isConnected)return x}return null}function me(){if(!o)return!0;const x=I=>{for(const k of I.children.value)if(k.data.open.value||x(k))return!0;return!1};return!x(o)}function ie(x){const I=x.hasAttribute("tabindex"),k=x.getAttribute("tabindex");return I||x.setAttribute("tabindex","-1"),()=>{I?k!=null&&x.setAttribute("tabindex",k):x.removeAttribute("tabindex")}}function re(x){try{return pr(x,{displayCheck:"full",includeContainer:!1})}catch{return[]}}function ue(x){const I=re(x),k=a.value;return D.value.map(_=>_==="floating"?x:_==="reference"?We(k)?k:(k==null?void 0:k.contextElement)instanceof HTMLElement?k.contextElement:null:I).flat().filter(_=>!!_)}function ye(){const x=document.createElement("div");return x.setAttribute("tabindex","0"),x.setAttribute("aria-hidden","true"),x.style.cssText="position:absolute;width:1px;height:1px;opacity:0;",x}function Ie(x){R.value&&(f||W||(f=ye(),W=ye(),x.insertBefore(f,x.firstChild),x.appendChild(W),y=Ae(f,"before",x),U=Ae(W,"after",x)))}function Se(){y==null||y(),U==null||U(),y=null,U=null,f&&f.parentNode&&f.parentNode.removeChild(f),W&&W.parentNode&&W.parentNode.removeChild(W),f=null,W=null}function Ae(x,I,k){const _=G=>{G.preventDefault();const Z=ue(k);if(!Z.length){M(k);return}M(I==="before"?Z[Z.length-1]:Z[0])};return x.addEventListener("focus",_),()=>x.removeEventListener("focus",_)}function ke(x){if(!L.value)return()=>{};const I=[],k=x.ownerDocument.body,_=Array.from(k.children);for(const G of _)if(!G.contains(x)){const Z=G.getAttribute("aria-hidden");I.push(G),G.setAttribute("aria-hidden","true"),G.__prevAriaHidden=Z}return()=>{for(const G of I){const Z=G.__prevAriaHidden;Z==null?G.removeAttribute("aria-hidden"):G.setAttribute("aria-hidden",Z),delete G.__prevAriaHidden}}}function O(x){if(!L.value||!V.value)return()=>{};const k=x.ownerDocument.body,G=Array.from(k.children).filter(Z=>!Z.contains(x)).map(Z=>({el:Z,ariaHidden:Z.getAttribute("aria-hidden"),inert:Z.inert??null}));for(const{el:Z}of G)A?Z.inert=!0:Z.setAttribute("aria-hidden","true");return()=>{var Z;for(const Pe of G){if(A){const Ye=Pe.el;Pe.inert==null?(Ye.inert=!1,(Z=Ye.removeAttribute)==null||Z.call(Ye,"inert")):Ye.inert=Pe.inert}Pe.ariaHidden==null?Pe.el.removeAttribute("aria-hidden"):Pe.el.setAttribute("aria-hidden",Pe.ariaHidden)}}}function M(x,I){if(x)try{x.focus(I??{preventScroll:N.value})}catch{}}function F(x){const I=s.toValue(p),k=re(x);if(typeof I=="number"){const _=k[I]??null;M(_);return}if(typeof I=="function"){M(I(),{preventScroll:N.value});return}if(We(I)){M(I,{preventScroll:N.value});return}if(I==="last"){M(k[k.length-1]??null);return}k.length>0?M(k[0]):(z=ie(x),M(x))}function $(x,I){if(x.key!=="Tab")return;const k=ue(I);if(!k.length){z??(z=ie(I)),x.preventDefault(),M(I);return}const _=document.activeElement,G=k[0],Z=k[k.length-1];x.shiftKey?(!_||_===G)&&(x.preventDefault(),M(Z)):(!_||_===Z)&&(x.preventDefault(),M(G))}function S(x){return o?le(x,o.data.refs.anchorEl.value)||le(x,o.data.refs.floatingEl.value)?!0:!!Ue(o,x):!!H.value&&H.value.contains(x)}const q=te(()=>E.value&&i.value?H.value:null,"keydown",x=>{const I=H.value;I&&$(x,I)},{capture:!0}),ee=te(()=>E.value&&i.value?document:null,"focusin",x=>{const I=H.value,k=x.target;if(!(!I||!k)&&me()&&!I.contains(k)&&!S(k)){if(L.value){const G=ue(I)[0]??I;M(G)}else if(K.value){J=!0;try{c(!1,"blur",x)}catch(_){console.error("[useFocusTrap] Error closing on focus out:",_)}}}},{capture:!0});te(()=>E.value&&i.value?H.value:null,"focusin",x=>{const I=H.value;if(!I)return;const k=re(I),_=x.target;if(!(_ instanceof HTMLElement)){ne.value=-1;return}ne.value=k.indexOf(_)}),te(()=>E.value&&i.value?H.value:null,"focusout",x=>{if(!P.value)return;const I=H.value;I&&queueMicrotask(()=>{const k=I.ownerDocument,_=k.activeElement;if(_&&I.contains(_)||_&&_!==k.body)return;const G=re(I),Z=G[ne.value]??G[G.length-1]??I;M(Z)})}),te(()=>E.value&&i.value?document:null,"pointerdown",()=>{queueMicrotask(()=>{})},{capture:!0});const Q=s.watchPostEffect(()=>{if(!E.value||!i.value)return;const x=H.value;if(!x)return;const k=x.ownerDocument.activeElement;Y.value=k,pe(k),Ie(x),B=ke(x),T=O(x),queueMicrotask(()=>F(x)),s.onWatcherCleanup(()=>{Se(),z&&(z(),z=null),B&&(B(),B=null),T&&(T(),T=null)})});s.watch(()=>i.value,(x,I)=>{if(!x&&I){const k=Y.value;if(Y.value=null,C.value&&!J){const _=oe()??k??ce();if(_){const G=re(_);M(G[0]??_,{preventScroll:!0})}}J=!1}},{flush:"post"});function ce(){const x=a.value;return x instanceof HTMLElement?x:(x==null?void 0:x.contextElement)instanceof HTMLElement?x.contextElement:null}return s.onScopeDispose(()=>{q(),ee(),Se(),z&&z(),B&&B(),T&&T()}),{cleanup:()=>{q(),ee(),Q(),Se(),z&&z(),B&&B(),T&&T()}}}X.FollowTracker=Lt,X.StaticTracker=Dt,X.TrackingStrategy=at,X.VirtualElementFactory=je,X.arrow=Qt,X.autoPlacement=bo,X.createTree=on,X.createTreeNode=vt,X.flip=Eo,X.hide=Co,X.offset=wo,X.shift=yo,X.size=xo,X.useArrow=Re,X.useClick=Fo,X.useClientPoint=Tn,X.useEscapeKey=Io,X.useFloating=en,X.useFloatingTree=Ao,X.useFocus=Bo,X.useFocusTrap=mr,X.useHover=Uo,X.useListNavigation=Zo,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})}));