@floating-ui/react
Advanced tools
Comparing version 0.19.0 to 0.19.1
@@ -1,1 +0,1 @@ | ||
import*as e from"react";import{useLayoutEffect as t,useEffect as n,useRef as r}from"react";import{hideOthers as o}from"aria-hidden";import{tabbable as u}from"tabbable";import{createPortal as c,flushSync as i}from"react-dom";import{getOverflowAncestors as l,offset as s,detectOverflow as a,useFloating as f}from"@floating-ui/react-dom";export{arrow}from"@floating-ui/react-dom";export{autoPlacement,autoUpdate,computePosition,detectOverflow,flip,getOverflowAncestors,hide,inline,limitShift,offset,platform,shift,size}from"@floating-ui/dom";var d="undefined"!=typeof document?t:n;let m=!1,v=0;const p=()=>"floating-ui-"+v++;const g=e["useId".toString()]||function(){const[t,n]=e.useState((()=>m?p():void 0));return d((()=>{null==t&&n(p())}),[]),e.useEffect((()=>{m||(m=!0)}),[]),t};function b(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter((e=>e!==n)))}}}const h=e.createContext(null),y=e.createContext(null),w=()=>{var t;return(null==(t=e.useContext(h))?void 0:t.id)||null},E=()=>e.useContext(y),R=e=>{const t=g(),n=E(),r=w(),o=e||r;return d((()=>{const e={id:t,parentId:o};return null==n||n.addNode(e),()=>{null==n||n.removeNode(e)}}),[n,t,o]),t},x=t=>{let{children:n,id:r}=t;const o=w();return e.createElement(h.Provider,{value:e.useMemo((()=>({id:r,parentId:o})),[r,o])},n)},I=t=>{let{children:n}=t;const r=e.useRef([]),o=e.useCallback((e=>{r.current=[...r.current,e]}),[]),u=e.useCallback((e=>{r.current=r.current.filter((t=>t!==e))}),[]),c=e.useState((()=>b()))[0];return e.createElement(y.Provider,{value:e.useMemo((()=>({nodesRef:r,addNode:o,removeNode:u,events:c})),[r,o,u,c])},n)};function k(e){return(null==e?void 0:e.ownerDocument)||document}function T(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function C(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}function M(e){return k(e).defaultView||window}function A(e){return!!e&&e instanceof M(e).Element}function L(e){return!!e&&e instanceof M(e).HTMLElement}function O(e){if(0===e.mozInputSource&&e.isTrusted)return!0;const t=/Android/i;return(t.test(T())||t.test(C()))&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType}function P(e){return 0===e.width&&0===e.height||1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"!==e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail}function S(){return/apple/i.test(navigator.vendor)}function D(){return T().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function F(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function K(e){const t=r(e);return d((()=>{t.current=e})),t}function H(e,t,n){return n&&!F(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}const N=function(t,n){let{enabled:r=!0,delay:o=0,handleClose:u=null,mouseOnly:c=!1,restMs:i=0,move:l=!0}=void 0===n?{}:n;const{open:s,onOpenChange:a,dataRef:f,events:m,elements:{domReference:v,floating:p},refs:g}=t,b=E(),h=w(),y=K(u),R=K(o),x=e.useRef(),I=e.useRef(),T=e.useRef(),C=e.useRef(),M=e.useRef(!0),L=e.useRef(!1),O=e.useRef((()=>{})),P=e.useCallback((()=>{var e;const t=null==(e=f.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[f]);e.useEffect((()=>{if(r)return m.on("dismiss",e),()=>{m.off("dismiss",e)};function e(){clearTimeout(I.current),clearTimeout(C.current),M.current=!0}}),[r,m]),e.useEffect((()=>{if(!r||!y.current||!s)return;function e(){P()&&a(!1)}const t=k(p).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[p,s,a,r,y,f,P]);const S=e.useCallback((function(e){void 0===e&&(e=!0);const t=H(R.current,"close",x.current);t&&!T.current?(clearTimeout(I.current),I.current=setTimeout((()=>a(!1)),t)):e&&(clearTimeout(I.current),a(!1))}),[R,a]),D=e.useCallback((()=>{O.current(),T.current=void 0}),[]),N=e.useCallback((()=>{if(L.current){const e=k(g.floating.current).body;e.style.pointerEvents="",e.removeAttribute("data-floating-ui-safe-polygon"),L.current=!1}}),[g]);return e.useEffect((()=>{if(r&&A(v)){const e=v;return s&&e.addEventListener("mouseleave",u),null==p||p.addEventListener("mouseleave",u),l&&e.addEventListener("mousemove",n,{once:!0}),e.addEventListener("mouseenter",n),e.addEventListener("mouseleave",o),()=>{s&&e.removeEventListener("mouseleave",u),null==p||p.removeEventListener("mouseleave",u),l&&e.removeEventListener("mousemove",n),e.removeEventListener("mouseenter",n),e.removeEventListener("mouseleave",o)}}function e(){return!!f.current.openEvent&&["click","mousedown"].includes(f.current.openEvent.type)}function n(e){if(clearTimeout(I.current),M.current=!1,c&&!F(x.current)||i>0&&0===H(R.current,"open"))return;f.current.openEvent=e;const t=H(R.current,"open",x.current);t?I.current=setTimeout((()=>{a(!0)}),t):a(!0)}function o(n){if(e())return;O.current();const r=k(p);if(clearTimeout(C.current),y.current){clearTimeout(I.current),T.current=y.current({...t,tree:b,x:n.clientX,y:n.clientY,onClose(){N(),D(),S()}});const e=T.current;return r.addEventListener("mousemove",e),void(O.current=()=>{r.removeEventListener("mousemove",e)})}S()}function u(n){e()||null==y.current||y.current({...t,tree:b,x:n.clientX,y:n.clientY,onClose(){D(),S()}})(n)}}),[v,p,r,t,c,i,l,S,D,N,a,s,b,R,y,f]),d((()=>{var e;if(r&&s&&null!=(e=y.current)&&e.__options.blockPointerEvents&&P()){const e=k(p).body;if(e.setAttribute("data-floating-ui-safe-polygon",""),e.style.pointerEvents="none",L.current=!0,A(v)&&p){var t,n;const e=v,r=null==b||null==(t=b.nodesRef.current.find((e=>e.id===h)))||null==(n=t.context)?void 0:n.elements.floating;return r&&(r.style.pointerEvents=""),e.style.pointerEvents="auto",p.style.pointerEvents="auto",()=>{e.style.pointerEvents="",p.style.pointerEvents=""}}}}),[r,s,h,p,v,b,y,f,P]),d((()=>{s||(x.current=void 0,D(),N())}),[s,D,N]),e.useEffect((()=>()=>{D(),clearTimeout(I.current),clearTimeout(C.current),N()}),[r,D,N]),e.useMemo((()=>{if(!r)return{};function e(e){x.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){s||0===i||(clearTimeout(C.current),C.current=setTimeout((()=>{M.current||a(!0)}),i))}},floating:{onMouseEnter(){clearTimeout(I.current)},onMouseLeave(){m.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),S(!1)}}}}),[m,r,i,s,a,S])},B=e.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{},isInstantPhase:!1}),_=()=>e.useContext(B),j=t=>{let{children:n,delay:r,timeoutMs:o=0}=t;const[u,c]=e.useReducer(((e,t)=>({...e,...t})),{delay:r,timeoutMs:o,initialDelay:r,currentId:null,isInstantPhase:!1}),i=e.useRef(null),l=e.useCallback((e=>{c({currentId:e})}),[]);return d((()=>{u.currentId?null===i.current?i.current=u.currentId:c({isInstantPhase:!0}):(c({isInstantPhase:!1}),i.current=null)}),[u.currentId]),e.createElement(B.Provider,{value:e.useMemo((()=>({...u,setState:c,setCurrentId:l})),[u,c,l])},n)},V=(t,n)=>{let{open:r,onOpenChange:o}=t,{id:u}=n;const{currentId:c,setCurrentId:i,initialDelay:l,setState:s,timeoutMs:a}=_();e.useEffect((()=>{c&&(s({delay:{open:1,close:H(l,"close")}}),c!==u&&o(!1))}),[u,o,s,c,l]),e.useEffect((()=>{function e(){o(!1),s({delay:l,currentId:null})}if(!r&&c===u){if(a){const t=window.setTimeout(e,a);return()=>{clearTimeout(t)}}e()}}),[r,s,c,u,o,l,a]),e.useEffect((()=>{r&&i(u)}),[r,i,u])};function W(){return W=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},W.apply(this,arguments)}function q(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(r=n.shadowRoot)?void 0:r.activeElement);){var n,r;t=t.shadowRoot.activeElement}return t}function z(e,t){if(!e||!t)return!1;const n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&(r=n,"undefined"!=typeof ShadowRoot&&(r instanceof M(r).ShadowRoot||r instanceof ShadowRoot))){let n=t;do{if(n&&e===n)return!0;n=n.parentNode||n.host}while(n)}var r;return!1}let U=0;function X(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(U);const u=()=>null==e?void 0:e.focus({preventScroll:n});o?u():U=requestAnimationFrame(u)}function Y(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)}))||[],r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))}))||[],n=n.concat(r);return n}function Z(e){return"composedPath"in e?e.composedPath()[0]:e.target}function G(e){return L(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function J(e){e.preventDefault(),e.stopPropagation()}const Q=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function $(e,t){const n=u(e,Q());"prev"===t&&n.reverse();const r=n.indexOf(q(k(e)));return n.slice(r+1)[0]}function ee(){return $(document.body,"next")}function te(){return $(document.body,"prev")}function ne(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!z(n,r)}function re(e){u(e,Q()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function oe(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const ue=e["useInsertionEffect".toString()]||(e=>e());function ce(t){const n=e.useRef((()=>{}));return ue((()=>{n.current=t})),e.useCallback((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return null==n.current?void 0:n.current(...t)}),[])}const ie={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 le,se;function ae(e){"Tab"===e.key&&(le=e.target,clearTimeout(se))}const fe=e.forwardRef((function(t,n){const r=ce(t.onFocus),[o,u]=e.useState();return d((()=>(S()&&u("button"),document.addEventListener("keydown",ae),()=>{document.removeEventListener("keydown",ae)})),[]),e.createElement("span",W({},t,{ref:n,tabIndex:0,role:o,"aria-hidden":!o||void 0,"data-floating-ui-focus-guard":"",style:ie,onFocus:e=>{S()&&D()&&!function(e){const t=le===e.relatedTarget;return le=e.relatedTarget,clearTimeout(se),t}(e)?(e.persist(),se=window.setTimeout((()=>{r(e)}),50)):r(e)}}))})),de=e.createContext(null),me=function(t){let{id:n,enabled:r=!0}=void 0===t?{}:t;const[o,u]=e.useState(null),c=g(),i=pe();return d((()=>{if(!r)return;const e=n?document.getElementById(n):null;if(!e){const e=document.createElement("div");""!==n&&(e.id=n||c),e.setAttribute("data-floating-ui-portal",""),u(e);const t=(null==i?void 0:i.portalNode)||document.body;return t.appendChild(e),()=>{t.removeChild(e)}}e.setAttribute("data-floating-ui-portal",""),u(e)}),[n,i,c,r]),o},ve=t=>{let{children:n,id:r,root:o=null,preserveTabOrder:u=!0}=t;const i=me({id:r,enabled:!o}),[l,s]=e.useState(null),a=e.useRef(null),f=e.useRef(null),d=e.useRef(null),m=e.useRef(null),v=!!l&&!l.modal&&!(!o&&!i)&&u;return e.useEffect((()=>{if(i&&u&&(null==l||!l.modal))return i.addEventListener("focusin",e,!0),i.addEventListener("focusout",e,!0),()=>{i.removeEventListener("focusin",e,!0),i.removeEventListener("focusout",e,!0)};function e(e){if(i&&ne(e)){("focusin"===e.type?oe:re)(i)}}}),[i,u,null==l?void 0:l.modal]),e.createElement(de.Provider,{value:e.useMemo((()=>({preserveTabOrder:u,beforeOutsideRef:a,afterOutsideRef:f,beforeInsideRef:d,afterInsideRef:m,portalNode:i,setFocusManagerState:s})),[u,i])},v&&i&&e.createElement(fe,{"data-type":"outside",ref:a,onFocus:e=>{if(ne(e,i)){var t;null==(t=d.current)||t.focus()}else{const e=te()||(null==l?void 0:l.refs.domReference.current);null==e||e.focus()}}}),v&&i&&e.createElement("span",{"aria-owns":i.id,style:ie}),o?c(n,o):i?c(n,i):null,v&&i&&e.createElement(fe,{"data-type":"outside",ref:f,onFocus:e=>{if(ne(e,i)){var t;null==(t=m.current)||t.focus()}else{const e=ee()||(null==l?void 0:l.refs.domReference.current);null==e||e.focus(),(null==l?void 0:l.closeOnFocusOut)&&(null==l||l.onOpenChange(!1))}}}))},pe=()=>e.useContext(de),ge=e.forwardRef((function(t,n){return e.createElement("button",W({},t,{type:"button",ref:n,tabIndex:-1,style:ie}))}));function be(t){let{context:n,children:r,order:c=["content"],guards:i=!0,initialFocus:l=0,returnFocus:s=!0,modal:a=!0,visuallyHiddenDismiss:f=!1,closeOnFocusOut:m=!0}=t;const{refs:v,nodeId:p,onOpenChange:g,events:b,dataRef:h,elements:{domReference:y,floating:w}}=n,R=K(c),x=E(),I=pe(),[T,C]=e.useState(null),M="number"==typeof l&&l<0,A=e.useRef(null),O=e.useRef(null),P=e.useRef(!1),S=e.useRef(null),D=e.useRef(!1),F=null!=I,H=y&&"combobox"===y.getAttribute("role")&&G(y),N=e.useCallback((function(e){return void 0===e&&(e=w),e?u(e,Q()):[]}),[w]),B=e.useCallback((e=>{const t=N(e);return R.current.map((e=>y&&"reference"===e?y:w&&"floating"===e?w:t)).filter(Boolean).flat()}),[y,w,R,N]);e.useEffect((()=>{if(!a)return;function e(e){if("Tab"===e.key){0!==N().length||H||J(e);const t=B(),n=Z(e);"reference"===R.current[0]&&n===y&&(J(e),e.shiftKey?X(t[t.length-1]):X(t[1])),"floating"===R.current[1]&&n===w&&e.shiftKey&&(J(e),X(t[0]))}}const t=k(w);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[y,w,a,R,v,H,N,B]),e.useEffect((()=>{if(m)return w&&L(y)?(y.addEventListener("focusout",t),y.addEventListener("pointerdown",e),!a&&w.addEventListener("focusout",t),()=>{y.removeEventListener("focusout",t),y.removeEventListener("pointerdown",e),!a&&w.removeEventListener("focusout",t)}):void 0;function e(){D.current=!0,setTimeout((()=>{D.current=!1}))}function t(e){const t=e.relatedTarget,n=!(z(y,t)||z(w,t)||z(t,w)||z(null==I?void 0:I.portalNode,t)||null!=t&&t.hasAttribute("data-floating-ui-focus-guard")||x&&(Y(x.nodesRef.current,p).find((e=>{var n,r;return z(null==(n=e.context)?void 0:n.elements.floating,t)||z(null==(r=e.context)?void 0:r.elements.domReference,t)}))||function(e,t){var n;let r=[],o=null==(n=e.find((e=>e.id===t)))?void 0:n.parentId;for(;o;){const t=e.find((e=>e.id===o));o=null==t?void 0:t.parentId,t&&(r=r.concat(t))}return r}(x.nodesRef.current,p).find((e=>{var n,r;return(null==(n=e.context)?void 0:n.elements.floating)===t||(null==(r=e.context)?void 0:r.elements.domReference)===t}))));t&&n&&!D.current&&t!==S.current&&(P.current=!0,setTimeout((()=>g(!1))))}}),[y,w,a,p,x,I,g,m]),e.useEffect((()=>{var e;const t=Array.from((null==I||null==(e=I.portalNode)?void 0:e.querySelectorAll("[data-floating-ui-portal]"))||[]);if(w&&a){const e=[w,...t,...[A.current,O.current].filter(Boolean)],n=o(R.current.includes("reference")||H?e.concat(y||[]):e);return()=>{n()}}}),[y,w,a,R,I,H]),e.useEffect((()=>{if(a&&!i&&w){const e=[],t=Q(),n=u(k(w).body,t),r=B(),o=n.filter((e=>!r.includes(e)));return o.forEach(((t,n)=>{e[n]=t.getAttribute("tabindex"),t.setAttribute("tabindex","-1")})),()=>{o.forEach(((t,n)=>{const r=e[n];null==r?t.removeAttribute("tabindex"):t.setAttribute("tabindex",r)}))}}}),[w,a,i,B]),d((()=>{if(!w)return;const e=k(w);let t=s,n=!1;const r=q(e),o=h.current;S.current=r;const u=B(w),c=("number"==typeof l?u[l]:l.current)||w;function i(e){if("escapeKey"===e.type&&v.domReference.current&&(S.current=v.domReference.current),["referencePress","escapeKey"].includes(e.type))return;const r=e.data.returnFocus;"object"==typeof r?(t=!0,n=r.preventScroll):t=r}return!M&&X(c,{preventScroll:c===w}),b.on("dismiss",i),()=>{var r;(b.off("dismiss",i),z(w,q(e))&&v.domReference.current&&(S.current=v.domReference.current),t&&L(S.current)&&!P.current)&&(!v.domReference.current||D.current?X(S.current,{cancelPrevious:!1,preventScroll:n}):(o.__syncReturnFocus=!0,null==(r=S.current)||r.focus({preventScroll:n}),setTimeout((()=>{delete o.__syncReturnFocus}))))}}),[w,B,l,s,h,v,b,M]),d((()=>{if(I)return I.setFocusManagerState({...n,modal:a,closeOnFocusOut:m}),()=>{I.setFocusManagerState(null)}}),[I,a,m,n]),d((()=>{if(!M&&w&&(e(),"function"==typeof MutationObserver)){const t=new MutationObserver(e);return t.observe(w,{childList:!0,subtree:!0}),()=>{t.disconnect()}}function e(){C(N().length)}}),[w,N,M,v]);const _=i&&(F||a)&&!H;function j(t){return f&&a?e.createElement(ge,{ref:"start"===t?A:O,onClick:()=>g(!1)},"string"==typeof f?f:"Dismiss"):null}return e.createElement(e.Fragment,null,_&&e.createElement(fe,{"data-type":"inside",ref:null==I?void 0:I.beforeInsideRef,onFocus:e=>{if(a){const e=B();X("reference"===c[0]?e[0]:e[e.length-1])}else if(null!=I&&I.preserveTabOrder&&I.portalNode)if(P.current=!1,ne(e,I.portalNode)){const e=ee()||y;null==e||e.focus()}else{var t;null==(t=I.beforeOutsideRef.current)||t.focus()}}}),H?null:j("start"),e.cloneElement(r,0===T||c.includes("floating")?{tabIndex:0}:{}),j("end"),_&&e.createElement(fe,{"data-type":"inside",ref:null==I?void 0:I.afterInsideRef,onFocus:e=>{if(a)X(B()[0]);else if(null!=I&&I.preserveTabOrder&&I.portalNode)if(P.current=!0,ne(e,I.portalNode)){const e=te()||y;null==e||e.focus()}else{var t;null==(t=I.afterOutsideRef.current)||t.focus()}}}))}const he="data-floating-ui-scroll-lock",ye=e.forwardRef((function(t,n){let{lockScroll:r=!1,...o}=t;return d((()=>{var e,t;if(!r)return;if(document.body.hasAttribute(he))return;document.body.setAttribute(he,"");const n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth;if(!/iP(hone|ad|od)|iOS/.test(T()))return Object.assign(document.body.style,{overflow:"hidden",[n]:o+"px"}),()=>{document.body.removeAttribute(he),Object.assign(document.body.style,{overflow:"",[n]:""})};const u=(null==(e=window.visualViewport)?void 0:e.offsetLeft)||0,c=(null==(t=window.visualViewport)?void 0:t.offsetTop)||0,i=window.pageXOffset,l=window.pageYOffset;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:-(l-Math.floor(c))+"px",left:-(i-Math.floor(u))+"px",right:"0",[n]:o+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[n]:""}),document.body.removeAttribute(he),window.scrollTo(i,l)}}),[r]),e.createElement("div",W({ref:n},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function we(e){return L(e.target)&&"BUTTON"===e.target.tagName}function Ee(e){return G(e)}const Re=function(t,n){let{open:r,onOpenChange:o,dataRef:u,elements:{domReference:c}}=t,{enabled:i=!0,event:l="click",toggle:s=!0,ignoreMouse:a=!1,keyboardHandlers:f=!0}=void 0===n?{}:n;const d=e.useRef();return e.useMemo((()=>i?{reference:{onPointerDown(e){d.current=e.pointerType},onMouseDown(e){0===e.button&&(F(d.current,!0)&&a||"click"!==l&&(r?!s||u.current.openEvent&&"mousedown"!==u.current.openEvent.type||o(!1):(e.preventDefault(),o(!0)),u.current.openEvent=e.nativeEvent))},onClick(e){u.current.__syncReturnFocus||("mousedown"===l&&d.current?d.current=void 0:F(d.current,!0)&&a||(r?!s||u.current.openEvent&&"click"!==u.current.openEvent.type||o(!1):o(!0),u.current.openEvent=e.nativeEvent))},onKeyDown(e){d.current=void 0,f&&(we(e)||(" "!==e.key||Ee(c)||e.preventDefault(),"Enter"===e.key&&(r?s&&o(!1):o(!0))))},onKeyUp(e){f&&(we(e)||Ee(c)||" "===e.key&&(r?s&&o(!1):o(!0)))}}}:{}),[i,u,l,a,f,c,s,r,o])};function xe(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}const Ie={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},ke={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Te=function(t,n){let{open:r,onOpenChange:o,events:u,nodeId:c,elements:{reference:i,domReference:s,floating:a},dataRef:f}=t,{enabled:d=!0,escapeKey:m=!0,outsidePress:v=!0,outsidePressEvent:p="pointerdown",referencePress:g=!1,referencePressEvent:b="pointerdown",ancestorScroll:h=!1,bubbles:y=!0}=void 0===n?{}:n;const R=E(),x=null!=w(),I=ce("function"==typeof v?v:()=>!1),T="function"==typeof v?I:v,C=e.useRef(!1),{escapeKeyBubbles:M,outsidePressBubbles:S}=function(e){var t,n;return void 0===e&&(e=!0),{escapeKeyBubbles:"boolean"==typeof e?e:null==(t=e.escapeKey)||t,outsidePressBubbles:"boolean"==typeof e?e:null==(n=e.outsidePress)||n}}(y);return e.useEffect((()=>{if(!r||!d)return;function e(e){if("Escape"===e.key){const e=R?Y(R.nodesRef.current,c):[];if(e.length>0){let t=!0;if(e.forEach((e=>{var n;null==(n=e.context)||!n.open||e.context.dataRef.current.__escapeKeyBubbles||(t=!1)})),!t)return}u.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),o(!1)}}function t(e){const t=C.current;if(C.current=!1,t)return;if("function"==typeof T&&!T(e))return;const n=Z(e);if(L(n)&&a){const t=a.ownerDocument.defaultView||window,r=n.scrollWidth>n.clientWidth,o=n.scrollHeight>n.clientHeight;let u=o&&e.offsetX>n.clientWidth;if(o){"rtl"===t.getComputedStyle(n).direction&&(u=e.offsetX<=n.offsetWidth-n.clientWidth)}if(u||r&&e.offsetY>n.clientHeight)return}const r=R&&Y(R.nodesRef.current,c).some((t=>{var n;return xe(e,null==(n=t.context)?void 0:n.elements.floating)}));if(xe(e,a)||xe(e,s)||r)return;const i=R?Y(R.nodesRef.current,c):[];if(i.length>0){let e=!0;if(i.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}u.emit("dismiss",{type:"outsidePress",data:{returnFocus:x?{preventScroll:!0}:O(e)||P(e)}}),o(!1)}function n(){o(!1)}f.current.__escapeKeyBubbles=M,f.current.__outsidePressBubbles=S;const v=k(a);m&&v.addEventListener("keydown",e),T&&v.addEventListener(p,t);let g=[];return h&&(A(s)&&(g=l(s)),A(a)&&(g=g.concat(l(a))),!A(i)&&i&&i.contextElement&&(g=g.concat(l(i.contextElement)))),g=g.filter((e=>{var t;return e!==(null==(t=v.defaultView)?void 0:t.visualViewport)})),g.forEach((e=>{e.addEventListener("scroll",n,{passive:!0})})),()=>{m&&v.removeEventListener("keydown",e),T&&v.removeEventListener(p,t),g.forEach((e=>{e.removeEventListener("scroll",n)}))}}),[f,a,s,i,m,T,p,u,R,c,r,o,h,d,M,S,x]),e.useEffect((()=>{C.current=!1}),[T,p]),e.useMemo((()=>d?{reference:{[Ie[b]]:()=>{g&&(u.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),o(!1))}},floating:{[ke[p]]:()=>{C.current=!0}}}:{}),[d,u,g,p,b,o])},Ce=function(t,n){let{open:r,onOpenChange:o,dataRef:u,events:c,refs:i,elements:{floating:l,domReference:s}}=t,{enabled:a=!0,keyboardOnly:f=!0}=void 0===n?{}:n;const d=e.useRef(""),m=e.useRef(!1),v=e.useRef();return e.useEffect((()=>{if(!a)return;const e=k(l).defaultView||window;function t(){!r&&L(s)&&s===q(k(s))&&(m.current=!0)}return e.addEventListener("blur",t),()=>{e.removeEventListener("blur",t)}}),[l,s,r,a]),e.useEffect((()=>{if(a)return c.on("dismiss",e),()=>{c.off("dismiss",e)};function e(e){"referencePress"!==e.type&&"escapeKey"!==e.type||(m.current=!0)}}),[c,a]),e.useEffect((()=>()=>{clearTimeout(v.current)}),[]),e.useMemo((()=>a?{reference:{onPointerDown(e){let{pointerType:t}=e;d.current=t,m.current=!(!t||!f)},onMouseLeave(){m.current=!1},onFocus(e){var t;m.current||"focus"===e.type&&"mousedown"===(null==(t=u.current.openEvent)?void 0:t.type)&&u.current.openEvent&&xe(u.current.openEvent,s)||(u.current.openEvent=e.nativeEvent,o(!0))},onBlur(e){m.current=!1;const t=e.relatedTarget,n=A(t)&&t.hasAttribute("data-floating-ui-focus-guard")&&"outside"===t.getAttribute("data-type");v.current=setTimeout((()=>{z(i.floating.current,t)||z(s,t)||n||o(!1)}))}}}:{}),[a,f,s,i,u,o])};let Me=!1;function Ae(e,t,n){return Math.floor(e/t)!==n}function Le(e,t){return t<0||t>=e.current.length}function Oe(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o,amount:u=1}=void 0===t?{}:t;const c=e.current;let i=n;do{var l,s;i+=r?-u:u}while(i>=0&&i<=c.length-1&&(o?o.includes(i):null==c[i]||(null==(l=c[i])?void 0:l.hasAttribute("disabled"))||"true"===(null==(s=c[i])?void 0:s.getAttribute("aria-disabled"))));return i}function Pe(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Se(e,t){return Pe(t,"ArrowUp"===e||"ArrowDown"===e,"ArrowLeft"===e||"ArrowRight"===e)}function De(e,t,n){return Pe(t,"ArrowDown"===e,n?"ArrowLeft"===e:"ArrowRight"===e)||"Enter"===e||" "==e||""===e}function Fe(e,t){return Oe(e,{disabledIndices:t})}function Ke(e,t){return Oe(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}const He=function(t,n){let{open:r,onOpenChange:o,refs:u,elements:{domReference:c}}=t,{listRef:l,activeIndex:s,onNavigate:a=(()=>{}),enabled:f=!0,selectedIndex:m=null,allowEscape:v=!1,loop:p=!1,nested:g=!1,rtl:b=!1,virtual:h=!1,focusItemOnOpen:y="auto",focusItemOnHover:R=!0,openOnArrowKeyDown:x=!0,disabledIndices:I,orientation:T="vertical",cols:C=1,scrollItemIntoView:M=!0}=void 0===n?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:n;const A=w(),F=E(),H=ce(a),N=e.useRef(y),B=e.useRef(null!=m?m:-1),_=e.useRef(null),j=e.useRef(!0),V=e.useRef(H),W=e.useRef(r),U=e.useRef(!1),Y=e.useRef(!1),Z=K(I),G=K(r),Q=K(M),[$,ee]=e.useState(),te=e.useCallback((function(e,t,n){void 0===n&&(n=!1);const r=e.current[t.current];h?ee(null==r?void 0:r.id):X(r,{preventScroll:!0,sync:!(!D()||!S())&&(Me||U.current)}),requestAnimationFrame((()=>{const e=Q.current;e&&r&&(n||!j.current)&&(null==r.scrollIntoView||r.scrollIntoView("boolean"==typeof e?{block:"nearest",inline:"nearest"}:e))}))}),[h,Q]);d((()=>{document.createElement("div").focus({get preventScroll(){return Me=!0,!1}})}),[]),d((()=>{f&&(r?N.current&&null!=m&&(Y.current=!0,H(m)):W.current&&(B.current=-1,V.current(null)))}),[f,r,m,H]),d((()=>{if(f&&r)if(null==s){if(U.current=!1,null!=m)return;W.current&&(B.current=-1,te(l,B)),!W.current&&N.current&&(null!=_.current||!0===N.current&&null==_.current)&&(B.current=null==_.current||De(_.current,T,b)||g?Fe(l,Z.current):Ke(l,Z.current),H(B.current))}else Le(l,s)||(B.current=s,te(l,B,Y.current),Y.current=!1)}),[f,r,s,m,g,l,T,b,H,te,Z]),d((()=>{if(f&&W.current&&!r){var e,t;const n=null==F||null==(e=F.nodesRef.current.find((e=>e.id===A)))||null==(t=e.context)?void 0:t.elements.floating;n&&!z(n,q(k(n)))&&n.focus({preventScroll:!0})}}),[f,r,F,A]),d((()=>{_.current=null,V.current=H,W.current=r}));const ne=null!=s,re=e.useMemo((()=>{function e(e){if(!r)return;const t=l.current.indexOf(e);-1!==t&&H(t)}return{onFocus(t){let{currentTarget:n}=t;e(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...R&&{onMouseMove(t){let{currentTarget:n}=t;e(n)},onPointerLeave(){var e;j.current&&(B.current=-1,te(l,B),i((()=>H(null))),h||null==(e=u.floating.current)||e.focus({preventScroll:!0}))}}}}),[r,u,te,R,l,H,h]);return e.useMemo((()=>{if(!f)return{};const e=Z.current;function t(t){if(j.current=!1,U.current=!0,!G.current&&t.currentTarget===u.floating.current)return;if(g&&function(e,t,n){return Pe(t,n?"ArrowRight"===e:"ArrowLeft"===e,"ArrowUp"===e)}(t.key,T,b))return J(t),o(!1),void(L(c)&&c.focus());const n=B.current,i=Fe(l,e),s=Ke(l,e);if("Home"===t.key&&(B.current=i,H(B.current)),"End"===t.key&&(B.current=s,H(B.current)),C>1){const n=B.current;if("ArrowUp"===t.key){if(J(t),-1===n)B.current=s;else if(B.current=Oe(l,{startingIndex:n,amount:C,decrement:!0,disabledIndices:e}),p&&(n-C<i||B.current<0)){const e=n%C,t=s%C,r=s-(t-e);B.current=t===e?s:t>e?r:r-C}Le(l,B.current)&&(B.current=n),H(B.current)}if("ArrowDown"===t.key&&(J(t),-1===n?B.current=i:(B.current=Oe(l,{startingIndex:n,amount:C,disabledIndices:e}),p&&n+C>s&&(B.current=Oe(l,{startingIndex:n%C-C,amount:C,disabledIndices:e}))),Le(l,B.current)&&(B.current=n),H(B.current)),"both"===T){const r=Math.floor(n/C);"ArrowRight"===t.key&&(J(t),n%C!=C-1?(B.current=Oe(l,{startingIndex:n,disabledIndices:e}),p&&Ae(B.current,C,r)&&(B.current=Oe(l,{startingIndex:n-n%C-1,disabledIndices:e}))):p&&(B.current=Oe(l,{startingIndex:n-n%C-1,disabledIndices:e})),Ae(B.current,C,r)&&(B.current=n)),"ArrowLeft"===t.key&&(J(t),n%C!=0?(B.current=Oe(l,{startingIndex:n,disabledIndices:e,decrement:!0}),p&&Ae(B.current,C,r)&&(B.current=Oe(l,{startingIndex:n+(C-n%C),decrement:!0,disabledIndices:e}))):p&&(B.current=Oe(l,{startingIndex:n+(C-n%C),decrement:!0,disabledIndices:e})),Ae(B.current,C,r)&&(B.current=n));const o=Math.floor(s/C)===r;return Le(l,B.current)&&(B.current=p&&o?"ArrowLeft"===t.key?s:Oe(l,{startingIndex:n-n%C-1,disabledIndices:e}):n),void H(B.current)}}if(Se(t.key,T)){if(J(t),r&&!h&&q(t.currentTarget.ownerDocument)===t.currentTarget)return B.current=De(t.key,T,b)?i:s,void H(B.current);De(t.key,T,b)?B.current=p?n>=s?v&&n!==l.current.length?-1:i:Oe(l,{startingIndex:n,disabledIndices:e}):Math.min(s,Oe(l,{startingIndex:n,disabledIndices:e})):B.current=p?n<=i?v&&-1!==n?l.current.length:s:Oe(l,{startingIndex:n,decrement:!0,disabledIndices:e}):Math.max(i,Oe(l,{startingIndex:n,decrement:!0,disabledIndices:e})),Le(l,B.current)?H(null):H(B.current)}}function n(e){"auto"===y&&O(e.nativeEvent)&&(N.current=!0)}const i=h&&r&&ne&&{"aria-activedescendant":$};return{reference:{...i,onKeyDown(n){j.current=!1;const u=0===n.key.indexOf("Arrow");if(h&&r)return t(n);if(!r&&!x&&u)return;(u||"Enter"===n.key||" "===n.key||""===n.key)&&(_.current=n.key),g?function(e,t,n){return Pe(t,n?"ArrowLeft"===e:"ArrowRight"===e,"ArrowDown"===e)}(n.key,T,b)&&(J(n),r?(B.current=Fe(l,e),H(B.current)):o(!0)):Se(n.key,T)&&(null!=m&&(B.current=m),J(n),!r&&x?o(!0):t(n),r&&H(B.current))},onFocus(){r&&H(null)},onPointerDown:function(e){N.current=y,"auto"===y&&P(e.nativeEvent)&&(N.current=!0)},onMouseDown:n,onClick:n},floating:{"aria-orientation":"both"===T?void 0:T,...i,onKeyDown:t,onPointerMove(){j.current=!0}},item:re}}),[c,u,$,Z,G,l,f,T,b,h,r,ne,g,m,x,v,C,p,y,H,o,re])};function Ne(t){return e.useMemo((()=>t.every((e=>null==e))?null:e=>{t.forEach((t=>{"function"==typeof t?t(e):null!=t&&(t.current=e)}))}),t)}const Be=function(t,n){let{open:r}=t,{enabled:o=!0,role:u="dialog"}=void 0===n?{}:n;const c=g(),i=g();return e.useMemo((()=>{const e={id:c,role:u};return o?"tooltip"===u?{reference:{"aria-describedby":r?c:void 0},floating:e}:{reference:{"aria-expanded":r?"true":"false","aria-haspopup":"alertdialog"===u?"dialog":u,"aria-controls":r?c:void 0,..."listbox"===u&&{role:"combobox"},..."menu"===u&&{id:i}},floating:{...e,..."menu"===u&&{"aria-labelledby":i}}}:{}}),[o,u,r,c,i])},_e=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function je(t,n){let{open:r,elements:{floating:o}}=t,{duration:u=250}=void 0===n?{}:n;const c=("number"==typeof u?u:u.close)||0,[i,l]=e.useState(!1),[s,a]=e.useState("unmounted"),f=function(t,n){const[r,o]=e.useState(t);return t&&!r&&o(!0),e.useEffect((()=>{if(!t){const e=setTimeout((()=>o(!1)),n);return()=>clearTimeout(e)}}),[t,n]),r}(r,c);return d((()=>{i&&!f&&a("unmounted")}),[i,f]),d((()=>{if(o){if(r){a("initial");const e=requestAnimationFrame((()=>{a("open")}));return()=>{cancelAnimationFrame(e)}}l(!0),a("close")}}),[r,o]),{isMounted:f,status:s}}function Ve(t,n){let{initial:r={opacity:0},open:o,close:u,common:c,duration:i=250}=void 0===n?{}:n;const l=t.placement,s=l.split("-")[0],[a,f]=e.useState({}),{isMounted:m,status:v}=je(t,{duration:i}),p=K(r),g=K(o),b=K(u),h=K(c),y="number"==typeof i,w=(y?i:i.open)||0,E=(y?i:i.close)||0;return d((()=>{const e={side:s,placement:l},t=p.current,n=b.current,r=g.current,o=h.current,u="function"==typeof t?t(e):t,c="function"==typeof n?n(e):n,i="function"==typeof o?o(e):o,a=("function"==typeof r?r(e):r)||Object.keys(u).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===v&&f((e=>({transitionProperty:e.transitionProperty,...i,...u}))),"open"===v&&f({transitionProperty:Object.keys(a).map(_e).join(","),transitionDuration:w+"ms",...i,...a}),"close"===v){const e=c||u;f({transitionProperty:Object.keys(e).map(_e).join(","),transitionDuration:E+"ms",...i,...e})}}),[s,l,E,b,p,g,h,w,v]),{isMounted:m,styles:a}}const We=function(t,n){var r;let{open:o,dataRef:u}=t,{listRef:c,activeIndex:i,onMatch:l=(()=>{}),enabled:s=!0,findMatch:a=null,resetMs:f=1e3,ignoreKeys:m=[],selectedIndex:v=null}=void 0===n?{listRef:{current:[]},activeIndex:null}:n;const p=e.useRef(),g=e.useRef(""),b=e.useRef(null!=(r=null!=v?v:i)?r:-1),h=e.useRef(null),y=ce(l),w=K(a),E=K(m);return d((()=>{o&&(clearTimeout(p.current),h.current=null,g.current="")}),[o]),d((()=>{var e;o&&""===g.current&&(b.current=null!=(e=null!=v?v:i)?e:-1)}),[o,v,i]),e.useMemo((()=>{if(!s)return{};function e(e){const t=Z(e.nativeEvent);if(A(t)&&q(k(t))!==e.currentTarget&&t.closest('[role="dialog"],[role="menu"],[role="listbox"],[role="tree"],[role="grid"]')!==e.currentTarget)return;g.current.length>0&&" "!==g.current[0]&&(u.current.typing=!0," "===e.key&&J(e));const n=c.current;if(null==n||E.current.includes(e.key)||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey)return;n.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&g.current===e.key&&(g.current="",b.current=h.current),g.current+=e.key,clearTimeout(p.current),p.current=setTimeout((()=>{g.current="",b.current=h.current,u.current.typing=!1}),f);const r=b.current,o=[...n.slice((r||0)+1),...n.slice(0,(r||0)+1)],i=w.current?w.current(o,g.current):o.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(g.current.toLocaleLowerCase())))),l=i?n.indexOf(i):-1;-1!==l&&(y(l),h.current=l)}return{reference:{onKeyDown:e},floating:{onKeyDown:e}}}),[s,u,c,f,E,w,y])};function qe(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const ze=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:u=0,index:c=0,minItemsVisible:l=4,referenceOverflowThreshold:f=0,scrollRef:d,...m}=e,{rects:v,elements:{floating:p}}=t,g=n.current[c];if(!g)return{};const b={...t,...await s(-g.offsetTop-v.reference.height/2-g.offsetHeight/2-u).fn(t)},h=(null==d?void 0:d.current)||p,y=await a(qe(b,h.scrollHeight),m),w=await a(b,{...m,elementContext:"reference"}),E=Math.max(0,y.top),R=b.y+E,x=Math.max(0,h.scrollHeight-E-Math.max(0,y.bottom));return h.style.maxHeight=x+"px",h.scrollTop=E,o&&(h.offsetHeight<g.offsetHeight*Math.min(l,n.current.length-1)-1||w.top>=-f||w.bottom>=-f?i((()=>o(!0))):i((()=>o(!1)))),r&&(r.current=await a(qe({...b,y:R},h.offsetHeight),m)),{y:R}}}),Ue=(t,n)=>{let{open:r,elements:o}=t,{enabled:u=!0,overflowRef:c,scrollRef:l,onChange:s}=n;const a=ce(s),f=e.useRef(!1),d=e.useRef(null),m=e.useRef(null);return e.useEffect((()=>{if(!u)return;function e(e){if(e.ctrlKey||!t||null==c.current)return;const n=e.deltaY,r=c.current.top>=-.5,o=c.current.bottom>=-.5,u=t.scrollHeight-t.clientHeight,l=n<0?-1:1,s=n<0?"max":"min";t.scrollHeight<=t.clientHeight||(!r&&n>0||!o&&n<0?(e.preventDefault(),i((()=>{a((e=>e+Math[s](n,u*l)))}))):/firefox/i.test(C())&&(t.scrollTop+=n))}const t=(null==l?void 0:l.current)||o.floating;return r&&t?(t.addEventListener("wheel",e),requestAnimationFrame((()=>{d.current=t.scrollTop,null!=c.current&&(m.current={...c.current})})),()=>{d.current=null,m.current=null,t.removeEventListener("wheel",e)}):void 0}),[u,r,o.floating,c,l,a]),e.useMemo((()=>u?{floating:{onKeyDown(){f.current=!0},onWheel(){f.current=!1},onPointerMove(){f.current=!1},onScroll(){const e=(null==l?void 0:l.current)||o.floating;if(c.current&&e&&f.current){if(null!==d.current){const t=e.scrollTop-d.current;(c.current.bottom<-.5&&t<-1||c.current.top<-.5&&t>1)&&i((()=>a((e=>e+t))))}requestAnimationFrame((()=>{d.current=e.scrollTop}))}}}}:{}),[u,c,o.floating,l,a])};function Xe(e){let t,{restMs:n=0,buffer:r=.5,blockPointerEvents:o=!1}=void 0===e?{}:e,u=!1,c=!1;const i=e=>{let{x:o,y:i,placement:l,elements:s,onClose:a,nodeId:f,tree:d}=e;return function(e){function m(){clearTimeout(t),a()}if(clearTimeout(t),!s.domReference||!s.floating||null==l||null==o||null==i)return;const{clientX:v,clientY:p}=e,g=[v,p],b=Z(e),h="mouseleave"===e.type,y=z(s.floating,b),w=z(s.domReference,b),E=s.domReference.getBoundingClientRect(),R=s.floating.getBoundingClientRect(),x=l.split("-")[0],I=o>R.right-R.width/2,k=i>R.bottom-R.height/2,T=function(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}(g,E);if(y&&(c=!0),w&&(c=!1),w&&!h)return void(c=!0);if(h&&A(e.relatedTarget)&&z(s.floating,e.relatedTarget))return;if(d&&Y(d.nodesRef.current,f).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if("top"===x&&i>=E.bottom-1||"bottom"===x&&i<=E.top+1||"left"===x&&o>=E.right-1||"right"===x&&o<=E.left+1)return m();let C=[];switch(x){case"top":C=[[R.left,E.top+1],[R.left,R.bottom-1],[R.right,R.bottom-1],[R.right,E.top+1]],u=v>=R.left&&v<=R.right&&p>=R.top&&p<=E.top+1;break;case"bottom":C=[[R.left,R.top+1],[R.left,E.bottom-1],[R.right,E.bottom-1],[R.right,R.top+1]],u=v>=R.left&&v<=R.right&&p>=E.bottom-1&&p<=R.bottom;break;case"left":C=[[R.right-1,R.bottom],[R.right-1,R.top],[E.left+1,R.top],[E.left+1,R.bottom]],u=v>=R.left&&v<=E.left+1&&p>=R.top&&p<=R.bottom;break;case"right":C=[[E.right-1,R.bottom],[E.right-1,R.top],[R.left+1,R.top],[R.left+1,R.bottom]],u=v>=E.right-1&&v<=R.right&&p>=R.top&&p<=R.bottom}const M=u?C:function(e){let[t,n]=e;const o=R.width>E.width,u=R.height>E.height;switch(x){case"top":return[[o?t+r/2:I?t+4*r:t-4*r,n+r+1],[o?t-r/2:I?t+4*r:t-4*r,n+r+1],...[[R.left,I||o?R.bottom-r:R.top],[R.right,I?o?R.bottom-r:R.top:R.bottom-r]]];case"bottom":return[[o?t+r/2:I?t+4*r:t-4*r,n-r],[o?t-r/2:I?t+4*r:t-4*r,n-r],...[[R.left,I||o?R.top+r:R.bottom],[R.right,I?o?R.top+r:R.bottom:R.top+r]]];case"left":{const e=[t+r+1,u?n+r/2:k?n+4*r:n-4*r],o=[t+r+1,u?n-r/2:k?n+4*r:n-4*r];return[...[[k||u?R.right-r:R.left,R.top],[k?u?R.right-r:R.left:R.right-r,R.bottom]],e,o]}case"right":return[[t-r,u?n+r/2:k?n+4*r:n-4*r],[t-r,u?n-r/2:k?n+4*r:n-4*r],...[[k||u?R.left+r:R.right,R.top],[k?u?R.left+r:R.right:R.left+r,R.bottom]]]}}([o,i]);return u?void 0:c&&!T?m():void(!function(e,t){const[n,r]=e;let o=!1;const u=t.length;for(let e=0,c=u-1;e<u;c=e++){const[u,i]=t[e]||[0,0],[l,s]=t[c]||[0,0];i>=r!=s>=r&&n<=(l-u)*(r-i)/(s-i)+u&&(o=!o)}return o}([v,p],M)?m():n&&!c&&(t=setTimeout(m,n)))}};return i.__options={blockPointerEvents:o},i}function Ye(t){void 0===t&&(t={});const{open:n=!1,onOpenChange:r,nodeId:o}=t,u=f(t),c=E(),i=e.useRef(null),l=e.useRef({}),s=e.useState((()=>b()))[0],[a,m]=e.useState(null),v=e.useCallback((e=>{const t=A(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;u.refs.setReference(t)}),[u.refs]),p=e.useCallback((e=>{(A(e)||null===e)&&(i.current=e,m(e)),(A(u.refs.reference.current)||null===u.refs.reference.current||null!==e&&!A(e))&&u.refs.setReference(e)}),[u.refs]),g=e.useMemo((()=>({...u.refs,setReference:p,setPositionReference:v,domReference:i})),[u.refs,p,v]),h=e.useMemo((()=>({...u.elements,domReference:a})),[u.elements,a]),y=ce(r),w=e.useMemo((()=>({...u,refs:g,elements:h,dataRef:l,nodeId:o,events:s,open:n,onOpenChange:y})),[u,o,s,n,y,g,h]);return d((()=>{const e=null==c?void 0:c.nodesRef.current.find((e=>e.id===o));e&&(e.context=w)})),e.useMemo((()=>({...u,context:w,refs:g,reference:p,positionReference:v})),[u,g,w,p,v])}function Ze(e,t,n){const r=new Map;return{..."floating"===n&&{tabIndex:-1},...e,...t.map((e=>e?e[n]:null)).concat(e).reduce(((e,t)=>t?(Object.entries(t).forEach((t=>{let[n,o]=t;var u;0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof o&&(null==(u=r.get(n))||u.push(o),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),u=0;u<t;u++)o[u]=arguments[u];null==(e=r.get(n))||e.forEach((e=>e(...o)))})):e[n]=o})),e):e),{})}}const Ge=function(t){void 0===t&&(t=[]);const n=t,r=e.useCallback((e=>Ze(e,t,"reference")),n),o=e.useCallback((e=>Ze(e,t,"floating")),n),u=e.useCallback((e=>Ze(e,t,"item")),t.map((e=>null==e?void 0:e.item)));return e.useMemo((()=>({getReferenceProps:r,getFloatingProps:o,getItemProps:u})),[r,o,u])};export{j as FloatingDelayGroup,be as FloatingFocusManager,x as FloatingNode,ye as FloatingOverlay,ve as FloatingPortal,I as FloatingTree,ze as inner,Xe as safePolygon,Re as useClick,V as useDelayGroup,_ as useDelayGroupContext,Te as useDismiss,Ye as useFloating,R as useFloatingNodeId,w as useFloatingParentNodeId,me as useFloatingPortalNode,E as useFloatingTree,Ce as useFocus,N as useHover,g as useId,Ue as useInnerOffset,Ge as useInteractions,He as useListNavigation,Ne as useMergeRefs,Be as useRole,je as useTransitionStatus,Ve as useTransitionStyles,We as useTypeahead}; | ||
import*as e from"react";import{useLayoutEffect as t,useEffect as n,useRef as r}from"react";import{hideOthers as o}from"aria-hidden";import{tabbable as u}from"tabbable";import{createPortal as c,flushSync as i}from"react-dom";import{getOverflowAncestors as l,offset as s,detectOverflow as a,useFloating as f}from"@floating-ui/react-dom";export{arrow,autoPlacement,autoUpdate,computePosition,detectOverflow,flip,getOverflowAncestors,hide,inline,limitShift,offset,platform,shift,size}from"@floating-ui/react-dom";var d="undefined"!=typeof document?t:n;let m=!1,v=0;const p=()=>"floating-ui-"+v++;const g=e["useId".toString()]||function(){const[t,n]=e.useState((()=>m?p():void 0));return d((()=>{null==t&&n(p())}),[]),e.useEffect((()=>{m||(m=!0)}),[]),t};function b(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter((e=>e!==n)))}}}const h=e.createContext(null),y=e.createContext(null),w=()=>{var t;return(null==(t=e.useContext(h))?void 0:t.id)||null},E=()=>e.useContext(y),R=e=>{const t=g(),n=E(),r=w(),o=e||r;return d((()=>{const e={id:t,parentId:o};return null==n||n.addNode(e),()=>{null==n||n.removeNode(e)}}),[n,t,o]),t},x=t=>{let{children:n,id:r}=t;const o=w();return e.createElement(h.Provider,{value:e.useMemo((()=>({id:r,parentId:o})),[r,o])},n)},I=t=>{let{children:n}=t;const r=e.useRef([]),o=e.useCallback((e=>{r.current=[...r.current,e]}),[]),u=e.useCallback((e=>{r.current=r.current.filter((t=>t!==e))}),[]),c=e.useState((()=>b()))[0];return e.createElement(y.Provider,{value:e.useMemo((()=>({nodesRef:r,addNode:o,removeNode:u,events:c})),[r,o,u,c])},n)};function k(e){return(null==e?void 0:e.ownerDocument)||document}function T(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function C(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}function M(e){return k(e).defaultView||window}function A(e){return!!e&&e instanceof M(e).Element}function L(e){return!!e&&e instanceof M(e).HTMLElement}function O(e){if(0===e.mozInputSource&&e.isTrusted)return!0;const t=/Android/i;return(t.test(T())||t.test(C()))&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType}function P(e){return 0===e.width&&0===e.height||1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"!==e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail}function S(){return/apple/i.test(navigator.vendor)}function D(){return T().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function F(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function K(e){const t=r(e);return d((()=>{t.current=e})),t}function H(e,t,n){return n&&!F(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}const N=function(t,n){let{enabled:r=!0,delay:o=0,handleClose:u=null,mouseOnly:c=!1,restMs:i=0,move:l=!0}=void 0===n?{}:n;const{open:s,onOpenChange:a,dataRef:f,events:m,elements:{domReference:v,floating:p},refs:g}=t,b=E(),h=w(),y=K(u),R=K(o),x=e.useRef(),I=e.useRef(),T=e.useRef(),C=e.useRef(),M=e.useRef(!0),L=e.useRef(!1),O=e.useRef((()=>{})),P=e.useCallback((()=>{var e;const t=null==(e=f.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[f]);e.useEffect((()=>{if(r)return m.on("dismiss",e),()=>{m.off("dismiss",e)};function e(){clearTimeout(I.current),clearTimeout(C.current),M.current=!0}}),[r,m]),e.useEffect((()=>{if(!r||!y.current||!s)return;function e(){P()&&a(!1)}const t=k(p).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[p,s,a,r,y,f,P]);const S=e.useCallback((function(e){void 0===e&&(e=!0);const t=H(R.current,"close",x.current);t&&!T.current?(clearTimeout(I.current),I.current=setTimeout((()=>a(!1)),t)):e&&(clearTimeout(I.current),a(!1))}),[R,a]),D=e.useCallback((()=>{O.current(),T.current=void 0}),[]),N=e.useCallback((()=>{if(L.current){const e=k(g.floating.current).body;e.style.pointerEvents="",e.removeAttribute("data-floating-ui-safe-polygon"),L.current=!1}}),[g]);return e.useEffect((()=>{if(r&&A(v)){const e=v;return s&&e.addEventListener("mouseleave",u),null==p||p.addEventListener("mouseleave",u),l&&e.addEventListener("mousemove",n,{once:!0}),e.addEventListener("mouseenter",n),e.addEventListener("mouseleave",o),()=>{s&&e.removeEventListener("mouseleave",u),null==p||p.removeEventListener("mouseleave",u),l&&e.removeEventListener("mousemove",n),e.removeEventListener("mouseenter",n),e.removeEventListener("mouseleave",o)}}function e(){return!!f.current.openEvent&&["click","mousedown"].includes(f.current.openEvent.type)}function n(e){if(clearTimeout(I.current),M.current=!1,c&&!F(x.current)||i>0&&0===H(R.current,"open"))return;f.current.openEvent=e;const t=H(R.current,"open",x.current);t?I.current=setTimeout((()=>{a(!0)}),t):a(!0)}function o(n){if(e())return;O.current();const r=k(p);if(clearTimeout(C.current),y.current){clearTimeout(I.current),T.current=y.current({...t,tree:b,x:n.clientX,y:n.clientY,onClose(){N(),D(),S()}});const e=T.current;return r.addEventListener("mousemove",e),void(O.current=()=>{r.removeEventListener("mousemove",e)})}S()}function u(n){e()||null==y.current||y.current({...t,tree:b,x:n.clientX,y:n.clientY,onClose(){D(),S()}})(n)}}),[v,p,r,t,c,i,l,S,D,N,a,s,b,R,y,f]),d((()=>{var e;if(r&&s&&null!=(e=y.current)&&e.__options.blockPointerEvents&&P()){const e=k(p).body;if(e.setAttribute("data-floating-ui-safe-polygon",""),e.style.pointerEvents="none",L.current=!0,A(v)&&p){var t,n;const e=v,r=null==b||null==(t=b.nodesRef.current.find((e=>e.id===h)))||null==(n=t.context)?void 0:n.elements.floating;return r&&(r.style.pointerEvents=""),e.style.pointerEvents="auto",p.style.pointerEvents="auto",()=>{e.style.pointerEvents="",p.style.pointerEvents=""}}}}),[r,s,h,p,v,b,y,f,P]),d((()=>{s||(x.current=void 0,D(),N())}),[s,D,N]),e.useEffect((()=>()=>{D(),clearTimeout(I.current),clearTimeout(C.current),N()}),[r,D,N]),e.useMemo((()=>{if(!r)return{};function e(e){x.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){s||0===i||(clearTimeout(C.current),C.current=setTimeout((()=>{M.current||a(!0)}),i))}},floating:{onMouseEnter(){clearTimeout(I.current)},onMouseLeave(){m.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),S(!1)}}}}),[m,r,i,s,a,S])},B=e.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{},isInstantPhase:!1}),_=()=>e.useContext(B),j=t=>{let{children:n,delay:r,timeoutMs:o=0}=t;const[u,c]=e.useReducer(((e,t)=>({...e,...t})),{delay:r,timeoutMs:o,initialDelay:r,currentId:null,isInstantPhase:!1}),i=e.useRef(null),l=e.useCallback((e=>{c({currentId:e})}),[]);return d((()=>{u.currentId?null===i.current?i.current=u.currentId:c({isInstantPhase:!0}):(c({isInstantPhase:!1}),i.current=null)}),[u.currentId]),e.createElement(B.Provider,{value:e.useMemo((()=>({...u,setState:c,setCurrentId:l})),[u,c,l])},n)},V=(t,n)=>{let{open:r,onOpenChange:o}=t,{id:u}=n;const{currentId:c,setCurrentId:i,initialDelay:l,setState:s,timeoutMs:a}=_();e.useEffect((()=>{c&&(s({delay:{open:1,close:H(l,"close")}}),c!==u&&o(!1))}),[u,o,s,c,l]),e.useEffect((()=>{function e(){o(!1),s({delay:l,currentId:null})}if(!r&&c===u){if(a){const t=window.setTimeout(e,a);return()=>{clearTimeout(t)}}e()}}),[r,s,c,u,o,l,a]),e.useEffect((()=>{r&&i(u)}),[r,i,u])};function W(){return W=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},W.apply(this,arguments)}function q(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(r=n.shadowRoot)?void 0:r.activeElement);){var n,r;t=t.shadowRoot.activeElement}return t}function z(e,t){if(!e||!t)return!1;const n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&(r=n,"undefined"!=typeof ShadowRoot&&(r instanceof M(r).ShadowRoot||r instanceof ShadowRoot))){let n=t;do{if(n&&e===n)return!0;n=n.parentNode||n.host}while(n)}var r;return!1}let U=0;function X(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(U);const u=()=>null==e?void 0:e.focus({preventScroll:n});o?u():U=requestAnimationFrame(u)}function Y(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)}))||[],r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))}))||[],n=n.concat(r);return n}function Z(e){return"composedPath"in e?e.composedPath()[0]:e.target}function G(e){return L(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function J(e){e.preventDefault(),e.stopPropagation()}const Q=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function $(e,t){const n=u(e,Q());"prev"===t&&n.reverse();const r=n.indexOf(q(k(e)));return n.slice(r+1)[0]}function ee(){return $(document.body,"next")}function te(){return $(document.body,"prev")}function ne(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!z(n,r)}function re(e){u(e,Q()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function oe(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const ue=e["useInsertionEffect".toString()]||(e=>e());function ce(t){const n=e.useRef((()=>{}));return ue((()=>{n.current=t})),e.useCallback((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return null==n.current?void 0:n.current(...t)}),[])}const ie={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 le,se;function ae(e){"Tab"===e.key&&(le=e.target,clearTimeout(se))}const fe=e.forwardRef((function(t,n){const r=ce(t.onFocus),[o,u]=e.useState();return d((()=>(S()&&u("button"),document.addEventListener("keydown",ae),()=>{document.removeEventListener("keydown",ae)})),[]),e.createElement("span",W({},t,{ref:n,tabIndex:0,role:o,"aria-hidden":!o||void 0,"data-floating-ui-focus-guard":"",style:ie,onFocus:e=>{S()&&D()&&!function(e){const t=le===e.relatedTarget;return le=e.relatedTarget,clearTimeout(se),t}(e)?(e.persist(),se=window.setTimeout((()=>{r(e)}),50)):r(e)}}))})),de=e.createContext(null),me=function(t){let{id:n,enabled:r=!0}=void 0===t?{}:t;const[o,u]=e.useState(null),c=g(),i=pe();return d((()=>{if(!r)return;const e=n?document.getElementById(n):null;if(!e){const e=document.createElement("div");""!==n&&(e.id=n||c),e.setAttribute("data-floating-ui-portal",""),u(e);const t=(null==i?void 0:i.portalNode)||document.body;return t.appendChild(e),()=>{t.removeChild(e)}}e.setAttribute("data-floating-ui-portal",""),u(e)}),[n,i,c,r]),o},ve=t=>{let{children:n,id:r,root:o=null,preserveTabOrder:u=!0}=t;const i=me({id:r,enabled:!o}),[l,s]=e.useState(null),a=e.useRef(null),f=e.useRef(null),d=e.useRef(null),m=e.useRef(null),v=!!l&&!l.modal&&!(!o&&!i)&&u;return e.useEffect((()=>{if(i&&u&&(null==l||!l.modal))return i.addEventListener("focusin",e,!0),i.addEventListener("focusout",e,!0),()=>{i.removeEventListener("focusin",e,!0),i.removeEventListener("focusout",e,!0)};function e(e){if(i&&ne(e)){("focusin"===e.type?oe:re)(i)}}}),[i,u,null==l?void 0:l.modal]),e.createElement(de.Provider,{value:e.useMemo((()=>({preserveTabOrder:u,beforeOutsideRef:a,afterOutsideRef:f,beforeInsideRef:d,afterInsideRef:m,portalNode:i,setFocusManagerState:s})),[u,i])},v&&i&&e.createElement(fe,{"data-type":"outside",ref:a,onFocus:e=>{if(ne(e,i)){var t;null==(t=d.current)||t.focus()}else{const e=te()||(null==l?void 0:l.refs.domReference.current);null==e||e.focus()}}}),v&&i&&e.createElement("span",{"aria-owns":i.id,style:ie}),o?c(n,o):i?c(n,i):null,v&&i&&e.createElement(fe,{"data-type":"outside",ref:f,onFocus:e=>{if(ne(e,i)){var t;null==(t=m.current)||t.focus()}else{const e=ee()||(null==l?void 0:l.refs.domReference.current);null==e||e.focus(),(null==l?void 0:l.closeOnFocusOut)&&(null==l||l.onOpenChange(!1))}}}))},pe=()=>e.useContext(de),ge=e.forwardRef((function(t,n){return e.createElement("button",W({},t,{type:"button",ref:n,tabIndex:-1,style:ie}))}));function be(t){let{context:n,children:r,order:c=["content"],guards:i=!0,initialFocus:l=0,returnFocus:s=!0,modal:a=!0,visuallyHiddenDismiss:f=!1,closeOnFocusOut:m=!0}=t;const{refs:v,nodeId:p,onOpenChange:g,events:b,dataRef:h,elements:{domReference:y,floating:w}}=n,R=K(c),x=E(),I=pe(),[T,C]=e.useState(null),M="number"==typeof l&&l<0,A=e.useRef(null),O=e.useRef(null),P=e.useRef(!1),S=e.useRef(null),D=e.useRef(!1),F=null!=I,H=y&&"combobox"===y.getAttribute("role")&&G(y),N=e.useCallback((function(e){return void 0===e&&(e=w),e?u(e,Q()):[]}),[w]),B=e.useCallback((e=>{const t=N(e);return R.current.map((e=>y&&"reference"===e?y:w&&"floating"===e?w:t)).filter(Boolean).flat()}),[y,w,R,N]);e.useEffect((()=>{if(!a)return;function e(e){if("Tab"===e.key){0!==N().length||H||J(e);const t=B(),n=Z(e);"reference"===R.current[0]&&n===y&&(J(e),e.shiftKey?X(t[t.length-1]):X(t[1])),"floating"===R.current[1]&&n===w&&e.shiftKey&&(J(e),X(t[0]))}}const t=k(w);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[y,w,a,R,v,H,N,B]),e.useEffect((()=>{if(m)return w&&L(y)?(y.addEventListener("focusout",t),y.addEventListener("pointerdown",e),!a&&w.addEventListener("focusout",t),()=>{y.removeEventListener("focusout",t),y.removeEventListener("pointerdown",e),!a&&w.removeEventListener("focusout",t)}):void 0;function e(){D.current=!0,setTimeout((()=>{D.current=!1}))}function t(e){const t=e.relatedTarget,n=!(z(y,t)||z(w,t)||z(t,w)||z(null==I?void 0:I.portalNode,t)||null!=t&&t.hasAttribute("data-floating-ui-focus-guard")||x&&(Y(x.nodesRef.current,p).find((e=>{var n,r;return z(null==(n=e.context)?void 0:n.elements.floating,t)||z(null==(r=e.context)?void 0:r.elements.domReference,t)}))||function(e,t){var n;let r=[],o=null==(n=e.find((e=>e.id===t)))?void 0:n.parentId;for(;o;){const t=e.find((e=>e.id===o));o=null==t?void 0:t.parentId,t&&(r=r.concat(t))}return r}(x.nodesRef.current,p).find((e=>{var n,r;return(null==(n=e.context)?void 0:n.elements.floating)===t||(null==(r=e.context)?void 0:r.elements.domReference)===t}))));t&&n&&!D.current&&t!==S.current&&(P.current=!0,setTimeout((()=>g(!1))))}}),[y,w,a,p,x,I,g,m]),e.useEffect((()=>{var e;const t=Array.from((null==I||null==(e=I.portalNode)?void 0:e.querySelectorAll("[data-floating-ui-portal]"))||[]);if(w&&a){const e=[w,...t,...[A.current,O.current].filter(Boolean)],n=o(R.current.includes("reference")||H?e.concat(y||[]):e);return()=>{n()}}}),[y,w,a,R,I,H]),e.useEffect((()=>{if(a&&!i&&w){const e=[],t=Q(),n=u(k(w).body,t),r=B(),o=n.filter((e=>!r.includes(e)));return o.forEach(((t,n)=>{e[n]=t.getAttribute("tabindex"),t.setAttribute("tabindex","-1")})),()=>{o.forEach(((t,n)=>{const r=e[n];null==r?t.removeAttribute("tabindex"):t.setAttribute("tabindex",r)}))}}}),[w,a,i,B]),d((()=>{if(!w)return;const e=k(w);let t=s,n=!1;const r=q(e),o=h.current;S.current=r;const u=B(w),c=("number"==typeof l?u[l]:l.current)||w;function i(e){if("escapeKey"===e.type&&v.domReference.current&&(S.current=v.domReference.current),["referencePress","escapeKey"].includes(e.type))return;const r=e.data.returnFocus;"object"==typeof r?(t=!0,n=r.preventScroll):t=r}return!M&&X(c,{preventScroll:c===w}),b.on("dismiss",i),()=>{var r;(b.off("dismiss",i),z(w,q(e))&&v.domReference.current&&(S.current=v.domReference.current),t&&L(S.current)&&!P.current)&&(!v.domReference.current||D.current?X(S.current,{cancelPrevious:!1,preventScroll:n}):(o.__syncReturnFocus=!0,null==(r=S.current)||r.focus({preventScroll:n}),setTimeout((()=>{delete o.__syncReturnFocus}))))}}),[w,B,l,s,h,v,b,M]),d((()=>{if(I)return I.setFocusManagerState({...n,modal:a,closeOnFocusOut:m}),()=>{I.setFocusManagerState(null)}}),[I,a,m,n]),d((()=>{if(!M&&w&&(e(),"function"==typeof MutationObserver)){const t=new MutationObserver(e);return t.observe(w,{childList:!0,subtree:!0}),()=>{t.disconnect()}}function e(){C(N().length)}}),[w,N,M,v]);const _=i&&(F||a)&&!H;function j(t){return f&&a?e.createElement(ge,{ref:"start"===t?A:O,onClick:()=>g(!1)},"string"==typeof f?f:"Dismiss"):null}return e.createElement(e.Fragment,null,_&&e.createElement(fe,{"data-type":"inside",ref:null==I?void 0:I.beforeInsideRef,onFocus:e=>{if(a){const e=B();X("reference"===c[0]?e[0]:e[e.length-1])}else if(null!=I&&I.preserveTabOrder&&I.portalNode)if(P.current=!1,ne(e,I.portalNode)){const e=ee()||y;null==e||e.focus()}else{var t;null==(t=I.beforeOutsideRef.current)||t.focus()}}}),H?null:j("start"),e.cloneElement(r,0===T||c.includes("floating")?{tabIndex:0}:{}),j("end"),_&&e.createElement(fe,{"data-type":"inside",ref:null==I?void 0:I.afterInsideRef,onFocus:e=>{if(a)X(B()[0]);else if(null!=I&&I.preserveTabOrder&&I.portalNode)if(P.current=!0,ne(e,I.portalNode)){const e=te()||y;null==e||e.focus()}else{var t;null==(t=I.afterOutsideRef.current)||t.focus()}}}))}const he="data-floating-ui-scroll-lock",ye=e.forwardRef((function(t,n){let{lockScroll:r=!1,...o}=t;return d((()=>{var e,t;if(!r)return;if(document.body.hasAttribute(he))return;document.body.setAttribute(he,"");const n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth;if(!/iP(hone|ad|od)|iOS/.test(T()))return Object.assign(document.body.style,{overflow:"hidden",[n]:o+"px"}),()=>{document.body.removeAttribute(he),Object.assign(document.body.style,{overflow:"",[n]:""})};const u=(null==(e=window.visualViewport)?void 0:e.offsetLeft)||0,c=(null==(t=window.visualViewport)?void 0:t.offsetTop)||0,i=window.pageXOffset,l=window.pageYOffset;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:-(l-Math.floor(c))+"px",left:-(i-Math.floor(u))+"px",right:"0",[n]:o+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[n]:""}),document.body.removeAttribute(he),window.scrollTo(i,l)}}),[r]),e.createElement("div",W({ref:n},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function we(e){return L(e.target)&&"BUTTON"===e.target.tagName}function Ee(e){return G(e)}const Re=function(t,n){let{open:r,onOpenChange:o,dataRef:u,elements:{domReference:c}}=t,{enabled:i=!0,event:l="click",toggle:s=!0,ignoreMouse:a=!1,keyboardHandlers:f=!0}=void 0===n?{}:n;const d=e.useRef();return e.useMemo((()=>i?{reference:{onPointerDown(e){d.current=e.pointerType},onMouseDown(e){0===e.button&&(F(d.current,!0)&&a||"click"!==l&&(r?!s||u.current.openEvent&&"mousedown"!==u.current.openEvent.type||o(!1):(e.preventDefault(),o(!0)),u.current.openEvent=e.nativeEvent))},onClick(e){u.current.__syncReturnFocus||("mousedown"===l&&d.current?d.current=void 0:F(d.current,!0)&&a||(r?!s||u.current.openEvent&&"click"!==u.current.openEvent.type||o(!1):o(!0),u.current.openEvent=e.nativeEvent))},onKeyDown(e){d.current=void 0,f&&(we(e)||(" "!==e.key||Ee(c)||e.preventDefault(),"Enter"===e.key&&(r?s&&o(!1):o(!0))))},onKeyUp(e){f&&(we(e)||Ee(c)||" "===e.key&&(r?s&&o(!1):o(!0)))}}}:{}),[i,u,l,a,f,c,s,r,o])};function xe(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}const Ie={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},ke={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Te=function(t,n){let{open:r,onOpenChange:o,events:u,nodeId:c,elements:{reference:i,domReference:s,floating:a},dataRef:f}=t,{enabled:d=!0,escapeKey:m=!0,outsidePress:v=!0,outsidePressEvent:p="pointerdown",referencePress:g=!1,referencePressEvent:b="pointerdown",ancestorScroll:h=!1,bubbles:y=!0}=void 0===n?{}:n;const R=E(),x=null!=w(),I=ce("function"==typeof v?v:()=>!1),T="function"==typeof v?I:v,C=e.useRef(!1),{escapeKeyBubbles:M,outsidePressBubbles:S}=function(e){var t,n;return void 0===e&&(e=!0),{escapeKeyBubbles:"boolean"==typeof e?e:null==(t=e.escapeKey)||t,outsidePressBubbles:"boolean"==typeof e?e:null==(n=e.outsidePress)||n}}(y);return e.useEffect((()=>{if(!r||!d)return;function e(e){if("Escape"===e.key){const e=R?Y(R.nodesRef.current,c):[];if(e.length>0){let t=!0;if(e.forEach((e=>{var n;null==(n=e.context)||!n.open||e.context.dataRef.current.__escapeKeyBubbles||(t=!1)})),!t)return}u.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),o(!1)}}function t(e){const t=C.current;if(C.current=!1,t)return;if("function"==typeof T&&!T(e))return;const n=Z(e);if(L(n)&&a){const t=a.ownerDocument.defaultView||window,r=n.scrollWidth>n.clientWidth,o=n.scrollHeight>n.clientHeight;let u=o&&e.offsetX>n.clientWidth;if(o){"rtl"===t.getComputedStyle(n).direction&&(u=e.offsetX<=n.offsetWidth-n.clientWidth)}if(u||r&&e.offsetY>n.clientHeight)return}const r=R&&Y(R.nodesRef.current,c).some((t=>{var n;return xe(e,null==(n=t.context)?void 0:n.elements.floating)}));if(xe(e,a)||xe(e,s)||r)return;const i=R?Y(R.nodesRef.current,c):[];if(i.length>0){let e=!0;if(i.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}u.emit("dismiss",{type:"outsidePress",data:{returnFocus:x?{preventScroll:!0}:O(e)||P(e)}}),o(!1)}function n(){o(!1)}f.current.__escapeKeyBubbles=M,f.current.__outsidePressBubbles=S;const v=k(a);m&&v.addEventListener("keydown",e),T&&v.addEventListener(p,t);let g=[];return h&&(A(s)&&(g=l(s)),A(a)&&(g=g.concat(l(a))),!A(i)&&i&&i.contextElement&&(g=g.concat(l(i.contextElement)))),g=g.filter((e=>{var t;return e!==(null==(t=v.defaultView)?void 0:t.visualViewport)})),g.forEach((e=>{e.addEventListener("scroll",n,{passive:!0})})),()=>{m&&v.removeEventListener("keydown",e),T&&v.removeEventListener(p,t),g.forEach((e=>{e.removeEventListener("scroll",n)}))}}),[f,a,s,i,m,T,p,u,R,c,r,o,h,d,M,S,x]),e.useEffect((()=>{C.current=!1}),[T,p]),e.useMemo((()=>d?{reference:{[Ie[b]]:()=>{g&&(u.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),o(!1))}},floating:{[ke[p]]:()=>{C.current=!0}}}:{}),[d,u,g,p,b,o])},Ce=function(t,n){let{open:r,onOpenChange:o,dataRef:u,events:c,refs:i,elements:{floating:l,domReference:s}}=t,{enabled:a=!0,keyboardOnly:f=!0}=void 0===n?{}:n;const d=e.useRef(""),m=e.useRef(!1),v=e.useRef();return e.useEffect((()=>{if(!a)return;const e=k(l).defaultView||window;function t(){!r&&L(s)&&s===q(k(s))&&(m.current=!0)}return e.addEventListener("blur",t),()=>{e.removeEventListener("blur",t)}}),[l,s,r,a]),e.useEffect((()=>{if(a)return c.on("dismiss",e),()=>{c.off("dismiss",e)};function e(e){"referencePress"!==e.type&&"escapeKey"!==e.type||(m.current=!0)}}),[c,a]),e.useEffect((()=>()=>{clearTimeout(v.current)}),[]),e.useMemo((()=>a?{reference:{onPointerDown(e){let{pointerType:t}=e;d.current=t,m.current=!(!t||!f)},onMouseLeave(){m.current=!1},onFocus(e){var t;m.current||"focus"===e.type&&"mousedown"===(null==(t=u.current.openEvent)?void 0:t.type)&&u.current.openEvent&&xe(u.current.openEvent,s)||(u.current.openEvent=e.nativeEvent,o(!0))},onBlur(e){m.current=!1;const t=e.relatedTarget,n=A(t)&&t.hasAttribute("data-floating-ui-focus-guard")&&"outside"===t.getAttribute("data-type");v.current=setTimeout((()=>{z(i.floating.current,t)||z(s,t)||n||o(!1)}))}}}:{}),[a,f,s,i,u,o])};let Me=!1;function Ae(e,t,n){return Math.floor(e/t)!==n}function Le(e,t){return t<0||t>=e.current.length}function Oe(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o,amount:u=1}=void 0===t?{}:t;const c=e.current;let i=n;do{var l,s;i+=r?-u:u}while(i>=0&&i<=c.length-1&&(o?o.includes(i):null==c[i]||(null==(l=c[i])?void 0:l.hasAttribute("disabled"))||"true"===(null==(s=c[i])?void 0:s.getAttribute("aria-disabled"))));return i}function Pe(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Se(e,t){return Pe(t,"ArrowUp"===e||"ArrowDown"===e,"ArrowLeft"===e||"ArrowRight"===e)}function De(e,t,n){return Pe(t,"ArrowDown"===e,n?"ArrowLeft"===e:"ArrowRight"===e)||"Enter"===e||" "==e||""===e}function Fe(e,t){return Oe(e,{disabledIndices:t})}function Ke(e,t){return Oe(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}const He=function(t,n){let{open:r,onOpenChange:o,refs:u,elements:{domReference:c}}=t,{listRef:l,activeIndex:s,onNavigate:a=(()=>{}),enabled:f=!0,selectedIndex:m=null,allowEscape:v=!1,loop:p=!1,nested:g=!1,rtl:b=!1,virtual:h=!1,focusItemOnOpen:y="auto",focusItemOnHover:R=!0,openOnArrowKeyDown:x=!0,disabledIndices:I,orientation:T="vertical",cols:C=1,scrollItemIntoView:M=!0}=void 0===n?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:n;const A=w(),F=E(),H=ce(a),N=e.useRef(y),B=e.useRef(null!=m?m:-1),_=e.useRef(null),j=e.useRef(!0),V=e.useRef(H),W=e.useRef(r),U=e.useRef(!1),Y=e.useRef(!1),Z=K(I),G=K(r),Q=K(M),[$,ee]=e.useState(),te=e.useCallback((function(e,t,n){void 0===n&&(n=!1);const r=e.current[t.current];h?ee(null==r?void 0:r.id):X(r,{preventScroll:!0,sync:!(!D()||!S())&&(Me||U.current)}),requestAnimationFrame((()=>{const e=Q.current;e&&r&&(n||!j.current)&&(null==r.scrollIntoView||r.scrollIntoView("boolean"==typeof e?{block:"nearest",inline:"nearest"}:e))}))}),[h,Q]);d((()=>{document.createElement("div").focus({get preventScroll(){return Me=!0,!1}})}),[]),d((()=>{f&&(r?N.current&&null!=m&&(Y.current=!0,H(m)):W.current&&(B.current=-1,V.current(null)))}),[f,r,m,H]),d((()=>{if(f&&r)if(null==s){if(U.current=!1,null!=m)return;W.current&&(B.current=-1,te(l,B)),!W.current&&N.current&&(null!=_.current||!0===N.current&&null==_.current)&&(B.current=null==_.current||De(_.current,T,b)||g?Fe(l,Z.current):Ke(l,Z.current),H(B.current))}else Le(l,s)||(B.current=s,te(l,B,Y.current),Y.current=!1)}),[f,r,s,m,g,l,T,b,H,te,Z]),d((()=>{if(f&&W.current&&!r){var e,t;const n=null==F||null==(e=F.nodesRef.current.find((e=>e.id===A)))||null==(t=e.context)?void 0:t.elements.floating;n&&!z(n,q(k(n)))&&n.focus({preventScroll:!0})}}),[f,r,F,A]),d((()=>{_.current=null,V.current=H,W.current=r}));const ne=null!=s,re=e.useMemo((()=>{function e(e){if(!r)return;const t=l.current.indexOf(e);-1!==t&&H(t)}return{onFocus(t){let{currentTarget:n}=t;e(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...R&&{onMouseMove(t){let{currentTarget:n}=t;e(n)},onPointerLeave(){var e;j.current&&(B.current=-1,te(l,B),i((()=>H(null))),h||null==(e=u.floating.current)||e.focus({preventScroll:!0}))}}}}),[r,u,te,R,l,H,h]);return e.useMemo((()=>{if(!f)return{};const e=Z.current;function t(t){if(j.current=!1,U.current=!0,!G.current&&t.currentTarget===u.floating.current)return;if(g&&function(e,t,n){return Pe(t,n?"ArrowRight"===e:"ArrowLeft"===e,"ArrowUp"===e)}(t.key,T,b))return J(t),o(!1),void(L(c)&&c.focus());const n=B.current,i=Fe(l,e),s=Ke(l,e);if("Home"===t.key&&(B.current=i,H(B.current)),"End"===t.key&&(B.current=s,H(B.current)),C>1){const n=B.current;if("ArrowUp"===t.key){if(J(t),-1===n)B.current=s;else if(B.current=Oe(l,{startingIndex:n,amount:C,decrement:!0,disabledIndices:e}),p&&(n-C<i||B.current<0)){const e=n%C,t=s%C,r=s-(t-e);B.current=t===e?s:t>e?r:r-C}Le(l,B.current)&&(B.current=n),H(B.current)}if("ArrowDown"===t.key&&(J(t),-1===n?B.current=i:(B.current=Oe(l,{startingIndex:n,amount:C,disabledIndices:e}),p&&n+C>s&&(B.current=Oe(l,{startingIndex:n%C-C,amount:C,disabledIndices:e}))),Le(l,B.current)&&(B.current=n),H(B.current)),"both"===T){const r=Math.floor(n/C);"ArrowRight"===t.key&&(J(t),n%C!=C-1?(B.current=Oe(l,{startingIndex:n,disabledIndices:e}),p&&Ae(B.current,C,r)&&(B.current=Oe(l,{startingIndex:n-n%C-1,disabledIndices:e}))):p&&(B.current=Oe(l,{startingIndex:n-n%C-1,disabledIndices:e})),Ae(B.current,C,r)&&(B.current=n)),"ArrowLeft"===t.key&&(J(t),n%C!=0?(B.current=Oe(l,{startingIndex:n,disabledIndices:e,decrement:!0}),p&&Ae(B.current,C,r)&&(B.current=Oe(l,{startingIndex:n+(C-n%C),decrement:!0,disabledIndices:e}))):p&&(B.current=Oe(l,{startingIndex:n+(C-n%C),decrement:!0,disabledIndices:e})),Ae(B.current,C,r)&&(B.current=n));const o=Math.floor(s/C)===r;return Le(l,B.current)&&(B.current=p&&o?"ArrowLeft"===t.key?s:Oe(l,{startingIndex:n-n%C-1,disabledIndices:e}):n),void H(B.current)}}if(Se(t.key,T)){if(J(t),r&&!h&&q(t.currentTarget.ownerDocument)===t.currentTarget)return B.current=De(t.key,T,b)?i:s,void H(B.current);De(t.key,T,b)?B.current=p?n>=s?v&&n!==l.current.length?-1:i:Oe(l,{startingIndex:n,disabledIndices:e}):Math.min(s,Oe(l,{startingIndex:n,disabledIndices:e})):B.current=p?n<=i?v&&-1!==n?l.current.length:s:Oe(l,{startingIndex:n,decrement:!0,disabledIndices:e}):Math.max(i,Oe(l,{startingIndex:n,decrement:!0,disabledIndices:e})),Le(l,B.current)?H(null):H(B.current)}}function n(e){"auto"===y&&O(e.nativeEvent)&&(N.current=!0)}const i=h&&r&&ne&&{"aria-activedescendant":$};return{reference:{...i,onKeyDown(n){j.current=!1;const u=0===n.key.indexOf("Arrow");if(h&&r)return t(n);if(!r&&!x&&u)return;(u||"Enter"===n.key||" "===n.key||""===n.key)&&(_.current=n.key),g?function(e,t,n){return Pe(t,n?"ArrowLeft"===e:"ArrowRight"===e,"ArrowDown"===e)}(n.key,T,b)&&(J(n),r?(B.current=Fe(l,e),H(B.current)):o(!0)):Se(n.key,T)&&(null!=m&&(B.current=m),J(n),!r&&x?o(!0):t(n),r&&H(B.current))},onFocus(){r&&H(null)},onPointerDown:function(e){N.current=y,"auto"===y&&P(e.nativeEvent)&&(N.current=!0)},onMouseDown:n,onClick:n},floating:{"aria-orientation":"both"===T?void 0:T,...i,onKeyDown:t,onPointerMove(){j.current=!0}},item:re}}),[c,u,$,Z,G,l,f,T,b,h,r,ne,g,m,x,v,C,p,y,H,o,re])};function Ne(t){return e.useMemo((()=>t.every((e=>null==e))?null:e=>{t.forEach((t=>{"function"==typeof t?t(e):null!=t&&(t.current=e)}))}),t)}const Be=function(t,n){let{open:r}=t,{enabled:o=!0,role:u="dialog"}=void 0===n?{}:n;const c=g(),i=g();return e.useMemo((()=>{const e={id:c,role:u};return o?"tooltip"===u?{reference:{"aria-describedby":r?c:void 0},floating:e}:{reference:{"aria-expanded":r?"true":"false","aria-haspopup":"alertdialog"===u?"dialog":u,"aria-controls":r?c:void 0,..."listbox"===u&&{role:"combobox"},..."menu"===u&&{id:i}},floating:{...e,..."menu"===u&&{"aria-labelledby":i}}}:{}}),[o,u,r,c,i])},_e=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function je(t,n){let{open:r,elements:{floating:o}}=t,{duration:u=250}=void 0===n?{}:n;const c=("number"==typeof u?u:u.close)||0,[i,l]=e.useState(!1),[s,a]=e.useState("unmounted"),f=function(t,n){const[r,o]=e.useState(t);return t&&!r&&o(!0),e.useEffect((()=>{if(!t){const e=setTimeout((()=>o(!1)),n);return()=>clearTimeout(e)}}),[t,n]),r}(r,c);return d((()=>{i&&!f&&a("unmounted")}),[i,f]),d((()=>{if(o){if(r){a("initial");const e=requestAnimationFrame((()=>{a("open")}));return()=>{cancelAnimationFrame(e)}}l(!0),a("close")}}),[r,o]),{isMounted:f,status:s}}function Ve(t,n){let{initial:r={opacity:0},open:o,close:u,common:c,duration:i=250}=void 0===n?{}:n;const l=t.placement,s=l.split("-")[0],[a,f]=e.useState({}),{isMounted:m,status:v}=je(t,{duration:i}),p=K(r),g=K(o),b=K(u),h=K(c),y="number"==typeof i,w=(y?i:i.open)||0,E=(y?i:i.close)||0;return d((()=>{const e={side:s,placement:l},t=p.current,n=b.current,r=g.current,o=h.current,u="function"==typeof t?t(e):t,c="function"==typeof n?n(e):n,i="function"==typeof o?o(e):o,a=("function"==typeof r?r(e):r)||Object.keys(u).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===v&&f((e=>({transitionProperty:e.transitionProperty,...i,...u}))),"open"===v&&f({transitionProperty:Object.keys(a).map(_e).join(","),transitionDuration:w+"ms",...i,...a}),"close"===v){const e=c||u;f({transitionProperty:Object.keys(e).map(_e).join(","),transitionDuration:E+"ms",...i,...e})}}),[s,l,E,b,p,g,h,w,v]),{isMounted:m,styles:a}}const We=function(t,n){var r;let{open:o,dataRef:u}=t,{listRef:c,activeIndex:i,onMatch:l=(()=>{}),enabled:s=!0,findMatch:a=null,resetMs:f=1e3,ignoreKeys:m=[],selectedIndex:v=null}=void 0===n?{listRef:{current:[]},activeIndex:null}:n;const p=e.useRef(),g=e.useRef(""),b=e.useRef(null!=(r=null!=v?v:i)?r:-1),h=e.useRef(null),y=ce(l),w=K(a),E=K(m);return d((()=>{o&&(clearTimeout(p.current),h.current=null,g.current="")}),[o]),d((()=>{var e;o&&""===g.current&&(b.current=null!=(e=null!=v?v:i)?e:-1)}),[o,v,i]),e.useMemo((()=>{if(!s)return{};function e(e){const t=Z(e.nativeEvent);if(A(t)&&q(k(t))!==e.currentTarget&&t.closest('[role="dialog"],[role="menu"],[role="listbox"],[role="tree"],[role="grid"]')!==e.currentTarget)return;g.current.length>0&&" "!==g.current[0]&&(u.current.typing=!0," "===e.key&&J(e));const n=c.current;if(null==n||E.current.includes(e.key)||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey)return;n.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&g.current===e.key&&(g.current="",b.current=h.current),g.current+=e.key,clearTimeout(p.current),p.current=setTimeout((()=>{g.current="",b.current=h.current,u.current.typing=!1}),f);const r=b.current,o=[...n.slice((r||0)+1),...n.slice(0,(r||0)+1)],i=w.current?w.current(o,g.current):o.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(g.current.toLocaleLowerCase())))),l=i?n.indexOf(i):-1;-1!==l&&(y(l),h.current=l)}return{reference:{onKeyDown:e},floating:{onKeyDown:e}}}),[s,u,c,f,E,w,y])};function qe(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const ze=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:u=0,index:c=0,minItemsVisible:l=4,referenceOverflowThreshold:f=0,scrollRef:d,...m}=e,{rects:v,elements:{floating:p}}=t,g=n.current[c];if(!g)return{};const b={...t,...await s(-g.offsetTop-v.reference.height/2-g.offsetHeight/2-u).fn(t)},h=(null==d?void 0:d.current)||p,y=await a(qe(b,h.scrollHeight),m),w=await a(b,{...m,elementContext:"reference"}),E=Math.max(0,y.top),R=b.y+E,x=Math.max(0,h.scrollHeight-E-Math.max(0,y.bottom));return h.style.maxHeight=x+"px",h.scrollTop=E,o&&(h.offsetHeight<g.offsetHeight*Math.min(l,n.current.length-1)-1||w.top>=-f||w.bottom>=-f?i((()=>o(!0))):i((()=>o(!1)))),r&&(r.current=await a(qe({...b,y:R},h.offsetHeight),m)),{y:R}}}),Ue=(t,n)=>{let{open:r,elements:o}=t,{enabled:u=!0,overflowRef:c,scrollRef:l,onChange:s}=n;const a=ce(s),f=e.useRef(!1),d=e.useRef(null),m=e.useRef(null);return e.useEffect((()=>{if(!u)return;function e(e){if(e.ctrlKey||!t||null==c.current)return;const n=e.deltaY,r=c.current.top>=-.5,o=c.current.bottom>=-.5,u=t.scrollHeight-t.clientHeight,l=n<0?-1:1,s=n<0?"max":"min";t.scrollHeight<=t.clientHeight||(!r&&n>0||!o&&n<0?(e.preventDefault(),i((()=>{a((e=>e+Math[s](n,u*l)))}))):/firefox/i.test(C())&&(t.scrollTop+=n))}const t=(null==l?void 0:l.current)||o.floating;return r&&t?(t.addEventListener("wheel",e),requestAnimationFrame((()=>{d.current=t.scrollTop,null!=c.current&&(m.current={...c.current})})),()=>{d.current=null,m.current=null,t.removeEventListener("wheel",e)}):void 0}),[u,r,o.floating,c,l,a]),e.useMemo((()=>u?{floating:{onKeyDown(){f.current=!0},onWheel(){f.current=!1},onPointerMove(){f.current=!1},onScroll(){const e=(null==l?void 0:l.current)||o.floating;if(c.current&&e&&f.current){if(null!==d.current){const t=e.scrollTop-d.current;(c.current.bottom<-.5&&t<-1||c.current.top<-.5&&t>1)&&i((()=>a((e=>e+t))))}requestAnimationFrame((()=>{d.current=e.scrollTop}))}}}}:{}),[u,c,o.floating,l,a])};function Xe(e){let t,{restMs:n=0,buffer:r=.5,blockPointerEvents:o=!1}=void 0===e?{}:e,u=!1,c=!1;const i=e=>{let{x:o,y:i,placement:l,elements:s,onClose:a,nodeId:f,tree:d}=e;return function(e){function m(){clearTimeout(t),a()}if(clearTimeout(t),!s.domReference||!s.floating||null==l||null==o||null==i)return;const{clientX:v,clientY:p}=e,g=[v,p],b=Z(e),h="mouseleave"===e.type,y=z(s.floating,b),w=z(s.domReference,b),E=s.domReference.getBoundingClientRect(),R=s.floating.getBoundingClientRect(),x=l.split("-")[0],I=o>R.right-R.width/2,k=i>R.bottom-R.height/2,T=function(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}(g,E);if(y&&(c=!0),w&&(c=!1),w&&!h)return void(c=!0);if(h&&A(e.relatedTarget)&&z(s.floating,e.relatedTarget))return;if(d&&Y(d.nodesRef.current,f).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if("top"===x&&i>=E.bottom-1||"bottom"===x&&i<=E.top+1||"left"===x&&o>=E.right-1||"right"===x&&o<=E.left+1)return m();let C=[];switch(x){case"top":C=[[R.left,E.top+1],[R.left,R.bottom-1],[R.right,R.bottom-1],[R.right,E.top+1]],u=v>=R.left&&v<=R.right&&p>=R.top&&p<=E.top+1;break;case"bottom":C=[[R.left,R.top+1],[R.left,E.bottom-1],[R.right,E.bottom-1],[R.right,R.top+1]],u=v>=R.left&&v<=R.right&&p>=E.bottom-1&&p<=R.bottom;break;case"left":C=[[R.right-1,R.bottom],[R.right-1,R.top],[E.left+1,R.top],[E.left+1,R.bottom]],u=v>=R.left&&v<=E.left+1&&p>=R.top&&p<=R.bottom;break;case"right":C=[[E.right-1,R.bottom],[E.right-1,R.top],[R.left+1,R.top],[R.left+1,R.bottom]],u=v>=E.right-1&&v<=R.right&&p>=R.top&&p<=R.bottom}const M=u?C:function(e){let[t,n]=e;const o=R.width>E.width,u=R.height>E.height;switch(x){case"top":return[[o?t+r/2:I?t+4*r:t-4*r,n+r+1],[o?t-r/2:I?t+4*r:t-4*r,n+r+1],...[[R.left,I||o?R.bottom-r:R.top],[R.right,I?o?R.bottom-r:R.top:R.bottom-r]]];case"bottom":return[[o?t+r/2:I?t+4*r:t-4*r,n-r],[o?t-r/2:I?t+4*r:t-4*r,n-r],...[[R.left,I||o?R.top+r:R.bottom],[R.right,I?o?R.top+r:R.bottom:R.top+r]]];case"left":{const e=[t+r+1,u?n+r/2:k?n+4*r:n-4*r],o=[t+r+1,u?n-r/2:k?n+4*r:n-4*r];return[...[[k||u?R.right-r:R.left,R.top],[k?u?R.right-r:R.left:R.right-r,R.bottom]],e,o]}case"right":return[[t-r,u?n+r/2:k?n+4*r:n-4*r],[t-r,u?n-r/2:k?n+4*r:n-4*r],...[[k||u?R.left+r:R.right,R.top],[k?u?R.left+r:R.right:R.left+r,R.bottom]]]}}([o,i]);return u?void 0:c&&!T?m():void(!function(e,t){const[n,r]=e;let o=!1;const u=t.length;for(let e=0,c=u-1;e<u;c=e++){const[u,i]=t[e]||[0,0],[l,s]=t[c]||[0,0];i>=r!=s>=r&&n<=(l-u)*(r-i)/(s-i)+u&&(o=!o)}return o}([v,p],M)?m():n&&!c&&(t=setTimeout(m,n)))}};return i.__options={blockPointerEvents:o},i}function Ye(t){void 0===t&&(t={});const{open:n=!1,onOpenChange:r,nodeId:o}=t,u=f(t),c=E(),i=e.useRef(null),l=e.useRef({}),s=e.useState((()=>b()))[0],[a,m]=e.useState(null),v=e.useCallback((e=>{const t=A(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;u.refs.setReference(t)}),[u.refs]),p=e.useCallback((e=>{(A(e)||null===e)&&(i.current=e,m(e)),(A(u.refs.reference.current)||null===u.refs.reference.current||null!==e&&!A(e))&&u.refs.setReference(e)}),[u.refs]),g=e.useMemo((()=>({...u.refs,setReference:p,setPositionReference:v,domReference:i})),[u.refs,p,v]),h=e.useMemo((()=>({...u.elements,domReference:a})),[u.elements,a]),y=ce(r),w=e.useMemo((()=>({...u,refs:g,elements:h,dataRef:l,nodeId:o,events:s,open:n,onOpenChange:y})),[u,o,s,n,y,g,h]);return d((()=>{const e=null==c?void 0:c.nodesRef.current.find((e=>e.id===o));e&&(e.context=w)})),e.useMemo((()=>({...u,context:w,refs:g,reference:p,positionReference:v})),[u,g,w,p,v])}function Ze(e,t,n){const r=new Map;return{..."floating"===n&&{tabIndex:-1},...e,...t.map((e=>e?e[n]:null)).concat(e).reduce(((e,t)=>t?(Object.entries(t).forEach((t=>{let[n,o]=t;var u;0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof o&&(null==(u=r.get(n))||u.push(o),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),u=0;u<t;u++)o[u]=arguments[u];null==(e=r.get(n))||e.forEach((e=>e(...o)))})):e[n]=o})),e):e),{})}}const Ge=function(t){void 0===t&&(t=[]);const n=t,r=e.useCallback((e=>Ze(e,t,"reference")),n),o=e.useCallback((e=>Ze(e,t,"floating")),n),u=e.useCallback((e=>Ze(e,t,"item")),t.map((e=>null==e?void 0:e.item)));return e.useMemo((()=>({getReferenceProps:r,getFloatingProps:o,getItemProps:u})),[r,o,u])};export{j as FloatingDelayGroup,be as FloatingFocusManager,x as FloatingNode,ye as FloatingOverlay,ve as FloatingPortal,I as FloatingTree,ze as inner,Xe as safePolygon,Re as useClick,V as useDelayGroup,_ as useDelayGroupContext,Te as useDismiss,Ye as useFloating,R as useFloatingNodeId,w as useFloatingParentNodeId,me as useFloatingPortalNode,E as useFloatingTree,Ce as useFocus,N as useHover,g as useId,Ue as useInnerOffset,Ge as useInteractions,He as useListNavigation,Ne as useMergeRefs,Be as useRole,je as useTransitionStatus,Ve as useTransitionStyles,We as useTypeahead}; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom"),require("@floating-ui/react-dom"),require("@floating-ui/dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","@floating-ui/react-dom","@floating-ui/dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIReactDOM={},e.React,e.ReactDOM,e.FloatingUIReactDOM,e.FloatingUIDOM)}(this,(function(e,t,n,r,o){"use strict";function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var i=u(t),c="undefined"!=typeof document?t.useLayoutEffect:t.useEffect;let l=!1,s=0;const a=()=>"floating-ui-"+s++;const f=i["useId".toString()]||function(){const[e,t]=i.useState((()=>l?a():void 0));return c((()=>{null==e&&t(a())}),[]),i.useEffect((()=>{l||(l=!0)}),[]),e};function d(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter((e=>e!==n)))}}}const m=i.createContext(null),p=i.createContext(null),v=()=>{var e;return(null==(e=i.useContext(m))?void 0:e.id)||null},g=()=>i.useContext(p);function b(e){return(null==e?void 0:e.ownerDocument)||document}function y(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function h(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}function w(e){return b(e).defaultView||window}function E(e){return!!e&&e instanceof w(e).Element}function R(e){return!!e&&e instanceof w(e).HTMLElement}function x(e){if(0===e.mozInputSource&&e.isTrusted)return!0;const t=/Android/i;return(t.test(y())||t.test(h()))&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType}function I(e){return 0===e.width&&0===e.height||1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"!==e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail}function O(){return/apple/i.test(navigator.vendor)}function k(){return y().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function T(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function S(e){const n=t.useRef(e);return c((()=>{n.current=e})),n}const P="data-floating-ui-safe-polygon";function M(e,t,n){return n&&!T(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}const C=i.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{},isInstantPhase:!1}),A=()=>i.useContext(C);function L(){return L=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},L.apply(this,arguments)}var F=new WeakMap,D=new WeakMap,N={},j=0,K=function(e,t,n){void 0===t&&(t=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e)),void 0===n&&(n="data-aria-hidden");var r=Array.isArray(e)?e:[e];N[n]||(N[n]=new WeakMap);var o=N[n],u=[],i=new Set,c=function(e){e&&!i.has(e)&&(i.add(e),c(e.parentNode))};r.forEach(c);var l=function(e){!e||r.indexOf(e)>=0||Array.prototype.forEach.call(e.children,(function(e){if(i.has(e))l(e);else{var t=e.getAttribute("aria-hidden"),r=null!==t&&"false"!==t,c=(F.get(e)||0)+1,s=(o.get(e)||0)+1;F.set(e,c),o.set(e,s),u.push(e),1===c&&r&&D.set(e,!0),1===s&&e.setAttribute(n,"true"),r||e.setAttribute("aria-hidden","true")}}))};return l(t),i.clear(),j++,function(){u.forEach((function(e){var t=F.get(e)-1,r=o.get(e)-1;F.set(e,t),o.set(e,r),t||(D.has(e)||e.removeAttribute("aria-hidden"),D.delete(e)),r||e.removeAttribute(n)})),--j||(F=new WeakMap,F=new WeakMap,D=new WeakMap,N={})}},_=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"].join(","),B="undefined"==typeof Element,H=B?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,W=!B&&Element.prototype.getRootNode?function(e){return e.getRootNode()}:function(e){return e.ownerDocument},q=function e(t,n,r){for(var o=[],u=Array.from(t);u.length;){var i=u.shift();if("SLOT"===i.tagName){var c=i.assignedElements(),l=e(c.length?c:i.children,!0,r);r.flatten?o.push.apply(o,l):o.push({scopeParent:i,candidates:l})}else{H.call(i,_)&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var s=i.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(i),a=!r.shadowRootFilter||r.shadowRootFilter(i);if(s&&a){var f=e(!0===s?i.children:s.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:i,candidates:f})}else u.unshift.apply(u,i.children)}}return o},U=function(e,t){return e.tabIndex<0&&(t||/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||e.isContentEditable)&&isNaN(parseInt(e.getAttribute("tabindex"),10))?0:e.tabIndex},V=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},z=function(e){return"INPUT"===e.tagName},X=function(e){return function(e){return z(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||W(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var o=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!o||o===e}(e)},Y=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},G=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=H.call(e,"details>summary:first-of-type")?e.parentElement:e;if(H.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Y(e)}else{if("function"==typeof r){for(var u=e;e;){var i=e.parentElement,c=W(e);if(i&&!i.shadowRoot&&!0===r(i))return Y(e);e=e.assignedSlot?e.assignedSlot:i||c===e.ownerDocument?i:c.host}e=u}if(function(e){for(var t,n=W(e).host,r=!!(null!==(t=n)&&void 0!==t&&t.ownerDocument.contains(n)||e.ownerDocument.contains(e));!r&&n;){var o;r=!(null===(o=n=W(n).host)||void 0===o||!o.ownerDocument.contains(n))}return r}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Z=function(e,t){return!(t.disabled||function(e){return z(e)&&"hidden"===e.type}(t)||G(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!H.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},$=function(e,t){return!(X(t)||U(t)<0||!Z(e,t))},J=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Q=function e(t){var n=[],r=[];return t.forEach((function(t,o){var u=!!t.scopeParent,i=u?t.scopeParent:t,c=U(i,u),l=u?e(t.candidates):i;0===c?u?n.push.apply(n,l):n.push(i):r.push({documentOrder:o,tabIndex:c,item:t,isScope:u,content:l})})),r.sort(V).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},ee=function(e,t){var n;return n=(t=t||{}).getShadowRoot?q([e],t.includeContainer,{filter:$.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:J}):function(e,t,n){var r=Array.prototype.slice.apply(e.querySelectorAll(_));return t&&H.call(e,_)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,$.bind(null,t)),Q(n)};function te(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(r=n.shadowRoot)?void 0:r.activeElement);){var n,r;t=t.shadowRoot.activeElement}return t}function ne(e,t){if(!e||!t)return!1;const n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&(r=n,"undefined"!=typeof ShadowRoot&&(r instanceof w(r).ShadowRoot||r instanceof ShadowRoot))){let n=t;do{if(n&&e===n)return!0;n=n.parentNode||n.host}while(n)}var r;return!1}let re=0;function oe(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(re);const u=()=>null==e?void 0:e.focus({preventScroll:n});o?u():re=requestAnimationFrame(u)}function ue(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)}))||[],r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))}))||[],n=n.concat(r);return n}function ie(e){return"composedPath"in e?e.composedPath()[0]:e.target}function ce(e){return R(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function le(e){e.preventDefault(),e.stopPropagation()}const se=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function ae(e,t){const n=ee(e,se());"prev"===t&&n.reverse();const r=n.indexOf(te(b(e)));return n.slice(r+1)[0]}function fe(){return ae(document.body,"next")}function de(){return ae(document.body,"prev")}function me(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!ne(n,r)}function pe(e){ee(e,se()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function ve(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const ge=i["useInsertionEffect".toString()]||(e=>e());function be(e){const t=i.useRef((()=>{}));return ge((()=>{t.current=e})),i.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}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 he,we;function Ee(e){"Tab"===e.key&&(he=e.target,clearTimeout(we))}const Re=i.forwardRef((function(e,t){const n=be(e.onFocus),[r,o]=i.useState();return c((()=>(O()&&o("button"),document.addEventListener("keydown",Ee),()=>{document.removeEventListener("keydown",Ee)})),[]),i.createElement("span",L({},e,{ref:t,tabIndex:0,role:r,"aria-hidden":!r||void 0,"data-floating-ui-focus-guard":"",style:ye,onFocus:e=>{O()&&k()&&!function(e){const t=he===e.relatedTarget;return he=e.relatedTarget,clearTimeout(we),t}(e)?(e.persist(),we=window.setTimeout((()=>{n(e)}),50)):n(e)}}))})),xe=i.createContext(null),Ie=function(e){let{id:t,enabled:n=!0}=void 0===e?{}:e;const[r,o]=i.useState(null),u=f(),l=Oe();return c((()=>{if(!n)return;const e=t?document.getElementById(t):null;if(!e){const e=document.createElement("div");""!==t&&(e.id=t||u),e.setAttribute("data-floating-ui-portal",""),o(e);const n=(null==l?void 0:l.portalNode)||document.body;return n.appendChild(e),()=>{n.removeChild(e)}}e.setAttribute("data-floating-ui-portal",""),o(e)}),[t,l,u,n]),r},Oe=()=>i.useContext(xe),ke=i.forwardRef((function(e,t){return i.createElement("button",L({},e,{type:"button",ref:t,tabIndex:-1,style:ye}))}));const Te="data-floating-ui-scroll-lock",Se=i.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return c((()=>{var e,t;if(!n)return;if(document.body.hasAttribute(Te))return;document.body.setAttribute(Te,"");const r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth;if(!/iP(hone|ad|od)|iOS/.test(y()))return Object.assign(document.body.style,{overflow:"hidden",[r]:o+"px"}),()=>{document.body.removeAttribute(Te),Object.assign(document.body.style,{overflow:"",[r]:""})};const u=(null==(e=window.visualViewport)?void 0:e.offsetLeft)||0,i=(null==(t=window.visualViewport)?void 0:t.offsetTop)||0,c=window.pageXOffset,l=window.pageYOffset;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:-(l-Math.floor(i))+"px",left:-(c-Math.floor(u))+"px",right:"0",[r]:o+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[r]:""}),document.body.removeAttribute(Te),window.scrollTo(c,l)}}),[n]),i.createElement("div",L({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function Pe(e){return R(e.target)&&"BUTTON"===e.target.tagName}function Me(e){return ce(e)}function Ce(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}const Ae={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Le={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"};let Fe=!1;const De="ArrowUp",Ne="ArrowDown",je="ArrowLeft",Ke="ArrowRight";function _e(e,t,n){return Math.floor(e/t)!==n}function Be(e,t){return t<0||t>=e.current.length}function He(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o,amount:u=1}=void 0===t?{}:t;const i=e.current;let c=n;do{var l,s;c+=r?-u:u}while(c>=0&&c<=i.length-1&&(o?o.includes(c):null==i[c]||(null==(l=i[c])?void 0:l.hasAttribute("disabled"))||"true"===(null==(s=i[c])?void 0:s.getAttribute("aria-disabled"))));return c}function We(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function qe(e,t){return We(t,e===De||e===Ne,e===je||e===Ke)}function Ue(e,t,n){return We(t,e===Ne,n?e===je:e===Ke)||"Enter"===e||" "==e||""===e}function Ve(e,t){return He(e,{disabledIndices:t})}function ze(e,t){return He(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}const Xe=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Ye(e,t){let{open:n,elements:{floating:r}}=e,{duration:o=250}=void 0===t?{}:t;const u=("number"==typeof o?o:o.close)||0,[l,s]=i.useState(!1),[a,f]=i.useState("unmounted"),d=function(e,t){const[n,r]=i.useState(e);return e&&!n&&r(!0),i.useEffect((()=>{if(!e){const e=setTimeout((()=>r(!1)),t);return()=>clearTimeout(e)}}),[e,t]),n}(n,u);return c((()=>{l&&!d&&f("unmounted")}),[l,d]),c((()=>{if(r){if(n){f("initial");const e=requestAnimationFrame((()=>{f("open")}));return()=>{cancelAnimationFrame(e)}}s(!0),f("close")}}),[n,r]),{isMounted:d,status:a}}function Ge(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}function Ze(e,t,n){const r=new Map;return{..."floating"===n&&{tabIndex:-1},...e,...t.map((e=>e?e[n]:null)).concat(e).reduce(((e,t)=>t?(Object.entries(t).forEach((t=>{let[n,o]=t;var u;0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof o&&(null==(u=r.get(n))||u.push(o),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),u=0;u<t;u++)o[u]=arguments[u];null==(e=r.get(n))||e.forEach((e=>e(...o)))})):e[n]=o})),e):e),{})}}Object.defineProperty(e,"arrow",{enumerable:!0,get:function(){return r.arrow}}),Object.defineProperty(e,"autoPlacement",{enumerable:!0,get:function(){return o.autoPlacement}}),Object.defineProperty(e,"autoUpdate",{enumerable:!0,get:function(){return o.autoUpdate}}),Object.defineProperty(e,"computePosition",{enumerable:!0,get:function(){return o.computePosition}}),Object.defineProperty(e,"detectOverflow",{enumerable:!0,get:function(){return o.detectOverflow}}),Object.defineProperty(e,"flip",{enumerable:!0,get:function(){return o.flip}}),Object.defineProperty(e,"getOverflowAncestors",{enumerable:!0,get:function(){return o.getOverflowAncestors}}),Object.defineProperty(e,"hide",{enumerable:!0,get:function(){return o.hide}}),Object.defineProperty(e,"inline",{enumerable:!0,get:function(){return o.inline}}),Object.defineProperty(e,"limitShift",{enumerable:!0,get:function(){return o.limitShift}}),Object.defineProperty(e,"offset",{enumerable:!0,get:function(){return o.offset}}),Object.defineProperty(e,"platform",{enumerable:!0,get:function(){return o.platform}}),Object.defineProperty(e,"shift",{enumerable:!0,get:function(){return o.shift}}),Object.defineProperty(e,"size",{enumerable:!0,get:function(){return o.size}}),e.FloatingDelayGroup=e=>{let{children:t,delay:n,timeoutMs:r=0}=e;const[o,u]=i.useReducer(((e,t)=>({...e,...t})),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),l=i.useRef(null),s=i.useCallback((e=>{u({currentId:e})}),[]);return c((()=>{o.currentId?null===l.current?l.current=o.currentId:u({isInstantPhase:!0}):(u({isInstantPhase:!1}),l.current=null)}),[o.currentId]),i.createElement(C.Provider,{value:i.useMemo((()=>({...o,setState:u,setCurrentId:s})),[o,u,s])},t)},e.FloatingFocusManager=function(e){let{context:t,children:n,order:r=["content"],guards:o=!0,initialFocus:u=0,returnFocus:l=!0,modal:s=!0,visuallyHiddenDismiss:a=!1,closeOnFocusOut:f=!0}=e;const{refs:d,nodeId:m,onOpenChange:p,events:v,dataRef:y,elements:{domReference:h,floating:w}}=t,E=S(r),x=g(),I=Oe(),[O,k]=i.useState(null),T="number"==typeof u&&u<0,P=i.useRef(null),M=i.useRef(null),C=i.useRef(!1),A=i.useRef(null),L=i.useRef(!1),F=null!=I,D=h&&"combobox"===h.getAttribute("role")&&ce(h),N=i.useCallback((function(e){return void 0===e&&(e=w),e?ee(e,se()):[]}),[w]),j=i.useCallback((e=>{const t=N(e);return E.current.map((e=>h&&"reference"===e?h:w&&"floating"===e?w:t)).filter(Boolean).flat()}),[h,w,E,N]);i.useEffect((()=>{if(!s)return;function e(e){if("Tab"===e.key){0!==N().length||D||le(e);const t=j(),n=ie(e);"reference"===E.current[0]&&n===h&&(le(e),e.shiftKey?oe(t[t.length-1]):oe(t[1])),"floating"===E.current[1]&&n===w&&e.shiftKey&&(le(e),oe(t[0]))}}const t=b(w);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[h,w,s,E,d,D,N,j]),i.useEffect((()=>{if(f)return w&&R(h)?(h.addEventListener("focusout",t),h.addEventListener("pointerdown",e),!s&&w.addEventListener("focusout",t),()=>{h.removeEventListener("focusout",t),h.removeEventListener("pointerdown",e),!s&&w.removeEventListener("focusout",t)}):void 0;function e(){L.current=!0,setTimeout((()=>{L.current=!1}))}function t(e){const t=e.relatedTarget,n=!(ne(h,t)||ne(w,t)||ne(t,w)||ne(null==I?void 0:I.portalNode,t)||null!=t&&t.hasAttribute("data-floating-ui-focus-guard")||x&&(ue(x.nodesRef.current,m).find((e=>{var n,r;return ne(null==(n=e.context)?void 0:n.elements.floating,t)||ne(null==(r=e.context)?void 0:r.elements.domReference,t)}))||function(e,t){var n;let r=[],o=null==(n=e.find((e=>e.id===t)))?void 0:n.parentId;for(;o;){const t=e.find((e=>e.id===o));o=null==t?void 0:t.parentId,t&&(r=r.concat(t))}return r}(x.nodesRef.current,m).find((e=>{var n,r;return(null==(n=e.context)?void 0:n.elements.floating)===t||(null==(r=e.context)?void 0:r.elements.domReference)===t}))));t&&n&&!L.current&&t!==A.current&&(C.current=!0,setTimeout((()=>p(!1))))}}),[h,w,s,m,x,I,p,f]),i.useEffect((()=>{var e;const t=Array.from((null==I||null==(e=I.portalNode)?void 0:e.querySelectorAll("[data-floating-ui-portal]"))||[]);if(w&&s){const e=[w,...t,...[P.current,M.current].filter(Boolean)],n=K(E.current.includes("reference")||D?e.concat(h||[]):e);return()=>{n()}}}),[h,w,s,E,I,D]),i.useEffect((()=>{if(s&&!o&&w){const e=[],t=se(),n=ee(b(w).body,t),r=j(),o=n.filter((e=>!r.includes(e)));return o.forEach(((t,n)=>{e[n]=t.getAttribute("tabindex"),t.setAttribute("tabindex","-1")})),()=>{o.forEach(((t,n)=>{const r=e[n];null==r?t.removeAttribute("tabindex"):t.setAttribute("tabindex",r)}))}}}),[w,s,o,j]),c((()=>{if(!w)return;const e=b(w);let t=l,n=!1;const r=te(e),o=y.current;A.current=r;const i=j(w),c=("number"==typeof u?i[u]:u.current)||w;function s(e){if("escapeKey"===e.type&&d.domReference.current&&(A.current=d.domReference.current),["referencePress","escapeKey"].includes(e.type))return;const r=e.data.returnFocus;"object"==typeof r?(t=!0,n=r.preventScroll):t=r}return!T&&oe(c,{preventScroll:c===w}),v.on("dismiss",s),()=>{var r;(v.off("dismiss",s),ne(w,te(e))&&d.domReference.current&&(A.current=d.domReference.current),t&&R(A.current)&&!C.current)&&(!d.domReference.current||L.current?oe(A.current,{cancelPrevious:!1,preventScroll:n}):(o.__syncReturnFocus=!0,null==(r=A.current)||r.focus({preventScroll:n}),setTimeout((()=>{delete o.__syncReturnFocus}))))}}),[w,j,u,l,y,d,v,T]),c((()=>{if(I)return I.setFocusManagerState({...t,modal:s,closeOnFocusOut:f}),()=>{I.setFocusManagerState(null)}}),[I,s,f,t]),c((()=>{if(!T&&w&&(e(),"function"==typeof MutationObserver)){const t=new MutationObserver(e);return t.observe(w,{childList:!0,subtree:!0}),()=>{t.disconnect()}}function e(){k(N().length)}}),[w,N,T,d]);const _=o&&(F||s)&&!D;function B(e){return a&&s?i.createElement(ke,{ref:"start"===e?P:M,onClick:()=>p(!1)},"string"==typeof a?a:"Dismiss"):null}return i.createElement(i.Fragment,null,_&&i.createElement(Re,{"data-type":"inside",ref:null==I?void 0:I.beforeInsideRef,onFocus:e=>{if(s){const e=j();oe("reference"===r[0]?e[0]:e[e.length-1])}else if(null!=I&&I.preserveTabOrder&&I.portalNode)if(C.current=!1,me(e,I.portalNode)){const e=fe()||h;null==e||e.focus()}else{var t;null==(t=I.beforeOutsideRef.current)||t.focus()}}}),D?null:B("start"),i.cloneElement(n,0===O||r.includes("floating")?{tabIndex:0}:{}),B("end"),_&&i.createElement(Re,{"data-type":"inside",ref:null==I?void 0:I.afterInsideRef,onFocus:e=>{if(s)oe(j()[0]);else if(null!=I&&I.preserveTabOrder&&I.portalNode)if(C.current=!0,me(e,I.portalNode)){const e=de()||h;null==e||e.focus()}else{var t;null==(t=I.afterOutsideRef.current)||t.focus()}}}))},e.FloatingNode=e=>{let{children:t,id:n}=e;const r=v();return i.createElement(m.Provider,{value:i.useMemo((()=>({id:n,parentId:r})),[n,r])},t)},e.FloatingOverlay=Se,e.FloatingPortal=e=>{let{children:t,id:r,root:o=null,preserveTabOrder:u=!0}=e;const c=Ie({id:r,enabled:!o}),[l,s]=i.useState(null),a=i.useRef(null),f=i.useRef(null),d=i.useRef(null),m=i.useRef(null),p=!!l&&!l.modal&&!(!o&&!c)&&u;return i.useEffect((()=>{if(c&&u&&(null==l||!l.modal))return c.addEventListener("focusin",e,!0),c.addEventListener("focusout",e,!0),()=>{c.removeEventListener("focusin",e,!0),c.removeEventListener("focusout",e,!0)};function e(e){if(c&&me(e)){("focusin"===e.type?ve:pe)(c)}}}),[c,u,null==l?void 0:l.modal]),i.createElement(xe.Provider,{value:i.useMemo((()=>({preserveTabOrder:u,beforeOutsideRef:a,afterOutsideRef:f,beforeInsideRef:d,afterInsideRef:m,portalNode:c,setFocusManagerState:s})),[u,c])},p&&c&&i.createElement(Re,{"data-type":"outside",ref:a,onFocus:e=>{if(me(e,c)){var t;null==(t=d.current)||t.focus()}else{const e=de()||(null==l?void 0:l.refs.domReference.current);null==e||e.focus()}}}),p&&c&&i.createElement("span",{"aria-owns":c.id,style:ye}),o?n.createPortal(t,o):c?n.createPortal(t,c):null,p&&c&&i.createElement(Re,{"data-type":"outside",ref:f,onFocus:e=>{if(me(e,c)){var t;null==(t=m.current)||t.focus()}else{const e=fe()||(null==l?void 0:l.refs.domReference.current);null==e||e.focus(),(null==l?void 0:l.closeOnFocusOut)&&(null==l||l.onOpenChange(!1))}}}))},e.FloatingTree=e=>{let{children:t}=e;const n=i.useRef([]),r=i.useCallback((e=>{n.current=[...n.current,e]}),[]),o=i.useCallback((e=>{n.current=n.current.filter((t=>t!==e))}),[]),u=i.useState((()=>d()))[0];return i.createElement(p.Provider,{value:i.useMemo((()=>({nodesRef:n,addNode:r,removeNode:o,events:u})),[n,r,o,u])},t)},e.inner=e=>({name:"inner",options:e,async fn(t){const{listRef:o,overflowRef:u,onFallbackChange:i,offset:c=0,index:l=0,minItemsVisible:s=4,referenceOverflowThreshold:a=0,scrollRef:f,...d}=e,{rects:m,elements:{floating:p}}=t,v=o.current[l];if(!v)return{};const g={...t,...await r.offset(-v.offsetTop-m.reference.height/2-v.offsetHeight/2-c).fn(t)},b=(null==f?void 0:f.current)||p,y=await r.detectOverflow(Ge(g,b.scrollHeight),d),h=await r.detectOverflow(g,{...d,elementContext:"reference"}),w=Math.max(0,y.top),E=g.y+w,R=Math.max(0,b.scrollHeight-w-Math.max(0,y.bottom));return b.style.maxHeight=R+"px",b.scrollTop=w,i&&(b.offsetHeight<v.offsetHeight*Math.min(s,o.current.length-1)-1||h.top>=-a||h.bottom>=-a?n.flushSync((()=>i(!0))):n.flushSync((()=>i(!1)))),u&&(u.current=await r.detectOverflow(Ge({...g,y:E},b.offsetHeight),d)),{y:E}}}),e.safePolygon=function(e){let t,{restMs:n=0,buffer:r=.5,blockPointerEvents:o=!1}=void 0===e?{}:e,u=!1,i=!1;const c=e=>{let{x:o,y:c,placement:l,elements:s,onClose:a,nodeId:f,tree:d}=e;return function(e){function m(){clearTimeout(t),a()}if(clearTimeout(t),!s.domReference||!s.floating||null==l||null==o||null==c)return;const{clientX:p,clientY:v}=e,g=[p,v],b=ie(e),y="mouseleave"===e.type,h=ne(s.floating,b),w=ne(s.domReference,b),R=s.domReference.getBoundingClientRect(),x=s.floating.getBoundingClientRect(),I=l.split("-")[0],O=o>x.right-x.width/2,k=c>x.bottom-x.height/2,T=function(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}(g,R);if(h&&(i=!0),w&&(i=!1),w&&!y)return void(i=!0);if(y&&E(e.relatedTarget)&&ne(s.floating,e.relatedTarget))return;if(d&&ue(d.nodesRef.current,f).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if("top"===I&&c>=R.bottom-1||"bottom"===I&&c<=R.top+1||"left"===I&&o>=R.right-1||"right"===I&&o<=R.left+1)return m();let S=[];switch(I){case"top":S=[[x.left,R.top+1],[x.left,x.bottom-1],[x.right,x.bottom-1],[x.right,R.top+1]],u=p>=x.left&&p<=x.right&&v>=x.top&&v<=R.top+1;break;case"bottom":S=[[x.left,x.top+1],[x.left,R.bottom-1],[x.right,R.bottom-1],[x.right,x.top+1]],u=p>=x.left&&p<=x.right&&v>=R.bottom-1&&v<=x.bottom;break;case"left":S=[[x.right-1,x.bottom],[x.right-1,x.top],[R.left+1,x.top],[R.left+1,x.bottom]],u=p>=x.left&&p<=R.left+1&&v>=x.top&&v<=x.bottom;break;case"right":S=[[R.right-1,x.bottom],[R.right-1,x.top],[x.left+1,x.top],[x.left+1,x.bottom]],u=p>=R.right-1&&p<=x.right&&v>=x.top&&v<=x.bottom}const P=u?S:function(e){let[t,n]=e;const o=x.width>R.width,u=x.height>R.height;switch(I){case"top":return[[o?t+r/2:O?t+4*r:t-4*r,n+r+1],[o?t-r/2:O?t+4*r:t-4*r,n+r+1],...[[x.left,O||o?x.bottom-r:x.top],[x.right,O?o?x.bottom-r:x.top:x.bottom-r]]];case"bottom":return[[o?t+r/2:O?t+4*r:t-4*r,n-r],[o?t-r/2:O?t+4*r:t-4*r,n-r],...[[x.left,O||o?x.top+r:x.bottom],[x.right,O?o?x.top+r:x.bottom:x.top+r]]];case"left":{const e=[t+r+1,u?n+r/2:k?n+4*r:n-4*r],o=[t+r+1,u?n-r/2:k?n+4*r:n-4*r];return[...[[k||u?x.right-r:x.left,x.top],[k?u?x.right-r:x.left:x.right-r,x.bottom]],e,o]}case"right":return[[t-r,u?n+r/2:k?n+4*r:n-4*r],[t-r,u?n-r/2:k?n+4*r:n-4*r],...[[k||u?x.left+r:x.right,x.top],[k?u?x.left+r:x.right:x.left+r,x.bottom]]]}}([o,c]);return u?void 0:i&&!T?m():void(!function(e,t){const[n,r]=e;let o=!1;const u=t.length;for(let e=0,i=u-1;e<u;i=e++){const[u,c]=t[e]||[0,0],[l,s]=t[i]||[0,0];c>=r!=s>=r&&n<=(l-u)*(r-c)/(s-c)+u&&(o=!o)}return o}([p,v],P)?m():n&&!i&&(t=setTimeout(m,n)))}};return c.__options={blockPointerEvents:o},c},e.useClick=function(e,t){let{open:n,onOpenChange:r,dataRef:o,elements:{domReference:u}}=e,{enabled:c=!0,event:l="click",toggle:s=!0,ignoreMouse:a=!1,keyboardHandlers:f=!0}=void 0===t?{}:t;const d=i.useRef();return i.useMemo((()=>c?{reference:{onPointerDown(e){d.current=e.pointerType},onMouseDown(e){0===e.button&&(T(d.current,!0)&&a||"click"!==l&&(n?!s||o.current.openEvent&&"mousedown"!==o.current.openEvent.type||r(!1):(e.preventDefault(),r(!0)),o.current.openEvent=e.nativeEvent))},onClick(e){o.current.__syncReturnFocus||("mousedown"===l&&d.current?d.current=void 0:T(d.current,!0)&&a||(n?!s||o.current.openEvent&&"click"!==o.current.openEvent.type||r(!1):r(!0),o.current.openEvent=e.nativeEvent))},onKeyDown(e){d.current=void 0,f&&(Pe(e)||(" "!==e.key||Me(u)||e.preventDefault(),"Enter"===e.key&&(n?s&&r(!1):r(!0))))},onKeyUp(e){f&&(Pe(e)||Me(u)||" "===e.key&&(n?s&&r(!1):r(!0)))}}}:{}),[c,o,l,a,f,u,s,n,r])},e.useDelayGroup=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:o}=t;const{currentId:u,setCurrentId:c,initialDelay:l,setState:s,timeoutMs:a}=A();i.useEffect((()=>{u&&(s({delay:{open:1,close:M(l,"close")}}),u!==o&&r(!1))}),[o,r,s,u,l]),i.useEffect((()=>{function e(){r(!1),s({delay:l,currentId:null})}if(!n&&u===o){if(a){const t=window.setTimeout(e,a);return()=>{clearTimeout(t)}}e()}}),[n,s,u,o,r,l,a]),i.useEffect((()=>{n&&c(o)}),[n,c,o])},e.useDelayGroupContext=A,e.useDismiss=function(e,t){let{open:n,onOpenChange:o,events:u,nodeId:c,elements:{reference:l,domReference:s,floating:a},dataRef:f}=e,{enabled:d=!0,escapeKey:m=!0,outsidePress:p=!0,outsidePressEvent:y="pointerdown",referencePress:h=!1,referencePressEvent:w="pointerdown",ancestorScroll:O=!1,bubbles:k=!0}=void 0===t?{}:t;const T=g(),S=null!=v(),P=be("function"==typeof p?p:()=>!1),M="function"==typeof p?P:p,C=i.useRef(!1),{escapeKeyBubbles:A,outsidePressBubbles:L}=function(e){var t,n;return void 0===e&&(e=!0),{escapeKeyBubbles:"boolean"==typeof e?e:null==(t=e.escapeKey)||t,outsidePressBubbles:"boolean"==typeof e?e:null==(n=e.outsidePress)||n}}(k);return i.useEffect((()=>{if(!n||!d)return;function e(e){if("Escape"===e.key){const e=T?ue(T.nodesRef.current,c):[];if(e.length>0){let t=!0;if(e.forEach((e=>{var n;null==(n=e.context)||!n.open||e.context.dataRef.current.__escapeKeyBubbles||(t=!1)})),!t)return}u.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),o(!1)}}function t(e){const t=C.current;if(C.current=!1,t)return;if("function"==typeof M&&!M(e))return;const n=ie(e);if(R(n)&&a){const t=a.ownerDocument.defaultView||window,r=n.scrollWidth>n.clientWidth,o=n.scrollHeight>n.clientHeight;let u=o&&e.offsetX>n.clientWidth;if(o){"rtl"===t.getComputedStyle(n).direction&&(u=e.offsetX<=n.offsetWidth-n.clientWidth)}if(u||r&&e.offsetY>n.clientHeight)return}const r=T&&ue(T.nodesRef.current,c).some((t=>{var n;return Ce(e,null==(n=t.context)?void 0:n.elements.floating)}));if(Ce(e,a)||Ce(e,s)||r)return;const i=T?ue(T.nodesRef.current,c):[];if(i.length>0){let e=!0;if(i.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}u.emit("dismiss",{type:"outsidePress",data:{returnFocus:S?{preventScroll:!0}:x(e)||I(e)}}),o(!1)}function i(){o(!1)}f.current.__escapeKeyBubbles=A,f.current.__outsidePressBubbles=L;const p=b(a);m&&p.addEventListener("keydown",e),M&&p.addEventListener(y,t);let v=[];return O&&(E(s)&&(v=r.getOverflowAncestors(s)),E(a)&&(v=v.concat(r.getOverflowAncestors(a))),!E(l)&&l&&l.contextElement&&(v=v.concat(r.getOverflowAncestors(l.contextElement)))),v=v.filter((e=>{var t;return e!==(null==(t=p.defaultView)?void 0:t.visualViewport)})),v.forEach((e=>{e.addEventListener("scroll",i,{passive:!0})})),()=>{m&&p.removeEventListener("keydown",e),M&&p.removeEventListener(y,t),v.forEach((e=>{e.removeEventListener("scroll",i)}))}}),[f,a,s,l,m,M,y,u,T,c,n,o,O,d,A,L,S]),i.useEffect((()=>{C.current=!1}),[M,y]),i.useMemo((()=>d?{reference:{[Ae[w]]:()=>{h&&(u.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),o(!1))}},floating:{[Le[y]]:()=>{C.current=!0}}}:{}),[d,u,h,y,w,o])},e.useFloating=function(e){void 0===e&&(e={});const{open:t=!1,onOpenChange:n,nodeId:o}=e,u=r.useFloating(e),l=g(),s=i.useRef(null),a=i.useRef({}),f=i.useState((()=>d()))[0],[m,p]=i.useState(null),v=i.useCallback((e=>{const t=E(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;u.refs.setReference(t)}),[u.refs]),b=i.useCallback((e=>{(E(e)||null===e)&&(s.current=e,p(e)),(E(u.refs.reference.current)||null===u.refs.reference.current||null!==e&&!E(e))&&u.refs.setReference(e)}),[u.refs]),y=i.useMemo((()=>({...u.refs,setReference:b,setPositionReference:v,domReference:s})),[u.refs,b,v]),h=i.useMemo((()=>({...u.elements,domReference:m})),[u.elements,m]),w=be(n),R=i.useMemo((()=>({...u,refs:y,elements:h,dataRef:a,nodeId:o,events:f,open:t,onOpenChange:w})),[u,o,f,t,w,y,h]);return c((()=>{const e=null==l?void 0:l.nodesRef.current.find((e=>e.id===o));e&&(e.context=R)})),i.useMemo((()=>({...u,context:R,refs:y,reference:b,positionReference:v})),[u,y,R,b,v])},e.useFloatingNodeId=e=>{const t=f(),n=g(),r=v(),o=e||r;return c((()=>{const e={id:t,parentId:o};return null==n||n.addNode(e),()=>{null==n||n.removeNode(e)}}),[n,t,o]),t},e.useFloatingParentNodeId=v,e.useFloatingPortalNode=Ie,e.useFloatingTree=g,e.useFocus=function(e,t){let{open:n,onOpenChange:r,dataRef:o,events:u,refs:c,elements:{floating:l,domReference:s}}=e,{enabled:a=!0,keyboardOnly:f=!0}=void 0===t?{}:t;const d=i.useRef(""),m=i.useRef(!1),p=i.useRef();return i.useEffect((()=>{if(!a)return;const e=b(l).defaultView||window;function t(){!n&&R(s)&&s===te(b(s))&&(m.current=!0)}return e.addEventListener("blur",t),()=>{e.removeEventListener("blur",t)}}),[l,s,n,a]),i.useEffect((()=>{if(a)return u.on("dismiss",e),()=>{u.off("dismiss",e)};function e(e){"referencePress"!==e.type&&"escapeKey"!==e.type||(m.current=!0)}}),[u,a]),i.useEffect((()=>()=>{clearTimeout(p.current)}),[]),i.useMemo((()=>a?{reference:{onPointerDown(e){let{pointerType:t}=e;d.current=t,m.current=!(!t||!f)},onMouseLeave(){m.current=!1},onFocus(e){var t;m.current||"focus"===e.type&&"mousedown"===(null==(t=o.current.openEvent)?void 0:t.type)&&o.current.openEvent&&Ce(o.current.openEvent,s)||(o.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){m.current=!1;const t=e.relatedTarget,n=E(t)&&t.hasAttribute("data-floating-ui-focus-guard")&&"outside"===t.getAttribute("data-type");p.current=setTimeout((()=>{ne(c.floating.current,t)||ne(s,t)||n||r(!1)}))}}}:{}),[a,f,s,c,o,r])},e.useHover=function(e,t){let{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:u=!1,restMs:l=0,move:s=!0}=void 0===t?{}:t;const{open:a,onOpenChange:f,dataRef:d,events:m,elements:{domReference:p,floating:y},refs:h}=e,w=g(),R=v(),x=S(o),I=S(r),O=i.useRef(),k=i.useRef(),C=i.useRef(),A=i.useRef(),L=i.useRef(!0),F=i.useRef(!1),D=i.useRef((()=>{})),N=i.useCallback((()=>{var e;const t=null==(e=d.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[d]);i.useEffect((()=>{if(n)return m.on("dismiss",e),()=>{m.off("dismiss",e)};function e(){clearTimeout(k.current),clearTimeout(A.current),L.current=!0}}),[n,m]),i.useEffect((()=>{if(!n||!x.current||!a)return;function e(){N()&&f(!1)}const t=b(y).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[y,a,f,n,x,d,N]);const j=i.useCallback((function(e){void 0===e&&(e=!0);const t=M(I.current,"close",O.current);t&&!C.current?(clearTimeout(k.current),k.current=setTimeout((()=>f(!1)),t)):e&&(clearTimeout(k.current),f(!1))}),[I,f]),K=i.useCallback((()=>{D.current(),C.current=void 0}),[]),_=i.useCallback((()=>{if(F.current){const e=b(h.floating.current).body;e.style.pointerEvents="",e.removeAttribute(P),F.current=!1}}),[h]);return i.useEffect((()=>{if(n&&E(p)){const e=p;return a&&e.addEventListener("mouseleave",i),null==y||y.addEventListener("mouseleave",i),s&&e.addEventListener("mousemove",r,{once:!0}),e.addEventListener("mouseenter",r),e.addEventListener("mouseleave",o),()=>{a&&e.removeEventListener("mouseleave",i),null==y||y.removeEventListener("mouseleave",i),s&&e.removeEventListener("mousemove",r),e.removeEventListener("mouseenter",r),e.removeEventListener("mouseleave",o)}}function t(){return!!d.current.openEvent&&["click","mousedown"].includes(d.current.openEvent.type)}function r(e){if(clearTimeout(k.current),L.current=!1,u&&!T(O.current)||l>0&&0===M(I.current,"open"))return;d.current.openEvent=e;const t=M(I.current,"open",O.current);t?k.current=setTimeout((()=>{f(!0)}),t):f(!0)}function o(n){if(t())return;D.current();const r=b(y);if(clearTimeout(A.current),x.current){clearTimeout(k.current),C.current=x.current({...e,tree:w,x:n.clientX,y:n.clientY,onClose(){_(),K(),j()}});const t=C.current;return r.addEventListener("mousemove",t),void(D.current=()=>{r.removeEventListener("mousemove",t)})}j()}function i(n){t()||null==x.current||x.current({...e,tree:w,x:n.clientX,y:n.clientY,onClose(){K(),j()}})(n)}}),[p,y,n,e,u,l,s,j,K,_,f,a,w,I,x,d]),c((()=>{var e;if(n&&a&&null!=(e=x.current)&&e.__options.blockPointerEvents&&N()){const e=b(y).body;if(e.setAttribute(P,""),e.style.pointerEvents="none",F.current=!0,E(p)&&y){var t,r;const e=p,n=null==w||null==(t=w.nodesRef.current.find((e=>e.id===R)))||null==(r=t.context)?void 0:r.elements.floating;return n&&(n.style.pointerEvents=""),e.style.pointerEvents="auto",y.style.pointerEvents="auto",()=>{e.style.pointerEvents="",y.style.pointerEvents=""}}}}),[n,a,R,y,p,w,x,d,N]),c((()=>{a||(O.current=void 0,K(),_())}),[a,K,_]),i.useEffect((()=>()=>{K(),clearTimeout(k.current),clearTimeout(A.current),_()}),[n,K,_]),i.useMemo((()=>{if(!n)return{};function e(e){O.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){a||0===l||(clearTimeout(A.current),A.current=setTimeout((()=>{L.current||f(!0)}),l))}},floating:{onMouseEnter(){clearTimeout(k.current)},onMouseLeave(){m.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),j(!1)}}}}),[m,n,l,a,f,j])},e.useId=f,e.useInnerOffset=(e,t)=>{let{open:r,elements:o}=e,{enabled:u=!0,overflowRef:c,scrollRef:l,onChange:s}=t;const a=be(s),f=i.useRef(!1),d=i.useRef(null),m=i.useRef(null);return i.useEffect((()=>{if(!u)return;function e(e){if(e.ctrlKey||!t||null==c.current)return;const r=e.deltaY,o=c.current.top>=-.5,u=c.current.bottom>=-.5,i=t.scrollHeight-t.clientHeight,l=r<0?-1:1,s=r<0?"max":"min";t.scrollHeight<=t.clientHeight||(!o&&r>0||!u&&r<0?(e.preventDefault(),n.flushSync((()=>{a((e=>e+Math[s](r,i*l)))}))):/firefox/i.test(h())&&(t.scrollTop+=r))}const t=(null==l?void 0:l.current)||o.floating;return r&&t?(t.addEventListener("wheel",e),requestAnimationFrame((()=>{d.current=t.scrollTop,null!=c.current&&(m.current={...c.current})})),()=>{d.current=null,m.current=null,t.removeEventListener("wheel",e)}):void 0}),[u,r,o.floating,c,l,a]),i.useMemo((()=>u?{floating:{onKeyDown(){f.current=!0},onWheel(){f.current=!1},onPointerMove(){f.current=!1},onScroll(){const e=(null==l?void 0:l.current)||o.floating;if(c.current&&e&&f.current){if(null!==d.current){const t=e.scrollTop-d.current;(c.current.bottom<-.5&&t<-1||c.current.top<-.5&&t>1)&&n.flushSync((()=>a((e=>e+t))))}requestAnimationFrame((()=>{d.current=e.scrollTop}))}}}}:{}),[u,c,o.floating,l,a])},e.useInteractions=function(e){void 0===e&&(e=[]);const t=e,n=i.useCallback((t=>Ze(t,e,"reference")),t),r=i.useCallback((t=>Ze(t,e,"floating")),t),o=i.useCallback((t=>Ze(t,e,"item")),e.map((e=>null==e?void 0:e.item)));return i.useMemo((()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:o})),[n,r,o])},e.useListNavigation=function(e,t){let{open:r,onOpenChange:o,refs:u,elements:{domReference:l}}=e,{listRef:s,activeIndex:a,onNavigate:f=(()=>{}),enabled:d=!0,selectedIndex:m=null,allowEscape:p=!1,loop:y=!1,nested:h=!1,rtl:w=!1,virtual:E=!1,focusItemOnOpen:T="auto",focusItemOnHover:P=!0,openOnArrowKeyDown:M=!0,disabledIndices:C,orientation:A="vertical",cols:L=1,scrollItemIntoView:F=!0}=void 0===t?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:t;const D=v(),N=g(),j=be(f),K=i.useRef(T),_=i.useRef(null!=m?m:-1),B=i.useRef(null),H=i.useRef(!0),W=i.useRef(j),q=i.useRef(r),U=i.useRef(!1),V=i.useRef(!1),z=S(C),X=S(r),Y=S(F),[G,Z]=i.useState(),$=i.useCallback((function(e,t,n){void 0===n&&(n=!1);const r=e.current[t.current];E?Z(null==r?void 0:r.id):oe(r,{preventScroll:!0,sync:!(!k()||!O())&&(Fe||U.current)}),requestAnimationFrame((()=>{const e=Y.current;e&&r&&(n||!H.current)&&(null==r.scrollIntoView||r.scrollIntoView("boolean"==typeof e?{block:"nearest",inline:"nearest"}:e))}))}),[E,Y]);c((()=>{document.createElement("div").focus({get preventScroll(){return Fe=!0,!1}})}),[]),c((()=>{d&&(r?K.current&&null!=m&&(V.current=!0,j(m)):q.current&&(_.current=-1,W.current(null)))}),[d,r,m,j]),c((()=>{if(d&&r)if(null==a){if(U.current=!1,null!=m)return;q.current&&(_.current=-1,$(s,_)),!q.current&&K.current&&(null!=B.current||!0===K.current&&null==B.current)&&(_.current=null==B.current||Ue(B.current,A,w)||h?Ve(s,z.current):ze(s,z.current),j(_.current))}else Be(s,a)||(_.current=a,$(s,_,V.current),V.current=!1)}),[d,r,a,m,h,s,A,w,j,$,z]),c((()=>{if(d&&q.current&&!r){var e,t;const n=null==N||null==(e=N.nodesRef.current.find((e=>e.id===D)))||null==(t=e.context)?void 0:t.elements.floating;n&&!ne(n,te(b(n)))&&n.focus({preventScroll:!0})}}),[d,r,N,D]),c((()=>{B.current=null,W.current=j,q.current=r}));const J=null!=a,Q=i.useMemo((()=>{function e(e){if(!r)return;const t=s.current.indexOf(e);-1!==t&&j(t)}return{onFocus(t){let{currentTarget:n}=t;e(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...P&&{onMouseMove(t){let{currentTarget:n}=t;e(n)},onPointerLeave(){var e;H.current&&(_.current=-1,$(s,_),n.flushSync((()=>j(null))),E||null==(e=u.floating.current)||e.focus({preventScroll:!0}))}}}}),[r,u,$,P,s,j,E]);return i.useMemo((()=>{if(!d)return{};const e=z.current;function t(t){if(H.current=!1,U.current=!0,!X.current&&t.currentTarget===u.floating.current)return;if(h&&function(e,t,n){return We(t,n?e===Ke:e===je,e===De)}(t.key,A,w))return le(t),o(!1),void(R(l)&&l.focus());const n=_.current,i=Ve(s,e),c=ze(s,e);if("Home"===t.key&&(_.current=i,j(_.current)),"End"===t.key&&(_.current=c,j(_.current)),L>1){const n=_.current;if(t.key===De){if(le(t),-1===n)_.current=c;else if(_.current=He(s,{startingIndex:n,amount:L,decrement:!0,disabledIndices:e}),y&&(n-L<i||_.current<0)){const e=n%L,t=c%L,r=c-(t-e);_.current=t===e?c:t>e?r:r-L}Be(s,_.current)&&(_.current=n),j(_.current)}if(t.key===Ne&&(le(t),-1===n?_.current=i:(_.current=He(s,{startingIndex:n,amount:L,disabledIndices:e}),y&&n+L>c&&(_.current=He(s,{startingIndex:n%L-L,amount:L,disabledIndices:e}))),Be(s,_.current)&&(_.current=n),j(_.current)),"both"===A){const r=Math.floor(n/L);t.key===Ke&&(le(t),n%L!=L-1?(_.current=He(s,{startingIndex:n,disabledIndices:e}),y&&_e(_.current,L,r)&&(_.current=He(s,{startingIndex:n-n%L-1,disabledIndices:e}))):y&&(_.current=He(s,{startingIndex:n-n%L-1,disabledIndices:e})),_e(_.current,L,r)&&(_.current=n)),t.key===je&&(le(t),n%L!=0?(_.current=He(s,{startingIndex:n,disabledIndices:e,decrement:!0}),y&&_e(_.current,L,r)&&(_.current=He(s,{startingIndex:n+(L-n%L),decrement:!0,disabledIndices:e}))):y&&(_.current=He(s,{startingIndex:n+(L-n%L),decrement:!0,disabledIndices:e})),_e(_.current,L,r)&&(_.current=n));const o=Math.floor(c/L)===r;return Be(s,_.current)&&(_.current=y&&o?t.key===je?c:He(s,{startingIndex:n-n%L-1,disabledIndices:e}):n),void j(_.current)}}if(qe(t.key,A)){if(le(t),r&&!E&&te(t.currentTarget.ownerDocument)===t.currentTarget)return _.current=Ue(t.key,A,w)?i:c,void j(_.current);Ue(t.key,A,w)?_.current=y?n>=c?p&&n!==s.current.length?-1:i:He(s,{startingIndex:n,disabledIndices:e}):Math.min(c,He(s,{startingIndex:n,disabledIndices:e})):_.current=y?n<=i?p&&-1!==n?s.current.length:c:He(s,{startingIndex:n,decrement:!0,disabledIndices:e}):Math.max(i,He(s,{startingIndex:n,decrement:!0,disabledIndices:e})),Be(s,_.current)?j(null):j(_.current)}}function n(e){"auto"===T&&x(e.nativeEvent)&&(K.current=!0)}const i=E&&r&&J&&{"aria-activedescendant":G};return{reference:{...i,onKeyDown(n){H.current=!1;const u=0===n.key.indexOf("Arrow");if(E&&r)return t(n);if(!r&&!M&&u)return;(u||"Enter"===n.key||" "===n.key||""===n.key)&&(B.current=n.key),h?function(e,t,n){return We(t,n?e===je:e===Ke,e===Ne)}(n.key,A,w)&&(le(n),r?(_.current=Ve(s,e),j(_.current)):o(!0)):qe(n.key,A)&&(null!=m&&(_.current=m),le(n),!r&&M?o(!0):t(n),r&&j(_.current))},onFocus(){r&&j(null)},onPointerDown:function(e){K.current=T,"auto"===T&&I(e.nativeEvent)&&(K.current=!0)},onMouseDown:n,onClick:n},floating:{"aria-orientation":"both"===A?void 0:A,...i,onKeyDown:t,onPointerMove(){H.current=!0}},item:Q}}),[l,u,G,z,X,s,d,A,w,E,r,J,h,m,M,p,L,y,T,j,o,Q])},e.useMergeRefs=function(e){return i.useMemo((()=>e.every((e=>null==e))?null:t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}),e)},e.useRole=function(e,t){let{open:n}=e,{enabled:r=!0,role:o="dialog"}=void 0===t?{}:t;const u=f(),c=f();return i.useMemo((()=>{const e={id:u,role:o};return r?"tooltip"===o?{reference:{"aria-describedby":n?u:void 0},floating:e}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":"alertdialog"===o?"dialog":o,"aria-controls":n?u:void 0,..."listbox"===o&&{role:"combobox"},..."menu"===o&&{id:c}},floating:{...e,..."menu"===o&&{"aria-labelledby":c}}}:{}}),[r,o,n,u,c])},e.useTransitionStatus=Ye,e.useTransitionStyles=function(e,t){let{initial:n={opacity:0},open:r,close:o,common:u,duration:l=250}=void 0===t?{}:t;const s=e.placement,a=s.split("-")[0],[f,d]=i.useState({}),{isMounted:m,status:p}=Ye(e,{duration:l}),v=S(n),g=S(r),b=S(o),y=S(u),h="number"==typeof l,w=(h?l:l.open)||0,E=(h?l:l.close)||0;return c((()=>{const e={side:a,placement:s},t=v.current,n=b.current,r=g.current,o=y.current,u="function"==typeof t?t(e):t,i="function"==typeof n?n(e):n,c="function"==typeof o?o(e):o,l=("function"==typeof r?r(e):r)||Object.keys(u).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===p&&d((e=>({transitionProperty:e.transitionProperty,...c,...u}))),"open"===p&&d({transitionProperty:Object.keys(l).map(Xe).join(","),transitionDuration:w+"ms",...c,...l}),"close"===p){const e=i||u;d({transitionProperty:Object.keys(e).map(Xe).join(","),transitionDuration:E+"ms",...c,...e})}}),[a,s,E,b,v,g,y,w,p]),{isMounted:m,styles:f}},e.useTypeahead=function(e,t){var n;let{open:r,dataRef:o}=e,{listRef:u,activeIndex:l,onMatch:s=(()=>{}),enabled:a=!0,findMatch:f=null,resetMs:d=1e3,ignoreKeys:m=[],selectedIndex:p=null}=void 0===t?{listRef:{current:[]},activeIndex:null}:t;const v=i.useRef(),g=i.useRef(""),y=i.useRef(null!=(n=null!=p?p:l)?n:-1),h=i.useRef(null),w=be(s),R=S(f),x=S(m);return c((()=>{r&&(clearTimeout(v.current),h.current=null,g.current="")}),[r]),c((()=>{var e;r&&""===g.current&&(y.current=null!=(e=null!=p?p:l)?e:-1)}),[r,p,l]),i.useMemo((()=>{if(!a)return{};function e(e){const t=ie(e.nativeEvent);if(E(t)&&te(b(t))!==e.currentTarget&&t.closest('[role="dialog"],[role="menu"],[role="listbox"],[role="tree"],[role="grid"]')!==e.currentTarget)return;g.current.length>0&&" "!==g.current[0]&&(o.current.typing=!0," "===e.key&&le(e));const n=u.current;if(null==n||x.current.includes(e.key)||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey)return;n.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&g.current===e.key&&(g.current="",y.current=h.current),g.current+=e.key,clearTimeout(v.current),v.current=setTimeout((()=>{g.current="",y.current=h.current,o.current.typing=!1}),d);const r=y.current,i=[...n.slice((r||0)+1),...n.slice(0,(r||0)+1)],c=R.current?R.current(i,g.current):i.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(g.current.toLocaleLowerCase())))),l=c?n.indexOf(c):-1;-1!==l&&(w(l),h.current=l)}return{reference:{onKeyDown:e},floating:{onKeyDown:e}}}),[a,o,u,d,x,R,w])},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom"),require("@floating-ui/react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","@floating-ui/react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIReactDOM={},e.React,e.ReactDOM,e.FloatingUIReactDOM)}(this,(function(e,t,n,r){"use strict";function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var u=o(t),i="undefined"!=typeof document?t.useLayoutEffect:t.useEffect;let c=!1,l=0;const s=()=>"floating-ui-"+l++;const a=u["useId".toString()]||function(){const[e,t]=u.useState((()=>c?s():void 0));return i((()=>{null==e&&t(s())}),[]),u.useEffect((()=>{c||(c=!0)}),[]),e};function f(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter((e=>e!==n)))}}}const d=u.createContext(null),m=u.createContext(null),p=()=>{var e;return(null==(e=u.useContext(d))?void 0:e.id)||null},v=()=>u.useContext(m);function g(e){return(null==e?void 0:e.ownerDocument)||document}function b(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function y(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}function h(e){return g(e).defaultView||window}function w(e){return!!e&&e instanceof h(e).Element}function E(e){return!!e&&e instanceof h(e).HTMLElement}function R(e){if(0===e.mozInputSource&&e.isTrusted)return!0;const t=/Android/i;return(t.test(b())||t.test(y()))&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType}function x(e){return 0===e.width&&0===e.height||1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"!==e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail}function I(){return/apple/i.test(navigator.vendor)}function O(){return b().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function k(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function T(e){const n=t.useRef(e);return i((()=>{n.current=e})),n}const S="data-floating-ui-safe-polygon";function P(e,t,n){return n&&!k(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}const C=u.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{},isInstantPhase:!1}),M=()=>u.useContext(C);function A(){return A=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},A.apply(this,arguments)}var L=new WeakMap,F=new WeakMap,D={},N=0,j=function(e,t,n){void 0===t&&(t=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e)),void 0===n&&(n="data-aria-hidden");var r=Array.isArray(e)?e:[e];D[n]||(D[n]=new WeakMap);var o=D[n],u=[],i=new Set,c=function(e){e&&!i.has(e)&&(i.add(e),c(e.parentNode))};r.forEach(c);var l=function(e){!e||r.indexOf(e)>=0||Array.prototype.forEach.call(e.children,(function(e){if(i.has(e))l(e);else{var t=e.getAttribute("aria-hidden"),r=null!==t&&"false"!==t,c=(L.get(e)||0)+1,s=(o.get(e)||0)+1;L.set(e,c),o.set(e,s),u.push(e),1===c&&r&&F.set(e,!0),1===s&&e.setAttribute(n,"true"),r||e.setAttribute("aria-hidden","true")}}))};return l(t),i.clear(),N++,function(){u.forEach((function(e){var t=L.get(e)-1,r=o.get(e)-1;L.set(e,t),o.set(e,r),t||(F.has(e)||e.removeAttribute("aria-hidden"),F.delete(e)),r||e.removeAttribute(n)})),--N||(L=new WeakMap,L=new WeakMap,F=new WeakMap,D={})}},K=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"].join(","),_="undefined"==typeof Element,B=_?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,H=!_&&Element.prototype.getRootNode?function(e){return e.getRootNode()}:function(e){return e.ownerDocument},W=function e(t,n,r){for(var o=[],u=Array.from(t);u.length;){var i=u.shift();if("SLOT"===i.tagName){var c=i.assignedElements(),l=e(c.length?c:i.children,!0,r);r.flatten?o.push.apply(o,l):o.push({scopeParent:i,candidates:l})}else{B.call(i,K)&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var s=i.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(i),a=!r.shadowRootFilter||r.shadowRootFilter(i);if(s&&a){var f=e(!0===s?i.children:s.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:i,candidates:f})}else u.unshift.apply(u,i.children)}}return o},q=function(e,t){return e.tabIndex<0&&(t||/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||e.isContentEditable)&&isNaN(parseInt(e.getAttribute("tabindex"),10))?0:e.tabIndex},U=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},V=function(e){return"INPUT"===e.tagName},z=function(e){return function(e){return V(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||H(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var o=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!o||o===e}(e)},X=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Y=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=B.call(e,"details>summary:first-of-type")?e.parentElement:e;if(B.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return X(e)}else{if("function"==typeof r){for(var u=e;e;){var i=e.parentElement,c=H(e);if(i&&!i.shadowRoot&&!0===r(i))return X(e);e=e.assignedSlot?e.assignedSlot:i||c===e.ownerDocument?i:c.host}e=u}if(function(e){for(var t,n=H(e).host,r=!!(null!==(t=n)&&void 0!==t&&t.ownerDocument.contains(n)||e.ownerDocument.contains(e));!r&&n;){var o;r=!(null===(o=n=H(n).host)||void 0===o||!o.ownerDocument.contains(n))}return r}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},G=function(e,t){return!(t.disabled||function(e){return V(e)&&"hidden"===e.type}(t)||Y(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!B.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Z=function(e,t){return!(z(t)||q(t)<0||!G(e,t))},$=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},J=function e(t){var n=[],r=[];return t.forEach((function(t,o){var u=!!t.scopeParent,i=u?t.scopeParent:t,c=q(i,u),l=u?e(t.candidates):i;0===c?u?n.push.apply(n,l):n.push(i):r.push({documentOrder:o,tabIndex:c,item:t,isScope:u,content:l})})),r.sort(U).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},Q=function(e,t){var n;return n=(t=t||{}).getShadowRoot?W([e],t.includeContainer,{filter:Z.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:$}):function(e,t,n){var r=Array.prototype.slice.apply(e.querySelectorAll(K));return t&&B.call(e,K)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,Z.bind(null,t)),J(n)};function ee(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(r=n.shadowRoot)?void 0:r.activeElement);){var n,r;t=t.shadowRoot.activeElement}return t}function te(e,t){if(!e||!t)return!1;const n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&(r=n,"undefined"!=typeof ShadowRoot&&(r instanceof h(r).ShadowRoot||r instanceof ShadowRoot))){let n=t;do{if(n&&e===n)return!0;n=n.parentNode||n.host}while(n)}var r;return!1}let ne=0;function re(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(ne);const u=()=>null==e?void 0:e.focus({preventScroll:n});o?u():ne=requestAnimationFrame(u)}function oe(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)}))||[],r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))}))||[],n=n.concat(r);return n}function ue(e){return"composedPath"in e?e.composedPath()[0]:e.target}function ie(e){return E(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function ce(e){e.preventDefault(),e.stopPropagation()}const le=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function se(e,t){const n=Q(e,le());"prev"===t&&n.reverse();const r=n.indexOf(ee(g(e)));return n.slice(r+1)[0]}function ae(){return se(document.body,"next")}function fe(){return se(document.body,"prev")}function de(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!te(n,r)}function me(e){Q(e,le()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function pe(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const ve=u["useInsertionEffect".toString()]||(e=>e());function ge(e){const t=u.useRef((()=>{}));return ve((()=>{t.current=e})),u.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}const be={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 ye,he;function we(e){"Tab"===e.key&&(ye=e.target,clearTimeout(he))}const Ee=u.forwardRef((function(e,t){const n=ge(e.onFocus),[r,o]=u.useState();return i((()=>(I()&&o("button"),document.addEventListener("keydown",we),()=>{document.removeEventListener("keydown",we)})),[]),u.createElement("span",A({},e,{ref:t,tabIndex:0,role:r,"aria-hidden":!r||void 0,"data-floating-ui-focus-guard":"",style:be,onFocus:e=>{I()&&O()&&!function(e){const t=ye===e.relatedTarget;return ye=e.relatedTarget,clearTimeout(he),t}(e)?(e.persist(),he=window.setTimeout((()=>{n(e)}),50)):n(e)}}))})),Re=u.createContext(null),xe=function(e){let{id:t,enabled:n=!0}=void 0===e?{}:e;const[r,o]=u.useState(null),c=a(),l=Ie();return i((()=>{if(!n)return;const e=t?document.getElementById(t):null;if(!e){const e=document.createElement("div");""!==t&&(e.id=t||c),e.setAttribute("data-floating-ui-portal",""),o(e);const n=(null==l?void 0:l.portalNode)||document.body;return n.appendChild(e),()=>{n.removeChild(e)}}e.setAttribute("data-floating-ui-portal",""),o(e)}),[t,l,c,n]),r},Ie=()=>u.useContext(Re),Oe=u.forwardRef((function(e,t){return u.createElement("button",A({},e,{type:"button",ref:t,tabIndex:-1,style:be}))}));const ke="data-floating-ui-scroll-lock",Te=u.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return i((()=>{var e,t;if(!n)return;if(document.body.hasAttribute(ke))return;document.body.setAttribute(ke,"");const r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth;if(!/iP(hone|ad|od)|iOS/.test(b()))return Object.assign(document.body.style,{overflow:"hidden",[r]:o+"px"}),()=>{document.body.removeAttribute(ke),Object.assign(document.body.style,{overflow:"",[r]:""})};const u=(null==(e=window.visualViewport)?void 0:e.offsetLeft)||0,i=(null==(t=window.visualViewport)?void 0:t.offsetTop)||0,c=window.pageXOffset,l=window.pageYOffset;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:-(l-Math.floor(i))+"px",left:-(c-Math.floor(u))+"px",right:"0",[r]:o+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[r]:""}),document.body.removeAttribute(ke),window.scrollTo(c,l)}}),[n]),u.createElement("div",A({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function Se(e){return E(e.target)&&"BUTTON"===e.target.tagName}function Pe(e){return ie(e)}function Ce(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}const Me={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Ae={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"};let Le=!1;const Fe="ArrowUp",De="ArrowDown",Ne="ArrowLeft",je="ArrowRight";function Ke(e,t,n){return Math.floor(e/t)!==n}function _e(e,t){return t<0||t>=e.current.length}function Be(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o,amount:u=1}=void 0===t?{}:t;const i=e.current;let c=n;do{var l,s;c+=r?-u:u}while(c>=0&&c<=i.length-1&&(o?o.includes(c):null==i[c]||(null==(l=i[c])?void 0:l.hasAttribute("disabled"))||"true"===(null==(s=i[c])?void 0:s.getAttribute("aria-disabled"))));return c}function He(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function We(e,t){return He(t,e===Fe||e===De,e===Ne||e===je)}function qe(e,t,n){return He(t,e===De,n?e===Ne:e===je)||"Enter"===e||" "==e||""===e}function Ue(e,t){return Be(e,{disabledIndices:t})}function Ve(e,t){return Be(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}const ze=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Xe(e,t){let{open:n,elements:{floating:r}}=e,{duration:o=250}=void 0===t?{}:t;const c=("number"==typeof o?o:o.close)||0,[l,s]=u.useState(!1),[a,f]=u.useState("unmounted"),d=function(e,t){const[n,r]=u.useState(e);return e&&!n&&r(!0),u.useEffect((()=>{if(!e){const e=setTimeout((()=>r(!1)),t);return()=>clearTimeout(e)}}),[e,t]),n}(n,c);return i((()=>{l&&!d&&f("unmounted")}),[l,d]),i((()=>{if(r){if(n){f("initial");const e=requestAnimationFrame((()=>{f("open")}));return()=>{cancelAnimationFrame(e)}}s(!0),f("close")}}),[n,r]),{isMounted:d,status:a}}function Ye(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}function Ge(e,t,n){const r=new Map;return{..."floating"===n&&{tabIndex:-1},...e,...t.map((e=>e?e[n]:null)).concat(e).reduce(((e,t)=>t?(Object.entries(t).forEach((t=>{let[n,o]=t;var u;0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof o&&(null==(u=r.get(n))||u.push(o),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),u=0;u<t;u++)o[u]=arguments[u];null==(e=r.get(n))||e.forEach((e=>e(...o)))})):e[n]=o})),e):e),{})}}Object.defineProperty(e,"arrow",{enumerable:!0,get:function(){return r.arrow}}),Object.defineProperty(e,"autoPlacement",{enumerable:!0,get:function(){return r.autoPlacement}}),Object.defineProperty(e,"autoUpdate",{enumerable:!0,get:function(){return r.autoUpdate}}),Object.defineProperty(e,"computePosition",{enumerable:!0,get:function(){return r.computePosition}}),Object.defineProperty(e,"detectOverflow",{enumerable:!0,get:function(){return r.detectOverflow}}),Object.defineProperty(e,"flip",{enumerable:!0,get:function(){return r.flip}}),Object.defineProperty(e,"getOverflowAncestors",{enumerable:!0,get:function(){return r.getOverflowAncestors}}),Object.defineProperty(e,"hide",{enumerable:!0,get:function(){return r.hide}}),Object.defineProperty(e,"inline",{enumerable:!0,get:function(){return r.inline}}),Object.defineProperty(e,"limitShift",{enumerable:!0,get:function(){return r.limitShift}}),Object.defineProperty(e,"offset",{enumerable:!0,get:function(){return r.offset}}),Object.defineProperty(e,"platform",{enumerable:!0,get:function(){return r.platform}}),Object.defineProperty(e,"shift",{enumerable:!0,get:function(){return r.shift}}),Object.defineProperty(e,"size",{enumerable:!0,get:function(){return r.size}}),e.FloatingDelayGroup=e=>{let{children:t,delay:n,timeoutMs:r=0}=e;const[o,c]=u.useReducer(((e,t)=>({...e,...t})),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),l=u.useRef(null),s=u.useCallback((e=>{c({currentId:e})}),[]);return i((()=>{o.currentId?null===l.current?l.current=o.currentId:c({isInstantPhase:!0}):(c({isInstantPhase:!1}),l.current=null)}),[o.currentId]),u.createElement(C.Provider,{value:u.useMemo((()=>({...o,setState:c,setCurrentId:s})),[o,c,s])},t)},e.FloatingFocusManager=function(e){let{context:t,children:n,order:r=["content"],guards:o=!0,initialFocus:c=0,returnFocus:l=!0,modal:s=!0,visuallyHiddenDismiss:a=!1,closeOnFocusOut:f=!0}=e;const{refs:d,nodeId:m,onOpenChange:p,events:b,dataRef:y,elements:{domReference:h,floating:w}}=t,R=T(r),x=v(),I=Ie(),[O,k]=u.useState(null),S="number"==typeof c&&c<0,P=u.useRef(null),C=u.useRef(null),M=u.useRef(!1),A=u.useRef(null),L=u.useRef(!1),F=null!=I,D=h&&"combobox"===h.getAttribute("role")&&ie(h),N=u.useCallback((function(e){return void 0===e&&(e=w),e?Q(e,le()):[]}),[w]),K=u.useCallback((e=>{const t=N(e);return R.current.map((e=>h&&"reference"===e?h:w&&"floating"===e?w:t)).filter(Boolean).flat()}),[h,w,R,N]);u.useEffect((()=>{if(!s)return;function e(e){if("Tab"===e.key){0!==N().length||D||ce(e);const t=K(),n=ue(e);"reference"===R.current[0]&&n===h&&(ce(e),e.shiftKey?re(t[t.length-1]):re(t[1])),"floating"===R.current[1]&&n===w&&e.shiftKey&&(ce(e),re(t[0]))}}const t=g(w);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[h,w,s,R,d,D,N,K]),u.useEffect((()=>{if(f)return w&&E(h)?(h.addEventListener("focusout",t),h.addEventListener("pointerdown",e),!s&&w.addEventListener("focusout",t),()=>{h.removeEventListener("focusout",t),h.removeEventListener("pointerdown",e),!s&&w.removeEventListener("focusout",t)}):void 0;function e(){L.current=!0,setTimeout((()=>{L.current=!1}))}function t(e){const t=e.relatedTarget,n=!(te(h,t)||te(w,t)||te(t,w)||te(null==I?void 0:I.portalNode,t)||null!=t&&t.hasAttribute("data-floating-ui-focus-guard")||x&&(oe(x.nodesRef.current,m).find((e=>{var n,r;return te(null==(n=e.context)?void 0:n.elements.floating,t)||te(null==(r=e.context)?void 0:r.elements.domReference,t)}))||function(e,t){var n;let r=[],o=null==(n=e.find((e=>e.id===t)))?void 0:n.parentId;for(;o;){const t=e.find((e=>e.id===o));o=null==t?void 0:t.parentId,t&&(r=r.concat(t))}return r}(x.nodesRef.current,m).find((e=>{var n,r;return(null==(n=e.context)?void 0:n.elements.floating)===t||(null==(r=e.context)?void 0:r.elements.domReference)===t}))));t&&n&&!L.current&&t!==A.current&&(M.current=!0,setTimeout((()=>p(!1))))}}),[h,w,s,m,x,I,p,f]),u.useEffect((()=>{var e;const t=Array.from((null==I||null==(e=I.portalNode)?void 0:e.querySelectorAll("[data-floating-ui-portal]"))||[]);if(w&&s){const e=[w,...t,...[P.current,C.current].filter(Boolean)],n=j(R.current.includes("reference")||D?e.concat(h||[]):e);return()=>{n()}}}),[h,w,s,R,I,D]),u.useEffect((()=>{if(s&&!o&&w){const e=[],t=le(),n=Q(g(w).body,t),r=K(),o=n.filter((e=>!r.includes(e)));return o.forEach(((t,n)=>{e[n]=t.getAttribute("tabindex"),t.setAttribute("tabindex","-1")})),()=>{o.forEach(((t,n)=>{const r=e[n];null==r?t.removeAttribute("tabindex"):t.setAttribute("tabindex",r)}))}}}),[w,s,o,K]),i((()=>{if(!w)return;const e=g(w);let t=l,n=!1;const r=ee(e),o=y.current;A.current=r;const u=K(w),i=("number"==typeof c?u[c]:c.current)||w;function s(e){if("escapeKey"===e.type&&d.domReference.current&&(A.current=d.domReference.current),["referencePress","escapeKey"].includes(e.type))return;const r=e.data.returnFocus;"object"==typeof r?(t=!0,n=r.preventScroll):t=r}return!S&&re(i,{preventScroll:i===w}),b.on("dismiss",s),()=>{var r;(b.off("dismiss",s),te(w,ee(e))&&d.domReference.current&&(A.current=d.domReference.current),t&&E(A.current)&&!M.current)&&(!d.domReference.current||L.current?re(A.current,{cancelPrevious:!1,preventScroll:n}):(o.__syncReturnFocus=!0,null==(r=A.current)||r.focus({preventScroll:n}),setTimeout((()=>{delete o.__syncReturnFocus}))))}}),[w,K,c,l,y,d,b,S]),i((()=>{if(I)return I.setFocusManagerState({...t,modal:s,closeOnFocusOut:f}),()=>{I.setFocusManagerState(null)}}),[I,s,f,t]),i((()=>{if(!S&&w&&(e(),"function"==typeof MutationObserver)){const t=new MutationObserver(e);return t.observe(w,{childList:!0,subtree:!0}),()=>{t.disconnect()}}function e(){k(N().length)}}),[w,N,S,d]);const _=o&&(F||s)&&!D;function B(e){return a&&s?u.createElement(Oe,{ref:"start"===e?P:C,onClick:()=>p(!1)},"string"==typeof a?a:"Dismiss"):null}return u.createElement(u.Fragment,null,_&&u.createElement(Ee,{"data-type":"inside",ref:null==I?void 0:I.beforeInsideRef,onFocus:e=>{if(s){const e=K();re("reference"===r[0]?e[0]:e[e.length-1])}else if(null!=I&&I.preserveTabOrder&&I.portalNode)if(M.current=!1,de(e,I.portalNode)){const e=ae()||h;null==e||e.focus()}else{var t;null==(t=I.beforeOutsideRef.current)||t.focus()}}}),D?null:B("start"),u.cloneElement(n,0===O||r.includes("floating")?{tabIndex:0}:{}),B("end"),_&&u.createElement(Ee,{"data-type":"inside",ref:null==I?void 0:I.afterInsideRef,onFocus:e=>{if(s)re(K()[0]);else if(null!=I&&I.preserveTabOrder&&I.portalNode)if(M.current=!0,de(e,I.portalNode)){const e=fe()||h;null==e||e.focus()}else{var t;null==(t=I.afterOutsideRef.current)||t.focus()}}}))},e.FloatingNode=e=>{let{children:t,id:n}=e;const r=p();return u.createElement(d.Provider,{value:u.useMemo((()=>({id:n,parentId:r})),[n,r])},t)},e.FloatingOverlay=Te,e.FloatingPortal=e=>{let{children:t,id:r,root:o=null,preserveTabOrder:i=!0}=e;const c=xe({id:r,enabled:!o}),[l,s]=u.useState(null),a=u.useRef(null),f=u.useRef(null),d=u.useRef(null),m=u.useRef(null),p=!!l&&!l.modal&&!(!o&&!c)&&i;return u.useEffect((()=>{if(c&&i&&(null==l||!l.modal))return c.addEventListener("focusin",e,!0),c.addEventListener("focusout",e,!0),()=>{c.removeEventListener("focusin",e,!0),c.removeEventListener("focusout",e,!0)};function e(e){if(c&&de(e)){("focusin"===e.type?pe:me)(c)}}}),[c,i,null==l?void 0:l.modal]),u.createElement(Re.Provider,{value:u.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:a,afterOutsideRef:f,beforeInsideRef:d,afterInsideRef:m,portalNode:c,setFocusManagerState:s})),[i,c])},p&&c&&u.createElement(Ee,{"data-type":"outside",ref:a,onFocus:e=>{if(de(e,c)){var t;null==(t=d.current)||t.focus()}else{const e=fe()||(null==l?void 0:l.refs.domReference.current);null==e||e.focus()}}}),p&&c&&u.createElement("span",{"aria-owns":c.id,style:be}),o?n.createPortal(t,o):c?n.createPortal(t,c):null,p&&c&&u.createElement(Ee,{"data-type":"outside",ref:f,onFocus:e=>{if(de(e,c)){var t;null==(t=m.current)||t.focus()}else{const e=ae()||(null==l?void 0:l.refs.domReference.current);null==e||e.focus(),(null==l?void 0:l.closeOnFocusOut)&&(null==l||l.onOpenChange(!1))}}}))},e.FloatingTree=e=>{let{children:t}=e;const n=u.useRef([]),r=u.useCallback((e=>{n.current=[...n.current,e]}),[]),o=u.useCallback((e=>{n.current=n.current.filter((t=>t!==e))}),[]),i=u.useState((()=>f()))[0];return u.createElement(m.Provider,{value:u.useMemo((()=>({nodesRef:n,addNode:r,removeNode:o,events:i})),[n,r,o,i])},t)},e.inner=e=>({name:"inner",options:e,async fn(t){const{listRef:o,overflowRef:u,onFallbackChange:i,offset:c=0,index:l=0,minItemsVisible:s=4,referenceOverflowThreshold:a=0,scrollRef:f,...d}=e,{rects:m,elements:{floating:p}}=t,v=o.current[l];if(!v)return{};const g={...t,...await r.offset(-v.offsetTop-m.reference.height/2-v.offsetHeight/2-c).fn(t)},b=(null==f?void 0:f.current)||p,y=await r.detectOverflow(Ye(g,b.scrollHeight),d),h=await r.detectOverflow(g,{...d,elementContext:"reference"}),w=Math.max(0,y.top),E=g.y+w,R=Math.max(0,b.scrollHeight-w-Math.max(0,y.bottom));return b.style.maxHeight=R+"px",b.scrollTop=w,i&&(b.offsetHeight<v.offsetHeight*Math.min(s,o.current.length-1)-1||h.top>=-a||h.bottom>=-a?n.flushSync((()=>i(!0))):n.flushSync((()=>i(!1)))),u&&(u.current=await r.detectOverflow(Ye({...g,y:E},b.offsetHeight),d)),{y:E}}}),e.safePolygon=function(e){let t,{restMs:n=0,buffer:r=.5,blockPointerEvents:o=!1}=void 0===e?{}:e,u=!1,i=!1;const c=e=>{let{x:o,y:c,placement:l,elements:s,onClose:a,nodeId:f,tree:d}=e;return function(e){function m(){clearTimeout(t),a()}if(clearTimeout(t),!s.domReference||!s.floating||null==l||null==o||null==c)return;const{clientX:p,clientY:v}=e,g=[p,v],b=ue(e),y="mouseleave"===e.type,h=te(s.floating,b),E=te(s.domReference,b),R=s.domReference.getBoundingClientRect(),x=s.floating.getBoundingClientRect(),I=l.split("-")[0],O=o>x.right-x.width/2,k=c>x.bottom-x.height/2,T=function(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}(g,R);if(h&&(i=!0),E&&(i=!1),E&&!y)return void(i=!0);if(y&&w(e.relatedTarget)&&te(s.floating,e.relatedTarget))return;if(d&&oe(d.nodesRef.current,f).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if("top"===I&&c>=R.bottom-1||"bottom"===I&&c<=R.top+1||"left"===I&&o>=R.right-1||"right"===I&&o<=R.left+1)return m();let S=[];switch(I){case"top":S=[[x.left,R.top+1],[x.left,x.bottom-1],[x.right,x.bottom-1],[x.right,R.top+1]],u=p>=x.left&&p<=x.right&&v>=x.top&&v<=R.top+1;break;case"bottom":S=[[x.left,x.top+1],[x.left,R.bottom-1],[x.right,R.bottom-1],[x.right,x.top+1]],u=p>=x.left&&p<=x.right&&v>=R.bottom-1&&v<=x.bottom;break;case"left":S=[[x.right-1,x.bottom],[x.right-1,x.top],[R.left+1,x.top],[R.left+1,x.bottom]],u=p>=x.left&&p<=R.left+1&&v>=x.top&&v<=x.bottom;break;case"right":S=[[R.right-1,x.bottom],[R.right-1,x.top],[x.left+1,x.top],[x.left+1,x.bottom]],u=p>=R.right-1&&p<=x.right&&v>=x.top&&v<=x.bottom}const P=u?S:function(e){let[t,n]=e;const o=x.width>R.width,u=x.height>R.height;switch(I){case"top":return[[o?t+r/2:O?t+4*r:t-4*r,n+r+1],[o?t-r/2:O?t+4*r:t-4*r,n+r+1],...[[x.left,O||o?x.bottom-r:x.top],[x.right,O?o?x.bottom-r:x.top:x.bottom-r]]];case"bottom":return[[o?t+r/2:O?t+4*r:t-4*r,n-r],[o?t-r/2:O?t+4*r:t-4*r,n-r],...[[x.left,O||o?x.top+r:x.bottom],[x.right,O?o?x.top+r:x.bottom:x.top+r]]];case"left":{const e=[t+r+1,u?n+r/2:k?n+4*r:n-4*r],o=[t+r+1,u?n-r/2:k?n+4*r:n-4*r];return[...[[k||u?x.right-r:x.left,x.top],[k?u?x.right-r:x.left:x.right-r,x.bottom]],e,o]}case"right":return[[t-r,u?n+r/2:k?n+4*r:n-4*r],[t-r,u?n-r/2:k?n+4*r:n-4*r],...[[k||u?x.left+r:x.right,x.top],[k?u?x.left+r:x.right:x.left+r,x.bottom]]]}}([o,c]);return u?void 0:i&&!T?m():void(!function(e,t){const[n,r]=e;let o=!1;const u=t.length;for(let e=0,i=u-1;e<u;i=e++){const[u,c]=t[e]||[0,0],[l,s]=t[i]||[0,0];c>=r!=s>=r&&n<=(l-u)*(r-c)/(s-c)+u&&(o=!o)}return o}([p,v],P)?m():n&&!i&&(t=setTimeout(m,n)))}};return c.__options={blockPointerEvents:o},c},e.useClick=function(e,t){let{open:n,onOpenChange:r,dataRef:o,elements:{domReference:i}}=e,{enabled:c=!0,event:l="click",toggle:s=!0,ignoreMouse:a=!1,keyboardHandlers:f=!0}=void 0===t?{}:t;const d=u.useRef();return u.useMemo((()=>c?{reference:{onPointerDown(e){d.current=e.pointerType},onMouseDown(e){0===e.button&&(k(d.current,!0)&&a||"click"!==l&&(n?!s||o.current.openEvent&&"mousedown"!==o.current.openEvent.type||r(!1):(e.preventDefault(),r(!0)),o.current.openEvent=e.nativeEvent))},onClick(e){o.current.__syncReturnFocus||("mousedown"===l&&d.current?d.current=void 0:k(d.current,!0)&&a||(n?!s||o.current.openEvent&&"click"!==o.current.openEvent.type||r(!1):r(!0),o.current.openEvent=e.nativeEvent))},onKeyDown(e){d.current=void 0,f&&(Se(e)||(" "!==e.key||Pe(i)||e.preventDefault(),"Enter"===e.key&&(n?s&&r(!1):r(!0))))},onKeyUp(e){f&&(Se(e)||Pe(i)||" "===e.key&&(n?s&&r(!1):r(!0)))}}}:{}),[c,o,l,a,f,i,s,n,r])},e.useDelayGroup=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:o}=t;const{currentId:i,setCurrentId:c,initialDelay:l,setState:s,timeoutMs:a}=M();u.useEffect((()=>{i&&(s({delay:{open:1,close:P(l,"close")}}),i!==o&&r(!1))}),[o,r,s,i,l]),u.useEffect((()=>{function e(){r(!1),s({delay:l,currentId:null})}if(!n&&i===o){if(a){const t=window.setTimeout(e,a);return()=>{clearTimeout(t)}}e()}}),[n,s,i,o,r,l,a]),u.useEffect((()=>{n&&c(o)}),[n,c,o])},e.useDelayGroupContext=M,e.useDismiss=function(e,t){let{open:n,onOpenChange:o,events:i,nodeId:c,elements:{reference:l,domReference:s,floating:a},dataRef:f}=e,{enabled:d=!0,escapeKey:m=!0,outsidePress:b=!0,outsidePressEvent:y="pointerdown",referencePress:h=!1,referencePressEvent:I="pointerdown",ancestorScroll:O=!1,bubbles:k=!0}=void 0===t?{}:t;const T=v(),S=null!=p(),P=ge("function"==typeof b?b:()=>!1),C="function"==typeof b?P:b,M=u.useRef(!1),{escapeKeyBubbles:A,outsidePressBubbles:L}=function(e){var t,n;return void 0===e&&(e=!0),{escapeKeyBubbles:"boolean"==typeof e?e:null==(t=e.escapeKey)||t,outsidePressBubbles:"boolean"==typeof e?e:null==(n=e.outsidePress)||n}}(k);return u.useEffect((()=>{if(!n||!d)return;function e(e){if("Escape"===e.key){const e=T?oe(T.nodesRef.current,c):[];if(e.length>0){let t=!0;if(e.forEach((e=>{var n;null==(n=e.context)||!n.open||e.context.dataRef.current.__escapeKeyBubbles||(t=!1)})),!t)return}i.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),o(!1)}}function t(e){const t=M.current;if(M.current=!1,t)return;if("function"==typeof C&&!C(e))return;const n=ue(e);if(E(n)&&a){const t=a.ownerDocument.defaultView||window,r=n.scrollWidth>n.clientWidth,o=n.scrollHeight>n.clientHeight;let u=o&&e.offsetX>n.clientWidth;if(o){"rtl"===t.getComputedStyle(n).direction&&(u=e.offsetX<=n.offsetWidth-n.clientWidth)}if(u||r&&e.offsetY>n.clientHeight)return}const r=T&&oe(T.nodesRef.current,c).some((t=>{var n;return Ce(e,null==(n=t.context)?void 0:n.elements.floating)}));if(Ce(e,a)||Ce(e,s)||r)return;const u=T?oe(T.nodesRef.current,c):[];if(u.length>0){let e=!0;if(u.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}i.emit("dismiss",{type:"outsidePress",data:{returnFocus:S?{preventScroll:!0}:R(e)||x(e)}}),o(!1)}function u(){o(!1)}f.current.__escapeKeyBubbles=A,f.current.__outsidePressBubbles=L;const p=g(a);m&&p.addEventListener("keydown",e),C&&p.addEventListener(y,t);let v=[];return O&&(w(s)&&(v=r.getOverflowAncestors(s)),w(a)&&(v=v.concat(r.getOverflowAncestors(a))),!w(l)&&l&&l.contextElement&&(v=v.concat(r.getOverflowAncestors(l.contextElement)))),v=v.filter((e=>{var t;return e!==(null==(t=p.defaultView)?void 0:t.visualViewport)})),v.forEach((e=>{e.addEventListener("scroll",u,{passive:!0})})),()=>{m&&p.removeEventListener("keydown",e),C&&p.removeEventListener(y,t),v.forEach((e=>{e.removeEventListener("scroll",u)}))}}),[f,a,s,l,m,C,y,i,T,c,n,o,O,d,A,L,S]),u.useEffect((()=>{M.current=!1}),[C,y]),u.useMemo((()=>d?{reference:{[Me[I]]:()=>{h&&(i.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),o(!1))}},floating:{[Ae[y]]:()=>{M.current=!0}}}:{}),[d,i,h,y,I,o])},e.useFloating=function(e){void 0===e&&(e={});const{open:t=!1,onOpenChange:n,nodeId:o}=e,c=r.useFloating(e),l=v(),s=u.useRef(null),a=u.useRef({}),d=u.useState((()=>f()))[0],[m,p]=u.useState(null),g=u.useCallback((e=>{const t=w(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;c.refs.setReference(t)}),[c.refs]),b=u.useCallback((e=>{(w(e)||null===e)&&(s.current=e,p(e)),(w(c.refs.reference.current)||null===c.refs.reference.current||null!==e&&!w(e))&&c.refs.setReference(e)}),[c.refs]),y=u.useMemo((()=>({...c.refs,setReference:b,setPositionReference:g,domReference:s})),[c.refs,b,g]),h=u.useMemo((()=>({...c.elements,domReference:m})),[c.elements,m]),E=ge(n),R=u.useMemo((()=>({...c,refs:y,elements:h,dataRef:a,nodeId:o,events:d,open:t,onOpenChange:E})),[c,o,d,t,E,y,h]);return i((()=>{const e=null==l?void 0:l.nodesRef.current.find((e=>e.id===o));e&&(e.context=R)})),u.useMemo((()=>({...c,context:R,refs:y,reference:b,positionReference:g})),[c,y,R,b,g])},e.useFloatingNodeId=e=>{const t=a(),n=v(),r=p(),o=e||r;return i((()=>{const e={id:t,parentId:o};return null==n||n.addNode(e),()=>{null==n||n.removeNode(e)}}),[n,t,o]),t},e.useFloatingParentNodeId=p,e.useFloatingPortalNode=xe,e.useFloatingTree=v,e.useFocus=function(e,t){let{open:n,onOpenChange:r,dataRef:o,events:i,refs:c,elements:{floating:l,domReference:s}}=e,{enabled:a=!0,keyboardOnly:f=!0}=void 0===t?{}:t;const d=u.useRef(""),m=u.useRef(!1),p=u.useRef();return u.useEffect((()=>{if(!a)return;const e=g(l).defaultView||window;function t(){!n&&E(s)&&s===ee(g(s))&&(m.current=!0)}return e.addEventListener("blur",t),()=>{e.removeEventListener("blur",t)}}),[l,s,n,a]),u.useEffect((()=>{if(a)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(e){"referencePress"!==e.type&&"escapeKey"!==e.type||(m.current=!0)}}),[i,a]),u.useEffect((()=>()=>{clearTimeout(p.current)}),[]),u.useMemo((()=>a?{reference:{onPointerDown(e){let{pointerType:t}=e;d.current=t,m.current=!(!t||!f)},onMouseLeave(){m.current=!1},onFocus(e){var t;m.current||"focus"===e.type&&"mousedown"===(null==(t=o.current.openEvent)?void 0:t.type)&&o.current.openEvent&&Ce(o.current.openEvent,s)||(o.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){m.current=!1;const t=e.relatedTarget,n=w(t)&&t.hasAttribute("data-floating-ui-focus-guard")&&"outside"===t.getAttribute("data-type");p.current=setTimeout((()=>{te(c.floating.current,t)||te(s,t)||n||r(!1)}))}}}:{}),[a,f,s,c,o,r])},e.useHover=function(e,t){let{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:c=!1,restMs:l=0,move:s=!0}=void 0===t?{}:t;const{open:a,onOpenChange:f,dataRef:d,events:m,elements:{domReference:b,floating:y},refs:h}=e,E=v(),R=p(),x=T(o),I=T(r),O=u.useRef(),C=u.useRef(),M=u.useRef(),A=u.useRef(),L=u.useRef(!0),F=u.useRef(!1),D=u.useRef((()=>{})),N=u.useCallback((()=>{var e;const t=null==(e=d.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[d]);u.useEffect((()=>{if(n)return m.on("dismiss",e),()=>{m.off("dismiss",e)};function e(){clearTimeout(C.current),clearTimeout(A.current),L.current=!0}}),[n,m]),u.useEffect((()=>{if(!n||!x.current||!a)return;function e(){N()&&f(!1)}const t=g(y).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[y,a,f,n,x,d,N]);const j=u.useCallback((function(e){void 0===e&&(e=!0);const t=P(I.current,"close",O.current);t&&!M.current?(clearTimeout(C.current),C.current=setTimeout((()=>f(!1)),t)):e&&(clearTimeout(C.current),f(!1))}),[I,f]),K=u.useCallback((()=>{D.current(),M.current=void 0}),[]),_=u.useCallback((()=>{if(F.current){const e=g(h.floating.current).body;e.style.pointerEvents="",e.removeAttribute(S),F.current=!1}}),[h]);return u.useEffect((()=>{if(n&&w(b)){const e=b;return a&&e.addEventListener("mouseleave",u),null==y||y.addEventListener("mouseleave",u),s&&e.addEventListener("mousemove",r,{once:!0}),e.addEventListener("mouseenter",r),e.addEventListener("mouseleave",o),()=>{a&&e.removeEventListener("mouseleave",u),null==y||y.removeEventListener("mouseleave",u),s&&e.removeEventListener("mousemove",r),e.removeEventListener("mouseenter",r),e.removeEventListener("mouseleave",o)}}function t(){return!!d.current.openEvent&&["click","mousedown"].includes(d.current.openEvent.type)}function r(e){if(clearTimeout(C.current),L.current=!1,c&&!k(O.current)||l>0&&0===P(I.current,"open"))return;d.current.openEvent=e;const t=P(I.current,"open",O.current);t?C.current=setTimeout((()=>{f(!0)}),t):f(!0)}function o(n){if(t())return;D.current();const r=g(y);if(clearTimeout(A.current),x.current){clearTimeout(C.current),M.current=x.current({...e,tree:E,x:n.clientX,y:n.clientY,onClose(){_(),K(),j()}});const t=M.current;return r.addEventListener("mousemove",t),void(D.current=()=>{r.removeEventListener("mousemove",t)})}j()}function u(n){t()||null==x.current||x.current({...e,tree:E,x:n.clientX,y:n.clientY,onClose(){K(),j()}})(n)}}),[b,y,n,e,c,l,s,j,K,_,f,a,E,I,x,d]),i((()=>{var e;if(n&&a&&null!=(e=x.current)&&e.__options.blockPointerEvents&&N()){const e=g(y).body;if(e.setAttribute(S,""),e.style.pointerEvents="none",F.current=!0,w(b)&&y){var t,r;const e=b,n=null==E||null==(t=E.nodesRef.current.find((e=>e.id===R)))||null==(r=t.context)?void 0:r.elements.floating;return n&&(n.style.pointerEvents=""),e.style.pointerEvents="auto",y.style.pointerEvents="auto",()=>{e.style.pointerEvents="",y.style.pointerEvents=""}}}}),[n,a,R,y,b,E,x,d,N]),i((()=>{a||(O.current=void 0,K(),_())}),[a,K,_]),u.useEffect((()=>()=>{K(),clearTimeout(C.current),clearTimeout(A.current),_()}),[n,K,_]),u.useMemo((()=>{if(!n)return{};function e(e){O.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){a||0===l||(clearTimeout(A.current),A.current=setTimeout((()=>{L.current||f(!0)}),l))}},floating:{onMouseEnter(){clearTimeout(C.current)},onMouseLeave(){m.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),j(!1)}}}}),[m,n,l,a,f,j])},e.useId=a,e.useInnerOffset=(e,t)=>{let{open:r,elements:o}=e,{enabled:i=!0,overflowRef:c,scrollRef:l,onChange:s}=t;const a=ge(s),f=u.useRef(!1),d=u.useRef(null),m=u.useRef(null);return u.useEffect((()=>{if(!i)return;function e(e){if(e.ctrlKey||!t||null==c.current)return;const r=e.deltaY,o=c.current.top>=-.5,u=c.current.bottom>=-.5,i=t.scrollHeight-t.clientHeight,l=r<0?-1:1,s=r<0?"max":"min";t.scrollHeight<=t.clientHeight||(!o&&r>0||!u&&r<0?(e.preventDefault(),n.flushSync((()=>{a((e=>e+Math[s](r,i*l)))}))):/firefox/i.test(y())&&(t.scrollTop+=r))}const t=(null==l?void 0:l.current)||o.floating;return r&&t?(t.addEventListener("wheel",e),requestAnimationFrame((()=>{d.current=t.scrollTop,null!=c.current&&(m.current={...c.current})})),()=>{d.current=null,m.current=null,t.removeEventListener("wheel",e)}):void 0}),[i,r,o.floating,c,l,a]),u.useMemo((()=>i?{floating:{onKeyDown(){f.current=!0},onWheel(){f.current=!1},onPointerMove(){f.current=!1},onScroll(){const e=(null==l?void 0:l.current)||o.floating;if(c.current&&e&&f.current){if(null!==d.current){const t=e.scrollTop-d.current;(c.current.bottom<-.5&&t<-1||c.current.top<-.5&&t>1)&&n.flushSync((()=>a((e=>e+t))))}requestAnimationFrame((()=>{d.current=e.scrollTop}))}}}}:{}),[i,c,o.floating,l,a])},e.useInteractions=function(e){void 0===e&&(e=[]);const t=e,n=u.useCallback((t=>Ge(t,e,"reference")),t),r=u.useCallback((t=>Ge(t,e,"floating")),t),o=u.useCallback((t=>Ge(t,e,"item")),e.map((e=>null==e?void 0:e.item)));return u.useMemo((()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:o})),[n,r,o])},e.useListNavigation=function(e,t){let{open:r,onOpenChange:o,refs:c,elements:{domReference:l}}=e,{listRef:s,activeIndex:a,onNavigate:f=(()=>{}),enabled:d=!0,selectedIndex:m=null,allowEscape:b=!1,loop:y=!1,nested:h=!1,rtl:w=!1,virtual:k=!1,focusItemOnOpen:S="auto",focusItemOnHover:P=!0,openOnArrowKeyDown:C=!0,disabledIndices:M,orientation:A="vertical",cols:L=1,scrollItemIntoView:F=!0}=void 0===t?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:t;const D=p(),N=v(),j=ge(f),K=u.useRef(S),_=u.useRef(null!=m?m:-1),B=u.useRef(null),H=u.useRef(!0),W=u.useRef(j),q=u.useRef(r),U=u.useRef(!1),V=u.useRef(!1),z=T(M),X=T(r),Y=T(F),[G,Z]=u.useState(),$=u.useCallback((function(e,t,n){void 0===n&&(n=!1);const r=e.current[t.current];k?Z(null==r?void 0:r.id):re(r,{preventScroll:!0,sync:!(!O()||!I())&&(Le||U.current)}),requestAnimationFrame((()=>{const e=Y.current;e&&r&&(n||!H.current)&&(null==r.scrollIntoView||r.scrollIntoView("boolean"==typeof e?{block:"nearest",inline:"nearest"}:e))}))}),[k,Y]);i((()=>{document.createElement("div").focus({get preventScroll(){return Le=!0,!1}})}),[]),i((()=>{d&&(r?K.current&&null!=m&&(V.current=!0,j(m)):q.current&&(_.current=-1,W.current(null)))}),[d,r,m,j]),i((()=>{if(d&&r)if(null==a){if(U.current=!1,null!=m)return;q.current&&(_.current=-1,$(s,_)),!q.current&&K.current&&(null!=B.current||!0===K.current&&null==B.current)&&(_.current=null==B.current||qe(B.current,A,w)||h?Ue(s,z.current):Ve(s,z.current),j(_.current))}else _e(s,a)||(_.current=a,$(s,_,V.current),V.current=!1)}),[d,r,a,m,h,s,A,w,j,$,z]),i((()=>{if(d&&q.current&&!r){var e,t;const n=null==N||null==(e=N.nodesRef.current.find((e=>e.id===D)))||null==(t=e.context)?void 0:t.elements.floating;n&&!te(n,ee(g(n)))&&n.focus({preventScroll:!0})}}),[d,r,N,D]),i((()=>{B.current=null,W.current=j,q.current=r}));const J=null!=a,Q=u.useMemo((()=>{function e(e){if(!r)return;const t=s.current.indexOf(e);-1!==t&&j(t)}return{onFocus(t){let{currentTarget:n}=t;e(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...P&&{onMouseMove(t){let{currentTarget:n}=t;e(n)},onPointerLeave(){var e;H.current&&(_.current=-1,$(s,_),n.flushSync((()=>j(null))),k||null==(e=c.floating.current)||e.focus({preventScroll:!0}))}}}}),[r,c,$,P,s,j,k]);return u.useMemo((()=>{if(!d)return{};const e=z.current;function t(t){if(H.current=!1,U.current=!0,!X.current&&t.currentTarget===c.floating.current)return;if(h&&function(e,t,n){return He(t,n?e===je:e===Ne,e===Fe)}(t.key,A,w))return ce(t),o(!1),void(E(l)&&l.focus());const n=_.current,u=Ue(s,e),i=Ve(s,e);if("Home"===t.key&&(_.current=u,j(_.current)),"End"===t.key&&(_.current=i,j(_.current)),L>1){const n=_.current;if(t.key===Fe){if(ce(t),-1===n)_.current=i;else if(_.current=Be(s,{startingIndex:n,amount:L,decrement:!0,disabledIndices:e}),y&&(n-L<u||_.current<0)){const e=n%L,t=i%L,r=i-(t-e);_.current=t===e?i:t>e?r:r-L}_e(s,_.current)&&(_.current=n),j(_.current)}if(t.key===De&&(ce(t),-1===n?_.current=u:(_.current=Be(s,{startingIndex:n,amount:L,disabledIndices:e}),y&&n+L>i&&(_.current=Be(s,{startingIndex:n%L-L,amount:L,disabledIndices:e}))),_e(s,_.current)&&(_.current=n),j(_.current)),"both"===A){const r=Math.floor(n/L);t.key===je&&(ce(t),n%L!=L-1?(_.current=Be(s,{startingIndex:n,disabledIndices:e}),y&&Ke(_.current,L,r)&&(_.current=Be(s,{startingIndex:n-n%L-1,disabledIndices:e}))):y&&(_.current=Be(s,{startingIndex:n-n%L-1,disabledIndices:e})),Ke(_.current,L,r)&&(_.current=n)),t.key===Ne&&(ce(t),n%L!=0?(_.current=Be(s,{startingIndex:n,disabledIndices:e,decrement:!0}),y&&Ke(_.current,L,r)&&(_.current=Be(s,{startingIndex:n+(L-n%L),decrement:!0,disabledIndices:e}))):y&&(_.current=Be(s,{startingIndex:n+(L-n%L),decrement:!0,disabledIndices:e})),Ke(_.current,L,r)&&(_.current=n));const o=Math.floor(i/L)===r;return _e(s,_.current)&&(_.current=y&&o?t.key===Ne?i:Be(s,{startingIndex:n-n%L-1,disabledIndices:e}):n),void j(_.current)}}if(We(t.key,A)){if(ce(t),r&&!k&&ee(t.currentTarget.ownerDocument)===t.currentTarget)return _.current=qe(t.key,A,w)?u:i,void j(_.current);qe(t.key,A,w)?_.current=y?n>=i?b&&n!==s.current.length?-1:u:Be(s,{startingIndex:n,disabledIndices:e}):Math.min(i,Be(s,{startingIndex:n,disabledIndices:e})):_.current=y?n<=u?b&&-1!==n?s.current.length:i:Be(s,{startingIndex:n,decrement:!0,disabledIndices:e}):Math.max(u,Be(s,{startingIndex:n,decrement:!0,disabledIndices:e})),_e(s,_.current)?j(null):j(_.current)}}function n(e){"auto"===S&&R(e.nativeEvent)&&(K.current=!0)}const u=k&&r&&J&&{"aria-activedescendant":G};return{reference:{...u,onKeyDown(n){H.current=!1;const u=0===n.key.indexOf("Arrow");if(k&&r)return t(n);if(!r&&!C&&u)return;(u||"Enter"===n.key||" "===n.key||""===n.key)&&(B.current=n.key),h?function(e,t,n){return He(t,n?e===Ne:e===je,e===De)}(n.key,A,w)&&(ce(n),r?(_.current=Ue(s,e),j(_.current)):o(!0)):We(n.key,A)&&(null!=m&&(_.current=m),ce(n),!r&&C?o(!0):t(n),r&&j(_.current))},onFocus(){r&&j(null)},onPointerDown:function(e){K.current=S,"auto"===S&&x(e.nativeEvent)&&(K.current=!0)},onMouseDown:n,onClick:n},floating:{"aria-orientation":"both"===A?void 0:A,...u,onKeyDown:t,onPointerMove(){H.current=!0}},item:Q}}),[l,c,G,z,X,s,d,A,w,k,r,J,h,m,C,b,L,y,S,j,o,Q])},e.useMergeRefs=function(e){return u.useMemo((()=>e.every((e=>null==e))?null:t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}),e)},e.useRole=function(e,t){let{open:n}=e,{enabled:r=!0,role:o="dialog"}=void 0===t?{}:t;const i=a(),c=a();return u.useMemo((()=>{const e={id:i,role:o};return r?"tooltip"===o?{reference:{"aria-describedby":n?i:void 0},floating:e}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":"alertdialog"===o?"dialog":o,"aria-controls":n?i:void 0,..."listbox"===o&&{role:"combobox"},..."menu"===o&&{id:c}},floating:{...e,..."menu"===o&&{"aria-labelledby":c}}}:{}}),[r,o,n,i,c])},e.useTransitionStatus=Xe,e.useTransitionStyles=function(e,t){let{initial:n={opacity:0},open:r,close:o,common:c,duration:l=250}=void 0===t?{}:t;const s=e.placement,a=s.split("-")[0],[f,d]=u.useState({}),{isMounted:m,status:p}=Xe(e,{duration:l}),v=T(n),g=T(r),b=T(o),y=T(c),h="number"==typeof l,w=(h?l:l.open)||0,E=(h?l:l.close)||0;return i((()=>{const e={side:a,placement:s},t=v.current,n=b.current,r=g.current,o=y.current,u="function"==typeof t?t(e):t,i="function"==typeof n?n(e):n,c="function"==typeof o?o(e):o,l=("function"==typeof r?r(e):r)||Object.keys(u).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===p&&d((e=>({transitionProperty:e.transitionProperty,...c,...u}))),"open"===p&&d({transitionProperty:Object.keys(l).map(ze).join(","),transitionDuration:w+"ms",...c,...l}),"close"===p){const e=i||u;d({transitionProperty:Object.keys(e).map(ze).join(","),transitionDuration:E+"ms",...c,...e})}}),[a,s,E,b,v,g,y,w,p]),{isMounted:m,styles:f}},e.useTypeahead=function(e,t){var n;let{open:r,dataRef:o}=e,{listRef:c,activeIndex:l,onMatch:s=(()=>{}),enabled:a=!0,findMatch:f=null,resetMs:d=1e3,ignoreKeys:m=[],selectedIndex:p=null}=void 0===t?{listRef:{current:[]},activeIndex:null}:t;const v=u.useRef(),b=u.useRef(""),y=u.useRef(null!=(n=null!=p?p:l)?n:-1),h=u.useRef(null),E=ge(s),R=T(f),x=T(m);return i((()=>{r&&(clearTimeout(v.current),h.current=null,b.current="")}),[r]),i((()=>{var e;r&&""===b.current&&(y.current=null!=(e=null!=p?p:l)?e:-1)}),[r,p,l]),u.useMemo((()=>{if(!a)return{};function e(e){const t=ue(e.nativeEvent);if(w(t)&&ee(g(t))!==e.currentTarget&&t.closest('[role="dialog"],[role="menu"],[role="listbox"],[role="tree"],[role="grid"]')!==e.currentTarget)return;b.current.length>0&&" "!==b.current[0]&&(o.current.typing=!0," "===e.key&&ce(e));const n=c.current;if(null==n||x.current.includes(e.key)||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey)return;n.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&b.current===e.key&&(b.current="",y.current=h.current),b.current+=e.key,clearTimeout(v.current),v.current=setTimeout((()=>{b.current="",y.current=h.current,o.current.typing=!1}),d);const r=y.current,u=[...n.slice((r||0)+1),...n.slice(0,(r||0)+1)],i=R.current?R.current(u,b.current):u.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(b.current.toLocaleLowerCase())))),l=i?n.indexOf(i):-1;-1!==l&&(E(l),h.current=l)}return{reference:{onKeyDown:e},floating:{onKeyDown:e}}}),[a,o,c,d,x,R,E])},Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "@floating-ui/react", | ||
"version": "0.19.0", | ||
"version": "0.19.1", | ||
"@rollingversions": { | ||
@@ -5,0 +5,0 @@ "baseVersion": [ |
@@ -20,3 +20,2 @@ export { FloatingDelayGroup, useDelayGroup, useDelayGroupContext, } from './components/FloatingDelayGroup'; | ||
export { useInteractions } from './useInteractions'; | ||
export { autoPlacement, autoUpdate, computePosition, detectOverflow, flip, getOverflowAncestors, hide, inline, limitShift, offset, platform, shift, size, } from '@floating-ui/dom'; | ||
export { arrow } from '@floating-ui/react-dom'; | ||
export { arrow, autoPlacement, autoUpdate, computePosition, detectOverflow, flip, getOverflowAncestors, hide, inline, limitShift, offset, platform, shift, size, } from '@floating-ui/react-dom'; |
@@ -1,3 +0,2 @@ | ||
import type { ComputePositionReturn, Middleware, Placement, Strategy, VirtualElement } from '@floating-ui/dom'; | ||
import type { UseFloatingReturn as UsePositionFloatingReturn } from '@floating-ui/react-dom'; | ||
import type { ComputePositionReturn, Middleware, Placement, Strategy, UseFloatingReturn as UsePositionFloatingReturn, VirtualElement } from '@floating-ui/react-dom'; | ||
import * as React from 'react'; | ||
@@ -15,5 +14,4 @@ import type { DismissPayload } from './hooks/useDismiss'; | ||
export { InnerProps, UseInnerOffsetProps } from './inner'; | ||
export type { AlignedPlacement, Alignment, AutoUpdateOptions, Axis, Boundary, ClientRectObject, ComputePositionConfig, ComputePositionReturn, Coords, DetectOverflowOptions, Dimensions, ElementContext, ElementRects, Elements, FloatingElement, Length, Middleware, MiddlewareArguments, MiddlewareData, MiddlewareReturn, NodeScroll, Padding, Placement, Platform, Rect, ReferenceElement, RootBoundary, Side, SideObject, SizeOptions, Strategy, VirtualElement, } from '@floating-ui/dom'; | ||
export { autoPlacement, autoUpdate, computePosition, detectOverflow, flip, getOverflowAncestors, hide, inline, limitShift, offset, platform, shift, size, } from '@floating-ui/dom'; | ||
export { arrow } from '@floating-ui/react-dom'; | ||
export type { AlignedPlacement, Alignment, AutoUpdateOptions, Axis, Boundary, ClientRectObject, ComputePositionConfig, ComputePositionReturn, Coords, DetectOverflowOptions, Dimensions, ElementContext, ElementRects, Elements, FloatingElement, Length, Middleware, MiddlewareArguments, MiddlewareData, MiddlewareReturn, NodeScroll, Padding, Placement, Platform, Rect, ReferenceElement, RootBoundary, Side, SideObject, SizeOptions, Strategy, VirtualElement, } from '@floating-ui/react-dom'; | ||
export { arrow, autoPlacement, autoUpdate, computePosition, detectOverflow, flip, getOverflowAncestors, hide, inline, limitShift, offset, platform, shift, size, } from '@floating-ui/react-dom'; | ||
export type NarrowedElement<T> = T extends Element ? T : Element; | ||
@@ -20,0 +18,0 @@ export interface ExtendedRefs<RT> { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
517793
11242