@floating-ui/react
Version:
Floating UI for React
6 lines • 69.9 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom"),require("@floating-ui/react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","@floating-ui/react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIReact={},e.React,e.ReactDOM,e.FloatingUIReactDOM)}(this,(function(e,t,n,r){"use strict";function o(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var u=o(t),i=o(n);function l(){return"undefined"!=typeof window}function c(e){return a(e)?(e.nodeName||"").toLowerCase():"#document"}function s(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function a(e){return!!l()&&(e instanceof Node||e instanceof s(e).Node)}function f(e){return!!l()&&(e instanceof Element||e instanceof s(e).Element)}function d(e){return!!l()&&(e instanceof HTMLElement||e instanceof s(e).HTMLElement)}function m(e){return!(!l()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof s(e).ShadowRoot)}function v(e){return["html","body","#document"].includes(c(e))}function p(e){return s(e).getComputedStyle(e)}function g(e){if("html"===c(e))return e;const t=e.assignedSlot||e.parentNode||m(e)&&e.host||function(e){var t;return null==(t=(a(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}(e);return m(t)?t.host:t}const h=Math.min,y=Math.max,b=Math.round,w=Math.floor;
/*!
* tabbable 6.2.0
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
*/
var E=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"].join(","),R="undefined"==typeof Element,x=R?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,I=!R&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},k=function e(t,n){var r;void 0===n&&(n=!0);var o=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},C=function(e,t,n){if(k(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(E));return t&&x.call(e,E)&&r.unshift(e),r=r.filter(n)},M=function e(t,n,r){for(var o=[],u=Array.from(t);u.length;){var i=u.shift();if(!k(i,!1))if("SLOT"===i.tagName){var l=i.assignedElements(),c=e(l.length?l:i.children,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:i,candidates:c})}else{x.call(i,E)&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var s=i.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(i),a=!k(s,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(s&&a){var f=e(!0===s?i.children:s.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:i,candidates:f})}else u.unshift.apply(u,i.children)}}return o},O=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},S=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!O(e)?0:e.tabIndex},P=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},T=function(e){return"INPUT"===e.tagName},A=function(e){return function(e){return T(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||I(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)},L=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},N=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=x.call(e,"details>summary:first-of-type")?e.parentElement:e;if(x.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return L(e)}else{if("function"==typeof r){for(var u=e;e;){var i=e.parentElement,l=I(e);if(i&&!i.shadowRoot&&!0===r(i))return L(e);e=e.assignedSlot?e.assignedSlot:i||l===e.ownerDocument?i:l.host}e=u}if(function(e){var t,n,r,o,u=e&&I(e),i=null===(t=u)||void 0===t?void 0:t.host,l=!1;if(u&&u!==e)for(l=!!(null!==(n=i)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(i)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!l&&i;){var c,s,a;l=!(null===(s=i=null===(c=u=I(i))||void 0===c?void 0:c.host)||void 0===s||null===(a=s.ownerDocument)||void 0===a||!a.contains(i))}return l}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},D=function(e,t){return!(t.disabled||k(t)||function(e){return T(e)&&"hidden"===e.type}(t)||N(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!!x.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},F=function(e,t){return!(A(t)||S(t)<0||!D(e,t))},j=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},K=function e(t){var n=[],r=[];return t.forEach((function(t,o){var u=!!t.scopeParent,i=u?t.scopeParent:t,l=function(e,t){var n=S(e);return n<0&&t&&!O(e)?0:n}(i,u),c=u?e(t.candidates):i;0===l?u?n.push.apply(n,c):n.push(i):r.push({documentOrder:o,tabIndex:l,item:t,isScope:u,content:c})})),r.sort(P).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},H=function(e,t){var n;return n=(t=t||{}).getShadowRoot?M([e],t.includeContainer,{filter:F.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:j}):C(e,t.includeContainer,F.bind(null,t)),K(n)},W=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==x.call(e,E)&&F(t,e)};function q(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function _(){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 B(){return/apple/i.test(navigator.vendor)}function U(){const e=/android/i;return e.test(q())||e.test(_())}function z(){return _().includes("jsdom/")}const X="data-floating-ui-focusable",Y="ArrowLeft",V="ArrowRight";function G(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;t=t.shadowRoot.activeElement}return t}function Z(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&m(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function $(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Q(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)}function J(e){return(null==e?void 0:e.ownerDocument)||document}function ee(e){return d(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function te(e){return!!e&&("combobox"===e.getAttribute("role")&&ee(e))}function ne(e){return e?e.hasAttribute(X)?e:e.querySelector("["+X+"]")||e:null}function re(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})),r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})),n=n.concat(r);return n}function oe(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}function ue(e){e.preventDefault(),e.stopPropagation()}function ie(e){return!(0!==e.mozInputSource||!e.isTrusted)||(U()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}function le(e){return!z()&&(!U()&&0===e.width&&0===e.height||U()&&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&&"touch"===e.pointerType)}function ce(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var se="undefined"!=typeof document?t.useLayoutEffect:function(){};function ae(e){const t=u.useRef(e);return se((()=>{t.current=e})),t}const fe={...u}.useInsertionEffect||(e=>e());function de(e){const t=u.useRef((()=>{if("production"!==process.env.NODE_ENV)throw new Error("Cannot call an event handler while rendering.")}));return fe((()=>{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 me(e,t,n){return Math.floor(e/t)!==n}function ve(e,t){return t<0||t>=e.current.length}function pe(e,t){return he(e,{disabledIndices:t})}function ge(e,t){return he(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function he(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o,amount:u=1}=void 0===t?{}:t,i=n;do{i+=r?-u:u}while(i>=0&&i<=e.current.length-1&&Re(e,i,o));return i}function ye(e,t){let{event:n,orientation:r,loop:o,rtl:u,cols:i,disabledIndices:l,minIndex:c,maxIndex:s,prevIndex:a,stopEvent:f=!1}=t,d=a;if("ArrowUp"===n.key){if(f&&ue(n),-1===a)d=s;else if(d=he(e,{startingIndex:d,amount:i,decrement:!0,disabledIndices:l}),o&&(a-i<c||d<0)){const e=a%i,t=s%i,n=s-(t-e);d=t===e?s:t>e?n:n-i}ve(e,d)&&(d=a)}if("ArrowDown"===n.key&&(f&&ue(n),-1===a?d=c:(d=he(e,{startingIndex:a,amount:i,disabledIndices:l}),o&&a+i>s&&(d=he(e,{startingIndex:a%i-i,amount:i,disabledIndices:l}))),ve(e,d)&&(d=a)),"both"===r){const t=w(a/i);n.key===(u?Y:V)&&(f&&ue(n),a%i!=i-1?(d=he(e,{startingIndex:a,disabledIndices:l}),o&&me(d,i,t)&&(d=he(e,{startingIndex:a-a%i-1,disabledIndices:l}))):o&&(d=he(e,{startingIndex:a-a%i-1,disabledIndices:l})),me(d,i,t)&&(d=a)),n.key===(u?V:Y)&&(f&&ue(n),a%i!=0?(d=he(e,{startingIndex:a,decrement:!0,disabledIndices:l}),o&&me(d,i,t)&&(d=he(e,{startingIndex:a+(i-a%i),decrement:!0,disabledIndices:l}))):o&&(d=he(e,{startingIndex:a+(i-a%i),decrement:!0,disabledIndices:l})),me(d,i,t)&&(d=a));const r=w(s/i)===t;ve(e,d)&&(d=o&&r?n.key===(u?V:Y)?s:he(e,{startingIndex:a-a%i-1,disabledIndices:l}):a)}return d}function be(e,t,n){const r=[];let o=0;return e.forEach(((e,u)=>{let{width:i,height:l}=e;if(i>t&&"production"!==process.env.NODE_ENV)throw new Error("[Floating UI]: Invalid grid - item width at index "+u+" is greater than grid columns");let c=!1;for(n&&(o=0);!c;){const e=[];for(let n=0;n<i;n++)for(let r=0;r<l;r++)e.push(o+n+r*t);o%t+i<=t&&e.every((e=>null==r[e]))?(e.forEach((e=>{r[e]=u})),c=!0):o++}})),[...r]}function we(e,t,n,r,o){if(-1===e)return-1;const u=n.indexOf(e),i=t[e];switch(o){case"tl":return u;case"tr":return i?u+i.width-1:u;case"bl":return i?u+(i.height-1)*r:u;case"br":return n.lastIndexOf(e)}}function Ee(e,t){return t.flatMap(((t,n)=>e.includes(t)?[n]:[]))}function Re(e,t,n){if("function"==typeof n)return n(t);if(n)return n.includes(t);const r=e.current[t];return null==r||r.hasAttribute("disabled")||"true"===r.getAttribute("aria-disabled")}const xe=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Ie(e,t){const n=H(e,xe()),r=n.length;if(0===r)return;const o=G(J(e)),u=n.indexOf(o);return n[-1===u?1===t?0:r-1:u+t]}function ke(e){return Ie(J(e).body,1)||e}function Ce(e){return Ie(J(e).body,-1)||e}function Me(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Z(n,r)}function Oe(e){H(e,xe()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function Se(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}function Pe(e){const t=u.useRef(void 0),n=u.useCallback((t=>{const n=e.map((e=>{if(null!=e){if("function"==typeof e){const n=e,r=n(t);return"function"==typeof r?r:()=>{n(null)}}return e.current=t,()=>{e.current=null}}}));return()=>{n.forEach((e=>null==e?void 0:e()))}}),e);return u.useMemo((()=>e.every((e=>null==e))?null:e=>{t.current&&(t.current(),t.current=void 0),null!=e&&(t.current=n(e))}),e)}function Te(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Ae=u.createContext({register:()=>{},unregister:()=>{},map:new Map,elementsRef:{current:[]}});function Le(e){const{children:t,elementsRef:n,labelsRef:r}=e,[o,i]=u.useState((()=>new Set)),l=u.useCallback((e=>{i((t=>new Set(t).add(e)))}),[]),c=u.useCallback((e=>{i((t=>{const n=new Set(t);return n.delete(e),n}))}),[]),s=u.useMemo((()=>{const e=new Map;return Array.from(o.keys()).sort(Te).forEach(((t,n)=>{e.set(t,n)})),e}),[o]);return u.createElement(Ae.Provider,{value:u.useMemo((()=>({register:l,unregister:c,map:s,elementsRef:n,labelsRef:r})),[l,c,s,n,r])},t)}function Ne(e){void 0===e&&(e={});const{label:t}=e,{register:n,unregister:r,map:o,elementsRef:i,labelsRef:l}=u.useContext(Ae),[c,s]=u.useState(null),a=u.useRef(null),f=u.useCallback((e=>{if(a.current=e,null!==c&&(i.current[c]=e,l)){var n;const r=void 0!==t;l.current[c]=r?t:null!=(n=null==e?void 0:e.textContent)?n:null}}),[c,i,l,t]);return se((()=>{const e=a.current;if(e)return n(e),()=>{r(e)}}),[n,r]),se((()=>{const e=a.current?o.get(a.current):null;null!=e&&s(e)}),[o]),u.useMemo((()=>({ref:f,index:null==c?-1:c})),[c,f])}const De="data-floating-ui-focusable",Fe="active",je="selected",Ke="ArrowLeft",He="ArrowRight",We="ArrowUp",qe="ArrowDown";function _e(e,t){return"function"==typeof e?e(t):e?u.cloneElement(e,t):u.createElement("div",t)}const Be=u.createContext({activeIndex:0,onNavigate:()=>{}}),Ue=[Ke,He],ze=[We,qe],Xe=[...Ue,...ze],Ye=u.forwardRef((function(e,t){const{render:n,orientation:r="both",loop:o=!0,rtl:i=!1,cols:l=1,disabledIndices:c,activeIndex:s,onNavigate:a,itemSizes:f,dense:d=!1,...m}=e,[v,p]=u.useState(0),g=null!=s?s:v,h=de(null!=a?a:p),y=u.useRef([]),b=n&&"function"!=typeof n?n.props:{},w=u.useMemo((()=>({activeIndex:g,onNavigate:h})),[g,h]),E=l>1;const R={...m,...b,ref:t,"aria-orientation":"both"===r?void 0:r,onKeyDown(e){null==m.onKeyDown||m.onKeyDown(e),null==b.onKeyDown||b.onKeyDown(e),function(e){if(!Xe.includes(e.key))return;let t=g;const n=pe(y,c),u=ge(y,c),s=i?Ke:He,a=i?He:Ke;if(E){const a=f||Array.from({length:y.current.length},(()=>({width:1,height:1}))),m=be(a,l,d),v=m.findIndex((e=>null!=e&&!Re(y,e,c))),p=m.reduce(((e,t,n)=>null==t||Re(y,t,c)?e:n),-1),h=m[ye({current:m.map((e=>e?y.current[e]:null))},{event:e,orientation:r,loop:o,rtl:i,cols:l,disabledIndices:Ee([...("function"!=typeof c?c:null)||y.current.map(((e,t)=>Re(y,t,c)?t:void 0)),void 0],m),minIndex:v,maxIndex:p,prevIndex:we(g>u?n:g,a,m,l,e.key===qe?"bl":e.key===s?"tr":"tl")})];null!=h&&(t=h)}const m={horizontal:[s],vertical:[qe],both:[s,qe]}[r],v={horizontal:[a],vertical:[We],both:[a,We]}[r],p=E?Xe:{horizontal:Ue,vertical:ze,both:Xe}[r];var b;t===g&&[...m,...v].includes(e.key)&&(t=o&&t===u&&m.includes(e.key)?n:o&&t===n&&v.includes(e.key)?u:he(y,{startingIndex:t,decrement:v.includes(e.key),disabledIndices:c})),t===g||ve(y,t)||(e.stopPropagation(),p.includes(e.key)&&e.preventDefault(),h(t),null==(b=y.current[t])||b.focus())}(e)}};return u.createElement(Be.Provider,{value:w},u.createElement(Le,{elementsRef:y},_e(n,R)))})),Ve=u.forwardRef((function(e,t){const{render:n,...r}=e,o=n&&"function"!=typeof n?n.props:{},{activeIndex:i,onNavigate:l}=u.useContext(Be),{ref:c,index:s}=Ne(),a=Pe([c,t,o.ref]),f=i===s;return _e(n,{...r,...o,ref:a,tabIndex:f?0:-1,"data-active":f?"":void 0,onFocus(e){null==r.onFocus||r.onFocus(e),null==o.onFocus||o.onFocus(e),l(s)}})}));function Ge(){return Ge=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ge.apply(null,arguments)}const Ze={...u};let $e=!1,Qe=0;const Je=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Qe++;const et=Ze.useId||function(){const[e,t]=u.useState((()=>$e?Je():void 0));return se((()=>{null==e&&t(Je())}),[]),u.useEffect((()=>{$e=!0}),[]),e},tt=u.forwardRef((function(e,t){const{context:{placement:n,elements:{floating:r},middlewareData:{arrow:o,shift:i}},width:l=14,height:c=7,tipRadius:s=0,strokeWidth:a=0,staticOffset:f,stroke:d,d:m,style:{transform:v,...g}={},...h}=e,y=et(),[b,w]=u.useState(!1);if(se((()=>{if(!r)return;"rtl"===p(r).direction&&w(!0)}),[r]),!r)return null;const[E,R]=n.split("-"),x="top"===E||"bottom"===E;let I=f;(x&&null!=i&&i.x||!x&&null!=i&&i.y)&&(I=null);const k=2*a,C=k/2,M=l/2*(s/-8+1),O=c/2*s/4,S=!!m,P=I&&"end"===R?"bottom":"top";let T=I&&"end"===R?"right":"left";I&&b&&(T="end"===R?"left":"right");const A=null!=(null==o?void 0:o.x)?I||o.x:"",L=null!=(null==o?void 0:o.y)?I||o.y:"",N=m||"M0,0 H"+l+" L"+(l-M)+","+(c-O)+" Q"+l/2+","+c+" "+M+","+(c-O)+" Z",D={top:S?"rotate(180deg)":"",left:S?"rotate(90deg)":"rotate(-90deg)",bottom:S?"":"rotate(180deg)",right:S?"rotate(-90deg)":"rotate(90deg)"}[E];return u.createElement("svg",Ge({},h,{"aria-hidden":!0,ref:t,width:S?l:l+k,height:l,viewBox:"0 0 "+l+" "+(c>l?c:l),style:{position:"absolute",pointerEvents:"none",[T]:A,[P]:L,[E]:x||S?"100%":"calc(100% - "+k/2+"px)",transform:[D,v].filter((e=>!!e)).join(" "),...g}}),k>0&&u.createElement("path",{clipPath:"url(#"+y+")",fill:"none",stroke:d,strokeWidth:k+(m?0:1),d:N}),u.createElement("path",{stroke:k&&!m?h.fill:"none",d:N}),u.createElement("clipPath",{id:y},u.createElement("rect",{x:-C,y:C*(S?-1:1),width:l+k,height:l})))}));function nt(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;null==(r=e.get(t))||r.delete(n)}}}const rt=u.createContext(null),ot=u.createContext(null),ut=()=>{var e;return(null==(e=u.useContext(rt))?void 0:e.id)||null},it=()=>u.useContext(ot);function lt(e){return"data-floating-ui-"+e}function ct(e){-1!==e.current&&(clearTimeout(e.current),e.current=-1)}const st=lt("safe-polygon");function at(e,t,n){if(n&&!ce(n))return 0;if("number"==typeof e)return e;if("function"==typeof e){const n=e();return"number"==typeof n?n:null==n?void 0:n[t]}return null==e?void 0:e[t]}function ft(e){return"function"==typeof e?e():e}const dt=()=>{},mt=u.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:dt,setState:dt,isInstantPhase:!1}),vt=()=>u.useContext(mt);const pt=u.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeoutIdRef:{current:-1},currentIdRef:{current:null},currentContextRef:{current:null}});let gt=0;function ht(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(gt);const u=()=>null==e?void 0:e.focus({preventScroll:n});o?u():gt=requestAnimationFrame(u)}function yt(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&m(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}const bt={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function wt(e){return"inert"===e?bt.inert:"aria-hidden"===e?bt["aria-hidden"]:bt.none}let Et=new WeakSet,Rt={},xt=0;const It=e=>e&&(e.host||It(e.parentNode));function kt(e,t,n,r){const o="data-floating-ui-inert",u=r?"inert":n?"aria-hidden":null,i=(l=t,e.map((e=>{if(l.contains(e))return e;const t=It(e);return l.contains(t)?t:null})).filter((e=>null!=e)));var l;const s=new Set,a=new Set(i),f=[];Rt[o]||(Rt[o]=new WeakMap);const d=Rt[o];return i.forEach((function e(t){if(!t||s.has(t))return;s.add(t),t.parentNode&&e(t.parentNode)})),function e(t){if(!t||a.has(t))return;[].forEach.call(t.children,(t=>{if("script"!==c(t))if(s.has(t))e(t);else{const e=u?t.getAttribute(u):null,n=null!==e&&"false"!==e,r=wt(u),i=(r.get(t)||0)+1,l=(d.get(t)||0)+1;r.set(t,i),d.set(t,l),f.push(t),1===i&&n&&Et.add(t),1===l&&t.setAttribute(o,""),!n&&u&&t.setAttribute(u,"inert"===u?"":"true")}}))}(t),s.clear(),xt++,()=>{f.forEach((e=>{const t=wt(u),n=(t.get(e)||0)-1,r=(d.get(e)||0)-1;t.set(e,n),d.set(e,r),n||(!Et.has(e)&&u&&e.removeAttribute(u),Et.delete(e)),r||e.removeAttribute(o)})),xt--,xt||(bt.inert=new WeakMap,bt["aria-hidden"]=new WeakMap,bt.none=new WeakMap,Et=new WeakSet,Rt={})}}function Ct(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=(o=e[0],(null==o?void 0:o.ownerDocument)||document).body;var o;return kt(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const Mt={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},Ot=u.forwardRef((function(e,t){const[n,r]=u.useState();se((()=>{B()&&r("button")}),[]);const o={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[lt("focus-guard")]:"",style:Mt};return u.createElement("span",Ge({},e,o))})),St=u.createContext(null),Pt=lt("portal");function Tt(e){void 0===e&&(e={});const{id:t,root:n}=e,r=et(),o=At(),[i,l]=u.useState(null),c=u.useRef(null);return se((()=>()=>{null==i||i.remove(),queueMicrotask((()=>{c.current=null}))}),[i]),se((()=>{if(!r)return;if(c.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=r,n.setAttribute(Pt,""),e.appendChild(n),c.current=n,l(n)}),[t,r]),se((()=>{if(null===n)return;if(!r)return;if(c.current)return;let e=n||(null==o?void 0:o.portalNode);e&&!f(e)&&(e=e.current),e=e||document.body;let u=null;t&&(u=document.createElement("div"),u.id=t,e.appendChild(u));const i=document.createElement("div");i.id=r,i.setAttribute(Pt,""),e=u||e,e.appendChild(i),c.current=i,l(i)}),[t,n,r,o]),i}const At=()=>u.useContext(St);function Lt(e){return u.useMemo((()=>t=>{e.forEach((e=>{e&&(e.current=t)}))}),e)}let Nt=[];function Dt(){return Nt.slice().reverse().find((e=>e.isConnected))}function Ft(e,t){var n;if(!(t.current.includes("floating")||null!=(n=e.getAttribute("role"))&&n.includes("dialog")))return;const r=xe(),o=function(e,t){return(t=t||{}).getShadowRoot?M([e],t.includeContainer,{filter:D.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):C(e,t.includeContainer,D.bind(null,t))}(e,r),u=o.filter((e=>{const t=e.getAttribute("data-tabindex")||"";return W(e,r)||e.hasAttribute("data-tabindex")&&!t.startsWith("-")})),i=e.getAttribute("tabindex");t.current.includes("floating")||0===u.length?"0"!==i&&e.setAttribute("tabindex","0"):("-1"!==i||e.hasAttribute("data-tabindex")&&"-1"!==e.getAttribute("data-tabindex"))&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}const jt=u.forwardRef((function(e,t){return u.createElement("button",Ge({},e,{type:"button",ref:t,tabIndex:-1,style:Mt}))}));let Kt=0;const Ht="--floating-ui-scrollbar-width";let Wt=()=>{};const qt=u.forwardRef((function(e,t){const{lockScroll:n=!1,...r}=e;return se((()=>{if(n)return Kt++,1===Kt&&(Wt=function(){const e=q(),t=/iP(hone|ad|od)|iOS/.test(e)||"MacIntel"===e&&navigator.maxTouchPoints>1,n=document.body.style,r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth,u=n.left?parseFloat(n.left):window.scrollX,i=n.top?parseFloat(n.top):window.scrollY;if(n.overflow="hidden",n.setProperty(Ht,o+"px"),o&&(n[r]=o+"px"),t){var l,c;const e=(null==(l=window.visualViewport)?void 0:l.offsetLeft)||0,t=(null==(c=window.visualViewport)?void 0:c.offsetTop)||0;Object.assign(n,{position:"fixed",top:-(i-Math.floor(t))+"px",left:-(u-Math.floor(e))+"px",right:"0"})}return()=>{Object.assign(n,{overflow:"",[r]:""}),n.removeProperty(Ht),t&&(Object.assign(n,{position:"",top:"",left:"",right:""}),window.scrollTo(u,i))}}()),()=>{Kt--,0===Kt&&Wt()}}),[n]),u.createElement("div",Ge({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function _t(e){return d(e.target)&&"BUTTON"===e.target.tagName}function Bt(e){return ee(e)}function Ut(e){return null!=e&&null!=e.clientX}const zt={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Xt={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Yt=e=>{var t,n;return{escapeKey:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePress:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}};function Vt(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=et(),i=u.useRef({}),[l]=u.useState((()=>nt())),c=null!=ut(),[s,a]=u.useState(r.reference),f=de(((e,t,r)=>{i.current.openEvent=e?t:void 0,l.emit("openchange",{open:e,event:t,reason:r,nested:c}),null==n||n(e,t,r)})),d=u.useMemo((()=>({setPositionReference:a})),[]),m=u.useMemo((()=>({reference:s||r.reference||null,floating:r.floating||null,domReference:r.reference})),[s,r.reference,r.floating]);return u.useMemo((()=>({dataRef:i,open:t,onOpenChange:f,elements:m,events:l,floatingId:o,refs:d})),[t,f,m,l,o,d])}function Gt(){return q().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints&&B()}function Zt(e,t,n){const r=new Map,o="item"===n;let u=e;if(o&&e){const{[Fe]:t,[je]:n,...r}=e;u=r}return{..."floating"===n&&{tabIndex:-1,[De]:""},...u,...t.map((t=>{const r=t?t[n]:null;return"function"==typeof r?e?r(e):null:r})).concat(e).reduce(((e,t)=>t?(Object.entries(t).forEach((t=>{let[n,u]=t;var i;o&&[Fe,je].includes(n)||(0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof u&&(null==(i=r.get(n))||i.push(u),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),u=0;u<t;u++)o[u]=arguments[u];return null==(e=r.get(n))?void 0:e.map((e=>e(...o))).find((e=>void 0!==e))})):e[n]=u)})),e):e),{})}}function $t(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Qt(e,t){return $t(t,e===We||e===qe,e===Ke||e===He)}function Jt(e,t,n){return $t(t,e===qe,n?e===Ke:e===He)||"Enter"===e||" "===e||""===e}function en(e,t,n){return $t(t,n?e===Ke:e===He,e===qe)}function tn(e,t,n,r){return"both"===t||"horizontal"===t&&r&&r>1?"Escape"===e:$t(t,n?e===He:e===Ke,e===We)}const nn=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);const rn=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function on(e,t){return"function"==typeof e?e(t):e}function un(e,t){void 0===t&&(t={});const{open:n,elements:{floating:r}}=e,{duration:o=250}=t,l=("number"==typeof o?o:o.close)||0,[c,s]=u.useState("unmounted"),a=function(e,t){const[n,r]=u.useState(e);return e&&!n&&r(!0),u.useEffect((()=>{if(!e&&n){const e=setTimeout((()=>r(!1)),t);return()=>clearTimeout(e)}}),[e,n,t]),n}(n,l);return a||"close"!==c||s("unmounted"),se((()=>{if(r){if(n){s("initial");const e=requestAnimationFrame((()=>{i.flushSync((()=>{s("open")}))}));return()=>{cancelAnimationFrame(e)}}s("close")}}),[n,r]),{isMounted:a,status:c}}function ln(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}function cn(e,t){const[n,r]=e;let o=!1;const u=t.length;for(let e=0,i=u-1;e<u;i=e++){const[u,l]=t[e]||[0,0],[c,s]=t[i]||[0,0];l>=r!=s>=r&&n<=(c-u)*(r-l)/(s-l)+u&&(o=!o)}return o}Object.defineProperty(e,"arrow",{enumerable:!0,get:function(){return r.arrow}}),Object.defineProperty(e,"autoPlacement",{enumerable:!0,get:function(){return r.autoPlacement}}),Object.defineProperty(e,"autoUpdate",{enumerable:!0,get:function(){return r.autoUpdate}}),Object.defineProperty(e,"computePosition",{enumerable:!0,get:function(){return r.computePosition}}),Object.defineProperty(e,"detectOverflow",{enumerable:!0,get:function(){return r.detectOverflow}}),Object.defineProperty(e,"flip",{enumerable:!0,get:function(){return r.flip}}),Object.defineProperty(e,"getOverflowAncestors",{enumerable:!0,get:function(){return r.getOverflowAncestors}}),Object.defineProperty(e,"hide",{enumerable:!0,get:function(){return r.hide}}),Object.defineProperty(e,"inline",{enumerable:!0,get:function(){return r.inline}}),Object.defineProperty(e,"limitShift",{enumerable:!0,get:function(){return r.limitShift}}),Object.defineProperty(e,"offset",{enumerable:!0,get:function(){return r.offset}}),Object.defineProperty(e,"platform",{enumerable:!0,get:function(){return r.platform}}),Object.defineProperty(e,"shift",{enumerable:!0,get:function(){return r.shift}}),Object.defineProperty(e,"size",{enumerable:!0,get:function(){return r.size}}),e.Composite=Ye,e.CompositeItem=Ve,e.FloatingArrow=tt,e.FloatingDelayGroup=function(e){const{children:t,delay:n,timeoutMs:r=0}=e,[o,i]=u.useReducer(((e,t)=>({...e,...t})),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),l=u.useRef(null),c=u.useCallback((e=>{i({currentId:e})}),[]);return se((()=>{o.currentId?null===l.current?l.current=o.currentId:o.isInstantPhase||i({isInstantPhase:!0}):(o.isInstantPhase&&i({isInstantPhase:!1}),l.current=null)}),[o.currentId,o.isInstantPhase]),u.createElement(mt.Provider,{value:u.useMemo((()=>({...o,setState:i,setCurrentId:c})),[o,c])},t)},e.FloatingFocusManager=function(e){const{context:t,children:n,disabled:r=!1,order:o=["content"],guards:i=!0,initialFocus:l=0,returnFocus:s=!0,restoreFocus:a=!1,modal:f=!0,visuallyHiddenDismiss:m=!1,closeOnFocusOut:v=!0,outsideElementsInert:p=!1,getInsideElements:g=()=>[]}=e,{open:h,onOpenChange:y,events:b,dataRef:w,elements:{domReference:E,floating:R}}=t,x=de((()=>{var e;return null==(e=w.current.floatingContext)?void 0:e.nodeId})),I=de(g),k="number"==typeof l&&l<0,C=te(E)&&k,M="undefined"!=typeof HTMLElement&&"inert"in HTMLElement.prototype,O=!M||i,S=!O||M&&p,P=ae(o),T=ae(l),A=ae(s),L=it(),N=At(),D=u.useRef(null),F=u.useRef(null),j=u.useRef(!1),K=u.useRef(!1),q=u.useRef(-1),_=null!=N,B=ne(R),U=de((function(e){return void 0===e&&(e=B),e?H(e,xe()):[]})),z=de((e=>{const t=U(e);return P.current.map((e=>E&&"reference"===e?E:B&&"floating"===e?B:t)).filter(Boolean).flat()}));u.useEffect((()=>{if(r)return;if(!f)return;function e(e){if("Tab"===e.key){Z(B,G(J(B)))&&0===U().length&&!C&&ue(e);const t=z(),n=$(e);"reference"===P.current[0]&&n===E&&(ue(e),e.shiftKey?ht(t[t.length-1]):ht(t[1])),"floating"===P.current[1]&&n===B&&e.shiftKey&&(ue(e),ht(t[0]))}}const t=J(B);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[r,E,B,f,P,C,U,z]),u.useEffect((()=>{if(!r&&R)return R.addEventListener("focusin",e),()=>{R.removeEventListener("focusin",e)};function e(e){const t=$(e),n=U().indexOf(t);-1!==n&&(q.current=n)}}),[r,R,U]),u.useEffect((()=>{if(!r&&v)return R&&d(E)?(E.addEventListener("focusout",t),E.addEventListener("pointerdown",e),R.addEventListener("focusout",t),()=>{E.removeEventListener("focusout",t),E.removeEventListener("pointerdown",e),R.removeEventListener("focusout",t)}):void 0;function e(){K.current=!0,setTimeout((()=>{K.current=!1}))}function t(e){const t=e.relatedTarget,n=e.currentTarget,r=$(e);queueMicrotask((()=>{const o=x(),u=!(Z(E,t)||Z(R,t)||Z(t,R)||Z(null==N?void 0:N.portalNode,t)||null!=t&&t.hasAttribute(lt("focus-guard"))||L&&(re(L.nodesRef.current,o).find((e=>{var n,r;return Z(null==(n=e.context)?void 0:n.elements.floating,t)||Z(null==(r=e.context)?void 0:r.elements.domReference,t)}))||oe(L.nodesRef.current,o).find((e=>{var n,r,o;return[null==(n=e.context)?void 0:n.elements.floating,ne(null==(r=e.context)?void 0:r.elements.floating)].includes(t)||(null==(o=e.context)?void 0:o.elements.domReference)===t}))));if(n===E&&B&&Ft(B,P),a&&n!==E&&(null==r||!r.isConnected)&&G(J(B))===J(B).body){d(B)&&B.focus();const e=q.current,t=U(),n=t[e]||t[t.length-1]||B;d(n)&&n.focus()}w.current.insideReactTree?w.current.insideReactTree=!1:!C&&f||!t||!u||K.current||t===Dt()||(j.current=!0,y(!1,e,"focus-out"))}))}}),[r,E,R,B,f,L,N,y,v,a,U,C,x,P,w]);const X=u.useRef(null),Y=u.useRef(null),V=Lt([X,null==N?void 0:N.beforeInsideRef]),Q=Lt([Y,null==N?void 0:N.afterInsideRef]);function ee(e){return!r&&m&&f?u.createElement(jt,{ref:"start"===e?D:F,onClick:e=>y(!1,e.nativeEvent)},"string"==typeof m?m:"Dismiss"):null}u.useEffect((()=>{var e,t;if(r)return;if(!R)return;const n=Array.from((null==N||null==(e=N.portalNode)?void 0:e.querySelectorAll("["+lt("portal")+"]"))||[]),o=L?oe(L.nodesRef.current,x()):[],u=L&&!f?o.map((e=>{var t;return null==(t=e.context)?void 0:t.elements.floating})):[],i=null==(t=o.find((e=>{var t;return te((null==(t=e.context)?void 0:t.elements.domReference)||null)})))||null==(t=t.context)?void 0:t.elements.domReference,l=[R,i,...n,...u,...I(),D.current,F.current,X.current,Y.current,null==N?void 0:N.beforeOutsideRef.current,null==N?void 0:N.afterOutsideRef.current,P.current.includes("reference")||C?E:null].filter((e=>null!=e)),c=f||C?Ct(l,!S,S):Ct(l);return()=>{c()}}),[r,E,R,f,P,N,C,O,S,L,x,I]),se((()=>{if(r||!d(B))return;const e=G(J(B));queueMicrotask((()=>{const t=z(B),n=T.current,r=("number"==typeof n?t[n]:n.current)||B,o=Z(B,e);k||o||!h||ht(r,{preventScroll:r===B})}))}),[r,h,B,k,z,T]),se((()=>{if(r||!B)return;const e=J(B),t=G(e);var n;function o(e){let{reason:t,event:n,nested:r}=e;if(["hover","safe-polygon"].includes(t)&&"mouseleave"===n.type&&(j.current=!0),"outside-press"===t)if(r)j.current=!1;else if(ie(n)||le(n))j.current=!1;else{let e=!1;document.createElement("div").focus({get preventScroll(){return e=!0,!1}}),j.current=!e}}n=t,Nt=Nt.filter((e=>e.isConnected)),n&&"body"!==c(n)&&(Nt.push(n),Nt.length>20&&(Nt=Nt.slice(-20))),b.on("openchange",o);const u=e.createElement("span");return u.setAttribute("tabindex","-1"),u.setAttribute("aria-hidden","true"),Object.assign(u.style,Mt),_&&E&&E.insertAdjacentElement("afterend",u),()=>{b.off("openchange",o);const t=G(e),n=Z(R,t)||L&&re(L.nodesRef.current,x()).some((e=>{var n;return Z(null==(n=e.context)?void 0:n.elements.floating,t)})),r=function(){if("boolean"==typeof A.current){const e=E||Dt();return e&&e.isConnected?e:u}return A.current.current||u}();queueMicrotask((()=>{const o=function(e){const t=xe();return W(e,t)?e:H(e,t)[0]||e}(r);A.current&&!j.current&&d(o)&&(o===t||t===e.body||n)&&o.focus({preventScroll:!0}),u.remove()}))}}),[r,R,B,A,w,b,L,_,E,x]),u.useEffect((()=>{queueMicrotask((()=>{j.current=!1}))}),[r]),se((()=>{if(!r&&N)return N.setFocusManagerState({modal:f,closeOnFocusOut:v,open:h,onOpenChange:y,domReference:E}),()=>{N.setFocusManagerState(null)}}),[r,N,f,h,y,v,E]),se((()=>{r||B&&Ft(B,P)}),[r,B,P]);const ce=!r&&O&&(!f||!C)&&(_||f);return u.createElement(u.Fragment,null,ce&&u.createElement(Ot,{"data-type":"inside",ref:V,onFocus:e=>{if(f){const e=z();ht("reference"===o[0]?e[0]:e[e.length-1])}else if(null!=N&&N.preserveTabOrder&&N.portalNode)if(j.current=!1,Me(e,N.portalNode)){const e=ke(E);null==e||e.focus()}else{var t;null==(t=N.beforeOutsideRef.current)||t.focus()}}}),!C&&ee("start"),n,ee("end"),ce&&u.createElement(Ot,{"data-type":"inside",ref:Q,onFocus:e=>{if(f)ht(z()[0]);else if(null!=N&&N.preserveTabOrder&&N.portalNode)if(v&&(j.current=!0),Me(e,N.portalNode)){const e=Ce(E);null==e||e.focus()}else{var t;null==(t=N.afterOutsideRef.current)||t.focus()}}}))},e.FloatingList=Le,e.FloatingNode=function(e){const{children:t,id:n}=e,r=ut();return u.createElement(rt.Provider,{value:u.useMemo((()=>({id:n,parentId:r})),[n,r])},t)},e.FloatingOverlay=qt,e.FloatingPortal=function(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,l=Tt({id:n,root:r}),[c,s]=u.useState(null),a=u.useRef(null),f=u.useRef(null),d=u.useRef(null),m=u.useRef(null),v=null==c?void 0:c.modal,p=null==c?void 0:c.open,g=!!c&&!c.modal&&c.open&&o&&!(!r&&!l);return u.useEffect((()=>{if(l&&o&&!v)return l.addEventListener("focusin",e,!0),l.addEventListener("focusout",e,!0),()=>{l.removeEventListener("focusin",e,!0),l.removeEventListener("focusout",e,!0)};function e(e){if(l&&Me(e)){("focusin"===e.type?Se:Oe)(l)}}}),[l,o,v]),u.useEffect((()=>{l&&(p||Se(l))}),[p,l]),u.createElement(St.Provider,{value:u.useMemo((()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:f,beforeInsideRef:d,afterInsideRef:m,portalNode:l,setFocusManagerState:s})),[o,l])},g&&l&&u.createElement(Ot,{"data-type":"outside",ref:a,onFocus:e=>{if(Me(e,l)){var t;null==(t=d.current)||t.focus()}else{const e=Ce(c?c.domReference:null);null==e||e.focus()}}}),g&&l&&u.createElement("span",{"aria-owns":l.id,style:Mt}),l&&i.createPortal(t,l),g&&l&&u.createElement(Ot,{"data-type":"outside",ref:f,onFocus:e=>{if(Me(e,l)){var t;null==(t=m.current)||t.focus()}else{const t=ke(c?c.domReference:null);null==t||t.focus(),(null==c?void 0:c.closeOnFocusOut)&&(null==c||c.onOpenChange(!1,e.nativeEvent,"focus-out"))}}}))},e.FloatingTree=function(e){const{children:t}=e,n=u.useRef([]),r=u.useCallback((e=>{n.current=[...n.current,e]}),[]),o=u.useCallback((e=>{n.current=n.current.filter((t=>t!==e))}),[]),[i]=u.useState((()=>nt()));return u.createElement(ot.Provider,{value:u.useMemo((()=>({nodesRef:n,addNode:r,removeNode:o,events:i})),[r,o,i])},t)},e.NextFloatingDelayGroup=function(e){const{children:t,delay:n,timeoutMs:r=0}=e,o=u.useRef(n),i=u.useRef(n),l=u.useRef(null),c=u.useRef(null),s=u.useRef(-1);return u.createElement(pt.Provider,{value:u.useMemo((()=>({hasProvider:!0,delayRef:o,initialDelayRef:i,currentIdRef:l,timeoutMs:r,currentContextRef:c,timeoutIdRef:s})),[r])},t)},e.inner=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:o,onFallbackChange:u,offset:l=0,index:c=0,minItemsVisible:s=4,referenceOverflowThreshold:a=0,scrollRef:f,...d}=(v=t,"function"==typeof(m=e)?m(v):m);var m,v;const{rects:p,elements:{floating:g}}=t,w=n.current[c],E=(null==f?void 0:f.current)||g,R=g.clientTop||E.clientTop,x=0!==g.clientTop,I=0!==E.clientTop,k=g===E;if(!w)return{};const C={...t,...await r.offset(-w.offsetTop-g.clientTop-p.reference.height/2-w.offsetHeight/2-l).fn(t)},M=await r.detectOverflow(ln(C,E.scrollHeight+R+g.clientTop),d),O=await r.detectOverflow(C,{...d,elementContext:"reference"}),S=y(0,M.top),P=C.y+S,T=(E.scrollHeight>E.clientHeight?e=>e:b)(y(0,E.scrollHeight+(x&&k||I?2*R:0)-S-y(0,M.bottom)));if(E.style.maxHeight=T+"px",E.scrollTop=S,u){const e=E.offsetHeight<w.offsetHeight*h(s,n.current.length)-1||O.top>=-a||O.bottom>=-a;i.flushSync((()=>u(e)))}return o&&(o.current=await r.detectOverflow(ln({...C,y:P},E.offsetHeight+R+g.clientTop),d)),{y:P}}}),e.safePolygon=function(e){void 0===e&&(e={});const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,o={current:-1};let u=!1,i=null,l=null,c=performance.now();const s=e=>{let{x:n,y:s,placement:a,elements:d,onClose:m,nodeId:v,tree:p}=e;return function(e){function g(){ct(o),m()}if(ct(o),!d.domReference||!d.floating||null==a||null==n||null==s)return;const{clientX:h,clientY:y}=e,b=[h,y],w=function(e){return"composedPath"in e?e.composedPath()[0]:e.target}(e),E="mouseleave"===e.type,R=yt(d.floating,w),x=yt(d.domReference,w),I=d.domReference.getBoundingClientRect(),k=d.floating.getBoundingClientRect(),C=a.split("-")[0],M=n>k.right-k.width/2,O=s>k.bottom-k.height/2,S=function(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}(b,I),P=k.width>I.width,T=k.height>I.height,A=(P?I:k).left,L=(P?I:k).right,N=(T?I:k).top,D=(T?I:k).bottom;if(R&&(u=!0,!E))return;if(x&&(u=!1),x&&!E)return void(u=!0);if(E&&f(e.relatedTarget)&&yt(d.floating,e.relatedTarget))return;if(p&&function(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})),r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})),n=n.concat(r);return n}(p.nodesRef.current,v).length)return;if("top"===C&&s>=I.bottom-1||"bottom"===C&&s<=I.top+1||"left"===C&&n>=I.right-1||"right"===C&&n<=I.left+1)return g();let F=[];switch(C){case"top":F=[[A,I.top+1],[A,k.bottom-1],[L,k.bottom-1],[L,I.top+1]];break;case"bottom":F=[[A,k.top+1],[A,I.bottom-1],[L,I.bottom-1],[L,k.top+1]];break;case"left":F=[[k.right-1,D],[k.right-1,N],[I.left+1,N],[I.left+1,D]];break;case"right":F=[[I.right-1,D],[I.right-1,N],[k.left+1,N],[k.left+1,D]]}if(!cn([h,y],F)){if(u&&!S)return g();if(!E&&r){const t=function(e,t){const n=performance.now(),r=n-c;if(null===i||null===l||0===r)return i=e,l=t,c=n,null;const o=e-i,u=t-l,s=Math.sqrt(o*o+u*u);return i=e,l=t,c=n,s/r}(e.clientX,e.clientY);if(null!==t&&t<.1)return g()}cn([h,y],function(e){let[n,r]=e;switch(C){case"top":return[[P?n+t/2:M?n+4*t:n-4*t,r+t+1],[P?n-t/2:M?n+4*t:n-4*t,r+t+1],...[[k.left,M||P?k.bottom-t:k.top],[k.right,M?P?k.bottom-t:k.top:k.bottom-t]]];case"bottom":return[[P?n+t/2:M?n+4*t:n-4*t,r-t],[P?n-t/2:M?n+4*t:n-4*t,r-t],...[[k.left,M||P?k.top+t:k.bottom],[k.right,M?P?k.top+t:k.bottom:k.top+t]]];case"left":{const e=[n+t+1,T?r+t/2:O?r+4*t:r-4*t],o=[n+t+1,T?r-t/2:O?r+4*t:r-4*t];return[...[[O||T?k.right-t:k.left,k.top],[O?T?k.right-t:k.left:k.right-t,k.bottom]],e,o]}case"right":return[[n-t,T?r+t/2:O?r+4*t:r-4*t],[n-t,T?r-t/2:O?r+4*t:r-4*t],...[[O||T?k.left+t:k.right,k.top],[O?T?k.left+t:k.right:k.left+t,k.bottom]]]}}([n,s]))?!u&&r&&(o.current=window.setTimeout(g,40)):g()}}};return s.__options={blockPointerEvents:n},s},e.useClick=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:i}}=e,{enabled:l=!0,event:c="click",toggle:s=!0,ignoreMouse:a=!1,keyboardHandlers:f=!0,stickIfOpen:m=!0}=t,v=u.useRef(),p=u.useRef(!1),g=u.useMemo((()=>({onPointerDown(e){v.current=e.pointerType},onMouseDown(e){const t=v.current;0===e.button&&"click"!==c&&(ce(t,!0)&&a||(!n||!s||o.current.openEvent&&m&&"mousedown"!==o.current.openEvent.type?(e.preventDefault(),r(!0,e.nativeEvent,"click")):r(!1,e.nativeEvent,"click")))},onClick(e){const t=v.current;"mousedown"===c&&v.current?v.current=void 0:ce(t,!0)&&a||(!n||!s||o.current.openEvent&&m&&"click"!==o.current.openEvent.type?r(!0,e.nativeEvent,"click"):r(!1,e.nativeEvent,"click"))},onKeyDown(e){v.current=void 0,e.defaultPrevented||!f||_t(e)||(" "!==e.key||Bt(i)||(e.preventDefault(),p.current=!0),function(e){return d(e.target)&&"A"===e.target.tagName}(e)||"Enter"===e.key&&r(!n||!s,e.nativeEvent,"click"))},onKeyUp(e){e.defaultPrevented||!f||_t(e)||Bt(i)||" "===e.key&&p.current&&(p.current=!1,r(!n||!s,e.nativeEvent,"click"))}})),[o,i,c,a,f,r,n,m,s]);return u.useMemo((()=>l?{reference:g}:{}),[l,g])},e.useClientPoint=function(e,t){void 0===t&&(t={});const{open:n,dataRef:r,elements:{floating:o,domReference:i},refs:l}=e,{enabled:c=!0,axis:a="both",x:f=null,y:d=null}=t,m=u.useRef(!1),v=u.useRef(null),[p,g]=u.useState(),[h,y]=u.useState([]),b=de(((e,t)=>{m.current||r.current.openEvent&&!Ut(r.current.openEvent)||l.setPositionReference(function(e,t){let n=null,r=null,o=!1;return{contextElement:e||void 0,getBoundingClientRect(){var u;const i=(null==e?void 0:e.getBoundingClientRect())||{width:0,height:0,x:0,y:0},l="x"===t.axis||"both"===t.axis,c="y"===t.axis||"both"===t.axis,s=["mouseenter","mousemove"].includes((null==(u=t.dataRef.current.openEvent)?void 0:u.type)||"")&&"touch"!==t.pointerType;let a=i.width,f=i.height,d=i.x,m=i.y;return null==n&&t.x&&l&&(n=i.x-t.x),null==r&&t.y&&c&&(r=i.y-t.y),d-=n||0,m-=r||0,a=0,f=0,!o||s?(a="y"===t.axis?i.width:0,f="x"===t.axis?i.height:0,d=l&&null!=t.x?t.x:d,m=c&&null!=t.y?t.y:m):o&&!s&&(f="x"===t.axis?i.height:f,a="y"===t.axis?i.width:a),o=!0,{width:a,height:f,x:d,y:m,top:m,right:d+a,bottom:m+f,left:d}}}}(i,{x:e,y:t,axis:a,dataRef:r,pointerType:p}))})),w=de((e=>{null==f&&null==d&&(n?v.current||y([]):b(e.clientX,e.clientY))})),E=ce(p)?o:n,R=u.useCallback((()=>{if(!E||!c||null!=f||null!=d)return;const e=s(o);function t(n){const r=$(n);Z(o,r)?(e.removeEventListener("mousemove",t),v.current=null):b(n.clientX,n.clientY)}if(!r.current.openEvent||Ut(r.current.openEvent)){e.addEventListener("mousemove",t);const n=()=>{e.removeEventListener("mousemove",t),v.current=null};return v.current=n,n}l.setPositionReference(i)}),[E,c,f,d,o,r,l,i,b]);u.useEffect((()=>R()),[R,h]),u.useEffect((()=>{c&&!o&&(m.current=!1)}),[c,o]),u.useEffect((()=>{!c&&n&&(m.current=!0)}),[c,n]),se((()=>{!c||null==f&&null==d||(m.current=!1,b(f,d))}),[c,f,d,b]);const x=u.useMemo((()=>{function e(e){let{pointerType:t}=e;g(t)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:w,onMouseEnter:w}}),[w]);return u.useMemo((()=>c?{reference:x}:{}),[c,x])},e.useDelayGroup=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,floatingId:o}=e,{id:u,enabled:i=!0}=t,l=null!=u?u:o,c=vt(),{currentId:s,setCurrentId:a,initialDelay:f,setState:d,timeoutMs:m}=c;return se((()=>{i&&s&&(d({delay:{open:1,close:at(f,"close")}}),s!==l&&r(!1))}),[i,l,r,d,s,f]),se((()=>{function e(){r(!1),d({delay:f,currentId:null})}if(i&&s&&!n&&s===l){if(m){const t=window.setTimeout(e,m);return()=>{clearTimeout(t)}}e()}}),[i,n,d,s,l,r,f,m]),se((()=>{i&&a!==dt&&n&&a(l)}),[i,n,a,l]),c},e.useDelayGroupContext=vt,e.useDismiss=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:o,elements:i,dataRef:l}=e,{enabled:c=!0,escapeKey:s=!0,outsidePress:a=!0,outsidePressEvent:m="pointerdown",referencePress:h=!1,referencePressEvent:y="pointerdown",ancestorScroll:b=!1,bubbles:w,capture:E}=t,R=it(),x=de("function"==typeof a?a:()=>!1),I="function"==typeof a?x:a,k=u.useRef(!1),{escapeKey:C,outsidePress:M}=Yt(w),{escapeKey:O,outsidePress:S}=Yt(E),P=u.useRef(!1),T=u.useRef(-1),A=de((e=>{var t;if(!n||!c||!s||"Escape"!==e.key)return;if(P.current)return;const r=null==(t=l.current.floatingContext)?void 0:t.nodeId,u=R?re(R.nodesRef.current,r):[];if(!C&&(e.stopPropagation(),u.length>0)){let e=!0;if(u.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)})),!e)return}o(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")})),L=de((e=>{var t;const n=()=>{var t;A(e),null==(t=$(e))||t.removeEventListener("keydown",n)};null==(t=$(e))||t.addEventListener("keydown",n)})),N=de((e=>{var t;const n=l.current.insideReactTree;l.current.insideReactTree=!1;const r=k.current;if(k.current=!1,"click"===m&&r)return;if(n)return;if("function"==typeof I&&!I(e))return;const u=$(e),c="["+lt("inert")+"]",s=J(i.floating).querySelectorAll(c);let a=f(u)?u:null;for(;a&&!v(a);){const e=g(a);if(v(e)||!f(e))break;a=e}if(s.length&&f(u)&&!u.matches("html,body")&&!Z(u,i.floating)&&Array.from(s).every((e=>!Z(a,e))))return;if(d(u)&&j){const t=v(u),n=p(u),r=/auto|scroll/,o=t||r.test(n.overflowX),i=t||r.test(n.overflowY),l=o&&u.clientWidth>0&&u.scrollWidth>u.clientWidth,c=i&&u.clientHeight>0&&u.scrollHeight>u.clientHeight,s="rtl"===n.direction,a=c&&(s?e.offsetX<=u.offsetWidth-u.clientWidth:e.offsetX>u.clientWidth),f=l&&e.offsetY>u.clientHeight;if(a||f)return}const h=null==(t=l.current.floatingContext)?void 0:t.nodeId,y=R&&re(R.nodesRef.current,h).some((t=>{var n;return Q(e,null==(n=t.context)?void 0:n.elements.floating)}));if(Q(e,i.floating)||Q(e,i.domReference)||y)return;const b=R?re(R.nodesRef.current,h):[];if(b.length>0){let e=!0;if(b.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}o(!1,e,"outside-press")})),D=de((e=>{var t;const n=()=>{var t;N(e),null==(t=$(e))||t.removeEventListener(m,n)};null==(t=$(e))||t.addEventListener(m,n)}));u.useEffect((()=>{if(!n||!c)return;l.current.__escapeKeyBubbles=C,l.current.__outsidePressBubbles=M;let e=-1;function t(e){o(!1,e,"ancestor-scroll")}function u(){window.clearTimeout(e),P.current=!0}function a(){e=window.setTimeout((()=>{P.current=!1}),"undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")?5:0)}const d=J(i.floating);s&&(d.addEventListener("keydown",O?L:A,O),d.addEventListener("compositionstart",u),d.addEventListener("compositionend",a)),I&&d.addEventListener(m,S?D:N,S);let v=[];return b&&(f(i.domReference)&&(v=r.getOverflowAncestors(i.domReference)),f(i.floating)&&(v=v.concat(r.getOverflowAncestors(i.floating))),!f(i.reference)&&i.reference&&i.reference.contextElement&&(v=v.concat(r.getOverflowAncestors(i.reference.contextElement)))),v=v.filter((e=>{var t;return e!==(null==(t=d.defaultView)?void 0:t.visualViewport)})),v.forEach((e=>{e.addEventListener("scroll",t,{passive:!0})})),()=>{s&&(d.removeEventListener("keydown",O?L:A,O),d.removeEventListener("compositionstart",u),d.removeEventListener("compositionend",a)),I&&d.removeEventListener(m,S?D:N,S),v.forEach((e=>{e.removeEventListener("scroll",t)})),window.clearTimeout(e)}}),[l,i,s,I,m,n,o,b,c,C,M,A,O,L,N,S,D]),u.useEffect((()=>{l.current.insideReactTree=!1}),[l,I,m]);const F=u.useMemo((()=>({onKeyDown:A,...h&&{[zt[y]]:e=>{o(!1,e.nativeEvent,"reference-press")},..."click"!==y&&{onClick(e){o(!1,e.nativeEvent,"reference-press")}}}})),[A,o,h,y]),j=u.useMemo((()=>({onKeyDown:A,onMouseDown(){k.current=!0},onMouseUp(){k.current=!0},[Xt[m]]:()=>{l.current.insideReactTree=!0},onBlurCapture(){R||(ct(T),l.current.insideReactTree=!0,T.current=window.setTimeout((()=>{l.current.insideReactTree=!1})))}})),[A,m,l,R]);return u.useMemo((()=>c?{reference:F,floating:j}:{}),[c,F,j])},e.useFloating=function(e){void 0===e&&(e={});const{nodeId:t}=e,n=Vt({...e,elements:{reference:null,floating:null,...e.elements}}),o=e.rootCon