@tedi-design-system/react 18.0.0-rc.3 → 18.0.0-rc.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/bundle-stats.html +1 -1
  2. package/external/@floating-ui/core/dist/floating-ui.core.cjs.js +1 -1
  3. package/external/@floating-ui/core/dist/floating-ui.core.es.js +275 -271
  4. package/external/@floating-ui/dom/dist/floating-ui.dom.cjs.js +1 -1
  5. package/external/@floating-ui/dom/dist/floating-ui.dom.es.js +189 -188
  6. package/external/@floating-ui/react/dist/floating-ui.react.cjs.js +1 -1
  7. package/external/@floating-ui/react/dist/floating-ui.react.es.js +1419 -1538
  8. package/external/@floating-ui/react/dist/floating-ui.react.utils.cjs.js +1 -1
  9. package/external/@floating-ui/react/dist/floating-ui.react.utils.es.js +348 -81
  10. package/external/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.js +1 -1
  11. package/external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js +113 -93
  12. package/external/@floating-ui/utils/dist/floating-ui.utils.cjs.js +1 -1
  13. package/external/@floating-ui/utils/dist/floating-ui.utils.dom.cjs.js +1 -1
  14. package/external/@floating-ui/utils/dist/floating-ui.utils.dom.es.js +97 -97
  15. package/external/@floating-ui/utils/dist/floating-ui.utils.es.js +66 -68
  16. package/external/lodash-es/_baseUnset.cjs.js +1 -1
  17. package/external/lodash-es/_baseUnset.es.js +12 -19
  18. package/external/tabbable/dist/index.esm.cjs.js +1 -1
  19. package/external/tabbable/dist/index.esm.es.js +72 -63
  20. package/index.css +1 -1
  21. package/package.json +4 -4
  22. package/src/community/components/modal/modal-closer.d.ts +6 -0
  23. package/src/community/components/modal/modal-provider.d.ts +6 -0
  24. package/src/community/components/modal/modal-trigger.d.ts +6 -0
  25. package/src/community/components/modal/modal.d.ts +6 -0
  26. package/src/tedi/components/buttons/button-group/button-group.cjs.js +1 -1
  27. package/src/tedi/components/buttons/button-group/button-group.es.js +4 -4
  28. package/src/tedi/components/buttons/collapse/collapse.cjs.js +1 -1
  29. package/src/tedi/components/buttons/collapse/collapse.d.ts +15 -0
  30. package/src/tedi/components/buttons/collapse/collapse.es.js +55 -54
  31. package/src/tedi/components/content/table/index.d.ts +6 -0
  32. package/src/tedi/components/content/table/table-columns-menu/table-columns-menu.cjs.js +1 -0
  33. package/src/tedi/components/content/table/table-columns-menu/table-columns-menu.d.ts +15 -0
  34. package/src/tedi/components/content/table/table-columns-menu/table-columns-menu.es.js +37 -0
  35. package/src/tedi/components/content/table/table-context.cjs.js +1 -0
  36. package/src/tedi/components/content/table/table-context.d.ts +3 -0
  37. package/src/tedi/components/content/table/table-context.es.js +11 -0
  38. package/src/tedi/components/content/table/table-header-button/table-header-button.cjs.js +1 -0
  39. package/src/tedi/components/content/table/table-header-button/table-header-button.d.ts +51 -0
  40. package/src/tedi/components/content/table/table-header-button/table-header-button.es.js +42 -0
  41. package/src/tedi/components/content/table/table-header-button/table-header-button.module.scss.cjs.js +1 -0
  42. package/src/tedi/components/content/table/table-header-button/table-header-button.module.scss.es.js +7 -0
  43. package/src/tedi/components/content/table/table-toolbar/table-toolbar.cjs.js +1 -0
  44. package/src/tedi/components/content/table/table-toolbar/table-toolbar.d.ts +21 -0
  45. package/src/tedi/components/content/table/table-toolbar/table-toolbar.es.js +9 -0
  46. package/src/tedi/components/content/table/table.cjs.js +1 -0
  47. package/src/tedi/components/content/table/table.d.ts +519 -0
  48. package/src/tedi/components/content/table/table.es.js +856 -0
  49. package/src/tedi/components/content/table/table.module.scss.cjs.js +1 -0
  50. package/src/tedi/components/content/table/table.module.scss.es.js +54 -0
  51. package/src/tedi/components/content/table/use-table-persistence.cjs.js +1 -0
  52. package/src/tedi/components/content/table/use-table-persistence.d.ts +13 -0
  53. package/src/tedi/components/content/table/use-table-persistence.es.js +53 -0
  54. package/src/tedi/components/form/time-field/time-field.es.js +3 -3
  55. package/src/tedi/components/navigation/pagination/pagination.cjs.js +1 -1
  56. package/src/tedi/components/navigation/pagination/pagination.d.ts +7 -0
  57. package/src/tedi/components/navigation/pagination/pagination.es.js +132 -91
  58. package/src/tedi/components/navigation/pagination/pagination.module.scss.cjs.js +1 -1
  59. package/src/tedi/components/navigation/pagination/pagination.module.scss.es.js +7 -1
  60. package/src/tedi/components/navigation/pagination/pagination.types.d.ts +100 -0
  61. package/src/tedi/components/overlays/modal/index.d.ts +8 -0
  62. package/src/tedi/components/overlays/modal/modal-body/modal-body.cjs.js +1 -0
  63. package/src/tedi/components/overlays/modal/modal-body/modal-body.d.ts +22 -0
  64. package/src/tedi/components/overlays/modal/modal-body/modal-body.es.js +21 -0
  65. package/src/tedi/components/overlays/modal/modal-closer/modal-closer.cjs.js +1 -0
  66. package/src/tedi/components/overlays/modal/modal-closer/modal-closer.d.ts +15 -0
  67. package/src/tedi/components/overlays/modal/modal-closer/modal-closer.es.js +16 -0
  68. package/src/tedi/components/overlays/modal/modal-content/modal-content.cjs.js +1 -0
  69. package/src/tedi/components/overlays/modal/modal-content/modal-content.d.ts +108 -0
  70. package/src/tedi/components/overlays/modal/modal-content/modal-content.es.js +81 -0
  71. package/src/tedi/components/overlays/modal/modal-context.cjs.js +1 -0
  72. package/src/tedi/components/overlays/modal/modal-context.d.ts +59 -0
  73. package/src/tedi/components/overlays/modal/modal-context.es.js +15 -0
  74. package/src/tedi/components/overlays/modal/modal-footer/modal-footer.cjs.js +1 -0
  75. package/src/tedi/components/overlays/modal/modal-footer/modal-footer.d.ts +22 -0
  76. package/src/tedi/components/overlays/modal/modal-footer/modal-footer.es.js +25 -0
  77. package/src/tedi/components/overlays/modal/modal-header/modal-header.cjs.js +1 -0
  78. package/src/tedi/components/overlays/modal/modal-header/modal-header.d.ts +58 -0
  79. package/src/tedi/components/overlays/modal/modal-header/modal-header.es.js +25 -0
  80. package/src/tedi/components/overlays/modal/modal-trigger/modal-trigger.cjs.js +1 -0
  81. package/src/tedi/components/overlays/modal/modal-trigger/modal-trigger.d.ts +13 -0
  82. package/src/tedi/components/overlays/modal/modal-trigger/modal-trigger.es.js +14 -0
  83. package/src/tedi/components/overlays/modal/modal.cjs.js +1 -0
  84. package/src/tedi/components/overlays/modal/modal.d.ts +68 -0
  85. package/src/tedi/components/overlays/modal/modal.es.js +76 -0
  86. package/src/tedi/components/overlays/modal/modal.module.scss.cjs.js +1 -0
  87. package/src/tedi/components/overlays/modal/modal.module.scss.es.js +36 -0
  88. package/src/tedi/components/overlays/tooltip/tooltip.cjs.js +1 -1
  89. package/src/tedi/components/overlays/tooltip/tooltip.es.js +14 -6
  90. package/src/tedi/helpers/hooks/use-sidenav-state.d.ts +1 -1
  91. package/src/tedi/index.d.ts +2 -0
  92. package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
  93. package/src/tedi/providers/label-provider/labels-map.d.ts +132 -6
  94. package/src/tedi/providers/label-provider/labels-map.es.js +146 -11
  95. package/tedi.cjs.js +1 -1
  96. package/tedi.es.js +203 -171
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ue=require("react"),m=require("./floating-ui.react.utils.cjs.js"),ut=require("../../utils/dist/floating-ui.utils.cjs.js"),H=require("../../utils/dist/floating-ui.utils.dom.cjs.js"),De=require("../../../tabbable/dist/index.esm.cjs.js"),qt=require("react-dom"),Ce=require("../../react-dom/dist/floating-ui.react-dom.cjs.js");function kt(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const u=kt(Ue),Bt=kt(qt);function jt(t){return u.useMemo(()=>t.every(e=>e==null)?null:e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})},t)}const Ft={...u},Ut=Ft.useInsertionEffect,Xt=Ut||(t=>t());function ie(t){const e=u.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Xt(()=>{e.current=t}),u.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}const nt="ArrowUp",Ne="ArrowDown",ve="ArrowLeft",be="ArrowRight";function Ve(t,e,n){return Math.floor(t/e)!==n}function Fe(t,e){return e<0||e>=t.current.length}function $e(t,e){return oe(t,{disabledIndices:e})}function lt(t,e){return oe(t,{decrement:!0,startingIndex:t.current.length,disabledIndices:e})}function oe(t,e){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o,amount:s=1}=e===void 0?{}:e;const i=t.current;let c=n;do c+=r?-s:s;while(c>=0&&c<=i.length-1&&Be(i,c,o));return c}function Yt(t,e){let{event:n,orientation:r,loop:o,rtl:s,cols:i,disabledIndices:c,minIndex:b,maxIndex:f,prevIndex:g,stopEvent:E=!1}=e,p=g;if(n.key===nt){if(E&&m.stopEvent(n),g===-1)p=f;else if(p=oe(t,{startingIndex:p,amount:i,decrement:!0,disabledIndices:c}),o&&(g-i<b||p<0)){const l=g%i,v=f%i,a=f-(v-l);v===l?p=f:p=v>l?a:a-i}Fe(t,p)&&(p=g)}if(n.key===Ne&&(E&&m.stopEvent(n),g===-1?p=b:(p=oe(t,{startingIndex:g,amount:i,disabledIndices:c}),o&&g+i>f&&(p=oe(t,{startingIndex:g%i-i,amount:i,disabledIndices:c}))),Fe(t,p)&&(p=g)),r==="both"){const l=ut.floor(g/i);n.key===(s?ve:be)&&(E&&m.stopEvent(n),g%i!==i-1?(p=oe(t,{startingIndex:g,disabledIndices:c}),o&&Ve(p,i,l)&&(p=oe(t,{startingIndex:g-g%i-1,disabledIndices:c}))):o&&(p=oe(t,{startingIndex:g-g%i-1,disabledIndices:c})),Ve(p,i,l)&&(p=g)),n.key===(s?be:ve)&&(E&&m.stopEvent(n),g%i!==0?(p=oe(t,{startingIndex:g,decrement:!0,disabledIndices:c}),o&&Ve(p,i,l)&&(p=oe(t,{startingIndex:g+(i-g%i),decrement:!0,disabledIndices:c}))):o&&(p=oe(t,{startingIndex:g+(i-g%i),decrement:!0,disabledIndices:c})),Ve(p,i,l)&&(p=g));const v=ut.floor(f/i)===l;Fe(t,p)&&(o&&v?p=n.key===(s?be:ve)?f:oe(t,{startingIndex:g-g%i-1,disabledIndices:c}):p=g)}return p}function zt(t,e,n){const r=[];let o=0;return t.forEach((s,i)=>{let{width:c,height:b}=s;if(c>e&&process.env.NODE_ENV!=="production")throw new Error("[Floating UI]: Invalid grid - item width at index "+i+" is greater than grid columns");let f=!1;for(n&&(o=0);!f;){const g=[];for(let E=0;E<c;E++)for(let p=0;p<b;p++)g.push(o+E+p*e);o%e+c<=e&&g.every(E=>r[E]==null)?(g.forEach(E=>{r[E]=i}),f=!0):o++}}),[...r]}function $t(t,e,n,r,o){if(t===-1)return-1;const s=n.indexOf(t),i=e[t];switch(o){case"tl":return s;case"tr":return i?s+i.width-1:s;case"bl":return i?s+(i.height-1)*r:s;case"br":return n.lastIndexOf(t)}}function Gt(t,e){return e.flatMap((n,r)=>t.includes(n)?[r]:[])}function Be(t,e,n){if(n)return n.includes(e);const r=t[e];return r==null||r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true"}var Z=typeof document<"u"?Ue.useLayoutEffect:Ue.useEffect;function Ie(){return Ie=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ie.apply(this,arguments)}let at=!1,Qt=0;const ft=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Qt++;function Zt(){const[t,e]=u.useState(()=>at?ft():void 0);return Z(()=>{t==null&&e(ft())},[]),u.useEffect(()=>{at=!0},[]),t}const Jt=Ft.useId,Me=Jt||Zt;let Se;process.env.NODE_ENV!=="production"&&(Se=new Set);function je(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((t=Se)!=null&&t.has(o))){var s;(s=Se)==null||s.add(o),console.warn(o)}}function en(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((t=Se)!=null&&t.has(o))){var s;(s=Se)==null||s.add(o),console.error(o)}}const tn=u.forwardRef(function(e,n){const{context:{placement:r,elements:{floating:o},middlewareData:{arrow:s,shift:i}},width:c=14,height:b=7,tipRadius:f=0,strokeWidth:g=0,staticOffset:E,stroke:p,d:l,style:{transform:v,...a}={},...F}=e;process.env.NODE_ENV!=="production"&&(n||je("The `ref` prop is required for `FloatingArrow`."));const N=Me(),[_,h]=u.useState(!1);if(Z(()=>{if(!o)return;H.getComputedStyle(o).direction==="rtl"&&h(!0)},[o]),!o)return null;const[L,z]=r.split("-"),W=L==="top"||L==="bottom";let Y=E;(W&&i!=null&&i.x||!W&&i!=null&&i.y)&&(Y=null);const U=g*2,$=U/2,G=c/2*(f/-8+1),j=b/2*f/4,y=!!l,I=Y&&z==="end"?"bottom":"top";let R=Y&&z==="end"?"right":"left";Y&&_&&(R=z==="end"?"left":"right");const T=(s==null?void 0:s.x)!=null?Y||s.x:"",w=(s==null?void 0:s.y)!=null?Y||s.y:"",x=l||"M0,0"+(" H"+c)+(" L"+(c-G)+","+(b-j))+(" Q"+c/2+","+b+" "+G+","+(b-j))+" Z",C={top:y?"rotate(180deg)":"",left:y?"rotate(90deg)":"rotate(-90deg)",bottom:y?"":"rotate(180deg)",right:y?"rotate(-90deg)":"rotate(90deg)"}[L];return u.createElement("svg",Ie({},F,{"aria-hidden":!0,ref:n,width:y?c:c+U,height:c,viewBox:"0 0 "+c+" "+(b>c?b:c),style:{position:"absolute",pointerEvents:"none",[R]:T,[I]:w,[L]:W||y?"100%":"calc(100% - "+U/2+"px)",transform:[C,v].filter(d=>!!d).join(" "),...a}}),U>0&&u.createElement("path",{clipPath:"url(#"+N+")",fill:"none",stroke:p,strokeWidth:U+(l?0:1),d:x}),u.createElement("path",{stroke:U&&!l?F.fill:"none",d:x}),u.createElement("clipPath",{id:N},u.createElement("rect",{x:-$,y:$*(y?-1:1),width:c+U,height:c})))});function nn(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(o=>o(n))},on(e,n){t.set(e,[...t.get(e)||[],n])},off(e,n){var r;t.set(e,((r=t.get(e))==null?void 0:r.filter(o=>o!==n))||[])}}}const rn=u.createContext(null),on=u.createContext(null),Oe=()=>{var t;return((t=u.useContext(rn))==null?void 0:t.id)||null},xe=()=>u.useContext(on);function sn(t){const e=Me(),n=xe(),o=Oe();return Z(()=>{const s={id:e,parentId:o};return n==null||n.addNode(s),()=>{n==null||n.removeNode(s)}},[n,e,o]),e}function we(t){return"data-floating-ui-"+t}function ue(t){const e=Ue.useRef(t);return Z(()=>{e.current=t}),e}const dt=we("safe-polygon");function Ge(t,e,n){return n&&!m.isMouseLikePointerType(n)?0:typeof t=="number"?t:t==null?void 0:t[e]}function cn(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:i}=t,{enabled:c=!0,delay:b=0,handleClose:f=null,mouseOnly:g=!1,restMs:E=0,move:p=!0}=e,l=xe(),v=Oe(),a=ue(f),F=ue(b),N=ue(n),_=u.useRef(),h=u.useRef(-1),L=u.useRef(),z=u.useRef(-1),W=u.useRef(!0),Y=u.useRef(!1),U=u.useRef(()=>{}),$=u.useRef(!1),G=u.useCallback(()=>{var x;const C=(x=o.current.openEvent)==null?void 0:x.type;return(C==null?void 0:C.includes("mouse"))&&C!=="mousedown"},[o]);u.useEffect(()=>{if(!c)return;function x(C){let{open:d}=C;d||(clearTimeout(h.current),clearTimeout(z.current),W.current=!0,$.current=!1)}return s.on("openchange",x),()=>{s.off("openchange",x)}},[c,s]),u.useEffect(()=>{if(!c||!a.current||!n)return;function x(d){G()&&r(!1,d,"hover")}const C=m.getDocument(i.floating).documentElement;return C.addEventListener("mouseleave",x),()=>{C.removeEventListener("mouseleave",x)}},[i.floating,n,r,c,a,G]);const j=u.useCallback(function(x,C,d){C===void 0&&(C=!0),d===void 0&&(d="hover");const M=Ge(F.current,"close",_.current);M&&!L.current?(clearTimeout(h.current),h.current=window.setTimeout(()=>r(!1,x,d),M)):C&&(clearTimeout(h.current),r(!1,x,d))},[F,r]),y=ie(()=>{U.current(),L.current=void 0}),I=ie(()=>{if(Y.current){const x=m.getDocument(i.floating).body;x.style.pointerEvents="",x.removeAttribute(dt),Y.current=!1}}),R=ie(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);u.useEffect(()=>{if(!c)return;function x(O){if(clearTimeout(h.current),W.current=!1,g&&!m.isMouseLikePointerType(_.current)||E>0&&!Ge(F.current,"open"))return;const B=Ge(F.current,"open",_.current);B?h.current=window.setTimeout(()=>{N.current||r(!0,O,"hover")},B):n||r(!0,O,"hover")}function C(O){if(R())return;U.current();const B=m.getDocument(i.floating);if(clearTimeout(z.current),$.current=!1,a.current&&o.current.floatingContext){n||clearTimeout(h.current),L.current=a.current({...o.current.floatingContext,tree:l,x:O.clientX,y:O.clientY,onClose(){I(),y(),R()||j(O,!0,"safe-polygon")}});const D=L.current;B.addEventListener("mousemove",D),U.current=()=>{B.removeEventListener("mousemove",D)};return}(_.current==="touch"?!m.contains(i.floating,O.relatedTarget):!0)&&j(O)}function d(O){R()||o.current.floatingContext&&(a.current==null||a.current({...o.current.floatingContext,tree:l,x:O.clientX,y:O.clientY,onClose(){I(),y(),R()||j(O)}})(O))}if(H.isElement(i.domReference)){var M;const O=i.domReference;return n&&O.addEventListener("mouseleave",d),(M=i.floating)==null||M.addEventListener("mouseleave",d),p&&O.addEventListener("mousemove",x,{once:!0}),O.addEventListener("mouseenter",x),O.addEventListener("mouseleave",C),()=>{var B;n&&O.removeEventListener("mouseleave",d),(B=i.floating)==null||B.removeEventListener("mouseleave",d),p&&O.removeEventListener("mousemove",x),O.removeEventListener("mouseenter",x),O.removeEventListener("mouseleave",C)}}},[i,c,t,g,E,p,j,y,I,r,n,N,l,F,a,o,R]),Z(()=>{var x;if(c&&n&&(x=a.current)!=null&&x.__options.blockPointerEvents&&G()){Y.current=!0;const d=i.floating;if(H.isElement(i.domReference)&&d){var C;const M=m.getDocument(i.floating).body;M.setAttribute(dt,"");const O=i.domReference,B=l==null||(C=l.nodesRef.current.find(re=>re.id===v))==null||(C=C.context)==null?void 0:C.elements.floating;return B&&(B.style.pointerEvents=""),M.style.pointerEvents="none",O.style.pointerEvents="auto",d.style.pointerEvents="auto",()=>{M.style.pointerEvents="",O.style.pointerEvents="",d.style.pointerEvents=""}}}},[c,n,v,i,l,a,G]),Z(()=>{n||(_.current=void 0,$.current=!1,y(),I())},[n,y,I]),u.useEffect(()=>()=>{y(),clearTimeout(h.current),clearTimeout(z.current),I()},[c,i.domReference,y,I]);const T=u.useMemo(()=>{function x(C){_.current=C.pointerType}return{onPointerDown:x,onPointerEnter:x,onMouseMove(C){const{nativeEvent:d}=C;function M(){!W.current&&!N.current&&r(!0,d,"hover")}g&&!m.isMouseLikePointerType(_.current)||n||E===0||$.current&&C.movementX**2+C.movementY**2<2||(clearTimeout(z.current),_.current==="touch"?M():($.current=!0,z.current=window.setTimeout(M,E)))}}},[g,r,n,N,E]),w=u.useMemo(()=>({onMouseEnter(){clearTimeout(h.current)},onMouseLeave(x){R()||j(x.nativeEvent,!1)}}),[j,R]);return u.useMemo(()=>c?{reference:T,floating:w}:{},[c,T,w])}let mt=0;function pe(t,e){e===void 0&&(e={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=e;r&&cancelAnimationFrame(mt);const s=()=>t==null?void 0:t.focus({preventScroll:n});o?s():mt=requestAnimationFrame(s)}function un(t,e){var n;let r=[],o=(n=t.find(s=>s.id===e))==null?void 0:n.parentId;for(;o;){const s=t.find(i=>i.id===o);o=s==null?void 0:s.parentId,s&&(r=r.concat(s))}return r}function ye(t,e){let n=t.filter(o=>{var s;return o.parentId===e&&((s=o.context)==null?void 0:s.open)}),r=n;for(;r.length;)r=t.filter(o=>{var s;return(s=r)==null?void 0:s.some(i=>{var c;return o.parentId===i.id&&((c=o.context)==null?void 0:c.open)})}),n=n.concat(r);return n}function ln(t,e){let n,r=-1;function o(s,i){i>r&&(n=s,r=i),ye(t,s).forEach(b=>{o(b.id,i+1)})}return o(e,0),t.find(s=>s.id===n)}let Te=new WeakMap,He=new WeakSet,We={},Qe=0;const an=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype,Lt=t=>t&&(t.host||Lt(t.parentNode)),fn=(t,e)=>e.map(n=>{if(t.contains(n))return n;const r=Lt(n);return t.contains(r)?r:null}).filter(n=>n!=null);function dn(t,e,n,r){const o="data-floating-ui-inert",s=r?"inert":n?"aria-hidden":null,i=fn(e,t),c=new Set,b=new Set(i),f=[];We[o]||(We[o]=new WeakMap);const g=We[o];i.forEach(E),p(e),c.clear();function E(l){!l||c.has(l)||(c.add(l),l.parentNode&&E(l.parentNode))}function p(l){!l||b.has(l)||[].forEach.call(l.children,v=>{if(H.getNodeName(v)!=="script")if(c.has(v))p(v);else{const a=s?v.getAttribute(s):null,F=a!==null&&a!=="false",N=(Te.get(v)||0)+1,_=(g.get(v)||0)+1;Te.set(v,N),g.set(v,_),f.push(v),N===1&&F&&He.add(v),_===1&&v.setAttribute(o,""),!F&&s&&v.setAttribute(s,"true")}})}return Qe++,()=>{f.forEach(l=>{const v=(Te.get(l)||0)-1,a=(g.get(l)||0)-1;Te.set(l,v),g.set(l,a),v||(!He.has(l)&&s&&l.removeAttribute(s),He.delete(l)),a||l.removeAttribute(o)}),Qe--,Qe||(Te=new WeakMap,Te=new WeakMap,He=new WeakSet,We={})}}function gt(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=m.getDocument(t[0]).body;return dn(t.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,e,n)}const Ae=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Dt(t,e){const n=De.tabbable(t,Ae());e==="prev"&&n.reverse();const r=n.indexOf(m.activeElement(m.getDocument(t)));return n.slice(r+1)[0]}function St(){return Dt(document.body,"next")}function At(){return Dt(document.body,"prev")}function Le(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!m.contains(n,r)}function mn(t){De.tabbable(t,Ae()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function pt(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const Ye={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};let gn;function vt(t){t.key==="Tab"&&(t.target,clearTimeout(gn))}const Xe=u.forwardRef(function(e,n){const[r,o]=u.useState();Z(()=>(m.isSafari()&&o("button"),document.addEventListener("keydown",vt),()=>{document.removeEventListener("keydown",vt)}),[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[we("focus-guard")]:"",style:Ye};return u.createElement("span",Ie({},e,s))}),Nt=u.createContext(null),bt=we("portal");function _t(t){t===void 0&&(t={});const{id:e,root:n}=t,r=Me(),o=Kt(),[s,i]=u.useState(null),c=u.useRef(null);return Z(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{c.current=null})},[s]),Z(()=>{if(!r||c.current)return;const b=e?document.getElementById(e):null;if(!b)return;const f=document.createElement("div");f.id=r,f.setAttribute(bt,""),b.appendChild(f),c.current=f,i(f)},[e,r]),Z(()=>{if(n===null||!r||c.current)return;let b=n||(o==null?void 0:o.portalNode);b&&!H.isElement(b)&&(b=b.current),b=b||document.body;let f=null;e&&(f=document.createElement("div"),f.id=e,b.appendChild(f));const g=document.createElement("div");g.id=r,g.setAttribute(bt,""),b=f||b,b.appendChild(g),c.current=g,i(g)},[e,n,r,o]),s}function pn(t){const{children:e,id:n,root:r,preserveTabOrder:o=!0}=t,s=_t({id:n,root:r}),[i,c]=u.useState(null),b=u.useRef(null),f=u.useRef(null),g=u.useRef(null),E=u.useRef(null),p=i==null?void 0:i.modal,l=i==null?void 0:i.open,v=!!i&&!i.modal&&i.open&&o&&!!(r||s);return u.useEffect(()=>{if(!s||!o||p)return;function a(F){s&&Le(F)&&(F.type==="focusin"?pt:mn)(s)}return s.addEventListener("focusin",a,!0),s.addEventListener("focusout",a,!0),()=>{s.removeEventListener("focusin",a,!0),s.removeEventListener("focusout",a,!0)}},[s,o,p]),u.useEffect(()=>{s&&(l||pt(s))},[l,s]),u.createElement(Nt.Provider,{value:u.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:b,afterOutsideRef:f,beforeInsideRef:g,afterInsideRef:E,portalNode:s,setFocusManagerState:c}),[o,s])},v&&s&&u.createElement(Xe,{"data-type":"outside",ref:b,onFocus:a=>{if(Le(a,s)){var F;(F=g.current)==null||F.focus()}else{const N=At()||(i==null?void 0:i.refs.domReference.current);N==null||N.focus()}}}),v&&s&&u.createElement("span",{"aria-owns":s.id,style:Ye}),s&&Bt.createPortal(e,s),v&&s&&u.createElement(Xe,{"data-type":"outside",ref:f,onFocus:a=>{if(Le(a,s)){var F;(F=E.current)==null||F.focus()}else{const N=St()||(i==null?void 0:i.refs.domReference.current);N==null||N.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,a.nativeEvent,"focus-out"))}}}))}const Kt=()=>u.useContext(Nt),tt="data-floating-ui-focusable";function Vt(t){return t?t.hasAttribute(tt)?t:t.querySelector("["+tt+"]")||t:null}const Et=20;let Re=[];function Ze(t){Re=Re.filter(n=>n.isConnected);let e=t;if(!(!e||H.getNodeName(e)==="body")){if(!De.isTabbable(e,Ae())){const n=De.tabbable(e,Ae())[0];n&&(e=n)}Re.push(e),Re.length>Et&&(Re=Re.slice(-Et))}}function ht(){return Re.slice().reverse().find(t=>t.isConnected)}const vn=u.forwardRef(function(e,n){return u.createElement("button",Ie({},e,{type:"button",ref:n,tabIndex:-1,style:Ye}))});function bn(t){const{context:e,children:n,disabled:r=!1,order:o=["content"],guards:s=!0,initialFocus:i=0,returnFocus:c=!0,restoreFocus:b=!1,modal:f=!0,visuallyHiddenDismiss:g=!1,closeOnFocusOut:E=!0}=t,{open:p,refs:l,nodeId:v,onOpenChange:a,events:F,dataRef:N,floatingId:_,elements:{domReference:h,floating:L}}=e,z=typeof i=="number"&&i<0,W=m.isTypeableCombobox(h)&&z,Y=an()?s:!0,U=ue(o),$=ue(i),G=ue(c),j=xe(),y=Kt(),I=u.useRef(null),R=u.useRef(null),T=u.useRef(!1),w=u.useRef(!1),x=u.useRef(-1),C=y!=null,d=Vt(L),M=ie(function(D){return D===void 0&&(D=d),D?De.tabbable(D,Ae()):[]}),O=ie(D=>{const K=M(D);return U.current.map(P=>h&&P==="reference"?h:d&&P==="floating"?d:K).filter(Boolean).flat()});u.useEffect(()=>{if(r||!f)return;function D(P){if(P.key==="Tab"){m.contains(d,m.activeElement(m.getDocument(d)))&&M().length===0&&!W&&m.stopEvent(P);const A=O(),k=m.getTarget(P);U.current[0]==="reference"&&k===h&&(m.stopEvent(P),P.shiftKey?pe(A[A.length-1]):pe(A[1])),U.current[1]==="floating"&&k===d&&P.shiftKey&&(m.stopEvent(P),pe(A[0]))}}const K=m.getDocument(d);return K.addEventListener("keydown",D),()=>{K.removeEventListener("keydown",D)}},[r,h,d,f,U,W,M,O]),u.useEffect(()=>{if(r||!L)return;function D(K){const P=m.getTarget(K),k=M().indexOf(P);k!==-1&&(x.current=k)}return L.addEventListener("focusin",D),()=>{L.removeEventListener("focusin",D)}},[r,L,M]),u.useEffect(()=>{if(r||!E)return;function D(){w.current=!0,setTimeout(()=>{w.current=!1})}function K(P){const A=P.relatedTarget;queueMicrotask(()=>{const k=!(m.contains(h,A)||m.contains(L,A)||m.contains(A,L)||m.contains(y==null?void 0:y.portalNode,A)||A!=null&&A.hasAttribute(we("focus-guard"))||j&&(ye(j.nodesRef.current,v).find(q=>{var X,te;return m.contains((X=q.context)==null?void 0:X.elements.floating,A)||m.contains((te=q.context)==null?void 0:te.elements.domReference,A)})||un(j.nodesRef.current,v).find(q=>{var X,te;return((X=q.context)==null?void 0:X.elements.floating)===A||((te=q.context)==null?void 0:te.elements.domReference)===A})));if(b&&k&&m.activeElement(m.getDocument(d))===m.getDocument(d).body){H.isHTMLElement(d)&&d.focus();const q=x.current,X=M(),te=X[q]||X[X.length-1]||d;H.isHTMLElement(te)&&te.focus()}(W||!f)&&A&&k&&!w.current&&A!==ht()&&(T.current=!0,a(!1,P,"focus-out"))})}if(L&&H.isHTMLElement(h))return h.addEventListener("focusout",K),h.addEventListener("pointerdown",D),L.addEventListener("focusout",K),()=>{h.removeEventListener("focusout",K),h.removeEventListener("pointerdown",D),L.removeEventListener("focusout",K)}},[r,h,L,d,f,v,j,y,a,E,b,M,W]),u.useEffect(()=>{var D;if(r)return;const K=Array.from((y==null||(D=y.portalNode)==null?void 0:D.querySelectorAll("["+we("portal")+"]"))||[]);if(L){const P=[L,...K,I.current,R.current,U.current.includes("reference")||W?h:null].filter(k=>k!=null),A=f||W?gt(P,Y,!Y):gt(P);return()=>{A()}}},[r,h,L,f,U,y,W,Y]),Z(()=>{if(r||!H.isHTMLElement(d))return;const D=m.getDocument(d),K=m.activeElement(D);queueMicrotask(()=>{const P=O(d),A=$.current,k=(typeof A=="number"?P[A]:A.current)||d,q=m.contains(d,K);!z&&!q&&p&&pe(k,{preventScroll:k===d})})},[r,p,d,z,O,$]),Z(()=>{if(r||!d)return;let D=!1;const K=m.getDocument(d),P=m.activeElement(K);let k=N.current.openEvent;Ze(P);function q(ne){let{open:Ee,reason:fe,event:se,nested:de}=ne;Ee&&(k=se),fe==="escape-key"&&l.domReference.current&&Ze(l.domReference.current),fe==="hover"&&se.type==="mouseleave"&&(T.current=!0),fe==="outside-press"&&(de?(T.current=!1,D=!0):T.current=!(m.isVirtualClick(se)||m.isVirtualPointerEvent(se)))}F.on("openchange",q);const X=K.createElement("span");X.setAttribute("tabindex","-1"),X.setAttribute("aria-hidden","true"),Object.assign(X.style,Ye),C&&h&&h.insertAdjacentElement("afterend",X);function te(){return typeof G.current=="boolean"?ht()||X:G.current.current||X}return()=>{F.off("openchange",q);const ne=m.activeElement(K),Ee=m.contains(L,ne)||j&&ye(j.nodesRef.current,v).some(de=>{var Pe;return m.contains((Pe=de.context)==null?void 0:Pe.elements.floating,ne)});(Ee||k&&["click","mousedown"].includes(k.type))&&l.domReference.current&&Ze(l.domReference.current);const se=te();queueMicrotask(()=>{G.current&&!T.current&&H.isHTMLElement(se)&&(!(se!==ne&&ne!==K.body)||Ee)&&se.focus({preventScroll:D}),X.remove()})}},[r,L,d,G,N,l,F,j,v,C,h]),u.useEffect(()=>{queueMicrotask(()=>{T.current=!1})},[r]),Z(()=>{if(!r&&y)return y.setFocusManagerState({modal:f,closeOnFocusOut:E,open:p,onOpenChange:a,refs:l}),()=>{y.setFocusManagerState(null)}},[r,y,f,p,a,l,E]),Z(()=>{if(r||!d||typeof MutationObserver!="function"||z)return;const D=()=>{const P=d.getAttribute("tabindex"),A=M(),k=m.activeElement(m.getDocument(L)),q=A.indexOf(k);q!==-1&&(x.current=q),U.current.includes("floating")||k!==l.domReference.current&&A.length===0?P!=="0"&&d.setAttribute("tabindex","0"):P!=="-1"&&d.setAttribute("tabindex","-1")};D();const K=new MutationObserver(D);return K.observe(d,{childList:!0,subtree:!0,attributes:!0}),()=>{K.disconnect()}},[r,L,d,l,U,M,z]);function B(D){return r||!g||!f?null:u.createElement(vn,{ref:D==="start"?I:R,onClick:K=>a(!1,K.nativeEvent)},typeof g=="string"?g:"Dismiss")}const re=!r&&Y&&(f?!W:!0)&&(C||f);return u.createElement(u.Fragment,null,re&&u.createElement(Xe,{"data-type":"inside",ref:y==null?void 0:y.beforeInsideRef,onFocus:D=>{if(f){const P=O();pe(o[0]==="reference"?P[0]:P[P.length-1])}else if(y!=null&&y.preserveTabOrder&&y.portalNode)if(T.current=!1,Le(D,y.portalNode)){const P=St()||h;P==null||P.focus()}else{var K;(K=y.beforeOutsideRef.current)==null||K.focus()}}}),!W&&B("start"),n,B("end"),re&&u.createElement(Xe,{"data-type":"inside",ref:y==null?void 0:y.afterInsideRef,onFocus:D=>{if(f)pe(O()[0]);else if(y!=null&&y.preserveTabOrder&&y.portalNode)if(E&&(T.current=!0),Le(D,y.portalNode)){const P=At()||h;P==null||P.focus()}else{var K;(K=y.afterOutsideRef.current)==null||K.focus()}}}))}let qe=0;function En(){const t=/iP(hone|ad|od)|iOS/.test(m.getPlatform()),e=document.body.style,r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth,s=e.left?parseFloat(e.left):window.scrollX,i=e.top?parseFloat(e.top):window.scrollY;if(e.overflow="hidden",o&&(e[r]=o+"px"),t){var c,b;const f=((c=window.visualViewport)==null?void 0:c.offsetLeft)||0,g=((b=window.visualViewport)==null?void 0:b.offsetTop)||0;Object.assign(e,{position:"fixed",top:-(i-Math.floor(g))+"px",left:-(s-Math.floor(f))+"px",right:"0"})}return()=>{Object.assign(e,{overflow:"",[r]:""}),t&&(Object.assign(e,{position:"",top:"",left:"",right:""}),window.scrollTo(s,i))}}let Rt=()=>{};const hn=u.forwardRef(function(e,n){const{lockScroll:r=!1,...o}=e;return Z(()=>{if(r)return qe++,qe===1&&(Rt=En()),()=>{qe--,qe===0&&Rt()}},[r]),u.createElement("div",Ie({ref:n},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))});function yt(t){return H.isHTMLElement(t.target)&&t.target.tagName==="BUTTON"}function wt(t){return m.isTypeableElement(t)}function Rn(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:s}}=t,{enabled:i=!0,event:c="click",toggle:b=!0,ignoreMouse:f=!1,keyboardHandlers:g=!0,stickIfOpen:E=!0}=e,p=u.useRef(),l=u.useRef(!1),v=u.useMemo(()=>({onPointerDown(a){p.current=a.pointerType},onMouseDown(a){const F=p.current;a.button===0&&c!=="click"&&(m.isMouseLikePointerType(F,!0)&&f||(n&&b&&(!(o.current.openEvent&&E)||o.current.openEvent.type==="mousedown")?r(!1,a.nativeEvent,"click"):(a.preventDefault(),r(!0,a.nativeEvent,"click"))))},onClick(a){const F=p.current;if(c==="mousedown"&&p.current){p.current=void 0;return}m.isMouseLikePointerType(F,!0)&&f||(n&&b&&(!(o.current.openEvent&&E)||o.current.openEvent.type==="click")?r(!1,a.nativeEvent,"click"):r(!0,a.nativeEvent,"click"))},onKeyDown(a){p.current=void 0,!(a.defaultPrevented||!g||yt(a))&&(a.key===" "&&!wt(s)&&(a.preventDefault(),l.current=!0),a.key==="Enter"&&r(!(n&&b),a.nativeEvent,"click"))},onKeyUp(a){a.defaultPrevented||!g||yt(a)||wt(s)||a.key===" "&&l.current&&(l.current=!1,r(!(n&&b),a.nativeEvent,"click"))}}),[o,s,c,f,g,r,n,E,b]);return u.useMemo(()=>i?{reference:v}:{},[i,v])}const yn={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},wn={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},xt=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t==null?void 0:t.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t==null?void 0:t.outsidePress)!=null?n:!0}};function xn(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:o,dataRef:s}=t,{enabled:i=!0,escapeKey:c=!0,outsidePress:b=!0,outsidePressEvent:f="pointerdown",referencePress:g=!1,referencePressEvent:E="pointerdown",ancestorScroll:p=!1,bubbles:l,capture:v}=e,a=xe(),F=ie(typeof b=="function"?b:()=>!1),N=typeof b=="function"?F:b,_=u.useRef(!1),h=u.useRef(!1),{escapeKey:L,outsidePress:z}=xt(l),{escapeKey:W,outsidePress:Y}=xt(v),U=u.useRef(!1),$=ie(T=>{var w;if(!n||!i||!c||T.key!=="Escape"||U.current)return;const x=(w=s.current.floatingContext)==null?void 0:w.nodeId,C=a?ye(a.nodesRef.current,x):[];if(!L&&(T.stopPropagation(),C.length>0)){let d=!0;if(C.forEach(M=>{var O;if((O=M.context)!=null&&O.open&&!M.context.dataRef.current.__escapeKeyBubbles){d=!1;return}}),!d)return}r(!1,m.isReactEvent(T)?T.nativeEvent:T,"escape-key")}),G=ie(T=>{var w;const x=()=>{var C;$(T),(C=m.getTarget(T))==null||C.removeEventListener("keydown",x)};(w=m.getTarget(T))==null||w.addEventListener("keydown",x)}),j=ie(T=>{var w;const x=_.current;_.current=!1;const C=h.current;if(h.current=!1,f==="click"&&C||x||typeof N=="function"&&!N(T))return;const d=m.getTarget(T),M="["+we("inert")+"]",O=m.getDocument(o.floating).querySelectorAll(M);let B=H.isElement(d)?d:null;for(;B&&!H.isLastTraversableNode(B);){const P=H.getParentNode(B);if(H.isLastTraversableNode(P)||!H.isElement(P))break;B=P}if(O.length&&H.isElement(d)&&!m.isRootElement(d)&&!m.contains(d,o.floating)&&Array.from(O).every(P=>!m.contains(B,P)))return;if(H.isHTMLElement(d)&&R){const P=d.clientWidth>0&&d.scrollWidth>d.clientWidth,A=d.clientHeight>0&&d.scrollHeight>d.clientHeight;let k=A&&T.offsetX>d.clientWidth;if(A&&H.getComputedStyle(d).direction==="rtl"&&(k=T.offsetX<=d.offsetWidth-d.clientWidth),k||P&&T.offsetY>d.clientHeight)return}const re=(w=s.current.floatingContext)==null?void 0:w.nodeId,D=a&&ye(a.nodesRef.current,re).some(P=>{var A;return m.isEventTargetWithin(T,(A=P.context)==null?void 0:A.elements.floating)});if(m.isEventTargetWithin(T,o.floating)||m.isEventTargetWithin(T,o.domReference)||D)return;const K=a?ye(a.nodesRef.current,re):[];if(K.length>0){let P=!0;if(K.forEach(A=>{var k;if((k=A.context)!=null&&k.open&&!A.context.dataRef.current.__outsidePressBubbles){P=!1;return}}),!P)return}r(!1,T,"outside-press")}),y=ie(T=>{var w;const x=()=>{var C;j(T),(C=m.getTarget(T))==null||C.removeEventListener(f,x)};(w=m.getTarget(T))==null||w.addEventListener(f,x)});u.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=L,s.current.__outsidePressBubbles=z;let T=-1;function w(O){r(!1,O,"ancestor-scroll")}function x(){window.clearTimeout(T),U.current=!0}function C(){T=window.setTimeout(()=>{U.current=!1},H.isWebKit()?5:0)}const d=m.getDocument(o.floating);c&&(d.addEventListener("keydown",W?G:$,W),d.addEventListener("compositionstart",x),d.addEventListener("compositionend",C)),N&&d.addEventListener(f,Y?y:j,Y);let M=[];return p&&(H.isElement(o.domReference)&&(M=H.getOverflowAncestors(o.domReference)),H.isElement(o.floating)&&(M=M.concat(H.getOverflowAncestors(o.floating))),!H.isElement(o.reference)&&o.reference&&o.reference.contextElement&&(M=M.concat(H.getOverflowAncestors(o.reference.contextElement)))),M=M.filter(O=>{var B;return O!==((B=d.defaultView)==null?void 0:B.visualViewport)}),M.forEach(O=>{O.addEventListener("scroll",w,{passive:!0})}),()=>{c&&(d.removeEventListener("keydown",W?G:$,W),d.removeEventListener("compositionstart",x),d.removeEventListener("compositionend",C)),N&&d.removeEventListener(f,Y?y:j,Y),M.forEach(O=>{O.removeEventListener("scroll",w)}),window.clearTimeout(T)}},[s,o,c,N,f,n,r,p,i,L,z,$,W,G,j,Y,y]),u.useEffect(()=>{_.current=!1},[N,f]);const I=u.useMemo(()=>({onKeyDown:$,[yn[E]]:T=>{g&&r(!1,T.nativeEvent,"reference-press")}}),[$,r,g,E]),R=u.useMemo(()=>({onKeyDown:$,onMouseDown(){h.current=!0},onMouseUp(){h.current=!0},[wn[f]]:()=>{_.current=!0}}),[$,f]);return u.useMemo(()=>i?{reference:I,floating:R}:{},[i,I,R])}function Ht(t){const{open:e=!1,onOpenChange:n,elements:r}=t,o=Me(),s=u.useRef({}),[i]=u.useState(()=>nn()),c=Oe()!=null;if(process.env.NODE_ENV!=="production"){const l=r.reference;l&&!H.isElement(l)&&en("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[b,f]=u.useState(r.reference),g=ie((l,v,a)=>{s.current.openEvent=l?v:void 0,i.emit("openchange",{open:l,event:v,reason:a,nested:c}),n==null||n(l,v,a)}),E=u.useMemo(()=>({setPositionReference:f}),[]),p=u.useMemo(()=>({reference:b||r.reference||null,floating:r.floating||null,domReference:r.reference}),[b,r.reference,r.floating]);return u.useMemo(()=>({dataRef:s,open:e,onOpenChange:g,elements:p,events:i,floatingId:o,refs:E}),[e,g,p,i,o,E])}function Tn(t){t===void 0&&(t={});const{nodeId:e}=t,n=Ht({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,o=r.elements,[s,i]=u.useState(null),[c,b]=u.useState(null),g=(o==null?void 0:o.domReference)||s,E=u.useRef(null),p=xe();Z(()=>{g&&(E.current=g)},[g]);const l=Ce.useFloating({...t,elements:{...o,...c&&{reference:c}}}),v=u.useCallback(h=>{const L=H.isElement(h)?{getBoundingClientRect:()=>h.getBoundingClientRect(),contextElement:h}:h;b(L),l.refs.setReference(L)},[l.refs]),a=u.useCallback(h=>{(H.isElement(h)||h===null)&&(E.current=h,i(h)),(H.isElement(l.refs.reference.current)||l.refs.reference.current===null||h!==null&&!H.isElement(h))&&l.refs.setReference(h)},[l.refs]),F=u.useMemo(()=>({...l.refs,setReference:a,setPositionReference:v,domReference:E}),[l.refs,a,v]),N=u.useMemo(()=>({...l.elements,domReference:g}),[l.elements,g]),_=u.useMemo(()=>({...l,...r,refs:F,elements:N,nodeId:e}),[l,F,N,e,r]);return Z(()=>{r.dataRef.current.floatingContext=_;const h=p==null?void 0:p.nodesRef.current.find(L=>L.id===e);h&&(h.context=_)}),u.useMemo(()=>({...l,context:_,refs:F,elements:N}),[l,F,N,_])}function In(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,events:o,dataRef:s,elements:i}=t,{enabled:c=!0,visibleOnly:b=!0}=e,f=u.useRef(!1),g=u.useRef(),E=u.useRef(!0);u.useEffect(()=>{if(!c)return;const l=H.getWindow(i.domReference);function v(){!n&&H.isHTMLElement(i.domReference)&&i.domReference===m.activeElement(m.getDocument(i.domReference))&&(f.current=!0)}function a(){E.current=!0}return l.addEventListener("blur",v),l.addEventListener("keydown",a,!0),()=>{l.removeEventListener("blur",v),l.removeEventListener("keydown",a,!0)}},[i.domReference,n,c]),u.useEffect(()=>{if(!c)return;function l(v){let{reason:a}=v;(a==="reference-press"||a==="escape-key")&&(f.current=!0)}return o.on("openchange",l),()=>{o.off("openchange",l)}},[o,c]),u.useEffect(()=>()=>{clearTimeout(g.current)},[]);const p=u.useMemo(()=>({onPointerDown(l){m.isVirtualPointerEvent(l.nativeEvent)||(E.current=!1)},onMouseLeave(){f.current=!1},onFocus(l){if(f.current)return;const v=m.getTarget(l.nativeEvent);if(b&&H.isElement(v))try{if(m.isSafari()&&m.isMac())throw Error();if(!v.matches(":focus-visible"))return}catch{if(!E.current&&!m.isTypeableElement(v))return}r(!0,l.nativeEvent,"focus")},onBlur(l){f.current=!1;const v=l.relatedTarget,a=l.nativeEvent,F=H.isElement(v)&&v.hasAttribute(we("focus-guard"))&&v.getAttribute("data-type")==="outside";g.current=window.setTimeout(()=>{var N;const _=m.activeElement(i.domReference?i.domReference.ownerDocument:document);!v&&_===i.domReference||m.contains((N=s.current.floatingContext)==null?void 0:N.refs.floating.current,_)||m.contains(i.domReference,_)||F||r(!1,a,"focus")})}}),[s,i.domReference,r,b]);return u.useMemo(()=>c?{reference:p}:{},[c,p])}const Tt="active",It="selected";function Je(t,e,n){const r=new Map,o=n==="item";let s=t;if(o&&t){const{[Tt]:i,[It]:c,...b}=t;s=b}return{...n==="floating"&&{tabIndex:-1,[tt]:""},...s,...e.map(i=>{const c=i?i[n]:null;return typeof c=="function"?t?c(t):null:c}).concat(t).reduce((i,c)=>(c&&Object.entries(c).forEach(b=>{let[f,g]=b;if(!(o&&[Tt,It].includes(f)))if(f.indexOf("on")===0){if(r.has(f)||r.set(f,[]),typeof g=="function"){var E;(E=r.get(f))==null||E.push(g),i[f]=function(){for(var p,l=arguments.length,v=new Array(l),a=0;a<l;a++)v[a]=arguments[a];return(p=r.get(f))==null?void 0:p.map(F=>F(...v)).find(F=>F!==void 0)}}}else i[f]=g}),i),{})}}function Cn(t){t===void 0&&(t=[]);const e=t.map(c=>c==null?void 0:c.reference),n=t.map(c=>c==null?void 0:c.floating),r=t.map(c=>c==null?void 0:c.item),o=u.useCallback(c=>Je(c,t,"reference"),e),s=u.useCallback(c=>Je(c,t,"floating"),n),i=u.useCallback(c=>Je(c,t,"item"),r);return u.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}let Ct=!1;function ze(t,e,n){switch(t){case"vertical":return e;case"horizontal":return n;default:return e||n}}function Mt(t,e){return ze(e,t===nt||t===Ne,t===ve||t===be)}function et(t,e,n){return ze(e,t===Ne,n?t===ve:t===be)||t==="Enter"||t===" "||t===""}function Mn(t,e,n){return ze(e,n?t===ve:t===be,t===Ne)}function Ot(t,e,n){return ze(e,n?t===be:t===ve,t===nt)}function On(t,e){const{open:n,onOpenChange:r,elements:o}=t,{listRef:s,activeIndex:i,onNavigate:c=()=>{},enabled:b=!0,selectedIndex:f=null,allowEscape:g=!1,loop:E=!1,nested:p=!1,rtl:l=!1,virtual:v=!1,focusItemOnOpen:a="auto",focusItemOnHover:F=!0,openOnArrowKeyDown:N=!0,disabledIndices:_=void 0,orientation:h="vertical",cols:L=1,scrollItemIntoView:z=!0,virtualItemRef:W,itemSizes:Y,dense:U=!1}=e;process.env.NODE_ENV!=="production"&&(g&&(E||je("`useListNavigation` looping must be enabled to allow escaping."),v||je("`useListNavigation` must be virtual to allow escaping.")),h==="vertical"&&L>1&&je("In grid list navigation mode (`cols` > 1), the `orientation` should",'be either "horizontal" or "both".'));const $=Vt(o.floating),G=ue($),j=Oe(),y=xe(),I=ie(c),R=m.isTypeableCombobox(o.domReference),T=u.useRef(a),w=u.useRef(f??-1),x=u.useRef(null),C=u.useRef(!0),d=u.useRef(I),M=u.useRef(!!o.floating),O=u.useRef(n),B=u.useRef(!1),re=u.useRef(!1),D=ue(_),K=ue(n),P=ue(z),A=ue(f),[k,q]=u.useState(),[X,te]=u.useState(),ne=ie(function(V,J,S){S===void 0&&(S=!1);function Q(ee){v?(q(ee.id),y==null||y.events.emit("virtualfocus",ee),W&&(W.current=ee)):pe(ee,{preventScroll:!0,sync:m.isMac()&&m.isSafari()?Ct||B.current:!1})}const ce=V.current[J.current];ce&&Q(ce),requestAnimationFrame(()=>{const ee=V.current[J.current]||ce;if(!ee)return;ce||Q(ee);const le=P.current;le&&fe&&(S||!C.current)&&(ee.scrollIntoView==null||ee.scrollIntoView(typeof le=="boolean"?{block:"nearest",inline:"nearest"}:le))})});Z(()=>{document.createElement("div").focus({get preventScroll(){return Ct=!0,!1}})},[]),Z(()=>{b&&(n&&o.floating?T.current&&f!=null&&(re.current=!0,w.current=f,I(f)):M.current&&(w.current=-1,d.current(null)))},[b,n,o.floating,f,I]),Z(()=>{if(b&&n&&o.floating)if(i==null){if(B.current=!1,A.current!=null)return;if(M.current&&(w.current=-1,ne(s,w)),(!O.current||!M.current)&&T.current&&(x.current!=null||T.current===!0&&x.current==null)){let V=0;const J=()=>{s.current[0]==null?(V<2&&(V?requestAnimationFrame:queueMicrotask)(J),V++):(w.current=x.current==null||et(x.current,h,l)||p?$e(s,D.current):lt(s,D.current),x.current=null,I(w.current))};J()}}else Fe(s,i)||(w.current=i,ne(s,w,re.current),re.current=!1)},[b,n,o.floating,i,A,p,s,h,l,I,ne,D]),Z(()=>{var V;if(!b||o.floating||!y||v||!M.current)return;const J=y.nodesRef.current,S=(V=J.find(ee=>ee.id===j))==null||(V=V.context)==null?void 0:V.elements.floating,Q=m.activeElement(m.getDocument(o.floating)),ce=J.some(ee=>ee.context&&m.contains(ee.context.elements.floating,Q));S&&!ce&&C.current&&S.focus({preventScroll:!0})},[b,o.floating,y,j,v]),Z(()=>{if(!b||!y||!v||j)return;function V(J){te(J.id),W&&(W.current=J)}return y.events.on("virtualfocus",V),()=>{y.events.off("virtualfocus",V)}},[b,y,v,j,W]),Z(()=>{d.current=I,M.current=!!o.floating}),Z(()=>{n||(x.current=null)},[n]),Z(()=>{O.current=n},[n]);const Ee=i!=null,fe=u.useMemo(()=>{function V(S){if(!n)return;const Q=s.current.indexOf(S);Q!==-1&&I(Q)}return{onFocus(S){let{currentTarget:Q}=S;V(Q)},onClick:S=>{let{currentTarget:Q}=S;return Q.focus({preventScroll:!0})},...F&&{onMouseMove(S){let{currentTarget:Q}=S;V(Q)},onPointerLeave(S){let{pointerType:Q}=S;!C.current||Q==="touch"||(w.current=-1,ne(s,w),I(null),v||pe(G.current,{preventScroll:!0}))}}}},[n,G,ne,F,s,I,v]),se=ie(V=>{if(C.current=!1,B.current=!0,V.which===229||!K.current&&V.currentTarget===G.current)return;if(p&&Ot(V.key,h,l)){m.stopEvent(V),r(!1,V.nativeEvent,"list-navigation"),H.isHTMLElement(o.domReference)&&(v?y==null||y.events.emit("virtualfocus",o.domReference):o.domReference.focus());return}const J=w.current,S=$e(s,_),Q=lt(s,_);if(R||(V.key==="Home"&&(m.stopEvent(V),w.current=S,I(w.current)),V.key==="End"&&(m.stopEvent(V),w.current=Q,I(w.current))),L>1){const ce=Y||Array.from({length:s.current.length},()=>({width:1,height:1})),ee=zt(ce,L,U),le=ee.findIndex(ae=>ae!=null&&!Be(s.current,ae,_)),ke=ee.reduce((ae,me,_e)=>me!=null&&!Be(s.current,me,_)?_e:ae,-1),he=ee[Yt({current:ee.map(ae=>ae!=null?s.current[ae]:null)},{event:V,orientation:h,loop:E,rtl:l,cols:L,disabledIndices:Gt([..._||s.current.map((ae,me)=>Be(s.current,me)?me:void 0),void 0],ee),minIndex:le,maxIndex:ke,prevIndex:$t(w.current>Q?S:w.current,ce,ee,L,V.key===Ne?"bl":V.key===(l?ve:be)?"tr":"tl"),stopEvent:!0})];if(he!=null&&(w.current=he,I(w.current)),h==="both")return}if(Mt(V.key,h)){if(m.stopEvent(V),n&&!v&&m.activeElement(V.currentTarget.ownerDocument)===V.currentTarget){w.current=et(V.key,h,l)?S:Q,I(w.current);return}et(V.key,h,l)?E?w.current=J>=Q?g&&J!==s.current.length?-1:S:oe(s,{startingIndex:J,disabledIndices:_}):w.current=Math.min(Q,oe(s,{startingIndex:J,disabledIndices:_})):E?w.current=J<=S?g&&J!==-1?s.current.length:Q:oe(s,{startingIndex:J,decrement:!0,disabledIndices:_}):w.current=Math.max(S,oe(s,{startingIndex:J,decrement:!0,disabledIndices:_})),Fe(s,w.current)?I(null):I(w.current)}}),de=u.useMemo(()=>v&&n&&Ee&&{"aria-activedescendant":X||k},[v,n,Ee,X,k]),Pe=u.useMemo(()=>({"aria-orientation":h==="both"?void 0:h,...!m.isTypeableCombobox(o.domReference)&&de,onKeyDown:se,onPointerMove(){C.current=!0}}),[de,se,o.domReference,h]),rt=u.useMemo(()=>{function V(S){a==="auto"&&m.isVirtualClick(S.nativeEvent)&&(T.current=!0)}function J(S){T.current=a,a==="auto"&&m.isVirtualPointerEvent(S.nativeEvent)&&(T.current=!0)}return{...de,onKeyDown(S){C.current=!1;const Q=S.key.startsWith("Arrow"),ce=["Home","End"].includes(S.key),ee=Q||ce,le=Mn(S.key,h,l),ke=Ot(S.key,h,l),he=Mt(S.key,h),ae=(p?le:he)||S.key==="Enter"||S.key.trim()==="";if(v&&n){const st=y==null?void 0:y.nodesRef.current.find(Ke=>Ke.parentId==null),ge=y&&st?ln(y.nodesRef.current,st.id):null;if(ee&&ge&&W){const Ke=new KeyboardEvent("keydown",{key:S.key,bubbles:!0});if(le||ke){var me,_e;const Wt=((me=ge.context)==null?void 0:me.elements.domReference)===S.currentTarget,it=ke&&!Wt?(_e=ge.context)==null?void 0:_e.elements.domReference:le?s.current.find(ct=>(ct==null?void 0:ct.id)===k):null;it&&(m.stopEvent(S),it.dispatchEvent(Ke),te(void 0))}if((he||ce)&&ge.context&&ge.context.open&&ge.parentId&&S.currentTarget!==ge.context.elements.domReference){var ot;m.stopEvent(S),(ot=ge.context.elements.domReference)==null||ot.dispatchEvent(Ke);return}}return se(S)}if(!(!n&&!N&&Q)){if(ae&&(x.current=p&&he?null:S.key),p){le&&(m.stopEvent(S),n?(w.current=$e(s,D.current),I(w.current)):r(!0,S.nativeEvent,"list-navigation"));return}he&&(f!=null&&(w.current=f),m.stopEvent(S),!n&&N?r(!0,S.nativeEvent,"list-navigation"):se(S),n&&I(w.current))}},onFocus(){n&&!v&&I(null)},onPointerDown:J,onMouseDown:V,onClick:V}},[k,de,se,D,a,s,p,I,r,n,N,h,l,f,y,v,W]);return u.useMemo(()=>b?{reference:rt,floating:Pe,item:fe}:{},[b,rt,Pe,fe])}const Pn=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function kn(t,e){var n;e===void 0&&(e={});const{open:r,floatingId:o}=t,{enabled:s=!0,role:i="dialog"}=e,c=(n=Pn.get(i))!=null?n:i,b=Me(),g=Oe()!=null,E=u.useMemo(()=>c==="tooltip"||i==="label"?{["aria-"+(i==="label"?"labelledby":"describedby")]:r?o:void 0}:{"aria-expanded":r?"true":"false","aria-haspopup":c==="alertdialog"?"dialog":c,"aria-controls":r?o:void 0,...c==="listbox"&&{role:"combobox"},...c==="menu"&&{id:b},...c==="menu"&&g&&{role:"menuitem"},...i==="select"&&{"aria-autocomplete":"none"},...i==="combobox"&&{"aria-autocomplete":"list"}},[c,o,g,r,b,i]),p=u.useMemo(()=>{const v={id:o,...c&&{role:c}};return c==="tooltip"||i==="label"?v:{...v,...c==="menu"&&{"aria-labelledby":b}}},[c,o,b,i]),l=u.useCallback(v=>{let{active:a,selected:F}=v;const N={role:"option",...a&&{id:o+"-option"}};switch(i){case"select":return{...N,"aria-selected":a&&F};case"combobox":return{...N,...a&&{"aria-selected":!0}}}return{}},[o,i]);return u.useMemo(()=>s?{reference:E,floating:p,item:l}:{},[s,E,p,l])}function Pt(t,e){const[n,r]=t;let o=!1;const s=e.length;for(let i=0,c=s-1;i<s;c=i++){const[b,f]=e[i]||[0,0],[g,E]=e[c]||[0,0];f>=r!=E>=r&&n<=(g-b)*(r-f)/(E-f)+b&&(o=!o)}return o}function Fn(t,e){return t[0]>=e.x&&t[0]<=e.x+e.width&&t[1]>=e.y&&t[1]<=e.y+e.height}function Ln(t){t===void 0&&(t={});const{buffer:e=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=t;let o,s=!1,i=null,c=null,b=performance.now();function f(E,p){const l=performance.now(),v=l-b;if(i===null||c===null||v===0)return i=E,c=p,b=l,null;const a=E-i,F=p-c,_=Math.sqrt(a*a+F*F)/v;return i=E,c=p,b=l,_}const g=E=>{let{x:p,y:l,placement:v,elements:a,onClose:F,nodeId:N,tree:_}=E;return function(L){function z(){clearTimeout(o),F()}if(clearTimeout(o),!a.domReference||!a.floating||v==null||p==null||l==null)return;const{clientX:W,clientY:Y}=L,U=[W,Y],$=m.getTarget(L),G=L.type==="mouseleave",j=m.contains(a.floating,$),y=m.contains(a.domReference,$),I=a.domReference.getBoundingClientRect(),R=a.floating.getBoundingClientRect(),T=v.split("-")[0],w=p>R.right-R.width/2,x=l>R.bottom-R.height/2,C=Fn(U,I),d=R.width>I.width,M=R.height>I.height,O=(d?I:R).left,B=(d?I:R).right,re=(M?I:R).top,D=(M?I:R).bottom;if(j&&(s=!0,!G))return;if(y&&(s=!1),y&&!G){s=!0;return}if(G&&H.isElement(L.relatedTarget)&&m.contains(a.floating,L.relatedTarget)||_&&ye(_.nodesRef.current,N).some(A=>{let{context:k}=A;return k==null?void 0:k.open}))return;if(T==="top"&&l>=I.bottom-1||T==="bottom"&&l<=I.top+1||T==="left"&&p>=I.right-1||T==="right"&&p<=I.left+1)return z();let K=[];switch(T){case"top":K=[[O,I.top+1],[O,R.bottom-1],[B,R.bottom-1],[B,I.top+1]];break;case"bottom":K=[[O,R.top+1],[O,I.bottom-1],[B,I.bottom-1],[B,R.top+1]];break;case"left":K=[[R.right-1,D],[R.right-1,re],[I.left+1,re],[I.left+1,D]];break;case"right":K=[[I.right-1,D],[I.right-1,re],[R.left+1,re],[R.left+1,D]];break}function P(A){let[k,q]=A;switch(T){case"top":{const X=[d?k+e/2:w?k+e*4:k-e*4,q+e+1],te=[d?k-e/2:w?k+e*4:k-e*4,q+e+1],ne=[[R.left,w||d?R.bottom-e:R.top],[R.right,w?d?R.bottom-e:R.top:R.bottom-e]];return[X,te,...ne]}case"bottom":{const X=[d?k+e/2:w?k+e*4:k-e*4,q-e],te=[d?k-e/2:w?k+e*4:k-e*4,q-e],ne=[[R.left,w||d?R.top+e:R.bottom],[R.right,w?d?R.top+e:R.bottom:R.top+e]];return[X,te,...ne]}case"left":{const X=[k+e+1,M?q+e/2:x?q+e*4:q-e*4],te=[k+e+1,M?q-e/2:x?q+e*4:q-e*4];return[...[[x||M?R.right-e:R.left,R.top],[x?M?R.right-e:R.left:R.right-e,R.bottom]],X,te]}case"right":{const X=[k-e,M?q+e/2:x?q+e*4:q-e*4],te=[k-e,M?q-e/2:x?q+e*4:q-e*4],ne=[[x||M?R.left+e:R.right,R.top],[x?M?R.left+e:R.right:R.left+e,R.bottom]];return[X,te,...ne]}}}if(!Pt([W,Y],K)){if(s&&!C)return z();if(!G&&r){const A=f(L.clientX,L.clientY);if(A!==null&&A<.1)return z()}Pt([W,Y],P([p,l]))?!s&&r&&(o=window.setTimeout(z,40)):z()}}};return g.__options={blockPointerEvents:n},g}exports.getOverflowAncestors=H.getOverflowAncestors;exports.arrow=Ce.arrow;exports.flip=Ce.flip;exports.offset=Ce.offset;exports.shift=Ce.shift;exports.size=Ce.size;exports.FloatingArrow=tn;exports.FloatingFocusManager=bn;exports.FloatingOverlay=hn;exports.FloatingPortal=pn;exports.safePolygon=Ln;exports.useClick=Rn;exports.useDismiss=xn;exports.useFloating=Tn;exports.useFloatingNodeId=sn;exports.useFloatingParentNodeId=Oe;exports.useFloatingPortalNode=_t;exports.useFloatingRootContext=Ht;exports.useFloatingTree=xe;exports.useFocus=In;exports.useHover=cn;exports.useId=Me;exports.useInteractions=Cn;exports.useListNavigation=On;exports.useMergeRefs=jt;exports.useRole=kn;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const St=require("react"),n=require("./floating-ui.react.utils.cjs.js"),le=require("react/jsx-runtime"),N=require("../../utils/dist/floating-ui.utils.dom.cjs.js"),Ce=require("../../../tabbable/dist/index.esm.cjs.js"),Dt=require("react-dom"),we=require("../../react-dom/dist/floating-ui.react-dom.cjs.js");function Tt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const l=Tt(St),Nt=Tt(Dt);function At(e){const t=l.useRef(void 0),o=l.useCallback(r=>{const s=e.map(u=>{if(u!=null){if(typeof u=="function"){const i=u,f=i(r);return typeof f=="function"?f:()=>{i(null)}}return u.current=r,()=>{u.current=null}}});return()=>{s.forEach(u=>u==null?void 0:u())}},e);return l.useMemo(()=>e.every(r=>r==null)?null:r=>{t.current&&(t.current(),t.current=void 0),r!=null&&(t.current=o(r))},e)}const _t="data-floating-ui-focusable",rt="active",ot="selected",Oe="ArrowLeft",ke="ArrowRight",Mt="ArrowUp",je="ArrowDown",Kt={...l};let st=!1,Wt=0;const it=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Wt++;function Vt(){const[e,t]=l.useState(()=>st?it():void 0);return n.useModernLayoutEffect(()=>{e==null&&t(it())},[]),l.useEffect(()=>{st=!0},[]),e}const Ht=Kt.useId,Te=Ht||Vt;let Pe;process.env.NODE_ENV!=="production"&&(Pe=new Set);function Ve(){for(var e,t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];const s="Floating UI: "+o.join(" ");if(!((e=Pe)!=null&&e.has(s))){var u;(u=Pe)==null||u.add(s),console.warn(s)}}function jt(){for(var e,t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];const s="Floating UI: "+o.join(" ");if(!((e=Pe)!=null&&e.has(s))){var u;(u=Pe)==null||u.add(s),console.error(s)}}const Bt=l.forwardRef(function(t,o){const{context:{placement:r,elements:{floating:s},middlewareData:{arrow:u,shift:i}},width:f=14,height:v=7,tipRadius:g=0,strokeWidth:R=0,staticOffset:T,stroke:y,d,style:{transform:E,...a}={},...w}=t;process.env.NODE_ENV!=="production"&&(o||Ve("The `ref` prop is required for `FloatingArrow`."));const O=Te(),[b,h]=l.useState(!1);if(n.useModernLayoutEffect(()=>{if(!s)return;N.getComputedStyle(s).direction==="rtl"&&h(!0)},[s]),!s)return null;const[I,Y]=r.split("-"),B=I==="top"||I==="bottom";let q=T;(B&&i!=null&&i.x||!B&&i!=null&&i.y)&&(q=null);const W=R*2,se=W/2,z=f/2*(g/-8+1),X=v/2*g/4,G=!!d,S=q&&Y==="end"?"bottom":"top";let c=q&&Y==="end"?"right":"left";q&&b&&(c=Y==="end"?"left":"right");const p=(u==null?void 0:u.x)!=null?q||u.x:"",V=(u==null?void 0:u.y)!=null?q||u.y:"",x=d||"M0,0"+(" H"+f)+(" L"+(f-z)+","+(v-X))+(" Q"+f/2+","+v+" "+z+","+(v-X))+" Z",m={top:G?"rotate(180deg)":"",left:G?"rotate(90deg)":"rotate(-90deg)",bottom:G?"":"rotate(180deg)",right:G?"rotate(-90deg)":"rotate(90deg)"}[I];return le.jsxs("svg",{...w,"aria-hidden":!0,ref:o,width:G?f:f+W,height:f,viewBox:"0 0 "+f+" "+(v>f?v:f),style:{position:"absolute",pointerEvents:"none",[c]:p,[S]:V,[I]:B||G?"100%":"calc(100% - "+W/2+"px)",transform:[m,E].filter(M=>!!M).join(" "),...a},children:[W>0&&le.jsx("path",{clipPath:"url(#"+O+")",fill:"none",stroke:y,strokeWidth:W+(d?0:1),d:x}),le.jsx("path",{stroke:W&&!d?w.fill:"none",d:x}),le.jsx("clipPath",{id:O,children:le.jsx("rect",{x:-se,y:se*(G?-1:1),width:f+W,height:f})})]})});function qt(){const e=new Map;return{emit(t,o){var r;(r=e.get(t))==null||r.forEach(s=>s(o))},on(t,o){e.has(t)||e.set(t,new Set),e.get(t).add(o)},off(t,o){var r;(r=e.get(t))==null||r.delete(o)}}}const Yt=l.createContext(null),$t=l.createContext(null),Me=()=>{var e;return((e=l.useContext(Yt))==null?void 0:e.id)||null},ye=()=>l.useContext($t);function Xt(e){const t=Te(),o=ye(),s=Me();return n.useModernLayoutEffect(()=>{if(!t)return;const u={id:t,parentId:s};return o==null||o.addNode(u),()=>{o==null||o.removeNode(u)}},[o,t,s]),t}function he(e){return"data-floating-ui-"+e}function de(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const ut=he("safe-polygon");function qe(e,t,o){if(o&&!n.isMouseLikePointerType(o))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r==null?void 0:r[t]}return e==null?void 0:e[t]}function Ye(e){return typeof e=="function"?e():e}function Gt(e,t){t===void 0&&(t={});const{open:o,onOpenChange:r,dataRef:s,events:u,elements:i}=e,{enabled:f=!0,delay:v=0,handleClose:g=null,mouseOnly:R=!1,restMs:T=0,move:y=!0}=t,d=ye(),E=Me(),a=n.useLatestRef(g),w=n.useLatestRef(v),O=n.useLatestRef(o),b=n.useLatestRef(T),h=l.useRef(),I=l.useRef(-1),Y=l.useRef(),B=l.useRef(-1),q=l.useRef(!0),W=l.useRef(!1),se=l.useRef(()=>{}),z=l.useRef(!1),X=n.useEffectEvent(()=>{var x;const m=(x=s.current.openEvent)==null?void 0:x.type;return(m==null?void 0:m.includes("mouse"))&&m!=="mousedown"});l.useEffect(()=>{if(!f)return;function x(m){let{open:M}=m;M||(de(I),de(B),q.current=!0,z.current=!1)}return u.on("openchange",x),()=>{u.off("openchange",x)}},[f,u]),l.useEffect(()=>{if(!f||!a.current||!o)return;function x(M){X()&&r(!1,M,"hover")}const m=n.getDocument(i.floating).documentElement;return m.addEventListener("mouseleave",x),()=>{m.removeEventListener("mouseleave",x)}},[i.floating,o,r,f,a,X]);const G=l.useCallback(function(x,m,M){m===void 0&&(m=!0),M===void 0&&(M="hover");const k=qe(w.current,"close",h.current);k&&!Y.current?(de(I),I.current=window.setTimeout(()=>r(!1,x,M),k)):m&&(de(I),r(!1,x,M))},[w,r]),S=n.useEffectEvent(()=>{se.current(),Y.current=void 0}),c=n.useEffectEvent(()=>{if(W.current){const x=n.getDocument(i.floating).body;x.style.pointerEvents="",x.removeAttribute(ut),W.current=!1}}),p=n.useEffectEvent(()=>s.current.openEvent?["click","mousedown"].includes(s.current.openEvent.type):!1);l.useEffect(()=>{if(!f)return;function x(D){if(de(I),q.current=!1,R&&!n.isMouseLikePointerType(h.current)||Ye(b.current)>0&&!qe(w.current,"open"))return;const C=qe(w.current,"open",h.current);C?I.current=window.setTimeout(()=>{O.current||r(!0,D,"hover")},C):o||r(!0,D,"hover")}function m(D){if(p()){c();return}se.current();const C=n.getDocument(i.floating);if(de(B),z.current=!1,a.current&&s.current.floatingContext){o||de(I),Y.current=a.current({...s.current.floatingContext,tree:d,x:D.clientX,y:D.clientY,onClose(){c(),S(),p()||G(D,!0,"safe-polygon")}});const K=Y.current;C.addEventListener("mousemove",K),se.current=()=>{C.removeEventListener("mousemove",K)};return}(h.current==="touch"?!n.contains(i.floating,D.relatedTarget):!0)&&G(D)}function M(D){p()||s.current.floatingContext&&(a.current==null||a.current({...s.current.floatingContext,tree:d,x:D.clientX,y:D.clientY,onClose(){c(),S(),p()||G(D)}})(D))}function k(){de(I)}function U(D){p()||G(D,!1)}if(N.isElement(i.domReference)){const D=i.domReference,C=i.floating;return o&&D.addEventListener("mouseleave",M),y&&D.addEventListener("mousemove",x,{once:!0}),D.addEventListener("mouseenter",x),D.addEventListener("mouseleave",m),C&&(C.addEventListener("mouseleave",M),C.addEventListener("mouseenter",k),C.addEventListener("mouseleave",U)),()=>{o&&D.removeEventListener("mouseleave",M),y&&D.removeEventListener("mousemove",x),D.removeEventListener("mouseenter",x),D.removeEventListener("mouseleave",m),C&&(C.removeEventListener("mouseleave",M),C.removeEventListener("mouseenter",k),C.removeEventListener("mouseleave",U))}}},[i,f,e,R,y,G,S,c,r,o,O,d,w,a,s,p,b]),n.useModernLayoutEffect(()=>{var x;if(f&&o&&(x=a.current)!=null&&(x=x.__options)!=null&&x.blockPointerEvents&&X()){W.current=!0;const M=i.floating;if(N.isElement(i.domReference)&&M){var m;const k=n.getDocument(i.floating).body;k.setAttribute(ut,"");const U=i.domReference,D=d==null||(m=d.nodesRef.current.find(C=>C.id===E))==null||(m=m.context)==null?void 0:m.elements.floating;return D&&(D.style.pointerEvents=""),k.style.pointerEvents="none",U.style.pointerEvents="auto",M.style.pointerEvents="auto",()=>{k.style.pointerEvents="",U.style.pointerEvents="",M.style.pointerEvents=""}}}},[f,o,E,i,d,a,X]),n.useModernLayoutEffect(()=>{o||(h.current=void 0,z.current=!1,S(),c())},[o,S,c]),l.useEffect(()=>()=>{S(),de(I),de(B),c()},[f,i.domReference,S,c]);const V=l.useMemo(()=>{function x(m){h.current=m.pointerType}return{onPointerDown:x,onPointerEnter:x,onMouseMove(m){const{nativeEvent:M}=m;function k(){!q.current&&!O.current&&r(!0,M,"hover")}R&&!n.isMouseLikePointerType(h.current)||o||Ye(b.current)===0||z.current&&m.movementX**2+m.movementY**2<2||(de(B),h.current==="touch"?k():(z.current=!0,B.current=window.setTimeout(k,Ye(b.current))))}}},[R,r,o,O,b]);return l.useMemo(()=>f?{reference:V}:{},[f,V])}let ct=0;function Re(e,t){t===void 0&&(t={});const{preventScroll:o=!1,cancelPrevious:r=!0,sync:s=!1}=t;r&&cancelAnimationFrame(ct);const u=()=>e==null?void 0:e.focus({preventScroll:o});s?u():ct=requestAnimationFrame(u)}function $e(e,t){if(!e||!t)return!1;const o=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(o&&N.isShadowRoot(o)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Ut(e){return"composedPath"in e?e.composedPath()[0]:e.target}function zt(e){return(e==null?void 0:e.ownerDocument)||document}const xe={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function lt(e){return e==="inert"?xe.inert:e==="aria-hidden"?xe["aria-hidden"]:xe.none}let Ae=new WeakSet,_e={},Xe=0;const Qt=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype;function It(e){return e?N.isShadowRoot(e)?e.host:It(e.parentNode):null}const Zt=(e,t)=>t.map(o=>{if(e.contains(o))return o;const r=It(o);return e.contains(r)?r:null}).filter(o=>o!=null);function Jt(e,t,o,r){const s="data-floating-ui-inert",u=r?"inert":o?"aria-hidden":null,i=Zt(t,e),f=new Set,v=new Set(i),g=[];_e[s]||(_e[s]=new WeakMap);const R=_e[s];i.forEach(T),y(t),f.clear();function T(d){!d||f.has(d)||(f.add(d),d.parentNode&&T(d.parentNode))}function y(d){!d||v.has(d)||[].forEach.call(d.children,E=>{if(N.getNodeName(E)!=="script")if(f.has(E))y(E);else{const a=u?E.getAttribute(u):null,w=a!==null&&a!=="false",O=lt(u),b=(O.get(E)||0)+1,h=(R.get(E)||0)+1;O.set(E,b),R.set(E,h),g.push(E),b===1&&w&&Ae.add(E),h===1&&E.setAttribute(s,""),!w&&u&&E.setAttribute(u,u==="inert"?"":"true")}})}return Xe++,()=>{g.forEach(d=>{const E=lt(u),w=(E.get(d)||0)-1,O=(R.get(d)||0)-1;E.set(d,w),R.set(d,O),w||(!Ae.has(d)&&u&&d.removeAttribute(u),Ae.delete(d)),O||d.removeAttribute(s)}),Xe--,Xe||(xe.inert=new WeakMap,xe["aria-hidden"]=new WeakMap,xe.none=new WeakMap,Ae=new WeakSet,_e={})}}function at(e,t,o){t===void 0&&(t=!1),o===void 0&&(o=!1);const r=zt(e[0]).body;return Jt(e.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))),r,t,o)}const Qe={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},He=l.forwardRef(function(t,o){const[r,s]=l.useState();n.useModernLayoutEffect(()=>{n.isSafari()&&s("button")},[]);const u={ref:o,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[he("focus-guard")]:"",style:Qe};return le.jsx("span",{...t,...u})}),en={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Lt=l.createContext(null),ft=he("portal");function Ct(e){e===void 0&&(e={});const{id:t,root:o}=e,r=Te(),s=Pt(),[u,i]=l.useState(null),f=l.useRef(null);return n.useModernLayoutEffect(()=>()=>{u==null||u.remove(),queueMicrotask(()=>{f.current=null})},[u]),n.useModernLayoutEffect(()=>{if(!r||f.current)return;const v=t?document.getElementById(t):null;if(!v)return;const g=document.createElement("div");g.id=r,g.setAttribute(ft,""),v.appendChild(g),f.current=g,i(g)},[t,r]),n.useModernLayoutEffect(()=>{if(o===null||!r||f.current)return;let v=o||(s==null?void 0:s.portalNode);v&&!N.isNode(v)&&(v=v.current),v=v||document.body;let g=null;t&&(g=document.createElement("div"),g.id=t,v.appendChild(g));const R=document.createElement("div");R.id=r,R.setAttribute(ft,""),v=g||v,v.appendChild(R),f.current=R,i(R)},[t,o,r,s]),u}function tn(e){const{children:t,id:o,root:r,preserveTabOrder:s=!0}=e,u=Ct({id:o,root:r}),[i,f]=l.useState(null),v=l.useRef(null),g=l.useRef(null),R=l.useRef(null),T=l.useRef(null),y=i==null?void 0:i.modal,d=i==null?void 0:i.open,E=!!i&&!i.modal&&i.open&&s&&!!(r||u);return l.useEffect(()=>{if(!u||!s||y)return;function a(w){u&&n.isOutsideEvent(w)&&(w.type==="focusin"?n.enableFocusInside:n.disableFocusInside)(u)}return u.addEventListener("focusin",a,!0),u.addEventListener("focusout",a,!0),()=>{u.removeEventListener("focusin",a,!0),u.removeEventListener("focusout",a,!0)}},[u,s,y]),l.useEffect(()=>{u&&(d||n.enableFocusInside(u))},[d,u]),le.jsxs(Lt.Provider,{value:l.useMemo(()=>({preserveTabOrder:s,beforeOutsideRef:v,afterOutsideRef:g,beforeInsideRef:R,afterInsideRef:T,portalNode:u,setFocusManagerState:f}),[s,u]),children:[E&&u&&le.jsx(He,{"data-type":"outside",ref:v,onFocus:a=>{if(n.isOutsideEvent(a,u)){var w;(w=R.current)==null||w.focus()}else{const O=i?i.domReference:null,b=n.getPreviousTabbable(O);b==null||b.focus()}}}),E&&u&&le.jsx("span",{"aria-owns":u.id,style:en}),u&&Nt.createPortal(t,u),E&&u&&le.jsx(He,{"data-type":"outside",ref:g,onFocus:a=>{if(n.isOutsideEvent(a,u)){var w;(w=T.current)==null||w.focus()}else{const O=i?i.domReference:null,b=n.getNextTabbable(O);b==null||b.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,a.nativeEvent,"focus-out"))}}})]})}const Pt=()=>l.useContext(Lt);function dt(e){return l.useMemo(()=>t=>{e.forEach(o=>{o&&(o.current=t)})},e)}const mt=20;let Ee=[];function Ze(){Ee=Ee.filter(e=>{var t;return(t=e.deref())==null?void 0:t.isConnected})}function nn(e){Ze(),e&&N.getNodeName(e)!=="body"&&(Ee.push(new WeakRef(e)),Ee.length>mt&&(Ee=Ee.slice(-mt)))}function gt(){Ze();const e=Ee[Ee.length-1];return e==null?void 0:e.deref()}function rn(e){const t=n.getTabbableOptions();return Ce.isTabbable(e,t)?e:Ce.tabbable(e,t)[0]||e}function pt(e,t){var o;if(!t.current.includes("floating")&&!((o=e.getAttribute("role"))!=null&&o.includes("dialog")))return;const r=n.getTabbableOptions(),u=Ce.focusable(e,r).filter(f=>{const v=f.getAttribute("data-tabindex")||"";return Ce.isTabbable(f,r)||f.hasAttribute("data-tabindex")&&!v.startsWith("-")}),i=e.getAttribute("tabindex");t.current.includes("floating")||u.length===0?i!=="0"&&e.setAttribute("tabindex","0"):(i!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}const on=l.forwardRef(function(t,o){return le.jsx("button",{...t,type:"button",ref:o,tabIndex:-1,style:Qe})});function sn(e){const{context:t,children:o,disabled:r=!1,order:s=["content"],guards:u=!0,initialFocus:i=0,returnFocus:f=!0,restoreFocus:v=!1,modal:g=!0,visuallyHiddenDismiss:R=!1,closeOnFocusOut:T=!0,outsideElementsInert:y=!1,getInsideElements:d=()=>[]}=e,{open:E,onOpenChange:a,events:w,dataRef:O,elements:{domReference:b,floating:h}}=t,I=n.useEffectEvent(()=>{var F;return(F=O.current.floatingContext)==null?void 0:F.nodeId}),Y=n.useEffectEvent(d),B=typeof i=="number"&&i<0,q=n.isTypeableCombobox(b)&&B,W=Qt(),se=W?u:!0,z=!se||W&&y,X=n.useLatestRef(s),G=n.useLatestRef(i),S=n.useLatestRef(f),c=ye(),p=Pt(),V=l.useRef(null),x=l.useRef(null),m=l.useRef(!1),M=l.useRef(!1),k=l.useRef(-1),U=l.useRef(-1),D=p!=null,C=n.getFloatingFocusElement(h),Q=n.useEffectEvent(function(F){return F===void 0&&(F=C),F?Ce.tabbable(F,n.getTabbableOptions()):[]}),K=n.useEffectEvent(F=>{const H=Q(F);return X.current.map(A=>b&&A==="reference"?b:C&&A==="floating"?C:H).filter(Boolean).flat()});l.useEffect(()=>{if(r||!g)return;function F(A){if(A.key==="Tab"){n.contains(C,n.activeElement(n.getDocument(C)))&&Q().length===0&&!q&&n.stopEvent(A);const Z=K(),ne=n.getTarget(A);X.current[0]==="reference"&&ne===b&&(n.stopEvent(A),A.shiftKey?Re(Z[Z.length-1]):Re(Z[1])),X.current[1]==="floating"&&ne===C&&A.shiftKey&&(n.stopEvent(A),Re(Z[0]))}}const H=n.getDocument(C);return H.addEventListener("keydown",F),()=>{H.removeEventListener("keydown",F)}},[r,b,C,g,X,q,Q,K]),l.useEffect(()=>{if(r||!h)return;function F(H){const A=n.getTarget(H),ne=Q().indexOf(A);ne!==-1&&(k.current=ne)}return h.addEventListener("focusin",F),()=>{h.removeEventListener("focusin",F)}},[r,h,Q]),l.useEffect(()=>{if(r||!T)return;function F(){M.current=!0,setTimeout(()=>{M.current=!1})}function H(ne){const j=ne.relatedTarget,fe=ne.currentTarget,ce=n.getTarget(ne);queueMicrotask(()=>{const ae=I(),pe=!(n.contains(b,j)||n.contains(h,j)||n.contains(j,h)||n.contains(p==null?void 0:p.portalNode,j)||j!=null&&j.hasAttribute(he("focus-guard"))||c&&(n.getNodeChildren(c.nodesRef.current,ae).find(P=>{var _,L;return n.contains((_=P.context)==null?void 0:_.elements.floating,j)||n.contains((L=P.context)==null?void 0:L.elements.domReference,j)})||n.getNodeAncestors(c.nodesRef.current,ae).find(P=>{var _,L,$;return[(_=P.context)==null?void 0:_.elements.floating,n.getFloatingFocusElement((L=P.context)==null?void 0:L.elements.floating)].includes(j)||(($=P.context)==null?void 0:$.elements.domReference)===j})));if(fe===b&&C&&pt(C,X),v&&fe!==b&&!(ce!=null&&ce.isConnected)&&n.activeElement(n.getDocument(C))===n.getDocument(C).body){N.isHTMLElement(C)&&C.focus();const P=k.current,_=Q(),L=_[P]||_[_.length-1]||C;N.isHTMLElement(L)&&L.focus()}if(O.current.insideReactTree){O.current.insideReactTree=!1;return}(q||!g)&&j&&pe&&!M.current&&j!==gt()&&(m.current=!0,a(!1,ne,"focus-out"))})}const A=!!(!c&&p);function Z(){de(U),O.current.insideReactTree=!0,U.current=window.setTimeout(()=>{O.current.insideReactTree=!1})}if(h&&N.isHTMLElement(b))return b.addEventListener("focusout",H),b.addEventListener("pointerdown",F),h.addEventListener("focusout",H),A&&h.addEventListener("focusout",Z,!0),()=>{b.removeEventListener("focusout",H),b.removeEventListener("pointerdown",F),h.removeEventListener("focusout",H),A&&h.removeEventListener("focusout",Z,!0)}},[r,b,h,C,g,c,p,a,T,v,Q,q,I,X,O]);const re=l.useRef(null),ie=l.useRef(null),ee=dt([re,p==null?void 0:p.beforeInsideRef]),te=dt([ie,p==null?void 0:p.afterInsideRef]);l.useEffect(()=>{var F,H;if(r||!h)return;const A=Array.from((p==null||(F=p.portalNode)==null?void 0:F.querySelectorAll("["+he("portal")+"]"))||[]),ne=(H=(c?n.getNodeAncestors(c.nodesRef.current,I()):[]).find(ce=>{var ae;return n.isTypeableCombobox(((ae=ce.context)==null?void 0:ae.elements.domReference)||null)}))==null||(H=H.context)==null?void 0:H.elements.domReference,j=[h,ne,...A,...Y(),V.current,x.current,re.current,ie.current,p==null?void 0:p.beforeOutsideRef.current,p==null?void 0:p.afterOutsideRef.current,X.current.includes("reference")||q?b:null].filter(ce=>ce!=null),fe=g||q?at(j,!z,z):at(j);return()=>{fe()}},[r,b,h,g,X,p,q,se,z,c,I,Y]),n.useModernLayoutEffect(()=>{if(r||!N.isHTMLElement(C))return;const F=n.getDocument(C),H=n.activeElement(F);queueMicrotask(()=>{const A=K(C),Z=G.current,ne=(typeof Z=="number"?A[Z]:Z.current)||C,j=n.contains(C,H);!B&&!j&&E&&Re(ne,{preventScroll:ne===C})})},[r,E,C,B,K,G]),n.useModernLayoutEffect(()=>{if(r||!C)return;const F=n.getDocument(C),H=n.activeElement(F);nn(H);function A(j){let{reason:fe,event:ce,nested:ae}=j;if(["hover","safe-polygon"].includes(fe)&&ce.type==="mouseleave"&&(m.current=!0),fe==="outside-press")if(ae)m.current=!1;else if(n.isVirtualClick(ce)||n.isVirtualPointerEvent(ce))m.current=!1;else{let pe=!1;document.createElement("div").focus({get preventScroll(){return pe=!0,!1}}),pe?m.current=!1:m.current=!0}}w.on("openchange",A);const Z=F.createElement("span");Z.setAttribute("tabindex","-1"),Z.setAttribute("aria-hidden","true"),Object.assign(Z.style,Qe),D&&b&&b.insertAdjacentElement("afterend",Z);function ne(){if(typeof S.current=="boolean"){const j=b||gt();return j&&j.isConnected?j:Z}return S.current.current||Z}return()=>{w.off("openchange",A);const j=n.activeElement(F),fe=n.contains(h,j)||c&&n.getNodeChildren(c.nodesRef.current,I(),!1).some(ae=>{var pe;return n.contains((pe=ae.context)==null?void 0:pe.elements.floating,j)}),ce=ne();queueMicrotask(()=>{const ae=rn(ce);S.current&&!m.current&&N.isHTMLElement(ae)&&(!(ae!==j&&j!==F.body)||fe)&&ae.focus({preventScroll:!0}),Z.remove()})}},[r,h,C,S,O,w,c,D,b,I]),l.useEffect(()=>(queueMicrotask(()=>{m.current=!1}),()=>{queueMicrotask(Ze)}),[r]),n.useModernLayoutEffect(()=>{if(!r&&p)return p.setFocusManagerState({modal:g,closeOnFocusOut:T,open:E,onOpenChange:a,domReference:b}),()=>{p.setFocusManagerState(null)}},[r,p,g,E,a,T,b]),n.useModernLayoutEffect(()=>{r||C&&pt(C,X)},[r,C,X]);function ue(F){return r||!R||!g?null:le.jsx(on,{ref:F==="start"?V:x,onClick:H=>a(!1,H.nativeEvent),children:typeof R=="string"?R:"Dismiss"})}const me=!r&&se&&(g?!q:!0)&&(D||g);return le.jsxs(le.Fragment,{children:[me&&le.jsx(He,{"data-type":"inside",ref:ee,onFocus:F=>{if(g){const A=K();Re(s[0]==="reference"?A[0]:A[A.length-1])}else if(p!=null&&p.preserveTabOrder&&p.portalNode)if(m.current=!1,n.isOutsideEvent(F,p.portalNode)){const A=n.getNextTabbable(b);A==null||A.focus()}else{var H;(H=p.beforeOutsideRef.current)==null||H.focus()}}}),!q&&ue("start"),o,ue("end"),me&&le.jsx(He,{"data-type":"inside",ref:te,onFocus:F=>{if(g)Re(K()[0]);else if(p!=null&&p.preserveTabOrder&&p.portalNode)if(T&&(m.current=!0),n.isOutsideEvent(F,p.portalNode)){const A=n.getPreviousTabbable(b);A==null||A.focus()}else{var H;(H=p.afterOutsideRef.current)==null||H.focus()}}})]})}let Ke=0;const vt="--floating-ui-scrollbar-width";function un(){const e=n.getPlatform(),t=/iP(hone|ad|od)|iOS/.test(e)||e==="MacIntel"&&navigator.maxTouchPoints>1,o=document.body.style,s=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",u=window.innerWidth-document.documentElement.clientWidth,i=o.left?parseFloat(o.left):window.scrollX,f=o.top?parseFloat(o.top):window.scrollY;if(o.overflow="hidden",o.setProperty(vt,u+"px"),u&&(o[s]=u+"px"),t){var v,g;const R=((v=window.visualViewport)==null?void 0:v.offsetLeft)||0,T=((g=window.visualViewport)==null?void 0:g.offsetTop)||0;Object.assign(o,{position:"fixed",top:-(f-Math.floor(T))+"px",left:-(i-Math.floor(R))+"px",right:"0"})}return()=>{Object.assign(o,{overflow:"",[s]:""}),o.removeProperty(vt),t&&(Object.assign(o,{position:"",top:"",left:"",right:""}),window.scrollTo(i,f))}}let Et=()=>{};const cn=l.forwardRef(function(t,o){const{lockScroll:r=!1,...s}=t;return n.useModernLayoutEffect(()=>{if(r)return Ke++,Ke===1&&(Et=un()),()=>{Ke--,Ke===0&&Et()}},[r]),le.jsx("div",{ref:o,...s,style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...s.style}})});function bt(e){return N.isHTMLElement(e.target)&&e.target.tagName==="BUTTON"}function ln(e){return N.isHTMLElement(e.target)&&e.target.tagName==="A"}function Rt(e){return n.isTypeableElement(e)}function an(e,t){t===void 0&&(t={});const{open:o,onOpenChange:r,dataRef:s,elements:{domReference:u}}=e,{enabled:i=!0,event:f="click",toggle:v=!0,ignoreMouse:g=!1,keyboardHandlers:R=!0,stickIfOpen:T=!0}=t,y=l.useRef(),d=l.useRef(!1),E=l.useMemo(()=>({onPointerDown(a){y.current=a.pointerType},onMouseDown(a){const w=y.current;a.button===0&&f!=="click"&&(n.isMouseLikePointerType(w,!0)&&g||(o&&v&&(!(s.current.openEvent&&T)||s.current.openEvent.type==="mousedown")?r(!1,a.nativeEvent,"click"):(a.preventDefault(),r(!0,a.nativeEvent,"click"))))},onClick(a){const w=y.current;if(f==="mousedown"&&y.current){y.current=void 0;return}n.isMouseLikePointerType(w,!0)&&g||(o&&v&&(!(s.current.openEvent&&T)||s.current.openEvent.type==="click")?r(!1,a.nativeEvent,"click"):r(!0,a.nativeEvent,"click"))},onKeyDown(a){y.current=void 0,!(a.defaultPrevented||!R||bt(a))&&(a.key===" "&&!Rt(u)&&(a.preventDefault(),d.current=!0),!ln(a)&&a.key==="Enter"&&r(!(o&&v),a.nativeEvent,"click"))},onKeyUp(a){a.defaultPrevented||!R||bt(a)||Rt(u)||a.key===" "&&d.current&&(d.current=!1,r(!(o&&v),a.nativeEvent,"click"))}}),[s,u,f,g,R,r,o,T,v]);return l.useMemo(()=>i?{reference:E}:{},[i,E])}const fn={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},dn={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},ht=e=>{var t,o;return{escapeKey:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(o=e==null?void 0:e.outsidePress)!=null?o:!0}};function mn(e,t){t===void 0&&(t={});const{open:o,onOpenChange:r,elements:s,dataRef:u}=e,{enabled:i=!0,escapeKey:f=!0,outsidePress:v=!0,outsidePressEvent:g="pointerdown",referencePress:R=!1,referencePressEvent:T="pointerdown",ancestorScroll:y=!1,bubbles:d,capture:E}=t,a=ye(),w=n.useEffectEvent(typeof v=="function"?v:()=>!1),O=typeof v=="function"?w:v,b=l.useRef(!1),{escapeKey:h,outsidePress:I}=ht(d),{escapeKey:Y,outsidePress:B}=ht(E),q=l.useRef(!1),W=n.useEffectEvent(c=>{var p;if(!o||!i||!f||c.key!=="Escape"||q.current)return;const V=(p=u.current.floatingContext)==null?void 0:p.nodeId,x=a?n.getNodeChildren(a.nodesRef.current,V):[];if(!h&&(c.stopPropagation(),x.length>0)){let m=!0;if(x.forEach(M=>{var k;if((k=M.context)!=null&&k.open&&!M.context.dataRef.current.__escapeKeyBubbles){m=!1;return}}),!m)return}r(!1,n.isReactEvent(c)?c.nativeEvent:c,"escape-key")}),se=n.useEffectEvent(c=>{var p;const V=()=>{var x;W(c),(x=n.getTarget(c))==null||x.removeEventListener("keydown",V)};(p=n.getTarget(c))==null||p.addEventListener("keydown",V)}),z=n.useEffectEvent(c=>{var p;const V=u.current.insideReactTree;u.current.insideReactTree=!1;const x=b.current;if(b.current=!1,g==="click"&&x||V||typeof O=="function"&&!O(c))return;const m=n.getTarget(c),M="["+he("inert")+"]",k=n.getDocument(s.floating).querySelectorAll(M);let U=N.isElement(m)?m:null;for(;U&&!N.isLastTraversableNode(U);){const K=N.getParentNode(U);if(N.isLastTraversableNode(K)||!N.isElement(K))break;U=K}if(k.length&&N.isElement(m)&&!n.isRootElement(m)&&!n.contains(m,s.floating)&&Array.from(k).every(K=>!n.contains(U,K)))return;if(N.isHTMLElement(m)&&S){const K=N.isLastTraversableNode(m),re=N.getComputedStyle(m),ie=/auto|scroll/,ee=K||ie.test(re.overflowX),te=K||ie.test(re.overflowY),ue=ee&&m.clientWidth>0&&m.scrollWidth>m.clientWidth,me=te&&m.clientHeight>0&&m.scrollHeight>m.clientHeight,F=re.direction==="rtl",H=me&&(F?c.offsetX<=m.offsetWidth-m.clientWidth:c.offsetX>m.clientWidth),A=ue&&c.offsetY>m.clientHeight;if(H||A)return}const D=(p=u.current.floatingContext)==null?void 0:p.nodeId,C=a&&n.getNodeChildren(a.nodesRef.current,D).some(K=>{var re;return n.isEventTargetWithin(c,(re=K.context)==null?void 0:re.elements.floating)});if(n.isEventTargetWithin(c,s.floating)||n.isEventTargetWithin(c,s.domReference)||C)return;const Q=a?n.getNodeChildren(a.nodesRef.current,D):[];if(Q.length>0){let K=!0;if(Q.forEach(re=>{var ie;if((ie=re.context)!=null&&ie.open&&!re.context.dataRef.current.__outsidePressBubbles){K=!1;return}}),!K)return}r(!1,c,"outside-press")}),X=n.useEffectEvent(c=>{var p;const V=()=>{var x;z(c),(x=n.getTarget(c))==null||x.removeEventListener(g,V)};(p=n.getTarget(c))==null||p.addEventListener(g,V)});l.useEffect(()=>{if(!o||!i)return;u.current.__escapeKeyBubbles=h,u.current.__outsidePressBubbles=I;let c=-1;function p(k){r(!1,k,"ancestor-scroll")}function V(){window.clearTimeout(c),q.current=!0}function x(){c=window.setTimeout(()=>{q.current=!1},N.isWebKit()?5:0)}const m=n.getDocument(s.floating);f&&(m.addEventListener("keydown",Y?se:W,Y),m.addEventListener("compositionstart",V),m.addEventListener("compositionend",x)),O&&m.addEventListener(g,B?X:z,B);let M=[];return y&&(N.isElement(s.domReference)&&(M=N.getOverflowAncestors(s.domReference)),N.isElement(s.floating)&&(M=M.concat(N.getOverflowAncestors(s.floating))),!N.isElement(s.reference)&&s.reference&&s.reference.contextElement&&(M=M.concat(N.getOverflowAncestors(s.reference.contextElement)))),M=M.filter(k=>{var U;return k!==((U=m.defaultView)==null?void 0:U.visualViewport)}),M.forEach(k=>{k.addEventListener("scroll",p,{passive:!0})}),()=>{f&&(m.removeEventListener("keydown",Y?se:W,Y),m.removeEventListener("compositionstart",V),m.removeEventListener("compositionend",x)),O&&m.removeEventListener(g,B?X:z,B),M.forEach(k=>{k.removeEventListener("scroll",p)}),window.clearTimeout(c)}},[u,s,f,O,g,o,r,y,i,h,I,W,Y,se,z,B,X]),l.useEffect(()=>{u.current.insideReactTree=!1},[u,O,g]);const G=l.useMemo(()=>({onKeyDown:W,...R&&{[fn[T]]:c=>{r(!1,c.nativeEvent,"reference-press")},...T!=="click"&&{onClick(c){r(!1,c.nativeEvent,"reference-press")}}}}),[W,r,R,T]),S=l.useMemo(()=>{function c(p){p.button===0&&(b.current=!0)}return{onKeyDown:W,onMouseDown:c,onMouseUp:c,[dn[g]]:()=>{u.current.insideReactTree=!0}}},[W,g,u]);return l.useMemo(()=>i?{reference:G,floating:S}:{},[i,G,S])}function Ot(e){const{open:t=!1,onOpenChange:o,elements:r}=e,s=Te(),u=l.useRef({}),[i]=l.useState(()=>qt()),f=Me()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!N.isElement(d)&&jt("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[v,g]=l.useState(r.reference),R=n.useEffectEvent((d,E,a)=>{u.current.openEvent=d?E:void 0,i.emit("openchange",{open:d,event:E,reason:a,nested:f}),o==null||o(d,E,a)}),T=l.useMemo(()=>({setPositionReference:g}),[]),y=l.useMemo(()=>({reference:v||r.reference||null,floating:r.floating||null,domReference:r.reference}),[v,r.reference,r.floating]);return l.useMemo(()=>({dataRef:u,open:t,onOpenChange:R,elements:y,events:i,floatingId:s,refs:T}),[t,R,y,i,s,T])}function gn(e){e===void 0&&(e={});const{nodeId:t}=e,o=Ot({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||o,s=r.elements,[u,i]=l.useState(null),[f,v]=l.useState(null),R=(s==null?void 0:s.domReference)||u,T=l.useRef(null),y=ye();n.useModernLayoutEffect(()=>{R&&(T.current=R)},[R]);const d=we.useFloating({...e,elements:{...s,...f&&{reference:f}}}),E=l.useCallback(h=>{const I=N.isElement(h)?{getBoundingClientRect:()=>h.getBoundingClientRect(),getClientRects:()=>h.getClientRects(),contextElement:h}:h;v(I),d.refs.setReference(I)},[d.refs]),a=l.useCallback(h=>{(N.isElement(h)||h===null)&&(T.current=h,i(h)),(N.isElement(d.refs.reference.current)||d.refs.reference.current===null||h!==null&&!N.isElement(h))&&d.refs.setReference(h)},[d.refs]),w=l.useMemo(()=>({...d.refs,setReference:a,setPositionReference:E,domReference:T}),[d.refs,a,E]),O=l.useMemo(()=>({...d.elements,domReference:R}),[d.elements,R]),b=l.useMemo(()=>({...d,...r,refs:w,elements:O,nodeId:t}),[d,w,O,t,r]);return n.useModernLayoutEffect(()=>{r.dataRef.current.floatingContext=b;const h=y==null?void 0:y.nodesRef.current.find(I=>I.id===t);h&&(h.context=b)}),l.useMemo(()=>({...d,context:b,refs:w,elements:O}),[d,w,O,b])}function Ge(){return n.isMac()&&n.isSafari()}function pn(e,t){t===void 0&&(t={});const{open:o,onOpenChange:r,events:s,dataRef:u,elements:i}=e,{enabled:f=!0,visibleOnly:v=!0}=t,g=l.useRef(!1),R=l.useRef(-1),T=l.useRef(!0);l.useEffect(()=>{if(!f)return;const d=N.getWindow(i.domReference);function E(){!o&&N.isHTMLElement(i.domReference)&&i.domReference===n.activeElement(n.getDocument(i.domReference))&&(g.current=!0)}function a(){T.current=!0}function w(){T.current=!1}return d.addEventListener("blur",E),Ge()&&(d.addEventListener("keydown",a,!0),d.addEventListener("pointerdown",w,!0)),()=>{d.removeEventListener("blur",E),Ge()&&(d.removeEventListener("keydown",a,!0),d.removeEventListener("pointerdown",w,!0))}},[i.domReference,o,f]),l.useEffect(()=>{if(!f)return;function d(E){let{reason:a}=E;(a==="reference-press"||a==="escape-key")&&(g.current=!0)}return s.on("openchange",d),()=>{s.off("openchange",d)}},[s,f]),l.useEffect(()=>()=>{de(R)},[]);const y=l.useMemo(()=>({onMouseLeave(){g.current=!1},onFocus(d){if(g.current)return;const E=n.getTarget(d.nativeEvent);if(v&&N.isElement(E)){if(Ge()&&!d.relatedTarget){if(!T.current&&!n.isTypeableElement(E))return}else if(!n.matchesFocusVisible(E))return}r(!0,d.nativeEvent,"focus")},onBlur(d){g.current=!1;const E=d.relatedTarget,a=d.nativeEvent,w=N.isElement(E)&&E.hasAttribute(he("focus-guard"))&&E.getAttribute("data-type")==="outside";R.current=window.setTimeout(()=>{var O;const b=n.activeElement(i.domReference?i.domReference.ownerDocument:document);!E&&b===i.domReference||n.contains((O=u.current.floatingContext)==null?void 0:O.refs.floating.current,b)||n.contains(i.domReference,b)||w||r(!1,a,"focus")})}}),[u,i.domReference,r,v]);return l.useMemo(()=>f?{reference:y}:{},[f,y])}function Ue(e,t,o){const r=new Map,s=o==="item";let u=e;if(s&&e){const{[rt]:i,[ot]:f,...v}=e;u=v}return{...o==="floating"&&{tabIndex:-1,[_t]:""},...u,...t.map(i=>{const f=i?i[o]:null;return typeof f=="function"?e?f(e):null:f}).concat(e).reduce((i,f)=>(f&&Object.entries(f).forEach(v=>{let[g,R]=v;if(!(s&&[rt,ot].includes(g)))if(g.indexOf("on")===0){if(r.has(g)||r.set(g,[]),typeof R=="function"){var T;(T=r.get(g))==null||T.push(R),i[g]=function(){for(var y,d=arguments.length,E=new Array(d),a=0;a<d;a++)E[a]=arguments[a];return(y=r.get(g))==null?void 0:y.map(w=>w(...E)).find(w=>w!==void 0)}}}else i[g]=R}),i),{})}}function vn(e){e===void 0&&(e=[]);const t=e.map(f=>f==null?void 0:f.reference),o=e.map(f=>f==null?void 0:f.floating),r=e.map(f=>f==null?void 0:f.item),s=l.useCallback(f=>Ue(f,e,"reference"),t),u=l.useCallback(f=>Ue(f,e,"floating"),o),i=l.useCallback(f=>Ue(f,e,"item"),r);return l.useMemo(()=>({getReferenceProps:s,getFloatingProps:u,getItemProps:i}),[s,u,i])}const En="Escape";function Be(e,t,o){switch(e){case"vertical":return t;case"horizontal":return o;default:return t||o}}function We(e,t){return Be(t,e===Mt||e===je,e===Oe||e===ke)}function ze(e,t,o){return Be(t,e===je,o?e===Oe:e===ke)||e==="Enter"||e===" "||e===""}function yt(e,t,o){return Be(t,o?e===Oe:e===ke,e===je)}function xt(e,t,o,r){const s=o?e===ke:e===Oe,u=e===Mt;return t==="both"||t==="horizontal"&&r&&r>1?e===En:Be(t,s,u)}function bn(e,t){const{open:o,onOpenChange:r,elements:s,floatingId:u}=e,{listRef:i,activeIndex:f,onNavigate:v=()=>{},enabled:g=!0,selectedIndex:R=null,allowEscape:T=!1,loop:y=!1,nested:d=!1,rtl:E=!1,virtual:a=!1,focusItemOnOpen:w="auto",focusItemOnHover:O=!0,openOnArrowKeyDown:b=!0,disabledIndices:h=void 0,orientation:I="vertical",parentOrientation:Y,cols:B=1,scrollItemIntoView:q=!0,virtualItemRef:W,itemSizes:se,dense:z=!1}=t;process.env.NODE_ENV!=="production"&&(T&&(y||Ve("`useListNavigation` looping must be enabled to allow escaping."),a||Ve("`useListNavigation` must be virtual to allow escaping.")),I==="vertical"&&B>1&&Ve("In grid list navigation mode (`cols` > 1), the `orientation` should",'be either "horizontal" or "both".'));const X=n.getFloatingFocusElement(s.floating),G=n.useLatestRef(X),S=Me(),c=ye();n.useModernLayoutEffect(()=>{e.dataRef.current.orientation=I},[e,I]);const p=n.useEffectEvent(()=>{v(m.current===-1?null:m.current)}),V=n.isTypeableCombobox(s.domReference),x=l.useRef(w),m=l.useRef(R??-1),M=l.useRef(null),k=l.useRef(!0),U=l.useRef(p),D=l.useRef(!!s.floating),C=l.useRef(o),Q=l.useRef(!1),K=l.useRef(!1),re=n.useLatestRef(h),ie=n.useLatestRef(o),ee=n.useLatestRef(q),te=n.useLatestRef(R),[ue,me]=l.useState(),[F,H]=l.useState(),A=n.useEffectEvent(()=>{function P(J){if(a){var oe;(oe=J.id)!=null&&oe.endsWith("-fui-option")&&(J.id=u+"-"+Math.random().toString(16).slice(2,10)),me(J.id),c==null||c.events.emit("virtualfocus",J),W&&(W.current=J)}else Re(J,{sync:Q.current,preventScroll:!0})}const _=i.current[m.current],L=K.current;_&&P(_),(Q.current?J=>J():requestAnimationFrame)(()=>{const J=i.current[m.current]||_;if(!J)return;_||P(J);const oe=ee.current;oe&&ne&&(L||!k.current)&&(J.scrollIntoView==null||J.scrollIntoView(typeof oe=="boolean"?{block:"nearest",inline:"nearest"}:oe))})});n.useModernLayoutEffect(()=>{g&&(o&&s.floating?x.current&&R!=null&&(K.current=!0,m.current=R,p()):D.current&&(m.current=-1,U.current()))},[g,o,s.floating,R,p]),n.useModernLayoutEffect(()=>{if(g&&o&&s.floating)if(f==null){if(Q.current=!1,te.current!=null)return;if(D.current&&(m.current=-1,A()),(!C.current||!D.current)&&x.current&&(M.current!=null||x.current===!0&&M.current==null)){let P=0;const _=()=>{i.current[0]==null?(P<2&&(P?requestAnimationFrame:queueMicrotask)(_),P++):(m.current=M.current==null||ze(M.current,I,E)||d?n.getMinListIndex(i,re.current):n.getMaxListIndex(i,re.current),M.current=null,p())};_()}}else n.isIndexOutOfListBounds(i,f)||(m.current=f,A(),K.current=!1)},[g,o,s.floating,f,te,d,i,I,E,p,A,re]),n.useModernLayoutEffect(()=>{var P;if(!g||s.floating||!c||a||!D.current)return;const _=c.nodesRef.current,L=(P=_.find(oe=>oe.id===S))==null||(P=P.context)==null?void 0:P.elements.floating,$=n.activeElement(n.getDocument(s.floating)),J=_.some(oe=>oe.context&&n.contains(oe.context.elements.floating,$));L&&!J&&k.current&&L.focus({preventScroll:!0})},[g,s.floating,c,S,a]),n.useModernLayoutEffect(()=>{if(!g||!c||!a||S)return;function P(_){H(_.id),W&&(W.current=_)}return c.events.on("virtualfocus",P),()=>{c.events.off("virtualfocus",P)}},[g,c,a,S,W]),n.useModernLayoutEffect(()=>{U.current=p,C.current=o,D.current=!!s.floating}),n.useModernLayoutEffect(()=>{o||(M.current=null,x.current=w)},[o,w]);const Z=f!=null,ne=l.useMemo(()=>{function P(L){if(!ie.current)return;const $=i.current.indexOf(L);$!==-1&&m.current!==$&&(m.current=$,p())}return{onFocus(L){let{currentTarget:$}=L;Q.current=!0,P($)},onClick:L=>{let{currentTarget:$}=L;return $.focus({preventScroll:!0})},onMouseMove(L){let{currentTarget:$}=L;Q.current=!0,K.current=!1,O&&P($)},onPointerLeave(L){let{pointerType:$}=L;if(!(!k.current||$==="touch")&&(Q.current=!0,!!O&&(m.current=-1,p(),!a))){var J;(J=G.current)==null||J.focus({preventScroll:!0})}}}},[ie,G,O,i,p,a]),j=l.useCallback(()=>{var P;return Y??(c==null||(P=c.nodesRef.current.find(_=>_.id===S))==null||(P=P.context)==null||(P=P.dataRef)==null?void 0:P.current.orientation)},[S,c,Y]),fe=n.useEffectEvent(P=>{if(k.current=!1,Q.current=!0,P.which===229||!ie.current&&P.currentTarget===G.current)return;if(d&&xt(P.key,I,E,B)){We(P.key,j())||n.stopEvent(P),r(!1,P.nativeEvent,"list-navigation"),N.isHTMLElement(s.domReference)&&(a?c==null||c.events.emit("virtualfocus",s.domReference):s.domReference.focus());return}const _=m.current,L=n.getMinListIndex(i,h),$=n.getMaxListIndex(i,h);if(V||(P.key==="Home"&&(n.stopEvent(P),m.current=L,p()),P.key==="End"&&(n.stopEvent(P),m.current=$,p())),B>1){const J=se||Array.from({length:i.current.length},()=>({width:1,height:1})),oe=n.createGridCellMap(J,B,z),Ie=oe.findIndex(ge=>ge!=null&&!n.isListIndexDisabled(i,ge,h)),Fe=oe.reduce((ge,be,Se)=>be!=null&&!n.isListIndexDisabled(i,be,h)?Se:ge,-1),Le=oe[n.getGridNavigatedIndex({current:oe.map(ge=>ge!=null?i.current[ge]:null)},{event:P,orientation:I,loop:y,rtl:E,cols:B,disabledIndices:n.getGridCellIndices([...(typeof h!="function"?h:null)||i.current.map((ge,be)=>n.isListIndexDisabled(i,be,h)?be:void 0),void 0],oe),minIndex:Ie,maxIndex:Fe,prevIndex:n.getGridCellIndexOfCorner(m.current>$?L:m.current,J,oe,B,P.key===je?"bl":P.key===(E?Oe:ke)?"tr":"tl"),stopEvent:!0})];if(Le!=null&&(m.current=Le,p()),I==="both")return}if(We(P.key,I)){if(n.stopEvent(P),o&&!a&&n.activeElement(P.currentTarget.ownerDocument)===P.currentTarget){m.current=ze(P.key,I,E)?L:$,p();return}ze(P.key,I,E)?y?m.current=_>=$?T&&_!==i.current.length?-1:L:n.findNonDisabledListIndex(i,{startingIndex:_,disabledIndices:h}):m.current=Math.min($,n.findNonDisabledListIndex(i,{startingIndex:_,disabledIndices:h})):y?m.current=_<=L?T&&_!==-1?i.current.length:$:n.findNonDisabledListIndex(i,{startingIndex:_,decrement:!0,disabledIndices:h}):m.current=Math.max(L,n.findNonDisabledListIndex(i,{startingIndex:_,decrement:!0,disabledIndices:h})),n.isIndexOutOfListBounds(i,m.current)&&(m.current=-1),p()}}),ce=l.useMemo(()=>a&&o&&Z&&{"aria-activedescendant":F||ue},[a,o,Z,F,ue]),ae=l.useMemo(()=>({"aria-orientation":I==="both"?void 0:I,...V?{}:ce,onKeyDown:fe,onPointerMove(){k.current=!0}}),[ce,fe,I,V]),pe=l.useMemo(()=>{function P(L){w==="auto"&&n.isVirtualClick(L.nativeEvent)&&(x.current=!0)}function _(L){x.current=w,w==="auto"&&n.isVirtualPointerEvent(L.nativeEvent)&&(x.current=!0)}return{...ce,onKeyDown(L){k.current=!1;const $=L.key.startsWith("Arrow"),J=["Home","End"].includes(L.key),oe=$||J,Ie=yt(L.key,I,E),Fe=xt(L.key,I,E,B),Le=yt(L.key,j(),E),ge=We(L.key,I),be=(d?Le:ge)||L.key==="Enter"||L.key.trim()==="";if(a&&o){const De=c==null?void 0:c.nodesRef.current.find(Ne=>Ne.parentId==null),ve=c&&De?n.getDeepestNode(c.nodesRef.current,De.id):null;if(oe&&ve&&W){const Ne=new KeyboardEvent("keydown",{key:L.key,bubbles:!0});if(Ie||Fe){var Se,Je;const Ft=((Se=ve.context)==null?void 0:Se.elements.domReference)===L.currentTarget,tt=Fe&&!Ft?(Je=ve.context)==null?void 0:Je.elements.domReference:Ie?i.current.find(nt=>(nt==null?void 0:nt.id)===ue):null;tt&&(n.stopEvent(L),tt.dispatchEvent(Ne),H(void 0))}if((ge||J)&&ve.context&&ve.context.open&&ve.parentId&&L.currentTarget!==ve.context.elements.domReference){var et;n.stopEvent(L),(et=ve.context.elements.domReference)==null||et.dispatchEvent(Ne);return}}return fe(L)}if(!(!o&&!b&&$)){if(be){const De=We(L.key,j());M.current=d&&De?null:L.key}if(d){Le&&(n.stopEvent(L),o?(m.current=n.getMinListIndex(i,re.current),p()):r(!0,L.nativeEvent,"list-navigation"));return}ge&&(R!=null&&(m.current=R),n.stopEvent(L),!o&&b?r(!0,L.nativeEvent,"list-navigation"):fe(L),o&&p())}},onFocus(){o&&!a&&(m.current=-1,p())},onPointerDown:_,onPointerEnter:_,onMouseDown:P,onClick:P}},[ue,ce,B,fe,re,w,i,d,p,r,o,b,I,j,E,R,c,a,W]);return l.useMemo(()=>g?{reference:pe,floating:ae,item:ne}:{},[g,pe,ae,ne])}const Rn=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function hn(e,t){var o,r;t===void 0&&(t={});const{open:s,elements:u,floatingId:i}=e,{enabled:f=!0,role:v="dialog"}=t,g=Te(),R=((o=u.domReference)==null?void 0:o.id)||g,T=l.useMemo(()=>{var b;return((b=n.getFloatingFocusElement(u.floating))==null?void 0:b.id)||i},[u.floating,i]),y=(r=Rn.get(v))!=null?r:v,E=Me()!=null,a=l.useMemo(()=>y==="tooltip"||v==="label"?{["aria-"+(v==="label"?"labelledby":"describedby")]:s?T:void 0}:{"aria-expanded":s?"true":"false","aria-haspopup":y==="alertdialog"?"dialog":y,"aria-controls":s?T:void 0,...y==="listbox"&&{role:"combobox"},...y==="menu"&&{id:R},...y==="menu"&&E&&{role:"menuitem"},...v==="select"&&{"aria-autocomplete":"none"},...v==="combobox"&&{"aria-autocomplete":"list"}},[y,T,E,s,R,v]),w=l.useMemo(()=>{const b={id:T,...y&&{role:y}};return y==="tooltip"||v==="label"?b:{...b,...y==="menu"&&{"aria-labelledby":R}}},[y,T,R,v]),O=l.useCallback(b=>{let{active:h,selected:I}=b;const Y={role:"option",...h&&{id:T+"-fui-option"}};switch(v){case"select":case"combobox":return{...Y,"aria-selected":I}}return{}},[T,v]);return l.useMemo(()=>f?{reference:a,floating:w,item:O}:{},[f,a,w,O])}function kt(e,t,o){return o===void 0&&(o=!0),e.filter(s=>{var u;return s.parentId===t&&(!o||((u=s.context)==null?void 0:u.open))}).flatMap(s=>[s,...kt(e,s.id,o)])}function wt(e,t){const[o,r]=e;let s=!1;const u=t.length;for(let i=0,f=u-1;i<u;f=i++){const[v,g]=t[i]||[0,0],[R,T]=t[f]||[0,0];g>=r!=T>=r&&o<=(R-v)*(r-g)/(T-g)+v&&(s=!s)}return s}function yn(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function xn(e){e===void 0&&(e={});const{buffer:t=.5,blockPointerEvents:o=!1,requireIntent:r=!0}=e,s={current:-1};let u=!1,i=null,f=null,v=typeof performance<"u"?performance.now():0;function g(T,y){const d=performance.now(),E=d-v;if(i===null||f===null||E===0)return i=T,f=y,v=d,null;const a=T-i,w=y-f,b=Math.sqrt(a*a+w*w)/E;return i=T,f=y,v=d,b}const R=T=>{let{x:y,y:d,placement:E,elements:a,onClose:w,nodeId:O,tree:b}=T;return function(I){function Y(){de(s),w()}if(de(s),!a.domReference||!a.floating||E==null||y==null||d==null)return;const{clientX:B,clientY:q}=I,W=[B,q],se=Ut(I),z=I.type==="mouseleave",X=$e(a.floating,se),G=$e(a.domReference,se),S=a.domReference.getBoundingClientRect(),c=a.floating.getBoundingClientRect(),p=E.split("-")[0],V=y>c.right-c.width/2,x=d>c.bottom-c.height/2,m=yn(W,S),M=c.width>S.width,k=c.height>S.height,U=(M?S:c).left,D=(M?S:c).right,C=(k?S:c).top,Q=(k?S:c).bottom;if(X&&(u=!0,!z))return;if(G&&(u=!1),G&&!z){u=!0;return}if(z&&N.isElement(I.relatedTarget)&&$e(a.floating,I.relatedTarget)||b&&kt(b.nodesRef.current,O).length)return;if(p==="top"&&d>=S.bottom-1||p==="bottom"&&d<=S.top+1||p==="left"&&y>=S.right-1||p==="right"&&y<=S.left+1)return Y();let K=[];switch(p){case"top":K=[[U,S.top+1],[U,c.bottom-1],[D,c.bottom-1],[D,S.top+1]];break;case"bottom":K=[[U,c.top+1],[U,S.bottom-1],[D,S.bottom-1],[D,c.top+1]];break;case"left":K=[[c.right-1,Q],[c.right-1,C],[S.left+1,C],[S.left+1,Q]];break;case"right":K=[[S.right-1,Q],[S.right-1,C],[c.left+1,C],[c.left+1,Q]];break}function re(ie){let[ee,te]=ie;switch(p){case"top":{const ue=[M?ee+t/2:V?ee+t*4:ee-t*4,te+t+1],me=[M?ee-t/2:V?ee+t*4:ee-t*4,te+t+1],F=[[c.left,V||M?c.bottom-t:c.top],[c.right,V?M?c.bottom-t:c.top:c.bottom-t]];return[ue,me,...F]}case"bottom":{const ue=[M?ee+t/2:V?ee+t*4:ee-t*4,te-t],me=[M?ee-t/2:V?ee+t*4:ee-t*4,te-t],F=[[c.left,V||M?c.top+t:c.bottom],[c.right,V?M?c.top+t:c.bottom:c.top+t]];return[ue,me,...F]}case"left":{const ue=[ee+t+1,k?te+t/2:x?te+t*4:te-t*4],me=[ee+t+1,k?te-t/2:x?te+t*4:te-t*4];return[...[[x||k?c.right-t:c.left,c.top],[x?k?c.right-t:c.left:c.right-t,c.bottom]],ue,me]}case"right":{const ue=[ee-t,k?te+t/2:x?te+t*4:te-t*4],me=[ee-t,k?te-t/2:x?te+t*4:te-t*4],F=[[x||k?c.left+t:c.right,c.top],[x?k?c.left+t:c.right:c.left+t,c.bottom]];return[ue,me,...F]}}}if(!wt([B,q],K)){if(u&&!m)return Y();if(!z&&r){const ie=g(I.clientX,I.clientY);if(ie!==null&&ie<.1)return Y()}wt([B,q],re([y,d]))?!u&&r&&(s.current=window.setTimeout(Y,40)):Y()}}};return R.__options={blockPointerEvents:o},R}exports.getOverflowAncestors=N.getOverflowAncestors;exports.arrow=we.arrow;exports.flip=we.flip;exports.offset=we.offset;exports.shift=we.shift;exports.size=we.size;exports.FloatingArrow=Bt;exports.FloatingFocusManager=sn;exports.FloatingOverlay=cn;exports.FloatingPortal=tn;exports.safePolygon=xn;exports.useClick=an;exports.useDismiss=mn;exports.useFloating=gn;exports.useFloatingNodeId=Xt;exports.useFloatingParentNodeId=Me;exports.useFloatingPortalNode=Ct;exports.useFloatingRootContext=Ot;exports.useFloatingTree=ye;exports.useFocus=pn;exports.useHover=Gt;exports.useId=Te;exports.useInteractions=vn;exports.useListNavigation=bn;exports.useMergeRefs=At;exports.useRole=hn;