@floating-ui/react
Advanced tools
Comparing version 0.14.0 to 0.15.0
@@ -1,1 +0,1 @@ | ||
import{useFloating as e,offset as t,detectOverflow as n,getOverflowAncestors as r}from"@floating-ui/react-dom";export*from"@floating-ui/react-dom";import*as o from"react";import{useLayoutEffect as u,useEffect as c,useRef as i}from"react";import{createPortal as l,flushSync as s}from"react-dom";import{tabbable as a}from"tabbable";import{hideOthers as f}from"aria-hidden";var d="undefined"!=typeof document?u:c;function v(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter((e=>e!==n)))}}}let m=!1,p=0;const g=()=>"floating-ui-"+p++;const b=o["useId".toString()],h=null!=b?b:function(){const[e,t]=o.useState((()=>m?g():void 0));return d((()=>{null==e&&t(g())}),[]),o.useEffect((()=>{m||(m=!0)}),[]),e},y=o.createContext(null),w=o.createContext(null),E=()=>{var e,t;return null!=(e=null==(t=o.useContext(y))?void 0:t.id)?e:null},R=()=>o.useContext(w),x=e=>{const t=h(),n=R(),r=E(),o=e||r;return d((()=>{const e={id:t,parentId:o};return null==n||n.addNode(e),()=>{null==n||n.removeNode(e)}}),[n,t,o]),t},k=e=>{let{children:t,id:n}=e;const r=E();return o.createElement(y.Provider,{value:o.useMemo((()=>({id:n,parentId:r})),[n,r])},t)},I=e=>{let{children:t}=e;const n=o.useRef([]),r=o.useCallback((e=>{n.current=[...n.current,e]}),[]),u=o.useCallback((e=>{n.current=n.current.filter((t=>t!==e))}),[]),c=o.useState((()=>v()))[0];return o.createElement(w.Provider,{value:o.useMemo((()=>({nodesRef:n,addNode:r,removeNode:u,events:c})),[n,r,u,c])},t)};function T(e){var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document}function C(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function L(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}function M(e){var t;return null!=(t=T(e).defaultView)?t:window}function A(e){return!!e&&e instanceof M(e).Element}function O(e){return!!e&&e instanceof M(e).HTMLElement}function S(e){if(0===e.mozInputSource&&e.isTrusted)return!0;const t=/Android/i;return(t.test(C())||t.test(L()))&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType}function P(e){return 0===e.width&&0===e.height||1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"!==e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail}function D(){return/apple/i.test(navigator.vendor)}function F(){return C().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}const H=o["useInsertionEffect".toString()]||(e=>e());function K(e){const t=o.useRef((()=>{}));return H((()=>{t.current=e})),o.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 N(t){let{open:n=!1,onOpenChange:r,whileElementsMounted:u,placement:c,middleware:i,strategy:l,nodeId:s}=void 0===t?{}:t;const[a,f]=o.useState(null),m=R(),p=o.useRef(null),g=o.useRef({}),b=o.useState((()=>v()))[0],h=e({placement:c,middleware:i,strategy:l,whileElementsMounted:u}),y=K(r),w=o.useMemo((()=>({...h.refs,domReference:p})),[h.refs]),E=o.useMemo((()=>({...h,refs:w,dataRef:g,nodeId:s,events:b,open:n,onOpenChange:y,_:{domReference:a}})),[h,s,b,n,y,w,a]);d((()=>{const e=null==m?void 0:m.nodesRef.current.find((e=>e.id===s));e&&(e.context=E)}));const{reference:x}=h,k=o.useCallback((e=>{(A(e)||null===e)&&(E.refs.domReference.current=e,f(e)),x(e)}),[x,E.refs]);return o.useMemo((()=>({...h,context:E,refs:w,reference:k})),[h,w,E,k])}function j(e,t,n){const r=new Map;return{..."floating"===n&&{tabIndex:-1},...e,...t.map((e=>e?e[n]:null)).concat(e).reduce(((e,t)=>t?(Object.entries(t).forEach((t=>{let[n,o]=t;var u;0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof o&&(null==(u=r.get(n))||u.push(o),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),u=0;u<t;u++)o[u]=arguments[u];null==(e=r.get(n))||e.forEach((e=>e(...o)))})):e[n]=o})),e):e),{})}}const B=function(e){void 0===e&&(e=[]);const t=e,n=o.useCallback((t=>j(t,e,"reference")),t),r=o.useCallback((t=>j(t,e,"floating")),t),u=o.useCallback((t=>j(t,e,"item")),t);return o.useMemo((()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:u})),[n,r,u])};function W(e,t){if(!e||!t)return!1;const n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&(r=n,"undefined"!=typeof ShadowRoot&&(r instanceof M(r).ShadowRoot||r instanceof ShadowRoot))){let n=t;do{if(n&&e===n)return!0;n=n.parentNode||n.host}while(n)}var r;return!1}function V(e,t){var n;let r=null!=(n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})))?n:[],o=r;for(;o.length;){var u;o=null!=(u=e.filter((e=>{var t;return null==(t=o)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})))?u:[],r=r.concat(o)}return r}function _(e){return"composedPath"in e?e.composedPath()[0]:e.target}function X(e){let t,{restMs:n=0,buffer:r=.5,blockPointerEvents:o=!0,debug:u=null}=void 0===e?{}:e,c=!1;const i=e=>{let{x:o,y:u,placement:i,refs:l,onClose:s,nodeId:a,tree:f,leave:d=!1}=e;return function(e){function v(){clearTimeout(t),s()}clearTimeout(t);const{clientX:m,clientY:p}=e,g=_(e);if("mousemove"===e.type&&W(l.domReference.current,g))return;if("mouseleave"===e.type&&A(e.relatedTarget)&&W(l.floating.current,e.relatedTarget))return;if(f&&V(f.nodesRef.current,a).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if(W(l.floating.current,g)&&!d)return void(c=!0);if(!l.domReference.current||!l.floating.current||null==i||null==o||null==u)return;const b=l.domReference.current.getBoundingClientRect(),h=l.floating.current.getBoundingClientRect(),y=i.split("-")[0],w=o>h.right-h.width/2,E=u>h.bottom-h.height/2;if("top"===y&&u>=b.bottom-1||"bottom"===y&&u<=b.top+1||"left"===y&&o>=b.right-1||"right"===y&&o<=b.left+1)return v();switch(y){case"top":if(m>=h.left&&m<=h.right&&p>=h.top&&p<=b.top+1)return;break;case"bottom":if(m>=h.left&&m<=h.right&&p>=b.bottom-1&&p<=h.bottom)return;break;case"left":if(m>=h.left&&m<=b.left+1&&p>=h.top&&p<=h.bottom)return;break;case"right":if(m>=b.right-1&&m<=h.right&&p>=h.top&&p<=h.bottom)return}if(c)return v();const R=function(e){let[t,n]=e;const o=h.width>b.width,u=h.height>b.height;switch(y){case"top":return[[o?t+r/2:w?t+4*r:t-4*r,n+r+1],[o?t-r/2:w?t+4*r:t-4*r,n+r+1],...[[h.left,w||o?h.bottom-r:h.top],[h.right,w?o?h.bottom-r:h.top:h.bottom-r]]];case"bottom":return[[o?t+r/2:w?t+4*r:t-4*r,n-r],[o?t-r/2:w?t+4*r:t-4*r,n-r],...[[h.left,w||o?h.top+r:h.bottom],[h.right,w?o?h.top+r:h.bottom:h.top+r]]];case"left":{const e=[t+r+1,u?n+r/2:E?n+4*r:n-4*r],o=[t+r+1,u?n-r/2:E?n+4*r:n-4*r];return[...[[E||u?h.right-r:h.left,h.top],[E?u?h.right-r:h.left:h.right-r,h.bottom]],e,o]}case"right":return[[t-r,u?n+r/2:E?n+4*r:n-4*r],[t-r,u?n-r/2:E?n+4*r:n-4*r],...[[E||u?h.left+r:h.right,h.top],[E?u?h.left+r:h.right:h.left+r,h.bottom]]]}}([o,u]);!function(e,t){const[n,r]=e;let o=!1;const u=t.length;for(let e=0,c=u-1;e<u;c=e++){const[u,i]=t[e]||[0,0],[l,s]=t[c]||[0,0];i>=r!=s>=r&&n<=(l-u)*(r-i)/(s-i)+u&&(o=!o)}return o}([m,p],R)?v():n&&(t=setTimeout(s,n))}};return i.__options={blockPointerEvents:o},i}function Y(){return Y=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},Y.apply(this,arguments)}const q={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};let U,z;function G(e){"Tab"===e.key&&(U=e.target,clearTimeout(z))}const J=o.forwardRef((function(e,t){const n=K(e.onFocus),[r,u]=o.useState();return d((()=>(D()&&u("button"),document.addEventListener("keydown",G),()=>{document.removeEventListener("keydown",G)})),[]),o.createElement("span",Y({},e,{ref:t,tabIndex:0,role:r,"aria-hidden":!r||void 0,"data-floating-ui-focus-guard":"",style:q,onFocus:e=>{D()&&F()&&!function(e){const t=U===e.relatedTarget;return U=e.relatedTarget,clearTimeout(z),t}(e)?(e.persist(),z=window.setTimeout((()=>{n(e)}),50)):n(e)}}))}));function Q(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(r=n.shadowRoot)?void 0:r.activeElement);){var n,r;t=t.shadowRoot.activeElement}return t}const Z=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function $(e,t){const n=a(e,Z());"prev"===t&&n.reverse();const r=n.indexOf(Q(T(e)));return n.slice(r+1)[0]}function ee(){return $(document.body,"next")}function te(){return $(document.body,"prev")}function ne(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!W(n,r)}function re(e){a(e,Z()).forEach((e=>{var t;e.dataset.tabindex=null!=(t=e.getAttribute("tabindex"))?t:"",e.setAttribute("tabindex","-1")}))}function oe(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const ue=o.createContext(null),ce=function(e){let{id:t,enabled:n=!0}=void 0===e?{}:e;const[r,u]=o.useState(null),c=h(),i=le();return d((()=>{if(!n)return;const e=t?document.getElementById(t):null;if(!e){const e=document.createElement("div");e.id=t||c,e.setAttribute("data-floating-ui-portal",""),u(e);const n=(null==i?void 0:i.portalNode)||document.body;return n.appendChild(e),()=>{n.removeChild(e)}}e.setAttribute("data-floating-ui-portal",""),u(e)}),[t,i,c,n]),r},ie=e=>{let{children:t,id:n,root:r=null,preserveTabOrder:u=!0}=e;const c=ce({id:n,enabled:!r}),[i,s]=o.useState(null),a=o.useRef(null),f=o.useRef(null),d=o.useRef(null),v=o.useRef(null),m=!!i&&!i.modal&&!(!r&&!c)&&u;return o.useEffect((()=>{if(c&&u&&(null==i||!i.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&&ne(e)){("focusin"===e.type?oe:re)(c)}}}),[c,u,null==i?void 0:i.modal]),o.createElement(ue.Provider,{value:o.useMemo((()=>({preserveTabOrder:u,beforeOutsideRef:a,afterOutsideRef:f,beforeInsideRef:d,afterInsideRef:v,portalNode:c,setFocusManagerState:s})),[u,c])},m&&c&&o.createElement(J,{ref:a,onFocus:e=>{if(ne(e,c)){var t;null==(t=d.current)||t.focus()}else{const e=te()||(null==i?void 0:i.refs.domReference.current);null==e||e.focus()}}}),m&&c&&o.createElement("span",{"aria-owns":c.id,style:q}),r?l(t,r):c?l(t,c):null,m&&c&&o.createElement(J,{ref:f,onFocus:e=>{if(ne(e,c)){var t;null==(t=v.current)||t.focus()}else{const e=ee()||(null==i?void 0:i.refs.domReference.current);null==e||e.focus(),null==i||i.onOpenChange(!1)}}}))},le=()=>o.useContext(ue),se="data-floating-ui-scroll-lock",ae=o.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return d((()=>{var e,t,r,o;if(!n)return;if(document.body.hasAttribute(se))return;document.body.setAttribute(se,"");const u=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",c=window.innerWidth-document.documentElement.clientWidth;if(!/iP(hone|ad|od)|iOS/.test(C()))return Object.assign(document.body.style,{overflow:"hidden",[u]:c+"px"}),()=>{document.body.removeAttribute(se),Object.assign(document.body.style,{overflow:"",[u]:""})};const i=null!=(e=null==(t=window.visualViewport)?void 0:t.offsetLeft)?e:0,l=null!=(r=null==(o=window.visualViewport)?void 0:o.offsetTop)?r:0,s=window.pageXOffset,a=window.pageYOffset;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:-(a-Math.floor(l))+"px",left:-(s-Math.floor(i))+"px",right:"0",[u]:c+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[u]:""}),document.body.removeAttribute(se),window.scrollTo(s,a)}}),[n]),o.createElement("div",Y({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function fe(e){return O(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function de(e){e.preventDefault(),e.stopPropagation()}function ve(e){const t=i(e);return d((()=>{t.current=e})),t}let me=0;function pe(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(me);const u=()=>null==e?void 0:e.focus({preventScroll:n});o?u():me=requestAnimationFrame(u)}const ge=o.forwardRef((function(e,t){return o.createElement("button",Y({},e,{ref:t,tabIndex:-1,style:q}))}));function be(e){let{context:t,children:n,order:r=["content"],guards:u=!0,initialFocus:c=0,returnFocus:i=!0,modal:l=!0,visuallyHiddenDismiss:s=!1,closeOnFocusOut:v=!0}=e;const{refs:m,nodeId:p,onOpenChange:g,events:b,_:{domReference:h}}=t,y=ve(r),w=R(),E=le(),[x,k]=o.useState(null),I="number"==typeof c&&c<0,C=o.useRef(null),L=o.useRef(null),M=o.useRef(!1),A=o.useRef(null),S=null!=E,P=h&&"combobox"===h.getAttribute("role")&&fe(h),D=o.useCallback((function(e){return void 0===e&&(e=m.floating.current),e?a(e,Z()):[]}),[m]),F=o.useCallback((e=>{const t=D(e);return y.current.map((e=>m.domReference.current&&"reference"===e?m.domReference.current:m.floating.current&&"floating"===e?m.floating.current:t)).filter(Boolean).flat()}),[y,m,D]);o.useEffect((()=>{if(!l)return;function e(e){if("Tab"===e.key){0!==D().length||P||de(e);const t=F(),n=_(e);"reference"===y.current[0]&&n===m.domReference.current&&(de(e),e.shiftKey?pe(t[t.length-1]):pe(t[1])),"floating"===y.current[1]&&n===m.floating.current&&e.shiftKey&&(de(e),pe(t[0]))}}const t=T(m.floating.current);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[l,y,m,P,D,F]),o.useEffect((()=>{if(!v)return;const e=m.floating.current,t=m.domReference.current;let n=!1;function r(){n=!0,setTimeout((()=>{n=!1}))}function o(r){const o=r.relatedTarget,u=!(W(t,o)||W(e,o)||W(o,e)||W(null==E?void 0:E.portalNode,o)||[null==E?void 0:E.beforeOutsideRef.current,null==E?void 0:E.afterOutsideRef.current].filter(Boolean).includes(o)||w&&(V(w.nodesRef.current,p).find((e=>{var t,n;return W(null==(t=e.context)?void 0:t.refs.floating.current,o)||W(null==(n=e.context)?void 0:n.refs.domReference.current,o)}))||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}(w.nodesRef.current,p).find((e=>{var t,n;return(null==(t=e.context)?void 0:t.refs.floating.current)===o||(null==(n=e.context)?void 0:n.refs.domReference.current)===o}))));o&&u&&!n&&o!==A.current&&(M.current=!0,setTimeout((()=>g(!1))))}return e&&O(t)?(t.addEventListener("focusout",o),t.addEventListener("pointerdown",r),!l&&e.addEventListener("focusout",o),()=>{t.removeEventListener("focusout",o),t.removeEventListener("pointerdown",r),!l&&e.removeEventListener("focusout",o)}):void 0}),[l,p,w,m,E,g,v]),o.useEffect((()=>{var e,t;const n=m.floating.current,r=m.domReference.current,o=Array.from(null!=(e=null==E||null==(t=E.portalNode)?void 0:t.querySelectorAll("[data-floating-ui-portal]"))?e:[]);if(n&&O(r)&&l){const e=[n,...o,...[C.current,L.current].filter(Boolean)],t=f(y.current.includes("reference")||P?e.concat(r):e);return()=>{t()}}}),[l,y,E,m,P]),o.useEffect((()=>{const e=m.floating.current;if(l&&!u&&e){const t=[],n=Z(),r=a(T(e).body,n),o=F(),u=r.filter((e=>!o.includes(e)));return u.forEach(((e,n)=>{t[n]=e.getAttribute("tabindex"),e.setAttribute("tabindex","-1")})),()=>{u.forEach(((e,n)=>{const r=t[n];null==r?e.removeAttribute("tabindex"):e.setAttribute("tabindex",r)}))}}}),[l,u,m,F]),d((()=>{const e=m.floating.current;if(!e)return;const t=T(e);let n=i,r=!1;const o=Q(t);A.current=o;const u=F(e),l=("number"==typeof c?u[c]:c.current)||e;function s(e){if("escapeKey"===e.type&&m.domReference.current&&(A.current=m.domReference.current),"outsidePress"!==e.type)return;const t=e.data.returnFocus;"object"==typeof t?(n=!0,r=t.preventScroll):n=t}return!I&&pe(l,{preventScroll:l===e}),b.on("dismiss",s),()=>{b.off("dismiss",s),W(e,Q(t))&&m.domReference.current&&(A.current=m.domReference.current),n&&O(A.current)&&!M.current&&pe(A.current,{preventScroll:r,cancelPrevious:!1})}}),[F,c,i,m,b,I]),d((()=>{if(E)return E.setFocusManagerState({...t,modal:l}),()=>{E.setFocusManagerState(null)}}),[E,l,t]),d((()=>{0!==D().length||I||k(0)}),[D,m,I]);const H=u&&(S||l)&&!P;function K(e){return s&&l?o.createElement(ge,{ref:"start"===e?C:L,onClick:()=>g(!1)},"string"==typeof s?s:"Dismiss"):null}return o.createElement(o.Fragment,null,H&&o.createElement(J,{ref:null==E?void 0:E.beforeInsideRef,onFocus:e=>{if(l){const e=F();pe("reference"===r[0]?e[0]:e[e.length-1])}else if(null!=E&&E.preserveTabOrder&&E.portalNode)if(M.current=!1,ne(e,E.portalNode)){const e=ee()||h;null==e||e.focus()}else{var t;null==(t=E.beforeOutsideRef.current)||t.focus()}}}),P?null:K("start"),o.cloneElement(n,0===x||r.includes("floating")?{tabIndex:0}:{}),K("end"),H&&o.createElement(J,{ref:null==E?void 0:E.afterInsideRef,onFocus:e=>{if(l)pe(F()[0]);else if(null!=E&&E.preserveTabOrder&&E.portalNode)if(M.current=!0,ne(e,E.portalNode)){const e=te()||h;null==e||e.focus()}else{var t;null==(t=E.afterOutsideRef.current)||t.focus()}}}))}const he=["mouse","pen","",void 0];function ye(e,t,n){return n&&!he.includes(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}const we=function(e,t){let{enabled:n=!0,delay:r=0,handleClose:u=null,mouseOnly:c=!1,restMs:i=0,move:l=!0}=void 0===t?{}:t;const{open:s,onOpenChange:a,dataRef:f,events:v,refs:m,_:p}=e,g=R(),b=E(),h=ve(u),y=ve(r),w=o.useRef(),x=o.useRef(),k=o.useRef(),I=o.useRef(),C=o.useRef(!0),L=o.useRef(!1),M=o.useCallback((()=>{var e;const t=null==(e=f.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[f]);o.useEffect((()=>{if(n)return v.on("dismiss",e),()=>{v.off("dismiss",e)};function e(){clearTimeout(x.current),clearTimeout(I.current),C.current=!0}}),[n,v,m]),o.useEffect((()=>{if(!n||!h.current||!s)return;function e(){M()&&a(!1)}const t=T(m.floating.current).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[m,s,a,n,h,f,M]);const O=o.useCallback((function(e){void 0===e&&(e=!0);const t=ye(y.current,"close",w.current);t&&!k.current?(clearTimeout(x.current),x.current=setTimeout((()=>a(!1)),t)):e&&(clearTimeout(x.current),a(!1))}),[y,a]),S=o.useCallback((()=>{k.current&&(T(m.floating.current).removeEventListener("mousemove",k.current),k.current=void 0)}),[m]),P=o.useCallback((()=>{T(m.floating.current).body.style.pointerEvents="",L.current=!1}),[m]);return o.useEffect((()=>{if(!n)return;function t(){return!!f.current.openEvent&&["click","mousedown"].includes(f.current.openEvent.type)}function r(e){if(clearTimeout(x.current),C.current=!1,c&&!he.includes(w.current)||i>0&&0===ye(y.current,"open"))return;f.current.openEvent=e;const t=ye(y.current,"open",w.current);t?x.current=setTimeout((()=>{a(!0)}),t):a(!0)}function o(n){if(t())return;const r=T(m.floating.current);if(clearTimeout(I.current),h.current)return clearTimeout(x.current),k.current&&r.removeEventListener("mousemove",k.current),k.current=h.current({...e,tree:g,x:n.clientX,y:n.clientY,onClose(){P(),S(),O()}}),void r.addEventListener("mousemove",k.current);O()}function u(n){t()||null==h.current||h.current({...e,tree:g,x:n.clientX,y:n.clientY,leave:!0,onClose(){P(),S(),O()}})(n)}const d=m.floating.current,v=m.domReference.current;return A(v)?(s&&v.addEventListener("mouseleave",u),null==d||d.addEventListener("mouseleave",u),l&&v.addEventListener("mousemove",r,{once:!0}),v.addEventListener("mouseenter",r),v.addEventListener("mouseleave",o),()=>{s&&v.removeEventListener("mouseleave",u),null==d||d.removeEventListener("mouseleave",u),l&&v.removeEventListener("mousemove",r),v.removeEventListener("mouseenter",r),v.removeEventListener("mouseleave",o)}):void 0}),[p.domReference,n,e,c,i,l,O,S,P,a,s,g,m,y,h,f]),d((()=>{if(n&&s&&h.current&&h.current.__options.blockPointerEvents&&M()){T(m.floating.current).body.style.pointerEvents="none",L.current=!0;const n=m.domReference.current,r=m.floating.current;if(A(n)&&r){var e,t;const o=null==g||null==(e=g.nodesRef.current.find((e=>e.id===b)))||null==(t=e.context)?void 0:t.refs.floating.current;return o&&(o.style.pointerEvents=""),n.style.pointerEvents="auto",r.style.pointerEvents="auto",()=>{n.style.pointerEvents="",r.style.pointerEvents=""}}}}),[n,s,b,m,g,h,f,M]),d((()=>{s||(w.current=void 0,S(),L.current&&P())}),[s,S,P]),o.useEffect((()=>()=>{S(),clearTimeout(x.current),clearTimeout(I.current),L.current&&P()}),[n,S,P]),o.useMemo((()=>{if(!n)return{};function e(e){w.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){s||0===i||(clearTimeout(I.current),I.current=setTimeout((()=>{C.current||a(!0)}),i))}},floating:{onMouseEnter(){clearTimeout(x.current)},onMouseLeave(){O(!1)}}}}),[n,i,s,a,O])},Ee=o.createContext({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),Re=()=>o.useContext(Ee),xe=e=>{let{children:t,delay:n}=e;const[r,u]=o.useState({delay:n,initialDelay:n,currentId:null}),c=o.useCallback((e=>{u((t=>({...t,currentId:e})))}),[]);return o.createElement(Ee.Provider,{value:o.useMemo((()=>({...r,setState:u,setCurrentId:c})),[r,u,c])},t)},ke=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:u}=t;const{currentId:c,initialDelay:i,setState:l}=Re();o.useEffect((()=>{c&&(l((e=>({...e,delay:{open:1,close:ye(i,"close")}}))),c!==u&&r(!1))}),[u,r,l,c,i]),o.useEffect((()=>{n||c!==u||(r(!1),l((e=>({...e,delay:i,currentId:null}))))}),[n,l,c,u,r,i])};function Ie(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Te=e=>({name:"inner",options:e,async fn(r){var o;const{listRef:u,overflowRef:c,onFallbackChange:i,offset:l=0,index:a=0,minItemsVisible:f=4,referenceOverflowThreshold:d=0,scrollRef:v,...m}=e,{rects:p,elements:{floating:g}}=r,b=u.current[a];if(!b)return{};const h={...r,...await t(-b.offsetTop-p.reference.height/2-b.offsetHeight/2-l).fn(r)},y=null!=(o=null==v?void 0:v.current)?o:g,w=await n(Ie(h,y.scrollHeight),m),E=await n(h,{...m,elementContext:"reference"}),R=Math.max(0,w.top),x=h.y+R,k=Math.max(0,y.scrollHeight-R-Math.max(0,w.bottom));return y.style.maxHeight=k+"px",y.scrollTop=R,i&&(y.offsetHeight<b.offsetHeight*Math.min(f,u.current.length-1)-1||E.top>=-d||E.bottom>=-d?s((()=>i(!0))):s((()=>i(!1)))),c&&(c.current=await n(Ie({...h,y:x},y.offsetHeight),m)),{y:x}}}),Ce=(e,t)=>{let{open:n,refs:r}=e,{enabled:u=!0,overflowRef:c,scrollRef:i,onChange:l}=t;const a=K(l),f=o.useRef(!1),d=o.useRef(null),v=o.useRef(null);return o.useEffect((()=>{var e;if(!u)return;function t(e){if(e.ctrlKey||!o||null==c.current)return;const t=e.deltaY,n=c.current.top>=-.5,r=c.current.bottom>=-.5,u=o.scrollHeight-o.clientHeight,i=t<0?-1:1,l=t<0?"max":"min";o.scrollHeight<=o.clientHeight||(!n&&t>0||!r&&t<0?(e.preventDefault(),s((()=>{a((e=>e+Math[l](t,u*i)))}))):/firefox/i.test(L())&&(o.scrollTop+=t))}const o=null!=(e=null==i?void 0:i.current)?e:r.floating.current;return n&&o?(o.addEventListener("wheel",t),requestAnimationFrame((()=>{d.current=o.scrollTop,null!=c.current&&(v.current={...c.current})})),()=>{d.current=null,v.current=null,o.removeEventListener("wheel",t)}):void 0}),[u,n,r,c,i,a]),o.useMemo((()=>u?{floating:{onKeyDown(){f.current=!0},onWheel(){f.current=!1},onPointerMove(){f.current=!1},onScroll(){const e=(null==i?void 0:i.current)||r.floating.current;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)&&s((()=>a((e=>e+t))))}requestAnimationFrame((()=>{d.current=e.scrollTop}))}}}}:{}),[u,c,r,i,a])},Le=function(e,t){let{open:n}=e,{enabled:r=!0,role:u="dialog"}=void 0===t?{}:t;const c=h(),i=h();return o.useMemo((()=>{const e={id:c,role:u};return r?"tooltip"===u?{reference:{"aria-describedby":n?c:void 0},floating:e}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":"alertdialog"===u?"dialog":u,"aria-controls":n?c:void 0,..."listbox"===u&&{role:"combobox"},..."menu"===u&&{id:i}},floating:{...e,..."menu"===u&&{"aria-labelledby":i}}}:{}}),[r,u,n,c,i])};function Me(e){return O(e.target)&&"BUTTON"===e.target.tagName}function Ae(e){return fe(e)}const Oe=function(e,t){let{open:n,onOpenChange:r,dataRef:u,refs:c}=e,{enabled:i=!0,event:l="click",toggle:s=!0,ignoreMouse:a=!1,keyboardHandlers:f=!0}=void 0===t?{}:t;const d=o.useRef();return o.useMemo((()=>i?{reference:{onPointerDown(e){d.current=e.pointerType},onMouseDown(e){0===e.button&&("mouse"===d.current&&a||"click"!==l&&(n?!s||u.current.openEvent&&"mousedown"!==u.current.openEvent.type||r(!1):(e.preventDefault(),r(!0)),u.current.openEvent=e.nativeEvent))},onClick(e){"mousedown"===l&&d.current?d.current=void 0:"mouse"===d.current&&a||(n?!s||u.current.openEvent&&"click"!==u.current.openEvent.type||r(!1):r(!0),u.current.openEvent=e.nativeEvent)},onKeyDown(e){d.current=void 0,f&&(Me(e)||(" "!==e.key||Ae(c.domReference.current)||e.preventDefault(),"Enter"===e.key&&(n?s&&r(!1):r(!0))))},onKeyUp(e){f&&(Me(e)||Ae(c.domReference.current)||" "===e.key&&(n?s&&r(!1):r(!0)))}}}:{}),[i,u,l,a,f,c,s,n,r])};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 Pe={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},De={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Fe=function(e,t){let{open:n,onOpenChange:u,refs:c,events:i,nodeId:l}=e,{enabled:s=!0,escapeKey:a=!0,outsidePress:f=!0,outsidePressEvent:d="pointerdown",referencePress:v=!1,referencePressEvent:m="pointerdown",ancestorScroll:p=!1,bubbles:g=!0}=void 0===t?{}:t;const b=R(),h=null!=E(),y=K("function"==typeof f?f:()=>!1),w="function"==typeof f?y:f,x=o.useRef(!1);return o.useEffect((()=>{if(!n||!s)return;function e(e){if("Escape"===e.key){if(!g&&b&&V(b.nodesRef.current,l).length>0)return;i.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),u(!1)}}function t(e){const t=x.current;if(x.current=!1,t)return;if("function"==typeof w&&!w(e))return;const n=_(e);if(A(n)&&c.floating.current){var r;const t=null!=(r=c.floating.current.ownerDocument.defaultView)?r:window,o=n.scrollWidth>n.clientWidth,u=n.scrollHeight>n.clientHeight;let i=u&&e.offsetX>n.clientWidth;if(u){"rtl"===t.getComputedStyle(n).direction&&(i=e.offsetX<=n.offsetWidth-n.clientWidth)}if(i||o&&e.offsetY>n.clientHeight)return}const o=b&&V(b.nodesRef.current,l).some((t=>{var n;return Se(e,null==(n=t.context)?void 0:n.refs.floating.current)}));Se(e,c.floating.current)||Se(e,c.domReference.current)||o||!g&&b&&V(b.nodesRef.current,l).length>0||(i.emit("dismiss",{type:"outsidePress",data:{returnFocus:h?{preventScroll:!0}:S(e)||P(e)}}),u(!1))}function o(){u(!1)}const f=T(c.floating.current);a&&f.addEventListener("keydown",e),w&&f.addEventListener(d,t);let v=[];return p&&(A(c.domReference.current)&&(v=r(c.domReference.current)),A(c.floating.current)&&(v=v.concat(r(c.floating.current))),!A(c.reference.current)&&c.reference.current&&c.reference.current.contextElement&&(v=v.concat(r(c.reference.current.contextElement)))),v=v.filter((e=>{var t;return e!==(null==(t=f.defaultView)?void 0:t.visualViewport)})),v.forEach((e=>{e.addEventListener("scroll",o,{passive:!0})})),()=>{a&&f.removeEventListener("keydown",e),w&&f.removeEventListener(d,t),v.forEach((e=>{e.removeEventListener("scroll",o)}))}}),[a,w,d,i,b,l,n,u,p,s,g,c,h]),o.useEffect((()=>{x.current=!1}),[w,d]),o.useMemo((()=>s?{reference:{[Pe[m]]:()=>{v&&(i.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),u(!1))}},floating:{[De[d]]:()=>{x.current=!0}}}:{}),[s,i,v,d,m,u])},He=function(e,t){let{open:n,onOpenChange:r,dataRef:u,refs:c,events:i}=e,{enabled:l=!0,keyboardOnly:s=!0}=void 0===t?{}:t;const a=o.useRef(""),f=o.useRef(!1),d=o.useRef();return o.useEffect((()=>{var e;if(!l)return;const t=null!=(e=T(c.floating.current).defaultView)?e:window;function r(){!n&&O(c.domReference.current)&&c.domReference.current===Q(T(c.domReference.current))&&(f.current=!0)}return t.addEventListener("blur",r),()=>{t.removeEventListener("blur",r)}}),[c,n,l]),o.useEffect((()=>{if(l)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(e){"referencePress"!==e.type&&"escapeKey"!==e.type||(f.current=!0)}}),[i,l]),o.useEffect((()=>()=>{clearTimeout(d.current)}),[]),o.useMemo((()=>l?{reference:{onPointerDown(e){let{pointerType:t}=e;a.current=t,f.current=!(!t||!s)},onMouseLeave(){f.current=!1},onFocus(e){var t;f.current||"focus"===e.type&&"mousedown"===(null==(t=u.current.openEvent)?void 0:t.type)&&u.current.openEvent&&Se(u.current.openEvent,c.domReference.current)||(u.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){f.current=!1;const t=e.relatedTarget,n=A(t)&&t.hasAttribute("data-floating-ui-focus-guard");d.current=setTimeout((()=>{W(c.floating.current,t)||W(c.domReference.current,t)||n||r(!1)}))}}}:{}),[l,s,c,u,r])};let Ke=!1;function Ne(e,t,n){return Math.floor(e/t)!==n}function je(e,t){return t<0||t>=e.current.length}function Be(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o,amount:u=1}=void 0===t?{}:t;const c=e.current;let i=n;do{var l,s;i+=r?-u:u}while(i>=0&&i<=c.length-1&&(o?o.includes(i):null==c[i]||(null==(l=c[i])?void 0:l.hasAttribute("disabled"))||"true"===(null==(s=c[i])?void 0:s.getAttribute("aria-disabled"))));return i}function We(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Ve(e,t){return We(t,"ArrowUp"===e||"ArrowDown"===e,"ArrowLeft"===e||"ArrowRight"===e)}function _e(e,t,n){return We(t,"ArrowDown"===e,n?"ArrowLeft"===e:"ArrowRight"===e)||"Enter"===e||" "==e||""===e}function Xe(e,t){return Be(e,{disabledIndices:t})}function Ye(e,t){return Be(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}const qe=function(e,t){let{open:n,onOpenChange:r,refs:u}=e,{listRef:c,activeIndex:i,onNavigate:l=(()=>{}),enabled:a=!0,selectedIndex:f=null,allowEscape:v=!1,loop:m=!1,nested:p=!1,rtl:g=!1,virtual:b=!1,focusItemOnOpen:h="auto",focusItemOnHover:y=!0,openOnArrowKeyDown:w=!0,disabledIndices:x,orientation:k="vertical",cols:I=1}=void 0===t?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:t;const C=E(),L=R(),M=K(l),A=o.useRef(h),H=o.useRef(null!=f?f:-1),N=o.useRef(null),j=o.useRef(!1),B=o.useRef(M),V=o.useRef(n),_=o.useRef(!1),X=ve(x),Y=ve(n),[q,U]=o.useState(),z=o.useCallback(((e,t)=>{if(b){var n;U(null==(n=e.current[t.current])?void 0:n.id)}else{pe(e.current[t.current],{preventScroll:!0,sync:!(!F()||!D())&&(Ke||_.current)})}}),[b]);return d((()=>{document.createElement("div").focus({get preventScroll(){return Ke=!0,!1}})}),[]),d((()=>{a&&(n?A.current&&null!=f&&M(f):V.current&&(H.current=-1,B.current(null)))}),[a,n,f,M]),d((()=>{if(a&&n)if(null==i){if(_.current=!1,null!=f)return;V.current&&(H.current=-1,z(c,H)),!V.current&&A.current&&(null!=N.current||!0===A.current&&null==N.current)&&(H.current=null==N.current||_e(N.current,k,g)||p?Xe(c,X.current):Ye(c,X.current),M(H.current))}else je(c,i)||(H.current=i,z(c,H))}),[a,n,i,f,p,c,k,g,M,z,X]),d((()=>{if(a&&V.current&&!n){var e,t;const n=null==L||null==(e=L.nodesRef.current.find((e=>e.id===C)))||null==(t=e.context)?void 0:t.refs.floating.current;n&&!W(n,Q(T(n)))&&n.focus({preventScroll:!0})}}),[a,n,L,C]),d((()=>{N.current=null,B.current=M,V.current=n})),o.useMemo((()=>{if(!a)return{};const e=X.current;function t(t){if(j.current=!0,_.current=!0,!Y.current&&t.currentTarget===u.floating.current)return;if(p&&function(e,t,n){return We(t,n?"ArrowRight"===e:"ArrowLeft"===e,"ArrowUp"===e)}(t.key,k,g))return de(t),r(!1),void(O(u.domReference.current)&&u.domReference.current.focus());const o=H.current,i=Xe(c,e),l=Ye(c,e);if("Home"===t.key&&(H.current=i,M(H.current)),"End"===t.key&&(H.current=l,M(H.current)),I>1){const n=H.current;if("ArrowUp"===t.key){if(de(t),-1===n)H.current=l;else if(H.current=Be(c,{startingIndex:n,amount:I,decrement:!0,disabledIndices:e}),m&&(n-I<i||H.current<0)){const e=n%I,t=l%I,r=l-(t-e);H.current=t===e?l:t>e?r:r-I}je(c,H.current)&&(H.current=n),M(H.current)}if("ArrowDown"===t.key&&(de(t),-1===n?H.current=i:(H.current=Be(c,{startingIndex:n,amount:I,disabledIndices:e}),m&&n+I>l&&(H.current=Be(c,{startingIndex:n%I-I,amount:I,disabledIndices:e}))),je(c,H.current)&&(H.current=n),M(H.current)),"both"===k){const r=Math.floor(n/I);"ArrowRight"===t.key&&(de(t),n%I!=I-1?(H.current=Be(c,{startingIndex:n,disabledIndices:e}),m&&Ne(H.current,I,r)&&(H.current=Be(c,{startingIndex:n-n%I-1,disabledIndices:e}))):m&&(H.current=Be(c,{startingIndex:n-n%I-1,disabledIndices:e})),Ne(H.current,I,r)&&(H.current=n)),"ArrowLeft"===t.key&&(de(t),n%I!=0?(H.current=Be(c,{startingIndex:n,disabledIndices:e,decrement:!0}),m&&Ne(H.current,I,r)&&(H.current=Be(c,{startingIndex:n+(I-n%I),decrement:!0,disabledIndices:e}))):m&&(H.current=Be(c,{startingIndex:n+(I-n%I),decrement:!0,disabledIndices:e})),Ne(H.current,I,r)&&(H.current=n));const o=Math.floor(l/I)===r;return je(c,H.current)&&(H.current=m&&o?"ArrowLeft"===t.key?l:Be(c,{startingIndex:n-n%I-1,disabledIndices:e}):n),void M(H.current)}}if(Ve(t.key,k)){if(de(t),n&&!b&&Q(t.currentTarget.ownerDocument)===t.currentTarget)return H.current=_e(t.key,k,g)?i:l,void M(H.current);_e(t.key,k,g)?H.current=m?o>=l?v&&o!==c.current.length?-1:i:Be(c,{startingIndex:o,disabledIndices:e}):Math.min(l,Be(c,{startingIndex:o,disabledIndices:e})):H.current=m?o<=i?v&&-1!==o?c.current.length:l:Be(c,{startingIndex:o,decrement:!0,disabledIndices:e}):Math.max(i,Be(c,{startingIndex:o,decrement:!0,disabledIndices:e})),je(c,H.current)?M(null):M(H.current)}}function o(e){"auto"===h&&S(e.nativeEvent)&&(A.current=!0)}return{reference:{...b&&n&&null!=i&&{"aria-activedescendant":q},onKeyDown(o){j.current=!0;const u=0===o.key.indexOf("Arrow");if(b&&n)return t(o);if(!n&&!w&&u)return;(u||"Enter"===o.key||" "===o.key||""===o.key)&&(N.current=o.key),p?function(e,t,n){return We(t,n?"ArrowLeft"===e:"ArrowRight"===e,"ArrowDown"===e)}(o.key,k,g)&&(de(o),n?(H.current=Xe(c,e),M(H.current)):r(!0)):Ve(o.key,k)&&(null!=f&&(H.current=f),de(o),!n&&w?r(!0):t(o),n&&M(H.current))},onFocus(){n&&M(null)},onPointerDown:function(e){A.current=h,"auto"===h&&P(e.nativeEvent)&&(A.current=!0)},onMouseDown:o,onClick:o},floating:{"aria-orientation":"both"===k?void 0:k,...b&&null!=i&&{"aria-activedescendant":q},onKeyDown:t,onPointerMove(){j.current=!1}},item:{onFocus(e){let{currentTarget:t}=e;const n=c.current.indexOf(t);-1!==n&&i!==n&&M(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...y&&{onMouseMove(e){let{currentTarget:t}=e;const n=t;if(n){const e=c.current.indexOf(n);-1!==e&&i!==e&&M(e)}},onPointerLeave(){var e;j.current||(H.current=-1,z(c,H),s((()=>M(null))),b||null==(e=u.floating.current)||e.focus({preventScroll:!0}))}}}}}),[q,X,Y,c,a,k,g,b,n,i,p,f,w,y,v,I,m,u,h,z,M,r])},Ue=function(e,t){var n;let{open:r,dataRef:u}=e,{listRef:c,activeIndex:i,onMatch:l=(()=>{}),enabled:s=!0,findMatch:a=null,resetMs:f=1e3,ignoreKeys:v=[],selectedIndex:m=null}=void 0===t?{listRef:{current:[]},activeIndex:null}:t;const p=o.useRef(),g=o.useRef(""),b=o.useRef(null!=(n=null!=m?m:i)?n:-1),h=o.useRef(null),y=K(l),w=ve(a),E=ve(v);return d((()=>{r&&(clearTimeout(p.current),h.current=null,g.current="")}),[r]),d((()=>{var e;r&&""===g.current&&(b.current=null!=(e=null!=m?m:i)?e:-1)}),[r,m,i]),o.useMemo((()=>{if(!s)return{};function e(e){const t=_(e.nativeEvent);if(A(t)&&Q(T(t))!==e.currentTarget&&t.closest('[role="dialog"],[role="menu"],[role="listbox"],[role="tree"],[role="grid"]')!==e.currentTarget)return;g.current.length>0&&" "!==g.current[0]&&(u.current.typing=!0," "===e.key&&de(e));const n=c.current;if(null==n||E.current.includes(e.key)||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey)return;n.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&g.current===e.key&&(g.current="",b.current=h.current),g.current+=e.key,clearTimeout(p.current),p.current=setTimeout((()=>{g.current="",b.current=h.current,u.current.typing=!1}),f);const r=b.current,o=[...n.slice((null!=r?r:0)+1),...n.slice(0,(null!=r?r:0)+1)],i=w.current?w.current(o,g.current):o.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(g.current.toLocaleLowerCase())))),l=i?n.indexOf(i):-1;-1!==l&&(y(l),h.current=l)}return{reference:{onKeyDown:e},floating:{onKeyDown:e}}}),[s,u,c,f,E,w,y])};export{xe as FloatingDelayGroup,be as FloatingFocusManager,k as FloatingNode,ae as FloatingOverlay,ie as FloatingPortal,I as FloatingTree,Te as inner,X as safePolygon,Oe as useClick,ke as useDelayGroup,Re as useDelayGroupContext,Fe as useDismiss,N as useFloating,x as useFloatingNodeId,E as useFloatingParentNodeId,ce as useFloatingPortalNode,R as useFloatingTree,He as useFocus,we as useHover,h as useId,Ce as useInnerOffset,B as useInteractions,qe as useListNavigation,Le as useRole,Ue as useTypeahead}; | ||
import{useFloating as e,offset as t,detectOverflow as n,getOverflowAncestors as r}from"@floating-ui/react-dom";export*from"@floating-ui/react-dom";import*as o from"react";import{useLayoutEffect as u,useEffect as c,useRef as i}from"react";import{createPortal as l,flushSync as s}from"react-dom";import{tabbable as a}from"tabbable";import{hideOthers as f}from"aria-hidden";var d="undefined"!=typeof document?u:c;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){e.set(t,(e.get(t)||[]).filter((e=>e!==n)))}}}let v=!1,p=0;const g=()=>"floating-ui-"+p++;const b=o["useId".toString()],h=null!=b?b:function(){const[e,t]=o.useState((()=>v?g():void 0));return d((()=>{null==e&&t(g())}),[]),o.useEffect((()=>{v||(v=!0)}),[]),e},y=o.createContext(null),w=o.createContext(null),E=()=>{var e,t;return null!=(e=null==(t=o.useContext(y))?void 0:t.id)?e:null},R=()=>o.useContext(w),x=e=>{const t=h(),n=R(),r=E(),o=e||r;return d((()=>{const e={id:t,parentId:o};return null==n||n.addNode(e),()=>{null==n||n.removeNode(e)}}),[n,t,o]),t},I=e=>{let{children:t,id:n}=e;const r=E();return o.createElement(y.Provider,{value:o.useMemo((()=>({id:n,parentId:r})),[n,r])},t)},k=e=>{let{children:t}=e;const n=o.useRef([]),r=o.useCallback((e=>{n.current=[...n.current,e]}),[]),u=o.useCallback((e=>{n.current=n.current.filter((t=>t!==e))}),[]),c=o.useState((()=>m()))[0];return o.createElement(w.Provider,{value:o.useMemo((()=>({nodesRef:n,addNode:r,removeNode:u,events:c})),[n,r,u,c])},t)};function T(e){var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document}function C(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function L(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}function M(e){var t;return null!=(t=T(e).defaultView)?t:window}function A(e){return!!e&&e instanceof M(e).Element}function O(e){return!!e&&e instanceof M(e).HTMLElement}function S(e){if(0===e.mozInputSource&&e.isTrusted)return!0;const t=/Android/i;return(t.test(C())||t.test(L()))&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType}function P(e){return 0===e.width&&0===e.height||1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"!==e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail}function D(){return/apple/i.test(navigator.vendor)}function F(){return C().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function K(e){return["mouse","pen","",void 0].includes(e)}const N=o["useInsertionEffect".toString()]||(e=>e());function H(e){const t=o.useRef((()=>{}));return N((()=>{t.current=e})),o.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 B(t){let{open:n=!1,onOpenChange:r,whileElementsMounted:u,placement:c,middleware:i,strategy:l,nodeId:s}=void 0===t?{}:t;const[a,f]=o.useState(null),v=R(),p=o.useRef(null),g=o.useRef({}),b=o.useState((()=>m()))[0],h=e({open:n,placement:c,middleware:i,strategy:l,whileElementsMounted:u}),y=H(r),w=o.useMemo((()=>({...h.refs,domReference:p})),[h.refs]),E=o.useMemo((()=>({...h,refs:w,dataRef:g,nodeId:s,events:b,open:n,onOpenChange:y,_:{domReference:a}})),[h,s,b,n,y,w,a]);d((()=>{const e=null==v?void 0:v.nodesRef.current.find((e=>e.id===s));e&&(e.context=E)}));const{reference:x}=h,I=o.useCallback((e=>{(A(e)||null===e)&&(E.refs.domReference.current=e,f(e)),(null===E.refs.reference.current||A(E.refs.reference.current))&&x(e)}),[x,E.refs]),k=o.useCallback((e=>{const t=A(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;x(t)}),[x]);return o.useMemo((()=>({...h,context:E,refs:w,reference:I,positionReference:k})),[h,w,E,I,k])}function V(e,t,n){const r=new Map;return{..."floating"===n&&{tabIndex:-1},...e,...t.map((e=>e?e[n]:null)).concat(e).reduce(((e,t)=>t?(Object.entries(t).forEach((t=>{let[n,o]=t;var u;0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof o&&(null==(u=r.get(n))||u.push(o),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),u=0;u<t;u++)o[u]=arguments[u];null==(e=r.get(n))||e.forEach((e=>e(...o)))})):e[n]=o})),e):e),{})}}const j=function(e){void 0===e&&(e=[]);const t=e,n=o.useCallback((t=>V(t,e,"reference")),t),r=o.useCallback((t=>V(t,e,"floating")),t),u=o.useCallback((t=>V(t,e,"item")),t);return o.useMemo((()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:u})),[n,r,u])};function W(e,t){if(!e||!t)return!1;const n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&(r=n,"undefined"!=typeof ShadowRoot&&(r instanceof M(r).ShadowRoot||r instanceof ShadowRoot))){let n=t;do{if(n&&e===n)return!0;n=n.parentNode||n.host}while(n)}var r;return!1}function q(e,t){var n;let r=null!=(n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})))?n:[],o=r;for(;o.length;){var u;o=null!=(u=e.filter((e=>{var t;return null==(t=o)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})))?u:[],r=r.concat(o)}return r}function X(e){return"composedPath"in e?e.composedPath()[0]:e.target}const Y="http://www.w3.org/2000/svg";function z(e){e.current&&(e.current.remove(),e.current=null)}function U(e){let t,{restMs:n=0,buffer:r=.5,blockPointerEvents:o=!0}=void 0===e?{}:e,u=!1,c=!1;return e=>{let{x:i,y:l,placement:s,refs:a,onClose:f,nodeId:d,tree:m,polygonRef:v}=e;return function(e){var p;function g(){z(v),clearTimeout(t),f()}if(clearTimeout(t),!a.domReference.current||!a.floating.current||null==s||null==i||null==l)return;const{clientX:b,clientY:h}=e,y=X(e),w="mouseleave"===e.type,E=W(a.domReference.current,y),R=W(a.floating.current,y);if(!w&&E)return void z(v);if(!w&&(E||u&&W(v.current,y)))return;if(w&&A(e.relatedTarget)&&W(a.floating.current,e.relatedTarget))return;if(m&&q(m.nodesRef.current,d).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if(R&&(c=!0),R&&!w&&"rect"!==(null==(p=v.current)?void 0:p.dataset.type))return void z(v);const x=a.domReference.current.getBoundingClientRect(),I=a.floating.current.getBoundingClientRect(),k=s.split("-")[0],C=i>I.right-I.width/2,L=l>I.bottom-I.height/2;if("top"===k&&l>=x.bottom-1||"bottom"===k&&l<=x.top+1||"left"===k&&i>=x.right-1||"right"===k&&i<=x.left+1)return g();let M=[];switch(k){case"top":M=[[I.left,x.top+1],[I.left,I.bottom-1],[I.right,I.bottom-1],[I.right,x.top+1]],u=b>=I.left&&b<=I.right&&h>=I.top&&h<=x.top+1;break;case"bottom":M=[[I.left,I.top+1],[I.left,x.bottom-1],[I.right,x.bottom-1],[I.right,I.top+1]],u=b>=I.left&&b<=I.right&&h>=x.bottom-1&&h<=I.bottom;break;case"left":M=[[I.right-1,I.bottom],[I.right-1,I.top],[x.left+1,I.top],[x.left+1,I.bottom]],u=b>=I.left&&b<=x.left+1&&h>=I.top&&h<=I.bottom;break;case"right":M=[[x.right-1,I.bottom],[x.right-1,I.top],[I.left+1,I.top],[I.left+1,I.bottom]],u=b>=x.right-1&&b<=I.right&&h>=I.top&&h<=I.bottom}const O=u?M:function(e){let[t,n]=e;const o=I.width>x.width,u=I.height>x.height;switch(k){case"top":return[[o?t+r/2:C?t+4*r:t-4*r,n+r+1],[o?t-r/2:C?t+4*r:t-4*r,n+r+1],...[[I.left,C||o?I.bottom-r:I.top],[I.right,C?o?I.bottom-r:I.top:I.bottom-r]]];case"bottom":return[[o?t+r/2:C?t+4*r:t-4*r,n-r],[o?t-r/2:C?t+4*r:t-4*r,n-r],...[[I.left,C||o?I.top+r:I.bottom],[I.right,C?o?I.top+r:I.bottom:I.top+r]]];case"left":{const e=[t+r+1,u?n+r/2:L?n+4*r:n-4*r],o=[t+r+1,u?n-r/2:L?n+4*r:n-4*r];return[...[[L||u?I.right-r:I.left,I.top],[L?u?I.right-r:I.left:I.right-r,I.bottom]],e,o]}case"right":return[[t-r,u?n+r/2:L?n+4*r:n-4*r],[t-r,u?n-r/2:L?n+4*r:n-4*r],...[[L||u?I.left+r:I.right,I.top],[L?u?I.left+r:I.right:I.left+r,I.bottom]]]}}([i,l]);if(!v.current&&o&&w){const e=T(a.floating.current);v.current=function(e,t,n){var r,o;const u=D(),c=t.defaultView||window,i=t.createElementNS(Y,"svg");Object.assign(i.style,{position:"fixed",left:(u&&(null==(r=c.visualViewport)?void 0:r.offsetLeft)||0)+"px",top:(u&&(null==(o=c.visualViewport)?void 0:o.offsetTop)||0)+"px",width:"100%",height:"100%",pointerEvents:"none",zIndex:2147483647}),i.setAttribute("data-type",n?"rect":"triangle");const l=t.createElementNS(Y,"polygon");return l.setAttribute("points",e.map((e=>{let[t,n]=e;return t+","+n})).join(" ")),Object.assign(l.style,{pointerEvents:"auto",fill:"transparent",opacity:0}),i.appendChild(l),i}(O,e,u),e.body.appendChild(v.current)}u||(!function(e,t){const[n,r]=e;let o=!1;const u=t.length;for(let e=0,c=u-1;e<u;c=e++){const[u,i]=t[e]||[0,0],[l,s]=t[c]||[0,0];i>=r!=s>=r&&n<=(l-u)*(r-i)/(s-i)+u&&(o=!o)}return o}([b,h],O)?g():n&&!c&&(t=setTimeout(f,n)))}}}function _(){return _=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},_.apply(this,arguments)}const G={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};let J,Q;function Z(e){"Tab"===e.key&&(J=e.target,clearTimeout(Q))}const $=o.forwardRef((function(e,t){const n=H(e.onFocus),[r,u]=o.useState();return d((()=>(D()&&u("button"),document.addEventListener("keydown",Z),()=>{document.removeEventListener("keydown",Z)})),[]),o.createElement("span",_({},e,{ref:t,tabIndex:0,role:r,"aria-hidden":!r||void 0,"data-floating-ui-focus-guard":"",style:G,onFocus:e=>{D()&&F()&&!function(e){const t=J===e.relatedTarget;return J=e.relatedTarget,clearTimeout(Q),t}(e)?(e.persist(),Q=window.setTimeout((()=>{n(e)}),50)):n(e)}}))}));function ee(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(r=n.shadowRoot)?void 0:r.activeElement);){var n,r;t=t.shadowRoot.activeElement}return t}const te=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function ne(e,t){const n=a(e,te());"prev"===t&&n.reverse();const r=n.indexOf(ee(T(e)));return n.slice(r+1)[0]}function re(){return ne(document.body,"next")}function oe(){return ne(document.body,"prev")}function ue(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!W(n,r)}function ce(e){a(e,te()).forEach((e=>{var t;e.dataset.tabindex=null!=(t=e.getAttribute("tabindex"))?t:"",e.setAttribute("tabindex","-1")}))}function ie(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 le=o.createContext(null),se=function(e){let{id:t,enabled:n=!0}=void 0===e?{}:e;const[r,u]=o.useState(null),c=h(),i=fe();return d((()=>{if(!n)return;const e=t?document.getElementById(t):null;if(!e){const e=document.createElement("div");e.id=t||c,e.setAttribute("data-floating-ui-portal",""),u(e);const n=(null==i?void 0:i.portalNode)||document.body;return n.appendChild(e),()=>{n.removeChild(e)}}e.setAttribute("data-floating-ui-portal",""),u(e)}),[t,i,c,n]),r},ae=e=>{let{children:t,id:n,root:r=null,preserveTabOrder:u=!0}=e;const c=se({id:n,enabled:!r}),[i,s]=o.useState(null),a=o.useRef(null),f=o.useRef(null),d=o.useRef(null),m=o.useRef(null),v=!!i&&!i.modal&&!(!r&&!c)&&u;return o.useEffect((()=>{if(c&&u&&(null==i||!i.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&&ue(e)){("focusin"===e.type?ie:ce)(c)}}}),[c,u,null==i?void 0:i.modal]),o.createElement(le.Provider,{value:o.useMemo((()=>({preserveTabOrder:u,beforeOutsideRef:a,afterOutsideRef:f,beforeInsideRef:d,afterInsideRef:m,portalNode:c,setFocusManagerState:s})),[u,c])},v&&c&&o.createElement($,{ref:a,onFocus:e=>{if(ue(e,c)){var t;null==(t=d.current)||t.focus()}else{const e=oe()||(null==i?void 0:i.refs.domReference.current);null==e||e.focus()}}}),v&&c&&o.createElement("span",{"aria-owns":c.id,style:G}),r?l(t,r):c?l(t,c):null,v&&c&&o.createElement($,{ref:f,onFocus:e=>{if(ue(e,c)){var t;null==(t=m.current)||t.focus()}else{const e=re()||(null==i?void 0:i.refs.domReference.current);null==e||e.focus(),null==i||i.onOpenChange(!1)}}}))},fe=()=>o.useContext(le),de="data-floating-ui-scroll-lock",me=o.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return d((()=>{var e,t,r,o;if(!n)return;if(document.body.hasAttribute(de))return;document.body.setAttribute(de,"");const u=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",c=window.innerWidth-document.documentElement.clientWidth;if(!/iP(hone|ad|od)|iOS/.test(C()))return Object.assign(document.body.style,{overflow:"hidden",[u]:c+"px"}),()=>{document.body.removeAttribute(de),Object.assign(document.body.style,{overflow:"",[u]:""})};const i=null!=(e=null==(t=window.visualViewport)?void 0:t.offsetLeft)?e:0,l=null!=(r=null==(o=window.visualViewport)?void 0:o.offsetTop)?r:0,s=window.pageXOffset,a=window.pageYOffset;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:-(a-Math.floor(l))+"px",left:-(s-Math.floor(i))+"px",right:"0",[u]:c+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[u]:""}),document.body.removeAttribute(de),window.scrollTo(s,a)}}),[n]),o.createElement("div",_({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function ve(e){return O(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function pe(e){e.preventDefault(),e.stopPropagation()}function ge(e){const t=i(e);return d((()=>{t.current=e})),t}let be=0;function he(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(be);const u=()=>null==e?void 0:e.focus({preventScroll:n});o?u():be=requestAnimationFrame(u)}const ye=o.forwardRef((function(e,t){return o.createElement("button",_({},e,{ref:t,tabIndex:-1,style:G}))}));function we(e){let{context:t,children:n,order:r=["content"],guards:u=!0,initialFocus:c=0,returnFocus:i=!0,modal:l=!0,visuallyHiddenDismiss:s=!1,closeOnFocusOut:m=!0}=e;const{refs:v,nodeId:p,onOpenChange:g,events:b,_:{domReference:h}}=t,y=ge(r),w=R(),E=fe(),[x,I]=o.useState(null),k="number"==typeof c&&c<0,C=o.useRef(null),L=o.useRef(null),M=o.useRef(!1),A=o.useRef(null),S=null!=E,P=h&&"combobox"===h.getAttribute("role")&&ve(h),D=o.useCallback((function(e){return void 0===e&&(e=v.floating.current),e?a(e,te()):[]}),[v]),F=o.useCallback((e=>{const t=D(e);return y.current.map((e=>v.domReference.current&&"reference"===e?v.domReference.current:v.floating.current&&"floating"===e?v.floating.current:t)).filter(Boolean).flat()}),[y,v,D]);o.useEffect((()=>{if(!l)return;function e(e){if("Tab"===e.key){0!==D().length||P||pe(e);const t=F(),n=X(e);"reference"===y.current[0]&&n===v.domReference.current&&(pe(e),e.shiftKey?he(t[t.length-1]):he(t[1])),"floating"===y.current[1]&&n===v.floating.current&&e.shiftKey&&(pe(e),he(t[0]))}}const t=T(v.floating.current);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[l,y,v,P,D,F]),o.useEffect((()=>{if(!m)return;const e=v.floating.current,t=v.domReference.current;let n=!1;function r(){n=!0,setTimeout((()=>{n=!1}))}function o(r){const o=r.relatedTarget,u=!(W(t,o)||W(e,o)||W(o,e)||W(null==E?void 0:E.portalNode,o)||null!=o&&o.hasAttribute("data-floating-ui-focus-guard")||w&&(q(w.nodesRef.current,p).find((e=>{var t,n;return W(null==(t=e.context)?void 0:t.refs.floating.current,o)||W(null==(n=e.context)?void 0:n.refs.domReference.current,o)}))||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}(w.nodesRef.current,p).find((e=>{var t,n;return(null==(t=e.context)?void 0:t.refs.floating.current)===o||(null==(n=e.context)?void 0:n.refs.domReference.current)===o}))));o&&u&&!n&&o!==A.current&&(M.current=!0,setTimeout((()=>g(!1))))}return e&&O(t)?(t.addEventListener("focusout",o),t.addEventListener("pointerdown",r),!l&&e.addEventListener("focusout",o),()=>{t.removeEventListener("focusout",o),t.removeEventListener("pointerdown",r),!l&&e.removeEventListener("focusout",o)}):void 0}),[l,p,w,v,E,g,m]),o.useEffect((()=>{var e,t;const n=v.floating.current,r=v.domReference.current,o=Array.from(null!=(e=null==E||null==(t=E.portalNode)?void 0:t.querySelectorAll("[data-floating-ui-portal]"))?e:[]);if(n&&O(r)&&l){const e=[n,...o,...[C.current,L.current].filter(Boolean)],t=f(y.current.includes("reference")||P?e.concat(r):e);return()=>{t()}}}),[l,y,E,v,P]),o.useEffect((()=>{const e=v.floating.current;if(l&&!u&&e){const t=[],n=te(),r=a(T(e).body,n),o=F(),u=r.filter((e=>!o.includes(e)));return u.forEach(((e,n)=>{t[n]=e.getAttribute("tabindex"),e.setAttribute("tabindex","-1")})),()=>{u.forEach(((e,n)=>{const r=t[n];null==r?e.removeAttribute("tabindex"):e.setAttribute("tabindex",r)}))}}}),[l,u,v,F]),d((()=>{const e=v.floating.current;if(!e)return;const t=T(e);let n=i,r=!1;const o=ee(t);A.current=o;const u=F(e),l=("number"==typeof c?u[c]:c.current)||e;function s(e){if("escapeKey"===e.type&&v.domReference.current&&(A.current=v.domReference.current),["referencePress","escapeKey"].includes(e.type))return;const t=e.data.returnFocus;"object"==typeof t?(n=!0,r=t.preventScroll):n=t}return!k&&he(l,{preventScroll:l===e}),b.on("dismiss",s),()=>{b.off("dismiss",s),W(e,ee(t))&&v.domReference.current&&(A.current=v.domReference.current),n&&O(A.current)&&!M.current&&he(A.current,{preventScroll:r,cancelPrevious:!1})}}),[F,c,i,v,b,k]),d((()=>{if(E)return E.setFocusManagerState({...t,modal:l}),()=>{E.setFocusManagerState(null)}}),[E,l,t]),d((()=>{0!==D().length||k||I(0)}),[D,v,k]);const K=u&&(S||l)&&!P;function N(e){return s&&l?o.createElement(ye,{ref:"start"===e?C:L,onClick:()=>g(!1)},"string"==typeof s?s:"Dismiss"):null}return o.createElement(o.Fragment,null,K&&o.createElement($,{ref:null==E?void 0:E.beforeInsideRef,onFocus:e=>{if(l){const e=F();he("reference"===r[0]?e[0]:e[e.length-1])}else if(null!=E&&E.preserveTabOrder&&E.portalNode)if(M.current=!1,ue(e,E.portalNode)){const e=re()||h;null==e||e.focus()}else{var t;null==(t=E.beforeOutsideRef.current)||t.focus()}}}),P?null:N("start"),o.cloneElement(n,0===x||r.includes("floating")?{tabIndex:0}:{}),N("end"),K&&o.createElement($,{ref:null==E?void 0:E.afterInsideRef,onFocus:e=>{if(l)he(F()[0]);else if(null!=E&&E.preserveTabOrder&&E.portalNode)if(M.current=!0,ue(e,E.portalNode)){const e=oe()||h;null==e||e.focus()}else{var t;null==(t=E.afterOutsideRef.current)||t.focus()}}}))}function Ee(e,t,n){return n&&!K(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}const Re=function(e,t){let{enabled:n=!0,delay:r=0,handleClose:u=null,mouseOnly:c=!1,restMs:i=0,move:l=!0}=void 0===t?{}:t;const{open:s,onOpenChange:a,dataRef:f,events:m,refs:v,_:p}=e,g=R(),b=ge(u),h=ge(r),y=o.useRef(),w=o.useRef(),E=o.useRef(),x=o.useRef(),I=o.useRef(!0),k=o.useRef(null),C=o.useCallback((()=>{var e;const t=null==(e=f.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[f]);o.useEffect((()=>{if(n)return m.on("dismiss",e),()=>{m.off("dismiss",e)};function e(){clearTimeout(w.current),clearTimeout(x.current),I.current=!0}}),[n,m,v]),o.useEffect((()=>{if(!n||!b.current||!s)return;function e(){C()&&a(!1)}const t=T(v.floating.current).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[v,s,a,n,b,f,C]);const L=o.useCallback((function(e){void 0===e&&(e=!0);const t=Ee(h.current,"close",y.current);t&&!E.current?(clearTimeout(w.current),w.current=setTimeout((()=>a(!1)),t)):e&&(clearTimeout(w.current),a(!1))}),[h,a]),M=o.useCallback((()=>{E.current&&(T(v.floating.current).removeEventListener("mousemove",E.current),E.current=void 0)}),[v]);return o.useEffect((()=>{if(!n)return;function t(){return!!f.current.openEvent&&["click","mousedown"].includes(f.current.openEvent.type)}function r(e){if(clearTimeout(w.current),I.current=!1,c&&!K(y.current)||i>0&&0===Ee(h.current,"open"))return;f.current.openEvent=e;const t=Ee(h.current,"open",y.current);t?w.current=setTimeout((()=>{a(!0)}),t):a(!0)}function o(n){if(t())return;const r=T(v.floating.current);if(clearTimeout(x.current),b.current)return clearTimeout(w.current),E.current&&r.removeEventListener("mousemove",E.current),E.current=b.current({...e,tree:g,polygonRef:k,x:n.clientX,y:n.clientY,onClose(){M(),L()}}),void r.addEventListener("mousemove",E.current);L()}function u(n){t()||null==b.current||b.current({...e,tree:g,polygonRef:k,x:n.clientX,y:n.clientY,onClose(){M(),L()}})(n)}const d=v.floating.current,m=v.domReference.current;return A(m)?(s&&m.addEventListener("mouseleave",u),null==d||d.addEventListener("mouseleave",u),l&&m.addEventListener("mousemove",r,{once:!0}),m.addEventListener("mouseenter",r),m.addEventListener("mouseleave",o),()=>{s&&m.removeEventListener("mouseleave",u),null==d||d.removeEventListener("mouseleave",u),l&&m.removeEventListener("mousemove",r),m.removeEventListener("mouseenter",r),m.removeEventListener("mouseleave",o)}):void 0}),[p.domReference,n,e,c,i,l,L,M,a,s,g,v,h,b,f]),d((()=>{s||(y.current=void 0,M(),z(k))}),[s,M]),o.useEffect((()=>()=>{M(),clearTimeout(w.current),clearTimeout(x.current),z(k)}),[n,M]),o.useMemo((()=>{if(!n)return{};function e(e){y.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){s||0===i||(clearTimeout(x.current),x.current=setTimeout((()=>{I.current||a(!0)}),i))}},floating:{onMouseEnter(){clearTimeout(w.current)},onMouseLeave(){m.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),L(!1)}}}}),[m,n,i,s,a,L])},xe=o.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{}}),Ie=()=>o.useContext(xe),ke=e=>{let{children:t,delay:n,timeoutMs:r=0}=e;const[u,c]=o.useState({delay:n,timeoutMs:r,initialDelay:n,currentId:null}),i=o.useCallback((e=>{c((t=>({...t,currentId:e})))}),[]);return o.createElement(xe.Provider,{value:o.useMemo((()=>({...u,setState:c,setCurrentId:i})),[u,c,i])},t)},Te=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:u}=t;const{currentId:c,initialDelay:i,setState:l,timeoutMs:s}=Ie(),a=o.useRef();o.useEffect((()=>{c&&(clearTimeout(a.current),l((e=>({...e,delay:{open:1,close:Ee(i,"close")}}))),c!==u&&r(!1))}),[u,r,l,c,i]),o.useEffect((()=>{function e(){r(!1),l((e=>({...e,delay:i,currentId:null})))}clearTimeout(a.current),n||c!==u||(s?a.current=window.setTimeout(e,s):e())}),[n,l,c,u,r,i,s]),o.useEffect((()=>()=>{clearTimeout(a.current)}),[])};function Ce(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Le=e=>({name:"inner",options:e,async fn(r){var o;const{listRef:u,overflowRef:c,onFallbackChange:i,offset:l=0,index:a=0,minItemsVisible:f=4,referenceOverflowThreshold:d=0,scrollRef:m,...v}=e,{rects:p,elements:{floating:g}}=r,b=u.current[a];if(!b)return{};const h={...r,...await t(-b.offsetTop-p.reference.height/2-b.offsetHeight/2-l).fn(r)},y=null!=(o=null==m?void 0:m.current)?o:g,w=await n(Ce(h,y.scrollHeight),v),E=await n(h,{...v,elementContext:"reference"}),R=Math.max(0,w.top),x=h.y+R,I=Math.max(0,y.scrollHeight-R-Math.max(0,w.bottom));return y.style.maxHeight=I+"px",y.scrollTop=R,i&&(y.offsetHeight<b.offsetHeight*Math.min(f,u.current.length-1)-1||E.top>=-d||E.bottom>=-d?s((()=>i(!0))):s((()=>i(!1)))),c&&(c.current=await n(Ce({...h,y:x},y.offsetHeight),v)),{y:x}}}),Me=(e,t)=>{let{open:n,refs:r}=e,{enabled:u=!0,overflowRef:c,scrollRef:i,onChange:l}=t;const a=H(l),f=o.useRef(!1),d=o.useRef(null),m=o.useRef(null);return o.useEffect((()=>{var e;if(!u)return;function t(e){if(e.ctrlKey||!o||null==c.current)return;const t=e.deltaY,n=c.current.top>=-.5,r=c.current.bottom>=-.5,u=o.scrollHeight-o.clientHeight,i=t<0?-1:1,l=t<0?"max":"min";o.scrollHeight<=o.clientHeight||(!n&&t>0||!r&&t<0?(e.preventDefault(),s((()=>{a((e=>e+Math[l](t,u*i)))}))):/firefox/i.test(L())&&(o.scrollTop+=t))}const o=null!=(e=null==i?void 0:i.current)?e:r.floating.current;return n&&o?(o.addEventListener("wheel",t),requestAnimationFrame((()=>{d.current=o.scrollTop,null!=c.current&&(m.current={...c.current})})),()=>{d.current=null,m.current=null,o.removeEventListener("wheel",t)}):void 0}),[u,n,r,c,i,a]),o.useMemo((()=>u?{floating:{onKeyDown(){f.current=!0},onWheel(){f.current=!1},onPointerMove(){f.current=!1},onScroll(){const e=(null==i?void 0:i.current)||r.floating.current;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)&&s((()=>a((e=>e+t))))}requestAnimationFrame((()=>{d.current=e.scrollTop}))}}}}:{}),[u,c,r,i,a])},Ae=function(e,t){let{open:n}=e,{enabled:r=!0,role:u="dialog"}=void 0===t?{}:t;const c=h(),i=h();return o.useMemo((()=>{const e={id:c,role:u};return r?"tooltip"===u?{reference:{"aria-describedby":n?c:void 0},floating:e}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":"alertdialog"===u?"dialog":u,"aria-controls":n?c:void 0,..."listbox"===u&&{role:"combobox"},..."menu"===u&&{id:i}},floating:{...e,..."menu"===u&&{"aria-labelledby":i}}}:{}}),[r,u,n,c,i])};function Oe(e){return O(e.target)&&"BUTTON"===e.target.tagName}function Se(e){return ve(e)}const Pe=function(e,t){let{open:n,onOpenChange:r,dataRef:u,refs:c}=e,{enabled:i=!0,event:l="click",toggle:s=!0,ignoreMouse:a=!1,keyboardHandlers:f=!0}=void 0===t?{}:t;const d=o.useRef();return o.useMemo((()=>i?{reference:{onPointerDown(e){d.current=e.pointerType},onMouseDown(e){0===e.button&&(K(d.current)&&a||"click"!==l&&(n?!s||u.current.openEvent&&"mousedown"!==u.current.openEvent.type||r(!1):(e.preventDefault(),r(!0)),u.current.openEvent=e.nativeEvent))},onClick(e){"mousedown"===l&&d.current?d.current=void 0:K(d.current)&&a||(n?!s||u.current.openEvent&&"click"!==u.current.openEvent.type||r(!1):r(!0),u.current.openEvent=e.nativeEvent)},onKeyDown(e){d.current=void 0,f&&(Oe(e)||(" "!==e.key||Se(c.domReference.current)||e.preventDefault(),"Enter"===e.key&&(n?s&&r(!1):r(!0))))},onKeyUp(e){f&&(Oe(e)||Se(c.domReference.current)||" "===e.key&&(n?s&&r(!1):r(!0)))}}}:{}),[i,u,l,a,f,c,s,n,r])};function De(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 Fe={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Ke={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Ne=function(e,t){let{open:n,onOpenChange:u,refs:c,events:i,nodeId:l}=e,{enabled:s=!0,escapeKey:a=!0,outsidePress:f=!0,outsidePressEvent:d="pointerdown",referencePress:m=!1,referencePressEvent:v="pointerdown",ancestorScroll:p=!1,bubbles:g=!0}=void 0===t?{}:t;const b=R(),h=null!=E(),y=H("function"==typeof f?f:()=>!1),w="function"==typeof f?y:f,x=o.useRef(!1),{escapeKeyBubbles:I,outsidePressBubbles:k}=function(e){var t,n;return void 0===e&&(e=!0),{escapeKeyBubbles:"boolean"==typeof e?e:null==(t=e.escapeKey)||t,outsidePressBubbles:"boolean"==typeof e?e:null==(n=e.outsidePress)||n}}(g);return o.useEffect((()=>{if(!n||!s)return;function e(e){if("Escape"===e.key){if(!I&&b&&q(b.nodesRef.current,l).length>0)return;i.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),u(!1)}}function t(e){const t=x.current;if(x.current=!1,t)return;if("function"==typeof w&&!w(e))return;const n=X(e);if(A(n)&&c.floating.current){var r;const t=null!=(r=c.floating.current.ownerDocument.defaultView)?r:window,o=n.scrollWidth>n.clientWidth,u=n.scrollHeight>n.clientHeight;let i=u&&e.offsetX>n.clientWidth;if(u){"rtl"===t.getComputedStyle(n).direction&&(i=e.offsetX<=n.offsetWidth-n.clientWidth)}if(i||o&&e.offsetY>n.clientHeight)return}const o=b&&q(b.nodesRef.current,l).some((t=>{var n;return De(e,null==(n=t.context)?void 0:n.refs.floating.current)}));De(e,c.floating.current)||De(e,c.domReference.current)||o||!k&&b&&q(b.nodesRef.current,l).length>0||(i.emit("dismiss",{type:"outsidePress",data:{returnFocus:h?{preventScroll:!0}:S(e)||P(e)}}),u(!1))}function o(){u(!1)}const f=T(c.floating.current);a&&f.addEventListener("keydown",e),w&&f.addEventListener(d,t);let m=[];return p&&(A(c.domReference.current)&&(m=r(c.domReference.current)),A(c.floating.current)&&(m=m.concat(r(c.floating.current))),!A(c.reference.current)&&c.reference.current&&c.reference.current.contextElement&&(m=m.concat(r(c.reference.current.contextElement)))),m=m.filter((e=>{var t;return e!==(null==(t=f.defaultView)?void 0:t.visualViewport)})),m.forEach((e=>{e.addEventListener("scroll",o,{passive:!0})})),()=>{a&&f.removeEventListener("keydown",e),w&&f.removeEventListener(d,t),m.forEach((e=>{e.removeEventListener("scroll",o)}))}}),[a,w,d,i,b,l,n,u,p,s,I,k,c,h]),o.useEffect((()=>{x.current=!1}),[w,d]),o.useMemo((()=>s?{reference:{[Fe[v]]:()=>{m&&(i.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),u(!1))}},floating:{[Ke[d]]:()=>{x.current=!0}}}:{}),[s,i,m,d,v,u])},He=function(e,t){let{open:n,onOpenChange:r,dataRef:u,refs:c,events:i}=e,{enabled:l=!0,keyboardOnly:s=!0}=void 0===t?{}:t;const a=o.useRef(""),f=o.useRef(!1),d=o.useRef();return o.useEffect((()=>{var e;if(!l)return;const t=null!=(e=T(c.floating.current).defaultView)?e:window;function r(){!n&&O(c.domReference.current)&&c.domReference.current===ee(T(c.domReference.current))&&(f.current=!0)}return t.addEventListener("blur",r),()=>{t.removeEventListener("blur",r)}}),[c,n,l]),o.useEffect((()=>{if(l)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(e){"referencePress"!==e.type&&"escapeKey"!==e.type||(f.current=!0)}}),[i,l]),o.useEffect((()=>()=>{clearTimeout(d.current)}),[]),o.useMemo((()=>l?{reference:{onPointerDown(e){let{pointerType:t}=e;a.current=t,f.current=!(!t||!s)},onMouseLeave(){f.current=!1},onFocus(e){var t;f.current||"focus"===e.type&&"mousedown"===(null==(t=u.current.openEvent)?void 0:t.type)&&u.current.openEvent&&De(u.current.openEvent,c.domReference.current)||(u.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){f.current=!1;const t=e.relatedTarget,n=A(t)&&t.hasAttribute("data-floating-ui-focus-guard");d.current=setTimeout((()=>{W(c.floating.current,t)||W(c.domReference.current,t)||n||r(!1)}))}}}:{}),[l,s,c,u,r])};let Be=!1;function Ve(e,t,n){return Math.floor(e/t)!==n}function je(e,t){return t<0||t>=e.current.length}function We(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o,amount:u=1}=void 0===t?{}:t;const c=e.current;let i=n;do{var l,s;i+=r?-u:u}while(i>=0&&i<=c.length-1&&(o?o.includes(i):null==c[i]||(null==(l=c[i])?void 0:l.hasAttribute("disabled"))||"true"===(null==(s=c[i])?void 0:s.getAttribute("aria-disabled"))));return i}function qe(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Xe(e,t){return qe(t,"ArrowUp"===e||"ArrowDown"===e,"ArrowLeft"===e||"ArrowRight"===e)}function Ye(e,t,n){return qe(t,"ArrowDown"===e,n?"ArrowLeft"===e:"ArrowRight"===e)||"Enter"===e||" "==e||""===e}function ze(e,t){return We(e,{disabledIndices:t})}function Ue(e,t){return We(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}const _e=function(e,t){let{open:n,onOpenChange:r,refs:u}=e,{listRef:c,activeIndex:i,onNavigate:l=(()=>{}),enabled:a=!0,selectedIndex:f=null,allowEscape:m=!1,loop:v=!1,nested:p=!1,rtl:g=!1,virtual:b=!1,focusItemOnOpen:h="auto",focusItemOnHover:y=!0,openOnArrowKeyDown:w=!0,disabledIndices:x,orientation:I="vertical",cols:k=1,scrollItemIntoView:C=!0}=void 0===t?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:t;const L=E(),M=R(),A=H(l),K=o.useRef(h),N=o.useRef(null!=f?f:-1),B=o.useRef(null),V=o.useRef(!0),j=o.useRef(A),q=o.useRef(n),X=o.useRef(!1),Y=ge(x),z=ge(n),U=ge(C),[_,G]=o.useState(),J=o.useCallback(((e,t)=>{const n=e.current[t.current];b?G(null==n?void 0:n.id):he(n,{preventScroll:!0,sync:!(!F()||!D())&&(Be||X.current)}),requestAnimationFrame((()=>{const e=U.current;e&&n&&!V.current&&(null==n.scrollIntoView||n.scrollIntoView("boolean"==typeof e?{block:"nearest",inline:"nearest"}:e))}))}),[b,U]);return d((()=>{document.createElement("div").focus({get preventScroll(){return Be=!0,!1}})}),[]),d((()=>{a&&(n?K.current&&null!=f&&A(f):q.current&&(N.current=-1,j.current(null)))}),[a,n,f,A]),d((()=>{if(a&&n)if(null==i){if(X.current=!1,null!=f)return;q.current&&(N.current=-1,J(c,N)),!q.current&&K.current&&(null!=B.current||!0===K.current&&null==B.current)&&(N.current=null==B.current||Ye(B.current,I,g)||p?ze(c,Y.current):Ue(c,Y.current),A(N.current))}else je(c,i)||(N.current=i,J(c,N))}),[a,n,i,f,p,c,I,g,A,J,Y]),d((()=>{if(a&&q.current&&!n){var e,t;const n=null==M||null==(e=M.nodesRef.current.find((e=>e.id===L)))||null==(t=e.context)?void 0:t.refs.floating.current;n&&!W(n,ee(T(n)))&&n.focus({preventScroll:!0})}}),[a,n,M,L]),d((()=>{B.current=null,j.current=A,q.current=n})),o.useMemo((()=>{if(!a)return{};const e=Y.current;function t(t){if(V.current=!1,X.current=!0,!z.current&&t.currentTarget===u.floating.current)return;if(p&&function(e,t,n){return qe(t,n?"ArrowRight"===e:"ArrowLeft"===e,"ArrowUp"===e)}(t.key,I,g))return pe(t),r(!1),void(O(u.domReference.current)&&u.domReference.current.focus());const o=N.current,i=ze(c,e),l=Ue(c,e);if("Home"===t.key&&(N.current=i,A(N.current)),"End"===t.key&&(N.current=l,A(N.current)),k>1){const n=N.current;if("ArrowUp"===t.key){if(pe(t),-1===n)N.current=l;else if(N.current=We(c,{startingIndex:n,amount:k,decrement:!0,disabledIndices:e}),v&&(n-k<i||N.current<0)){const e=n%k,t=l%k,r=l-(t-e);N.current=t===e?l:t>e?r:r-k}je(c,N.current)&&(N.current=n),A(N.current)}if("ArrowDown"===t.key&&(pe(t),-1===n?N.current=i:(N.current=We(c,{startingIndex:n,amount:k,disabledIndices:e}),v&&n+k>l&&(N.current=We(c,{startingIndex:n%k-k,amount:k,disabledIndices:e}))),je(c,N.current)&&(N.current=n),A(N.current)),"both"===I){const r=Math.floor(n/k);"ArrowRight"===t.key&&(pe(t),n%k!=k-1?(N.current=We(c,{startingIndex:n,disabledIndices:e}),v&&Ve(N.current,k,r)&&(N.current=We(c,{startingIndex:n-n%k-1,disabledIndices:e}))):v&&(N.current=We(c,{startingIndex:n-n%k-1,disabledIndices:e})),Ve(N.current,k,r)&&(N.current=n)),"ArrowLeft"===t.key&&(pe(t),n%k!=0?(N.current=We(c,{startingIndex:n,disabledIndices:e,decrement:!0}),v&&Ve(N.current,k,r)&&(N.current=We(c,{startingIndex:n+(k-n%k),decrement:!0,disabledIndices:e}))):v&&(N.current=We(c,{startingIndex:n+(k-n%k),decrement:!0,disabledIndices:e})),Ve(N.current,k,r)&&(N.current=n));const o=Math.floor(l/k)===r;return je(c,N.current)&&(N.current=v&&o?"ArrowLeft"===t.key?l:We(c,{startingIndex:n-n%k-1,disabledIndices:e}):n),void A(N.current)}}if(Xe(t.key,I)){if(pe(t),n&&!b&&ee(t.currentTarget.ownerDocument)===t.currentTarget)return N.current=Ye(t.key,I,g)?i:l,void A(N.current);Ye(t.key,I,g)?N.current=v?o>=l?m&&o!==c.current.length?-1:i:We(c,{startingIndex:o,disabledIndices:e}):Math.min(l,We(c,{startingIndex:o,disabledIndices:e})):N.current=v?o<=i?m&&-1!==o?c.current.length:l:We(c,{startingIndex:o,decrement:!0,disabledIndices:e}):Math.max(i,We(c,{startingIndex:o,decrement:!0,disabledIndices:e})),je(c,N.current)?A(null):A(N.current)}}function o(e){"auto"===h&&S(e.nativeEvent)&&(K.current=!0)}return{reference:{...b&&n&&null!=i&&{"aria-activedescendant":_},onKeyDown(o){V.current=!1;const u=0===o.key.indexOf("Arrow");if(b&&n)return t(o);if(!n&&!w&&u)return;(u||"Enter"===o.key||" "===o.key||""===o.key)&&(B.current=o.key),p?function(e,t,n){return qe(t,n?"ArrowLeft"===e:"ArrowRight"===e,"ArrowDown"===e)}(o.key,I,g)&&(pe(o),n?(N.current=ze(c,e),A(N.current)):r(!0)):Xe(o.key,I)&&(null!=f&&(N.current=f),pe(o),!n&&w?r(!0):t(o),n&&A(N.current))},onFocus(){n&&A(null)},onPointerDown:function(e){K.current=h,"auto"===h&&P(e.nativeEvent)&&(K.current=!0)},onMouseDown:o,onClick:o},floating:{"aria-orientation":"both"===I?void 0:I,...b&&null!=i&&{"aria-activedescendant":_},onKeyDown:t,onPointerMove(){V.current=!0}},item:{onFocus(e){let{currentTarget:t}=e;const n=c.current.indexOf(t);-1!==n&&i!==n&&A(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...y&&{onMouseMove(e){let{currentTarget:t}=e;const n=t;if(n){const e=c.current.indexOf(n);-1!==e&&i!==e&&A(e)}},onPointerLeave(){var e;V.current&&(N.current=-1,J(c,N),s((()=>A(null))),b||null==(e=u.floating.current)||e.focus({preventScroll:!0}))}}}}}),[_,Y,z,c,a,I,g,b,n,i,p,f,w,y,m,k,v,u,h,J,A,r])},Ge=function(e,t){var n;let{open:r,dataRef:u}=e,{listRef:c,activeIndex:i,onMatch:l=(()=>{}),enabled:s=!0,findMatch:a=null,resetMs:f=1e3,ignoreKeys:m=[],selectedIndex:v=null}=void 0===t?{listRef:{current:[]},activeIndex:null}:t;const p=o.useRef(),g=o.useRef(""),b=o.useRef(null!=(n=null!=v?v:i)?n:-1),h=o.useRef(null),y=H(l),w=ge(a),E=ge(m);return d((()=>{r&&(clearTimeout(p.current),h.current=null,g.current="")}),[r]),d((()=>{var e;r&&""===g.current&&(b.current=null!=(e=null!=v?v:i)?e:-1)}),[r,v,i]),o.useMemo((()=>{if(!s)return{};function e(e){const t=X(e.nativeEvent);if(A(t)&&ee(T(t))!==e.currentTarget&&t.closest('[role="dialog"],[role="menu"],[role="listbox"],[role="tree"],[role="grid"]')!==e.currentTarget)return;g.current.length>0&&" "!==g.current[0]&&(u.current.typing=!0," "===e.key&&pe(e));const n=c.current;if(null==n||E.current.includes(e.key)||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey)return;n.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&g.current===e.key&&(g.current="",b.current=h.current),g.current+=e.key,clearTimeout(p.current),p.current=setTimeout((()=>{g.current="",b.current=h.current,u.current.typing=!1}),f);const r=b.current,o=[...n.slice((null!=r?r:0)+1),...n.slice(0,(null!=r?r:0)+1)],i=w.current?w.current(o,g.current):o.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(g.current.toLocaleLowerCase())))),l=i?n.indexOf(i):-1;-1!==l&&(y(l),h.current=l)}return{reference:{onKeyDown:e},floating:{onKeyDown:e}}}),[s,u,c,f,E,w,y])};function Je(e){return o.useMemo((()=>e.every((e=>null==e))?null:t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}),e)}export{ke as FloatingDelayGroup,we as FloatingFocusManager,I as FloatingNode,me as FloatingOverlay,ae as FloatingPortal,k as FloatingTree,Le as inner,U as safePolygon,Pe as useClick,Te as useDelayGroup,Ie as useDelayGroupContext,Ne as useDismiss,B as useFloating,x as useFloatingNodeId,E as useFloatingParentNodeId,se as useFloatingPortalNode,R as useFloatingTree,He as useFocus,Re as useHover,h as useId,Me as useInnerOffset,j as useInteractions,_e as useListNavigation,Je as useMergeRefs,Ae as useRole,Ge as useTypeahead}; |
@@ -1,5 +0,5 @@ | ||
!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),c="undefined"!=typeof document?n.useLayoutEffect:n.useEffect;function i(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter((e=>e!==n)))}}}let l=!1,a=0;const s=()=>"floating-ui-"+a++;const f=u["useId".toString()],d=null!=f?f:function(){const[e,t]=u.useState((()=>l?s():void 0));return c((()=>{null==e&&t(s())}),[]),u.useEffect((()=>{l||(l=!0)}),[]),e},v=u.createContext(null),m=u.createContext(null),p=()=>{var e,t;return null!=(e=null==(t=u.useContext(v))?void 0:t.id)?e:null},g=()=>u.useContext(m);function h(e){var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document}function y(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function b(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}function w(e){var t;return null!=(t=h(e).defaultView)?t:window}function E(e){return!!e&&e instanceof w(e).Element}function R(e){return!!e&&e instanceof w(e).HTMLElement}function x(e){if(0===e.mozInputSource&&e.isTrusted)return!0;const t=/Android/i;return(t.test(y())||t.test(b()))&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType}function I(e){return 0===e.width&&0===e.height||1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"!==e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail}function k(){return/apple/i.test(navigator.vendor)}function T(){return y().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}const S=u["useInsertionEffect".toString()]||(e=>e());function O(e){const t=u.useRef((()=>{}));return S((()=>{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 C(e,t,n){const r=new Map;return{..."floating"===n&&{tabIndex:-1},...e,...t.map((e=>e?e[n]:null)).concat(e).reduce(((e,t)=>t?(Object.entries(t).forEach((t=>{let[n,o]=t;var u;0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof o&&(null==(u=r.get(n))||u.push(o),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),u=0;u<t;u++)o[u]=arguments[u];null==(e=r.get(n))||e.forEach((e=>e(...o)))})):e[n]=o})),e):e),{})}}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 w(r).ShadowRoot||r instanceof ShadowRoot))){let n=t;do{if(n&&e===n)return!0;n=n.parentNode||n.host}while(n)}var r;return!1}function A(e,t){var n;let r=null!=(n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})))?n:[],o=r;for(;o.length;){var u;o=null!=(u=e.filter((e=>{var t;return null==(t=o)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})))?u:[],r=r.concat(o)}return r}function L(e){return"composedPath"in e?e.composedPath()[0]:e.target}function P(){return P=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},P.apply(this,arguments)}const D={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};let F,N;function H(e){"Tab"===e.key&&(F=e.target,clearTimeout(N))}const j=u.forwardRef((function(e,t){const n=O(e.onFocus),[r,o]=u.useState();return c((()=>(k()&&o("button"),document.addEventListener("keydown",H),()=>{document.removeEventListener("keydown",H)})),[]),u.createElement("span",P({},e,{ref:t,tabIndex:0,role:r,"aria-hidden":!r||void 0,"data-floating-ui-focus-guard":"",style:D,onFocus:e=>{k()&&T()&&!function(e){const t=F===e.relatedTarget;return F=e.relatedTarget,clearTimeout(N),t}(e)?(e.persist(),N=window.setTimeout((()=>{n(e)}),50)):n(e)}}))})); | ||
!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),c="undefined"!=typeof document?n.useLayoutEffect:n.useEffect;function i(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter((e=>e!==n)))}}}let l=!1,a=0;const s=()=>"floating-ui-"+a++;const f=u["useId".toString()],d=null!=f?f:function(){const[e,t]=u.useState((()=>l?s():void 0));return c((()=>{null==e&&t(s())}),[]),u.useEffect((()=>{l||(l=!0)}),[]),e},m=u.createContext(null),v=u.createContext(null),p=()=>{var e,t;return null!=(e=null==(t=u.useContext(m))?void 0:t.id)?e:null},g=()=>u.useContext(v);function h(e){var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document}function b(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function y(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}function w(e){var t;return null!=(t=h(e).defaultView)?t:window}function E(e){return!!e&&e instanceof w(e).Element}function R(e){return!!e&&e instanceof w(e).HTMLElement}function x(e){if(0===e.mozInputSource&&e.isTrusted)return!0;const t=/Android/i;return(t.test(b())||t.test(y()))&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType}function I(e){return 0===e.width&&0===e.height||1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"!==e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail}function T(){return/apple/i.test(navigator.vendor)}function k(){return b().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function S(e){return["mouse","pen","",void 0].includes(e)}const C=u["useInsertionEffect".toString()]||(e=>e());function O(e){const t=u.useRef((()=>{}));return C((()=>{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 M(e,t,n){const r=new Map;return{..."floating"===n&&{tabIndex:-1},...e,...t.map((e=>e?e[n]:null)).concat(e).reduce(((e,t)=>t?(Object.entries(t).forEach((t=>{let[n,o]=t;var u;0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof o&&(null==(u=r.get(n))||u.push(o),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),u=0;u<t;u++)o[u]=arguments[u];null==(e=r.get(n))||e.forEach((e=>e(...o)))})):e[n]=o})),e):e),{})}}function A(e,t){if(!e||!t)return!1;const n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&(r=n,"undefined"!=typeof ShadowRoot&&(r instanceof w(r).ShadowRoot||r instanceof ShadowRoot))){let n=t;do{if(n&&e===n)return!0;n=n.parentNode||n.host}while(n)}var r;return!1}function L(e,t){var n;let r=null!=(n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})))?n:[],o=r;for(;o.length;){var u;o=null!=(u=e.filter((e=>{var t;return null==(t=o)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})))?u:[],r=r.concat(o)}return r}function P(e){return"composedPath"in e?e.composedPath()[0]:e.target}const D="http://www.w3.org/2000/svg";function F(e){e.current&&(e.current.remove(),e.current=null)}function N(){return N=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},N.apply(this,arguments)}const K={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};let j,H;function B(e){"Tab"===e.key&&(j=e.target,clearTimeout(H))}const V=u.forwardRef((function(e,t){const n=O(e.onFocus),[r,o]=u.useState();return c((()=>(T()&&o("button"),document.addEventListener("keydown",B),()=>{document.removeEventListener("keydown",B)})),[]),u.createElement("span",N({},e,{ref:t,tabIndex:0,role:r,"aria-hidden":!r||void 0,"data-floating-ui-focus-guard":"",style:K,onFocus:e=>{T()&&k()&&!function(e){const t=j===e.relatedTarget;return j=e.relatedTarget,clearTimeout(H),t}(e)?(e.persist(),H=window.setTimeout((()=>{n(e)}),50)):n(e)}}))})); | ||
/*! | ||
* tabbable 6.0.1 | ||
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE | ||
*/var K=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"].join(","),W="undefined"==typeof Element,B=W?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,_=!W&&Element.prototype.getRootNode?function(e){return e.getRootNode()}:function(e){return e.ownerDocument},q=function e(t,n,r){for(var o=[],u=Array.from(t);u.length;){var c=u.shift();if("SLOT"===c.tagName){var i=c.assignedElements(),l=e(i.length?i:c.children,!0,r);r.flatten?o.push.apply(o,l):o.push({scopeParent:c,candidates:l})}else{B.call(c,K)&&r.filter(c)&&(n||!t.includes(c))&&o.push(c);var a=c.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(c),s=!r.shadowRootFilter||r.shadowRootFilter(c);if(a&&s){var f=e(!0===a?c.children:a.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:c,candidates:f})}else u.unshift.apply(u,c.children)}}return o},U=function(e,t){return e.tabIndex<0&&(t||/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||e.isContentEditable)&&isNaN(parseInt(e.getAttribute("tabindex"),10))?0:e.tabIndex},V=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},X=function(e){return"INPUT"===e.tagName},Y=function(e){return function(e){return X(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||_(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)},z=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=B.call(e,"details>summary:first-of-type")?e.parentElement:e;if(B.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return z(e)}else{if("function"==typeof r){for(var u=e;e;){var c=e.parentElement,i=_(e);if(c&&!c.shadowRoot&&!0===r(c))return z(e);e=e.assignedSlot?e.assignedSlot:c||i===e.ownerDocument?c:i.host}e=u}if(function(e){for(var t,n=_(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=_(n).host)||void 0===o||!o.ownerDocument.contains(n))}return r}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},$=function(e,t){return!(t.disabled||function(e){return X(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!!B.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},J=function(e,t){return!(Y(t)||U(t)<0||!$(e,t))},Q=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Z=function e(t){var n=[],r=[];return t.forEach((function(t,o){var u=!!t.scopeParent,c=u?t.scopeParent:t,i=U(c,u),l=u?e(t.candidates):c;0===i?u?n.push.apply(n,l):n.push(c):r.push({documentOrder:o,tabIndex:i,item:t,isScope:u,content:l})})),r.sort(V).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},ee=function(e,t){var n;return n=(t=t||{}).getShadowRoot?q([e],t.includeContainer,{filter:J.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Q}):function(e,t,n){var r=Array.prototype.slice.apply(e.querySelectorAll(K));return t&&B.call(e,K)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,J.bind(null,t)),Z(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}const ne=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function re(e,t){const n=ee(e,ne());"prev"===t&&n.reverse();const r=n.indexOf(te(h(e)));return n.slice(r+1)[0]}function oe(){return re(document.body,"next")}function ue(){return re(document.body,"prev")}function ce(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!M(n,r)}function ie(e){ee(e,ne()).forEach((e=>{var t;e.dataset.tabindex=null!=(t=e.getAttribute("tabindex"))?t:"",e.setAttribute("tabindex","-1")}))}function le(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 ae=u.createContext(null),se=function(e){let{id:t,enabled:n=!0}=void 0===e?{}:e;const[r,o]=u.useState(null),i=d(),l=fe();return c((()=>{if(!n)return;const e=t?document.getElementById(t):null;if(!e){const e=document.createElement("div");e.id=t||i,e.setAttribute("data-floating-ui-portal",""),o(e);const n=(null==l?void 0:l.portalNode)||document.body;return n.appendChild(e),()=>{n.removeChild(e)}}e.setAttribute("data-floating-ui-portal",""),o(e)}),[t,l,i,n]),r},fe=()=>u.useContext(ae),de="data-floating-ui-scroll-lock",ve=u.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return c((()=>{var e,t,r,o;if(!n)return;if(document.body.hasAttribute(de))return;document.body.setAttribute(de,"");const u=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",c=window.innerWidth-document.documentElement.clientWidth;if(!/iP(hone|ad|od)|iOS/.test(y()))return Object.assign(document.body.style,{overflow:"hidden",[u]:c+"px"}),()=>{document.body.removeAttribute(de),Object.assign(document.body.style,{overflow:"",[u]:""})};const i=null!=(e=null==(t=window.visualViewport)?void 0:t.offsetLeft)?e:0,l=null!=(r=null==(o=window.visualViewport)?void 0:o.offsetTop)?r:0,a=window.pageXOffset,s=window.pageYOffset;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:-(s-Math.floor(l))+"px",left:-(a-Math.floor(i))+"px",right:"0",[u]:c+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[u]:""}),document.body.removeAttribute(de),window.scrollTo(a,s)}}),[n]),u.createElement("div",P({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));var me=new WeakMap,pe=new WeakMap,ge={},he=0,ye=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];ge[n]||(ge[n]=new WeakMap);var o=ge[n],u=[],c=new Set,i=function(e){e&&!c.has(e)&&(c.add(e),i(e.parentNode))};r.forEach(i);var l=function(e){!e||r.indexOf(e)>=0||Array.prototype.forEach.call(e.children,(function(e){if(c.has(e))l(e);else{var t=e.getAttribute("aria-hidden"),r=null!==t&&"false"!==t,i=(me.get(e)||0)+1,a=(o.get(e)||0)+1;me.set(e,i),o.set(e,a),u.push(e),1===i&&r&&pe.set(e,!0),1===a&&e.setAttribute(n,"true"),r||e.setAttribute("aria-hidden","true")}}))};return l(t),c.clear(),he++,function(){u.forEach((function(e){var t=me.get(e)-1,r=o.get(e)-1;me.set(e,t),o.set(e,r),t||(pe.has(e)||e.removeAttribute("aria-hidden"),pe.delete(e)),r||e.removeAttribute(n)})),--he||(me=new WeakMap,me=new WeakMap,pe=new WeakMap,ge={})}};function be(e){return R(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function we(e){e.preventDefault(),e.stopPropagation()}function Ee(e){const t=n.useRef(e);return c((()=>{t.current=e})),t}let Re=0;function xe(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(Re);const u=()=>null==e?void 0:e.focus({preventScroll:n});o?u():Re=requestAnimationFrame(u)}const Ie=u.forwardRef((function(e,t){return u.createElement("button",P({},e,{ref:t,tabIndex:-1,style:D}))}));const ke=["mouse","pen","",void 0];function Te(e,t,n){return n&&!ke.includes(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}const Se=u.createContext({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),Oe=()=>u.useContext(Se);function Ce(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}function Me(e){return R(e.target)&&"BUTTON"===e.target.tagName}function Ae(e){return be(e)}function Le(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 Pe={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},De={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"};let Fe=!1;const Ne="ArrowUp",He="ArrowDown",je="ArrowLeft",Ke="ArrowRight";function We(e,t,n){return Math.floor(e/t)!==n}function Be(e,t){return t<0||t>=e.current.length}function _e(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o,amount:u=1}=void 0===t?{}:t;const c=e.current;let i=n;do{var l,a;i+=r?-u:u}while(i>=0&&i<=c.length-1&&(o?o.includes(i):null==c[i]||(null==(l=c[i])?void 0:l.hasAttribute("disabled"))||"true"===(null==(a=c[i])?void 0:a.getAttribute("aria-disabled"))));return i}function qe(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Ue(e,t){return qe(t,e===Ne||e===He,e===je||e===Ke)}function Ve(e,t,n){return qe(t,e===He,n?e===je:e===Ke)||"Enter"===e||" "==e||""===e}function Xe(e,t){return _e(e,{disabledIndices:t})}function Ye(e,t){return _e(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}e.FloatingDelayGroup=e=>{let{children:t,delay:n}=e;const[r,o]=u.useState({delay:n,initialDelay:n,currentId:null}),c=u.useCallback((e=>{o((t=>({...t,currentId:e})))}),[]);return u.createElement(Se.Provider,{value:u.useMemo((()=>({...r,setState:o,setCurrentId:c})),[r,o,c])},t)},e.FloatingFocusManager=function(e){let{context:t,children:n,order:r=["content"],guards:o=!0,initialFocus:i=0,returnFocus:l=!0,modal:a=!0,visuallyHiddenDismiss:s=!1,closeOnFocusOut:f=!0}=e;const{refs:d,nodeId:v,onOpenChange:m,events:p,_:{domReference:y}}=t,b=Ee(r),w=g(),E=fe(),[x,I]=u.useState(null),k="number"==typeof i&&i<0,T=u.useRef(null),S=u.useRef(null),O=u.useRef(!1),C=u.useRef(null),P=null!=E,D=y&&"combobox"===y.getAttribute("role")&&be(y),F=u.useCallback((function(e){return void 0===e&&(e=d.floating.current),e?ee(e,ne()):[]}),[d]),N=u.useCallback((e=>{const t=F(e);return b.current.map((e=>d.domReference.current&&"reference"===e?d.domReference.current:d.floating.current&&"floating"===e?d.floating.current:t)).filter(Boolean).flat()}),[b,d,F]);u.useEffect((()=>{if(!a)return;function e(e){if("Tab"===e.key){0!==F().length||D||we(e);const t=N(),n=L(e);"reference"===b.current[0]&&n===d.domReference.current&&(we(e),e.shiftKey?xe(t[t.length-1]):xe(t[1])),"floating"===b.current[1]&&n===d.floating.current&&e.shiftKey&&(we(e),xe(t[0]))}}const t=h(d.floating.current);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[a,b,d,D,F,N]),u.useEffect((()=>{if(!f)return;const e=d.floating.current,t=d.domReference.current;let n=!1;function r(){n=!0,setTimeout((()=>{n=!1}))}function o(r){const o=r.relatedTarget,u=!(M(t,o)||M(e,o)||M(o,e)||M(null==E?void 0:E.portalNode,o)||[null==E?void 0:E.beforeOutsideRef.current,null==E?void 0:E.afterOutsideRef.current].filter(Boolean).includes(o)||w&&(A(w.nodesRef.current,v).find((e=>{var t,n;return M(null==(t=e.context)?void 0:t.refs.floating.current,o)||M(null==(n=e.context)?void 0:n.refs.domReference.current,o)}))||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}(w.nodesRef.current,v).find((e=>{var t,n;return(null==(t=e.context)?void 0:t.refs.floating.current)===o||(null==(n=e.context)?void 0:n.refs.domReference.current)===o}))));o&&u&&!n&&o!==C.current&&(O.current=!0,setTimeout((()=>m(!1))))}return e&&R(t)?(t.addEventListener("focusout",o),t.addEventListener("pointerdown",r),!a&&e.addEventListener("focusout",o),()=>{t.removeEventListener("focusout",o),t.removeEventListener("pointerdown",r),!a&&e.removeEventListener("focusout",o)}):void 0}),[a,v,w,d,E,m,f]),u.useEffect((()=>{var e,t;const n=d.floating.current,r=d.domReference.current,o=Array.from(null!=(e=null==E||null==(t=E.portalNode)?void 0:t.querySelectorAll("[data-floating-ui-portal]"))?e:[]);if(n&&R(r)&&a){const e=[n,...o,...[T.current,S.current].filter(Boolean)],t=ye(b.current.includes("reference")||D?e.concat(r):e);return()=>{t()}}}),[a,b,E,d,D]),u.useEffect((()=>{const e=d.floating.current;if(a&&!o&&e){const t=[],n=ne(),r=ee(h(e).body,n),o=N(),u=r.filter((e=>!o.includes(e)));return u.forEach(((e,n)=>{t[n]=e.getAttribute("tabindex"),e.setAttribute("tabindex","-1")})),()=>{u.forEach(((e,n)=>{const r=t[n];null==r?e.removeAttribute("tabindex"):e.setAttribute("tabindex",r)}))}}}),[a,o,d,N]),c((()=>{const e=d.floating.current;if(!e)return;const t=h(e);let n=l,r=!1;const o=te(t);C.current=o;const u=N(e),c=("number"==typeof i?u[i]:i.current)||e;function a(e){if("escapeKey"===e.type&&d.domReference.current&&(C.current=d.domReference.current),"outsidePress"!==e.type)return;const t=e.data.returnFocus;"object"==typeof t?(n=!0,r=t.preventScroll):n=t}return!k&&xe(c,{preventScroll:c===e}),p.on("dismiss",a),()=>{p.off("dismiss",a),M(e,te(t))&&d.domReference.current&&(C.current=d.domReference.current),n&&R(C.current)&&!O.current&&xe(C.current,{preventScroll:r,cancelPrevious:!1})}}),[N,i,l,d,p,k]),c((()=>{if(E)return E.setFocusManagerState({...t,modal:a}),()=>{E.setFocusManagerState(null)}}),[E,a,t]),c((()=>{0!==F().length||k||I(0)}),[F,d,k]);const H=o&&(P||a)&&!D;function K(e){return s&&a?u.createElement(Ie,{ref:"start"===e?T:S,onClick:()=>m(!1)},"string"==typeof s?s:"Dismiss"):null}return u.createElement(u.Fragment,null,H&&u.createElement(j,{ref:null==E?void 0:E.beforeInsideRef,onFocus:e=>{if(a){const e=N();xe("reference"===r[0]?e[0]:e[e.length-1])}else if(null!=E&&E.preserveTabOrder&&E.portalNode)if(O.current=!1,ce(e,E.portalNode)){const e=oe()||y;null==e||e.focus()}else{var t;null==(t=E.beforeOutsideRef.current)||t.focus()}}}),D?null:K("start"),u.cloneElement(n,0===x||r.includes("floating")?{tabIndex:0}:{}),K("end"),H&&u.createElement(j,{ref:null==E?void 0:E.afterInsideRef,onFocus:e=>{if(a)xe(N()[0]);else if(null!=E&&E.preserveTabOrder&&E.portalNode)if(O.current=!0,ce(e,E.portalNode)){const e=ue()||y;null==e||e.focus()}else{var t;null==(t=E.afterOutsideRef.current)||t.focus()}}}))},e.FloatingNode=e=>{let{children:t,id:n}=e;const r=p();return u.createElement(v.Provider,{value:u.useMemo((()=>({id:n,parentId:r})),[n,r])},t)},e.FloatingOverlay=ve,e.FloatingPortal=e=>{let{children:t,id:n,root:o=null,preserveTabOrder:c=!0}=e;const i=se({id:n,enabled:!o}),[l,a]=u.useState(null),s=u.useRef(null),f=u.useRef(null),d=u.useRef(null),v=u.useRef(null),m=!!l&&!l.modal&&!(!o&&!i)&&c;return u.useEffect((()=>{if(i&&c&&(null==l||!l.modal))return i.addEventListener("focusin",e,!0),i.addEventListener("focusout",e,!0),()=>{i.removeEventListener("focusin",e,!0),i.removeEventListener("focusout",e,!0)};function e(e){if(i&&ce(e)){("focusin"===e.type?le:ie)(i)}}}),[i,c,null==l?void 0:l.modal]),u.createElement(ae.Provider,{value:u.useMemo((()=>({preserveTabOrder:c,beforeOutsideRef:s,afterOutsideRef:f,beforeInsideRef:d,afterInsideRef:v,portalNode:i,setFocusManagerState:a})),[c,i])},m&&i&&u.createElement(j,{ref:s,onFocus:e=>{if(ce(e,i)){var t;null==(t=d.current)||t.focus()}else{const e=ue()||(null==l?void 0:l.refs.domReference.current);null==e||e.focus()}}}),m&&i&&u.createElement("span",{"aria-owns":i.id,style:D}),o?r.createPortal(t,o):i?r.createPortal(t,i):null,m&&i&&u.createElement(j,{ref:f,onFocus:e=>{if(ce(e,i)){var t;null==(t=v.current)||t.focus()}else{const e=oe()||(null==l?void 0:l.refs.domReference.current);null==e||e.focus(),null==l||l.onOpenChange(!1)}}}))},e.FloatingTree=e=>{let{children:t}=e;const n=u.useRef([]),r=u.useCallback((e=>{n.current=[...n.current,e]}),[]),o=u.useCallback((e=>{n.current=n.current.filter((t=>t!==e))}),[]),c=u.useState((()=>i()))[0];return u.createElement(m.Provider,{value:u.useMemo((()=>({nodesRef:n,addNode:r,removeNode:o,events:c})),[n,r,o,c])},t)},e.inner=e=>({name:"inner",options:e,async fn(n){var o;const{listRef:u,overflowRef:c,onFallbackChange:i,offset:l=0,index:a=0,minItemsVisible:s=4,referenceOverflowThreshold:f=0,scrollRef:d,...v}=e,{rects:m,elements:{floating:p}}=n,g=u.current[a];if(!g)return{};const h={...n,...await t.offset(-g.offsetTop-m.reference.height/2-g.offsetHeight/2-l).fn(n)},y=null!=(o=null==d?void 0:d.current)?o:p,b=await t.detectOverflow(Ce(h,y.scrollHeight),v),w=await t.detectOverflow(h,{...v,elementContext:"reference"}),E=Math.max(0,b.top),R=h.y+E,x=Math.max(0,y.scrollHeight-E-Math.max(0,b.bottom));return y.style.maxHeight=x+"px",y.scrollTop=E,i&&(y.offsetHeight<g.offsetHeight*Math.min(s,u.current.length-1)-1||w.top>=-f||w.bottom>=-f?r.flushSync((()=>i(!0))):r.flushSync((()=>i(!1)))),c&&(c.current=await t.detectOverflow(Ce({...h,y:R},y.offsetHeight),v)),{y:R}}}),e.safePolygon=function(e){let t,{restMs:n=0,buffer:r=.5,blockPointerEvents:o=!0,debug:u=null}=void 0===e?{}:e,c=!1;const i=e=>{let{x:o,y:u,placement:i,refs:l,onClose:a,nodeId:s,tree:f,leave:d=!1}=e;return function(e){function v(){clearTimeout(t),a()}clearTimeout(t);const{clientX:m,clientY:p}=e,g=L(e);if("mousemove"===e.type&&M(l.domReference.current,g))return;if("mouseleave"===e.type&&E(e.relatedTarget)&&M(l.floating.current,e.relatedTarget))return;if(f&&A(f.nodesRef.current,s).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if(M(l.floating.current,g)&&!d)return void(c=!0);if(!l.domReference.current||!l.floating.current||null==i||null==o||null==u)return;const h=l.domReference.current.getBoundingClientRect(),y=l.floating.current.getBoundingClientRect(),b=i.split("-")[0],w=o>y.right-y.width/2,R=u>y.bottom-y.height/2;if("top"===b&&u>=h.bottom-1||"bottom"===b&&u<=h.top+1||"left"===b&&o>=h.right-1||"right"===b&&o<=h.left+1)return v();switch(b){case"top":if(m>=y.left&&m<=y.right&&p>=y.top&&p<=h.top+1)return;break;case"bottom":if(m>=y.left&&m<=y.right&&p>=h.bottom-1&&p<=y.bottom)return;break;case"left":if(m>=y.left&&m<=h.left+1&&p>=y.top&&p<=y.bottom)return;break;case"right":if(m>=h.right-1&&m<=y.right&&p>=y.top&&p<=y.bottom)return}if(c)return v();const x=function(e){let[t,n]=e;const o=y.width>h.width,u=y.height>h.height;switch(b){case"top":return[[o?t+r/2:w?t+4*r:t-4*r,n+r+1],[o?t-r/2:w?t+4*r:t-4*r,n+r+1],...[[y.left,w||o?y.bottom-r:y.top],[y.right,w?o?y.bottom-r:y.top:y.bottom-r]]];case"bottom":return[[o?t+r/2:w?t+4*r:t-4*r,n-r],[o?t-r/2:w?t+4*r:t-4*r,n-r],...[[y.left,w||o?y.top+r:y.bottom],[y.right,w?o?y.top+r:y.bottom:y.top+r]]];case"left":{const e=[t+r+1,u?n+r/2:R?n+4*r:n-4*r],o=[t+r+1,u?n-r/2:R?n+4*r:n-4*r];return[...[[R||u?y.right-r:y.left,y.top],[R?u?y.right-r:y.left:y.right-r,y.bottom]],e,o]}case"right":return[[t-r,u?n+r/2:R?n+4*r:n-4*r],[t-r,u?n-r/2:R?n+4*r:n-4*r],...[[R||u?y.left+r:y.right,y.top],[R?u?y.left+r:y.right:y.left+r,y.bottom]]]}}([o,u]);!function(e,t){const[n,r]=e;let o=!1;const u=t.length;for(let e=0,c=u-1;e<u;c=e++){const[u,i]=t[e]||[0,0],[l,a]=t[c]||[0,0];i>=r!=a>=r&&n<=(l-u)*(r-i)/(a-i)+u&&(o=!o)}return o}([m,p],x)?v():n&&(t=setTimeout(a,n))}};return i.__options={blockPointerEvents:o},i},e.useClick=function(e,t){let{open:n,onOpenChange:r,dataRef:o,refs:c}=e,{enabled:i=!0,event:l="click",toggle:a=!0,ignoreMouse:s=!1,keyboardHandlers:f=!0}=void 0===t?{}:t;const d=u.useRef();return u.useMemo((()=>i?{reference:{onPointerDown(e){d.current=e.pointerType},onMouseDown(e){0===e.button&&("mouse"===d.current&&s||"click"!==l&&(n?!a||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:"mouse"===d.current&&s||(n?!a||o.current.openEvent&&"click"!==o.current.openEvent.type||r(!1):r(!0),o.current.openEvent=e.nativeEvent)},onKeyDown(e){d.current=void 0,f&&(Me(e)||(" "!==e.key||Ae(c.domReference.current)||e.preventDefault(),"Enter"===e.key&&(n?a&&r(!1):r(!0))))},onKeyUp(e){f&&(Me(e)||Ae(c.domReference.current)||" "===e.key&&(n?a&&r(!1):r(!0)))}}}:{}),[i,o,l,s,f,c,a,n,r])},e.useDelayGroup=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:o}=t;const{currentId:c,initialDelay:i,setState:l}=Oe();u.useEffect((()=>{c&&(l((e=>({...e,delay:{open:1,close:Te(i,"close")}}))),c!==o&&r(!1))}),[o,r,l,c,i]),u.useEffect((()=>{n||c!==o||(r(!1),l((e=>({...e,delay:i,currentId:null}))))}),[n,l,c,o,r,i])},e.useDelayGroupContext=Oe,e.useDismiss=function(e,n){let{open:r,onOpenChange:o,refs:c,events:i,nodeId:l}=e,{enabled:a=!0,escapeKey:s=!0,outsidePress:f=!0,outsidePressEvent:d="pointerdown",referencePress:v=!1,referencePressEvent:m="pointerdown",ancestorScroll:y=!1,bubbles:b=!0}=void 0===n?{}:n;const w=g(),R=null!=p(),k=O("function"==typeof f?f:()=>!1),T="function"==typeof f?k:f,S=u.useRef(!1);return u.useEffect((()=>{if(!r||!a)return;function e(e){if("Escape"===e.key){if(!b&&w&&A(w.nodesRef.current,l).length>0)return;i.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),o(!1)}}function n(e){const t=S.current;if(S.current=!1,t)return;if("function"==typeof T&&!T(e))return;const n=L(e);if(E(n)&&c.floating.current){var r;const t=null!=(r=c.floating.current.ownerDocument.defaultView)?r:window,o=n.scrollWidth>n.clientWidth,u=n.scrollHeight>n.clientHeight;let i=u&&e.offsetX>n.clientWidth;if(u){"rtl"===t.getComputedStyle(n).direction&&(i=e.offsetX<=n.offsetWidth-n.clientWidth)}if(i||o&&e.offsetY>n.clientHeight)return}const u=w&&A(w.nodesRef.current,l).some((t=>{var n;return Le(e,null==(n=t.context)?void 0:n.refs.floating.current)}));Le(e,c.floating.current)||Le(e,c.domReference.current)||u||!b&&w&&A(w.nodesRef.current,l).length>0||(i.emit("dismiss",{type:"outsidePress",data:{returnFocus:R?{preventScroll:!0}:x(e)||I(e)}}),o(!1))}function u(){o(!1)}const f=h(c.floating.current);s&&f.addEventListener("keydown",e),T&&f.addEventListener(d,n);let v=[];return y&&(E(c.domReference.current)&&(v=t.getOverflowAncestors(c.domReference.current)),E(c.floating.current)&&(v=v.concat(t.getOverflowAncestors(c.floating.current))),!E(c.reference.current)&&c.reference.current&&c.reference.current.contextElement&&(v=v.concat(t.getOverflowAncestors(c.reference.current.contextElement)))),v=v.filter((e=>{var t;return e!==(null==(t=f.defaultView)?void 0:t.visualViewport)})),v.forEach((e=>{e.addEventListener("scroll",u,{passive:!0})})),()=>{s&&f.removeEventListener("keydown",e),T&&f.removeEventListener(d,n),v.forEach((e=>{e.removeEventListener("scroll",u)}))}}),[s,T,d,i,w,l,r,o,y,a,b,c,R]),u.useEffect((()=>{S.current=!1}),[T,d]),u.useMemo((()=>a?{reference:{[Pe[m]]:()=>{v&&(i.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),o(!1))}},floating:{[De[d]]:()=>{S.current=!0}}}:{}),[a,i,v,d,m,o])},e.useFloating=function(e){let{open:n=!1,onOpenChange:r,whileElementsMounted:o,placement:l,middleware:a,strategy:s,nodeId:f}=void 0===e?{}:e;const[d,v]=u.useState(null),m=g(),p=u.useRef(null),h=u.useRef({}),y=u.useState((()=>i()))[0],b=t.useFloating({placement:l,middleware:a,strategy:s,whileElementsMounted:o}),w=O(r),R=u.useMemo((()=>({...b.refs,domReference:p})),[b.refs]),x=u.useMemo((()=>({...b,refs:R,dataRef:h,nodeId:f,events:y,open:n,onOpenChange:w,_:{domReference:d}})),[b,f,y,n,w,R,d]);c((()=>{const e=null==m?void 0:m.nodesRef.current.find((e=>e.id===f));e&&(e.context=x)}));const{reference:I}=b,k=u.useCallback((e=>{(E(e)||null===e)&&(x.refs.domReference.current=e,v(e)),I(e)}),[I,x.refs]);return u.useMemo((()=>({...b,context:x,refs:R,reference:k})),[b,R,x,k])},e.useFloatingNodeId=e=>{const t=d(),n=g(),r=p(),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=p,e.useFloatingPortalNode=se,e.useFloatingTree=g,e.useFocus=function(e,t){let{open:n,onOpenChange:r,dataRef:o,refs:c,events:i}=e,{enabled:l=!0,keyboardOnly:a=!0}=void 0===t?{}:t;const s=u.useRef(""),f=u.useRef(!1),d=u.useRef();return u.useEffect((()=>{var e;if(!l)return;const t=null!=(e=h(c.floating.current).defaultView)?e:window;function r(){!n&&R(c.domReference.current)&&c.domReference.current===te(h(c.domReference.current))&&(f.current=!0)}return t.addEventListener("blur",r),()=>{t.removeEventListener("blur",r)}}),[c,n,l]),u.useEffect((()=>{if(l)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(e){"referencePress"!==e.type&&"escapeKey"!==e.type||(f.current=!0)}}),[i,l]),u.useEffect((()=>()=>{clearTimeout(d.current)}),[]),u.useMemo((()=>l?{reference:{onPointerDown(e){let{pointerType:t}=e;s.current=t,f.current=!(!t||!a)},onMouseLeave(){f.current=!1},onFocus(e){var t;f.current||"focus"===e.type&&"mousedown"===(null==(t=o.current.openEvent)?void 0:t.type)&&o.current.openEvent&&Le(o.current.openEvent,c.domReference.current)||(o.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){f.current=!1;const t=e.relatedTarget,n=E(t)&&t.hasAttribute("data-floating-ui-focus-guard");d.current=setTimeout((()=>{M(c.floating.current,t)||M(c.domReference.current,t)||n||r(!1)}))}}}:{}),[l,a,c,o,r])},e.useHover=function(e,t){let{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:i=!1,restMs:l=0,move:a=!0}=void 0===t?{}:t;const{open:s,onOpenChange:f,dataRef:d,events:v,refs:m,_:y}=e,b=g(),w=p(),R=Ee(o),x=Ee(r),I=u.useRef(),k=u.useRef(),T=u.useRef(),S=u.useRef(),O=u.useRef(!0),C=u.useRef(!1),M=u.useCallback((()=>{var e;const t=null==(e=d.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[d]);u.useEffect((()=>{if(n)return v.on("dismiss",e),()=>{v.off("dismiss",e)};function e(){clearTimeout(k.current),clearTimeout(S.current),O.current=!0}}),[n,v,m]),u.useEffect((()=>{if(!n||!R.current||!s)return;function e(){M()&&f(!1)}const t=h(m.floating.current).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[m,s,f,n,R,d,M]);const A=u.useCallback((function(e){void 0===e&&(e=!0);const t=Te(x.current,"close",I.current);t&&!T.current?(clearTimeout(k.current),k.current=setTimeout((()=>f(!1)),t)):e&&(clearTimeout(k.current),f(!1))}),[x,f]),L=u.useCallback((()=>{T.current&&(h(m.floating.current).removeEventListener("mousemove",T.current),T.current=void 0)}),[m]),P=u.useCallback((()=>{h(m.floating.current).body.style.pointerEvents="",C.current=!1}),[m]);return u.useEffect((()=>{if(!n)return;function t(){return!!d.current.openEvent&&["click","mousedown"].includes(d.current.openEvent.type)}function r(e){if(clearTimeout(k.current),O.current=!1,i&&!ke.includes(I.current)||l>0&&0===Te(x.current,"open"))return;d.current.openEvent=e;const t=Te(x.current,"open",I.current);t?k.current=setTimeout((()=>{f(!0)}),t):f(!0)}function o(n){if(t())return;const r=h(m.floating.current);if(clearTimeout(S.current),R.current)return clearTimeout(k.current),T.current&&r.removeEventListener("mousemove",T.current),T.current=R.current({...e,tree:b,x:n.clientX,y:n.clientY,onClose(){P(),L(),A()}}),void r.addEventListener("mousemove",T.current);A()}function u(n){t()||null==R.current||R.current({...e,tree:b,x:n.clientX,y:n.clientY,leave:!0,onClose(){P(),L(),A()}})(n)}const c=m.floating.current,v=m.domReference.current;return E(v)?(s&&v.addEventListener("mouseleave",u),null==c||c.addEventListener("mouseleave",u),a&&v.addEventListener("mousemove",r,{once:!0}),v.addEventListener("mouseenter",r),v.addEventListener("mouseleave",o),()=>{s&&v.removeEventListener("mouseleave",u),null==c||c.removeEventListener("mouseleave",u),a&&v.removeEventListener("mousemove",r),v.removeEventListener("mouseenter",r),v.removeEventListener("mouseleave",o)}):void 0}),[y.domReference,n,e,i,l,a,A,L,P,f,s,b,m,x,R,d]),c((()=>{if(n&&s&&R.current&&R.current.__options.blockPointerEvents&&M()){h(m.floating.current).body.style.pointerEvents="none",C.current=!0;const n=m.domReference.current,r=m.floating.current;if(E(n)&&r){var e,t;const o=null==b||null==(e=b.nodesRef.current.find((e=>e.id===w)))||null==(t=e.context)?void 0:t.refs.floating.current;return o&&(o.style.pointerEvents=""),n.style.pointerEvents="auto",r.style.pointerEvents="auto",()=>{n.style.pointerEvents="",r.style.pointerEvents=""}}}}),[n,s,w,m,b,R,d,M]),c((()=>{s||(I.current=void 0,L(),C.current&&P())}),[s,L,P]),u.useEffect((()=>()=>{L(),clearTimeout(k.current),clearTimeout(S.current),C.current&&P()}),[n,L,P]),u.useMemo((()=>{if(!n)return{};function e(e){I.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){s||0===l||(clearTimeout(S.current),S.current=setTimeout((()=>{O.current||f(!0)}),l))}},floating:{onMouseEnter(){clearTimeout(k.current)},onMouseLeave(){A(!1)}}}}),[n,l,s,f,A])},e.useId=d,e.useInnerOffset=(e,t)=>{let{open:n,refs:o}=e,{enabled:c=!0,overflowRef:i,scrollRef:l,onChange:a}=t;const s=O(a),f=u.useRef(!1),d=u.useRef(null),v=u.useRef(null);return u.useEffect((()=>{var e;if(!c)return;function t(e){if(e.ctrlKey||!u||null==i.current)return;const t=e.deltaY,n=i.current.top>=-.5,o=i.current.bottom>=-.5,c=u.scrollHeight-u.clientHeight,l=t<0?-1:1,a=t<0?"max":"min";u.scrollHeight<=u.clientHeight||(!n&&t>0||!o&&t<0?(e.preventDefault(),r.flushSync((()=>{s((e=>e+Math[a](t,c*l)))}))):/firefox/i.test(b())&&(u.scrollTop+=t))}const u=null!=(e=null==l?void 0:l.current)?e:o.floating.current;return n&&u?(u.addEventListener("wheel",t),requestAnimationFrame((()=>{d.current=u.scrollTop,null!=i.current&&(v.current={...i.current})})),()=>{d.current=null,v.current=null,u.removeEventListener("wheel",t)}):void 0}),[c,n,o,i,l,s]),u.useMemo((()=>c?{floating:{onKeyDown(){f.current=!0},onWheel(){f.current=!1},onPointerMove(){f.current=!1},onScroll(){const e=(null==l?void 0:l.current)||o.floating.current;if(i.current&&e&&f.current){if(null!==d.current){const t=e.scrollTop-d.current;(i.current.bottom<-.5&&t<-1||i.current.top<-.5&&t>1)&&r.flushSync((()=>s((e=>e+t))))}requestAnimationFrame((()=>{d.current=e.scrollTop}))}}}}:{}),[c,i,o,l,s])},e.useInteractions=function(e){void 0===e&&(e=[]);const t=e,n=u.useCallback((t=>C(t,e,"reference")),t),r=u.useCallback((t=>C(t,e,"floating")),t),o=u.useCallback((t=>C(t,e,"item")),t);return u.useMemo((()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:o})),[n,r,o])},e.useListNavigation=function(e,t){let{open:n,onOpenChange:o,refs:i}=e,{listRef:l,activeIndex:a,onNavigate:s=(()=>{}),enabled:f=!0,selectedIndex:d=null,allowEscape:v=!1,loop:m=!1,nested:y=!1,rtl:b=!1,virtual:w=!1,focusItemOnOpen:E="auto",focusItemOnHover:S=!0,openOnArrowKeyDown:C=!0,disabledIndices:A,orientation:L="vertical",cols:P=1}=void 0===t?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:t;const D=p(),F=g(),N=O(s),H=u.useRef(E),j=u.useRef(null!=d?d:-1),K=u.useRef(null),W=u.useRef(!1),B=u.useRef(N),_=u.useRef(n),q=u.useRef(!1),U=Ee(A),V=Ee(n),[X,Y]=u.useState(),z=u.useCallback(((e,t)=>{if(w){var n;Y(null==(n=e.current[t.current])?void 0:n.id)}else{xe(e.current[t.current],{preventScroll:!0,sync:!(!T()||!k())&&(Fe||q.current)})}}),[w]);return c((()=>{document.createElement("div").focus({get preventScroll(){return Fe=!0,!1}})}),[]),c((()=>{f&&(n?H.current&&null!=d&&N(d):_.current&&(j.current=-1,B.current(null)))}),[f,n,d,N]),c((()=>{if(f&&n)if(null==a){if(q.current=!1,null!=d)return;_.current&&(j.current=-1,z(l,j)),!_.current&&H.current&&(null!=K.current||!0===H.current&&null==K.current)&&(j.current=null==K.current||Ve(K.current,L,b)||y?Xe(l,U.current):Ye(l,U.current),N(j.current))}else Be(l,a)||(j.current=a,z(l,j))}),[f,n,a,d,y,l,L,b,N,z,U]),c((()=>{if(f&&_.current&&!n){var e,t;const n=null==F||null==(e=F.nodesRef.current.find((e=>e.id===D)))||null==(t=e.context)?void 0:t.refs.floating.current;n&&!M(n,te(h(n)))&&n.focus({preventScroll:!0})}}),[f,n,F,D]),c((()=>{K.current=null,B.current=N,_.current=n})),u.useMemo((()=>{if(!f)return{};const e=U.current;function t(t){if(W.current=!0,q.current=!0,!V.current&&t.currentTarget===i.floating.current)return;if(y&&function(e,t,n){return qe(t,n?e===Ke:e===je,e===Ne)}(t.key,L,b))return we(t),o(!1),void(R(i.domReference.current)&&i.domReference.current.focus());const r=j.current,u=Xe(l,e),c=Ye(l,e);if("Home"===t.key&&(j.current=u,N(j.current)),"End"===t.key&&(j.current=c,N(j.current)),P>1){const n=j.current;if(t.key===Ne){if(we(t),-1===n)j.current=c;else if(j.current=_e(l,{startingIndex:n,amount:P,decrement:!0,disabledIndices:e}),m&&(n-P<u||j.current<0)){const e=n%P,t=c%P,r=c-(t-e);j.current=t===e?c:t>e?r:r-P}Be(l,j.current)&&(j.current=n),N(j.current)}if(t.key===He&&(we(t),-1===n?j.current=u:(j.current=_e(l,{startingIndex:n,amount:P,disabledIndices:e}),m&&n+P>c&&(j.current=_e(l,{startingIndex:n%P-P,amount:P,disabledIndices:e}))),Be(l,j.current)&&(j.current=n),N(j.current)),"both"===L){const r=Math.floor(n/P);t.key===Ke&&(we(t),n%P!=P-1?(j.current=_e(l,{startingIndex:n,disabledIndices:e}),m&&We(j.current,P,r)&&(j.current=_e(l,{startingIndex:n-n%P-1,disabledIndices:e}))):m&&(j.current=_e(l,{startingIndex:n-n%P-1,disabledIndices:e})),We(j.current,P,r)&&(j.current=n)),t.key===je&&(we(t),n%P!=0?(j.current=_e(l,{startingIndex:n,disabledIndices:e,decrement:!0}),m&&We(j.current,P,r)&&(j.current=_e(l,{startingIndex:n+(P-n%P),decrement:!0,disabledIndices:e}))):m&&(j.current=_e(l,{startingIndex:n+(P-n%P),decrement:!0,disabledIndices:e})),We(j.current,P,r)&&(j.current=n));const o=Math.floor(c/P)===r;return Be(l,j.current)&&(j.current=m&&o?t.key===je?c:_e(l,{startingIndex:n-n%P-1,disabledIndices:e}):n),void N(j.current)}}if(Ue(t.key,L)){if(we(t),n&&!w&&te(t.currentTarget.ownerDocument)===t.currentTarget)return j.current=Ve(t.key,L,b)?u:c,void N(j.current);Ve(t.key,L,b)?j.current=m?r>=c?v&&r!==l.current.length?-1:u:_e(l,{startingIndex:r,disabledIndices:e}):Math.min(c,_e(l,{startingIndex:r,disabledIndices:e})):j.current=m?r<=u?v&&-1!==r?l.current.length:c:_e(l,{startingIndex:r,decrement:!0,disabledIndices:e}):Math.max(u,_e(l,{startingIndex:r,decrement:!0,disabledIndices:e})),Be(l,j.current)?N(null):N(j.current)}}function u(e){"auto"===E&&x(e.nativeEvent)&&(H.current=!0)}return{reference:{...w&&n&&null!=a&&{"aria-activedescendant":X},onKeyDown(r){W.current=!0;const u=0===r.key.indexOf("Arrow");if(w&&n)return t(r);if(!n&&!C&&u)return;(u||"Enter"===r.key||" "===r.key||""===r.key)&&(K.current=r.key),y?function(e,t,n){return qe(t,n?e===je:e===Ke,e===He)}(r.key,L,b)&&(we(r),n?(j.current=Xe(l,e),N(j.current)):o(!0)):Ue(r.key,L)&&(null!=d&&(j.current=d),we(r),!n&&C?o(!0):t(r),n&&N(j.current))},onFocus(){n&&N(null)},onPointerDown:function(e){H.current=E,"auto"===E&&I(e.nativeEvent)&&(H.current=!0)},onMouseDown:u,onClick:u},floating:{"aria-orientation":"both"===L?void 0:L,...w&&null!=a&&{"aria-activedescendant":X},onKeyDown:t,onPointerMove(){W.current=!1}},item:{onFocus(e){let{currentTarget:t}=e;const n=l.current.indexOf(t);-1!==n&&a!==n&&N(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...S&&{onMouseMove(e){let{currentTarget:t}=e;const n=t;if(n){const e=l.current.indexOf(n);-1!==e&&a!==e&&N(e)}},onPointerLeave(){var e;W.current||(j.current=-1,z(l,j),r.flushSync((()=>N(null))),w||null==(e=i.floating.current)||e.focus({preventScroll:!0}))}}}}}),[X,U,V,l,f,L,b,w,n,a,y,d,C,S,v,P,m,i,E,z,N,o])},e.useRole=function(e,t){let{open:n}=e,{enabled:r=!0,role:o="dialog"}=void 0===t?{}:t;const c=d(),i=d();return u.useMemo((()=>{const e={id:c,role:o};return r?"tooltip"===o?{reference:{"aria-describedby":n?c:void 0},floating:e}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":"alertdialog"===o?"dialog":o,"aria-controls":n?c:void 0,..."listbox"===o&&{role:"combobox"},..."menu"===o&&{id:i}},floating:{...e,..."menu"===o&&{"aria-labelledby":i}}}:{}}),[r,o,n,c,i])},e.useTypeahead=function(e,t){var n;let{open:r,dataRef:o}=e,{listRef:i,activeIndex:l,onMatch:a=(()=>{}),enabled:s=!0,findMatch:f=null,resetMs:d=1e3,ignoreKeys:v=[],selectedIndex:m=null}=void 0===t?{listRef:{current:[]},activeIndex:null}:t;const p=u.useRef(),g=u.useRef(""),y=u.useRef(null!=(n=null!=m?m:l)?n:-1),b=u.useRef(null),w=O(a),R=Ee(f),x=Ee(v);return c((()=>{r&&(clearTimeout(p.current),b.current=null,g.current="")}),[r]),c((()=>{var e;r&&""===g.current&&(y.current=null!=(e=null!=m?m:l)?e:-1)}),[r,m,l]),u.useMemo((()=>{if(!s)return{};function e(e){const t=L(e.nativeEvent);if(E(t)&&te(h(t))!==e.currentTarget&&t.closest('[role="dialog"],[role="menu"],[role="listbox"],[role="tree"],[role="grid"]')!==e.currentTarget)return;g.current.length>0&&" "!==g.current[0]&&(o.current.typing=!0," "===e.key&&we(e));const n=i.current;if(null==n||x.current.includes(e.key)||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey)return;n.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&g.current===e.key&&(g.current="",y.current=b.current),g.current+=e.key,clearTimeout(p.current),p.current=setTimeout((()=>{g.current="",y.current=b.current,o.current.typing=!1}),d);const r=y.current,u=[...n.slice((null!=r?r:0)+1),...n.slice(0,(null!=r?r:0)+1)],c=R.current?R.current(u,g.current):u.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(g.current.toLocaleLowerCase())))),l=c?n.indexOf(c):-1;-1!==l&&(w(l),b.current=l)}return{reference:{onKeyDown:e},floating:{onKeyDown:e}}}),[s,o,i,d,x,R,w])},Object.keys(t).forEach((function(n){"default"===n||e.hasOwnProperty(n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})})),Object.defineProperty(e,"__esModule",{value:!0})})); | ||
*/var W=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"].join(","),q="undefined"==typeof Element,U=q?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,z=!q&&Element.prototype.getRootNode?function(e){return e.getRootNode()}:function(e){return e.ownerDocument},X=function e(t,n,r){for(var o=[],u=Array.from(t);u.length;){var c=u.shift();if("SLOT"===c.tagName){var i=c.assignedElements(),l=e(i.length?i:c.children,!0,r);r.flatten?o.push.apply(o,l):o.push({scopeParent:c,candidates:l})}else{U.call(c,W)&&r.filter(c)&&(n||!t.includes(c))&&o.push(c);var a=c.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(c),s=!r.shadowRootFilter||r.shadowRootFilter(c);if(a&&s){var f=e(!0===a?c.children:a.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:c,candidates:f})}else u.unshift.apply(u,c.children)}}return o},Y=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},_=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},G=function(e){return"INPUT"===e.tagName},$=function(e){return function(e){return G(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||z(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)},J=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Q=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=U.call(e,"details>summary:first-of-type")?e.parentElement:e;if(U.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return J(e)}else{if("function"==typeof r){for(var u=e;e;){var c=e.parentElement,i=z(e);if(c&&!c.shadowRoot&&!0===r(c))return J(e);e=e.assignedSlot?e.assignedSlot:c||i===e.ownerDocument?c:i.host}e=u}if(function(e){for(var t,n=z(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=z(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 G(e)&&"hidden"===e.type}(t)||Q(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!!U.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},ee=function(e,t){return!($(t)||Y(t)<0||!Z(e,t))},te=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},ne=function e(t){var n=[],r=[];return t.forEach((function(t,o){var u=!!t.scopeParent,c=u?t.scopeParent:t,i=Y(c,u),l=u?e(t.candidates):c;0===i?u?n.push.apply(n,l):n.push(c):r.push({documentOrder:o,tabIndex:i,item:t,isScope:u,content:l})})),r.sort(_).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},re=function(e,t){var n;return n=(t=t||{}).getShadowRoot?X([e],t.includeContainer,{filter:ee.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:te}):function(e,t,n){var r=Array.prototype.slice.apply(e.querySelectorAll(W));return t&&U.call(e,W)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,ee.bind(null,t)),ne(n)};function oe(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}const ue=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function ce(e,t){const n=re(e,ue());"prev"===t&&n.reverse();const r=n.indexOf(oe(h(e)));return n.slice(r+1)[0]}function ie(){return ce(document.body,"next")}function le(){return ce(document.body,"prev")}function ae(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!A(n,r)}function se(e){re(e,ue()).forEach((e=>{var t;e.dataset.tabindex=null!=(t=e.getAttribute("tabindex"))?t:"",e.setAttribute("tabindex","-1")}))}function fe(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 de=u.createContext(null),me=function(e){let{id:t,enabled:n=!0}=void 0===e?{}:e;const[r,o]=u.useState(null),i=d(),l=ve();return c((()=>{if(!n)return;const e=t?document.getElementById(t):null;if(!e){const e=document.createElement("div");e.id=t||i,e.setAttribute("data-floating-ui-portal",""),o(e);const n=(null==l?void 0:l.portalNode)||document.body;return n.appendChild(e),()=>{n.removeChild(e)}}e.setAttribute("data-floating-ui-portal",""),o(e)}),[t,l,i,n]),r},ve=()=>u.useContext(de),pe="data-floating-ui-scroll-lock",ge=u.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return c((()=>{var e,t,r,o;if(!n)return;if(document.body.hasAttribute(pe))return;document.body.setAttribute(pe,"");const u=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",c=window.innerWidth-document.documentElement.clientWidth;if(!/iP(hone|ad|od)|iOS/.test(b()))return Object.assign(document.body.style,{overflow:"hidden",[u]:c+"px"}),()=>{document.body.removeAttribute(pe),Object.assign(document.body.style,{overflow:"",[u]:""})};const i=null!=(e=null==(t=window.visualViewport)?void 0:t.offsetLeft)?e:0,l=null!=(r=null==(o=window.visualViewport)?void 0:o.offsetTop)?r:0,a=window.pageXOffset,s=window.pageYOffset;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:-(s-Math.floor(l))+"px",left:-(a-Math.floor(i))+"px",right:"0",[u]:c+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[u]:""}),document.body.removeAttribute(pe),window.scrollTo(a,s)}}),[n]),u.createElement("div",N({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));var he=new WeakMap,be=new WeakMap,ye={},we=0,Ee=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];ye[n]||(ye[n]=new WeakMap);var o=ye[n],u=[],c=new Set,i=function(e){e&&!c.has(e)&&(c.add(e),i(e.parentNode))};r.forEach(i);var l=function(e){!e||r.indexOf(e)>=0||Array.prototype.forEach.call(e.children,(function(e){if(c.has(e))l(e);else{var t=e.getAttribute("aria-hidden"),r=null!==t&&"false"!==t,i=(he.get(e)||0)+1,a=(o.get(e)||0)+1;he.set(e,i),o.set(e,a),u.push(e),1===i&&r&&be.set(e,!0),1===a&&e.setAttribute(n,"true"),r||e.setAttribute("aria-hidden","true")}}))};return l(t),c.clear(),we++,function(){u.forEach((function(e){var t=he.get(e)-1,r=o.get(e)-1;he.set(e,t),o.set(e,r),t||(be.has(e)||e.removeAttribute("aria-hidden"),be.delete(e)),r||e.removeAttribute(n)})),--we||(he=new WeakMap,he=new WeakMap,be=new WeakMap,ye={})}};function Re(e){return R(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function xe(e){e.preventDefault(),e.stopPropagation()}function Ie(e){const t=n.useRef(e);return c((()=>{t.current=e})),t}let Te=0;function ke(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(Te);const u=()=>null==e?void 0:e.focus({preventScroll:n});o?u():Te=requestAnimationFrame(u)}const Se=u.forwardRef((function(e,t){return u.createElement("button",N({},e,{ref:t,tabIndex:-1,style:K}))}));function Ce(e,t,n){return n&&!S(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}const Oe=u.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{}}),Me=()=>u.useContext(Oe);function Ae(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}function Le(e){return R(e.target)&&"BUTTON"===e.target.tagName}function Pe(e){return Re(e)}function De(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 Fe={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Ne={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"};let Ke=!1;const je="ArrowUp",He="ArrowDown",Be="ArrowLeft",Ve="ArrowRight";function We(e,t,n){return Math.floor(e/t)!==n}function qe(e,t){return t<0||t>=e.current.length}function Ue(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o,amount:u=1}=void 0===t?{}:t;const c=e.current;let i=n;do{var l,a;i+=r?-u:u}while(i>=0&&i<=c.length-1&&(o?o.includes(i):null==c[i]||(null==(l=c[i])?void 0:l.hasAttribute("disabled"))||"true"===(null==(a=c[i])?void 0:a.getAttribute("aria-disabled"))));return i}function ze(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Xe(e,t){return ze(t,e===je||e===He,e===Be||e===Ve)}function Ye(e,t,n){return ze(t,e===He,n?e===Be:e===Ve)||"Enter"===e||" "==e||""===e}function _e(e,t){return Ue(e,{disabledIndices:t})}function Ge(e,t){return Ue(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}e.FloatingDelayGroup=e=>{let{children:t,delay:n,timeoutMs:r=0}=e;const[o,c]=u.useState({delay:n,timeoutMs:r,initialDelay:n,currentId:null}),i=u.useCallback((e=>{c((t=>({...t,currentId:e})))}),[]);return u.createElement(Oe.Provider,{value:u.useMemo((()=>({...o,setState:c,setCurrentId:i})),[o,c,i])},t)},e.FloatingFocusManager=function(e){let{context:t,children:n,order:r=["content"],guards:o=!0,initialFocus:i=0,returnFocus:l=!0,modal:a=!0,visuallyHiddenDismiss:s=!1,closeOnFocusOut:f=!0}=e;const{refs:d,nodeId:m,onOpenChange:v,events:p,_:{domReference:b}}=t,y=Ie(r),w=g(),E=ve(),[x,I]=u.useState(null),T="number"==typeof i&&i<0,k=u.useRef(null),S=u.useRef(null),C=u.useRef(!1),O=u.useRef(null),M=null!=E,D=b&&"combobox"===b.getAttribute("role")&&Re(b),F=u.useCallback((function(e){return void 0===e&&(e=d.floating.current),e?re(e,ue()):[]}),[d]),N=u.useCallback((e=>{const t=F(e);return y.current.map((e=>d.domReference.current&&"reference"===e?d.domReference.current:d.floating.current&&"floating"===e?d.floating.current:t)).filter(Boolean).flat()}),[y,d,F]);u.useEffect((()=>{if(!a)return;function e(e){if("Tab"===e.key){0!==F().length||D||xe(e);const t=N(),n=P(e);"reference"===y.current[0]&&n===d.domReference.current&&(xe(e),e.shiftKey?ke(t[t.length-1]):ke(t[1])),"floating"===y.current[1]&&n===d.floating.current&&e.shiftKey&&(xe(e),ke(t[0]))}}const t=h(d.floating.current);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[a,y,d,D,F,N]),u.useEffect((()=>{if(!f)return;const e=d.floating.current,t=d.domReference.current;let n=!1;function r(){n=!0,setTimeout((()=>{n=!1}))}function o(r){const o=r.relatedTarget,u=!(A(t,o)||A(e,o)||A(o,e)||A(null==E?void 0:E.portalNode,o)||null!=o&&o.hasAttribute("data-floating-ui-focus-guard")||w&&(L(w.nodesRef.current,m).find((e=>{var t,n;return A(null==(t=e.context)?void 0:t.refs.floating.current,o)||A(null==(n=e.context)?void 0:n.refs.domReference.current,o)}))||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}(w.nodesRef.current,m).find((e=>{var t,n;return(null==(t=e.context)?void 0:t.refs.floating.current)===o||(null==(n=e.context)?void 0:n.refs.domReference.current)===o}))));o&&u&&!n&&o!==O.current&&(C.current=!0,setTimeout((()=>v(!1))))}return e&&R(t)?(t.addEventListener("focusout",o),t.addEventListener("pointerdown",r),!a&&e.addEventListener("focusout",o),()=>{t.removeEventListener("focusout",o),t.removeEventListener("pointerdown",r),!a&&e.removeEventListener("focusout",o)}):void 0}),[a,m,w,d,E,v,f]),u.useEffect((()=>{var e,t;const n=d.floating.current,r=d.domReference.current,o=Array.from(null!=(e=null==E||null==(t=E.portalNode)?void 0:t.querySelectorAll("[data-floating-ui-portal]"))?e:[]);if(n&&R(r)&&a){const e=[n,...o,...[k.current,S.current].filter(Boolean)],t=Ee(y.current.includes("reference")||D?e.concat(r):e);return()=>{t()}}}),[a,y,E,d,D]),u.useEffect((()=>{const e=d.floating.current;if(a&&!o&&e){const t=[],n=ue(),r=re(h(e).body,n),o=N(),u=r.filter((e=>!o.includes(e)));return u.forEach(((e,n)=>{t[n]=e.getAttribute("tabindex"),e.setAttribute("tabindex","-1")})),()=>{u.forEach(((e,n)=>{const r=t[n];null==r?e.removeAttribute("tabindex"):e.setAttribute("tabindex",r)}))}}}),[a,o,d,N]),c((()=>{const e=d.floating.current;if(!e)return;const t=h(e);let n=l,r=!1;const o=oe(t);O.current=o;const u=N(e),c=("number"==typeof i?u[i]:i.current)||e;function a(e){if("escapeKey"===e.type&&d.domReference.current&&(O.current=d.domReference.current),["referencePress","escapeKey"].includes(e.type))return;const t=e.data.returnFocus;"object"==typeof t?(n=!0,r=t.preventScroll):n=t}return!T&&ke(c,{preventScroll:c===e}),p.on("dismiss",a),()=>{p.off("dismiss",a),A(e,oe(t))&&d.domReference.current&&(O.current=d.domReference.current),n&&R(O.current)&&!C.current&&ke(O.current,{preventScroll:r,cancelPrevious:!1})}}),[N,i,l,d,p,T]),c((()=>{if(E)return E.setFocusManagerState({...t,modal:a}),()=>{E.setFocusManagerState(null)}}),[E,a,t]),c((()=>{0!==F().length||T||I(0)}),[F,d,T]);const K=o&&(M||a)&&!D;function j(e){return s&&a?u.createElement(Se,{ref:"start"===e?k:S,onClick:()=>v(!1)},"string"==typeof s?s:"Dismiss"):null}return u.createElement(u.Fragment,null,K&&u.createElement(V,{ref:null==E?void 0:E.beforeInsideRef,onFocus:e=>{if(a){const e=N();ke("reference"===r[0]?e[0]:e[e.length-1])}else if(null!=E&&E.preserveTabOrder&&E.portalNode)if(C.current=!1,ae(e,E.portalNode)){const e=ie()||b;null==e||e.focus()}else{var t;null==(t=E.beforeOutsideRef.current)||t.focus()}}}),D?null:j("start"),u.cloneElement(n,0===x||r.includes("floating")?{tabIndex:0}:{}),j("end"),K&&u.createElement(V,{ref:null==E?void 0:E.afterInsideRef,onFocus:e=>{if(a)ke(N()[0]);else if(null!=E&&E.preserveTabOrder&&E.portalNode)if(C.current=!0,ae(e,E.portalNode)){const e=le()||b;null==e||e.focus()}else{var t;null==(t=E.afterOutsideRef.current)||t.focus()}}}))},e.FloatingNode=e=>{let{children:t,id:n}=e;const r=p();return u.createElement(m.Provider,{value:u.useMemo((()=>({id:n,parentId:r})),[n,r])},t)},e.FloatingOverlay=ge,e.FloatingPortal=e=>{let{children:t,id:n,root:o=null,preserveTabOrder:c=!0}=e;const i=me({id:n,enabled:!o}),[l,a]=u.useState(null),s=u.useRef(null),f=u.useRef(null),d=u.useRef(null),m=u.useRef(null),v=!!l&&!l.modal&&!(!o&&!i)&&c;return u.useEffect((()=>{if(i&&c&&(null==l||!l.modal))return i.addEventListener("focusin",e,!0),i.addEventListener("focusout",e,!0),()=>{i.removeEventListener("focusin",e,!0),i.removeEventListener("focusout",e,!0)};function e(e){if(i&&ae(e)){("focusin"===e.type?fe:se)(i)}}}),[i,c,null==l?void 0:l.modal]),u.createElement(de.Provider,{value:u.useMemo((()=>({preserveTabOrder:c,beforeOutsideRef:s,afterOutsideRef:f,beforeInsideRef:d,afterInsideRef:m,portalNode:i,setFocusManagerState:a})),[c,i])},v&&i&&u.createElement(V,{ref:s,onFocus:e=>{if(ae(e,i)){var t;null==(t=d.current)||t.focus()}else{const e=le()||(null==l?void 0:l.refs.domReference.current);null==e||e.focus()}}}),v&&i&&u.createElement("span",{"aria-owns":i.id,style:K}),o?r.createPortal(t,o):i?r.createPortal(t,i):null,v&&i&&u.createElement(V,{ref:f,onFocus:e=>{if(ae(e,i)){var t;null==(t=m.current)||t.focus()}else{const e=ie()||(null==l?void 0:l.refs.domReference.current);null==e||e.focus(),null==l||l.onOpenChange(!1)}}}))},e.FloatingTree=e=>{let{children:t}=e;const n=u.useRef([]),r=u.useCallback((e=>{n.current=[...n.current,e]}),[]),o=u.useCallback((e=>{n.current=n.current.filter((t=>t!==e))}),[]),c=u.useState((()=>i()))[0];return u.createElement(v.Provider,{value:u.useMemo((()=>({nodesRef:n,addNode:r,removeNode:o,events:c})),[n,r,o,c])},t)},e.inner=e=>({name:"inner",options:e,async fn(n){var o;const{listRef:u,overflowRef:c,onFallbackChange:i,offset:l=0,index:a=0,minItemsVisible:s=4,referenceOverflowThreshold:f=0,scrollRef:d,...m}=e,{rects:v,elements:{floating:p}}=n,g=u.current[a];if(!g)return{};const h={...n,...await t.offset(-g.offsetTop-v.reference.height/2-g.offsetHeight/2-l).fn(n)},b=null!=(o=null==d?void 0:d.current)?o:p,y=await t.detectOverflow(Ae(h,b.scrollHeight),m),w=await t.detectOverflow(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,u.current.length-1)-1||w.top>=-f||w.bottom>=-f?r.flushSync((()=>i(!0))):r.flushSync((()=>i(!1)))),c&&(c.current=await t.detectOverflow(Ae({...h,y:R},b.offsetHeight),m)),{y:R}}}),e.safePolygon=function(e){let t,{restMs:n=0,buffer:r=.5,blockPointerEvents:o=!0}=void 0===e?{}:e,u=!1,c=!1;return e=>{let{x:i,y:l,placement:a,refs:s,onClose:f,nodeId:d,tree:m,polygonRef:v}=e;return function(e){var p;function g(){F(v),clearTimeout(t),f()}if(clearTimeout(t),!s.domReference.current||!s.floating.current||null==a||null==i||null==l)return;const{clientX:b,clientY:y}=e,w=P(e),R="mouseleave"===e.type,x=A(s.domReference.current,w),I=A(s.floating.current,w);if(!R&&x)return void F(v);if(!R&&(x||u&&A(v.current,w)))return;if(R&&E(e.relatedTarget)&&A(s.floating.current,e.relatedTarget))return;if(m&&L(m.nodesRef.current,d).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if(I&&(c=!0),I&&!R&&"rect"!==(null==(p=v.current)?void 0:p.dataset.type))return void F(v);const k=s.domReference.current.getBoundingClientRect(),S=s.floating.current.getBoundingClientRect(),C=a.split("-")[0],O=i>S.right-S.width/2,M=l>S.bottom-S.height/2;if("top"===C&&l>=k.bottom-1||"bottom"===C&&l<=k.top+1||"left"===C&&i>=k.right-1||"right"===C&&i<=k.left+1)return g();let N=[];switch(C){case"top":N=[[S.left,k.top+1],[S.left,S.bottom-1],[S.right,S.bottom-1],[S.right,k.top+1]],u=b>=S.left&&b<=S.right&&y>=S.top&&y<=k.top+1;break;case"bottom":N=[[S.left,S.top+1],[S.left,k.bottom-1],[S.right,k.bottom-1],[S.right,S.top+1]],u=b>=S.left&&b<=S.right&&y>=k.bottom-1&&y<=S.bottom;break;case"left":N=[[S.right-1,S.bottom],[S.right-1,S.top],[k.left+1,S.top],[k.left+1,S.bottom]],u=b>=S.left&&b<=k.left+1&&y>=S.top&&y<=S.bottom;break;case"right":N=[[k.right-1,S.bottom],[k.right-1,S.top],[S.left+1,S.top],[S.left+1,S.bottom]],u=b>=k.right-1&&b<=S.right&&y>=S.top&&y<=S.bottom}const K=u?N:function(e){let[t,n]=e;const o=S.width>k.width,u=S.height>k.height;switch(C){case"top":return[[o?t+r/2:O?t+4*r:t-4*r,n+r+1],[o?t-r/2:O?t+4*r:t-4*r,n+r+1],...[[S.left,O||o?S.bottom-r:S.top],[S.right,O?o?S.bottom-r:S.top:S.bottom-r]]];case"bottom":return[[o?t+r/2:O?t+4*r:t-4*r,n-r],[o?t-r/2:O?t+4*r:t-4*r,n-r],...[[S.left,O||o?S.top+r:S.bottom],[S.right,O?o?S.top+r:S.bottom:S.top+r]]];case"left":{const e=[t+r+1,u?n+r/2:M?n+4*r:n-4*r],o=[t+r+1,u?n-r/2:M?n+4*r:n-4*r];return[...[[M||u?S.right-r:S.left,S.top],[M?u?S.right-r:S.left:S.right-r,S.bottom]],e,o]}case"right":return[[t-r,u?n+r/2:M?n+4*r:n-4*r],[t-r,u?n-r/2:M?n+4*r:n-4*r],...[[M||u?S.left+r:S.right,S.top],[M?u?S.left+r:S.right:S.left+r,S.bottom]]]}}([i,l]);if(!v.current&&o&&R){const e=h(s.floating.current);v.current=function(e,t,n){var r,o;const u=T(),c=t.defaultView||window,i=t.createElementNS(D,"svg");Object.assign(i.style,{position:"fixed",left:(u&&(null==(r=c.visualViewport)?void 0:r.offsetLeft)||0)+"px",top:(u&&(null==(o=c.visualViewport)?void 0:o.offsetTop)||0)+"px",width:"100%",height:"100%",pointerEvents:"none",zIndex:2147483647}),i.setAttribute("data-type",n?"rect":"triangle");const l=t.createElementNS(D,"polygon");return l.setAttribute("points",e.map((e=>{let[t,n]=e;return t+","+n})).join(" ")),Object.assign(l.style,{pointerEvents:"auto",fill:"transparent",opacity:0}),i.appendChild(l),i}(K,e,u),e.body.appendChild(v.current)}u||(!function(e,t){const[n,r]=e;let o=!1;const u=t.length;for(let e=0,c=u-1;e<u;c=e++){const[u,i]=t[e]||[0,0],[l,a]=t[c]||[0,0];i>=r!=a>=r&&n<=(l-u)*(r-i)/(a-i)+u&&(o=!o)}return o}([b,y],K)?g():n&&!c&&(t=setTimeout(f,n)))}}},e.useClick=function(e,t){let{open:n,onOpenChange:r,dataRef:o,refs:c}=e,{enabled:i=!0,event:l="click",toggle:a=!0,ignoreMouse:s=!1,keyboardHandlers:f=!0}=void 0===t?{}:t;const d=u.useRef();return u.useMemo((()=>i?{reference:{onPointerDown(e){d.current=e.pointerType},onMouseDown(e){0===e.button&&(S(d.current)&&s||"click"!==l&&(n?!a||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:S(d.current)&&s||(n?!a||o.current.openEvent&&"click"!==o.current.openEvent.type||r(!1):r(!0),o.current.openEvent=e.nativeEvent)},onKeyDown(e){d.current=void 0,f&&(Le(e)||(" "!==e.key||Pe(c.domReference.current)||e.preventDefault(),"Enter"===e.key&&(n?a&&r(!1):r(!0))))},onKeyUp(e){f&&(Le(e)||Pe(c.domReference.current)||" "===e.key&&(n?a&&r(!1):r(!0)))}}}:{}),[i,o,l,s,f,c,a,n,r])},e.useDelayGroup=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:o}=t;const{currentId:c,initialDelay:i,setState:l,timeoutMs:a}=Me(),s=u.useRef();u.useEffect((()=>{c&&(clearTimeout(s.current),l((e=>({...e,delay:{open:1,close:Ce(i,"close")}}))),c!==o&&r(!1))}),[o,r,l,c,i]),u.useEffect((()=>{function e(){r(!1),l((e=>({...e,delay:i,currentId:null})))}clearTimeout(s.current),n||c!==o||(a?s.current=window.setTimeout(e,a):e())}),[n,l,c,o,r,i,a]),u.useEffect((()=>()=>{clearTimeout(s.current)}),[])},e.useDelayGroupContext=Me,e.useDismiss=function(e,n){let{open:r,onOpenChange:o,refs:c,events:i,nodeId:l}=e,{enabled:a=!0,escapeKey:s=!0,outsidePress:f=!0,outsidePressEvent:d="pointerdown",referencePress:m=!1,referencePressEvent:v="pointerdown",ancestorScroll:b=!1,bubbles:y=!0}=void 0===n?{}:n;const w=g(),R=null!=p(),T=O("function"==typeof f?f:()=>!1),k="function"==typeof f?T:f,S=u.useRef(!1),{escapeKeyBubbles:C,outsidePressBubbles:M}=function(e){var t,n;return void 0===e&&(e=!0),{escapeKeyBubbles:"boolean"==typeof e?e:null==(t=e.escapeKey)||t,outsidePressBubbles:"boolean"==typeof e?e:null==(n=e.outsidePress)||n}}(y);return u.useEffect((()=>{if(!r||!a)return;function e(e){if("Escape"===e.key){if(!C&&w&&L(w.nodesRef.current,l).length>0)return;i.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),o(!1)}}function n(e){const t=S.current;if(S.current=!1,t)return;if("function"==typeof k&&!k(e))return;const n=P(e);if(E(n)&&c.floating.current){var r;const t=null!=(r=c.floating.current.ownerDocument.defaultView)?r:window,o=n.scrollWidth>n.clientWidth,u=n.scrollHeight>n.clientHeight;let i=u&&e.offsetX>n.clientWidth;if(u){"rtl"===t.getComputedStyle(n).direction&&(i=e.offsetX<=n.offsetWidth-n.clientWidth)}if(i||o&&e.offsetY>n.clientHeight)return}const u=w&&L(w.nodesRef.current,l).some((t=>{var n;return De(e,null==(n=t.context)?void 0:n.refs.floating.current)}));De(e,c.floating.current)||De(e,c.domReference.current)||u||!M&&w&&L(w.nodesRef.current,l).length>0||(i.emit("dismiss",{type:"outsidePress",data:{returnFocus:R?{preventScroll:!0}:x(e)||I(e)}}),o(!1))}function u(){o(!1)}const f=h(c.floating.current);s&&f.addEventListener("keydown",e),k&&f.addEventListener(d,n);let m=[];return b&&(E(c.domReference.current)&&(m=t.getOverflowAncestors(c.domReference.current)),E(c.floating.current)&&(m=m.concat(t.getOverflowAncestors(c.floating.current))),!E(c.reference.current)&&c.reference.current&&c.reference.current.contextElement&&(m=m.concat(t.getOverflowAncestors(c.reference.current.contextElement)))),m=m.filter((e=>{var t;return e!==(null==(t=f.defaultView)?void 0:t.visualViewport)})),m.forEach((e=>{e.addEventListener("scroll",u,{passive:!0})})),()=>{s&&f.removeEventListener("keydown",e),k&&f.removeEventListener(d,n),m.forEach((e=>{e.removeEventListener("scroll",u)}))}}),[s,k,d,i,w,l,r,o,b,a,C,M,c,R]),u.useEffect((()=>{S.current=!1}),[k,d]),u.useMemo((()=>a?{reference:{[Fe[v]]:()=>{m&&(i.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),o(!1))}},floating:{[Ne[d]]:()=>{S.current=!0}}}:{}),[a,i,m,d,v,o])},e.useFloating=function(e){let{open:n=!1,onOpenChange:r,whileElementsMounted:o,placement:l,middleware:a,strategy:s,nodeId:f}=void 0===e?{}:e;const[d,m]=u.useState(null),v=g(),p=u.useRef(null),h=u.useRef({}),b=u.useState((()=>i()))[0],y=t.useFloating({open:n,placement:l,middleware:a,strategy:s,whileElementsMounted:o}),w=O(r),R=u.useMemo((()=>({...y.refs,domReference:p})),[y.refs]),x=u.useMemo((()=>({...y,refs:R,dataRef:h,nodeId:f,events:b,open:n,onOpenChange:w,_:{domReference:d}})),[y,f,b,n,w,R,d]);c((()=>{const e=null==v?void 0:v.nodesRef.current.find((e=>e.id===f));e&&(e.context=x)}));const{reference:I}=y,T=u.useCallback((e=>{(E(e)||null===e)&&(x.refs.domReference.current=e,m(e)),(null===x.refs.reference.current||E(x.refs.reference.current))&&I(e)}),[I,x.refs]),k=u.useCallback((e=>{const t=E(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;I(t)}),[I]);return u.useMemo((()=>({...y,context:x,refs:R,reference:T,positionReference:k})),[y,R,x,T,k])},e.useFloatingNodeId=e=>{const t=d(),n=g(),r=p(),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=p,e.useFloatingPortalNode=me,e.useFloatingTree=g,e.useFocus=function(e,t){let{open:n,onOpenChange:r,dataRef:o,refs:c,events:i}=e,{enabled:l=!0,keyboardOnly:a=!0}=void 0===t?{}:t;const s=u.useRef(""),f=u.useRef(!1),d=u.useRef();return u.useEffect((()=>{var e;if(!l)return;const t=null!=(e=h(c.floating.current).defaultView)?e:window;function r(){!n&&R(c.domReference.current)&&c.domReference.current===oe(h(c.domReference.current))&&(f.current=!0)}return t.addEventListener("blur",r),()=>{t.removeEventListener("blur",r)}}),[c,n,l]),u.useEffect((()=>{if(l)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(e){"referencePress"!==e.type&&"escapeKey"!==e.type||(f.current=!0)}}),[i,l]),u.useEffect((()=>()=>{clearTimeout(d.current)}),[]),u.useMemo((()=>l?{reference:{onPointerDown(e){let{pointerType:t}=e;s.current=t,f.current=!(!t||!a)},onMouseLeave(){f.current=!1},onFocus(e){var t;f.current||"focus"===e.type&&"mousedown"===(null==(t=o.current.openEvent)?void 0:t.type)&&o.current.openEvent&&De(o.current.openEvent,c.domReference.current)||(o.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){f.current=!1;const t=e.relatedTarget,n=E(t)&&t.hasAttribute("data-floating-ui-focus-guard");d.current=setTimeout((()=>{A(c.floating.current,t)||A(c.domReference.current,t)||n||r(!1)}))}}}:{}),[l,a,c,o,r])},e.useHover=function(e,t){let{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:i=!1,restMs:l=0,move:a=!0}=void 0===t?{}:t;const{open:s,onOpenChange:f,dataRef:d,events:m,refs:v,_:p}=e,b=g(),y=Ie(o),w=Ie(r),R=u.useRef(),x=u.useRef(),I=u.useRef(),T=u.useRef(),k=u.useRef(!0),C=u.useRef(null),O=u.useCallback((()=>{var e;const t=null==(e=d.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[d]);u.useEffect((()=>{if(n)return m.on("dismiss",e),()=>{m.off("dismiss",e)};function e(){clearTimeout(x.current),clearTimeout(T.current),k.current=!0}}),[n,m,v]),u.useEffect((()=>{if(!n||!y.current||!s)return;function e(){O()&&f(!1)}const t=h(v.floating.current).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[v,s,f,n,y,d,O]);const M=u.useCallback((function(e){void 0===e&&(e=!0);const t=Ce(w.current,"close",R.current);t&&!I.current?(clearTimeout(x.current),x.current=setTimeout((()=>f(!1)),t)):e&&(clearTimeout(x.current),f(!1))}),[w,f]),A=u.useCallback((()=>{I.current&&(h(v.floating.current).removeEventListener("mousemove",I.current),I.current=void 0)}),[v]);return u.useEffect((()=>{if(!n)return;function t(){return!!d.current.openEvent&&["click","mousedown"].includes(d.current.openEvent.type)}function r(e){if(clearTimeout(x.current),k.current=!1,i&&!S(R.current)||l>0&&0===Ce(w.current,"open"))return;d.current.openEvent=e;const t=Ce(w.current,"open",R.current);t?x.current=setTimeout((()=>{f(!0)}),t):f(!0)}function o(n){if(t())return;const r=h(v.floating.current);if(clearTimeout(T.current),y.current)return clearTimeout(x.current),I.current&&r.removeEventListener("mousemove",I.current),I.current=y.current({...e,tree:b,polygonRef:C,x:n.clientX,y:n.clientY,onClose(){A(),M()}}),void r.addEventListener("mousemove",I.current);M()}function u(n){t()||null==y.current||y.current({...e,tree:b,polygonRef:C,x:n.clientX,y:n.clientY,onClose(){A(),M()}})(n)}const c=v.floating.current,m=v.domReference.current;return E(m)?(s&&m.addEventListener("mouseleave",u),null==c||c.addEventListener("mouseleave",u),a&&m.addEventListener("mousemove",r,{once:!0}),m.addEventListener("mouseenter",r),m.addEventListener("mouseleave",o),()=>{s&&m.removeEventListener("mouseleave",u),null==c||c.removeEventListener("mouseleave",u),a&&m.removeEventListener("mousemove",r),m.removeEventListener("mouseenter",r),m.removeEventListener("mouseleave",o)}):void 0}),[p.domReference,n,e,i,l,a,M,A,f,s,b,v,w,y,d]),c((()=>{s||(R.current=void 0,A(),F(C))}),[s,A]),u.useEffect((()=>()=>{A(),clearTimeout(x.current),clearTimeout(T.current),F(C)}),[n,A]),u.useMemo((()=>{if(!n)return{};function e(e){R.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){s||0===l||(clearTimeout(T.current),T.current=setTimeout((()=>{k.current||f(!0)}),l))}},floating:{onMouseEnter(){clearTimeout(x.current)},onMouseLeave(){m.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),M(!1)}}}}),[m,n,l,s,f,M])},e.useId=d,e.useInnerOffset=(e,t)=>{let{open:n,refs:o}=e,{enabled:c=!0,overflowRef:i,scrollRef:l,onChange:a}=t;const s=O(a),f=u.useRef(!1),d=u.useRef(null),m=u.useRef(null);return u.useEffect((()=>{var e;if(!c)return;function t(e){if(e.ctrlKey||!u||null==i.current)return;const t=e.deltaY,n=i.current.top>=-.5,o=i.current.bottom>=-.5,c=u.scrollHeight-u.clientHeight,l=t<0?-1:1,a=t<0?"max":"min";u.scrollHeight<=u.clientHeight||(!n&&t>0||!o&&t<0?(e.preventDefault(),r.flushSync((()=>{s((e=>e+Math[a](t,c*l)))}))):/firefox/i.test(y())&&(u.scrollTop+=t))}const u=null!=(e=null==l?void 0:l.current)?e:o.floating.current;return n&&u?(u.addEventListener("wheel",t),requestAnimationFrame((()=>{d.current=u.scrollTop,null!=i.current&&(m.current={...i.current})})),()=>{d.current=null,m.current=null,u.removeEventListener("wheel",t)}):void 0}),[c,n,o,i,l,s]),u.useMemo((()=>c?{floating:{onKeyDown(){f.current=!0},onWheel(){f.current=!1},onPointerMove(){f.current=!1},onScroll(){const e=(null==l?void 0:l.current)||o.floating.current;if(i.current&&e&&f.current){if(null!==d.current){const t=e.scrollTop-d.current;(i.current.bottom<-.5&&t<-1||i.current.top<-.5&&t>1)&&r.flushSync((()=>s((e=>e+t))))}requestAnimationFrame((()=>{d.current=e.scrollTop}))}}}}:{}),[c,i,o,l,s])},e.useInteractions=function(e){void 0===e&&(e=[]);const t=e,n=u.useCallback((t=>M(t,e,"reference")),t),r=u.useCallback((t=>M(t,e,"floating")),t),o=u.useCallback((t=>M(t,e,"item")),t);return u.useMemo((()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:o})),[n,r,o])},e.useListNavigation=function(e,t){let{open:n,onOpenChange:o,refs:i}=e,{listRef:l,activeIndex:a,onNavigate:s=(()=>{}),enabled:f=!0,selectedIndex:d=null,allowEscape:m=!1,loop:v=!1,nested:b=!1,rtl:y=!1,virtual:w=!1,focusItemOnOpen:E="auto",focusItemOnHover:S=!0,openOnArrowKeyDown:C=!0,disabledIndices:M,orientation:L="vertical",cols:P=1,scrollItemIntoView:D=!0}=void 0===t?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:t;const F=p(),N=g(),K=O(s),j=u.useRef(E),H=u.useRef(null!=d?d:-1),B=u.useRef(null),V=u.useRef(!0),W=u.useRef(K),q=u.useRef(n),U=u.useRef(!1),z=Ie(M),X=Ie(n),Y=Ie(D),[_,G]=u.useState(),$=u.useCallback(((e,t)=>{const n=e.current[t.current];w?G(null==n?void 0:n.id):ke(n,{preventScroll:!0,sync:!(!k()||!T())&&(Ke||U.current)}),requestAnimationFrame((()=>{const e=Y.current;e&&n&&!V.current&&(null==n.scrollIntoView||n.scrollIntoView("boolean"==typeof e?{block:"nearest",inline:"nearest"}:e))}))}),[w,Y]);return c((()=>{document.createElement("div").focus({get preventScroll(){return Ke=!0,!1}})}),[]),c((()=>{f&&(n?j.current&&null!=d&&K(d):q.current&&(H.current=-1,W.current(null)))}),[f,n,d,K]),c((()=>{if(f&&n)if(null==a){if(U.current=!1,null!=d)return;q.current&&(H.current=-1,$(l,H)),!q.current&&j.current&&(null!=B.current||!0===j.current&&null==B.current)&&(H.current=null==B.current||Ye(B.current,L,y)||b?_e(l,z.current):Ge(l,z.current),K(H.current))}else qe(l,a)||(H.current=a,$(l,H))}),[f,n,a,d,b,l,L,y,K,$,z]),c((()=>{if(f&&q.current&&!n){var e,t;const n=null==N||null==(e=N.nodesRef.current.find((e=>e.id===F)))||null==(t=e.context)?void 0:t.refs.floating.current;n&&!A(n,oe(h(n)))&&n.focus({preventScroll:!0})}}),[f,n,N,F]),c((()=>{B.current=null,W.current=K,q.current=n})),u.useMemo((()=>{if(!f)return{};const e=z.current;function t(t){if(V.current=!1,U.current=!0,!X.current&&t.currentTarget===i.floating.current)return;if(b&&function(e,t,n){return ze(t,n?e===Ve:e===Be,e===je)}(t.key,L,y))return xe(t),o(!1),void(R(i.domReference.current)&&i.domReference.current.focus());const r=H.current,u=_e(l,e),c=Ge(l,e);if("Home"===t.key&&(H.current=u,K(H.current)),"End"===t.key&&(H.current=c,K(H.current)),P>1){const n=H.current;if(t.key===je){if(xe(t),-1===n)H.current=c;else if(H.current=Ue(l,{startingIndex:n,amount:P,decrement:!0,disabledIndices:e}),v&&(n-P<u||H.current<0)){const e=n%P,t=c%P,r=c-(t-e);H.current=t===e?c:t>e?r:r-P}qe(l,H.current)&&(H.current=n),K(H.current)}if(t.key===He&&(xe(t),-1===n?H.current=u:(H.current=Ue(l,{startingIndex:n,amount:P,disabledIndices:e}),v&&n+P>c&&(H.current=Ue(l,{startingIndex:n%P-P,amount:P,disabledIndices:e}))),qe(l,H.current)&&(H.current=n),K(H.current)),"both"===L){const r=Math.floor(n/P);t.key===Ve&&(xe(t),n%P!=P-1?(H.current=Ue(l,{startingIndex:n,disabledIndices:e}),v&&We(H.current,P,r)&&(H.current=Ue(l,{startingIndex:n-n%P-1,disabledIndices:e}))):v&&(H.current=Ue(l,{startingIndex:n-n%P-1,disabledIndices:e})),We(H.current,P,r)&&(H.current=n)),t.key===Be&&(xe(t),n%P!=0?(H.current=Ue(l,{startingIndex:n,disabledIndices:e,decrement:!0}),v&&We(H.current,P,r)&&(H.current=Ue(l,{startingIndex:n+(P-n%P),decrement:!0,disabledIndices:e}))):v&&(H.current=Ue(l,{startingIndex:n+(P-n%P),decrement:!0,disabledIndices:e})),We(H.current,P,r)&&(H.current=n));const o=Math.floor(c/P)===r;return qe(l,H.current)&&(H.current=v&&o?t.key===Be?c:Ue(l,{startingIndex:n-n%P-1,disabledIndices:e}):n),void K(H.current)}}if(Xe(t.key,L)){if(xe(t),n&&!w&&oe(t.currentTarget.ownerDocument)===t.currentTarget)return H.current=Ye(t.key,L,y)?u:c,void K(H.current);Ye(t.key,L,y)?H.current=v?r>=c?m&&r!==l.current.length?-1:u:Ue(l,{startingIndex:r,disabledIndices:e}):Math.min(c,Ue(l,{startingIndex:r,disabledIndices:e})):H.current=v?r<=u?m&&-1!==r?l.current.length:c:Ue(l,{startingIndex:r,decrement:!0,disabledIndices:e}):Math.max(u,Ue(l,{startingIndex:r,decrement:!0,disabledIndices:e})),qe(l,H.current)?K(null):K(H.current)}}function u(e){"auto"===E&&x(e.nativeEvent)&&(j.current=!0)}return{reference:{...w&&n&&null!=a&&{"aria-activedescendant":_},onKeyDown(r){V.current=!1;const u=0===r.key.indexOf("Arrow");if(w&&n)return t(r);if(!n&&!C&&u)return;(u||"Enter"===r.key||" "===r.key||""===r.key)&&(B.current=r.key),b?function(e,t,n){return ze(t,n?e===Be:e===Ve,e===He)}(r.key,L,y)&&(xe(r),n?(H.current=_e(l,e),K(H.current)):o(!0)):Xe(r.key,L)&&(null!=d&&(H.current=d),xe(r),!n&&C?o(!0):t(r),n&&K(H.current))},onFocus(){n&&K(null)},onPointerDown:function(e){j.current=E,"auto"===E&&I(e.nativeEvent)&&(j.current=!0)},onMouseDown:u,onClick:u},floating:{"aria-orientation":"both"===L?void 0:L,...w&&null!=a&&{"aria-activedescendant":_},onKeyDown:t,onPointerMove(){V.current=!0}},item:{onFocus(e){let{currentTarget:t}=e;const n=l.current.indexOf(t);-1!==n&&a!==n&&K(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...S&&{onMouseMove(e){let{currentTarget:t}=e;const n=t;if(n){const e=l.current.indexOf(n);-1!==e&&a!==e&&K(e)}},onPointerLeave(){var e;V.current&&(H.current=-1,$(l,H),r.flushSync((()=>K(null))),w||null==(e=i.floating.current)||e.focus({preventScroll:!0}))}}}}}),[_,z,X,l,f,L,y,w,n,a,b,d,C,S,m,P,v,i,E,$,K,o])},e.useMergeRefs=function(e){return u.useMemo((()=>e.every((e=>null==e))?null:t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}),e)},e.useRole=function(e,t){let{open:n}=e,{enabled:r=!0,role:o="dialog"}=void 0===t?{}:t;const c=d(),i=d();return u.useMemo((()=>{const e={id:c,role:o};return r?"tooltip"===o?{reference:{"aria-describedby":n?c:void 0},floating:e}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":"alertdialog"===o?"dialog":o,"aria-controls":n?c:void 0,..."listbox"===o&&{role:"combobox"},..."menu"===o&&{id:i}},floating:{...e,..."menu"===o&&{"aria-labelledby":i}}}:{}}),[r,o,n,c,i])},e.useTypeahead=function(e,t){var n;let{open:r,dataRef:o}=e,{listRef:i,activeIndex:l,onMatch:a=(()=>{}),enabled:s=!0,findMatch:f=null,resetMs:d=1e3,ignoreKeys:m=[],selectedIndex:v=null}=void 0===t?{listRef:{current:[]},activeIndex:null}:t;const p=u.useRef(),g=u.useRef(""),b=u.useRef(null!=(n=null!=v?v:l)?n:-1),y=u.useRef(null),w=O(a),R=Ie(f),x=Ie(m);return c((()=>{r&&(clearTimeout(p.current),y.current=null,g.current="")}),[r]),c((()=>{var e;r&&""===g.current&&(b.current=null!=(e=null!=v?v:l)?e:-1)}),[r,v,l]),u.useMemo((()=>{if(!s)return{};function e(e){const t=P(e.nativeEvent);if(E(t)&&oe(h(t))!==e.currentTarget&&t.closest('[role="dialog"],[role="menu"],[role="listbox"],[role="tree"],[role="grid"]')!==e.currentTarget)return;g.current.length>0&&" "!==g.current[0]&&(o.current.typing=!0," "===e.key&&xe(e));const n=i.current;if(null==n||x.current.includes(e.key)||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey)return;n.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&g.current===e.key&&(g.current="",b.current=y.current),g.current+=e.key,clearTimeout(p.current),p.current=setTimeout((()=>{g.current="",b.current=y.current,o.current.typing=!1}),d);const r=b.current,u=[...n.slice((null!=r?r:0)+1),...n.slice(0,(null!=r?r:0)+1)],c=R.current?R.current(u,g.current):u.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(g.current.toLocaleLowerCase())))),l=c?n.indexOf(c):-1;-1!==l&&(w(l),y.current=l)}return{reference:{onKeyDown:e},floating:{onKeyDown:e}}}),[s,o,i,d,x,R,w])},Object.keys(t).forEach((function(n){"default"===n||e.hasOwnProperty(n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})})),Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "@floating-ui/react", | ||
"version": "0.14.0", | ||
"version": "0.15.0", | ||
"@rollingversions": { | ||
@@ -34,3 +34,2 @@ "baseVersion": [ | ||
], | ||
"browserslist": "> 0.5%, not dead, not IE 11", | ||
"scripts": { | ||
@@ -65,3 +64,3 @@ "test": "jest test", | ||
"dependencies": { | ||
"@floating-ui/react-dom": "^1.0.1", | ||
"@floating-ui/react-dom": "^1.1.0", | ||
"aria-hidden": "^1.1.3", | ||
@@ -71,9 +70,4 @@ "tabbable": "^6.0.1" | ||
"devDependencies": { | ||
"@babel/preset-env": "^7.16.4", | ||
"@babel/preset-react": "^7.16.0", | ||
"@babel/preset-typescript": "^7.16.0", | ||
"@rollup/plugin-babel": "^5.3.0", | ||
"@rollup/plugin-commonjs": "^21.0.1", | ||
"@rollup/plugin-node-resolve": "^13.0.6", | ||
"@rollup/plugin-replace": "^3.0.0", | ||
"@testing-library/jest-dom": "^5.16.4", | ||
@@ -83,7 +77,4 @@ "@testing-library/react": "^13.1.1", | ||
"@testing-library/user-event": "^14.4.3", | ||
"@types/jest": "^27.0.3", | ||
"@types/react": "^18.0.1", | ||
"babel-plugin-annotate-pure-calls": "^0.4.0", | ||
"framer-motion": "^6.2.8", | ||
"jest": "^27.3.1", | ||
"react": "^18.0.0", | ||
@@ -95,7 +86,4 @@ "react-dom": "^18.0.0", | ||
"resize-observer-polyfill": "^1.5.1", | ||
"rollup": "^2.60.1", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"ts-jest": "^27.0.7", | ||
"use-isomorphic-layout-effect": "^1.1.1" | ||
} | ||
} |
import * as React from 'react'; | ||
import type { FloatingContext } from '../types'; | ||
declare type Delay = number | Partial<{ | ||
type Delay = number | Partial<{ | ||
open: number; | ||
@@ -11,2 +11,3 @@ close: number; | ||
currentId: any; | ||
timeoutMs: number; | ||
} | ||
@@ -23,5 +24,6 @@ interface GroupContext extends GroupState { | ||
*/ | ||
export declare const FloatingDelayGroup: ({ children, delay, }: { | ||
export declare const FloatingDelayGroup: ({ children, delay, timeoutMs, }: { | ||
children?: React.ReactNode; | ||
delay: Delay; | ||
timeoutMs?: number | undefined; | ||
}) => JSX.Element; | ||
@@ -28,0 +30,0 @@ interface UseGroupOptions { |
@@ -10,2 +10,2 @@ import * as React from 'react'; | ||
lockScroll?: boolean | undefined; | ||
}, "start" | "name" | "data" | "width" | "height" | "size" | "content" | "id" | "children" | "value" | "cite" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "onPointerDown" | "onMouseDown" | "onClick" | "onPointerDownCapture" | "onMouseDownCapture" | "onClickCapture" | "open" | "list" | "step" | "key" | "hidden" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "nonce" | "noValidate" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "target" | "type" | "useMap" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "lockScroll"> & React.RefAttributes<HTMLDivElement>>; | ||
}, "start" | "name" | "data" | "width" | "height" | "size" | "content" | "open" | "className" | "id" | "prefix" | "slot" | "role" | "children" | "value" | "cite" | "form" | "label" | "span" | "style" | "summary" | "title" | "pattern" | "onPointerDown" | "onMouseDown" | "onClick" | "onPointerDownCapture" | "onMouseDownCapture" | "onClickCapture" | "type" | "accessKey" | "dir" | "draggable" | "hidden" | "lang" | "translate" | "contentEditable" | "inputMode" | "nonce" | "tabIndex" | "list" | "step" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "noValidate" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "target" | "useMap" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "contextMenu" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "lockScroll"> & React.RefAttributes<HTMLDivElement>>; |
import * as React from 'react'; | ||
import type { FloatingTreeType } from '../types'; | ||
import type { FloatingTreeType, ReferenceType } from '../types'; | ||
export declare const useFloatingParentNodeId: () => string | null; | ||
export declare const useFloatingTree: <RT extends import("@floating-ui/dom/src/types").ReferenceElement = import("@floating-ui/dom/src/types").ReferenceElement>() => FloatingTreeType<RT> | null; | ||
export declare const useFloatingTree: <RT extends ReferenceType = ReferenceType>() => FloatingTreeType<RT> | null; | ||
/** | ||
* Registers a node into the floating tree, returning its id. | ||
*/ | ||
export declare const useFloatingNodeId: (customParentId?: string | undefined) => string; | ||
export declare const useFloatingNodeId: (customParentId?: string) => string; | ||
/** | ||
@@ -10,0 +10,0 @@ * Provides parent node context for nested floating elements. |
import * as React from 'react'; | ||
export declare const HIDDEN_STYLES: React.CSSProperties; | ||
export declare const FocusGuard: React.ForwardRefExoticComponent<Pick<React.HTMLProps<HTMLSpanElement>, "start" | "name" | "data" | "width" | "height" | "size" | "content" | "id" | "children" | "value" | "cite" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "onPointerDown" | "onMouseDown" | "onClick" | "onPointerDownCapture" | "onMouseDownCapture" | "onClickCapture" | "open" | "list" | "step" | "key" | "hidden" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "nonce" | "noValidate" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "target" | "type" | "useMap" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & React.RefAttributes<HTMLSpanElement>>; | ||
export declare const FocusGuard: React.ForwardRefExoticComponent<Pick<React.HTMLProps<HTMLSpanElement>, "start" | "name" | "data" | "width" | "height" | "size" | "content" | "open" | "className" | "id" | "prefix" | "slot" | "role" | "children" | "value" | "cite" | "form" | "label" | "span" | "style" | "summary" | "title" | "pattern" | "onPointerDown" | "onMouseDown" | "onClick" | "onPointerDownCapture" | "onMouseDownCapture" | "onClickCapture" | "type" | "accessKey" | "dir" | "draggable" | "hidden" | "lang" | "translate" | "contentEditable" | "inputMode" | "nonce" | "tabIndex" | "list" | "step" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "noValidate" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "target" | "useMap" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "contextMenu" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key"> & React.RefAttributes<HTMLSpanElement>>; |
@@ -1,2 +0,2 @@ | ||
import type { ElementProps, FloatingContext } from '../types'; | ||
import type { ElementProps, FloatingContext, ReferenceType } from '../types'; | ||
export interface Props { | ||
@@ -13,2 +13,2 @@ enabled?: boolean; | ||
*/ | ||
export declare const useClick: <RT extends import("@floating-ui/dom/src/types").ReferenceElement = import("@floating-ui/dom/src/types").ReferenceElement>({ open, onOpenChange, dataRef, refs }: FloatingContext<RT>, { enabled, event: eventOption, toggle, ignoreMouse, keyboardHandlers, }?: Props) => ElementProps; | ||
export declare const useClick: <RT extends ReferenceType = ReferenceType>({ open, onOpenChange, dataRef, refs }: FloatingContext<RT>, { enabled, event: eventOption, toggle, ignoreMouse, keyboardHandlers, }?: Props) => ElementProps; |
@@ -1,4 +0,11 @@ | ||
import type { ElementProps, FloatingContext } from '../types'; | ||
import type { ElementProps, FloatingContext, ReferenceType } from '../types'; | ||
export declare const normalizeBubblesProp: (bubbles?: boolean | { | ||
escapeKey?: boolean; | ||
outsidePress?: boolean; | ||
}) => { | ||
escapeKeyBubbles: boolean; | ||
outsidePressBubbles: boolean; | ||
}; | ||
export interface DismissPayload { | ||
type: 'outsidePress' | 'referencePress' | 'escapeKey'; | ||
type: 'outsidePress' | 'referencePress' | 'escapeKey' | 'mouseLeave'; | ||
data: { | ||
@@ -18,3 +25,6 @@ returnFocus: boolean | { | ||
ancestorScroll?: boolean; | ||
bubbles?: boolean; | ||
bubbles?: boolean | { | ||
escapeKey?: boolean; | ||
outsidePress?: boolean; | ||
}; | ||
} | ||
@@ -25,2 +35,2 @@ /** | ||
*/ | ||
export declare const useDismiss: <RT extends import("@floating-ui/react-dom").ReferenceElement = import("@floating-ui/react-dom").ReferenceElement>({ open, onOpenChange, refs, events, nodeId }: FloatingContext<RT>, { enabled, escapeKey, outsidePress: unstable_outsidePress, outsidePressEvent, referencePress, referencePressEvent, ancestorScroll, bubbles, }?: Props) => ElementProps; | ||
export declare const useDismiss: <RT extends ReferenceType = ReferenceType>({ open, onOpenChange, refs, events, nodeId }: FloatingContext<RT>, { enabled, escapeKey, outsidePress: unstable_outsidePress, outsidePressEvent, referencePress, referencePressEvent, ancestorScroll, bubbles, }?: Props) => ElementProps; |
@@ -1,2 +0,2 @@ | ||
import type { ElementProps, FloatingContext } from '../types'; | ||
import type { ElementProps, FloatingContext, ReferenceType } from '../types'; | ||
export interface Props { | ||
@@ -10,2 +10,2 @@ enabled?: boolean; | ||
*/ | ||
export declare const useFocus: <RT extends import("@floating-ui/dom/src/types").ReferenceElement = import("@floating-ui/dom/src/types").ReferenceElement>({ open, onOpenChange, dataRef, refs, events }: FloatingContext<RT>, { enabled, keyboardOnly }?: Props) => ElementProps; | ||
export declare const useFocus: <RT extends ReferenceType = ReferenceType>({ open, onOpenChange, dataRef, refs, events }: FloatingContext<RT>, { enabled, keyboardOnly }?: Props) => ElementProps; |
@@ -0,3 +1,4 @@ | ||
import * as React from 'react'; | ||
import type { ElementProps, FloatingContext, FloatingTreeType, ReferenceType } from '../types'; | ||
interface HandleCloseFn<RT extends ReferenceType = ReferenceType> { | ||
export interface HandleCloseFn<RT extends ReferenceType = ReferenceType> { | ||
(context: FloatingContext<RT> & { | ||
@@ -7,6 +8,4 @@ onClose: () => void; | ||
leave?: boolean; | ||
polygonRef: React.MutableRefObject<SVGElement | null>; | ||
}): (event: MouseEvent) => void; | ||
__options: { | ||
blockPointerEvents: boolean; | ||
}; | ||
} | ||
@@ -29,3 +28,2 @@ export declare function getDelay(value: Props['delay'], prop: 'open' | 'close', pointerType?: PointerEvent['pointerType']): number | undefined; | ||
*/ | ||
export declare const useHover: <RT extends import("@floating-ui/dom/src/types").ReferenceElement = import("@floating-ui/dom/src/types").ReferenceElement>(context: FloatingContext<RT>, { enabled, delay, handleClose, mouseOnly, restMs, move, }?: Props<RT>) => ElementProps; | ||
export {}; | ||
export declare const useHover: <RT extends ReferenceType = ReferenceType>(context: FloatingContext<RT>, { enabled, delay, handleClose, mouseOnly, restMs, move, }?: Props<RT>) => ElementProps; |
import * as React from 'react'; | ||
import type { ElementProps, FloatingContext } from '../types'; | ||
import type { ElementProps, FloatingContext, ReferenceType } from '../types'; | ||
export interface Props { | ||
@@ -20,2 +20,3 @@ listRef: React.MutableRefObject<Array<HTMLElement | null>>; | ||
cols?: number; | ||
scrollItemIntoView?: boolean | ScrollIntoViewOptions; | ||
} | ||
@@ -27,2 +28,2 @@ /** | ||
*/ | ||
export declare const useListNavigation: <RT extends import("@floating-ui/dom/src/types").ReferenceElement = import("@floating-ui/dom/src/types").ReferenceElement>({ open, onOpenChange, refs }: FloatingContext<RT>, { listRef, activeIndex, onNavigate: unstable_onNavigate, enabled, selectedIndex, allowEscape, loop, nested, rtl, virtual, focusItemOnOpen, focusItemOnHover, openOnArrowKeyDown, disabledIndices, orientation, cols, }?: Props) => ElementProps; | ||
export declare const useListNavigation: <RT extends ReferenceType = ReferenceType>({ open, onOpenChange, refs }: FloatingContext<RT>, { listRef, activeIndex, onNavigate: unstable_onNavigate, enabled, selectedIndex, allowEscape, loop, nested, rtl, virtual, focusItemOnOpen, focusItemOnHover, openOnArrowKeyDown, disabledIndices, orientation, cols, scrollItemIntoView, }?: Props) => ElementProps; |
@@ -1,2 +0,2 @@ | ||
import type { ElementProps, FloatingContext } from '../types'; | ||
import type { ElementProps, FloatingContext, ReferenceType } from '../types'; | ||
export interface Props { | ||
@@ -10,2 +10,2 @@ enabled?: boolean; | ||
*/ | ||
export declare const useRole: <RT extends import("@floating-ui/dom/src/types").ReferenceElement = import("@floating-ui/dom/src/types").ReferenceElement>({ open }: FloatingContext<RT>, { enabled, role }?: Partial<Props>) => ElementProps; | ||
export declare const useRole: <RT extends ReferenceType = ReferenceType>({ open }: FloatingContext<RT>, { enabled, role }?: Partial<Props>) => ElementProps; |
import * as React from 'react'; | ||
import type { ElementProps, FloatingContext } from '../types'; | ||
import type { ElementProps, FloatingContext, ReferenceType } from '../types'; | ||
export interface Props { | ||
@@ -18,2 +18,2 @@ listRef: React.MutableRefObject<Array<string | null>>; | ||
*/ | ||
export declare const useTypeahead: <RT extends import("@floating-ui/dom/src/types").ReferenceElement = import("@floating-ui/dom/src/types").ReferenceElement>({ open, dataRef }: FloatingContext<RT>, { listRef, activeIndex, onMatch: unstable_onMatch, enabled, findMatch, resetMs, ignoreKeys, selectedIndex, }?: Props) => ElementProps; | ||
export declare const useTypeahead: <RT extends ReferenceType = ReferenceType>({ open, dataRef }: FloatingContext<RT>, { listRef, activeIndex, onMatch: unstable_onMatch, enabled, findMatch, resetMs, ignoreKeys, selectedIndex, }?: Props) => ElementProps; |
@@ -1,3 +0,3 @@ | ||
declare type AnyFunction = (...args: any[]) => any; | ||
type AnyFunction = (...args: any[]) => any; | ||
export declare function useEvent<T extends AnyFunction>(callback?: T): T; | ||
export {}; |
@@ -19,1 +19,2 @@ export * from '@floating-ui/react-dom'; | ||
export { useTypeahead } from './hooks/useTypeahead'; | ||
export { useMergeRefs } from './hooks/useMergeRefs'; |
@@ -1,16 +0,9 @@ | ||
import type { FloatingContext, FloatingTreeType, ReferenceType } from './types'; | ||
export declare function safePolygon<RT extends ReferenceType = ReferenceType>({ restMs, buffer, blockPointerEvents, debug, }?: Partial<{ | ||
/// <reference types="react" /> | ||
import type { ReferenceType } from './types'; | ||
import type { HandleCloseFn } from './hooks/useHover'; | ||
export declare function destroyPolygon(ref: React.MutableRefObject<SVGElement | null>): void; | ||
export declare function safePolygon<RT extends ReferenceType = ReferenceType>({ restMs, buffer, blockPointerEvents, }?: Partial<{ | ||
restMs: number; | ||
buffer: number; | ||
blockPointerEvents: boolean; | ||
debug: null | ((points?: string | null) => void); | ||
}>): { | ||
({ x, y, placement, refs, onClose, nodeId, tree, leave, }: FloatingContext<RT> & { | ||
onClose: () => void; | ||
tree?: FloatingTreeType<RT> | null | undefined; | ||
leave?: boolean | undefined; | ||
}): (event: MouseEvent) => void; | ||
__options: { | ||
blockPointerEvents: boolean; | ||
}; | ||
}; | ||
}>): HandleCloseFn<RT>; |
@@ -8,6 +8,6 @@ import * as React from 'react'; | ||
export { arrow } from '@floating-ui/react-dom'; | ||
export interface ExtendedRefs<RT extends ReferenceType = ReferenceType> { | ||
reference: React.MutableRefObject<RT | null>; | ||
export interface ExtendedRefs<RT> { | ||
reference: React.MutableRefObject<ReferenceType | null>; | ||
floating: React.MutableRefObject<HTMLElement | null>; | ||
domReference: React.MutableRefObject<Element | null>; | ||
domReference: React.MutableRefObject<(RT extends Element ? RT : Element) | null>; | ||
} | ||
@@ -24,3 +24,3 @@ export interface FloatingEvents { | ||
} | ||
export interface FloatingContext<RT extends ReferenceType = ReferenceType> extends UsePositionFloatingReturn<RT> { | ||
export interface FloatingContext<RT extends ReferenceType = ReferenceType> extends Omit<UsePositionFloatingReturn<RT>, 'refs'> { | ||
open: boolean; | ||
@@ -52,13 +52,15 @@ onOpenChange: (open: boolean) => void; | ||
} | ||
export declare type ReferenceType = Element | VirtualElement; | ||
export declare type UseFloatingData = Omit<ComputePositionReturn, 'x' | 'y'> & { | ||
export type ReferenceType = Element | VirtualElement; | ||
export type UseFloatingData = Omit<ComputePositionReturn, 'x' | 'y'> & { | ||
x: number | null; | ||
y: number | null; | ||
}; | ||
export declare type UseFloatingReturn<RT extends ReferenceType = ReferenceType> = UseFloatingData & { | ||
export type UseFloatingReturn<RT extends ReferenceType = ReferenceType> = UseFloatingData & { | ||
update: () => void; | ||
reference: (node: RT | null) => void; | ||
floating: (node: HTMLElement | null) => void; | ||
positionReference: (node: ReferenceType | null) => void; | ||
context: FloatingContext<RT>; | ||
refs: ExtendedRefs<RT>; | ||
isPositioned: boolean; | ||
}; | ||
@@ -65,0 +67,0 @@ export interface UseFloatingProps<RT extends ReferenceType = ReferenceType> { |
import * as React from 'react'; | ||
import type { ElementProps } from './types'; | ||
export declare const useInteractions: (propsList?: Array<ElementProps | void>) => { | ||
getReferenceProps: (userProps?: React.HTMLProps<Element> | undefined) => Record<string, unknown>; | ||
getFloatingProps: (userProps?: React.HTMLProps<HTMLElement> | undefined) => Record<string, unknown>; | ||
getItemProps: (userProps?: React.HTMLProps<HTMLElement> | undefined) => Record<string, unknown>; | ||
getReferenceProps: (userProps?: React.HTMLProps<Element>) => Record<string, unknown>; | ||
getFloatingProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>; | ||
getItemProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>; | ||
}; |
@@ -8,1 +8,2 @@ export declare function isElement(value: any): value is HTMLElement; | ||
export declare function isMac(): boolean; | ||
export declare function isMouseLikePointerType(pointerType: string | undefined): boolean; |
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
480637
15
46
10321
9
2