@floating-ui/react
Advanced tools
Comparing version 0.24.0 to 0.24.1
@@ -1,1 +0,1 @@ | ||
import{platform as e,getOverflowAncestors as t,offset as n,detectOverflow as r,useFloating as o}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";import*as u from"react";import{useLayoutEffect as i,useEffect as c,useRef as l}from"react";import{hideOthers as s}from"aria-hidden";import{tabbable as a}from"tabbable";import{createPortal as f,flushSync as d}from"react-dom";function m(){return m=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},m.apply(this,arguments)}var p="undefined"!=typeof document?i:c;let v=!1,g=0;const h=()=>"floating-ui-"+g++;const b=u["useId".toString()]||function(){const[e,t]=u.useState((()=>v?h():void 0));return p((()=>{null==e&&t(h())}),[]),u.useEffect((()=>{v||(v=!0)}),[]),e},y=u.forwardRef((function(t,n){let{context:{placement:r,elements:{floating:o},middlewareData:{arrow:i}},width:c=14,height:l=7,tipRadius:s=0,strokeWidth:a=0,staticOffset:f,stroke:d,d:p,style:{transform:v,...g}={},...h}=t;a*=2;const y=a/2,w=c/2*(s/-8+1),E=l/2*s/4,[R,x]=r.split("-"),I=!!o&&e.isRTL(o),k=!!p,C="top"===R||"bottom"===R,M=f&&"end"===x?"bottom":"top";let T=f&&"end"===x?"right":"left";f&&I&&(T="end"===x?"left":"right");const O=k?0:y,A=null!=(null==i?void 0:i.x)?f||i.x:"",L=null!=(null==i?void 0:i.y)?f||i.y+O:"",P=p||"M0,0 H"+c+" L"+(c-w)+","+(l-E)+" Q"+c/2+","+l+" "+w+","+(l-E)+" Z",S={top:k?"rotate(180deg)":"",left:k?"rotate(90deg)":"rotate(-90deg)",bottom:k?"":"rotate(180deg)",right:k?"rotate(-90deg)":"rotate(90deg)"}[R],D=b();return u.createElement("svg",m({},h,{suppressHydrationWarning:!0,"aria-hidden":!0,ref:n,width:k?c:c+a,height:c,viewBox:"0 0 "+c+" "+(l>c?l:c),style:{position:"absolute",pointerEvents:"none",[T]:A,[M]:L,[R]:C||k?"100%":"calc(100% - "+a/2+"px)",transform:""+S+(null!=v?v:""),...g}}),a>0&&u.createElement("path",{clipPath:"url(#"+D+")",fill:"none",stroke:d,strokeWidth:a+(p?0:1),d:P}),u.createElement("path",{stroke:a&&!p?h.fill:"none",d:P}),u.createElement("clipPath",{id:D},u.createElement("rect",{x:-y,y:y*(k?-1:1),width:c+a,height:c})))}));function w(){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){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}const E=u.createContext(null),R=u.createContext(null),x=()=>{var e;return(null==(e=u.useContext(E))?void 0:e.id)||null},I=()=>u.useContext(R);function k(e){const t=b(),n=I(),r=x(),o=e||r;return p((()=>{const e={id:t,parentId:o};return null==n||n.addNode(e),()=>{null==n||n.removeNode(e)}}),[n,t,o]),t}function C(e){let{children:t,id:n}=e;const r=x();return u.createElement(E.Provider,{value:u.useMemo((()=>({id:n,parentId:r})),[n,r])},t)}function M(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((()=>w()))[0];return u.createElement(R.Provider,{value:u.useMemo((()=>({nodesRef:n,addNode:r,removeNode:o,events:i})),[n,r,o,i])},t)}function T(e){return(null==e?void 0:e.ownerDocument)||document}function O(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function A(){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 L(e){return T(e).defaultView||window}function P(e){return!!e&&e instanceof L(e).Element}function S(e){return!!e&&e instanceof L(e).HTMLElement}function D(e){if(0===e.mozInputSource&&e.isTrusted)return!0;const t=/Android/i;return(t.test(O())||t.test(A()))&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType}function N(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 F(){return/apple/i.test(navigator.vendor)}function K(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function B(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 L(r).ShadowRoot||r instanceof ShadowRoot))){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}var r;return!1}function H(e){const t=l(e);return p((()=>{t.current=e})),t}function _(e,t,n){return n&&!K(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}function q(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:{domReference:c,floating:l},refs:s}=e,{enabled:a=!0,delay:f=0,handleClose:d=null,mouseOnly:m=!1,restMs:v=0,move:g=!0}=t,h=I(),b=x(),y=H(d),w=H(f),E=u.useRef(),R=u.useRef(),k=u.useRef(),C=u.useRef(),M=u.useRef(!0),O=u.useRef(!1),A=u.useRef((()=>{})),L=u.useCallback((()=>{var e;const t=null==(e=o.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[o]);u.useEffect((()=>{if(a)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(){clearTimeout(R.current),clearTimeout(C.current),M.current=!0}}),[a,i]),u.useEffect((()=>{if(!a||!y.current||!n)return;function e(){L()&&r(!1)}const t=T(l).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[l,n,r,a,y,o,L]);const S=u.useCallback((function(e){void 0===e&&(e=!0);const t=_(w.current,"close",E.current);t&&!k.current?(clearTimeout(R.current),R.current=setTimeout((()=>r(!1)),t)):e&&(clearTimeout(R.current),r(!1))}),[w,r]),D=u.useCallback((()=>{A.current(),k.current=void 0}),[]),N=u.useCallback((()=>{if(O.current){const e=T(s.floating.current).body;e.style.pointerEvents="",e.removeAttribute("data-floating-ui-safe-polygon"),O.current=!1}}),[s]);return u.useEffect((()=>{if(a&&P(c)){const e=c;return n&&e.addEventListener("mouseleave",s),null==l||l.addEventListener("mouseleave",s),g&&e.addEventListener("mousemove",u,{once:!0}),e.addEventListener("mouseenter",u),e.addEventListener("mouseleave",i),()=>{n&&e.removeEventListener("mouseleave",s),null==l||l.removeEventListener("mouseleave",s),g&&e.removeEventListener("mousemove",u),e.removeEventListener("mouseenter",u),e.removeEventListener("mouseleave",i)}}function t(){return!!o.current.openEvent&&["click","mousedown"].includes(o.current.openEvent.type)}function u(e){if(clearTimeout(R.current),M.current=!1,m&&!K(E.current)||v>0&&0===_(w.current,"open"))return;o.current.openEvent=e;const t=_(w.current,"open",E.current);t?R.current=setTimeout((()=>{r(!0)}),t):r(!0)}function i(r){if(t())return;A.current();const o=T(l);if(clearTimeout(C.current),y.current){n||clearTimeout(R.current),k.current=y.current({...e,tree:h,x:r.clientX,y:r.clientY,onClose(){N(),D(),S()}});const t=k.current;return o.addEventListener("mousemove",t),void(A.current=()=>{o.removeEventListener("mousemove",t)})}("touch"!==E.current||!B(l,r.relatedTarget))&&S()}function s(n){t()||null==y.current||y.current({...e,tree:h,x:n.clientX,y:n.clientY,onClose(){N(),D(),S()}})(n)}}),[c,l,a,e,m,v,g,S,D,N,r,n,h,w,y,o]),p((()=>{var e;if(a&&n&&null!=(e=y.current)&&e.__options.blockPointerEvents&&L()){const e=T(l).body;if(e.setAttribute("data-floating-ui-safe-polygon",""),e.style.pointerEvents="none",O.current=!0,P(c)&&l){var t,r;const e=c,n=null==h||null==(t=h.nodesRef.current.find((e=>e.id===b)))||null==(r=t.context)?void 0:r.elements.floating;return n&&(n.style.pointerEvents=""),e.style.pointerEvents="auto",l.style.pointerEvents="auto",()=>{e.style.pointerEvents="",l.style.pointerEvents=""}}}}),[a,n,b,l,c,h,y,o,L]),p((()=>{n||(E.current=void 0,D(),N())}),[n,D,N]),u.useEffect((()=>()=>{D(),clearTimeout(R.current),clearTimeout(C.current),N()}),[a,D,N]),u.useMemo((()=>{if(!a)return{};function e(e){E.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){n||0===v||(clearTimeout(C.current),C.current=setTimeout((()=>{M.current||r(!0)}),v))}},floating:{onMouseEnter(){clearTimeout(R.current)},onMouseLeave(){i.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),S(!1)}}}}),[i,a,v,n,r,S])}const j=u.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{},isInstantPhase:!1}),W=()=>u.useContext(j),U=e=>{let{children:t,delay:n,timeoutMs:r=0}=e;const[o,i]=u.useReducer(((e,t)=>({...e,...t})),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),c=u.useRef(null),l=u.useCallback((e=>{i({currentId:e})}),[]);return p((()=>{o.currentId?null===c.current?c.current=o.currentId:i({isInstantPhase:!0}):(i({isInstantPhase:!1}),c.current=null)}),[o.currentId]),u.createElement(j.Provider,{value:u.useMemo((()=>({...o,setState:i,setCurrentId:l})),[o,i,l])},t)},V=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:o}=t;const{currentId:u,setCurrentId:i,initialDelay:c,setState:l,timeoutMs:s}=W();p((()=>{u&&(l({delay:{open:1,close:_(c,"close")}}),u!==o&&r(!1))}),[o,r,l,u,c]),p((()=>{function e(){r(!1),l({delay:c,currentId:null})}if(!n&&u===o){if(s){const t=window.setTimeout(e,s);return()=>{clearTimeout(t)}}e()}}),[n,l,u,o,r,c,s]),p((()=>{n&&i(o)}),[n,i,o])};function X(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}let Y=0;function z(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(Y);const u=()=>null==e?void 0:e.focus({preventScroll:n});o?u():Y=requestAnimationFrame(u)}function Z(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 G(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Q(e){return S(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function J(e){e.preventDefault(),e.stopPropagation()}const $=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function ee(e,t){const n=a(e,$());"prev"===t&&n.reverse();const r=n.indexOf(X(T(e)));return n.slice(r+1)[0]}function te(){return ee(document.body,"next")}function ne(){return ee(document.body,"prev")}function re(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!B(n,r)}function oe(e){a(e,$()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function ue(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 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};function ce(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const le=u.forwardRef((function(e,t){const[n,r]=u.useState();return p((()=>(F()&&r("button"),document.addEventListener("keydown",ce),()=>{document.removeEventListener("keydown",ce)})),[]),u.createElement("span",m({},e,{ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,"data-floating-ui-focus-guard":"",style:ie}))})),se=u.createContext(null);function ae(e){let{id:t,root:n}=void 0===e?{}:e;const[r,o]=u.useState(null),i=b(),c=de(),l=u.useMemo((()=>({id:t,root:n,portalContext:c,uniqueId:i})),[t,n,c,i]),s=u.useRef();return p((()=>()=>{null==r||r.remove()}),[r,l]),p((()=>{if(s.current===l)return;s.current=l;const{id:e,root:t,portalContext:n,uniqueId:r}=l,u=e?document.getElementById(e):null,i="data-floating-ui-portal";if(u){const e=document.createElement("div");e.id=r,e.setAttribute(i,""),u.appendChild(e),o(e)}else{let u=(null==n?void 0:n.portalNode)||t||document.body,c=null;e&&(c=document.createElement("div"),c.id=e,u.appendChild(c));const l=document.createElement("div");l.id=r,l.setAttribute(i,""),u=c||u,u.appendChild(l),o(l)}}),[l]),r}function fe(e){let{children:t,id:n,root:r=null,preserveTabOrder:o=!0}=e;const i=ae({id:n,root:r}),[c,l]=u.useState(null),s=u.useRef(null),a=u.useRef(null),d=u.useRef(null),m=u.useRef(null),p=!!c&&!c.modal&&c.open&&o&&!(!r&&!i);return u.useEffect((()=>{if(i&&o&&(null==c||!c.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&&re(e)){("focusin"===e.type?ue:oe)(i)}}}),[i,o,null==c?void 0:c.modal]),u.createElement(se.Provider,{value:u.useMemo((()=>({preserveTabOrder:o,beforeOutsideRef:s,afterOutsideRef:a,beforeInsideRef:d,afterInsideRef:m,portalNode:i,setFocusManagerState:l})),[o,i])},p&&i&&u.createElement(le,{"data-type":"outside",ref:s,onFocus:e=>{if(re(e,i)){var t;null==(t=d.current)||t.focus()}else{const e=ne()||(null==c?void 0:c.refs.domReference.current);null==e||e.focus()}}}),p&&i&&u.createElement("span",{"aria-owns":i.id,style:ie}),i&&f(t,i),p&&i&&u.createElement(le,{"data-type":"outside",ref:a,onFocus:e=>{if(re(e,i)){var t;null==(t=m.current)||t.focus()}else{const e=te()||(null==c?void 0:c.refs.domReference.current);null==e||e.focus(),(null==c?void 0:c.closeOnFocusOut)&&(null==c||c.onOpenChange(!1))}}}))}const de=()=>u.useContext(se),me=u.forwardRef((function(e,t){return u.createElement("button",m({},e,{type:"button",ref:t,tabIndex:-1,style:ie}))}));function pe(e){const{context:t,children:n,order:r=["content"],guards:o=!0,initialFocus:i=0,returnFocus:c=!0,modal:l=!0,visuallyHiddenDismiss:f=!1,closeOnFocusOut:d=!0}=e,{open:m,refs:v,nodeId:g,onOpenChange:h,events:b,dataRef:y,elements:{domReference:w,floating:E}}=t,R=H(r),x=H(i),k=H(c),C=I(),M=de(),O="number"==typeof i&&i<0,A=u.useRef(null),L=u.useRef(null),P=u.useRef(!1),D=u.useRef(null),N=u.useRef(!1),F=null!=M,K=w&&"combobox"===w.getAttribute("role")&&Q(w),_=u.useCallback((function(e){return void 0===e&&(e=E),e?a(e,$()):[]}),[E]),q=u.useCallback((e=>{const t=_(e);return R.current.map((e=>w&&"reference"===e?w:E&&"floating"===e?E:t)).filter(Boolean).flat()}),[w,E,R,_]);function j(e){return f&&l?u.createElement(me,{ref:"start"===e?A:L,onClick:()=>h(!1)},"string"==typeof f?f:"Dismiss"):null}u.useEffect((()=>{if(!l)return;function e(e){if("Tab"===e.key){B(E,X(T(E)))&&0===_().length&&!K&&J(e);const t=q(),n=G(e);"reference"===R.current[0]&&n===w&&(J(e),e.shiftKey?z(t[t.length-1]):z(t[1])),"floating"===R.current[1]&&n===E&&e.shiftKey&&(J(e),z(t[0]))}}const t=T(E);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[w,E,l,R,v,K,_,q]),u.useEffect((()=>{if(d)return E&&S(w)?(w.addEventListener("focusout",t),w.addEventListener("pointerdown",e),!l&&E.addEventListener("focusout",t),()=>{w.removeEventListener("focusout",t),w.removeEventListener("pointerdown",e),!l&&E.removeEventListener("focusout",t)}):void 0;function e(){N.current=!0,setTimeout((()=>{N.current=!1}))}function t(e){const t=e.relatedTarget;queueMicrotask((()=>{const e=!(B(w,t)||B(E,t)||B(t,E)||B(null==M?void 0:M.portalNode,t)||null!=t&&t.hasAttribute("data-floating-ui-focus-guard")||C&&(Z(C.nodesRef.current,g).find((e=>{var n,r;return B(null==(n=e.context)?void 0:n.elements.floating,t)||B(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}(C.nodesRef.current,g).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&&e&&!N.current&&t!==D.current&&(P.current=!0,h(!1))}))}}),[w,E,l,g,C,M,h,d]),u.useEffect((()=>{var e;const t=Array.from((null==M||null==(e=M.portalNode)?void 0:e.querySelectorAll("[data-floating-ui-portal]"))||[]);if(E&&l){const e=[E,...t,...[A.current,L.current].filter(Boolean)],n=s(R.current.includes("reference")||K?e.concat(w||[]):e);return()=>{n()}}}),[w,E,l,R,M,K]),u.useEffect((()=>{if(l&&!o&&E){const e=[],t=$(),n=a(T(E).body,t),r=q(),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)}))}}}),[E,l,o,q]),p((()=>{if(!E)return;const e=X(T(E));queueMicrotask((()=>{const t=q(E),n=x.current,r=("number"==typeof n?t[n]:n.current)||E,o=B(E,e);O||o||!m||z(r,{preventScroll:r===E})}))}),[m,E,O,q,x]),p((()=>{if(!E)return;let e=!1;const t=T(E),n=X(t),r=y.current;function o(t){if("escapeKey"===t.type&&v.domReference.current&&(D.current=v.domReference.current),["referencePress","escapeKey"].includes(t.type))return;const n=t.data.returnFocus;"object"==typeof n?(P.current=!1,e=n.preventScroll):P.current=!n}return D.current=n,b.on("dismiss",o),()=>{b.off("dismiss",o);const n=X(t);(B(E,n)||C&&Z(C.nodesRef.current,g).some((e=>{var t;return B(null==(t=e.context)?void 0:t.elements.floating,n)}))||r.openEvent&&["click","mousedown"].includes(r.openEvent.type))&&v.domReference.current&&(D.current=v.domReference.current),k.current&&S(D.current)&&!P.current&&z(D.current,{cancelPrevious:!1,preventScroll:e})}}),[E,k,y,v,b,C,g]),p((()=>{if(M)return M.setFocusManagerState({...t,modal:l,closeOnFocusOut:d,open:m}),()=>{M.setFocusManagerState(null)}}),[M,l,m,d,t]),p((()=>{if(E&&"function"==typeof MutationObserver){const e=()=>{const e=E.getAttribute("tabindex");R.current.includes("floating")||X(T(E))!==v.domReference.current&&0===_().length?"0"!==e&&E.setAttribute("tabindex","0"):"-1"!==e&&E.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(E,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}}}),[E,v,R,_]);const W=o&&!K&&(F||l);return u.createElement(u.Fragment,null,W&&u.createElement(le,{"data-type":"inside",ref:null==M?void 0:M.beforeInsideRef,onFocus:e=>{if(l){const e=q();z("reference"===r[0]?e[0]:e[e.length-1])}else if(null!=M&&M.preserveTabOrder&&M.portalNode)if(P.current=!1,re(e,M.portalNode)){const e=te()||w;null==e||e.focus()}else{var t;null==(t=M.beforeOutsideRef.current)||t.focus()}}}),!K&&j("start"),n,j("end"),W&&u.createElement(le,{"data-type":"inside",ref:null==M?void 0:M.afterInsideRef,onFocus:e=>{if(l)z(q()[0]);else if(null!=M&&M.preserveTabOrder&&M.portalNode)if(d&&(P.current=!0),re(e,M.portalNode)){const e=ne()||w;null==e||e.focus()}else{var t;null==(t=M.afterOutsideRef.current)||t.focus()}}}))}function ve(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const ge=u.createContext({register:()=>{},unregister:()=>{},map:new Map,elementsRef:{current:[]}});function he(e){let{children:t,elementsRef:n,labelsRef:r}=e;const[o,i]=u.useState((()=>new Map)),c=u.useCallback((e=>{i((t=>new Map(t).set(e,null)))}),[]),l=u.useCallback((e=>{i((t=>{const n=new Map(t);return n.delete(e),n}))}),[]);return p((()=>{const e=new Map(o);Array.from(e.keys()).sort(ve).forEach(((t,n)=>{e.set(t,n)})),function(e,t){if(e.size!==t.size)return!1;for(const[n,r]of e.entries())if(r!==t.get(n))return!1;return!0}(o,e)||i(e)}),[o]),u.createElement(ge.Provider,{value:{register:c,unregister:l,map:o,elementsRef:n,labelsRef:r}},t)}function be(e){let{label:t}=void 0===e?{}:e;const[n,r]=u.useState(null),o=u.useRef(null),{register:i,unregister:c,map:l,elementsRef:s,labelsRef:a}=u.useContext(ge),f=u.useCallback((e=>{if(o.current=e,null!==n&&(s.current[n]=e,a)){var r;const o=void 0!==t;a.current[n]=o?t:null!=(r=null==e?void 0:e.textContent)?r:null}}),[n,s,a,t]);return p((()=>{const e=o.current;if(e)return i(e),()=>{c(e)}}),[i,c]),p((()=>{const e=o.current?l.get(o.current):null;null!=e&&r(e)}),[l]),u.useMemo((()=>({ref:f,index:null==n?-1:n})),[n,f])}const ye="data-floating-ui-scroll-lock",we=u.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return p((()=>{var e,t;if(!n)return;if(document.body.hasAttribute(ye))return;document.body.setAttribute(ye,"");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(O()))return Object.assign(document.body.style,{overflow:"hidden",[r]:o+"px"}),()=>{document.body.removeAttribute(ye),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(ye),window.scrollTo(c,l)}}),[n]),u.createElement("div",m({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function Ee(e){return S(e.target)&&"BUTTON"===e.target.tagName}function Re(e){return Q(e)}function xe(e,t){void 0===t&&(t={});const{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}=t,d=u.useRef(),m=u.useRef(!1);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){"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,e.defaultPrevented||!f||Ee(e)||(" "!==e.key||Re(i)||(e.preventDefault(),m.current=!0),"Enter"===e.key&&(n?s&&r(!1):r(!0)))},onKeyUp(e){e.defaultPrevented||!f||Ee(e)||Re(i)||" "===e.key&&m.current&&(m.current=!1,n?s&&r(!1):r(!0))}}}:{}),[c,o,l,a,f,i,s,n,r])}const Ie=u["useInsertionEffect".toString()]||(e=>e());function ke(e){const t=u.useRef((()=>{}));return Ie((()=>{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)}),[])}function Ce(e){return null!=e&&null!=e.clientX}function Me(e,t){void 0===t&&(t={});const{open:n,refs:r,dataRef:o,elements:{floating:i}}=e,{enabled:c=!0,axis:l="both",x:s=null,y:a=null}=t,f=u.useRef(!1),d=u.useRef(null),[m,v]=u.useState(),[g,h]=u.useState([]),b=ke(((e,t)=>{f.current||o.current.openEvent&&!Ce(o.current.openEvent)||r.setPositionReference(function(e,t){let n=null,r=null,o=!1;return{contextElement:e.current||void 0,getBoundingClientRect(){var u,i;const c=(null==(u=e.current)?void 0:u.getBoundingClientRect())||{width:0,height:0,x:0,y:0},l="x"===t.axis||"both"===t.axis,s="y"===t.axis||"both"===t.axis,a=["mouseenter","mousemove"].includes((null==(i=t.dataRef.current.openEvent)?void 0:i.type)||"")&&"touch"!==t.pointerType;let f=c.width,d=c.height,m=c.x,p=c.y;return null==n&&t.x&&l&&(n=c.x-t.x),null==r&&t.y&&s&&(r=c.y-t.y),m-=n||0,p-=r||0,f=0,d=0,!o||a?(f="y"===t.axis?c.width:0,d="x"===t.axis?c.height:0,m=l&&null!=t.x?t.x:m,p=s&&null!=t.y?t.y:p):o&&!a&&(d="x"===t.axis?c.height:d,f="y"===t.axis?c.width:f),o=!0,{width:f,height:d,x:m,y:p,top:p,right:m+f,bottom:p+d,left:m}}}}(r.domReference,{x:e,y:t,axis:l,dataRef:o,pointerType:m}))})),y=ke((e=>{null==s&&null==a&&(n?d.current||h([]):b(e.clientX,e.clientY))})),w=K(m)?i:n,E=u.useCallback((()=>{if(!w||!c||null!=s||null!=a)return;const e=L(r.floating.current);function t(n){const o=G(n);B(r.floating.current,o)?(e.removeEventListener("mousemove",t),d.current=null):b(n.clientX,n.clientY)}if(!o.current.openEvent||Ce(o.current.openEvent)){e.addEventListener("mousemove",t);const n=()=>{e.removeEventListener("mousemove",t),d.current=null};return d.current=n,n}r.setPositionReference(r.domReference.current)}),[o,c,w,r,b,s,a]);return u.useEffect((()=>E()),[E,g]),u.useEffect((()=>{c&&!i&&(f.current=!1)}),[c,i]),u.useEffect((()=>{!c&&n&&(f.current=!0)}),[c,n]),p((()=>{!c||null==s&&null==a||(f.current=!1,b(s,a))}),[c,s,a,b]),u.useMemo((()=>{if(!c)return{};function e(e){let{pointerType:t}=e;v(t)}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove:y,onMouseEnter:y}}}),[c,y])}function Te(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 Oe={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Ae={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"};function Le(e,n){void 0===n&&(n={});const{open:r,onOpenChange:o,events:i,nodeId:c,elements:{reference:l,domReference:s,floating:a},dataRef:f}=e,{enabled:d=!0,escapeKey:m=!0,outsidePress:p=!0,outsidePressEvent:v="pointerdown",referencePress:g=!1,referencePressEvent:h="pointerdown",ancestorScroll:b=!1,bubbles:y}=n,w=I(),E=null!=x(),R=ke("function"==typeof p?p:()=>!1),k="function"==typeof p?R:p,C=u.useRef(!1),{escapeKeyBubbles:M,outsidePressBubbles:O}=(e=>{var t,n;return{escapeKeyBubbles:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePressBubbles:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}})(y),A=ke((e=>{if(!r||!d||!m||"Escape"!==e.key)return;const t=w?Z(w.nodesRef.current,c):[];if(!M&&(e.stopPropagation(),t.length>0)){let e=!0;if(t.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)})),!e)return}i.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),o(!1)})),F=ke((e=>{const t=C.current;if(C.current=!1,t)return;if("function"==typeof k&&!k(e))return;const n=G(e);if(S(n)&&a){const t=n.clientWidth>0&&n.scrollWidth>n.clientWidth,r=n.clientHeight>0&&n.scrollHeight>n.clientHeight;let o=r&&e.offsetX>n.clientWidth;if(r){"rtl"===L(a).getComputedStyle(n).direction&&(o=e.offsetX<=n.offsetWidth-n.clientWidth)}if(o||t&&e.offsetY>n.clientHeight)return}const r=w&&Z(w.nodesRef.current,c).some((t=>{var n;return Te(e,null==(n=t.context)?void 0:n.elements.floating)}));if(Te(e,a)||Te(e,s)||r)return;const u=w?Z(w.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:E?{preventScroll:!0}:D(e)||N(e)}}),o(!1)}));return u.useEffect((()=>{if(!r||!d)return;function e(){o(!1)}f.current.__escapeKeyBubbles=M,f.current.__outsidePressBubbles=O;const n=T(a);m&&n.addEventListener("keydown",A),k&&n.addEventListener(v,F);let u=[];return b&&(P(s)&&(u=t(s)),P(a)&&(u=u.concat(t(a))),!P(l)&&l&&l.contextElement&&(u=u.concat(t(l.contextElement)))),u=u.filter((e=>{var t;return e!==(null==(t=n.defaultView)?void 0:t.visualViewport)})),u.forEach((t=>{t.addEventListener("scroll",e,{passive:!0})})),()=>{m&&n.removeEventListener("keydown",A),k&&n.removeEventListener(v,F),u.forEach((t=>{t.removeEventListener("scroll",e)}))}}),[f,a,s,l,m,k,v,r,o,b,d,M,O,A,F]),u.useEffect((()=>{C.current=!1}),[k,v]),u.useMemo((()=>d?{reference:{onKeyDown:A,[Oe[h]]:()=>{g&&(i.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),o(!1))}},floating:{onKeyDown:A,[Ae[v]]:()=>{C.current=!0}}}:{}),[d,i,g,v,h,o,A])}function Pe(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,refs:c,elements:{floating:l,domReference:s}}=e,{enabled:a=!0,keyboardOnly:f=!0}=t,d=u.useRef(""),m=u.useRef(!1),p=u.useRef();return u.useEffect((()=>{if(!a)return;const e=T(l).defaultView||window;function t(){!n&&S(s)&&s===X(T(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&&Te(o.current.openEvent,s)||(o.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){m.current=!1;const t=e.relatedTarget,n=P(t)&&t.hasAttribute("data-floating-ui-focus-guard")&&"outside"===t.getAttribute("data-type");p.current=setTimeout((()=>{B(c.floating.current,t)||B(s,t)||n||r(!1)}))}}}:{}),[a,f,s,c,o,r])}let Se=!1;function De(e,t,n){return Math.floor(e/t)!==n}function Ne(e,t){return t<0||t>=e.current.length}function Fe(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 Ke(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Be(e,t){return Ke(t,"ArrowUp"===e||"ArrowDown"===e,"ArrowLeft"===e||"ArrowRight"===e)}function He(e,t,n){return Ke(t,"ArrowDown"===e,n?"ArrowLeft"===e:"ArrowRight"===e)||"Enter"===e||" "==e||""===e}function _e(e,t){return Fe(e,{disabledIndices:t})}function qe(e,t){return Fe(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function je(e,t){const{open:n,onOpenChange:r,refs:o,elements:{domReference:i,floating:c}}=e,{listRef:l,activeIndex:s,onNavigate:a=(()=>{}),enabled:f=!0,selectedIndex:d=null,allowEscape:m=!1,loop:v=!1,nested:g=!1,rtl:h=!1,virtual:b=!1,focusItemOnOpen:y="auto",focusItemOnHover:w=!0,openOnArrowKeyDown:E=!0,disabledIndices:R,orientation:k="vertical",cols:C=1,scrollItemIntoView:M=!0}=t,A=x(),L=I(),P=ke(a),K=u.useRef(y),_=u.useRef(null!=d?d:-1),q=u.useRef(null),j=u.useRef(!0),W=u.useRef(P),U=u.useRef(!!c),V=u.useRef(!1),Y=u.useRef(!1),Z=H(R),G=H(n),Q=H(M),[$,ee]=u.useState(),te=ke((function(e,t,n){void 0===n&&(n=!1);const r=e.current[t.current];r&&(b?ee(r.id):z(r,{preventScroll:!0,sync:!(!O().toLowerCase().startsWith("mac")||navigator.maxTouchPoints||!F())&&(Se||V.current)}),requestAnimationFrame((()=>{const e=Q.current;e&&r&&(n||!j.current)&&(null==r.scrollIntoView||r.scrollIntoView("boolean"==typeof e?{block:"nearest",inline:"nearest"}:e))})))}));p((()=>{document.createElement("div").focus({get preventScroll(){return Se=!0,!1}})}),[]),p((()=>{f&&(n&&c?K.current&&null!=d&&(Y.current=!0,P(d)):U.current&&(_.current=-1,W.current(null)))}),[f,n,c,d,P]),p((()=>{if(f&&n&&c)if(null==s){if(V.current=!1,null!=d)return;if(U.current&&(_.current=-1,te(l,_)),!U.current&&K.current&&(null!=q.current||!0===K.current&&null==q.current)){let e=0;const t=()=>{if(null==l.current[0]){if(e<2){(e?requestAnimationFrame:queueMicrotask)(t)}e++}else _.current=null==q.current||He(q.current,k,h)||g?_e(l,Z.current):qe(l,Z.current),q.current=null,P(_.current)};t()}}else Ne(l,s)||(_.current=s,te(l,_,Y.current),Y.current=!1)}),[f,n,c,s,d,g,l,k,h,P,te,Z]),p((()=>{if(f&&U.current&&!c&&L){var e,t;const n=L.nodesRef.current,r=null==(e=n.find((e=>e.id===A)))||null==(t=e.context)?void 0:t.elements.floating,o=X(T(c)),u=n.some((e=>e.context&&B(e.context.elements.floating,o)));r&&!u&&r.focus({preventScroll:!0})}}),[f,c,L,A]),p((()=>{W.current=P,U.current=!!c})),p((()=>{n||(q.current=null)}),[n]);const ne=null!=s,re=u.useMemo((()=>{function e(e){if(!n)return;const t=l.current.indexOf(e);-1!==t&&P(t)}return{onFocus(t){let{currentTarget:n}=t;e(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...w&&{onMouseMove(t){let{currentTarget:n}=t;e(n)},onPointerLeave(e){let{pointerType:t}=e;j.current&&"touch"!==t&&(_.current=-1,te(l,_),P(null),b||z(o.floating.current,{preventScroll:!0}))}}}}),[n,o,te,w,l,P,b]);return u.useMemo((()=>{if(!f)return{};const e=Z.current;function t(t){if(j.current=!1,V.current=!0,!G.current&&t.currentTarget===o.floating.current)return;if(g&&function(e,t,n){return Ke(t,n?"ArrowRight"===e:"ArrowLeft"===e,"ArrowUp"===e)}(t.key,k,h))return J(t),r(!1),void(S(i)&&i.focus());const u=_.current,c=_e(l,e),s=qe(l,e);if("Home"===t.key&&(J(t),_.current=c,P(_.current)),"End"===t.key&&(J(t),_.current=s,P(_.current)),C>1){const n=_.current;if("ArrowUp"===t.key){if(J(t),-1===n)_.current=s;else if(_.current=Fe(l,{startingIndex:n,amount:C,decrement:!0,disabledIndices:e}),v&&(n-C<c||_.current<0)){const e=n%C,t=s%C,r=s-(t-e);_.current=t===e?s:t>e?r:r-C}Ne(l,_.current)&&(_.current=n),P(_.current)}if("ArrowDown"===t.key&&(J(t),-1===n?_.current=c:(_.current=Fe(l,{startingIndex:n,amount:C,disabledIndices:e}),v&&n+C>s&&(_.current=Fe(l,{startingIndex:n%C-C,amount:C,disabledIndices:e}))),Ne(l,_.current)&&(_.current=n),P(_.current)),"both"===k){const r=Math.floor(n/C);"ArrowRight"===t.key&&(J(t),n%C!=C-1?(_.current=Fe(l,{startingIndex:n,disabledIndices:e}),v&&De(_.current,C,r)&&(_.current=Fe(l,{startingIndex:n-n%C-1,disabledIndices:e}))):v&&(_.current=Fe(l,{startingIndex:n-n%C-1,disabledIndices:e})),De(_.current,C,r)&&(_.current=n)),"ArrowLeft"===t.key&&(J(t),n%C!=0?(_.current=Fe(l,{startingIndex:n,disabledIndices:e,decrement:!0}),v&&De(_.current,C,r)&&(_.current=Fe(l,{startingIndex:n+(C-n%C),decrement:!0,disabledIndices:e}))):v&&(_.current=Fe(l,{startingIndex:n+(C-n%C),decrement:!0,disabledIndices:e})),De(_.current,C,r)&&(_.current=n));const o=Math.floor(s/C)===r;return Ne(l,_.current)&&(_.current=v&&o?"ArrowLeft"===t.key?s:Fe(l,{startingIndex:n-n%C-1,disabledIndices:e}):n),void P(_.current)}}if(Be(t.key,k)){if(J(t),n&&!b&&X(t.currentTarget.ownerDocument)===t.currentTarget)return _.current=He(t.key,k,h)?c:s,void P(_.current);He(t.key,k,h)?_.current=v?u>=s?m&&u!==l.current.length?-1:c:Fe(l,{startingIndex:u,disabledIndices:e}):Math.min(s,Fe(l,{startingIndex:u,disabledIndices:e})):_.current=v?u<=c?m&&-1!==u?l.current.length:s:Fe(l,{startingIndex:u,decrement:!0,disabledIndices:e}):Math.max(c,Fe(l,{startingIndex:u,decrement:!0,disabledIndices:e})),Ne(l,_.current)?P(null):P(_.current)}}function u(e){"auto"===y&&D(e.nativeEvent)&&(K.current=!0)}const c=b&&n&&ne&&{"aria-activedescendant":$};return{reference:{...c,onKeyDown(o){j.current=!1;const u=0===o.key.indexOf("Arrow");if(b&&n)return t(o);if(!n&&!E&&u)return;const i=u||"Enter"===o.key||""===o.key.trim(),c=Be(o.key,k),s=function(e,t,n){return Ke(t,n?"ArrowLeft"===e:"ArrowRight"===e,"ArrowDown"===e)}(o.key,k,h);i&&(q.current=g&&c?null:o.key),g?s&&(J(o),n?(_.current=_e(l,e),P(_.current)):r(!0)):c&&(null!=d&&(_.current=d),J(o),!n&&E?r(!0):t(o),n&&P(_.current))},onFocus(){n&&P(null)},onPointerDown:function(e){K.current=y,"auto"===y&&N(e.nativeEvent)&&(K.current=!0)},onMouseDown:u,onClick:u},floating:{"aria-orientation":"both"===k?void 0:k,...c,onKeyDown:t,onPointerMove(){j.current=!0}},item:re}}),[i,o,$,Z,G,l,f,k,h,b,n,ne,g,d,E,m,C,v,y,P,r,re])}function We(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)}function Ue(e,t){void 0===t&&(t={});const{open:n,floatingId:r}=e,{enabled:o=!0,role:i="dialog"}=t,c=b();return u.useMemo((()=>{const e={id:r,role:i};return o?"tooltip"===i?{reference:{"aria-describedby":n?r:void 0},floating:e}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":"alertdialog"===i?"dialog":i,"aria-controls":n?r:void 0,..."listbox"===i&&{role:"combobox"},..."menu"===i&&{id:c}},floating:{...e,..."menu"===i&&{"aria-labelledby":c}}}:{}}),[o,i,n,r,c])}const Ve=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Xe(e,t){return"function"==typeof e?e(t):e}function Ye(e,t){void 0===t&&(t={});const{open:n,elements:{floating:r}}=e,{duration:o=250}=t,i=("number"==typeof o?o:o.close)||0,[c,l]=u.useState(!1),[s,a]=u.useState("unmounted"),f=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,i);return p((()=>{c&&!f&&a("unmounted")}),[c,f]),p((()=>{if(r){if(n){a("initial");const e=requestAnimationFrame((()=>{a("open")}));return()=>{cancelAnimationFrame(e)}}l(!0),a("close")}}),[n,r]),{isMounted:f,status:s}}function ze(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:r,close:o,common:i,duration:c=250}=t,l=e.placement,s=l.split("-")[0],a=u.useMemo((()=>({side:s,placement:l})),[s,l]),f="number"==typeof c,d=(f?c:c.open)||0,m=(f?c:c.close)||0,[v,g]=u.useState((()=>({...Xe(i,a),...Xe(n,a)}))),{isMounted:h,status:b}=Ye(e,{duration:c}),y=H(n),w=H(r),E=H(o),R=H(i);return p((()=>{const e=Xe(y.current,a),t=Xe(E.current,a),n=Xe(R.current,a),r=Xe(w.current,a)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===b&&g((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===b&&g({transitionProperty:Object.keys(r).map(Ve).join(","),transitionDuration:d+"ms",...n,...r}),"close"===b){const r=t||e;g({transitionProperty:Object.keys(r).map(Ve).join(","),transitionDuration:m+"ms",...n,...r})}}),[m,E,y,w,R,d,b,a]),{isMounted:h,styles:v}}function Ze(e,t){var n;const{open:r,dataRef:o}=e,{listRef:i,activeIndex:c,onMatch:l,onTypingChange:s,enabled:a=!0,findMatch:f=null,resetMs:d=750,ignoreKeys:m=[],selectedIndex:v=null}=t,g=u.useRef(),h=u.useRef(""),b=u.useRef(null!=(n=null!=v?v:c)?n:-1),y=u.useRef(null),w=ke(l),E=ke(s),R=H(f),x=H(m);return p((()=>{r&&(clearTimeout(g.current),y.current=null,h.current="")}),[r]),p((()=>{var e;r&&""===h.current&&(b.current=null!=(e=null!=v?v:c)?e:-1)}),[r,v,c]),u.useMemo((()=>{if(!a)return{};function e(e){e?o.current.typing||(o.current.typing=e,E(e)):o.current.typing&&(o.current.typing=e,E(e))}function t(e,t,n){const r=R.current?R.current(t,n):t.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(n.toLocaleLowerCase()))));return r?e.indexOf(r):-1}function n(n){const o=i.current;if(h.current.length>0&&" "!==h.current[0]&&(-1===t(o,o,h.current)?e(!1):" "===n.key&&J(n)),null==o||x.current.includes(n.key)||1!==n.key.length||n.ctrlKey||n.metaKey||n.altKey)return;r&&" "!==n.key&&(J(n),e(!0));o.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&h.current===n.key&&(h.current="",b.current=y.current),h.current+=n.key,clearTimeout(g.current),g.current=setTimeout((()=>{h.current="",b.current=y.current,e(!1)}),d);const u=b.current,c=t(o,[...o.slice((u||0)+1),...o.slice(0,(u||0)+1)],h.current);-1!==c?(w(c),y.current=c):" "!==n.key&&(h.current="",e(!1))}return{reference:{onKeyDown:n},floating:{onKeyDown:n,onKeyUp(t){" "===t.key&&e(!1)}}}}),[a,r,o,i,d,x,R,w,E])}function Ge(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Qe=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,...m}=e,{rects:p,elements:{floating:v}}=t,g=o.current[l];if(!g)return{};const h={...t,...await n(-g.offsetTop-p.reference.height/2-g.offsetHeight/2-c).fn(t)},b=(null==f?void 0:f.current)||v,y=await r(Ge(h,b.scrollHeight),m),w=await r(h,{...m,elementContext:"reference"}),E=Math.max(0,y.top),R=h.y+E,x=Math.max(0,b.scrollHeight-E-Math.max(0,y.bottom));return b.style.maxHeight=x+"px",b.scrollTop=E,i&&(b.offsetHeight<g.offsetHeight*Math.min(s,o.current.length-1)-1||w.top>=-a||w.bottom>=-a?d((()=>i(!0))):d((()=>i(!1)))),u&&(u.current=await r(Ge({...h,y:R},b.offsetHeight),m)),{y:R}}});function Je(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:i,scrollRef:c,onChange:l}=t,s=ke(l),a=u.useRef(!1),f=u.useRef(null),m=u.useRef(null);return u.useEffect((()=>{if(!o)return;function e(e){if(e.ctrlKey||!t||null==i.current)return;const n=e.deltaY,r=i.current.top>=-.5,o=i.current.bottom>=-.5,u=t.scrollHeight-t.clientHeight,c=n<0?-1:1,l=n<0?"max":"min";t.scrollHeight<=t.clientHeight||(!r&&n>0||!o&&n<0?(e.preventDefault(),d((()=>{s((e=>e+Math[l](n,u*c)))}))):/firefox/i.test(A())&&(t.scrollTop+=n))}const t=(null==c?void 0:c.current)||r.floating;return n&&t?(t.addEventListener("wheel",e),requestAnimationFrame((()=>{f.current=t.scrollTop,null!=i.current&&(m.current={...i.current})})),()=>{f.current=null,m.current=null,t.removeEventListener("wheel",e)}):void 0}),[o,n,r.floating,i,c,s]),u.useMemo((()=>o?{floating:{onKeyDown(){a.current=!0},onWheel(){a.current=!1},onPointerMove(){a.current=!1},onScroll(){const e=(null==c?void 0:c.current)||r.floating;if(i.current&&e&&a.current){if(null!==f.current){const t=e.scrollTop-f.current;(i.current.bottom<-.5&&t<-1||i.current.top<-.5&&t>1)&&d((()=>s((e=>e+t))))}requestAnimationFrame((()=>{f.current=e.scrollTop}))}}}}:{}),[o,i,r.floating,c,s])}function $e(e){void 0===e&&(e={});const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e;let o,u=!1,i=!1,c=null,l=null,s=performance.now();const a=e=>{let{x:n,y:a,placement:f,elements:d,onClose:m,nodeId:p,tree:v}=e;return function(e){function g(){clearTimeout(o),m()}if(clearTimeout(o),!d.domReference||!d.floating||null==f||null==n||null==a)return;const{clientX:h,clientY:b}=e,y=[h,b],w=G(e),E="mouseleave"===e.type,R=B(d.floating,w),x=B(d.domReference,w),I=d.domReference.getBoundingClientRect(),k=d.floating.getBoundingClientRect(),C=f.split("-")[0],M=n>k.right-k.width/2,T=a>k.bottom-k.height/2,O=function(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}(y,I);if(R&&(i=!0,!E))return;if(x&&(i=!1),x&&!E)return void(i=!0);if(E&&P(e.relatedTarget)&&B(d.floating,e.relatedTarget))return;if(v&&Z(v.nodesRef.current,p).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if("top"===C&&a>=I.bottom-1||"bottom"===C&&a<=I.top+1||"left"===C&&n>=I.right-1||"right"===C&&n<=I.left+1)return g();let A=[];switch(C){case"top":A=[[k.left,I.top+1],[k.left,k.bottom-1],[k.right,k.bottom-1],[k.right,I.top+1]],u=h>=k.left&&h<=k.right&&b>=k.top&&b<=I.top+1;break;case"bottom":A=[[k.left,k.top+1],[k.left,I.bottom-1],[k.right,I.bottom-1],[k.right,k.top+1]],u=h>=k.left&&h<=k.right&&b>=I.bottom-1&&b<=k.bottom;break;case"left":A=[[k.right-1,k.bottom],[k.right-1,k.top],[I.left+1,k.top],[I.left+1,k.bottom]],u=h>=k.left&&h<=I.left+1&&b>=k.top&&b<=k.bottom;break;case"right":A=[[I.right-1,k.bottom],[I.right-1,k.top],[k.left+1,k.top],[k.left+1,k.bottom]],u=h>=I.right-1&&h<=k.right&&b>=k.top&&b<=k.bottom}const L=u?A:function(e){let[n,r]=e;const o=k.width>I.width,u=k.height>I.height;switch(C){case"top":return[[o?n+t/2:M?n+4*t:n-4*t,r+t+1],[o?n-t/2:M?n+4*t:n-4*t,r+t+1],...[[k.left,M||o?k.bottom-t:k.top],[k.right,M?o?k.bottom-t:k.top:k.bottom-t]]];case"bottom":return[[o?n+t/2:M?n+4*t:n-4*t,r-t],[o?n-t/2:M?n+4*t:n-4*t,r-t],...[[k.left,M||o?k.top+t:k.bottom],[k.right,M?o?k.top+t:k.bottom:k.top+t]]];case"left":{const e=[n+t+1,u?r+t/2:T?r+4*t:r-4*t],o=[n+t+1,u?r-t/2:T?r+4*t:r-4*t];return[...[[T||u?k.right-t:k.left,k.top],[T?u?k.right-t:k.left:k.right-t,k.bottom]],e,o]}case"right":return[[n-t,u?r+t/2:T?r+4*t:r-4*t],[n-t,u?r-t/2:T?r+4*t:r-4*t],...[[T||u?k.left+t:k.right,k.top],[T?u?k.left+t:k.right:k.left+t,k.bottom]]]}}([n,a]);if(!u){if(i&&!O)return g();if(!E&&r){const t=function(e,t){const n=performance.now(),r=n-s;if(null===c||null===l||0===r)return c=e,l=t,s=n,null;const o=e-c,u=t-l,i=Math.sqrt(o*o+u*u);return c=e,l=t,s=n,i/r}(e.clientX,e.clientY),n=.1;if(null!==t&&t<n)return g()}!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}([h,b],L)?g():!i&&r&&(o=window.setTimeout(g,40))}}};return a.__options={blockPointerEvents:n},a}function et(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:r,nodeId:i}=e,[c,l]=u.useState(null),s=(null==(t=e.elements)?void 0:t.reference)||c,a=o(e),f=I(),d=ke(r),m=u.useRef(null),v=u.useRef({}),g=u.useState((()=>w()))[0],h=b(),y=u.useCallback((e=>{const t=P(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;a.refs.setReference(t)}),[a.refs]),E=u.useCallback((e=>{(P(e)||null===e)&&(m.current=e,l(e)),(P(a.refs.reference.current)||null===a.refs.reference.current||null!==e&&!P(e))&&a.refs.setReference(e)}),[a.refs]),R=u.useMemo((()=>({...a.refs,setReference:E,setPositionReference:y,domReference:m})),[a.refs,E,y]),x=u.useMemo((()=>({...a.elements,domReference:s})),[a.elements,s]),k=u.useMemo((()=>({...a,refs:R,elements:x,dataRef:v,nodeId:i,floatingId:h,events:g,open:n,onOpenChange:d})),[a,i,h,g,n,d,R,x]);return p((()=>{const e=null==f?void 0:f.nodesRef.current.find((e=>e.id===i));e&&(e.context=k)})),u.useMemo((()=>({...a,context:k,refs:R,elements:x})),[a,R,x,k])}function tt(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];return null==(e=r.get(n))?void 0:e.map((e=>e(...o))).find((e=>void 0!==e))})):e[n]=o})),e):e),{})}}function nt(e){void 0===e&&(e=[]);const t=e,n=u.useCallback((t=>tt(t,e,"reference")),t),r=u.useCallback((t=>tt(t,e,"floating")),t),o=u.useCallback((t=>tt(t,e,"item")),e.map((e=>null==e?void 0:e.item)));return u.useMemo((()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:o})),[n,r,o])}export{y as FloatingArrow,U as FloatingDelayGroup,pe as FloatingFocusManager,he as FloatingList,C as FloatingNode,we as FloatingOverlay,fe as FloatingPortal,M as FloatingTree,Qe as inner,$e as safePolygon,xe as useClick,Me as useClientPoint,V as useDelayGroup,W as useDelayGroupContext,Le as useDismiss,et as useFloating,k as useFloatingNodeId,x as useFloatingParentNodeId,ae as useFloatingPortalNode,I as useFloatingTree,Pe as useFocus,q as useHover,b as useId,Je as useInnerOffset,nt as useInteractions,be as useListItem,je as useListNavigation,We as useMergeRefs,Ue as useRole,Ye as useTransitionStatus,ze as useTransitionStyles,Ze as useTypeahead}; | ||
import{platform as e,getOverflowAncestors as t,offset as n,detectOverflow as r,useFloating as o}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";import*as u from"react";import{useLayoutEffect as i,useEffect as c,useRef as l}from"react";import{hideOthers as s}from"aria-hidden";import{tabbable as a}from"tabbable";import{createPortal as f,flushSync as d}from"react-dom";function m(){return m=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},m.apply(this,arguments)}var v="undefined"!=typeof document?i:c;let p=!1,g=0;const h=()=>"floating-ui-"+g++;const b=u["useId".toString()]||function(){const[e,t]=u.useState((()=>p?h():void 0));return v((()=>{null==e&&t(h())}),[]),u.useEffect((()=>{p||(p=!0)}),[]),e},y=u.forwardRef((function(t,n){let{context:{placement:r,elements:{floating:o},middlewareData:{arrow:i}},width:c=14,height:l=7,tipRadius:s=0,strokeWidth:a=0,staticOffset:f,stroke:d,d:v,style:{transform:p,...g}={},...h}=t;const y=b();if(!o)return null;a*=2;const w=a/2,E=c/2*(s/-8+1),R=l/2*s/4,[x,I]=r.split("-"),k=!!o&&e.isRTL(o),C=!!v,M="top"===x||"bottom"===x,T=f&&"end"===I?"bottom":"top";let O=f&&"end"===I?"right":"left";f&&k&&(O="end"===I?"left":"right");const A=C?0:w,L=null!=(null==i?void 0:i.x)?f||i.x:"",P=null!=(null==i?void 0:i.y)?f||i.y+A:"",S=v||"M0,0 H"+c+" L"+(c-E)+","+(l-R)+" Q"+c/2+","+l+" "+E+","+(l-R)+" Z",D={top:C?"rotate(180deg)":"",left:C?"rotate(90deg)":"rotate(-90deg)",bottom:C?"":"rotate(180deg)",right:C?"rotate(-90deg)":"rotate(90deg)"}[x];return u.createElement("svg",m({},h,{"aria-hidden":!0,ref:n,width:C?c:c+a,height:c,viewBox:"0 0 "+c+" "+(l>c?l:c),style:{position:"absolute",pointerEvents:"none",[O]:L,[T]:P,[x]:M||C?"100%":"calc(100% - "+a/2+"px)",transform:""+D+(null!=p?p:""),...g}}),a>0&&u.createElement("path",{clipPath:"url(#"+y+")",fill:"none",stroke:d,strokeWidth:a+(v?0:1),d:S}),u.createElement("path",{stroke:a&&!v?h.fill:"none",d:S}),u.createElement("clipPath",{id:y},u.createElement("rect",{x:-w,y:w*(C?-1:1),width:c+a,height:c})))}));function w(){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){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}const E=u.createContext(null),R=u.createContext(null),x=()=>{var e;return(null==(e=u.useContext(E))?void 0:e.id)||null},I=()=>u.useContext(R);function k(e){const t=b(),n=I(),r=x(),o=e||r;return v((()=>{const e={id:t,parentId:o};return null==n||n.addNode(e),()=>{null==n||n.removeNode(e)}}),[n,t,o]),t}function C(e){let{children:t,id:n}=e;const r=x();return u.createElement(E.Provider,{value:u.useMemo((()=>({id:n,parentId:r})),[n,r])},t)}function M(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((()=>w()))[0];return u.createElement(R.Provider,{value:u.useMemo((()=>({nodesRef:n,addNode:r,removeNode:o,events:i})),[n,r,o,i])},t)}function T(e){return(null==e?void 0:e.ownerDocument)||document}function O(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function A(){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 L(e){return T(e).defaultView||window}function P(e){return!!e&&e instanceof L(e).Element}function S(e){return!!e&&e instanceof L(e).HTMLElement}function D(e){if(0===e.mozInputSource&&e.isTrusted)return!0;const t=/Android/i;return(t.test(O())||t.test(A()))&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType}function N(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 F(){return/apple/i.test(navigator.vendor)}function K(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function B(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 L(r).ShadowRoot||r instanceof ShadowRoot))){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}var r;return!1}function H(e){const t=l(e);return v((()=>{t.current=e})),t}function _(e,t,n){return n&&!K(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}function q(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:{domReference:c,floating:l},refs:s}=e,{enabled:a=!0,delay:f=0,handleClose:d=null,mouseOnly:m=!1,restMs:p=0,move:g=!0}=t,h=I(),b=x(),y=H(d),w=H(f),E=u.useRef(),R=u.useRef(),k=u.useRef(),C=u.useRef(),M=u.useRef(!0),O=u.useRef(!1),A=u.useRef((()=>{})),L=u.useCallback((()=>{var e;const t=null==(e=o.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[o]);u.useEffect((()=>{if(a)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(){clearTimeout(R.current),clearTimeout(C.current),M.current=!0}}),[a,i]),u.useEffect((()=>{if(!a||!y.current||!n)return;function e(){L()&&r(!1)}const t=T(l).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[l,n,r,a,y,o,L]);const S=u.useCallback((function(e){void 0===e&&(e=!0);const t=_(w.current,"close",E.current);t&&!k.current?(clearTimeout(R.current),R.current=setTimeout((()=>r(!1)),t)):e&&(clearTimeout(R.current),r(!1))}),[w,r]),D=u.useCallback((()=>{A.current(),k.current=void 0}),[]),N=u.useCallback((()=>{if(O.current){const e=T(s.floating.current).body;e.style.pointerEvents="",e.removeAttribute("data-floating-ui-safe-polygon"),O.current=!1}}),[s]);return u.useEffect((()=>{if(a&&P(c)){const e=c;return n&&e.addEventListener("mouseleave",s),null==l||l.addEventListener("mouseleave",s),g&&e.addEventListener("mousemove",u,{once:!0}),e.addEventListener("mouseenter",u),e.addEventListener("mouseleave",i),()=>{n&&e.removeEventListener("mouseleave",s),null==l||l.removeEventListener("mouseleave",s),g&&e.removeEventListener("mousemove",u),e.removeEventListener("mouseenter",u),e.removeEventListener("mouseleave",i)}}function t(){return!!o.current.openEvent&&["click","mousedown"].includes(o.current.openEvent.type)}function u(e){if(clearTimeout(R.current),M.current=!1,m&&!K(E.current)||p>0&&0===_(w.current,"open"))return;o.current.openEvent=e;const t=_(w.current,"open",E.current);t?R.current=setTimeout((()=>{r(!0)}),t):r(!0)}function i(r){if(t())return;A.current();const o=T(l);if(clearTimeout(C.current),y.current){n||clearTimeout(R.current),k.current=y.current({...e,tree:h,x:r.clientX,y:r.clientY,onClose(){N(),D(),S()}});const t=k.current;return o.addEventListener("mousemove",t),void(A.current=()=>{o.removeEventListener("mousemove",t)})}("touch"!==E.current||!B(l,r.relatedTarget))&&S()}function s(n){t()||null==y.current||y.current({...e,tree:h,x:n.clientX,y:n.clientY,onClose(){N(),D(),S()}})(n)}}),[c,l,a,e,m,p,g,S,D,N,r,n,h,w,y,o]),v((()=>{var e;if(a&&n&&null!=(e=y.current)&&e.__options.blockPointerEvents&&L()){const e=T(l).body;if(e.setAttribute("data-floating-ui-safe-polygon",""),e.style.pointerEvents="none",O.current=!0,P(c)&&l){var t,r;const e=c,n=null==h||null==(t=h.nodesRef.current.find((e=>e.id===b)))||null==(r=t.context)?void 0:r.elements.floating;return n&&(n.style.pointerEvents=""),e.style.pointerEvents="auto",l.style.pointerEvents="auto",()=>{e.style.pointerEvents="",l.style.pointerEvents=""}}}}),[a,n,b,l,c,h,y,o,L]),v((()=>{n||(E.current=void 0,D(),N())}),[n,D,N]),u.useEffect((()=>()=>{D(),clearTimeout(R.current),clearTimeout(C.current),N()}),[a,D,N]),u.useMemo((()=>{if(!a)return{};function e(e){E.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){n||0===p||(clearTimeout(C.current),C.current=setTimeout((()=>{M.current||r(!0)}),p))}},floating:{onMouseEnter(){clearTimeout(R.current)},onMouseLeave(){i.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),S(!1)}}}}),[i,a,p,n,r,S])}const j=u.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{},isInstantPhase:!1}),W=()=>u.useContext(j),U=e=>{let{children:t,delay:n,timeoutMs:r=0}=e;const[o,i]=u.useReducer(((e,t)=>({...e,...t})),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),c=u.useRef(null),l=u.useCallback((e=>{i({currentId:e})}),[]);return v((()=>{o.currentId?null===c.current?c.current=o.currentId:i({isInstantPhase:!0}):(i({isInstantPhase:!1}),c.current=null)}),[o.currentId]),u.createElement(j.Provider,{value:u.useMemo((()=>({...o,setState:i,setCurrentId:l})),[o,i,l])},t)},V=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:o}=t;const{currentId:u,setCurrentId:i,initialDelay:c,setState:l,timeoutMs:s}=W();v((()=>{u&&(l({delay:{open:1,close:_(c,"close")}}),u!==o&&r(!1))}),[o,r,l,u,c]),v((()=>{function e(){r(!1),l({delay:c,currentId:null})}if(!n&&u===o){if(s){const t=window.setTimeout(e,s);return()=>{clearTimeout(t)}}e()}}),[n,l,u,o,r,c,s]),v((()=>{n&&i(o)}),[n,i,o])};function X(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}let Y=0;function z(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(Y);const u=()=>null==e?void 0:e.focus({preventScroll:n});o?u():Y=requestAnimationFrame(u)}function Z(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 G(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Q(e){return S(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function J(e){e.preventDefault(),e.stopPropagation()}const $=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function ee(e,t){const n=a(e,$());"prev"===t&&n.reverse();const r=n.indexOf(X(T(e)));return n.slice(r+1)[0]}function te(){return ee(document.body,"next")}function ne(){return ee(document.body,"prev")}function re(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!B(n,r)}function oe(e){a(e,$()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function ue(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 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};function ce(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const le=u.forwardRef((function(e,t){const[n,r]=u.useState();return v((()=>(F()&&r("button"),document.addEventListener("keydown",ce),()=>{document.removeEventListener("keydown",ce)})),[]),u.createElement("span",m({},e,{ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,"data-floating-ui-focus-guard":"",style:ie}))})),se=u.createContext(null);function ae(e){let{id:t,root:n}=void 0===e?{}:e;const[r,o]=u.useState(null),i=b(),c=de(),l=u.useMemo((()=>({id:t,root:n,portalContext:c,uniqueId:i})),[t,n,c,i]),s=u.useRef();return v((()=>()=>{null==r||r.remove()}),[r,l]),v((()=>{if(s.current===l)return;s.current=l;const{id:e,root:t,portalContext:n,uniqueId:r}=l,u=e?document.getElementById(e):null,i="data-floating-ui-portal";if(u){const e=document.createElement("div");e.id=r,e.setAttribute(i,""),u.appendChild(e),o(e)}else{let u=(null==n?void 0:n.portalNode)||t||document.body,c=null;e&&(c=document.createElement("div"),c.id=e,u.appendChild(c));const l=document.createElement("div");l.id=r,l.setAttribute(i,""),u=c||u,u.appendChild(l),o(l)}}),[l]),r}function fe(e){let{children:t,id:n,root:r=null,preserveTabOrder:o=!0}=e;const i=ae({id:n,root:r}),[c,l]=u.useState(null),s=u.useRef(null),a=u.useRef(null),d=u.useRef(null),m=u.useRef(null),v=!!c&&!c.modal&&c.open&&o&&!(!r&&!i);return u.useEffect((()=>{if(i&&o&&(null==c||!c.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&&re(e)){("focusin"===e.type?ue:oe)(i)}}}),[i,o,null==c?void 0:c.modal]),u.createElement(se.Provider,{value:u.useMemo((()=>({preserveTabOrder:o,beforeOutsideRef:s,afterOutsideRef:a,beforeInsideRef:d,afterInsideRef:m,portalNode:i,setFocusManagerState:l})),[o,i])},v&&i&&u.createElement(le,{"data-type":"outside",ref:s,onFocus:e=>{if(re(e,i)){var t;null==(t=d.current)||t.focus()}else{const e=ne()||(null==c?void 0:c.refs.domReference.current);null==e||e.focus()}}}),v&&i&&u.createElement("span",{"aria-owns":i.id,style:ie}),i&&f(t,i),v&&i&&u.createElement(le,{"data-type":"outside",ref:a,onFocus:e=>{if(re(e,i)){var t;null==(t=m.current)||t.focus()}else{const e=te()||(null==c?void 0:c.refs.domReference.current);null==e||e.focus(),(null==c?void 0:c.closeOnFocusOut)&&(null==c||c.onOpenChange(!1))}}}))}const de=()=>u.useContext(se),me=u.forwardRef((function(e,t){return u.createElement("button",m({},e,{type:"button",ref:t,tabIndex:-1,style:ie}))}));function ve(e){const{context:t,children:n,order:r=["content"],guards:o=!0,initialFocus:i=0,returnFocus:c=!0,modal:l=!0,visuallyHiddenDismiss:f=!1,closeOnFocusOut:d=!0}=e,{open:m,refs:p,nodeId:g,onOpenChange:h,events:b,dataRef:y,elements:{domReference:w,floating:E}}=t,R=H(r),x=H(i),k=H(c),C=I(),M=de(),O="number"==typeof i&&i<0,A=u.useRef(null),L=u.useRef(null),P=u.useRef(!1),D=u.useRef(null),N=u.useRef(!1),F=null!=M,K=w&&"combobox"===w.getAttribute("role")&&Q(w),_=u.useCallback((function(e){return void 0===e&&(e=E),e?a(e,$()):[]}),[E]),q=u.useCallback((e=>{const t=_(e);return R.current.map((e=>w&&"reference"===e?w:E&&"floating"===e?E:t)).filter(Boolean).flat()}),[w,E,R,_]);function j(e){return f&&l?u.createElement(me,{ref:"start"===e?A:L,onClick:()=>h(!1)},"string"==typeof f?f:"Dismiss"):null}u.useEffect((()=>{if(!l)return;function e(e){if("Tab"===e.key){B(E,X(T(E)))&&0===_().length&&!K&&J(e);const t=q(),n=G(e);"reference"===R.current[0]&&n===w&&(J(e),e.shiftKey?z(t[t.length-1]):z(t[1])),"floating"===R.current[1]&&n===E&&e.shiftKey&&(J(e),z(t[0]))}}const t=T(E);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[w,E,l,R,p,K,_,q]),u.useEffect((()=>{if(d)return E&&S(w)?(w.addEventListener("focusout",t),w.addEventListener("pointerdown",e),!l&&E.addEventListener("focusout",t),()=>{w.removeEventListener("focusout",t),w.removeEventListener("pointerdown",e),!l&&E.removeEventListener("focusout",t)}):void 0;function e(){N.current=!0,setTimeout((()=>{N.current=!1}))}function t(e){const t=e.relatedTarget;queueMicrotask((()=>{const e=!(B(w,t)||B(E,t)||B(t,E)||B(null==M?void 0:M.portalNode,t)||null!=t&&t.hasAttribute("data-floating-ui-focus-guard")||C&&(Z(C.nodesRef.current,g).find((e=>{var n,r;return B(null==(n=e.context)?void 0:n.elements.floating,t)||B(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}(C.nodesRef.current,g).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&&e&&!N.current&&t!==D.current&&(P.current=!0,h(!1))}))}}),[w,E,l,g,C,M,h,d]),u.useEffect((()=>{var e;const t=Array.from((null==M||null==(e=M.portalNode)?void 0:e.querySelectorAll("[data-floating-ui-portal]"))||[]);if(E&&l){const e=[E,...t,...[A.current,L.current].filter(Boolean)],n=s(R.current.includes("reference")||K?e.concat(w||[]):e);return()=>{n()}}}),[w,E,l,R,M,K]),u.useEffect((()=>{if(l&&!o&&E){const e=[],t=$(),n=a(T(E).body,t),r=q(),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)}))}}}),[E,l,o,q]),v((()=>{if(!E)return;const e=X(T(E));queueMicrotask((()=>{const t=q(E),n=x.current,r=("number"==typeof n?t[n]:n.current)||E,o=B(E,e);O||o||!m||z(r,{preventScroll:r===E})}))}),[m,E,O,q,x]),v((()=>{if(!E)return;let e=!1;const t=T(E),n=X(t),r=y.current;function o(t){if("escapeKey"===t.type&&p.domReference.current&&(D.current=p.domReference.current),["referencePress","escapeKey"].includes(t.type))return;const n=t.data.returnFocus;"object"==typeof n?(P.current=!1,e=n.preventScroll):P.current=!n}return D.current=n,b.on("dismiss",o),()=>{b.off("dismiss",o);const n=X(t);(B(E,n)||C&&Z(C.nodesRef.current,g).some((e=>{var t;return B(null==(t=e.context)?void 0:t.elements.floating,n)}))||r.openEvent&&["click","mousedown"].includes(r.openEvent.type))&&p.domReference.current&&(D.current=p.domReference.current),k.current&&S(D.current)&&!P.current&&z(D.current,{cancelPrevious:!1,preventScroll:e})}}),[E,k,y,p,b,C,g]),v((()=>{if(M)return M.setFocusManagerState({...t,modal:l,closeOnFocusOut:d,open:m}),()=>{M.setFocusManagerState(null)}}),[M,l,m,d,t]),v((()=>{if(E&&"function"==typeof MutationObserver){const e=()=>{const e=E.getAttribute("tabindex");R.current.includes("floating")||X(T(E))!==p.domReference.current&&0===_().length?"0"!==e&&E.setAttribute("tabindex","0"):"-1"!==e&&E.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(E,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}}}),[E,p,R,_]);const W=o&&!K&&(F||l);return u.createElement(u.Fragment,null,W&&u.createElement(le,{"data-type":"inside",ref:null==M?void 0:M.beforeInsideRef,onFocus:e=>{if(l){const e=q();z("reference"===r[0]?e[0]:e[e.length-1])}else if(null!=M&&M.preserveTabOrder&&M.portalNode)if(P.current=!1,re(e,M.portalNode)){const e=te()||w;null==e||e.focus()}else{var t;null==(t=M.beforeOutsideRef.current)||t.focus()}}}),!K&&j("start"),n,j("end"),W&&u.createElement(le,{"data-type":"inside",ref:null==M?void 0:M.afterInsideRef,onFocus:e=>{if(l)z(q()[0]);else if(null!=M&&M.preserveTabOrder&&M.portalNode)if(d&&(P.current=!0),re(e,M.portalNode)){const e=ne()||w;null==e||e.focus()}else{var t;null==(t=M.afterOutsideRef.current)||t.focus()}}}))}function pe(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const ge=u.createContext({register:()=>{},unregister:()=>{},map:new Map,elementsRef:{current:[]}});function he(e){let{children:t,elementsRef:n,labelsRef:r}=e;const[o,i]=u.useState((()=>new Map)),c=u.useCallback((e=>{i((t=>new Map(t).set(e,null)))}),[]),l=u.useCallback((e=>{i((t=>{const n=new Map(t);return n.delete(e),n}))}),[]);return v((()=>{const e=new Map(o);Array.from(e.keys()).sort(pe).forEach(((t,n)=>{e.set(t,n)})),function(e,t){if(e.size!==t.size)return!1;for(const[n,r]of e.entries())if(r!==t.get(n))return!1;return!0}(o,e)||i(e)}),[o]),u.createElement(ge.Provider,{value:{register:c,unregister:l,map:o,elementsRef:n,labelsRef:r}},t)}function be(e){let{label:t}=void 0===e?{}:e;const[n,r]=u.useState(null),o=u.useRef(null),{register:i,unregister:c,map:l,elementsRef:s,labelsRef:a}=u.useContext(ge),f=u.useCallback((e=>{if(o.current=e,null!==n&&(s.current[n]=e,a)){var r;const o=void 0!==t;a.current[n]=o?t:null!=(r=null==e?void 0:e.textContent)?r:null}}),[n,s,a,t]);return v((()=>{const e=o.current;if(e)return i(e),()=>{c(e)}}),[i,c]),v((()=>{const e=o.current?l.get(o.current):null;null!=e&&r(e)}),[l]),u.useMemo((()=>({ref:f,index:null==n?-1:n})),[n,f])}const ye="data-floating-ui-scroll-lock",we=u.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return v((()=>{var e,t;if(!n)return;if(document.body.hasAttribute(ye))return;document.body.setAttribute(ye,"");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(O()))return Object.assign(document.body.style,{overflow:"hidden",[r]:o+"px"}),()=>{document.body.removeAttribute(ye),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(ye),window.scrollTo(c,l)}}),[n]),u.createElement("div",m({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function Ee(e){return S(e.target)&&"BUTTON"===e.target.tagName}function Re(e){return Q(e)}function xe(e,t){void 0===t&&(t={});const{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}=t,d=u.useRef(),m=u.useRef(!1);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){"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,e.defaultPrevented||!f||Ee(e)||(" "!==e.key||Re(i)||(e.preventDefault(),m.current=!0),"Enter"===e.key&&(n?s&&r(!1):r(!0)))},onKeyUp(e){e.defaultPrevented||!f||Ee(e)||Re(i)||" "===e.key&&m.current&&(m.current=!1,n?s&&r(!1):r(!0))}}}:{}),[c,o,l,a,f,i,s,n,r])}const Ie=u["useInsertionEffect".toString()]||(e=>e());function ke(e){const t=u.useRef((()=>{}));return Ie((()=>{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)}),[])}function Ce(e){return null!=e&&null!=e.clientX}function Me(e,t){void 0===t&&(t={});const{open:n,refs:r,dataRef:o,elements:{floating:i}}=e,{enabled:c=!0,axis:l="both",x:s=null,y:a=null}=t,f=u.useRef(!1),d=u.useRef(null),[m,p]=u.useState(),[g,h]=u.useState([]),b=ke(((e,t)=>{f.current||o.current.openEvent&&!Ce(o.current.openEvent)||r.setPositionReference(function(e,t){let n=null,r=null,o=!1;return{contextElement:e.current||void 0,getBoundingClientRect(){var u,i;const c=(null==(u=e.current)?void 0:u.getBoundingClientRect())||{width:0,height:0,x:0,y:0},l="x"===t.axis||"both"===t.axis,s="y"===t.axis||"both"===t.axis,a=["mouseenter","mousemove"].includes((null==(i=t.dataRef.current.openEvent)?void 0:i.type)||"")&&"touch"!==t.pointerType;let f=c.width,d=c.height,m=c.x,v=c.y;return null==n&&t.x&&l&&(n=c.x-t.x),null==r&&t.y&&s&&(r=c.y-t.y),m-=n||0,v-=r||0,f=0,d=0,!o||a?(f="y"===t.axis?c.width:0,d="x"===t.axis?c.height:0,m=l&&null!=t.x?t.x:m,v=s&&null!=t.y?t.y:v):o&&!a&&(d="x"===t.axis?c.height:d,f="y"===t.axis?c.width:f),o=!0,{width:f,height:d,x:m,y:v,top:v,right:m+f,bottom:v+d,left:m}}}}(r.domReference,{x:e,y:t,axis:l,dataRef:o,pointerType:m}))})),y=ke((e=>{null==s&&null==a&&(n?d.current||h([]):b(e.clientX,e.clientY))})),w=K(m)?i:n,E=u.useCallback((()=>{if(!w||!c||null!=s||null!=a)return;const e=L(r.floating.current);function t(n){const o=G(n);B(r.floating.current,o)?(e.removeEventListener("mousemove",t),d.current=null):b(n.clientX,n.clientY)}if(!o.current.openEvent||Ce(o.current.openEvent)){e.addEventListener("mousemove",t);const n=()=>{e.removeEventListener("mousemove",t),d.current=null};return d.current=n,n}r.setPositionReference(r.domReference.current)}),[o,c,w,r,b,s,a]);return u.useEffect((()=>E()),[E,g]),u.useEffect((()=>{c&&!i&&(f.current=!1)}),[c,i]),u.useEffect((()=>{!c&&n&&(f.current=!0)}),[c,n]),v((()=>{!c||null==s&&null==a||(f.current=!1,b(s,a))}),[c,s,a,b]),u.useMemo((()=>{if(!c)return{};function e(e){let{pointerType:t}=e;p(t)}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove:y,onMouseEnter:y}}}),[c,y])}function Te(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 Oe={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Ae={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"};function Le(e,n){void 0===n&&(n={});const{open:r,onOpenChange:o,events:i,nodeId:c,elements:{reference:l,domReference:s,floating:a},dataRef:f}=e,{enabled:d=!0,escapeKey:m=!0,outsidePress:v=!0,outsidePressEvent:p="pointerdown",referencePress:g=!1,referencePressEvent:h="pointerdown",ancestorScroll:b=!1,bubbles:y}=n,w=I(),E=null!=x(),R=ke("function"==typeof v?v:()=>!1),k="function"==typeof v?R:v,C=u.useRef(!1),{escapeKeyBubbles:M,outsidePressBubbles:O}=(e=>{var t,n;return{escapeKeyBubbles:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePressBubbles:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}})(y),A=ke((e=>{if(!r||!d||!m||"Escape"!==e.key)return;const t=w?Z(w.nodesRef.current,c):[];if(!M&&(e.stopPropagation(),t.length>0)){let e=!0;if(t.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)})),!e)return}i.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),o(!1)})),F=ke((e=>{const t=C.current;if(C.current=!1,t)return;if("function"==typeof k&&!k(e))return;const n=G(e);if(S(n)&&a){const t=n.clientWidth>0&&n.scrollWidth>n.clientWidth,r=n.clientHeight>0&&n.scrollHeight>n.clientHeight;let o=r&&e.offsetX>n.clientWidth;if(r){"rtl"===L(a).getComputedStyle(n).direction&&(o=e.offsetX<=n.offsetWidth-n.clientWidth)}if(o||t&&e.offsetY>n.clientHeight)return}const r=w&&Z(w.nodesRef.current,c).some((t=>{var n;return Te(e,null==(n=t.context)?void 0:n.elements.floating)}));if(Te(e,a)||Te(e,s)||r)return;const u=w?Z(w.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:E?{preventScroll:!0}:D(e)||N(e)}}),o(!1)}));return u.useEffect((()=>{if(!r||!d)return;function e(){o(!1)}f.current.__escapeKeyBubbles=M,f.current.__outsidePressBubbles=O;const n=T(a);m&&n.addEventListener("keydown",A),k&&n.addEventListener(p,F);let u=[];return b&&(P(s)&&(u=t(s)),P(a)&&(u=u.concat(t(a))),!P(l)&&l&&l.contextElement&&(u=u.concat(t(l.contextElement)))),u=u.filter((e=>{var t;return e!==(null==(t=n.defaultView)?void 0:t.visualViewport)})),u.forEach((t=>{t.addEventListener("scroll",e,{passive:!0})})),()=>{m&&n.removeEventListener("keydown",A),k&&n.removeEventListener(p,F),u.forEach((t=>{t.removeEventListener("scroll",e)}))}}),[f,a,s,l,m,k,p,r,o,b,d,M,O,A,F]),u.useEffect((()=>{C.current=!1}),[k,p]),u.useMemo((()=>d?{reference:{onKeyDown:A,[Oe[h]]:()=>{g&&(i.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),o(!1))}},floating:{onKeyDown:A,[Ae[p]]:()=>{C.current=!0}}}:{}),[d,i,g,p,h,o,A])}function Pe(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,refs:c,elements:{floating:l,domReference:s}}=e,{enabled:a=!0,keyboardOnly:f=!0}=t,d=u.useRef(""),m=u.useRef(!1),v=u.useRef();return u.useEffect((()=>{if(!a)return;const e=T(l).defaultView||window;function t(){!n&&S(s)&&s===X(T(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(v.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&&Te(o.current.openEvent,s)||(o.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){m.current=!1;const t=e.relatedTarget,n=P(t)&&t.hasAttribute("data-floating-ui-focus-guard")&&"outside"===t.getAttribute("data-type");v.current=setTimeout((()=>{B(c.floating.current,t)||B(s,t)||n||r(!1)}))}}}:{}),[a,f,s,c,o,r])}let Se=!1;function De(e,t,n){return Math.floor(e/t)!==n}function Ne(e,t){return t<0||t>=e.current.length}function Fe(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 Ke(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Be(e,t){return Ke(t,"ArrowUp"===e||"ArrowDown"===e,"ArrowLeft"===e||"ArrowRight"===e)}function He(e,t,n){return Ke(t,"ArrowDown"===e,n?"ArrowLeft"===e:"ArrowRight"===e)||"Enter"===e||" "==e||""===e}function _e(e,t){return Fe(e,{disabledIndices:t})}function qe(e,t){return Fe(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function je(e,t){const{open:n,onOpenChange:r,refs:o,elements:{domReference:i,floating:c}}=e,{listRef:l,activeIndex:s,onNavigate:a=(()=>{}),enabled:f=!0,selectedIndex:d=null,allowEscape:m=!1,loop:p=!1,nested:g=!1,rtl:h=!1,virtual:b=!1,focusItemOnOpen:y="auto",focusItemOnHover:w=!0,openOnArrowKeyDown:E=!0,disabledIndices:R,orientation:k="vertical",cols:C=1,scrollItemIntoView:M=!0}=t,A=x(),L=I(),P=ke(a),K=u.useRef(y),_=u.useRef(null!=d?d:-1),q=u.useRef(null),j=u.useRef(!0),W=u.useRef(P),U=u.useRef(!!c),V=u.useRef(!1),Y=u.useRef(!1),Z=H(R),G=H(n),Q=H(M),[$,ee]=u.useState(),te=ke((function(e,t,n){void 0===n&&(n=!1);const r=e.current[t.current];r&&(b?ee(r.id):z(r,{preventScroll:!0,sync:!(!O().toLowerCase().startsWith("mac")||navigator.maxTouchPoints||!F())&&(Se||V.current)}),requestAnimationFrame((()=>{const e=Q.current;e&&r&&(n||!j.current)&&(null==r.scrollIntoView||r.scrollIntoView("boolean"==typeof e?{block:"nearest",inline:"nearest"}:e))})))}));v((()=>{document.createElement("div").focus({get preventScroll(){return Se=!0,!1}})}),[]),v((()=>{f&&(n&&c?K.current&&null!=d&&(Y.current=!0,P(d)):U.current&&(_.current=-1,W.current(null)))}),[f,n,c,d,P]),v((()=>{if(f&&n&&c)if(null==s){if(V.current=!1,null!=d)return;if(U.current&&(_.current=-1,te(l,_)),!U.current&&K.current&&(null!=q.current||!0===K.current&&null==q.current)){let e=0;const t=()=>{if(null==l.current[0]){if(e<2){(e?requestAnimationFrame:queueMicrotask)(t)}e++}else _.current=null==q.current||He(q.current,k,h)||g?_e(l,Z.current):qe(l,Z.current),q.current=null,P(_.current)};t()}}else Ne(l,s)||(_.current=s,te(l,_,Y.current),Y.current=!1)}),[f,n,c,s,d,g,l,k,h,P,te,Z]),v((()=>{if(f&&U.current&&!c&&L){var e,t;const n=L.nodesRef.current,r=null==(e=n.find((e=>e.id===A)))||null==(t=e.context)?void 0:t.elements.floating,o=X(T(c)),u=n.some((e=>e.context&&B(e.context.elements.floating,o)));r&&!u&&r.focus({preventScroll:!0})}}),[f,c,L,A]),v((()=>{W.current=P,U.current=!!c})),v((()=>{n||(q.current=null)}),[n]);const ne=null!=s,re=u.useMemo((()=>{function e(e){if(!n)return;const t=l.current.indexOf(e);-1!==t&&P(t)}return{onFocus(t){let{currentTarget:n}=t;e(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...w&&{onMouseMove(t){let{currentTarget:n}=t;e(n)},onPointerLeave(e){let{pointerType:t}=e;j.current&&"touch"!==t&&(_.current=-1,te(l,_),P(null),b||z(o.floating.current,{preventScroll:!0}))}}}}),[n,o,te,w,l,P,b]);return u.useMemo((()=>{if(!f)return{};const e=Z.current;function t(t){if(j.current=!1,V.current=!0,!G.current&&t.currentTarget===o.floating.current)return;if(g&&function(e,t,n){return Ke(t,n?"ArrowRight"===e:"ArrowLeft"===e,"ArrowUp"===e)}(t.key,k,h))return J(t),r(!1),void(S(i)&&i.focus());const u=_.current,c=_e(l,e),s=qe(l,e);if("Home"===t.key&&(J(t),_.current=c,P(_.current)),"End"===t.key&&(J(t),_.current=s,P(_.current)),C>1){const n=_.current;if("ArrowUp"===t.key){if(J(t),-1===n)_.current=s;else if(_.current=Fe(l,{startingIndex:n,amount:C,decrement:!0,disabledIndices:e}),p&&(n-C<c||_.current<0)){const e=n%C,t=s%C,r=s-(t-e);_.current=t===e?s:t>e?r:r-C}Ne(l,_.current)&&(_.current=n),P(_.current)}if("ArrowDown"===t.key&&(J(t),-1===n?_.current=c:(_.current=Fe(l,{startingIndex:n,amount:C,disabledIndices:e}),p&&n+C>s&&(_.current=Fe(l,{startingIndex:n%C-C,amount:C,disabledIndices:e}))),Ne(l,_.current)&&(_.current=n),P(_.current)),"both"===k){const r=Math.floor(n/C);"ArrowRight"===t.key&&(J(t),n%C!=C-1?(_.current=Fe(l,{startingIndex:n,disabledIndices:e}),p&&De(_.current,C,r)&&(_.current=Fe(l,{startingIndex:n-n%C-1,disabledIndices:e}))):p&&(_.current=Fe(l,{startingIndex:n-n%C-1,disabledIndices:e})),De(_.current,C,r)&&(_.current=n)),"ArrowLeft"===t.key&&(J(t),n%C!=0?(_.current=Fe(l,{startingIndex:n,disabledIndices:e,decrement:!0}),p&&De(_.current,C,r)&&(_.current=Fe(l,{startingIndex:n+(C-n%C),decrement:!0,disabledIndices:e}))):p&&(_.current=Fe(l,{startingIndex:n+(C-n%C),decrement:!0,disabledIndices:e})),De(_.current,C,r)&&(_.current=n));const o=Math.floor(s/C)===r;return Ne(l,_.current)&&(_.current=p&&o?"ArrowLeft"===t.key?s:Fe(l,{startingIndex:n-n%C-1,disabledIndices:e}):n),void P(_.current)}}if(Be(t.key,k)){if(J(t),n&&!b&&X(t.currentTarget.ownerDocument)===t.currentTarget)return _.current=He(t.key,k,h)?c:s,void P(_.current);He(t.key,k,h)?_.current=p?u>=s?m&&u!==l.current.length?-1:c:Fe(l,{startingIndex:u,disabledIndices:e}):Math.min(s,Fe(l,{startingIndex:u,disabledIndices:e})):_.current=p?u<=c?m&&-1!==u?l.current.length:s:Fe(l,{startingIndex:u,decrement:!0,disabledIndices:e}):Math.max(c,Fe(l,{startingIndex:u,decrement:!0,disabledIndices:e})),Ne(l,_.current)?P(null):P(_.current)}}function u(e){"auto"===y&&D(e.nativeEvent)&&(K.current=!0)}const c=b&&n&&ne&&{"aria-activedescendant":$};return{reference:{...c,onKeyDown(o){j.current=!1;const u=0===o.key.indexOf("Arrow");if(b&&n)return t(o);if(!n&&!E&&u)return;const i=u||"Enter"===o.key||""===o.key.trim(),c=Be(o.key,k),s=function(e,t,n){return Ke(t,n?"ArrowLeft"===e:"ArrowRight"===e,"ArrowDown"===e)}(o.key,k,h);i&&(q.current=g&&c?null:o.key),g?s&&(J(o),n?(_.current=_e(l,e),P(_.current)):r(!0)):c&&(null!=d&&(_.current=d),J(o),!n&&E?r(!0):t(o),n&&P(_.current))},onFocus(){n&&P(null)},onPointerDown:function(e){K.current=y,"auto"===y&&N(e.nativeEvent)&&(K.current=!0)},onMouseDown:u,onClick:u},floating:{"aria-orientation":"both"===k?void 0:k,...c,onKeyDown:t,onPointerMove(){j.current=!0}},item:re}}),[i,o,$,Z,G,l,f,k,h,b,n,ne,g,d,E,m,C,p,y,P,r,re])}function We(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)}function Ue(e,t){void 0===t&&(t={});const{open:n,floatingId:r}=e,{enabled:o=!0,role:i="dialog"}=t,c=b();return u.useMemo((()=>{const e={id:r,role:i};return o?"tooltip"===i?{reference:{"aria-describedby":n?r:void 0},floating:e}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":"alertdialog"===i?"dialog":i,"aria-controls":n?r:void 0,..."listbox"===i&&{role:"combobox"},..."menu"===i&&{id:c}},floating:{...e,..."menu"===i&&{"aria-labelledby":c}}}:{}}),[o,i,n,r,c])}const Ve=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Xe(e,t){return"function"==typeof e?e(t):e}function Ye(e,t){void 0===t&&(t={});const{open:n,elements:{floating:r}}=e,{duration:o=250}=t,i=("number"==typeof o?o:o.close)||0,[c,l]=u.useState(!1),[s,a]=u.useState("unmounted"),f=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,i);return v((()=>{c&&!f&&a("unmounted")}),[c,f]),v((()=>{if(r){if(n){a("initial");const e=requestAnimationFrame((()=>{a("open")}));return()=>{cancelAnimationFrame(e)}}l(!0),a("close")}}),[n,r]),{isMounted:f,status:s}}function ze(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:r,close:o,common:i,duration:c=250}=t,l=e.placement,s=l.split("-")[0],a=u.useMemo((()=>({side:s,placement:l})),[s,l]),f="number"==typeof c,d=(f?c:c.open)||0,m=(f?c:c.close)||0,[p,g]=u.useState((()=>({...Xe(i,a),...Xe(n,a)}))),{isMounted:h,status:b}=Ye(e,{duration:c}),y=H(n),w=H(r),E=H(o),R=H(i);return v((()=>{const e=Xe(y.current,a),t=Xe(E.current,a),n=Xe(R.current,a),r=Xe(w.current,a)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===b&&g((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===b&&g({transitionProperty:Object.keys(r).map(Ve).join(","),transitionDuration:d+"ms",...n,...r}),"close"===b){const r=t||e;g({transitionProperty:Object.keys(r).map(Ve).join(","),transitionDuration:m+"ms",...n,...r})}}),[m,E,y,w,R,d,b,a]),{isMounted:h,styles:p}}function Ze(e,t){var n;const{open:r,dataRef:o}=e,{listRef:i,activeIndex:c,onMatch:l,onTypingChange:s,enabled:a=!0,findMatch:f=null,resetMs:d=750,ignoreKeys:m=[],selectedIndex:p=null}=t,g=u.useRef(),h=u.useRef(""),b=u.useRef(null!=(n=null!=p?p:c)?n:-1),y=u.useRef(null),w=ke(l),E=ke(s),R=H(f),x=H(m);return v((()=>{r&&(clearTimeout(g.current),y.current=null,h.current="")}),[r]),v((()=>{var e;r&&""===h.current&&(b.current=null!=(e=null!=p?p:c)?e:-1)}),[r,p,c]),u.useMemo((()=>{if(!a)return{};function e(e){e?o.current.typing||(o.current.typing=e,E(e)):o.current.typing&&(o.current.typing=e,E(e))}function t(e,t,n){const r=R.current?R.current(t,n):t.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(n.toLocaleLowerCase()))));return r?e.indexOf(r):-1}function n(n){const o=i.current;if(h.current.length>0&&" "!==h.current[0]&&(-1===t(o,o,h.current)?e(!1):" "===n.key&&J(n)),null==o||x.current.includes(n.key)||1!==n.key.length||n.ctrlKey||n.metaKey||n.altKey)return;r&&" "!==n.key&&(J(n),e(!0));o.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&h.current===n.key&&(h.current="",b.current=y.current),h.current+=n.key,clearTimeout(g.current),g.current=setTimeout((()=>{h.current="",b.current=y.current,e(!1)}),d);const u=b.current,c=t(o,[...o.slice((u||0)+1),...o.slice(0,(u||0)+1)],h.current);-1!==c?(w(c),y.current=c):" "!==n.key&&(h.current="",e(!1))}return{reference:{onKeyDown:n},floating:{onKeyDown:n,onKeyUp(t){" "===t.key&&e(!1)}}}}),[a,r,o,i,d,x,R,w,E])}function Ge(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Qe=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,...m}=e,{rects:v,elements:{floating:p}}=t,g=o.current[l];if(!g)return{};const h={...t,...await n(-g.offsetTop-v.reference.height/2-g.offsetHeight/2-c).fn(t)},b=(null==f?void 0:f.current)||p,y=await r(Ge(h,b.scrollHeight),m),w=await r(h,{...m,elementContext:"reference"}),E=Math.max(0,y.top),R=h.y+E,x=Math.max(0,b.scrollHeight-E-Math.max(0,y.bottom));return b.style.maxHeight=x+"px",b.scrollTop=E,i&&(b.offsetHeight<g.offsetHeight*Math.min(s,o.current.length-1)-1||w.top>=-a||w.bottom>=-a?d((()=>i(!0))):d((()=>i(!1)))),u&&(u.current=await r(Ge({...h,y:R},b.offsetHeight),m)),{y:R}}});function Je(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:i,scrollRef:c,onChange:l}=t,s=ke(l),a=u.useRef(!1),f=u.useRef(null),m=u.useRef(null);return u.useEffect((()=>{if(!o)return;function e(e){if(e.ctrlKey||!t||null==i.current)return;const n=e.deltaY,r=i.current.top>=-.5,o=i.current.bottom>=-.5,u=t.scrollHeight-t.clientHeight,c=n<0?-1:1,l=n<0?"max":"min";t.scrollHeight<=t.clientHeight||(!r&&n>0||!o&&n<0?(e.preventDefault(),d((()=>{s((e=>e+Math[l](n,u*c)))}))):/firefox/i.test(A())&&(t.scrollTop+=n))}const t=(null==c?void 0:c.current)||r.floating;return n&&t?(t.addEventListener("wheel",e),requestAnimationFrame((()=>{f.current=t.scrollTop,null!=i.current&&(m.current={...i.current})})),()=>{f.current=null,m.current=null,t.removeEventListener("wheel",e)}):void 0}),[o,n,r.floating,i,c,s]),u.useMemo((()=>o?{floating:{onKeyDown(){a.current=!0},onWheel(){a.current=!1},onPointerMove(){a.current=!1},onScroll(){const e=(null==c?void 0:c.current)||r.floating;if(i.current&&e&&a.current){if(null!==f.current){const t=e.scrollTop-f.current;(i.current.bottom<-.5&&t<-1||i.current.top<-.5&&t>1)&&d((()=>s((e=>e+t))))}requestAnimationFrame((()=>{f.current=e.scrollTop}))}}}}:{}),[o,i,r.floating,c,s])}function $e(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}function et(e){void 0===e&&(e={});const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e;let o,u=!1,i=null,c=null,l=performance.now();const s=e=>{let{x:n,y:s,placement:a,elements:f,onClose:d,nodeId:m,tree:v}=e;return function(e){function p(){clearTimeout(o),d()}if(clearTimeout(o),!f.domReference||!f.floating||null==a||null==n||null==s)return;const{clientX:g,clientY:h}=e,b=[g,h],y=G(e),w="mouseleave"===e.type,E=B(f.floating,y),R=B(f.domReference,y),x=f.domReference.getBoundingClientRect(),I=f.floating.getBoundingClientRect(),k=a.split("-")[0],C=n>I.right-I.width/2,M=s>I.bottom-I.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}(b,x),O=I.width>x.width,A=I.height>x.height,L=(O?x:I).left,S=(O?x:I).right,D=(A?x:I).top,N=(A?x:I).bottom;if(E&&(u=!0,!w))return;if(R&&(u=!1),R&&!w)return void(u=!0);if(w&&P(e.relatedTarget)&&B(f.floating,e.relatedTarget))return;if(v&&Z(v.nodesRef.current,m).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if("top"===k&&s>=x.bottom-1||"bottom"===k&&s<=x.top+1||"left"===k&&n>=x.right-1||"right"===k&&n<=x.left+1)return p();let F=[];switch(k){case"top":F=[[L,x.top+1],[L,I.bottom-1],[S,I.bottom-1],[S,x.top+1]];break;case"bottom":F=[[L,I.top+1],[L,x.bottom-1],[S,x.bottom-1],[S,I.top+1]];break;case"left":F=[[I.right-1,N],[I.right-1,D],[x.left+1,D],[x.left+1,N]];break;case"right":F=[[x.right-1,N],[x.right-1,D],[I.left+1,D],[I.left+1,N]]}if(!$e([g,h],F)){if(u&&!T)return p();if(!w&&r){const t=function(e,t){const n=performance.now(),r=n-l;if(null===i||null===c||0===r)return i=e,c=t,l=n,null;const o=e-i,u=t-c,s=Math.sqrt(o*o+u*u);return i=e,c=t,l=n,s/r}(e.clientX,e.clientY),n=.1;if(null!==t&&t<n)return p()}$e([g,h],function(e){let[n,r]=e;switch(k){case"top":return[[O?n+t/2:C?n+4*t:n-4*t,r+t+1],[O?n-t/2:C?n+4*t:n-4*t,r+t+1],...[[I.left,C||O?I.bottom-t:I.top],[I.right,C?O?I.bottom-t:I.top:I.bottom-t]]];case"bottom":return[[O?n+t/2:C?n+4*t:n-4*t,r-t],[O?n-t/2:C?n+4*t:n-4*t,r-t],...[[I.left,C||O?I.top+t:I.bottom],[I.right,C?O?I.top+t:I.bottom:I.top+t]]];case"left":{const e=[n+t+1,A?r+t/2:M?r+4*t:r-4*t],o=[n+t+1,A?r-t/2:M?r+4*t:r-4*t];return[...[[M||A?I.right-t:I.left,I.top],[M?A?I.right-t:I.left:I.right-t,I.bottom]],e,o]}case"right":return[[n-t,A?r+t/2:M?r+4*t:r-4*t],[n-t,A?r-t/2:M?r+4*t:r-4*t],...[[M||A?I.left+t:I.right,I.top],[M?A?I.left+t:I.right:I.left+t,I.bottom]]]}}([n,s]))?!u&&r&&(o=window.setTimeout(p,40)):p()}}};return s.__options={blockPointerEvents:n},s}function tt(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:r,nodeId:i}=e,[c,l]=u.useState(null),s=(null==(t=e.elements)?void 0:t.reference)||c,a=o(e),f=I(),d=ke(r),m=u.useRef(null),p=u.useRef({}),g=u.useState((()=>w()))[0],h=b(),y=u.useCallback((e=>{const t=P(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;a.refs.setReference(t)}),[a.refs]),E=u.useCallback((e=>{(P(e)||null===e)&&(m.current=e,l(e)),(P(a.refs.reference.current)||null===a.refs.reference.current||null!==e&&!P(e))&&a.refs.setReference(e)}),[a.refs]),R=u.useMemo((()=>({...a.refs,setReference:E,setPositionReference:y,domReference:m})),[a.refs,E,y]),x=u.useMemo((()=>({...a.elements,domReference:s})),[a.elements,s]),k=u.useMemo((()=>({...a,refs:R,elements:x,dataRef:p,nodeId:i,floatingId:h,events:g,open:n,onOpenChange:d})),[a,i,h,g,n,d,R,x]);return v((()=>{const e=null==f?void 0:f.nodesRef.current.find((e=>e.id===i));e&&(e.context=k)})),u.useMemo((()=>({...a,context:k,refs:R,elements:x})),[a,R,x,k])}function nt(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];return null==(e=r.get(n))?void 0:e.map((e=>e(...o))).find((e=>void 0!==e))})):e[n]=o})),e):e),{})}}function rt(e){void 0===e&&(e=[]);const t=e,n=u.useCallback((t=>nt(t,e,"reference")),t),r=u.useCallback((t=>nt(t,e,"floating")),t),o=u.useCallback((t=>nt(t,e,"item")),e.map((e=>null==e?void 0:e.item)));return u.useMemo((()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:o})),[n,r,o])}export{y as FloatingArrow,U as FloatingDelayGroup,ve as FloatingFocusManager,he as FloatingList,C as FloatingNode,we as FloatingOverlay,fe as FloatingPortal,M as FloatingTree,Qe as inner,et as safePolygon,xe as useClick,Me as useClientPoint,V as useDelayGroup,W as useDelayGroupContext,Le as useDismiss,tt as useFloating,k as useFloatingNodeId,x as useFloatingParentNodeId,ae as useFloatingPortalNode,I as useFloatingTree,Pe as useFocus,q as useHover,b as useId,Je as useInnerOffset,rt as useInteractions,be as useListItem,je as useListNavigation,We as useMergeRefs,Ue as useRole,Ye as useTransitionStatus,ze as useTransitionStyles,Ze as useTypeahead}; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@floating-ui/react-dom"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","@floating-ui/react-dom","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIReactDOM={},e.FloatingUIReactDOM,e.React,e.ReactDOM)}(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(n);function i(){return i=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},i.apply(this,arguments)}var c="undefined"!=typeof document?n.useLayoutEffect:n.useEffect;let l=!1,s=0;const a=()=>"floating-ui-"+s++;const f=u["useId".toString()]||function(){const[e,t]=u.useState((()=>l?a():void 0));return c((()=>{null==e&&t(a())}),[]),u.useEffect((()=>{l||(l=!0)}),[]),e},d=u.forwardRef((function(e,n){let{context:{placement:r,elements:{floating:o},middlewareData:{arrow:c}},width:l=14,height:s=7,tipRadius:a=0,strokeWidth:d=0,staticOffset:m,stroke:p,d:v,style:{transform:g,...h}={},...y}=e;d*=2;const b=d/2,w=l/2*(a/-8+1),E=s/2*a/4,[R,x]=r.split("-"),I=!!o&&t.platform.isRTL(o),O=!!v,k="top"===R||"bottom"===R,C=m&&"end"===x?"bottom":"top";let M=m&&"end"===x?"right":"left";m&&I&&(M="end"===x?"left":"right");const P=O?0:b,T=null!=(null==c?void 0:c.x)?m||c.x:"",S=null!=(null==c?void 0:c.y)?m||c.y+P:"",A=v||"M0,0 H"+l+" L"+(l-w)+","+(s-E)+" Q"+l/2+","+s+" "+w+","+(s-E)+" Z",L={top:O?"rotate(180deg)":"",left:O?"rotate(90deg)":"rotate(-90deg)",bottom:O?"":"rotate(180deg)",right:O?"rotate(-90deg)":"rotate(90deg)"}[R],D=f();return u.createElement("svg",i({},y,{suppressHydrationWarning:!0,"aria-hidden":!0,ref:n,width:O?l:l+d,height:l,viewBox:"0 0 "+l+" "+(s>l?s:l),style:{position:"absolute",pointerEvents:"none",[M]:T,[C]:S,[R]:k||O?"100%":"calc(100% - "+d/2+"px)",transform:""+L+(null!=g?g:""),...h}}),d>0&&u.createElement("path",{clipPath:"url(#"+D+")",fill:"none",stroke:p,strokeWidth:d+(v?0:1),d:A}),u.createElement("path",{stroke:d&&!v?y.fill:"none",d:A}),u.createElement("clipPath",{id:D},u.createElement("rect",{x:-b,y:b*(O?-1:1),width:l+d,height:l})))}));function m(){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){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}const p=u.createContext(null),v=u.createContext(null),g=()=>{var e;return(null==(e=u.useContext(p))?void 0:e.id)||null},h=()=>u.useContext(v);function y(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 w(){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 E(e){return y(e).defaultView||window}function R(e){return!!e&&e instanceof E(e).Element}function x(e){return!!e&&e instanceof E(e).HTMLElement}function I(e){if(0===e.mozInputSource&&e.isTrusted)return!0;const t=/Android/i;return(t.test(b())||t.test(w()))&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType}function O(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 k(){return/apple/i.test(navigator.vendor)}function C(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function M(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 E(r).ShadowRoot||r instanceof ShadowRoot))){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}var r;return!1}function P(e){const t=n.useRef(e);return c((()=>{t.current=e})),t}const T="data-floating-ui-safe-polygon";function S(e,t,n){return n&&!C(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}const A=u.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{},isInstantPhase:!1}),L=()=>u.useContext(A);var D=new WeakMap,N=new WeakMap,F={},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];F[n]||(F[n]=new WeakMap);var o=F[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=(D.get(e)||0)+1,s=(o.get(e)||0)+1;D.set(e,c),o.set(e,s),u.push(e),1===c&&r&&N.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=D.get(e)-1,r=o.get(e)-1;D.set(e,t),o.set(e,r),t||(N.has(e)||e.removeAttribute("aria-hidden"),N.delete(e)),r||e.removeAttribute(n)})),--j||(D=new WeakMap,D=new WeakMap,N=new WeakMap,F={})}},_=["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,q=!B&&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{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},z=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},V=function(e){return"INPUT"===e.tagName},X=function(e){return function(e){return V(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||q(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=q(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=q(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=q(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 V(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))},Q=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=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(z).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?W([e],t.includeContainer,{filter:$.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Q}):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)),J(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}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 x(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=ee(e,le());"prev"===t&&n.reverse();const r=n.indexOf(te(y(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||!M(n,r)}function me(e){ee(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={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};function ge(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const he=u.forwardRef((function(e,t){const[n,r]=u.useState();return c((()=>(k()&&r("button"),document.addEventListener("keydown",ge),()=>{document.removeEventListener("keydown",ge)})),[]),u.createElement("span",i({},e,{ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,"data-floating-ui-focus-guard":"",style:ve}))})),ye=u.createContext(null);function be(e){let{id:t,root:n}=void 0===e?{}:e;const[r,o]=u.useState(null),i=f(),l=we(),s=u.useMemo((()=>({id:t,root:n,portalContext:l,uniqueId:i})),[t,n,l,i]),a=u.useRef();return c((()=>()=>{null==r||r.remove()}),[r,s]),c((()=>{if(a.current===s)return;a.current=s;const{id:e,root:t,portalContext:n,uniqueId:r}=s,u=e?document.getElementById(e):null,i="data-floating-ui-portal";if(u){const e=document.createElement("div");e.id=r,e.setAttribute(i,""),u.appendChild(e),o(e)}else{let u=(null==n?void 0:n.portalNode)||t||document.body,c=null;e&&(c=document.createElement("div"),c.id=e,u.appendChild(c));const l=document.createElement("div");l.id=r,l.setAttribute(i,""),u=c||u,u.appendChild(l),o(l)}}),[s]),r}const we=()=>u.useContext(ye),Ee=u.forwardRef((function(e,t){return u.createElement("button",i({},e,{type:"button",ref:t,tabIndex:-1,style:ve}))}));function Re(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const xe=u.createContext({register:()=>{},unregister:()=>{},map:new Map,elementsRef:{current:[]}});const Ie="data-floating-ui-scroll-lock",Oe=u.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return c((()=>{var e,t;if(!n)return;if(document.body.hasAttribute(Ie))return;document.body.setAttribute(Ie,"");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(Ie),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(Ie),window.scrollTo(c,l)}}),[n]),u.createElement("div",i({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function ke(e){return x(e.target)&&"BUTTON"===e.target.tagName}function Ce(e){return ie(e)}const Me=u["useInsertionEffect".toString()]||(e=>e());function Pe(e){const t=u.useRef((()=>{}));return Me((()=>{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)}),[])}function Te(e){return null!=e&&null!=e.clientX}function Se(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 De=!1;const Ne="ArrowUp",Fe="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 qe(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function We(e,t){return qe(t,e===Ne||e===Fe,e===je||e===Ke)}function Ue(e,t,n){return qe(t,e===Fe,n?e===je:e===Ke)||"Enter"===e||" "==e||""===e}function ze(e,t){return He(e,{disabledIndices:t})}function Ve(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){return"function"==typeof e?e(t):e}function Ge(e,t){void 0===t&&(t={});const{open:n,elements:{floating:r}}=e,{duration:o=250}=t,i=("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,i);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 Ze(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}function $e(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];return null==(e=r.get(n))?void 0:e.map((e=>e(...o))).find((e=>void 0!==e))})):e[n]=o})),e):e),{})}}Object.defineProperty(e,"arrow",{enumerable:!0,get:function(){return t.arrow}}),Object.defineProperty(e,"autoPlacement",{enumerable:!0,get:function(){return t.autoPlacement}}),Object.defineProperty(e,"autoUpdate",{enumerable:!0,get:function(){return t.autoUpdate}}),Object.defineProperty(e,"computePosition",{enumerable:!0,get:function(){return t.computePosition}}),Object.defineProperty(e,"detectOverflow",{enumerable:!0,get:function(){return t.detectOverflow}}),Object.defineProperty(e,"flip",{enumerable:!0,get:function(){return t.flip}}),Object.defineProperty(e,"getOverflowAncestors",{enumerable:!0,get:function(){return t.getOverflowAncestors}}),Object.defineProperty(e,"hide",{enumerable:!0,get:function(){return t.hide}}),Object.defineProperty(e,"inline",{enumerable:!0,get:function(){return t.inline}}),Object.defineProperty(e,"limitShift",{enumerable:!0,get:function(){return t.limitShift}}),Object.defineProperty(e,"offset",{enumerable:!0,get:function(){return t.offset}}),Object.defineProperty(e,"platform",{enumerable:!0,get:function(){return t.platform}}),Object.defineProperty(e,"shift",{enumerable:!0,get:function(){return t.shift}}),Object.defineProperty(e,"size",{enumerable:!0,get:function(){return t.size}}),e.FloatingArrow=d,e.FloatingDelayGroup=e=>{let{children:t,delay:n,timeoutMs:r=0}=e;const[o,i]=u.useReducer(((e,t)=>({...e,...t})),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),l=u.useRef(null),s=u.useCallback((e=>{i({currentId:e})}),[]);return c((()=>{o.currentId?null===l.current?l.current=o.currentId:i({isInstantPhase:!0}):(i({isInstantPhase:!1}),l.current=null)}),[o.currentId]),u.createElement(A.Provider,{value:u.useMemo((()=>({...o,setState:i,setCurrentId:s})),[o,i,s])},t)},e.FloatingFocusManager=function(e){const{context:t,children:n,order:r=["content"],guards:o=!0,initialFocus:i=0,returnFocus:l=!0,modal:s=!0,visuallyHiddenDismiss:a=!1,closeOnFocusOut:f=!0}=e,{open:d,refs:m,nodeId:p,onOpenChange:v,events:g,dataRef:b,elements:{domReference:w,floating:E}}=t,R=P(r),I=P(i),O=P(l),k=h(),C=we(),T="number"==typeof i&&i<0,S=u.useRef(null),A=u.useRef(null),L=u.useRef(!1),D=u.useRef(null),N=u.useRef(!1),F=null!=C,j=w&&"combobox"===w.getAttribute("role")&&ie(w),_=u.useCallback((function(e){return void 0===e&&(e=E),e?ee(e,le()):[]}),[E]),B=u.useCallback((e=>{const t=_(e);return R.current.map((e=>w&&"reference"===e?w:E&&"floating"===e?E:t)).filter(Boolean).flat()}),[w,E,R,_]);function H(e){return a&&s?u.createElement(Ee,{ref:"start"===e?S:A,onClick:()=>v(!1)},"string"==typeof a?a:"Dismiss"):null}u.useEffect((()=>{if(!s)return;function e(e){if("Tab"===e.key){M(E,te(y(E)))&&0===_().length&&!j&&ce(e);const t=B(),n=ue(e);"reference"===R.current[0]&&n===w&&(ce(e),e.shiftKey?re(t[t.length-1]):re(t[1])),"floating"===R.current[1]&&n===E&&e.shiftKey&&(ce(e),re(t[0]))}}const t=y(E);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[w,E,s,R,m,j,_,B]),u.useEffect((()=>{if(f)return E&&x(w)?(w.addEventListener("focusout",t),w.addEventListener("pointerdown",e),!s&&E.addEventListener("focusout",t),()=>{w.removeEventListener("focusout",t),w.removeEventListener("pointerdown",e),!s&&E.removeEventListener("focusout",t)}):void 0;function e(){N.current=!0,setTimeout((()=>{N.current=!1}))}function t(e){const t=e.relatedTarget;queueMicrotask((()=>{const e=!(M(w,t)||M(E,t)||M(t,E)||M(null==C?void 0:C.portalNode,t)||null!=t&&t.hasAttribute("data-floating-ui-focus-guard")||k&&(oe(k.nodesRef.current,p).find((e=>{var n,r;return M(null==(n=e.context)?void 0:n.elements.floating,t)||M(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}(k.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&&e&&!N.current&&t!==D.current&&(L.current=!0,v(!1))}))}}),[w,E,s,p,k,C,v,f]),u.useEffect((()=>{var e;const t=Array.from((null==C||null==(e=C.portalNode)?void 0:e.querySelectorAll("[data-floating-ui-portal]"))||[]);if(E&&s){const e=[E,...t,...[S.current,A.current].filter(Boolean)],n=K(R.current.includes("reference")||j?e.concat(w||[]):e);return()=>{n()}}}),[w,E,s,R,C,j]),u.useEffect((()=>{if(s&&!o&&E){const e=[],t=le(),n=ee(y(E).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)}))}}}),[E,s,o,B]),c((()=>{if(!E)return;const e=te(y(E));queueMicrotask((()=>{const t=B(E),n=I.current,r=("number"==typeof n?t[n]:n.current)||E,o=M(E,e);T||o||!d||re(r,{preventScroll:r===E})}))}),[d,E,T,B,I]),c((()=>{if(!E)return;let e=!1;const t=y(E),n=te(t),r=b.current;function o(t){if("escapeKey"===t.type&&m.domReference.current&&(D.current=m.domReference.current),["referencePress","escapeKey"].includes(t.type))return;const n=t.data.returnFocus;"object"==typeof n?(L.current=!1,e=n.preventScroll):L.current=!n}return D.current=n,g.on("dismiss",o),()=>{g.off("dismiss",o);const n=te(t);(M(E,n)||k&&oe(k.nodesRef.current,p).some((e=>{var t;return M(null==(t=e.context)?void 0:t.elements.floating,n)}))||r.openEvent&&["click","mousedown"].includes(r.openEvent.type))&&m.domReference.current&&(D.current=m.domReference.current),O.current&&x(D.current)&&!L.current&&re(D.current,{cancelPrevious:!1,preventScroll:e})}}),[E,O,b,m,g,k,p]),c((()=>{if(C)return C.setFocusManagerState({...t,modal:s,closeOnFocusOut:f,open:d}),()=>{C.setFocusManagerState(null)}}),[C,s,d,f,t]),c((()=>{if(E&&"function"==typeof MutationObserver){const e=()=>{const e=E.getAttribute("tabindex");R.current.includes("floating")||te(y(E))!==m.domReference.current&&0===_().length?"0"!==e&&E.setAttribute("tabindex","0"):"-1"!==e&&E.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(E,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}}}),[E,m,R,_]);const q=o&&!j&&(F||s);return u.createElement(u.Fragment,null,q&&u.createElement(he,{"data-type":"inside",ref:null==C?void 0:C.beforeInsideRef,onFocus:e=>{if(s){const e=B();re("reference"===r[0]?e[0]:e[e.length-1])}else if(null!=C&&C.preserveTabOrder&&C.portalNode)if(L.current=!1,de(e,C.portalNode)){const e=ae()||w;null==e||e.focus()}else{var t;null==(t=C.beforeOutsideRef.current)||t.focus()}}}),!j&&H("start"),n,H("end"),q&&u.createElement(he,{"data-type":"inside",ref:null==C?void 0:C.afterInsideRef,onFocus:e=>{if(s)re(B()[0]);else if(null!=C&&C.preserveTabOrder&&C.portalNode)if(f&&(L.current=!0),de(e,C.portalNode)){const e=fe()||w;null==e||e.focus()}else{var t;null==(t=C.afterOutsideRef.current)||t.focus()}}}))},e.FloatingList=function(e){let{children:t,elementsRef:n,labelsRef:r}=e;const[o,i]=u.useState((()=>new Map)),l=u.useCallback((e=>{i((t=>new Map(t).set(e,null)))}),[]),s=u.useCallback((e=>{i((t=>{const n=new Map(t);return n.delete(e),n}))}),[]);return c((()=>{const e=new Map(o);Array.from(e.keys()).sort(Re).forEach(((t,n)=>{e.set(t,n)})),function(e,t){if(e.size!==t.size)return!1;for(const[n,r]of e.entries())if(r!==t.get(n))return!1;return!0}(o,e)||i(e)}),[o]),u.createElement(xe.Provider,{value:{register:l,unregister:s,map:o,elementsRef:n,labelsRef:r}},t)},e.FloatingNode=function(e){let{children:t,id:n}=e;const r=g();return u.createElement(p.Provider,{value:u.useMemo((()=>({id:n,parentId:r})),[n,r])},t)},e.FloatingOverlay=Oe,e.FloatingPortal=function(e){let{children:t,id:n,root:o=null,preserveTabOrder:i=!0}=e;const c=be({id:n,root: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&&l.open&&i&&!(!o&&!c);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(ye.Provider,{value:u.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:a,afterOutsideRef:f,beforeInsideRef:d,afterInsideRef:m,portalNode:c,setFocusManagerState:s})),[i,c])},p&&c&&u.createElement(he,{"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:ve}),c&&r.createPortal(t,c),p&&c&&u.createElement(he,{"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=function(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((()=>m()))[0];return u.createElement(v.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(n){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}}=n,v=o.current[l];if(!v)return{};const g={...n,...await t.offset(-v.offsetTop-m.reference.height/2-v.offsetHeight/2-c).fn(n)},h=(null==f?void 0:f.current)||p,y=await t.detectOverflow(Ze(g,h.scrollHeight),d),b=await t.detectOverflow(g,{...d,elementContext:"reference"}),w=Math.max(0,y.top),E=g.y+w,R=Math.max(0,h.scrollHeight-w-Math.max(0,y.bottom));return h.style.maxHeight=R+"px",h.scrollTop=w,i&&(h.offsetHeight<v.offsetHeight*Math.min(s,o.current.length-1)-1||b.top>=-a||b.bottom>=-a?r.flushSync((()=>i(!0))):r.flushSync((()=>i(!1)))),u&&(u.current=await t.detectOverflow(Ze({...g,y:E},h.offsetHeight),d)),{y:E}}}),e.safePolygon=function(e){void 0===e&&(e={});const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e;let o,u=!1,i=!1,c=null,l=null,s=performance.now();const a=e=>{let{x:n,y:a,placement:f,elements:d,onClose:m,nodeId:p,tree:v}=e;return function(e){function g(){clearTimeout(o),m()}if(clearTimeout(o),!d.domReference||!d.floating||null==f||null==n||null==a)return;const{clientX:h,clientY:y}=e,b=[h,y],w=ue(e),E="mouseleave"===e.type,x=M(d.floating,w),I=M(d.domReference,w),O=d.domReference.getBoundingClientRect(),k=d.floating.getBoundingClientRect(),C=f.split("-")[0],P=n>k.right-k.width/2,T=a>k.bottom-k.height/2,S=function(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}(b,O);if(x&&(i=!0,!E))return;if(I&&(i=!1),I&&!E)return void(i=!0);if(E&&R(e.relatedTarget)&&M(d.floating,e.relatedTarget))return;if(v&&oe(v.nodesRef.current,p).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if("top"===C&&a>=O.bottom-1||"bottom"===C&&a<=O.top+1||"left"===C&&n>=O.right-1||"right"===C&&n<=O.left+1)return g();let A=[];switch(C){case"top":A=[[k.left,O.top+1],[k.left,k.bottom-1],[k.right,k.bottom-1],[k.right,O.top+1]],u=h>=k.left&&h<=k.right&&y>=k.top&&y<=O.top+1;break;case"bottom":A=[[k.left,k.top+1],[k.left,O.bottom-1],[k.right,O.bottom-1],[k.right,k.top+1]],u=h>=k.left&&h<=k.right&&y>=O.bottom-1&&y<=k.bottom;break;case"left":A=[[k.right-1,k.bottom],[k.right-1,k.top],[O.left+1,k.top],[O.left+1,k.bottom]],u=h>=k.left&&h<=O.left+1&&y>=k.top&&y<=k.bottom;break;case"right":A=[[O.right-1,k.bottom],[O.right-1,k.top],[k.left+1,k.top],[k.left+1,k.bottom]],u=h>=O.right-1&&h<=k.right&&y>=k.top&&y<=k.bottom}const L=u?A:function(e){let[n,r]=e;const o=k.width>O.width,u=k.height>O.height;switch(C){case"top":return[[o?n+t/2:P?n+4*t:n-4*t,r+t+1],[o?n-t/2:P?n+4*t:n-4*t,r+t+1],...[[k.left,P||o?k.bottom-t:k.top],[k.right,P?o?k.bottom-t:k.top:k.bottom-t]]];case"bottom":return[[o?n+t/2:P?n+4*t:n-4*t,r-t],[o?n-t/2:P?n+4*t:n-4*t,r-t],...[[k.left,P||o?k.top+t:k.bottom],[k.right,P?o?k.top+t:k.bottom:k.top+t]]];case"left":{const e=[n+t+1,u?r+t/2:T?r+4*t:r-4*t],o=[n+t+1,u?r-t/2:T?r+4*t:r-4*t];return[...[[T||u?k.right-t:k.left,k.top],[T?u?k.right-t:k.left:k.right-t,k.bottom]],e,o]}case"right":return[[n-t,u?r+t/2:T?r+4*t:r-4*t],[n-t,u?r-t/2:T?r+4*t:r-4*t],...[[T||u?k.left+t:k.right,k.top],[T?u?k.left+t:k.right:k.left+t,k.bottom]]]}}([n,a]);if(!u){if(i&&!S)return g();if(!E&&r){const t=function(e,t){const n=performance.now(),r=n-s;if(null===c||null===l||0===r)return c=e,l=t,s=n,null;const o=e-c,u=t-l,i=Math.sqrt(o*o+u*u);return c=e,l=t,s=n,i/r}(e.clientX,e.clientY),n=.1;if(null!==t&&t<n)return g()}!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}([h,y],L)?g():!i&&r&&(o=window.setTimeout(g,40))}}};return a.__options={blockPointerEvents:n},a},e.useClick=function(e,t){void 0===t&&(t={});const{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}=t,d=u.useRef(),m=u.useRef(!1);return u.useMemo((()=>c?{reference:{onPointerDown(e){d.current=e.pointerType},onMouseDown(e){0===e.button&&(C(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){"mousedown"===l&&d.current?d.current=void 0:C(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,e.defaultPrevented||!f||ke(e)||(" "!==e.key||Ce(i)||(e.preventDefault(),m.current=!0),"Enter"===e.key&&(n?s&&r(!1):r(!0)))},onKeyUp(e){e.defaultPrevented||!f||ke(e)||Ce(i)||" "===e.key&&m.current&&(m.current=!1,n?s&&r(!1):r(!0))}}}:{}),[c,o,l,a,f,i,s,n,r])},e.useClientPoint=function(e,t){void 0===t&&(t={});const{open:n,refs:r,dataRef:o,elements:{floating:i}}=e,{enabled:l=!0,axis:s="both",x:a=null,y:f=null}=t,d=u.useRef(!1),m=u.useRef(null),[p,v]=u.useState(),[g,h]=u.useState([]),y=Pe(((e,t)=>{d.current||o.current.openEvent&&!Te(o.current.openEvent)||r.setPositionReference(function(e,t){let n=null,r=null,o=!1;return{contextElement:e.current||void 0,getBoundingClientRect(){var u,i;const c=(null==(u=e.current)?void 0:u.getBoundingClientRect())||{width:0,height:0,x:0,y:0},l="x"===t.axis||"both"===t.axis,s="y"===t.axis||"both"===t.axis,a=["mouseenter","mousemove"].includes((null==(i=t.dataRef.current.openEvent)?void 0:i.type)||"")&&"touch"!==t.pointerType;let f=c.width,d=c.height,m=c.x,p=c.y;return null==n&&t.x&&l&&(n=c.x-t.x),null==r&&t.y&&s&&(r=c.y-t.y),m-=n||0,p-=r||0,f=0,d=0,!o||a?(f="y"===t.axis?c.width:0,d="x"===t.axis?c.height:0,m=l&&null!=t.x?t.x:m,p=s&&null!=t.y?t.y:p):o&&!a&&(d="x"===t.axis?c.height:d,f="y"===t.axis?c.width:f),o=!0,{width:f,height:d,x:m,y:p,top:p,right:m+f,bottom:p+d,left:m}}}}(r.domReference,{x:e,y:t,axis:s,dataRef:o,pointerType:p}))})),b=Pe((e=>{null==a&&null==f&&(n?m.current||h([]):y(e.clientX,e.clientY))})),w=C(p)?i:n,R=u.useCallback((()=>{if(!w||!l||null!=a||null!=f)return;const e=E(r.floating.current);function t(n){const o=ue(n);M(r.floating.current,o)?(e.removeEventListener("mousemove",t),m.current=null):y(n.clientX,n.clientY)}if(!o.current.openEvent||Te(o.current.openEvent)){e.addEventListener("mousemove",t);const n=()=>{e.removeEventListener("mousemove",t),m.current=null};return m.current=n,n}r.setPositionReference(r.domReference.current)}),[o,l,w,r,y,a,f]);return u.useEffect((()=>R()),[R,g]),u.useEffect((()=>{l&&!i&&(d.current=!1)}),[l,i]),u.useEffect((()=>{!l&&n&&(d.current=!0)}),[l,n]),c((()=>{!l||null==a&&null==f||(d.current=!1,y(a,f))}),[l,a,f,y]),u.useMemo((()=>{if(!l)return{};function e(e){let{pointerType:t}=e;v(t)}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove:b,onMouseEnter:b}}}),[l,b])},e.useDelayGroup=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:o}=t;const{currentId:u,setCurrentId:i,initialDelay:l,setState:s,timeoutMs:a}=L();c((()=>{u&&(s({delay:{open:1,close:S(l,"close")}}),u!==o&&r(!1))}),[o,r,s,u,l]),c((()=>{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]),c((()=>{n&&i(o)}),[n,i,o])},e.useDelayGroupContext=L,e.useDismiss=function(e,n){void 0===n&&(n={});const{open:r,onOpenChange:o,events:i,nodeId:c,elements:{reference:l,domReference:s,floating:a},dataRef:f}=e,{enabled:d=!0,escapeKey:m=!0,outsidePress:p=!0,outsidePressEvent:v="pointerdown",referencePress:b=!1,referencePressEvent:w="pointerdown",ancestorScroll:k=!1,bubbles:C}=n,M=h(),P=null!=g(),T=Pe("function"==typeof p?p:()=>!1),S="function"==typeof p?T:p,A=u.useRef(!1),{escapeKeyBubbles:L,outsidePressBubbles:D}=(e=>{var t,n;return{escapeKeyBubbles:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePressBubbles:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}})(C),N=Pe((e=>{if(!r||!d||!m||"Escape"!==e.key)return;const t=M?oe(M.nodesRef.current,c):[];if(!L&&(e.stopPropagation(),t.length>0)){let e=!0;if(t.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)})),!e)return}i.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),o(!1)})),F=Pe((e=>{const t=A.current;if(A.current=!1,t)return;if("function"==typeof S&&!S(e))return;const n=ue(e);if(x(n)&&a){const t=n.clientWidth>0&&n.scrollWidth>n.clientWidth,r=n.clientHeight>0&&n.scrollHeight>n.clientHeight;let o=r&&e.offsetX>n.clientWidth;if(r){"rtl"===E(a).getComputedStyle(n).direction&&(o=e.offsetX<=n.offsetWidth-n.clientWidth)}if(o||t&&e.offsetY>n.clientHeight)return}const r=M&&oe(M.nodesRef.current,c).some((t=>{var n;return Se(e,null==(n=t.context)?void 0:n.elements.floating)}));if(Se(e,a)||Se(e,s)||r)return;const u=M?oe(M.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:P?{preventScroll:!0}:I(e)||O(e)}}),o(!1)}));return u.useEffect((()=>{if(!r||!d)return;function e(){o(!1)}f.current.__escapeKeyBubbles=L,f.current.__outsidePressBubbles=D;const n=y(a);m&&n.addEventListener("keydown",N),S&&n.addEventListener(v,F);let u=[];return k&&(R(s)&&(u=t.getOverflowAncestors(s)),R(a)&&(u=u.concat(t.getOverflowAncestors(a))),!R(l)&&l&&l.contextElement&&(u=u.concat(t.getOverflowAncestors(l.contextElement)))),u=u.filter((e=>{var t;return e!==(null==(t=n.defaultView)?void 0:t.visualViewport)})),u.forEach((t=>{t.addEventListener("scroll",e,{passive:!0})})),()=>{m&&n.removeEventListener("keydown",N),S&&n.removeEventListener(v,F),u.forEach((t=>{t.removeEventListener("scroll",e)}))}}),[f,a,s,l,m,S,v,r,o,k,d,L,D,N,F]),u.useEffect((()=>{A.current=!1}),[S,v]),u.useMemo((()=>d?{reference:{onKeyDown:N,[Ae[w]]:()=>{b&&(i.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),o(!1))}},floating:{onKeyDown:N,[Le[v]]:()=>{A.current=!0}}}:{}),[d,i,b,v,w,o,N])},e.useFloating=function(e){var n;void 0===e&&(e={});const{open:r=!1,onOpenChange:o,nodeId:i}=e,[l,s]=u.useState(null),a=(null==(n=e.elements)?void 0:n.reference)||l,d=t.useFloating(e),p=h(),v=Pe(o),g=u.useRef(null),y=u.useRef({}),b=u.useState((()=>m()))[0],w=f(),E=u.useCallback((e=>{const t=R(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;d.refs.setReference(t)}),[d.refs]),x=u.useCallback((e=>{(R(e)||null===e)&&(g.current=e,s(e)),(R(d.refs.reference.current)||null===d.refs.reference.current||null!==e&&!R(e))&&d.refs.setReference(e)}),[d.refs]),I=u.useMemo((()=>({...d.refs,setReference:x,setPositionReference:E,domReference:g})),[d.refs,x,E]),O=u.useMemo((()=>({...d.elements,domReference:a})),[d.elements,a]),k=u.useMemo((()=>({...d,refs:I,elements:O,dataRef:y,nodeId:i,floatingId:w,events:b,open:r,onOpenChange:v})),[d,i,w,b,r,v,I,O]);return c((()=>{const e=null==p?void 0:p.nodesRef.current.find((e=>e.id===i));e&&(e.context=k)})),u.useMemo((()=>({...d,context:k,refs:I,elements:O})),[d,I,O,k])},e.useFloatingNodeId=function(e){const t=f(),n=h(),r=g(),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=g,e.useFloatingPortalNode=be,e.useFloatingTree=h,e.useFocus=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,refs:c,elements:{floating:l,domReference:s}}=e,{enabled:a=!0,keyboardOnly:f=!0}=t,d=u.useRef(""),m=u.useRef(!1),p=u.useRef();return u.useEffect((()=>{if(!a)return;const e=y(l).defaultView||window;function t(){!n&&x(s)&&s===te(y(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&&Se(o.current.openEvent,s)||(o.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){m.current=!1;const t=e.relatedTarget,n=R(t)&&t.hasAttribute("data-floating-ui-focus-guard")&&"outside"===t.getAttribute("data-type");p.current=setTimeout((()=>{M(c.floating.current,t)||M(s,t)||n||r(!1)}))}}}:{}),[a,f,s,c,o,r])},e.useHover=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:{domReference:l,floating:s},refs:a}=e,{enabled:f=!0,delay:d=0,handleClose:m=null,mouseOnly:p=!1,restMs:v=0,move:b=!0}=t,w=h(),E=g(),x=P(m),I=P(d),O=u.useRef(),k=u.useRef(),A=u.useRef(),L=u.useRef(),D=u.useRef(!0),N=u.useRef(!1),F=u.useRef((()=>{})),j=u.useCallback((()=>{var e;const t=null==(e=o.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[o]);u.useEffect((()=>{if(f)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(){clearTimeout(k.current),clearTimeout(L.current),D.current=!0}}),[f,i]),u.useEffect((()=>{if(!f||!x.current||!n)return;function e(){j()&&r(!1)}const t=y(s).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[s,n,r,f,x,o,j]);const K=u.useCallback((function(e){void 0===e&&(e=!0);const t=S(I.current,"close",O.current);t&&!A.current?(clearTimeout(k.current),k.current=setTimeout((()=>r(!1)),t)):e&&(clearTimeout(k.current),r(!1))}),[I,r]),_=u.useCallback((()=>{F.current(),A.current=void 0}),[]),B=u.useCallback((()=>{if(N.current){const e=y(a.floating.current).body;e.style.pointerEvents="",e.removeAttribute(T),N.current=!1}}),[a]);return u.useEffect((()=>{if(f&&R(l)){const e=l;return n&&e.addEventListener("mouseleave",c),null==s||s.addEventListener("mouseleave",c),b&&e.addEventListener("mousemove",u,{once:!0}),e.addEventListener("mouseenter",u),e.addEventListener("mouseleave",i),()=>{n&&e.removeEventListener("mouseleave",c),null==s||s.removeEventListener("mouseleave",c),b&&e.removeEventListener("mousemove",u),e.removeEventListener("mouseenter",u),e.removeEventListener("mouseleave",i)}}function t(){return!!o.current.openEvent&&["click","mousedown"].includes(o.current.openEvent.type)}function u(e){if(clearTimeout(k.current),D.current=!1,p&&!C(O.current)||v>0&&0===S(I.current,"open"))return;o.current.openEvent=e;const t=S(I.current,"open",O.current);t?k.current=setTimeout((()=>{r(!0)}),t):r(!0)}function i(r){if(t())return;F.current();const o=y(s);if(clearTimeout(L.current),x.current){n||clearTimeout(k.current),A.current=x.current({...e,tree:w,x:r.clientX,y:r.clientY,onClose(){B(),_(),K()}});const t=A.current;return o.addEventListener("mousemove",t),void(F.current=()=>{o.removeEventListener("mousemove",t)})}("touch"!==O.current||!M(s,r.relatedTarget))&&K()}function c(n){t()||null==x.current||x.current({...e,tree:w,x:n.clientX,y:n.clientY,onClose(){B(),_(),K()}})(n)}}),[l,s,f,e,p,v,b,K,_,B,r,n,w,I,x,o]),c((()=>{var e;if(f&&n&&null!=(e=x.current)&&e.__options.blockPointerEvents&&j()){const e=y(s).body;if(e.setAttribute(T,""),e.style.pointerEvents="none",N.current=!0,R(l)&&s){var t,r;const e=l,n=null==w||null==(t=w.nodesRef.current.find((e=>e.id===E)))||null==(r=t.context)?void 0:r.elements.floating;return n&&(n.style.pointerEvents=""),e.style.pointerEvents="auto",s.style.pointerEvents="auto",()=>{e.style.pointerEvents="",s.style.pointerEvents=""}}}}),[f,n,E,s,l,w,x,o,j]),c((()=>{n||(O.current=void 0,_(),B())}),[n,_,B]),u.useEffect((()=>()=>{_(),clearTimeout(k.current),clearTimeout(L.current),B()}),[f,_,B]),u.useMemo((()=>{if(!f)return{};function e(e){O.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){n||0===v||(clearTimeout(L.current),L.current=setTimeout((()=>{D.current||r(!0)}),v))}},floating:{onMouseEnter(){clearTimeout(k.current)},onMouseLeave(){i.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),K(!1)}}}}),[i,f,v,n,r,K])},e.useId=f,e.useInnerOffset=function(e,t){const{open:n,elements:o}=e,{enabled:i=!0,overflowRef:c,scrollRef:l,onChange:s}=t,a=Pe(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 n=e.deltaY,o=c.current.top>=-.5,u=c.current.bottom>=-.5,i=t.scrollHeight-t.clientHeight,l=n<0?-1:1,s=n<0?"max":"min";t.scrollHeight<=t.clientHeight||(!o&&n>0||!u&&n<0?(e.preventDefault(),r.flushSync((()=>{a((e=>e+Math[s](n,i*l)))}))):/firefox/i.test(w())&&(t.scrollTop+=n))}const t=(null==l?void 0:l.current)||o.floating;return n&&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,n,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)&&r.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=>$e(t,e,"reference")),t),r=u.useCallback((t=>$e(t,e,"floating")),t),o=u.useCallback((t=>$e(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.useListItem=function(e){let{label:t}=void 0===e?{}:e;const[n,r]=u.useState(null),o=u.useRef(null),{register:i,unregister:l,map:s,elementsRef:a,labelsRef:f}=u.useContext(xe),d=u.useCallback((e=>{if(o.current=e,null!==n&&(a.current[n]=e,f)){var r;const o=void 0!==t;f.current[n]=o?t:null!=(r=null==e?void 0:e.textContent)?r:null}}),[n,a,f,t]);return c((()=>{const e=o.current;if(e)return i(e),()=>{l(e)}}),[i,l]),c((()=>{const e=o.current?s.get(o.current):null;null!=e&&r(e)}),[s]),u.useMemo((()=>({ref:d,index:null==n?-1:n})),[n,d])},e.useListNavigation=function(e,t){const{open:n,onOpenChange:r,refs:o,elements:{domReference:i,floating:l}}=e,{listRef:s,activeIndex:a,onNavigate:f=(()=>{}),enabled:d=!0,selectedIndex:m=null,allowEscape:p=!1,loop:v=!1,nested:w=!1,rtl:E=!1,virtual:R=!1,focusItemOnOpen:C="auto",focusItemOnHover:T=!0,openOnArrowKeyDown:S=!0,disabledIndices:A,orientation:L="vertical",cols:D=1,scrollItemIntoView:N=!0}=t,F=g(),j=h(),K=Pe(f),_=u.useRef(C),B=u.useRef(null!=m?m:-1),H=u.useRef(null),q=u.useRef(!0),W=u.useRef(K),U=u.useRef(!!l),z=u.useRef(!1),V=u.useRef(!1),X=P(A),Y=P(n),G=P(N),[Z,$]=u.useState(),Q=Pe((function(e,t,n){void 0===n&&(n=!1);const r=e.current[t.current];r&&(R?$(r.id):re(r,{preventScroll:!0,sync:!(!b().toLowerCase().startsWith("mac")||navigator.maxTouchPoints||!k())&&(De||z.current)}),requestAnimationFrame((()=>{const e=G.current;e&&r&&(n||!q.current)&&(null==r.scrollIntoView||r.scrollIntoView("boolean"==typeof e?{block:"nearest",inline:"nearest"}:e))})))}));c((()=>{document.createElement("div").focus({get preventScroll(){return De=!0,!1}})}),[]),c((()=>{d&&(n&&l?_.current&&null!=m&&(V.current=!0,K(m)):U.current&&(B.current=-1,W.current(null)))}),[d,n,l,m,K]),c((()=>{if(d&&n&&l)if(null==a){if(z.current=!1,null!=m)return;if(U.current&&(B.current=-1,Q(s,B)),!U.current&&_.current&&(null!=H.current||!0===_.current&&null==H.current)){let e=0;const t=()=>{if(null==s.current[0]){if(e<2){(e?requestAnimationFrame:queueMicrotask)(t)}e++}else B.current=null==H.current||Ue(H.current,L,E)||w?ze(s,X.current):Ve(s,X.current),H.current=null,K(B.current)};t()}}else Be(s,a)||(B.current=a,Q(s,B,V.current),V.current=!1)}),[d,n,l,a,m,w,s,L,E,K,Q,X]),c((()=>{if(d&&U.current&&!l&&j){var e,t;const n=j.nodesRef.current,r=null==(e=n.find((e=>e.id===F)))||null==(t=e.context)?void 0:t.elements.floating,o=te(y(l)),u=n.some((e=>e.context&&M(e.context.elements.floating,o)));r&&!u&&r.focus({preventScroll:!0})}}),[d,l,j,F]),c((()=>{W.current=K,U.current=!!l})),c((()=>{n||(H.current=null)}),[n]);const J=null!=a,ee=u.useMemo((()=>{function e(e){if(!n)return;const t=s.current.indexOf(e);-1!==t&&K(t)}return{onFocus(t){let{currentTarget:n}=t;e(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...T&&{onMouseMove(t){let{currentTarget:n}=t;e(n)},onPointerLeave(e){let{pointerType:t}=e;q.current&&"touch"!==t&&(B.current=-1,Q(s,B),K(null),R||re(o.floating.current,{preventScroll:!0}))}}}}),[n,o,Q,T,s,K,R]);return u.useMemo((()=>{if(!d)return{};const e=X.current;function t(t){if(q.current=!1,z.current=!0,!Y.current&&t.currentTarget===o.floating.current)return;if(w&&function(e,t,n){return qe(t,n?e===Ke:e===je,e===Ne)}(t.key,L,E))return ce(t),r(!1),void(x(i)&&i.focus());const u=B.current,c=ze(s,e),l=Ve(s,e);if("Home"===t.key&&(ce(t),B.current=c,K(B.current)),"End"===t.key&&(ce(t),B.current=l,K(B.current)),D>1){const n=B.current;if(t.key===Ne){if(ce(t),-1===n)B.current=l;else if(B.current=He(s,{startingIndex:n,amount:D,decrement:!0,disabledIndices:e}),v&&(n-D<c||B.current<0)){const e=n%D,t=l%D,r=l-(t-e);B.current=t===e?l:t>e?r:r-D}Be(s,B.current)&&(B.current=n),K(B.current)}if(t.key===Fe&&(ce(t),-1===n?B.current=c:(B.current=He(s,{startingIndex:n,amount:D,disabledIndices:e}),v&&n+D>l&&(B.current=He(s,{startingIndex:n%D-D,amount:D,disabledIndices:e}))),Be(s,B.current)&&(B.current=n),K(B.current)),"both"===L){const r=Math.floor(n/D);t.key===Ke&&(ce(t),n%D!=D-1?(B.current=He(s,{startingIndex:n,disabledIndices:e}),v&&_e(B.current,D,r)&&(B.current=He(s,{startingIndex:n-n%D-1,disabledIndices:e}))):v&&(B.current=He(s,{startingIndex:n-n%D-1,disabledIndices:e})),_e(B.current,D,r)&&(B.current=n)),t.key===je&&(ce(t),n%D!=0?(B.current=He(s,{startingIndex:n,disabledIndices:e,decrement:!0}),v&&_e(B.current,D,r)&&(B.current=He(s,{startingIndex:n+(D-n%D),decrement:!0,disabledIndices:e}))):v&&(B.current=He(s,{startingIndex:n+(D-n%D),decrement:!0,disabledIndices:e})),_e(B.current,D,r)&&(B.current=n));const o=Math.floor(l/D)===r;return Be(s,B.current)&&(B.current=v&&o?t.key===je?l:He(s,{startingIndex:n-n%D-1,disabledIndices:e}):n),void K(B.current)}}if(We(t.key,L)){if(ce(t),n&&!R&&te(t.currentTarget.ownerDocument)===t.currentTarget)return B.current=Ue(t.key,L,E)?c:l,void K(B.current);Ue(t.key,L,E)?B.current=v?u>=l?p&&u!==s.current.length?-1:c:He(s,{startingIndex:u,disabledIndices:e}):Math.min(l,He(s,{startingIndex:u,disabledIndices:e})):B.current=v?u<=c?p&&-1!==u?s.current.length:l:He(s,{startingIndex:u,decrement:!0,disabledIndices:e}):Math.max(c,He(s,{startingIndex:u,decrement:!0,disabledIndices:e})),Be(s,B.current)?K(null):K(B.current)}}function u(e){"auto"===C&&I(e.nativeEvent)&&(_.current=!0)}const c=R&&n&&J&&{"aria-activedescendant":Z};return{reference:{...c,onKeyDown(o){q.current=!1;const u=0===o.key.indexOf("Arrow");if(R&&n)return t(o);if(!n&&!S&&u)return;const i=u||"Enter"===o.key||""===o.key.trim(),c=We(o.key,L),l=function(e,t,n){return qe(t,n?e===je:e===Ke,e===Fe)}(o.key,L,E);i&&(H.current=w&&c?null:o.key),w?l&&(ce(o),n?(B.current=ze(s,e),K(B.current)):r(!0)):c&&(null!=m&&(B.current=m),ce(o),!n&&S?r(!0):t(o),n&&K(B.current))},onFocus(){n&&K(null)},onPointerDown:function(e){_.current=C,"auto"===C&&O(e.nativeEvent)&&(_.current=!0)},onMouseDown:u,onClick:u},floating:{"aria-orientation":"both"===L?void 0:L,...c,onKeyDown:t,onPointerMove(){q.current=!0}},item:ee}}),[i,o,Z,X,Y,s,d,L,E,R,n,J,w,m,S,p,D,v,C,K,r,ee])},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){void 0===t&&(t={});const{open:n,floatingId:r}=e,{enabled:o=!0,role:i="dialog"}=t,c=f();return u.useMemo((()=>{const e={id:r,role:i};return o?"tooltip"===i?{reference:{"aria-describedby":n?r:void 0},floating:e}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":"alertdialog"===i?"dialog":i,"aria-controls":n?r:void 0,..."listbox"===i&&{role:"combobox"},..."menu"===i&&{id:c}},floating:{...e,..."menu"===i&&{"aria-labelledby":c}}}:{}}),[o,i,n,r,c])},e.useTransitionStatus=Ge,e.useTransitionStyles=function(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:r,close:o,common:i,duration:l=250}=t,s=e.placement,a=s.split("-")[0],f=u.useMemo((()=>({side:a,placement:s})),[a,s]),d="number"==typeof l,m=(d?l:l.open)||0,p=(d?l:l.close)||0,[v,g]=u.useState((()=>({...Ye(i,f),...Ye(n,f)}))),{isMounted:h,status:y}=Ge(e,{duration:l}),b=P(n),w=P(r),E=P(o),R=P(i);return c((()=>{const e=Ye(b.current,f),t=Ye(E.current,f),n=Ye(R.current,f),r=Ye(w.current,f)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===y&&g((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===y&&g({transitionProperty:Object.keys(r).map(Xe).join(","),transitionDuration:m+"ms",...n,...r}),"close"===y){const r=t||e;g({transitionProperty:Object.keys(r).map(Xe).join(","),transitionDuration:p+"ms",...n,...r})}}),[p,E,b,w,R,m,y,f]),{isMounted:h,styles:v}},e.useTypeahead=function(e,t){var n;const{open:r,dataRef:o}=e,{listRef:i,activeIndex:l,onMatch:s,onTypingChange:a,enabled:f=!0,findMatch:d=null,resetMs:m=750,ignoreKeys:p=[],selectedIndex:v=null}=t,g=u.useRef(),h=u.useRef(""),y=u.useRef(null!=(n=null!=v?v:l)?n:-1),b=u.useRef(null),w=Pe(s),E=Pe(a),R=P(d),x=P(p);return c((()=>{r&&(clearTimeout(g.current),b.current=null,h.current="")}),[r]),c((()=>{var e;r&&""===h.current&&(y.current=null!=(e=null!=v?v:l)?e:-1)}),[r,v,l]),u.useMemo((()=>{if(!f)return{};function e(e){e?o.current.typing||(o.current.typing=e,E(e)):o.current.typing&&(o.current.typing=e,E(e))}function t(e,t,n){const r=R.current?R.current(t,n):t.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(n.toLocaleLowerCase()))));return r?e.indexOf(r):-1}function n(n){const o=i.current;if(h.current.length>0&&" "!==h.current[0]&&(-1===t(o,o,h.current)?e(!1):" "===n.key&&ce(n)),null==o||x.current.includes(n.key)||1!==n.key.length||n.ctrlKey||n.metaKey||n.altKey)return;r&&" "!==n.key&&(ce(n),e(!0));o.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&h.current===n.key&&(h.current="",y.current=b.current),h.current+=n.key,clearTimeout(g.current),g.current=setTimeout((()=>{h.current="",y.current=b.current,e(!1)}),m);const u=y.current,c=t(o,[...o.slice((u||0)+1),...o.slice(0,(u||0)+1)],h.current);-1!==c?(w(c),b.current=c):" "!==n.key&&(h.current="",e(!1))}return{reference:{onKeyDown:n},floating:{onKeyDown:n,onKeyUp(t){" "===t.key&&e(!1)}}}}),[f,r,o,i,m,x,R,w,E])},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@floating-ui/react-dom"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","@floating-ui/react-dom","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIReact={},e.FloatingUIReactDOM,e.React,e.ReactDOM)}(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(n);function i(){return i=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},i.apply(this,arguments)}var c="undefined"!=typeof document?n.useLayoutEffect:n.useEffect;let l=!1,s=0;const a=()=>"floating-ui-"+s++;const f=u["useId".toString()]||function(){const[e,t]=u.useState((()=>l?a():void 0));return c((()=>{null==e&&t(a())}),[]),u.useEffect((()=>{l||(l=!0)}),[]),e},d=u.forwardRef((function(e,n){let{context:{placement:r,elements:{floating:o},middlewareData:{arrow:c}},width:l=14,height:s=7,tipRadius:a=0,strokeWidth:d=0,staticOffset:m,stroke:p,d:v,style:{transform:g,...h}={},...y}=e;const b=f();if(!o)return null;d*=2;const w=d/2,E=l/2*(a/-8+1),R=s/2*a/4,[x,I]=r.split("-"),O=!!o&&t.platform.isRTL(o),k=!!v,C="top"===x||"bottom"===x,M=m&&"end"===I?"bottom":"top";let P=m&&"end"===I?"right":"left";m&&O&&(P="end"===I?"left":"right");const T=k?0:w,S=null!=(null==c?void 0:c.x)?m||c.x:"",A=null!=(null==c?void 0:c.y)?m||c.y+T:"",L=v||"M0,0 H"+l+" L"+(l-E)+","+(s-R)+" Q"+l/2+","+s+" "+E+","+(s-R)+" Z",D={top:k?"rotate(180deg)":"",left:k?"rotate(90deg)":"rotate(-90deg)",bottom:k?"":"rotate(180deg)",right:k?"rotate(-90deg)":"rotate(90deg)"}[x];return u.createElement("svg",i({},y,{"aria-hidden":!0,ref:n,width:k?l:l+d,height:l,viewBox:"0 0 "+l+" "+(s>l?s:l),style:{position:"absolute",pointerEvents:"none",[P]:S,[M]:A,[x]:C||k?"100%":"calc(100% - "+d/2+"px)",transform:""+D+(null!=g?g:""),...h}}),d>0&&u.createElement("path",{clipPath:"url(#"+b+")",fill:"none",stroke:p,strokeWidth:d+(v?0:1),d:L}),u.createElement("path",{stroke:d&&!v?y.fill:"none",d:L}),u.createElement("clipPath",{id:b},u.createElement("rect",{x:-w,y:w*(k?-1:1),width:l+d,height:l})))}));function m(){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){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}const p=u.createContext(null),v=u.createContext(null),g=()=>{var e;return(null==(e=u.useContext(p))?void 0:e.id)||null},h=()=>u.useContext(v);function y(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 w(){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 E(e){return y(e).defaultView||window}function R(e){return!!e&&e instanceof E(e).Element}function x(e){return!!e&&e instanceof E(e).HTMLElement}function I(e){if(0===e.mozInputSource&&e.isTrusted)return!0;const t=/Android/i;return(t.test(b())||t.test(w()))&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType}function O(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 k(){return/apple/i.test(navigator.vendor)}function C(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function M(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 E(r).ShadowRoot||r instanceof ShadowRoot))){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}var r;return!1}function P(e){const t=n.useRef(e);return c((()=>{t.current=e})),t}const T="data-floating-ui-safe-polygon";function S(e,t,n){return n&&!C(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}const A=u.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{},isInstantPhase:!1}),L=()=>u.useContext(A);var D=new WeakMap,N=new WeakMap,F={},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];F[n]||(F[n]=new WeakMap);var o=F[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=(D.get(e)||0)+1,s=(o.get(e)||0)+1;D.set(e,c),o.set(e,s),u.push(e),1===c&&r&&N.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=D.get(e)-1,r=o.get(e)-1;D.set(e,t),o.set(e,r),t||(N.has(e)||e.removeAttribute("aria-hidden"),N.delete(e)),r||e.removeAttribute(n)})),--j||(D=new WeakMap,D=new WeakMap,N=new WeakMap,F={})}},_=["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,q=!B&&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{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},z=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},V=function(e){return"INPUT"===e.tagName},X=function(e){return function(e){return V(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||q(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=q(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=q(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=q(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 V(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))},Q=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=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(z).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?W([e],t.includeContainer,{filter:$.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Q}):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)),J(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}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 x(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=ee(e,le());"prev"===t&&n.reverse();const r=n.indexOf(te(y(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||!M(n,r)}function me(e){ee(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={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};function ge(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const he=u.forwardRef((function(e,t){const[n,r]=u.useState();return c((()=>(k()&&r("button"),document.addEventListener("keydown",ge),()=>{document.removeEventListener("keydown",ge)})),[]),u.createElement("span",i({},e,{ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,"data-floating-ui-focus-guard":"",style:ve}))})),ye=u.createContext(null);function be(e){let{id:t,root:n}=void 0===e?{}:e;const[r,o]=u.useState(null),i=f(),l=we(),s=u.useMemo((()=>({id:t,root:n,portalContext:l,uniqueId:i})),[t,n,l,i]),a=u.useRef();return c((()=>()=>{null==r||r.remove()}),[r,s]),c((()=>{if(a.current===s)return;a.current=s;const{id:e,root:t,portalContext:n,uniqueId:r}=s,u=e?document.getElementById(e):null,i="data-floating-ui-portal";if(u){const e=document.createElement("div");e.id=r,e.setAttribute(i,""),u.appendChild(e),o(e)}else{let u=(null==n?void 0:n.portalNode)||t||document.body,c=null;e&&(c=document.createElement("div"),c.id=e,u.appendChild(c));const l=document.createElement("div");l.id=r,l.setAttribute(i,""),u=c||u,u.appendChild(l),o(l)}}),[s]),r}const we=()=>u.useContext(ye),Ee=u.forwardRef((function(e,t){return u.createElement("button",i({},e,{type:"button",ref:t,tabIndex:-1,style:ve}))}));function Re(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const xe=u.createContext({register:()=>{},unregister:()=>{},map:new Map,elementsRef:{current:[]}});const Ie="data-floating-ui-scroll-lock",Oe=u.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return c((()=>{var e,t;if(!n)return;if(document.body.hasAttribute(Ie))return;document.body.setAttribute(Ie,"");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(Ie),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(Ie),window.scrollTo(c,l)}}),[n]),u.createElement("div",i({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function ke(e){return x(e.target)&&"BUTTON"===e.target.tagName}function Ce(e){return ie(e)}const Me=u["useInsertionEffect".toString()]||(e=>e());function Pe(e){const t=u.useRef((()=>{}));return Me((()=>{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)}),[])}function Te(e){return null!=e&&null!=e.clientX}function Se(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 De=!1;const Ne="ArrowUp",Fe="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 qe(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function We(e,t){return qe(t,e===Ne||e===Fe,e===je||e===Ke)}function Ue(e,t,n){return qe(t,e===Fe,n?e===je:e===Ke)||"Enter"===e||" "==e||""===e}function ze(e,t){return He(e,{disabledIndices:t})}function Ve(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){return"function"==typeof e?e(t):e}function Ge(e,t){void 0===t&&(t={});const{open:n,elements:{floating:r}}=e,{duration:o=250}=t,i=("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,i);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 Ze(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}function $e(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}function Qe(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];return null==(e=r.get(n))?void 0:e.map((e=>e(...o))).find((e=>void 0!==e))})):e[n]=o})),e):e),{})}}Object.defineProperty(e,"arrow",{enumerable:!0,get:function(){return t.arrow}}),Object.defineProperty(e,"autoPlacement",{enumerable:!0,get:function(){return t.autoPlacement}}),Object.defineProperty(e,"autoUpdate",{enumerable:!0,get:function(){return t.autoUpdate}}),Object.defineProperty(e,"computePosition",{enumerable:!0,get:function(){return t.computePosition}}),Object.defineProperty(e,"detectOverflow",{enumerable:!0,get:function(){return t.detectOverflow}}),Object.defineProperty(e,"flip",{enumerable:!0,get:function(){return t.flip}}),Object.defineProperty(e,"getOverflowAncestors",{enumerable:!0,get:function(){return t.getOverflowAncestors}}),Object.defineProperty(e,"hide",{enumerable:!0,get:function(){return t.hide}}),Object.defineProperty(e,"inline",{enumerable:!0,get:function(){return t.inline}}),Object.defineProperty(e,"limitShift",{enumerable:!0,get:function(){return t.limitShift}}),Object.defineProperty(e,"offset",{enumerable:!0,get:function(){return t.offset}}),Object.defineProperty(e,"platform",{enumerable:!0,get:function(){return t.platform}}),Object.defineProperty(e,"shift",{enumerable:!0,get:function(){return t.shift}}),Object.defineProperty(e,"size",{enumerable:!0,get:function(){return t.size}}),e.FloatingArrow=d,e.FloatingDelayGroup=e=>{let{children:t,delay:n,timeoutMs:r=0}=e;const[o,i]=u.useReducer(((e,t)=>({...e,...t})),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),l=u.useRef(null),s=u.useCallback((e=>{i({currentId:e})}),[]);return c((()=>{o.currentId?null===l.current?l.current=o.currentId:i({isInstantPhase:!0}):(i({isInstantPhase:!1}),l.current=null)}),[o.currentId]),u.createElement(A.Provider,{value:u.useMemo((()=>({...o,setState:i,setCurrentId:s})),[o,i,s])},t)},e.FloatingFocusManager=function(e){const{context:t,children:n,order:r=["content"],guards:o=!0,initialFocus:i=0,returnFocus:l=!0,modal:s=!0,visuallyHiddenDismiss:a=!1,closeOnFocusOut:f=!0}=e,{open:d,refs:m,nodeId:p,onOpenChange:v,events:g,dataRef:b,elements:{domReference:w,floating:E}}=t,R=P(r),I=P(i),O=P(l),k=h(),C=we(),T="number"==typeof i&&i<0,S=u.useRef(null),A=u.useRef(null),L=u.useRef(!1),D=u.useRef(null),N=u.useRef(!1),F=null!=C,j=w&&"combobox"===w.getAttribute("role")&&ie(w),_=u.useCallback((function(e){return void 0===e&&(e=E),e?ee(e,le()):[]}),[E]),B=u.useCallback((e=>{const t=_(e);return R.current.map((e=>w&&"reference"===e?w:E&&"floating"===e?E:t)).filter(Boolean).flat()}),[w,E,R,_]);function H(e){return a&&s?u.createElement(Ee,{ref:"start"===e?S:A,onClick:()=>v(!1)},"string"==typeof a?a:"Dismiss"):null}u.useEffect((()=>{if(!s)return;function e(e){if("Tab"===e.key){M(E,te(y(E)))&&0===_().length&&!j&&ce(e);const t=B(),n=ue(e);"reference"===R.current[0]&&n===w&&(ce(e),e.shiftKey?re(t[t.length-1]):re(t[1])),"floating"===R.current[1]&&n===E&&e.shiftKey&&(ce(e),re(t[0]))}}const t=y(E);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[w,E,s,R,m,j,_,B]),u.useEffect((()=>{if(f)return E&&x(w)?(w.addEventListener("focusout",t),w.addEventListener("pointerdown",e),!s&&E.addEventListener("focusout",t),()=>{w.removeEventListener("focusout",t),w.removeEventListener("pointerdown",e),!s&&E.removeEventListener("focusout",t)}):void 0;function e(){N.current=!0,setTimeout((()=>{N.current=!1}))}function t(e){const t=e.relatedTarget;queueMicrotask((()=>{const e=!(M(w,t)||M(E,t)||M(t,E)||M(null==C?void 0:C.portalNode,t)||null!=t&&t.hasAttribute("data-floating-ui-focus-guard")||k&&(oe(k.nodesRef.current,p).find((e=>{var n,r;return M(null==(n=e.context)?void 0:n.elements.floating,t)||M(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}(k.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&&e&&!N.current&&t!==D.current&&(L.current=!0,v(!1))}))}}),[w,E,s,p,k,C,v,f]),u.useEffect((()=>{var e;const t=Array.from((null==C||null==(e=C.portalNode)?void 0:e.querySelectorAll("[data-floating-ui-portal]"))||[]);if(E&&s){const e=[E,...t,...[S.current,A.current].filter(Boolean)],n=K(R.current.includes("reference")||j?e.concat(w||[]):e);return()=>{n()}}}),[w,E,s,R,C,j]),u.useEffect((()=>{if(s&&!o&&E){const e=[],t=le(),n=ee(y(E).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)}))}}}),[E,s,o,B]),c((()=>{if(!E)return;const e=te(y(E));queueMicrotask((()=>{const t=B(E),n=I.current,r=("number"==typeof n?t[n]:n.current)||E,o=M(E,e);T||o||!d||re(r,{preventScroll:r===E})}))}),[d,E,T,B,I]),c((()=>{if(!E)return;let e=!1;const t=y(E),n=te(t),r=b.current;function o(t){if("escapeKey"===t.type&&m.domReference.current&&(D.current=m.domReference.current),["referencePress","escapeKey"].includes(t.type))return;const n=t.data.returnFocus;"object"==typeof n?(L.current=!1,e=n.preventScroll):L.current=!n}return D.current=n,g.on("dismiss",o),()=>{g.off("dismiss",o);const n=te(t);(M(E,n)||k&&oe(k.nodesRef.current,p).some((e=>{var t;return M(null==(t=e.context)?void 0:t.elements.floating,n)}))||r.openEvent&&["click","mousedown"].includes(r.openEvent.type))&&m.domReference.current&&(D.current=m.domReference.current),O.current&&x(D.current)&&!L.current&&re(D.current,{cancelPrevious:!1,preventScroll:e})}}),[E,O,b,m,g,k,p]),c((()=>{if(C)return C.setFocusManagerState({...t,modal:s,closeOnFocusOut:f,open:d}),()=>{C.setFocusManagerState(null)}}),[C,s,d,f,t]),c((()=>{if(E&&"function"==typeof MutationObserver){const e=()=>{const e=E.getAttribute("tabindex");R.current.includes("floating")||te(y(E))!==m.domReference.current&&0===_().length?"0"!==e&&E.setAttribute("tabindex","0"):"-1"!==e&&E.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(E,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}}}),[E,m,R,_]);const q=o&&!j&&(F||s);return u.createElement(u.Fragment,null,q&&u.createElement(he,{"data-type":"inside",ref:null==C?void 0:C.beforeInsideRef,onFocus:e=>{if(s){const e=B();re("reference"===r[0]?e[0]:e[e.length-1])}else if(null!=C&&C.preserveTabOrder&&C.portalNode)if(L.current=!1,de(e,C.portalNode)){const e=ae()||w;null==e||e.focus()}else{var t;null==(t=C.beforeOutsideRef.current)||t.focus()}}}),!j&&H("start"),n,H("end"),q&&u.createElement(he,{"data-type":"inside",ref:null==C?void 0:C.afterInsideRef,onFocus:e=>{if(s)re(B()[0]);else if(null!=C&&C.preserveTabOrder&&C.portalNode)if(f&&(L.current=!0),de(e,C.portalNode)){const e=fe()||w;null==e||e.focus()}else{var t;null==(t=C.afterOutsideRef.current)||t.focus()}}}))},e.FloatingList=function(e){let{children:t,elementsRef:n,labelsRef:r}=e;const[o,i]=u.useState((()=>new Map)),l=u.useCallback((e=>{i((t=>new Map(t).set(e,null)))}),[]),s=u.useCallback((e=>{i((t=>{const n=new Map(t);return n.delete(e),n}))}),[]);return c((()=>{const e=new Map(o);Array.from(e.keys()).sort(Re).forEach(((t,n)=>{e.set(t,n)})),function(e,t){if(e.size!==t.size)return!1;for(const[n,r]of e.entries())if(r!==t.get(n))return!1;return!0}(o,e)||i(e)}),[o]),u.createElement(xe.Provider,{value:{register:l,unregister:s,map:o,elementsRef:n,labelsRef:r}},t)},e.FloatingNode=function(e){let{children:t,id:n}=e;const r=g();return u.createElement(p.Provider,{value:u.useMemo((()=>({id:n,parentId:r})),[n,r])},t)},e.FloatingOverlay=Oe,e.FloatingPortal=function(e){let{children:t,id:n,root:o=null,preserveTabOrder:i=!0}=e;const c=be({id:n,root: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&&l.open&&i&&!(!o&&!c);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(ye.Provider,{value:u.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:a,afterOutsideRef:f,beforeInsideRef:d,afterInsideRef:m,portalNode:c,setFocusManagerState:s})),[i,c])},p&&c&&u.createElement(he,{"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:ve}),c&&r.createPortal(t,c),p&&c&&u.createElement(he,{"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=function(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((()=>m()))[0];return u.createElement(v.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(n){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}}=n,v=o.current[l];if(!v)return{};const g={...n,...await t.offset(-v.offsetTop-m.reference.height/2-v.offsetHeight/2-c).fn(n)},h=(null==f?void 0:f.current)||p,y=await t.detectOverflow(Ze(g,h.scrollHeight),d),b=await t.detectOverflow(g,{...d,elementContext:"reference"}),w=Math.max(0,y.top),E=g.y+w,R=Math.max(0,h.scrollHeight-w-Math.max(0,y.bottom));return h.style.maxHeight=R+"px",h.scrollTop=w,i&&(h.offsetHeight<v.offsetHeight*Math.min(s,o.current.length-1)-1||b.top>=-a||b.bottom>=-a?r.flushSync((()=>i(!0))):r.flushSync((()=>i(!1)))),u&&(u.current=await t.detectOverflow(Ze({...g,y:E},h.offsetHeight),d)),{y:E}}}),e.safePolygon=function(e){void 0===e&&(e={});const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e;let o,u=!1,i=null,c=null,l=performance.now();const s=e=>{let{x:n,y:s,placement:a,elements:f,onClose:d,nodeId:m,tree:p}=e;return function(e){function v(){clearTimeout(o),d()}if(clearTimeout(o),!f.domReference||!f.floating||null==a||null==n||null==s)return;const{clientX:g,clientY:h}=e,y=[g,h],b=ue(e),w="mouseleave"===e.type,E=M(f.floating,b),x=M(f.domReference,b),I=f.domReference.getBoundingClientRect(),O=f.floating.getBoundingClientRect(),k=a.split("-")[0],C=n>O.right-O.width/2,P=s>O.bottom-O.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}(y,I),S=O.width>I.width,A=O.height>I.height,L=(S?I:O).left,D=(S?I:O).right,N=(A?I:O).top,F=(A?I:O).bottom;if(E&&(u=!0,!w))return;if(x&&(u=!1),x&&!w)return void(u=!0);if(w&&R(e.relatedTarget)&&M(f.floating,e.relatedTarget))return;if(p&&oe(p.nodesRef.current,m).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if("top"===k&&s>=I.bottom-1||"bottom"===k&&s<=I.top+1||"left"===k&&n>=I.right-1||"right"===k&&n<=I.left+1)return v();let j=[];switch(k){case"top":j=[[L,I.top+1],[L,O.bottom-1],[D,O.bottom-1],[D,I.top+1]];break;case"bottom":j=[[L,O.top+1],[L,I.bottom-1],[D,I.bottom-1],[D,O.top+1]];break;case"left":j=[[O.right-1,F],[O.right-1,N],[I.left+1,N],[I.left+1,F]];break;case"right":j=[[I.right-1,F],[I.right-1,N],[O.left+1,N],[O.left+1,F]]}if(!$e([g,h],j)){if(u&&!T)return v();if(!w&&r){const t=function(e,t){const n=performance.now(),r=n-l;if(null===i||null===c||0===r)return i=e,c=t,l=n,null;const o=e-i,u=t-c,s=Math.sqrt(o*o+u*u);return i=e,c=t,l=n,s/r}(e.clientX,e.clientY),n=.1;if(null!==t&&t<n)return v()}$e([g,h],function(e){let[n,r]=e;switch(k){case"top":return[[S?n+t/2:C?n+4*t:n-4*t,r+t+1],[S?n-t/2:C?n+4*t:n-4*t,r+t+1],...[[O.left,C||S?O.bottom-t:O.top],[O.right,C?S?O.bottom-t:O.top:O.bottom-t]]];case"bottom":return[[S?n+t/2:C?n+4*t:n-4*t,r-t],[S?n-t/2:C?n+4*t:n-4*t,r-t],...[[O.left,C||S?O.top+t:O.bottom],[O.right,C?S?O.top+t:O.bottom:O.top+t]]];case"left":{const e=[n+t+1,A?r+t/2:P?r+4*t:r-4*t],o=[n+t+1,A?r-t/2:P?r+4*t:r-4*t];return[...[[P||A?O.right-t:O.left,O.top],[P?A?O.right-t:O.left:O.right-t,O.bottom]],e,o]}case"right":return[[n-t,A?r+t/2:P?r+4*t:r-4*t],[n-t,A?r-t/2:P?r+4*t:r-4*t],...[[P||A?O.left+t:O.right,O.top],[P?A?O.left+t:O.right:O.left+t,O.bottom]]]}}([n,s]))?!u&&r&&(o=window.setTimeout(v,40)):v()}}};return s.__options={blockPointerEvents:n},s},e.useClick=function(e,t){void 0===t&&(t={});const{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}=t,d=u.useRef(),m=u.useRef(!1);return u.useMemo((()=>c?{reference:{onPointerDown(e){d.current=e.pointerType},onMouseDown(e){0===e.button&&(C(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){"mousedown"===l&&d.current?d.current=void 0:C(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,e.defaultPrevented||!f||ke(e)||(" "!==e.key||Ce(i)||(e.preventDefault(),m.current=!0),"Enter"===e.key&&(n?s&&r(!1):r(!0)))},onKeyUp(e){e.defaultPrevented||!f||ke(e)||Ce(i)||" "===e.key&&m.current&&(m.current=!1,n?s&&r(!1):r(!0))}}}:{}),[c,o,l,a,f,i,s,n,r])},e.useClientPoint=function(e,t){void 0===t&&(t={});const{open:n,refs:r,dataRef:o,elements:{floating:i}}=e,{enabled:l=!0,axis:s="both",x:a=null,y:f=null}=t,d=u.useRef(!1),m=u.useRef(null),[p,v]=u.useState(),[g,h]=u.useState([]),y=Pe(((e,t)=>{d.current||o.current.openEvent&&!Te(o.current.openEvent)||r.setPositionReference(function(e,t){let n=null,r=null,o=!1;return{contextElement:e.current||void 0,getBoundingClientRect(){var u,i;const c=(null==(u=e.current)?void 0:u.getBoundingClientRect())||{width:0,height:0,x:0,y:0},l="x"===t.axis||"both"===t.axis,s="y"===t.axis||"both"===t.axis,a=["mouseenter","mousemove"].includes((null==(i=t.dataRef.current.openEvent)?void 0:i.type)||"")&&"touch"!==t.pointerType;let f=c.width,d=c.height,m=c.x,p=c.y;return null==n&&t.x&&l&&(n=c.x-t.x),null==r&&t.y&&s&&(r=c.y-t.y),m-=n||0,p-=r||0,f=0,d=0,!o||a?(f="y"===t.axis?c.width:0,d="x"===t.axis?c.height:0,m=l&&null!=t.x?t.x:m,p=s&&null!=t.y?t.y:p):o&&!a&&(d="x"===t.axis?c.height:d,f="y"===t.axis?c.width:f),o=!0,{width:f,height:d,x:m,y:p,top:p,right:m+f,bottom:p+d,left:m}}}}(r.domReference,{x:e,y:t,axis:s,dataRef:o,pointerType:p}))})),b=Pe((e=>{null==a&&null==f&&(n?m.current||h([]):y(e.clientX,e.clientY))})),w=C(p)?i:n,R=u.useCallback((()=>{if(!w||!l||null!=a||null!=f)return;const e=E(r.floating.current);function t(n){const o=ue(n);M(r.floating.current,o)?(e.removeEventListener("mousemove",t),m.current=null):y(n.clientX,n.clientY)}if(!o.current.openEvent||Te(o.current.openEvent)){e.addEventListener("mousemove",t);const n=()=>{e.removeEventListener("mousemove",t),m.current=null};return m.current=n,n}r.setPositionReference(r.domReference.current)}),[o,l,w,r,y,a,f]);return u.useEffect((()=>R()),[R,g]),u.useEffect((()=>{l&&!i&&(d.current=!1)}),[l,i]),u.useEffect((()=>{!l&&n&&(d.current=!0)}),[l,n]),c((()=>{!l||null==a&&null==f||(d.current=!1,y(a,f))}),[l,a,f,y]),u.useMemo((()=>{if(!l)return{};function e(e){let{pointerType:t}=e;v(t)}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove:b,onMouseEnter:b}}}),[l,b])},e.useDelayGroup=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:o}=t;const{currentId:u,setCurrentId:i,initialDelay:l,setState:s,timeoutMs:a}=L();c((()=>{u&&(s({delay:{open:1,close:S(l,"close")}}),u!==o&&r(!1))}),[o,r,s,u,l]),c((()=>{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]),c((()=>{n&&i(o)}),[n,i,o])},e.useDelayGroupContext=L,e.useDismiss=function(e,n){void 0===n&&(n={});const{open:r,onOpenChange:o,events:i,nodeId:c,elements:{reference:l,domReference:s,floating:a},dataRef:f}=e,{enabled:d=!0,escapeKey:m=!0,outsidePress:p=!0,outsidePressEvent:v="pointerdown",referencePress:b=!1,referencePressEvent:w="pointerdown",ancestorScroll:k=!1,bubbles:C}=n,M=h(),P=null!=g(),T=Pe("function"==typeof p?p:()=>!1),S="function"==typeof p?T:p,A=u.useRef(!1),{escapeKeyBubbles:L,outsidePressBubbles:D}=(e=>{var t,n;return{escapeKeyBubbles:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePressBubbles:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}})(C),N=Pe((e=>{if(!r||!d||!m||"Escape"!==e.key)return;const t=M?oe(M.nodesRef.current,c):[];if(!L&&(e.stopPropagation(),t.length>0)){let e=!0;if(t.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)})),!e)return}i.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),o(!1)})),F=Pe((e=>{const t=A.current;if(A.current=!1,t)return;if("function"==typeof S&&!S(e))return;const n=ue(e);if(x(n)&&a){const t=n.clientWidth>0&&n.scrollWidth>n.clientWidth,r=n.clientHeight>0&&n.scrollHeight>n.clientHeight;let o=r&&e.offsetX>n.clientWidth;if(r){"rtl"===E(a).getComputedStyle(n).direction&&(o=e.offsetX<=n.offsetWidth-n.clientWidth)}if(o||t&&e.offsetY>n.clientHeight)return}const r=M&&oe(M.nodesRef.current,c).some((t=>{var n;return Se(e,null==(n=t.context)?void 0:n.elements.floating)}));if(Se(e,a)||Se(e,s)||r)return;const u=M?oe(M.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:P?{preventScroll:!0}:I(e)||O(e)}}),o(!1)}));return u.useEffect((()=>{if(!r||!d)return;function e(){o(!1)}f.current.__escapeKeyBubbles=L,f.current.__outsidePressBubbles=D;const n=y(a);m&&n.addEventListener("keydown",N),S&&n.addEventListener(v,F);let u=[];return k&&(R(s)&&(u=t.getOverflowAncestors(s)),R(a)&&(u=u.concat(t.getOverflowAncestors(a))),!R(l)&&l&&l.contextElement&&(u=u.concat(t.getOverflowAncestors(l.contextElement)))),u=u.filter((e=>{var t;return e!==(null==(t=n.defaultView)?void 0:t.visualViewport)})),u.forEach((t=>{t.addEventListener("scroll",e,{passive:!0})})),()=>{m&&n.removeEventListener("keydown",N),S&&n.removeEventListener(v,F),u.forEach((t=>{t.removeEventListener("scroll",e)}))}}),[f,a,s,l,m,S,v,r,o,k,d,L,D,N,F]),u.useEffect((()=>{A.current=!1}),[S,v]),u.useMemo((()=>d?{reference:{onKeyDown:N,[Ae[w]]:()=>{b&&(i.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),o(!1))}},floating:{onKeyDown:N,[Le[v]]:()=>{A.current=!0}}}:{}),[d,i,b,v,w,o,N])},e.useFloating=function(e){var n;void 0===e&&(e={});const{open:r=!1,onOpenChange:o,nodeId:i}=e,[l,s]=u.useState(null),a=(null==(n=e.elements)?void 0:n.reference)||l,d=t.useFloating(e),p=h(),v=Pe(o),g=u.useRef(null),y=u.useRef({}),b=u.useState((()=>m()))[0],w=f(),E=u.useCallback((e=>{const t=R(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;d.refs.setReference(t)}),[d.refs]),x=u.useCallback((e=>{(R(e)||null===e)&&(g.current=e,s(e)),(R(d.refs.reference.current)||null===d.refs.reference.current||null!==e&&!R(e))&&d.refs.setReference(e)}),[d.refs]),I=u.useMemo((()=>({...d.refs,setReference:x,setPositionReference:E,domReference:g})),[d.refs,x,E]),O=u.useMemo((()=>({...d.elements,domReference:a})),[d.elements,a]),k=u.useMemo((()=>({...d,refs:I,elements:O,dataRef:y,nodeId:i,floatingId:w,events:b,open:r,onOpenChange:v})),[d,i,w,b,r,v,I,O]);return c((()=>{const e=null==p?void 0:p.nodesRef.current.find((e=>e.id===i));e&&(e.context=k)})),u.useMemo((()=>({...d,context:k,refs:I,elements:O})),[d,I,O,k])},e.useFloatingNodeId=function(e){const t=f(),n=h(),r=g(),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=g,e.useFloatingPortalNode=be,e.useFloatingTree=h,e.useFocus=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,refs:c,elements:{floating:l,domReference:s}}=e,{enabled:a=!0,keyboardOnly:f=!0}=t,d=u.useRef(""),m=u.useRef(!1),p=u.useRef();return u.useEffect((()=>{if(!a)return;const e=y(l).defaultView||window;function t(){!n&&x(s)&&s===te(y(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&&Se(o.current.openEvent,s)||(o.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){m.current=!1;const t=e.relatedTarget,n=R(t)&&t.hasAttribute("data-floating-ui-focus-guard")&&"outside"===t.getAttribute("data-type");p.current=setTimeout((()=>{M(c.floating.current,t)||M(s,t)||n||r(!1)}))}}}:{}),[a,f,s,c,o,r])},e.useHover=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:{domReference:l,floating:s},refs:a}=e,{enabled:f=!0,delay:d=0,handleClose:m=null,mouseOnly:p=!1,restMs:v=0,move:b=!0}=t,w=h(),E=g(),x=P(m),I=P(d),O=u.useRef(),k=u.useRef(),A=u.useRef(),L=u.useRef(),D=u.useRef(!0),N=u.useRef(!1),F=u.useRef((()=>{})),j=u.useCallback((()=>{var e;const t=null==(e=o.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[o]);u.useEffect((()=>{if(f)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(){clearTimeout(k.current),clearTimeout(L.current),D.current=!0}}),[f,i]),u.useEffect((()=>{if(!f||!x.current||!n)return;function e(){j()&&r(!1)}const t=y(s).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[s,n,r,f,x,o,j]);const K=u.useCallback((function(e){void 0===e&&(e=!0);const t=S(I.current,"close",O.current);t&&!A.current?(clearTimeout(k.current),k.current=setTimeout((()=>r(!1)),t)):e&&(clearTimeout(k.current),r(!1))}),[I,r]),_=u.useCallback((()=>{F.current(),A.current=void 0}),[]),B=u.useCallback((()=>{if(N.current){const e=y(a.floating.current).body;e.style.pointerEvents="",e.removeAttribute(T),N.current=!1}}),[a]);return u.useEffect((()=>{if(f&&R(l)){const e=l;return n&&e.addEventListener("mouseleave",c),null==s||s.addEventListener("mouseleave",c),b&&e.addEventListener("mousemove",u,{once:!0}),e.addEventListener("mouseenter",u),e.addEventListener("mouseleave",i),()=>{n&&e.removeEventListener("mouseleave",c),null==s||s.removeEventListener("mouseleave",c),b&&e.removeEventListener("mousemove",u),e.removeEventListener("mouseenter",u),e.removeEventListener("mouseleave",i)}}function t(){return!!o.current.openEvent&&["click","mousedown"].includes(o.current.openEvent.type)}function u(e){if(clearTimeout(k.current),D.current=!1,p&&!C(O.current)||v>0&&0===S(I.current,"open"))return;o.current.openEvent=e;const t=S(I.current,"open",O.current);t?k.current=setTimeout((()=>{r(!0)}),t):r(!0)}function i(r){if(t())return;F.current();const o=y(s);if(clearTimeout(L.current),x.current){n||clearTimeout(k.current),A.current=x.current({...e,tree:w,x:r.clientX,y:r.clientY,onClose(){B(),_(),K()}});const t=A.current;return o.addEventListener("mousemove",t),void(F.current=()=>{o.removeEventListener("mousemove",t)})}("touch"!==O.current||!M(s,r.relatedTarget))&&K()}function c(n){t()||null==x.current||x.current({...e,tree:w,x:n.clientX,y:n.clientY,onClose(){B(),_(),K()}})(n)}}),[l,s,f,e,p,v,b,K,_,B,r,n,w,I,x,o]),c((()=>{var e;if(f&&n&&null!=(e=x.current)&&e.__options.blockPointerEvents&&j()){const e=y(s).body;if(e.setAttribute(T,""),e.style.pointerEvents="none",N.current=!0,R(l)&&s){var t,r;const e=l,n=null==w||null==(t=w.nodesRef.current.find((e=>e.id===E)))||null==(r=t.context)?void 0:r.elements.floating;return n&&(n.style.pointerEvents=""),e.style.pointerEvents="auto",s.style.pointerEvents="auto",()=>{e.style.pointerEvents="",s.style.pointerEvents=""}}}}),[f,n,E,s,l,w,x,o,j]),c((()=>{n||(O.current=void 0,_(),B())}),[n,_,B]),u.useEffect((()=>()=>{_(),clearTimeout(k.current),clearTimeout(L.current),B()}),[f,_,B]),u.useMemo((()=>{if(!f)return{};function e(e){O.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){n||0===v||(clearTimeout(L.current),L.current=setTimeout((()=>{D.current||r(!0)}),v))}},floating:{onMouseEnter(){clearTimeout(k.current)},onMouseLeave(){i.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),K(!1)}}}}),[i,f,v,n,r,K])},e.useId=f,e.useInnerOffset=function(e,t){const{open:n,elements:o}=e,{enabled:i=!0,overflowRef:c,scrollRef:l,onChange:s}=t,a=Pe(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 n=e.deltaY,o=c.current.top>=-.5,u=c.current.bottom>=-.5,i=t.scrollHeight-t.clientHeight,l=n<0?-1:1,s=n<0?"max":"min";t.scrollHeight<=t.clientHeight||(!o&&n>0||!u&&n<0?(e.preventDefault(),r.flushSync((()=>{a((e=>e+Math[s](n,i*l)))}))):/firefox/i.test(w())&&(t.scrollTop+=n))}const t=(null==l?void 0:l.current)||o.floating;return n&&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,n,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)&&r.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=>Qe(t,e,"reference")),t),r=u.useCallback((t=>Qe(t,e,"floating")),t),o=u.useCallback((t=>Qe(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.useListItem=function(e){let{label:t}=void 0===e?{}:e;const[n,r]=u.useState(null),o=u.useRef(null),{register:i,unregister:l,map:s,elementsRef:a,labelsRef:f}=u.useContext(xe),d=u.useCallback((e=>{if(o.current=e,null!==n&&(a.current[n]=e,f)){var r;const o=void 0!==t;f.current[n]=o?t:null!=(r=null==e?void 0:e.textContent)?r:null}}),[n,a,f,t]);return c((()=>{const e=o.current;if(e)return i(e),()=>{l(e)}}),[i,l]),c((()=>{const e=o.current?s.get(o.current):null;null!=e&&r(e)}),[s]),u.useMemo((()=>({ref:d,index:null==n?-1:n})),[n,d])},e.useListNavigation=function(e,t){const{open:n,onOpenChange:r,refs:o,elements:{domReference:i,floating:l}}=e,{listRef:s,activeIndex:a,onNavigate:f=(()=>{}),enabled:d=!0,selectedIndex:m=null,allowEscape:p=!1,loop:v=!1,nested:w=!1,rtl:E=!1,virtual:R=!1,focusItemOnOpen:C="auto",focusItemOnHover:T=!0,openOnArrowKeyDown:S=!0,disabledIndices:A,orientation:L="vertical",cols:D=1,scrollItemIntoView:N=!0}=t,F=g(),j=h(),K=Pe(f),_=u.useRef(C),B=u.useRef(null!=m?m:-1),H=u.useRef(null),q=u.useRef(!0),W=u.useRef(K),U=u.useRef(!!l),z=u.useRef(!1),V=u.useRef(!1),X=P(A),Y=P(n),G=P(N),[Z,$]=u.useState(),Q=Pe((function(e,t,n){void 0===n&&(n=!1);const r=e.current[t.current];r&&(R?$(r.id):re(r,{preventScroll:!0,sync:!(!b().toLowerCase().startsWith("mac")||navigator.maxTouchPoints||!k())&&(De||z.current)}),requestAnimationFrame((()=>{const e=G.current;e&&r&&(n||!q.current)&&(null==r.scrollIntoView||r.scrollIntoView("boolean"==typeof e?{block:"nearest",inline:"nearest"}:e))})))}));c((()=>{document.createElement("div").focus({get preventScroll(){return De=!0,!1}})}),[]),c((()=>{d&&(n&&l?_.current&&null!=m&&(V.current=!0,K(m)):U.current&&(B.current=-1,W.current(null)))}),[d,n,l,m,K]),c((()=>{if(d&&n&&l)if(null==a){if(z.current=!1,null!=m)return;if(U.current&&(B.current=-1,Q(s,B)),!U.current&&_.current&&(null!=H.current||!0===_.current&&null==H.current)){let e=0;const t=()=>{if(null==s.current[0]){if(e<2){(e?requestAnimationFrame:queueMicrotask)(t)}e++}else B.current=null==H.current||Ue(H.current,L,E)||w?ze(s,X.current):Ve(s,X.current),H.current=null,K(B.current)};t()}}else Be(s,a)||(B.current=a,Q(s,B,V.current),V.current=!1)}),[d,n,l,a,m,w,s,L,E,K,Q,X]),c((()=>{if(d&&U.current&&!l&&j){var e,t;const n=j.nodesRef.current,r=null==(e=n.find((e=>e.id===F)))||null==(t=e.context)?void 0:t.elements.floating,o=te(y(l)),u=n.some((e=>e.context&&M(e.context.elements.floating,o)));r&&!u&&r.focus({preventScroll:!0})}}),[d,l,j,F]),c((()=>{W.current=K,U.current=!!l})),c((()=>{n||(H.current=null)}),[n]);const J=null!=a,ee=u.useMemo((()=>{function e(e){if(!n)return;const t=s.current.indexOf(e);-1!==t&&K(t)}return{onFocus(t){let{currentTarget:n}=t;e(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...T&&{onMouseMove(t){let{currentTarget:n}=t;e(n)},onPointerLeave(e){let{pointerType:t}=e;q.current&&"touch"!==t&&(B.current=-1,Q(s,B),K(null),R||re(o.floating.current,{preventScroll:!0}))}}}}),[n,o,Q,T,s,K,R]);return u.useMemo((()=>{if(!d)return{};const e=X.current;function t(t){if(q.current=!1,z.current=!0,!Y.current&&t.currentTarget===o.floating.current)return;if(w&&function(e,t,n){return qe(t,n?e===Ke:e===je,e===Ne)}(t.key,L,E))return ce(t),r(!1),void(x(i)&&i.focus());const u=B.current,c=ze(s,e),l=Ve(s,e);if("Home"===t.key&&(ce(t),B.current=c,K(B.current)),"End"===t.key&&(ce(t),B.current=l,K(B.current)),D>1){const n=B.current;if(t.key===Ne){if(ce(t),-1===n)B.current=l;else if(B.current=He(s,{startingIndex:n,amount:D,decrement:!0,disabledIndices:e}),v&&(n-D<c||B.current<0)){const e=n%D,t=l%D,r=l-(t-e);B.current=t===e?l:t>e?r:r-D}Be(s,B.current)&&(B.current=n),K(B.current)}if(t.key===Fe&&(ce(t),-1===n?B.current=c:(B.current=He(s,{startingIndex:n,amount:D,disabledIndices:e}),v&&n+D>l&&(B.current=He(s,{startingIndex:n%D-D,amount:D,disabledIndices:e}))),Be(s,B.current)&&(B.current=n),K(B.current)),"both"===L){const r=Math.floor(n/D);t.key===Ke&&(ce(t),n%D!=D-1?(B.current=He(s,{startingIndex:n,disabledIndices:e}),v&&_e(B.current,D,r)&&(B.current=He(s,{startingIndex:n-n%D-1,disabledIndices:e}))):v&&(B.current=He(s,{startingIndex:n-n%D-1,disabledIndices:e})),_e(B.current,D,r)&&(B.current=n)),t.key===je&&(ce(t),n%D!=0?(B.current=He(s,{startingIndex:n,disabledIndices:e,decrement:!0}),v&&_e(B.current,D,r)&&(B.current=He(s,{startingIndex:n+(D-n%D),decrement:!0,disabledIndices:e}))):v&&(B.current=He(s,{startingIndex:n+(D-n%D),decrement:!0,disabledIndices:e})),_e(B.current,D,r)&&(B.current=n));const o=Math.floor(l/D)===r;return Be(s,B.current)&&(B.current=v&&o?t.key===je?l:He(s,{startingIndex:n-n%D-1,disabledIndices:e}):n),void K(B.current)}}if(We(t.key,L)){if(ce(t),n&&!R&&te(t.currentTarget.ownerDocument)===t.currentTarget)return B.current=Ue(t.key,L,E)?c:l,void K(B.current);Ue(t.key,L,E)?B.current=v?u>=l?p&&u!==s.current.length?-1:c:He(s,{startingIndex:u,disabledIndices:e}):Math.min(l,He(s,{startingIndex:u,disabledIndices:e})):B.current=v?u<=c?p&&-1!==u?s.current.length:l:He(s,{startingIndex:u,decrement:!0,disabledIndices:e}):Math.max(c,He(s,{startingIndex:u,decrement:!0,disabledIndices:e})),Be(s,B.current)?K(null):K(B.current)}}function u(e){"auto"===C&&I(e.nativeEvent)&&(_.current=!0)}const c=R&&n&&J&&{"aria-activedescendant":Z};return{reference:{...c,onKeyDown(o){q.current=!1;const u=0===o.key.indexOf("Arrow");if(R&&n)return t(o);if(!n&&!S&&u)return;const i=u||"Enter"===o.key||""===o.key.trim(),c=We(o.key,L),l=function(e,t,n){return qe(t,n?e===je:e===Ke,e===Fe)}(o.key,L,E);i&&(H.current=w&&c?null:o.key),w?l&&(ce(o),n?(B.current=ze(s,e),K(B.current)):r(!0)):c&&(null!=m&&(B.current=m),ce(o),!n&&S?r(!0):t(o),n&&K(B.current))},onFocus(){n&&K(null)},onPointerDown:function(e){_.current=C,"auto"===C&&O(e.nativeEvent)&&(_.current=!0)},onMouseDown:u,onClick:u},floating:{"aria-orientation":"both"===L?void 0:L,...c,onKeyDown:t,onPointerMove(){q.current=!0}},item:ee}}),[i,o,Z,X,Y,s,d,L,E,R,n,J,w,m,S,p,D,v,C,K,r,ee])},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){void 0===t&&(t={});const{open:n,floatingId:r}=e,{enabled:o=!0,role:i="dialog"}=t,c=f();return u.useMemo((()=>{const e={id:r,role:i};return o?"tooltip"===i?{reference:{"aria-describedby":n?r:void 0},floating:e}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":"alertdialog"===i?"dialog":i,"aria-controls":n?r:void 0,..."listbox"===i&&{role:"combobox"},..."menu"===i&&{id:c}},floating:{...e,..."menu"===i&&{"aria-labelledby":c}}}:{}}),[o,i,n,r,c])},e.useTransitionStatus=Ge,e.useTransitionStyles=function(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:r,close:o,common:i,duration:l=250}=t,s=e.placement,a=s.split("-")[0],f=u.useMemo((()=>({side:a,placement:s})),[a,s]),d="number"==typeof l,m=(d?l:l.open)||0,p=(d?l:l.close)||0,[v,g]=u.useState((()=>({...Ye(i,f),...Ye(n,f)}))),{isMounted:h,status:y}=Ge(e,{duration:l}),b=P(n),w=P(r),E=P(o),R=P(i);return c((()=>{const e=Ye(b.current,f),t=Ye(E.current,f),n=Ye(R.current,f),r=Ye(w.current,f)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===y&&g((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===y&&g({transitionProperty:Object.keys(r).map(Xe).join(","),transitionDuration:m+"ms",...n,...r}),"close"===y){const r=t||e;g({transitionProperty:Object.keys(r).map(Xe).join(","),transitionDuration:p+"ms",...n,...r})}}),[p,E,b,w,R,m,y,f]),{isMounted:h,styles:v}},e.useTypeahead=function(e,t){var n;const{open:r,dataRef:o}=e,{listRef:i,activeIndex:l,onMatch:s,onTypingChange:a,enabled:f=!0,findMatch:d=null,resetMs:m=750,ignoreKeys:p=[],selectedIndex:v=null}=t,g=u.useRef(),h=u.useRef(""),y=u.useRef(null!=(n=null!=v?v:l)?n:-1),b=u.useRef(null),w=Pe(s),E=Pe(a),R=P(d),x=P(p);return c((()=>{r&&(clearTimeout(g.current),b.current=null,h.current="")}),[r]),c((()=>{var e;r&&""===h.current&&(y.current=null!=(e=null!=v?v:l)?e:-1)}),[r,v,l]),u.useMemo((()=>{if(!f)return{};function e(e){e?o.current.typing||(o.current.typing=e,E(e)):o.current.typing&&(o.current.typing=e,E(e))}function t(e,t,n){const r=R.current?R.current(t,n):t.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(n.toLocaleLowerCase()))));return r?e.indexOf(r):-1}function n(n){const o=i.current;if(h.current.length>0&&" "!==h.current[0]&&(-1===t(o,o,h.current)?e(!1):" "===n.key&&ce(n)),null==o||x.current.includes(n.key)||1!==n.key.length||n.ctrlKey||n.metaKey||n.altKey)return;r&&" "!==n.key&&(ce(n),e(!0));o.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&h.current===n.key&&(h.current="",y.current=b.current),h.current+=n.key,clearTimeout(g.current),g.current=setTimeout((()=>{h.current="",y.current=b.current,e(!1)}),m);const u=y.current,c=t(o,[...o.slice((u||0)+1),...o.slice(0,(u||0)+1)],h.current);-1!==c?(w(c),b.current=c):" "!==n.key&&(h.current="",e(!1))}return{reference:{onKeyDown:n},floating:{onKeyDown:n,onKeyUp(t){" "===t.key&&e(!1)}}}}),[f,r,o,i,m,x,R,w,E])},Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "@floating-ui/react", | ||
"version": "0.24.0", | ||
"version": "0.24.1", | ||
"@rollingversions": { | ||
@@ -5,0 +5,0 @@ "baseVersion": [ |
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
567510
12904