@floating-ui/react
Advanced tools
Comparing version 0.26.4 to 0.26.5
@@ -1,6 +0,6 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@floating-ui/react-dom"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","@floating-ui/react-dom","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIReact={},e.React,e.FloatingUIReactDOM,e.ReactDOM)}(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);function i(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)}const c=u["useInsertionEffect".toString()]||(e=>e());function l(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 s(e){return f(e)?(e.nodeName||"").toLowerCase():"#document"}function a(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function f(e){return e instanceof Node||e instanceof a(e).Node}function d(e){return e instanceof Element||e instanceof a(e).Element}function m(e){return e instanceof HTMLElement||e instanceof a(e).HTMLElement}function v(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof a(e).ShadowRoot)}function p(e){return["html","body","#document"].includes(s(e))}function g(e){if("html"===s(e))return e;const t=e.assignedSlot||e.parentNode||v(e)&&e.host||function(e){var t;return null==(t=(f(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}(e);return v(t)?t.host:t}function h(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 y(e,t){if(!e||!t)return!1;const n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&v(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function b(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function E(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}function w(e){return!(0!==e.mozInputSource||!e.isTrusted)||(I()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}function x(e){return!I()&&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 R(){return/apple/i.test(navigator.vendor)}function I(){const e=/android/i;return e.test(b())||e.test(E())}function k(){return b().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function O(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function C(e){return(null==e?void 0:e.ownerDocument)||document}function M(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 T(e){return"composedPath"in e?e.composedPath()[0]:e.target}const S="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function P(e){return m(e)&&e.matches(S)}function L(e){e.preventDefault(),e.stopPropagation()}function A(e){return!!e&&("combobox"===e.getAttribute("role")&&P(e))}const D=Math.floor,N="ArrowUp",F="ArrowDown",j="ArrowLeft",K="ArrowRight";function H(e,t,n){return Math.floor(e/t)!==n}function q(e,t){return t<0||t>=e.current.length}function _(e,t){return W(e,{disabledIndices:t})}function B(e,t){return W(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function W(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o,amount:u=1}=void 0===t?{}:t;const i=e.current,c=o?e=>o.includes(e):e=>{const t=i[e];return null==t||t.hasAttribute("disabled")||"true"===t.getAttribute("aria-disabled")};let l=n;do{l+=r?-u:u}while(l>=0&&l<=i.length-1&&c(l));return l}function U(e,t){let{event:n,orientation:r,loop:o,cols:u,disabledIndices:i,minIndex:c,maxIndex:l,prevIndex:s,stopEvent:a=!1}=t,f=s;if(n.key===N){if(a&&L(n),-1===s)f=l;else if(f=W(e,{startingIndex:f,amount:u,decrement:!0,disabledIndices:i}),o&&(s-u<c||f<0)){const e=s%u,t=l%u,n=l-(t-e);f=t===e?l:t>e?n:n-u}q(e,f)&&(f=s)}if(n.key===F&&(a&&L(n),-1===s?f=c:(f=W(e,{startingIndex:s,amount:u,disabledIndices:i}),o&&s+u>l&&(f=W(e,{startingIndex:s%u-u,amount:u,disabledIndices:i}))),q(e,f)&&(f=s)),"both"===r){const t=D(s/u);n.key===K&&(a&&L(n),s%u!=u-1?(f=W(e,{startingIndex:s,disabledIndices:i}),o&&H(f,u,t)&&(f=W(e,{startingIndex:s-s%u-1,disabledIndices:i}))):o&&(f=W(e,{startingIndex:s-s%u-1,disabledIndices:i})),H(f,u,t)&&(f=s)),n.key===j&&(a&&L(n),s%u!=0?(f=W(e,{startingIndex:s,disabledIndices:i,decrement:!0}),o&&H(f,u,t)&&(f=W(e,{startingIndex:s+(u-s%u),decrement:!0,disabledIndices:i}))):o&&(f=W(e,{startingIndex:s+(u-s%u),decrement:!0,disabledIndices:i})),H(f,u,t)&&(f=s));const r=D(l/u)===t;q(e,f)&&(f=o&&r?n.key===j?l:W(e,{startingIndex:s-s%u-1,disabledIndices:i}):s)}return f}let z=0;function X(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(z);const u=()=>null==e?void 0:e.focus({preventScroll:n});o?u():z=requestAnimationFrame(u)}var Y="undefined"!=typeof document?t.useLayoutEffect:t.useEffect;function V(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 G=u.createContext({register:()=>{},unregister:()=>{},map:new Map,elementsRef:{current:[]}});function Z(e){let{children:t,elementsRef:n,labelsRef:r}=e;const[o,i]=u.useState((()=>new Map)),c=u.useCallback((e=>{i((t=>new Map(t).set(e,null)))}),[]),l=u.useCallback((e=>{i((t=>{const n=new Map(t);return n.delete(e),n}))}),[]);return Y((()=>{const e=new Map(o);Array.from(e.keys()).sort(V).forEach(((t,n)=>{e.set(t,n)})),function(e,t){if(e.size!==t.size)return!1;for(const[n,r]of e.entries())if(r!==t.get(n))return!1;return!0}(o,e)||i(e)}),[o]),u.createElement(G.Provider,{value:u.useMemo((()=>({register:c,unregister:l,map:o,elementsRef:n,labelsRef:r})),[c,l,o,n,r])},t)}function $(e){let{label:t}=void 0===e?{}:e;const[n,r]=u.useState(null),o=u.useRef(null),{register:i,unregister:c,map:l,elementsRef:s,labelsRef:a}=u.useContext(G),f=u.useCallback((e=>{if(o.current=e,null!==n&&(s.current[n]=e,a)){var r;const o=void 0!==t;a.current[n]=o?t:null!=(r=null==e?void 0:e.textContent)?r:null}}),[n,s,a,t]);return Y((()=>{const e=o.current;if(e)return i(e),()=>{c(e)}}),[i,c]),Y((()=>{const e=o.current?l.get(o.current):null;null!=e&&r(e)}),[l]),u.useMemo((()=>({ref:f,index:null==n?-1:n})),[n,f])}function Q(e,t){return"function"==typeof e?e(t):e?u.cloneElement(e,t):u.createElement("div",t)}const J=u.createContext({activeIndex:0,onNavigate:()=>{}}),ee=[j,K],te=[N,F],ne=[...ee,...te],re=u.forwardRef((function(e,t){let{render:n,orientation:r="both",loop:o=!0,cols:i=1,disabledIndices:c,activeIndex:s,onNavigate:a,...f}=e;const[d,m]=u.useState(0),v=null!=s?s:d,p=l(null!=a?a:m),g=u.useRef([]),h=n&&"function"!=typeof n?n.props:{},y=u.useMemo((()=>({activeIndex:v,onNavigate:p})),[v,p]),b=i>1;const E={...f,...h,ref:t,"aria-orientation":"both"===r?void 0:r,onKeyDown(e){null==f.onKeyDown||f.onKeyDown(e),null==h.onKeyDown||h.onKeyDown(e),function(e){if(!ne.includes(e.key))return;const t=_(g,c),n=B(g,c);let u=v;b&&(u=U(g,{event:e,orientation:r,loop:o,cols:i,disabledIndices:c,minIndex:t,maxIndex:n,prevIndex:v}));const l={horizontal:[K],vertical:[F],both:[K,F]}[r],s={horizontal:[j],vertical:[N],both:[j,N]}[r],a=b?ne:{horizontal:ee,vertical:te,both:ne}[r];u===v&&[...l,...s].includes(e.key)&&(u=o&&u===n&&l.includes(e.key)?t:o&&u===t&&s.includes(e.key)?n:W(g,{startingIndex:u,decrement:s.includes(e.key),disabledIndices:c})),u===v||q(g,u)||(e.stopPropagation(),a.includes(e.key)&&e.preventDefault(),p(u),queueMicrotask((()=>{X(g.current[u])})))}(e)}};return u.createElement(J.Provider,{value:y},u.createElement(Z,{elementsRef:g},Q(n,E)))})),oe=u.forwardRef((function(e,t){let{render:n,...r}=e;const o=n&&"function"!=typeof n?n.props:{},{activeIndex:c,onNavigate:l}=u.useContext(J),{ref:s,index:a}=$(),f=i([s,t,o.ref]),d=c===a;return Q(n,{...r,...o,ref:f,tabIndex:d?0:-1,"data-active":d?"":void 0,onFocus(e){null==r.onFocus||r.onFocus(e),null==o.onFocus||o.onFocus(e),l(a)}})}));function ue(){return ue=Object.assign?Object.assign.bind():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},ue.apply(this,arguments)}let ie=!1,ce=0;const le=()=>"floating-ui-"+ce++;const se=u["useId".toString()]||function(){const[e,t]=u.useState((()=>ie?le():void 0));return Y((()=>{null==e&&t(le())}),[]),u.useEffect((()=>{ie||(ie=!0)}),[]),e},ae=u.forwardRef((function(e,t){let{context:{placement:r,elements:{floating:o},middlewareData:{arrow:i}},width:c=14,height:l=7,tipRadius:s=0,strokeWidth:a=0,staticOffset:f,stroke:d,d:m,style:{transform:v,...p}={},...g}=e;const h=se();if(!o)return null;a*=2;const y=a/2,b=c/2*(s/-8+1),E=l/2*s/4,[w,x]=r.split("-"),R=n.platform.isRTL(o),I=!!m,k="top"===w||"bottom"===w,O=f&&"end"===x?"bottom":"top";let C=f&&"end"===x?"right":"left";f&&R&&(C="end"===x?"left":"right");const M=null!=(null==i?void 0:i.x)?f||i.x:"",T=null!=(null==i?void 0:i.y)?f||i.y:"",S=m||"M0,0 H"+c+" L"+(c-b)+","+(l-E)+" Q"+c/2+","+l+" "+b+","+(l-E)+" Z",P={top:I?"rotate(180deg)":"",left:I?"rotate(90deg)":"rotate(-90deg)",bottom:I?"":"rotate(180deg)",right:I?"rotate(-90deg)":"rotate(90deg)"}[w];return u.createElement("svg",ue({},g,{"aria-hidden":!0,ref:t,width:I?c:c+a,height:c,viewBox:"0 0 "+c+" "+(l>c?l:c),style:{position:"absolute",pointerEvents:"none",[C]:M,[O]:T,[w]:k||I?"100%":"calc(100% - "+a/2+"px)",transform:""+P+(null!=v?v:""),...p}}),a>0&&u.createElement("path",{clipPath:"url(#"+h+")",fill:"none",stroke:d,strokeWidth:a+(m?0:1),d:S}),u.createElement("path",{stroke:a&&!m?g.fill:"none",d:S}),u.createElement("clipPath",{id:h},u.createElement("rect",{x:-y,y:y*(I?-1:1),width:c+a,height:c})))}));function fe(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}const de=u.createContext(null),me=u.createContext(null),ve=()=>{var e;return(null==(e=u.useContext(de))?void 0:e.id)||null},pe=()=>u.useContext(me);function ge(e){return"data-floating-ui-"+e}function he(e){const n=t.useRef(e);return Y((()=>{n.current=e})),n}const ye=ge("safe-polygon");function be(e,t,n){return n&&!O(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}const Ee=u.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{},isInstantPhase:!1}),we=()=>u.useContext(Ee); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@floating-ui/react-dom"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","@floating-ui/react-dom","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIReact={},e.React,e.FloatingUIReactDOM,e.ReactDOM)}(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);function i(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)}const c=u["useInsertionEffect".toString()]||(e=>e());function l(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 s(e){return f(e)?(e.nodeName||"").toLowerCase():"#document"}function a(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function f(e){return e instanceof Node||e instanceof a(e).Node}function d(e){return e instanceof Element||e instanceof a(e).Element}function v(e){return e instanceof HTMLElement||e instanceof a(e).HTMLElement}function m(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof a(e).ShadowRoot)}function p(e){return["html","body","#document"].includes(s(e))}function g(e){if("html"===s(e))return e;const t=e.assignedSlot||e.parentNode||m(e)&&e.host||function(e){var t;return null==(t=(f(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}(e);return m(t)?t.host:t}function h(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 y(e,t){if(!e||!t)return!1;const n=t.getRootNode&&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 b(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function E(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}function w(e){return!(0!==e.mozInputSource||!e.isTrusted)||(I()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}function x(e){return!I()&&0===e.width&&0===e.height||I()&&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 R(){return/apple/i.test(navigator.vendor)}function I(){const e=/android/i;return e.test(b())||e.test(E())}function k(){return b().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function O(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function C(e){return(null==e?void 0:e.ownerDocument)||document}function M(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 T(e){return"composedPath"in e?e.composedPath()[0]:e.target}const S="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function P(e){return v(e)&&e.matches(S)}function L(e){e.preventDefault(),e.stopPropagation()}function A(e){return!!e&&("combobox"===e.getAttribute("role")&&P(e))}const D=Math.floor,N="ArrowUp",F="ArrowDown",j="ArrowLeft",K="ArrowRight";function H(e,t,n){return Math.floor(e/t)!==n}function q(e,t){return t<0||t>=e.current.length}function _(e,t){return W(e,{disabledIndices:t})}function B(e,t){return W(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function W(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o,amount:u=1}=void 0===t?{}:t;const i=e.current,c=o?e=>o.includes(e):e=>{const t=i[e];return null==t||t.hasAttribute("disabled")||"true"===t.getAttribute("aria-disabled")};let l=n;do{l+=r?-u:u}while(l>=0&&l<=i.length-1&&c(l));return l}function U(e,t){let{event:n,orientation:r,loop:o,cols:u,disabledIndices:i,minIndex:c,maxIndex:l,prevIndex:s,stopEvent:a=!1}=t,f=s;if(n.key===N){if(a&&L(n),-1===s)f=l;else if(f=W(e,{startingIndex:f,amount:u,decrement:!0,disabledIndices:i}),o&&(s-u<c||f<0)){const e=s%u,t=l%u,n=l-(t-e);f=t===e?l:t>e?n:n-u}q(e,f)&&(f=s)}if(n.key===F&&(a&&L(n),-1===s?f=c:(f=W(e,{startingIndex:s,amount:u,disabledIndices:i}),o&&s+u>l&&(f=W(e,{startingIndex:s%u-u,amount:u,disabledIndices:i}))),q(e,f)&&(f=s)),"both"===r){const t=D(s/u);n.key===K&&(a&&L(n),s%u!=u-1?(f=W(e,{startingIndex:s,disabledIndices:i}),o&&H(f,u,t)&&(f=W(e,{startingIndex:s-s%u-1,disabledIndices:i}))):o&&(f=W(e,{startingIndex:s-s%u-1,disabledIndices:i})),H(f,u,t)&&(f=s)),n.key===j&&(a&&L(n),s%u!=0?(f=W(e,{startingIndex:s,disabledIndices:i,decrement:!0}),o&&H(f,u,t)&&(f=W(e,{startingIndex:s+(u-s%u),decrement:!0,disabledIndices:i}))):o&&(f=W(e,{startingIndex:s+(u-s%u),decrement:!0,disabledIndices:i})),H(f,u,t)&&(f=s));const r=D(l/u)===t;q(e,f)&&(f=o&&r?n.key===j?l:W(e,{startingIndex:s-s%u-1,disabledIndices:i}):s)}return f}function z(e,t,n){const r=[];let o=0;return e.forEach(((e,u)=>{let{width:i,height:c}=e,l=!1;for(n&&(o=0);!l;){const e=[];for(let n=0;n<i;n++)for(let r=0;r<c;r++)e.push(o+n+r*t);o%t+i<=t&&e.every((e=>void 0===r[e]))?(e.forEach((e=>r[e]=u)),l=!0):o++}})),[...r]}function X(e,t,n,r,o){if(-1===e)return-1;const u=n.indexOf(e);switch(o){case"tl":return u;case"tr":return u+t[e].width-1;case"bl":return u+(t[e].height-1)*r;case"br":return n.lastIndexOf(e)}}function Y(e,t){return t.flatMap(((t,n)=>e.includes(t)?[n]:[]))}let V=0;function G(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(V);const u=()=>null==e?void 0:e.focus({preventScroll:n});o?u():V=requestAnimationFrame(u)}var Z="undefined"!=typeof document?t.useLayoutEffect:t.useEffect;function $(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 Q=u.createContext({register:()=>{},unregister:()=>{},map:new Map,elementsRef:{current:[]}});function J(e){let{children:t,elementsRef:n,labelsRef:r}=e;const[o,i]=u.useState((()=>new Map)),c=u.useCallback((e=>{i((t=>new Map(t).set(e,null)))}),[]),l=u.useCallback((e=>{i((t=>{const n=new Map(t);return n.delete(e),n}))}),[]);return Z((()=>{const e=new Map(o);Array.from(e.keys()).sort($).forEach(((t,n)=>{e.set(t,n)})),function(e,t){if(e.size!==t.size)return!1;for(const[n,r]of e.entries())if(r!==t.get(n))return!1;return!0}(o,e)||i(e)}),[o]),u.createElement(Q.Provider,{value:u.useMemo((()=>({register:c,unregister:l,map:o,elementsRef:n,labelsRef:r})),[c,l,o,n,r])},t)}function ee(e){let{label:t}=void 0===e?{}:e;const[n,r]=u.useState(null),o=u.useRef(null),{register:i,unregister:c,map:l,elementsRef:s,labelsRef:a}=u.useContext(Q),f=u.useCallback((e=>{if(o.current=e,null!==n&&(s.current[n]=e,a)){var r;const o=void 0!==t;a.current[n]=o?t:null!=(r=null==e?void 0:e.textContent)?r:null}}),[n,s,a,t]);return Z((()=>{const e=o.current;if(e)return i(e),()=>{c(e)}}),[i,c]),Z((()=>{const e=o.current?l.get(o.current):null;null!=e&&r(e)}),[l]),u.useMemo((()=>({ref:f,index:null==n?-1:n})),[n,f])}function te(e,t){return"function"==typeof e?e(t):e?u.cloneElement(e,t):u.createElement("div",t)}const ne=u.createContext({activeIndex:0,onNavigate:()=>{}}),re=[j,K],oe=[N,F],ue=[...re,...oe],ie=u.forwardRef((function(e,t){let{render:n,orientation:r="both",loop:o=!0,cols:i=1,disabledIndices:c=[],activeIndex:s,onNavigate:a,itemSizes:f,dense:d=!1,...v}=e;const[m,p]=u.useState(0),g=null!=s?s:m,h=l(null!=a?a:p),y=u.useRef([]),b=n&&"function"!=typeof n?n.props:{},E=u.useMemo((()=>({activeIndex:g,onNavigate:h})),[g,h]),w=i>1;const x={...v,...b,ref:t,"aria-orientation":"both"===r?void 0:r,onKeyDown(e){null==v.onKeyDown||v.onKeyDown(e),null==b.onKeyDown||b.onKeyDown(e),function(e){if(!ue.includes(e.key))return;let t=g;if(w){const n=null!=f?f:Array.from(Array(y.current.length),(()=>({width:1,height:1}))),u=z(n,i,d),l=u.findIndex((e=>null!=e&&!c.includes(e))),s=u.reduce(((e,t,n)=>null==t||null!=c&&c.includes(t)?e:n),-1);t=u[U({current:u.map((e=>e?y.current[e]:null))},{event:e,orientation:r,loop:o,cols:i,disabledIndices:Y([...c,void 0],u),minIndex:l,maxIndex:s,prevIndex:X(g,n,u,i,e.key===F?"bl":e.key===K?"tr":"tl")})]}const n=_(y,c),u=B(y,c),l={horizontal:[K],vertical:[F],both:[K,F]}[r],s={horizontal:[j],vertical:[N],both:[j,N]}[r],a=w?ue:{horizontal:re,vertical:oe,both:ue}[r];t===g&&[...l,...s].includes(e.key)&&(t=o&&t===u&&l.includes(e.key)?n:o&&t===n&&s.includes(e.key)?u:W(y,{startingIndex:t,decrement:s.includes(e.key),disabledIndices:c})),t===g||q(y,t)||(e.stopPropagation(),a.includes(e.key)&&e.preventDefault(),h(t),queueMicrotask((()=>{G(y.current[t])})))}(e)}};return u.createElement(ne.Provider,{value:E},u.createElement(J,{elementsRef:y},te(n,x)))})),ce=u.forwardRef((function(e,t){let{render:n,...r}=e;const o=n&&"function"!=typeof n?n.props:{},{activeIndex:c,onNavigate:l}=u.useContext(ne),{ref:s,index:a}=ee(),f=i([s,t,o.ref]),d=c===a;return te(n,{...r,...o,ref:f,tabIndex:d?0:-1,"data-active":d?"":void 0,onFocus(e){null==r.onFocus||r.onFocus(e),null==o.onFocus||o.onFocus(e),l(a)}})}));function le(){return le=Object.assign?Object.assign.bind():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},le.apply(this,arguments)}let se=!1,ae=0;const fe=()=>"floating-ui-"+ae++;const de=u["useId".toString()]||function(){const[e,t]=u.useState((()=>se?fe():void 0));return Z((()=>{null==e&&t(fe())}),[]),u.useEffect((()=>{se||(se=!0)}),[]),e},ve=u.forwardRef((function(e,t){let{context:{placement:r,elements:{floating:o},middlewareData:{arrow:i}},width:c=14,height:l=7,tipRadius:s=0,strokeWidth:a=0,staticOffset:f,stroke:d,d:v,style:{transform:m,...p}={},...g}=e;const h=de();if(!o)return null;a*=2;const y=a/2,b=c/2*(s/-8+1),E=l/2*s/4,[w,x]=r.split("-"),R=n.platform.isRTL(o),I=!!v,k="top"===w||"bottom"===w,O=f&&"end"===x?"bottom":"top";let C=f&&"end"===x?"right":"left";f&&R&&(C="end"===x?"left":"right");const M=null!=(null==i?void 0:i.x)?f||i.x:"",T=null!=(null==i?void 0:i.y)?f||i.y:"",S=v||"M0,0 H"+c+" L"+(c-b)+","+(l-E)+" Q"+c/2+","+l+" "+b+","+(l-E)+" Z",P={top:I?"rotate(180deg)":"",left:I?"rotate(90deg)":"rotate(-90deg)",bottom:I?"":"rotate(180deg)",right:I?"rotate(-90deg)":"rotate(90deg)"}[w];return u.createElement("svg",le({},g,{"aria-hidden":!0,ref:t,width:I?c:c+a,height:c,viewBox:"0 0 "+c+" "+(l>c?l:c),style:{position:"absolute",pointerEvents:"none",[C]:M,[O]:T,[w]:k||I?"100%":"calc(100% - "+a/2+"px)",transform:""+P+(null!=m?m:""),...p}}),a>0&&u.createElement("path",{clipPath:"url(#"+h+")",fill:"none",stroke:d,strokeWidth:a+(v?0:1),d:S}),u.createElement("path",{stroke:a&&!v?g.fill:"none",d:S}),u.createElement("clipPath",{id:h},u.createElement("rect",{x:-y,y:y*(I?-1:1),width:c+a,height:c})))}));function me(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}const pe=u.createContext(null),ge=u.createContext(null),he=()=>{var e;return(null==(e=u.useContext(pe))?void 0:e.id)||null},ye=()=>u.useContext(ge);function be(e){return"data-floating-ui-"+e}function Ee(e){const n=t.useRef(e);return Z((()=>{n.current=e})),n}const we=be("safe-polygon");function xe(e,t,n){return n&&!O(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}const Re=u.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{},isInstantPhase:!1}),Ie=()=>u.useContext(Re); | ||
/*! | ||
* tabbable 6.0.1 | ||
* tabbable 6.2.0 | ||
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE | ||
*/ | ||
var xe=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"].join(","),Re="undefined"==typeof Element,Ie=Re?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ke=!Re&&Element.prototype.getRootNode?function(e){return e.getRootNode()}:function(e){return e.ownerDocument},Oe=function e(t,n,r){for(var o=[],u=Array.from(t);u.length;){var i=u.shift();if("SLOT"===i.tagName){var c=i.assignedElements(),l=e(c.length?c:i.children,!0,r);r.flatten?o.push.apply(o,l):o.push({scopeParent:i,candidates:l})}else{Ie.call(i,xe)&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var s=i.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(i),a=!r.shadowRootFilter||r.shadowRootFilter(i);if(s&&a){var f=e(!0===s?i.children:s.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:i,candidates:f})}else u.unshift.apply(u,i.children)}}return o},Ce=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},Me=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Te=function(e){return"INPUT"===e.tagName},Se=function(e){return function(e){return Te(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||ke(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)},Pe=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Le=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=Ie.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Ie.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Pe(e)}else{if("function"==typeof r){for(var u=e;e;){var i=e.parentElement,c=ke(e);if(i&&!i.shadowRoot&&!0===r(i))return Pe(e);e=e.assignedSlot?e.assignedSlot:i||c===e.ownerDocument?i:c.host}e=u}if(function(e){for(var t,n=ke(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=ke(n).host)||void 0===o||!o.ownerDocument.contains(n))}return r}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Ae=function(e,t){return!(t.disabled||function(e){return Te(e)&&"hidden"===e.type}(t)||Le(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!!Ie.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},De=function(e,t){return!(Se(t)||Ce(t)<0||!Ae(e,t))},Ne=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Fe=function e(t){var n=[],r=[];return t.forEach((function(t,o){var u=!!t.scopeParent,i=u?t.scopeParent:t,c=Ce(i,u),l=u?e(t.candidates):i;0===c?u?n.push.apply(n,l):n.push(i):r.push({documentOrder:o,tabIndex:c,item:t,isScope:u,content:l})})),r.sort(Me).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},je=function(e,t){var n;return n=(t=t||{}).getShadowRoot?Oe([e],t.includeContainer,{filter:De.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Ne}):function(e,t,n){var r=Array.prototype.slice.apply(e.querySelectorAll(xe));return t&&Ie.call(e,xe)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,De.bind(null,t)),Fe(n)};function Ke(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}let He=new WeakMap,qe=new WeakSet,_e={},Be=0;const We=e=>e&&(e.host||We(e.parentNode)),Ue=(e,t)=>t.map((t=>{if(e.contains(t))return t;const n=We(t);return e.contains(n)?n:null})).filter((e=>null!=e));function ze(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=C(e[0]).body;return function(e,t,n,r){const o="data-floating-ui-inert",u=r?"inert":n?"aria-hidden":null,i=Ue(t,e),c=new Set,l=new Set(i),s=[];_e[o]||(_e[o]=new WeakMap);const a=_e[o];return i.forEach((function e(t){t&&!c.has(t)&&(c.add(t),t.parentNode&&e(t.parentNode))})),function e(t){t&&!l.has(t)&&Array.prototype.forEach.call(t.children,(t=>{if(c.has(t))e(t);else{const e=u?t.getAttribute(u):null,n=null!==e&&"false"!==e,r=(He.get(t)||0)+1,i=(a.get(t)||0)+1;He.set(t,r),a.set(t,i),s.push(t),1===r&&n&&qe.add(t),1===i&&t.setAttribute(o,""),!n&&u&&t.setAttribute(u,"true")}}))}(t),c.clear(),Be++,()=>{s.forEach((e=>{const t=(He.get(e)||0)-1,n=(a.get(e)||0)-1;He.set(e,t),a.set(e,n),t||(!qe.has(e)&&u&&e.removeAttribute(u),qe.delete(e)),n||e.removeAttribute(o)})),Be--,Be||(He=new WeakMap,He=new WeakMap,qe=new WeakSet,_e={})}}(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const Xe=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Ye(e,t){const n=je(e,Xe());"prev"===t&&n.reverse();const r=n.indexOf(h(C(e)));return n.slice(r+1)[0]}function Ve(){return Ye(document.body,"next")}function Ge(){return Ye(document.body,"prev")}function Ze(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!y(n,r)}function $e(e){je(e,Xe()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function Qe(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 Je={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function et(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const tt=u.forwardRef((function(e,t){const[n,r]=u.useState();Y((()=>(R()&&r("button"),document.addEventListener("keydown",et),()=>{document.removeEventListener("keydown",et)})),[]);const o={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[ge("focus-guard")]:"",style:Je};return u.createElement("span",ue({},e,o))})),nt=u.createContext(null);function rt(e){let{id:t,root:n}=void 0===e?{}:e;const[r,o]=u.useState(null),i=se(),c=ot(),l=u.useMemo((()=>({id:t,root:n,portalContext:c,uniqueId:i})),[t,n,c,i]),s=u.useRef();return Y((()=>()=>{null==r||r.remove()}),[r,l]),Y((()=>{if(s.current===l)return;s.current=l;const{id:e,root:t,portalContext:n,uniqueId:r}=l,u=e?document.getElementById(e):null,i=ge("portal");if(u){const e=document.createElement("div");e.id=r,e.setAttribute(i,""),u.appendChild(e),o(e)}else{let u=t||(null==n?void 0:n.portalNode);u&&!d(u)&&(u=u.current),u=u||document.body;let c=null;e&&(c=document.createElement("div"),c.id=e,u.appendChild(c));const l=document.createElement("div");l.id=r,l.setAttribute(i,""),u=c||u,u.appendChild(l),o(l)}}),[l]),r}const ot=()=>u.useContext(nt),ut=20;let it=[];function ct(e){it=it.filter((e=>e.isConnected)),e&&"body"!==s(e)&&(it.push(e),it.length>ut&&(it=it.slice(-ut)))}function lt(){return it.slice().reverse().find((e=>e.isConnected))}const st=u.forwardRef((function(e,t){return u.createElement("button",ue({},e,{type:"button",ref:t,tabIndex:-1,style:Je}))}));const at=new Set,ft=u.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;const o=se();return Y((()=>{if(!n)return;at.add(o);const e=/iP(hone|ad|od)|iOS/.test(b()),t=document.body.style,r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",u=window.innerWidth-document.documentElement.clientWidth,i=t.left?parseFloat(t.left):window.pageXOffset,c=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",u&&(t[r]=u+"px"),e){var l,s;const e=(null==(l=window.visualViewport)?void 0:l.offsetLeft)||0,n=(null==(s=window.visualViewport)?void 0:s.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(c-Math.floor(n))+"px",left:-(i-Math.floor(e))+"px",right:"0"})}return()=>{at.delete(o),0===at.size&&(Object.assign(t,{overflow:"",[r]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(i,c)))}}),[o,n]),u.createElement("div",ue({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function dt(e){return m(e.target)&&"BUTTON"===e.target.tagName}function mt(e){return P(e)}function vt(e){return null!=e&&null!=e.clientX}const pt={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},gt={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},ht=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}};const yt="active",bt="selected";function Et(e,t,n){const r=new Map,o="item"===n;let u=e;if(o&&e){const{[yt]:t,[bt]:n,...r}=e;u=r}return{..."floating"===n&&{tabIndex:-1},...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&&[yt,bt].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),{})}}let wt=!1;function xt(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Rt(e,t){return xt(t,e===N||e===F,e===j||e===K)}function It(e,t,n){return xt(t,e===F,n?e===j:e===K)||"Enter"===e||" "==e||""===e}function kt(e,t,n){return xt(t,n?e===K:e===j,e===N)}const Ot=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);const Ct=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Mt(e,t){return"function"==typeof e?e(t):e}function Tt(e,t){void 0===t&&(t={});const{open:n,elements:{floating:r}}=e,{duration:o=250}=t,i=("number"==typeof o?o:o.close)||0,[c,l]=u.useState(!1),[s,a]=u.useState("unmounted"),f=function(e,t){const[n,r]=u.useState(e);return e&&!n&&r(!0),u.useEffect((()=>{if(!e){const e=setTimeout((()=>r(!1)),t);return()=>clearTimeout(e)}}),[e,t]),n}(n,i);return Y((()=>{c&&!f&&a("unmounted")}),[c,f]),Y((()=>{if(r){if(n){a("initial");const e=requestAnimationFrame((()=>{a("open")}));return()=>{cancelAnimationFrame(e)}}l(!0),a("close")}}),[n,r]),{isMounted:f,status:s}}function St(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}function Pt(e,t){const[n,r]=e;let o=!1;const u=t.length;for(let e=0,i=u-1;e<u;i=e++){const[u,c]=t[e]||[0,0],[l,s]=t[i]||[0,0];c>=r!=s>=r&&n<=(l-u)*(r-c)/(s-c)+u&&(o=!o)}return o}Object.defineProperty(e,"arrow",{enumerable:!0,get:function(){return n.arrow}}),Object.defineProperty(e,"autoPlacement",{enumerable:!0,get:function(){return n.autoPlacement}}),Object.defineProperty(e,"autoUpdate",{enumerable:!0,get:function(){return n.autoUpdate}}),Object.defineProperty(e,"computePosition",{enumerable:!0,get:function(){return n.computePosition}}),Object.defineProperty(e,"detectOverflow",{enumerable:!0,get:function(){return n.detectOverflow}}),Object.defineProperty(e,"flip",{enumerable:!0,get:function(){return n.flip}}),Object.defineProperty(e,"getOverflowAncestors",{enumerable:!0,get:function(){return n.getOverflowAncestors}}),Object.defineProperty(e,"hide",{enumerable:!0,get:function(){return n.hide}}),Object.defineProperty(e,"inline",{enumerable:!0,get:function(){return n.inline}}),Object.defineProperty(e,"limitShift",{enumerable:!0,get:function(){return n.limitShift}}),Object.defineProperty(e,"offset",{enumerable:!0,get:function(){return n.offset}}),Object.defineProperty(e,"platform",{enumerable:!0,get:function(){return n.platform}}),Object.defineProperty(e,"shift",{enumerable:!0,get:function(){return n.shift}}),Object.defineProperty(e,"size",{enumerable:!0,get:function(){return n.size}}),e.Composite=re,e.CompositeItem=oe,e.FloatingArrow=ae,e.FloatingDelayGroup=e=>{let{children:t,delay:n,timeoutMs:r=0}=e;const[o,i]=u.useReducer(((e,t)=>({...e,...t})),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),c=u.useRef(null),l=u.useCallback((e=>{i({currentId:e})}),[]);return Y((()=>{o.currentId?null===c.current?c.current=o.currentId:i({isInstantPhase:!0}):(i({isInstantPhase:!1}),c.current=null)}),[o.currentId]),u.createElement(Ee.Provider,{value:u.useMemo((()=>({...o,setState:i,setCurrentId:l})),[o,i,l])},t)},e.FloatingFocusManager=function(e){const{context:t,children:n,disabled:r=!1,order:o=["content"],guards:i=!0,initialFocus:c=0,returnFocus:l=!0,modal:s=!0,visuallyHiddenDismiss:a=!1,closeOnFocusOut:f=!0}=e,{open:d,refs:v,nodeId:p,onOpenChange:g,events:b,dataRef:E,elements:{domReference:R,floating:I}}=t,k="number"==typeof c&&c<0,O=A(R)&&k,M="undefined"==typeof HTMLElement||!("inert"in HTMLElement.prototype)||i,S=he(o),P=he(c),D=he(l),N=pe(),F=ot(),j=u.useRef(null),K=u.useRef(null),H=u.useRef(!1),q=u.useRef(!1),_=null!=F,B=u.useCallback((function(e){return void 0===e&&(e=I),e?je(e,Xe()):[]}),[I]),W=u.useCallback((e=>{const t=B(e);return S.current.map((e=>R&&"reference"===e?R:I&&"floating"===e?I:t)).filter(Boolean).flat()}),[R,I,S,B]);function U(e){return!r&&a&&s?u.createElement(st,{ref:"start"===e?j:K,onClick:e=>g(!1,e.nativeEvent)},"string"==typeof a?a:"Dismiss"):null}u.useEffect((()=>{if(r||!s)return;function e(e){if("Tab"===e.key){y(I,h(C(I)))&&0===B().length&&!O&&L(e);const t=W(),n=T(e);"reference"===S.current[0]&&n===R&&(L(e),e.shiftKey?X(t[t.length-1]):X(t[1])),"floating"===S.current[1]&&n===I&&e.shiftKey&&(L(e),X(t[0]))}}const t=C(I);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[r,R,I,s,S,v,O,B,W]),u.useEffect((()=>{if(!r&&f)return I&&m(R)?(R.addEventListener("focusout",t),R.addEventListener("pointerdown",e),!s&&I.addEventListener("focusout",t),()=>{R.removeEventListener("focusout",t),R.removeEventListener("pointerdown",e),!s&&I.removeEventListener("focusout",t)}):void 0;function e(){q.current=!0,setTimeout((()=>{q.current=!1}))}function t(e){const t=e.relatedTarget;queueMicrotask((()=>{const n=!(y(R,t)||y(I,t)||y(t,I)||y(null==F?void 0:F.portalNode,t)||null!=t&&t.hasAttribute(ge("focus-guard"))||N&&(Ke(N.nodesRef.current,p).find((e=>{var n,r;return y(null==(n=e.context)?void 0:n.elements.floating,t)||y(null==(r=e.context)?void 0:r.elements.domReference,t)}))||function(e,t){var n;let r=[],o=null==(n=e.find((e=>e.id===t)))?void 0:n.parentId;for(;o;){const t=e.find((e=>e.id===o));o=null==t?void 0:t.parentId,t&&(r=r.concat(t))}return r}(N.nodesRef.current,p).find((e=>{var n,r;return(null==(n=e.context)?void 0:n.elements.floating)===t||(null==(r=e.context)?void 0:r.elements.domReference)===t}))));t&&n&&!q.current&&t!==lt()&&(H.current=!0,g(!1,e))}))}}),[r,R,I,s,p,N,F,g,f]),u.useEffect((()=>{var e;if(r)return;const t=Array.from((null==F||null==(e=F.portalNode)?void 0:e.querySelectorAll("["+ge("portal")+"]"))||[]);if(I){const e=[I,...t,j.current,K.current,S.current.includes("reference")||O?R:null].filter((e=>null!=e)),n=s||O?ze(e,M,!M):ze(e);return()=>{n()}}}),[r,R,I,s,S,F,O,M]),Y((()=>{if(r||!I)return;const e=h(C(I));queueMicrotask((()=>{const t=W(I),n=P.current,r=("number"==typeof n?t[n]:n.current)||I,o=y(I,e);k||o||!d||X(r,{preventScroll:r===I})}))}),[r,d,I,k,W,P]),Y((()=>{if(r||!I)return;let e=!1;const t=C(I),n=h(t),o=E.current;function u(t){let{reason:n,event:r,nested:o}=t;"escape-key"===n&&v.domReference.current&&ct(v.domReference.current),"hover"===n&&"mouseleave"===r.type&&(H.current=!0),"outside-press"===n&&(o?(H.current=!1,e=!0):H.current=!(w(r)||x(r)))}return ct(n),b.on("openchange",u),()=>{b.off("openchange",u);const n=h(t),r=y(I,n)||N&&Ke(N.nodesRef.current,p).some((e=>{var t;return y(null==(t=e.context)?void 0:t.elements.floating,n)}));(r||o.openEvent&&["click","mousedown"].includes(o.openEvent.type))&&v.domReference.current&&ct(v.domReference.current);const i=lt();D.current&&!H.current&&m(i)&&(i===n||n===t.body||r)&&X(i,{cancelPrevious:!1,preventScroll:e})}}),[r,I,D,E,v,b,N,p]),Y((()=>{if(!r&&F)return F.setFocusManagerState({modal:s,closeOnFocusOut:f,open:d,onOpenChange:g,refs:v}),()=>{F.setFocusManagerState(null)}}),[r,F,s,d,g,v,f]),Y((()=>{if(r||!I||"function"!=typeof MutationObserver||k)return;const e=()=>{const e=I.getAttribute("tabindex");S.current.includes("floating")||h(C(I))!==v.domReference.current&&0===B().length?"0"!==e&&I.setAttribute("tabindex","0"):"-1"!==e&&I.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(I,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}}),[r,I,v,S,B,k]);const z=!r&&M&&(_||s);return u.createElement(u.Fragment,null,z&&u.createElement(tt,{"data-type":"inside",ref:null==F?void 0:F.beforeInsideRef,onFocus:e=>{if(s){const e=W();X("reference"===o[0]?e[0]:e[e.length-1])}else if(null!=F&&F.preserveTabOrder&&F.portalNode)if(H.current=!1,Ze(e,F.portalNode)){const e=Ve()||R;null==e||e.focus()}else{var t;null==(t=F.beforeOutsideRef.current)||t.focus()}}}),!O&&U("start"),n,U("end"),z&&u.createElement(tt,{"data-type":"inside",ref:null==F?void 0:F.afterInsideRef,onFocus:e=>{if(s)X(W()[0]);else if(null!=F&&F.preserveTabOrder&&F.portalNode)if(f&&(H.current=!0),Ze(e,F.portalNode)){const e=Ge()||R;null==e||e.focus()}else{var t;null==(t=F.afterOutsideRef.current)||t.focus()}}}))},e.FloatingList=Z,e.FloatingNode=function(e){let{children:t,id:n}=e;const r=ve();return u.createElement(de.Provider,{value:u.useMemo((()=>({id:n,parentId:r})),[n,r])},t)},e.FloatingOverlay=ft,e.FloatingPortal=function(e){let{children:t,id:n,root:o=null,preserveTabOrder:i=!0}=e;const c=rt({id:n,root:o}),[l,s]=u.useState(null),a=u.useRef(null),f=u.useRef(null),d=u.useRef(null),m=u.useRef(null),v=!!l&&!l.modal&&l.open&&i&&!(!o&&!c);return u.useEffect((()=>{if(c&&i&&(null==l||!l.modal))return c.addEventListener("focusin",e,!0),c.addEventListener("focusout",e,!0),()=>{c.removeEventListener("focusin",e,!0),c.removeEventListener("focusout",e,!0)};function e(e){if(c&&Ze(e)){("focusin"===e.type?Qe:$e)(c)}}}),[c,i,null==l?void 0:l.modal]),u.createElement(nt.Provider,{value:u.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:a,afterOutsideRef:f,beforeInsideRef:d,afterInsideRef:m,portalNode:c,setFocusManagerState:s})),[i,c])},v&&c&&u.createElement(tt,{"data-type":"outside",ref:a,onFocus:e=>{if(Ze(e,c)){var t;null==(t=d.current)||t.focus()}else{const e=Ge()||(null==l?void 0:l.refs.domReference.current);null==e||e.focus()}}}),v&&c&&u.createElement("span",{"aria-owns":c.id,style:Je}),c&&r.createPortal(t,c),v&&c&&u.createElement(tt,{"data-type":"outside",ref:f,onFocus:e=>{if(Ze(e,c)){var t;null==(t=m.current)||t.focus()}else{const t=Ve()||(null==l?void 0:l.refs.domReference.current);null==t||t.focus(),(null==l?void 0:l.closeOnFocusOut)&&(null==l||l.onOpenChange(!1,e.nativeEvent))}}}))},e.FloatingTree=function(e){let{children:t}=e;const n=u.useRef([]),r=u.useCallback((e=>{n.current=[...n.current,e]}),[]),o=u.useCallback((e=>{n.current=n.current.filter((t=>t!==e))}),[]),i=u.useState((()=>fe()))[0];return u.createElement(me.Provider,{value:u.useMemo((()=>({nodesRef:n,addNode:r,removeNode:o,events:i})),[n,r,o,i])},t)},e.inner=e=>({name:"inner",options:e,async fn(t){const{listRef:o,overflowRef:u,onFallbackChange:i,offset:c=0,index:l=0,minItemsVisible:s=4,referenceOverflowThreshold:a=0,scrollRef:f,...d}=e,{rects:m,elements:{floating:v}}=t,p=o.current[l];if(!p)return{};const g={...t,...await n.offset(-p.offsetTop-v.clientTop-m.reference.height/2-p.offsetHeight/2-c).fn(t)},h=(null==f?void 0:f.current)||v,y=await n.detectOverflow(St(g,h.scrollHeight),d),b=await n.detectOverflow(g,{...d,elementContext:"reference"}),E=Math.max(0,y.top),w=g.y+E,x=Math.max(0,h.scrollHeight-E-Math.max(0,y.bottom));return h.style.maxHeight=x+"px",h.scrollTop=E,i&&(h.offsetHeight<p.offsetHeight*Math.min(s,o.current.length-1)-1||b.top>=-a||b.bottom>=-a?r.flushSync((()=>i(!0))):r.flushSync((()=>i(!1)))),u&&(u.current=await n.detectOverflow(St({...g,y:w},h.offsetHeight),d)),{y:w}}}),e.safePolygon=function(e){void 0===e&&(e={});const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e;let o,u=!1,i=null,c=null,l=performance.now();const s=e=>{let{x:n,y:s,placement:a,elements:f,onClose:m,nodeId:v,tree:p}=e;return function(e){function g(){clearTimeout(o),m()}if(clearTimeout(o),!f.domReference||!f.floating||null==a||null==n||null==s)return;const{clientX:h,clientY:b}=e,E=[h,b],w=T(e),x="mouseleave"===e.type,R=y(f.floating,w),I=y(f.domReference,w),k=f.domReference.getBoundingClientRect(),O=f.floating.getBoundingClientRect(),C=a.split("-")[0],M=n>O.right-O.width/2,S=s>O.bottom-O.height/2,P=function(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}(E,k),L=O.width>k.width,A=O.height>k.height,D=(L?k:O).left,N=(L?k:O).right,F=(A?k:O).top,j=(A?k:O).bottom;if(R&&(u=!0,!x))return;if(I&&(u=!1),I&&!x)return void(u=!0);if(x&&d(e.relatedTarget)&&y(f.floating,e.relatedTarget))return;if(p&&Ke(p.nodesRef.current,v).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if("top"===C&&s>=k.bottom-1||"bottom"===C&&s<=k.top+1||"left"===C&&n>=k.right-1||"right"===C&&n<=k.left+1)return g();let K=[];switch(C){case"top":K=[[D,k.top+1],[D,O.bottom-1],[N,O.bottom-1],[N,k.top+1]];break;case"bottom":K=[[D,O.top+1],[D,k.bottom-1],[N,k.bottom-1],[N,O.top+1]];break;case"left":K=[[O.right-1,j],[O.right-1,F],[k.left+1,F],[k.left+1,j]];break;case"right":K=[[k.right-1,j],[k.right-1,F],[O.left+1,F],[O.left+1,j]]}if(!Pt([h,b],K)){if(u&&!P)return g();if(!x&&r){const t=function(e,t){const n=performance.now(),r=n-l;if(null===i||null===c||0===r)return i=e,c=t,l=n,null;const o=e-i,u=t-c,s=Math.sqrt(o*o+u*u);return i=e,c=t,l=n,s/r}(e.clientX,e.clientY);if(null!==t&&t<.1)return g()}Pt([h,b],function(e){let[n,r]=e;switch(C){case"top":return[[L?n+t/2:M?n+4*t:n-4*t,r+t+1],[L?n-t/2:M?n+4*t:n-4*t,r+t+1],...[[O.left,M||L?O.bottom-t:O.top],[O.right,M?L?O.bottom-t:O.top:O.bottom-t]]];case"bottom":return[[L?n+t/2:M?n+4*t:n-4*t,r-t],[L?n-t/2:M?n+4*t:n-4*t,r-t],...[[O.left,M||L?O.top+t:O.bottom],[O.right,M?L?O.top+t:O.bottom:O.top+t]]];case"left":{const e=[n+t+1,A?r+t/2:S?r+4*t:r-4*t],o=[n+t+1,A?r-t/2:S?r+4*t:r-4*t];return[...[[S||A?O.right-t:O.left,O.top],[S?A?O.right-t:O.left:O.right-t,O.bottom]],e,o]}case"right":return[[n-t,A?r+t/2:S?r+4*t:r-4*t],[n-t,A?r-t/2:S?r+4*t:r-4*t],...[[S||A?O.left+t:O.right,O.top],[S?A?O.left+t:O.right:O.left+t,O.bottom]]]}}([n,s]))?!u&&r&&(o=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:c=!0,event:l="click",toggle:s=!0,ignoreMouse:a=!1,keyboardHandlers:f=!0}=t,d=u.useRef(),m=u.useRef(!1);return u.useMemo((()=>c?{reference:{onPointerDown(e){d.current=e.pointerType},onMouseDown(e){0===e.button&&(O(d.current,!0)&&a||"click"!==l&&(!n||!s||o.current.openEvent&&"mousedown"!==o.current.openEvent.type?(e.preventDefault(),r(!0,e.nativeEvent,"click")):r(!1,e.nativeEvent,"click")))},onClick(e){"mousedown"===l&&d.current?d.current=void 0:O(d.current,!0)&&a||(!n||!s||o.current.openEvent&&"click"!==o.current.openEvent.type?r(!0,e.nativeEvent,"click"):r(!1,e.nativeEvent,"click"))},onKeyDown(e){d.current=void 0,e.defaultPrevented||!f||dt(e)||(" "!==e.key||mt(i)||(e.preventDefault(),m.current=!0),"Enter"===e.key&&r(!n||!s,e.nativeEvent,"click"))},onKeyUp(e){e.defaultPrevented||!f||dt(e)||mt(i)||" "===e.key&&m.current&&(m.current=!1,r(!n||!s,e.nativeEvent,"click"))}}}:{}),[c,o,l,a,f,i,s,n,r])},e.useClientPoint=function(e,t){void 0===t&&(t={});const{open:n,refs:r,dataRef:o,elements:{floating:i}}=e,{enabled:c=!0,axis:s="both",x:f=null,y:d=null}=t,m=u.useRef(!1),v=u.useRef(null),[p,g]=u.useState(),[h,b]=u.useState([]),E=l(((e,t)=>{m.current||o.current.openEvent&&!vt(o.current.openEvent)||r.setPositionReference(function(e,t){let n=null,r=null,o=!1;return{contextElement:e.current||void 0,getBoundingClientRect(){var u,i;const c=(null==(u=e.current)?void 0:u.getBoundingClientRect())||{width:0,height:0,x:0,y:0},l="x"===t.axis||"both"===t.axis,s="y"===t.axis||"both"===t.axis,a=["mouseenter","mousemove"].includes((null==(i=t.dataRef.current.openEvent)?void 0:i.type)||"")&&"touch"!==t.pointerType;let f=c.width,d=c.height,m=c.x,v=c.y;return null==n&&t.x&&l&&(n=c.x-t.x),null==r&&t.y&&s&&(r=c.y-t.y),m-=n||0,v-=r||0,f=0,d=0,!o||a?(f="y"===t.axis?c.width:0,d="x"===t.axis?c.height:0,m=l&&null!=t.x?t.x:m,v=s&&null!=t.y?t.y:v):o&&!a&&(d="x"===t.axis?c.height:d,f="y"===t.axis?c.width:f),o=!0,{width:f,height:d,x:m,y:v,top:v,right:m+f,bottom:v+d,left:m}}}}(r.domReference,{x:e,y:t,axis:s,dataRef:o,pointerType:p}))})),w=l((e=>{null==f&&null==d&&(n?v.current||b([]):E(e.clientX,e.clientY))})),x=O(p)?i:n,R=u.useCallback((()=>{if(!x||!c||null!=f||null!=d)return;const e=a(r.floating.current);function t(n){const o=T(n);y(r.floating.current,o)?(e.removeEventListener("mousemove",t),v.current=null):E(n.clientX,n.clientY)}if(!o.current.openEvent||vt(o.current.openEvent)){e.addEventListener("mousemove",t);const n=()=>{e.removeEventListener("mousemove",t),v.current=null};return v.current=n,n}r.setPositionReference(r.domReference.current)}),[o,c,x,r,E,f,d]);return u.useEffect((()=>R()),[R,h]),u.useEffect((()=>{c&&!i&&(m.current=!1)}),[c,i]),u.useEffect((()=>{!c&&n&&(m.current=!0)}),[c,n]),Y((()=>{!c||null==f&&null==d||(m.current=!1,E(f,d))}),[c,f,d,E]),u.useMemo((()=>{if(!c)return{};function e(e){let{pointerType:t}=e;g(t)}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove:w,onMouseEnter:w}}}),[c,w])},e.useDelayGroup=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:o}=t;const{currentId:u,setCurrentId:i,initialDelay:c,setState:l,timeoutMs:s}=we();Y((()=>{u&&(l({delay:{open:1,close:be(c,"close")}}),u!==o&&r(!1))}),[o,r,l,u,c]),Y((()=>{function e(){r(!1),l({delay:c,currentId:null})}if(!n&&u===o){if(s){const t=window.setTimeout(e,s);return()=>{clearTimeout(t)}}e()}}),[n,l,u,o,r,c,s]),Y((()=>{n&&i(o)}),[n,i,o])},e.useDelayGroupContext=we,e.useDismiss=function(e,t){void 0===t&&(t={});const{open:r,onOpenChange:o,nodeId:i,elements:{reference:c,domReference:s,floating:f},dataRef:v}=e,{enabled:h=!0,escapeKey:b=!0,outsidePress:E=!0,outsidePressEvent:w="pointerdown",referencePress:x=!1,referencePressEvent:R="pointerdown",ancestorScroll:I=!1,bubbles:k,capture:O}=t,S=pe(),P=l("function"==typeof E?E:()=>!1),L="function"==typeof E?P:E,A=u.useRef(!1),D=u.useRef(!1),{escapeKey:N,outsidePress:F}=ht(k),{escapeKey:j,outsidePress:K}=ht(O),H=l((e=>{if(!r||!h||!b||"Escape"!==e.key)return;const t=S?Ke(S.nodesRef.current,i):[];if(!N&&(e.stopPropagation(),t.length>0)){let e=!0;if(t.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)})),!e)return}o(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")})),q=l((e=>{var t;const n=()=>{var t;H(e),null==(t=T(e))||t.removeEventListener("keydown",n)};null==(t=T(e))||t.addEventListener("keydown",n)})),_=l((e=>{const t=A.current;A.current=!1;const n=D.current;if(D.current=!1,"click"===w&&n)return;if(t)return;if("function"==typeof L&&!L(e))return;const r=T(e),u="["+ge("inert")+"]",c=C(f).querySelectorAll(u);let l=d(r)?r:null;for(;l&&!p(l);){const e=g(l);if(p(e)||!d(e))break;l=e}if(c.length&&d(r)&&!r.matches("html,body")&&!y(r,f)&&Array.from(c).every((e=>!y(l,e))))return;if(m(r)&&f){const t=r.clientWidth>0&&r.scrollWidth>r.clientWidth,n=r.clientHeight>0&&r.scrollHeight>r.clientHeight;let o=n&&e.offsetX>r.clientWidth;if(n){const t="rtl"===function(e){return a(e).getComputedStyle(e)}(r).direction;t&&(o=e.offsetX<=r.offsetWidth-r.clientWidth)}if(o||t&&e.offsetY>r.clientHeight)return}const v=S&&Ke(S.nodesRef.current,i).some((t=>{var n;return M(e,null==(n=t.context)?void 0:n.elements.floating)}));if(M(e,f)||M(e,s)||v)return;const h=S?Ke(S.nodesRef.current,i):[];if(h.length>0){let e=!0;if(h.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}o(!1,e,"outside-press")})),B=l((e=>{var t;const n=()=>{var t;_(e),null==(t=T(e))||t.removeEventListener(w,n)};null==(t=T(e))||t.addEventListener(w,n)}));return u.useEffect((()=>{if(!r||!h)return;function e(e){o(!1,e,"ancestor-scroll")}v.current.__escapeKeyBubbles=N,v.current.__outsidePressBubbles=F;const t=C(f);b&&t.addEventListener("keydown",j?q:H,j),L&&t.addEventListener(w,K?B:_,K);let u=[];return I&&(d(s)&&(u=n.getOverflowAncestors(s)),d(f)&&(u=u.concat(n.getOverflowAncestors(f))),!d(c)&&c&&c.contextElement&&(u=u.concat(n.getOverflowAncestors(c.contextElement)))),u=u.filter((e=>{var n;return e!==(null==(n=t.defaultView)?void 0:n.visualViewport)})),u.forEach((t=>{t.addEventListener("scroll",e,{passive:!0})})),()=>{b&&t.removeEventListener("keydown",j?q:H,j),L&&t.removeEventListener(w,K?B:_,K),u.forEach((t=>{t.removeEventListener("scroll",e)}))}}),[v,f,s,c,b,L,w,r,o,I,h,N,F,H,j,q,_,K,B]),u.useEffect((()=>{A.current=!1}),[L,w]),u.useMemo((()=>h?{reference:{onKeyDown:H,[pt[R]]:e=>{x&&o(!1,e.nativeEvent,"reference-press")}},floating:{onKeyDown:H,onMouseDown(){D.current=!0},onMouseUp(){D.current=!0},[gt[w]]:()=>{A.current=!0}}}:{}),[h,x,w,R,o,H])},e.useFloating=function(e){var t;void 0===e&&(e={});const{open:r=!1,onOpenChange:o,nodeId:i}=e,[c,s]=u.useState(null),a=(null==(t=e.elements)?void 0:t.reference)||c,f=n.useFloating(e),m=pe(),v=null!=ve(),p=l(((e,t,n)=>{e&&(h.current.openEvent=t),y.emit("openchange",{open:e,event:t,reason:n,nested:v}),null==o||o(e,t,n)})),g=u.useRef(null),h=u.useRef({}),y=u.useState((()=>fe()))[0],b=se(),E=u.useCallback((e=>{const t=d(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;f.refs.setReference(t)}),[f.refs]),w=u.useCallback((e=>{(d(e)||null===e)&&(g.current=e,s(e)),(d(f.refs.reference.current)||null===f.refs.reference.current||null!==e&&!d(e))&&f.refs.setReference(e)}),[f.refs]),x=u.useMemo((()=>({...f.refs,setReference:w,setPositionReference:E,domReference:g})),[f.refs,w,E]),R=u.useMemo((()=>({...f.elements,domReference:a})),[f.elements,a]),I=u.useMemo((()=>({...f,refs:x,elements:R,dataRef:h,nodeId:i,floatingId:b,events:y,open:r,onOpenChange:p})),[f,i,b,y,r,p,x,R]);return Y((()=>{const e=null==m?void 0:m.nodesRef.current.find((e=>e.id===i));e&&(e.context=I)})),u.useMemo((()=>({...f,context:I,refs:x,elements:R})),[f,x,R,I])},e.useFloatingNodeId=function(e){const t=se(),n=pe(),r=ve(),o=e||r;return Y((()=>{const e={id:t,parentId:o};return null==n||n.addNode(e),()=>{null==n||n.removeNode(e)}}),[n,t,o]),t},e.useFloatingParentNodeId=ve,e.useFloatingPortalNode=rt,e.useFloatingTree=pe,e.useFocus=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,events:o,refs:i,elements:{floating:c,domReference:l}}=e,{enabled:s=!0,visibleOnly:f=!0}=t,v=u.useRef(!1),p=u.useRef(),g=u.useRef(!0);return u.useEffect((()=>{if(!s)return;const e=a(l);function t(){!n&&m(l)&&l===h(C(l))&&(v.current=!0)}function r(){g.current=!0}return e.addEventListener("blur",t),e.addEventListener("keydown",r,!0),()=>{e.removeEventListener("blur",t),e.removeEventListener("keydown",r,!0)}}),[c,l,n,s]),u.useEffect((()=>{if(s)return o.on("openchange",e),()=>{o.off("openchange",e)};function e(e){let{reason:t}=e;"reference-press"!==t&&"escape-key"!==t||(v.current=!0)}}),[o,s]),u.useEffect((()=>()=>{clearTimeout(p.current)}),[]),u.useMemo((()=>s?{reference:{onPointerDown(e){x(e.nativeEvent)||(g.current=!1)},onMouseLeave(){v.current=!1},onFocus(e){if(v.current)return;const t=T(e.nativeEvent);if(f&&d(t))try{if(R()&&k())throw Error();if(!t.matches(":focus-visible"))return}catch(e){if(!g.current&&!P(t))return}r(!0,e.nativeEvent,"focus")},onBlur(e){v.current=!1;const t=e.relatedTarget,n=d(t)&&t.hasAttribute(ge("focus-guard"))&&"outside"===t.getAttribute("data-type");p.current=window.setTimeout((()=>{const o=h(l?l.ownerDocument:document);(t||o!==l)&&(y(i.floating.current,t)||y(l,t)||n||r(!1,e.nativeEvent,"focus"))}))}}}:{}),[s,f,l,i,r])},e.useHover=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:{domReference:c,floating:l},refs:s}=e,{enabled:a=!0,delay:f=0,handleClose:m=null,mouseOnly:v=!1,restMs:p=0,move:g=!0}=t,h=pe(),b=ve(),E=he(m),w=he(f),x=u.useRef(),R=u.useRef(),I=u.useRef(),k=u.useRef(),M=u.useRef(!0),T=u.useRef(!1),S=u.useRef((()=>{})),P=u.useCallback((()=>{var e;const t=null==(e=o.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[o]);u.useEffect((()=>{if(a)return i.on("openchange",e),()=>{i.off("openchange",e)};function e(e){let{open:t}=e;t||(clearTimeout(R.current),clearTimeout(k.current),M.current=!0)}}),[a,i]),u.useEffect((()=>{if(!a||!E.current||!n)return;function e(e){P()&&r(!1,e,"hover")}const t=C(l).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[l,n,r,a,E,o,P]);const L=u.useCallback((function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");const o=be(w.current,"close",x.current);o&&!I.current?(clearTimeout(R.current),R.current=setTimeout((()=>r(!1,e,n)),o)):t&&(clearTimeout(R.current),r(!1,e,n))}),[w,r]),A=u.useCallback((()=>{S.current(),I.current=void 0}),[]),D=u.useCallback((()=>{if(T.current){const e=C(s.floating.current).body;e.style.pointerEvents="",e.removeAttribute(ye),T.current=!1}}),[s]);return u.useEffect((()=>{if(a&&d(c)){const e=c;return n&&e.addEventListener("mouseleave",s),null==l||l.addEventListener("mouseleave",s),g&&e.addEventListener("mousemove",u,{once:!0}),e.addEventListener("mouseenter",u),e.addEventListener("mouseleave",i),()=>{n&&e.removeEventListener("mouseleave",s),null==l||l.removeEventListener("mouseleave",s),g&&e.removeEventListener("mousemove",u),e.removeEventListener("mouseenter",u),e.removeEventListener("mouseleave",i)}}function t(){return!!o.current.openEvent&&["click","mousedown"].includes(o.current.openEvent.type)}function u(e){if(clearTimeout(R.current),M.current=!1,v&&!O(x.current)||p>0&&0===be(w.current,"open"))return;const t=be(w.current,"open",x.current);t?R.current=setTimeout((()=>{r(!0,e,"hover")}),t):r(!0,e,"hover")}function i(r){if(t())return;S.current();const o=C(l);if(clearTimeout(k.current),E.current){n||clearTimeout(R.current),I.current=E.current({...e,tree:h,x:r.clientX,y:r.clientY,onClose(){D(),A(),L(r,!0,"safe-polygon")}});const t=I.current;return o.addEventListener("mousemove",t),void(S.current=()=>{o.removeEventListener("mousemove",t)})}("touch"!==x.current||!y(l,r.relatedTarget))&&L(r)}function s(n){t()||null==E.current||E.current({...e,tree:h,x:n.clientX,y:n.clientY,onClose(){D(),A(),L(n)}})(n)}}),[c,l,a,e,v,p,g,L,A,D,r,n,h,w,E,o]),Y((()=>{var e;if(a&&n&&null!=(e=E.current)&&e.__options.blockPointerEvents&&P()){const e=C(l).body;if(e.setAttribute(ye,""),e.style.pointerEvents="none",T.current=!0,d(c)&&l){var t;const e=c,n=null==h||null==(t=h.nodesRef.current.find((e=>e.id===b)))||null==(t=t.context)?void 0:t.elements.floating;return n&&(n.style.pointerEvents=""),e.style.pointerEvents="auto",l.style.pointerEvents="auto",()=>{e.style.pointerEvents="",l.style.pointerEvents=""}}}}),[a,n,b,l,c,h,E,o,P]),Y((()=>{n||(x.current=void 0,A(),D())}),[n,A,D]),u.useEffect((()=>()=>{A(),clearTimeout(R.current),clearTimeout(k.current),D()}),[a,c,A,D]),u.useMemo((()=>{if(!a)return{};function e(e){x.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(e){n||0===p||(clearTimeout(k.current),k.current=setTimeout((()=>{M.current||r(!0,e.nativeEvent,"hover")}),p))}},floating:{onMouseEnter(){clearTimeout(R.current)},onMouseLeave(e){L(e.nativeEvent,!1)}}}}),[a,p,n,r,L])},e.useId=se,e.useInnerOffset=function(e,t){const{open:n,elements:o}=e,{enabled:i=!0,overflowRef:c,scrollRef:s,onChange:a}=t,f=l(a),d=u.useRef(!1),m=u.useRef(null),v=u.useRef(null);return u.useEffect((()=>{if(!i)return;function e(e){if(e.ctrlKey||!t||null==c.current)return;const n=e.deltaY,o=c.current.top>=-.5,u=c.current.bottom>=-.5,i=t.scrollHeight-t.clientHeight,l=n<0?-1:1,s=n<0?"max":"min";t.scrollHeight<=t.clientHeight||(!o&&n>0||!u&&n<0?(e.preventDefault(),r.flushSync((()=>{f((e=>e+Math[s](n,i*l)))}))):/firefox/i.test(E())&&(t.scrollTop+=n))}const t=(null==s?void 0:s.current)||o.floating;return n&&t?(t.addEventListener("wheel",e),requestAnimationFrame((()=>{m.current=t.scrollTop,null!=c.current&&(v.current={...c.current})})),()=>{m.current=null,v.current=null,t.removeEventListener("wheel",e)}):void 0}),[i,n,o.floating,c,s,f]),u.useMemo((()=>i?{floating:{onKeyDown(){d.current=!0},onWheel(){d.current=!1},onPointerMove(){d.current=!1},onScroll(){const e=(null==s?void 0:s.current)||o.floating;if(c.current&&e&&d.current){if(null!==m.current){const t=e.scrollTop-m.current;(c.current.bottom<-.5&&t<-1||c.current.top<-.5&&t>1)&&r.flushSync((()=>f((e=>e+t))))}requestAnimationFrame((()=>{m.current=e.scrollTop}))}}}}:{}),[i,c,o.floating,s,f])},e.useInteractions=function(e){void 0===e&&(e=[]);const t=e,n=u.useCallback((t=>Et(t,e,"reference")),t),r=u.useCallback((t=>Et(t,e,"floating")),t),o=u.useCallback((t=>Et(t,e,"item")),e.map((e=>null==e?void 0:e.item)));return u.useMemo((()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:o})),[n,r,o])},e.useListItem=$,e.useListNavigation=function(e,t){const{open:n,onOpenChange:r,refs:o,elements:{domReference:i,floating:c}}=e,{listRef:s,activeIndex:a,onNavigate:f=(()=>{}),enabled:d=!0,selectedIndex:v=null,allowEscape:p=!1,loop:g=!1,nested:b=!1,rtl:E=!1,virtual:I=!1,focusItemOnOpen:O="auto",focusItemOnHover:M=!0,openOnArrowKeyDown:T=!0,disabledIndices:S,orientation:P="vertical",cols:D=1,scrollItemIntoView:N=!0,virtualItemRef:H}=t,z=ve(),V=pe(),G=l(f),Z=u.useRef(O),$=u.useRef(null!=v?v:-1),Q=u.useRef(null),J=u.useRef(!0),ee=u.useRef(G),te=u.useRef(!!c),ne=u.useRef(!1),re=u.useRef(!1),oe=he(S),ue=he(n),ie=he(N),[ce,le]=u.useState(),[se,ae]=u.useState(),fe=l((function(e,t,n){void 0===n&&(n=!1);const r=e.current[t.current];r&&(I?(le(r.id),null==V||V.events.emit("virtualfocus",r),H&&(H.current=r)):X(r,{preventScroll:!0,sync:!(!k()||!R())&&(wt||ne.current)}),requestAnimationFrame((()=>{const e=ie.current;e&&r&&(n||!J.current)&&(null==r.scrollIntoView||r.scrollIntoView("boolean"==typeof e?{block:"nearest",inline:"nearest"}:e))})))}));Y((()=>{document.createElement("div").focus({get preventScroll(){return wt=!0,!1}})}),[]),Y((()=>{d&&(n&&c?Z.current&&null!=v&&(re.current=!0,G(v)):te.current&&($.current=-1,ee.current(null)))}),[d,n,c,v,G]),Y((()=>{if(d&&n&&c)if(null==a){if(ne.current=!1,null!=v)return;if(te.current&&($.current=-1,fe(s,$)),!te.current&&Z.current&&(null!=Q.current||!0===Z.current&&null==Q.current)){let e=0;const t=()=>{if(null==s.current[0]){if(e<2){(e?requestAnimationFrame:queueMicrotask)(t)}e++}else $.current=null==Q.current||It(Q.current,P,E)||b?_(s,oe.current):B(s,oe.current),Q.current=null,G($.current)};t()}}else q(s,a)||($.current=a,fe(s,$,re.current),re.current=!1)}),[d,n,c,a,v,b,s,P,E,G,fe,oe]),Y((()=>{var e;if(!d||c||!V||I||!te.current)return;const t=V.nodesRef.current,n=null==(e=t.find((e=>e.id===z)))||null==(e=e.context)?void 0:e.elements.floating,r=h(C(c)),o=t.some((e=>e.context&&y(e.context.elements.floating,r)));n&&!o&&J.current&&n.focus({preventScroll:!0})}),[d,c,V,z,I]),Y((()=>{if(d&&V&&I&&!z)return V.events.on("virtualfocus",e),()=>{V.events.off("virtualfocus",e)};function e(e){ae(e.id),H&&(H.current=e)}}),[d,V,I,z,H]),Y((()=>{ee.current=G,te.current=!!c})),Y((()=>{n||(Q.current=null)}),[n]);const de=null!=a,me=u.useMemo((()=>{function e(e){if(!n)return;const t=s.current.indexOf(e);-1!==t&&G(t)}return{onFocus(t){let{currentTarget:n}=t;e(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...M&&{onMouseMove(t){let{currentTarget:n}=t;e(n)},onPointerLeave(e){let{pointerType:t}=e;J.current&&"touch"!==t&&($.current=-1,fe(s,$),G(null),I||X(o.floating.current,{preventScroll:!0}))}}}}),[n,o,fe,M,s,G,I]);return u.useMemo((()=>{if(!d)return{};const e=oe.current;function t(t){if(J.current=!1,ne.current=!0,!ue.current&&t.currentTarget===o.floating.current)return;if(b&&kt(t.key,P,E))return L(t),r(!1,t.nativeEvent,"list-navigation"),void(m(i)&&!I&&i.focus());const u=$.current,c=_(s,e),l=B(s,e);if("Home"===t.key&&(L(t),$.current=c,G($.current)),"End"===t.key&&(L(t),$.current=l,G($.current)),!(D>1&&($.current=U(s,{event:t,orientation:P,loop:g,cols:D,disabledIndices:e,minIndex:c,maxIndex:l,prevIndex:$.current,stopEvent:!0}),G($.current),"both"===P))&&Rt(t.key,P)){if(L(t),n&&!I&&h(t.currentTarget.ownerDocument)===t.currentTarget)return $.current=It(t.key,P,E)?c:l,void G($.current);It(t.key,P,E)?$.current=g?u>=l?p&&u!==s.current.length?-1:c:W(s,{startingIndex:u,disabledIndices:e}):Math.min(l,W(s,{startingIndex:u,disabledIndices:e})):$.current=g?u<=c?p&&-1!==u?s.current.length:l:W(s,{startingIndex:u,decrement:!0,disabledIndices:e}):Math.max(c,W(s,{startingIndex:u,decrement:!0,disabledIndices:e})),q(s,$.current)?G(null):G($.current)}}function u(e){"auto"===O&&w(e.nativeEvent)&&(Z.current=!0)}const c=I&&n&&de&&{"aria-activedescendant":se||ce},l=s.current.find((e=>(null==e?void 0:e.id)===ce));return{reference:{...c,onKeyDown(o){J.current=!1;const u=0===o.key.indexOf("Arrow"),i=function(e,t,n){return xt(t,n?e===j:e===K,e===F)}(o.key,P,E),c=kt(o.key,P,E),a=Rt(o.key,P),f=(b?i:a)||"Enter"===o.key||""===o.key.trim();if(I&&n){const e=null==V?void 0:V.nodesRef.current.find((e=>null==e.parentId)),n=V&&e?function(e,t){let n,r=-1;return function t(o,u){u>r&&(n=o,r=u),Ke(e,o).forEach((e=>{t(e.id,u+1)}))}(t,0),e.find((e=>e.id===n))}(V.nodesRef.current,e.id):null;if(u&&n&&H){const e=new KeyboardEvent("keydown",{key:o.key,bubbles:!0});if(i||c){var d,m;const t=(null==(d=n.context)?void 0:d.elements.domReference)===o.currentTarget,r=c&&!t?null==(m=n.context)?void 0:m.elements.domReference:i?l:null;r&&(L(o),r.dispatchEvent(e),ae(void 0))}var p;if(a&&n.context)if(n.context.open&&n.parentId&&o.currentTarget!==n.context.elements.domReference)return L(o),void(null==(p=n.context.elements.domReference)||p.dispatchEvent(e))}return t(o)}(n||T||!u)&&(f&&(Q.current=b&&a?null:o.key),b?i&&(L(o),n?($.current=_(s,e),G($.current)):r(!0,o.nativeEvent,"list-navigation")):a&&(null!=v&&($.current=v),L(o),!n&&T?r(!0,o.nativeEvent,"list-navigation"):t(o),n&&G($.current)))},onFocus(){n&&G(null)},onPointerDown:function(e){Z.current=O,"auto"===O&&x(e.nativeEvent)&&(Z.current=!0)},onMouseDown:u,onClick:u},floating:{"aria-orientation":"both"===P?void 0:P,...!A(i)&&c,onKeyDown:t,onPointerMove(){J.current=!0}},item:me}}),[i,o,ce,se,oe,ue,s,d,P,E,I,n,de,b,v,T,p,D,g,O,G,r,me,V,H])},e.useMergeRefs=i,e.useRole=function(e,t){var n;void 0===t&&(t={});const{open:r,floatingId:o}=e,{enabled:i=!0,role:c="dialog"}=t,l=null!=(n=Ot.get(c))?n:c,s=se(),a=null!=ve();return u.useMemo((()=>{if(!i)return{};const e={id:o,...l&&{role:l}};return"tooltip"===l||"label"===c?{reference:{["aria-"+("label"===c?"labelledby":"describedby")]:r?o:void 0},floating:e}:{reference:{"aria-expanded":r?"true":"false","aria-haspopup":"alertdialog"===l?"dialog":l,"aria-controls":r?o:void 0,..."listbox"===l&&{role:"combobox"},..."menu"===l&&{id:s},..."menu"===l&&a&&{role:"menuitem"},..."select"===c&&{"aria-autocomplete":"none"},..."combobox"===c&&{"aria-autocomplete":"list"}},floating:{...e,..."menu"===l&&{"aria-labelledby":s}},item(e){let{active:t,selected:n}=e;const r={role:"option",...t&&{id:o+"-option"}};switch(c){case"select":return{...r,"aria-selected":t&&n};case"combobox":return{...r,...t&&{"aria-selected":!0}}}return{}}}}),[i,c,l,r,o,s,a])},e.useTransitionStatus=Tt,e.useTransitionStyles=function(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:r,close:o,common:i,duration:c=250}=t,l=e.placement,s=l.split("-")[0],a=u.useMemo((()=>({side:s,placement:l})),[s,l]),f="number"==typeof c,d=(f?c:c.open)||0,m=(f?c:c.close)||0,[v,p]=u.useState((()=>({...Mt(i,a),...Mt(n,a)}))),{isMounted:g,status:h}=Tt(e,{duration:c}),y=he(n),b=he(r),E=he(o),w=he(i);return Y((()=>{const e=Mt(y.current,a),t=Mt(E.current,a),n=Mt(w.current,a),r=Mt(b.current,a)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===h&&p((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===h&&p({transitionProperty:Object.keys(r).map(Ct).join(","),transitionDuration:d+"ms",...n,...r}),"close"===h){const r=t||e;p({transitionProperty:Object.keys(r).map(Ct).join(","),transitionDuration:m+"ms",...n,...r})}}),[m,E,y,b,w,d,h,a]),{isMounted:g,styles:v}},e.useTypeahead=function(e,t){var n;const{open:r,dataRef:o}=e,{listRef:i,activeIndex:c,onMatch:s,onTypingChange:a,enabled:f=!0,findMatch:d=null,resetMs:m=750,ignoreKeys:v=[],selectedIndex:p=null}=t,g=u.useRef(),h=u.useRef(""),y=u.useRef(null!=(n=null!=p?p:c)?n:-1),b=u.useRef(null),E=l(s),w=l(a),x=he(d),R=he(v);return Y((()=>{r&&(clearTimeout(g.current),b.current=null,h.current="")}),[r]),Y((()=>{var e;r&&""===h.current&&(y.current=null!=(e=null!=p?p:c)?e:-1)}),[r,p,c]),u.useMemo((()=>{if(!f)return{};function e(e){e?o.current.typing||(o.current.typing=e,w(e)):o.current.typing&&(o.current.typing=e,w(e))}function t(e,t,n){const r=x.current?x.current(t,n):t.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(n.toLocaleLowerCase()))));return r?e.indexOf(r):-1}function n(n){const o=i.current;if(h.current.length>0&&" "!==h.current[0]&&(-1===t(o,o,h.current)?e(!1):" "===n.key&&L(n)),null==o||R.current.includes(n.key)||1!==n.key.length||n.ctrlKey||n.metaKey||n.altKey)return;r&&" "!==n.key&&(L(n),e(!0));o.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&h.current===n.key&&(h.current="",y.current=b.current),h.current+=n.key,clearTimeout(g.current),g.current=setTimeout((()=>{h.current="",y.current=b.current,e(!1)}),m);const u=y.current,c=t(o,[...o.slice((u||0)+1),...o.slice(0,(u||0)+1)],h.current);-1!==c?(E(c),b.current=c):" "!==n.key&&(h.current="",e(!1))}return{reference:{onKeyDown:n},floating:{onKeyDown:n,onKeyUp(t){" "===t.key&&e(!1)}}}}),[f,r,o,i,m,R,x,E,w])}})); | ||
var ke=["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(","),Oe="undefined"==typeof Element,Ce=Oe?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Me=!Oe&&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},Te=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)},Se=function e(t,n,r){for(var o=[],u=Array.from(t);u.length;){var i=u.shift();if(!Te(i,!1))if("SLOT"===i.tagName){var c=i.assignedElements(),l=e(c.length?c:i.children,!0,r);r.flatten?o.push.apply(o,l):o.push({scopeParent:i,candidates:l})}else{Ce.call(i,ke)&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var s=i.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(i),a=!Te(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},Pe=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Le=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))&&!Pe(e)?0:e.tabIndex},Ae=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},De=function(e){return"INPUT"===e.tagName},Ne=function(e){return function(e){return De(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Me(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)},Fe=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},je=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=Ce.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Ce.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Fe(e)}else{if("function"==typeof r){for(var u=e;e;){var i=e.parentElement,c=Me(e);if(i&&!i.shadowRoot&&!0===r(i))return Fe(e);e=e.assignedSlot?e.assignedSlot:i||c===e.ownerDocument?i:c.host}e=u}if(function(e){var t,n,r,o,u=e&&Me(e),i=null===(t=u)||void 0===t?void 0:t.host,c=!1;if(u&&u!==e)for(c=!!(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));!c&&i;){var l,s,a;c=!(null===(s=i=null===(l=u=Me(i))||void 0===l?void 0:l.host)||void 0===s||null===(a=s.ownerDocument)||void 0===a||!a.contains(i))}return c}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Ke=function(e,t){return!(t.disabled||Te(t)||function(e){return De(e)&&"hidden"===e.type}(t)||je(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!!Ce.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},He=function(e,t){return!(Ne(t)||Le(t)<0||!Ke(e,t))},qe=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},_e=function e(t){var n=[],r=[];return t.forEach((function(t,o){var u=!!t.scopeParent,i=u?t.scopeParent:t,c=function(e,t){var n=Le(e);return n<0&&t&&!Pe(e)?0:n}(i,u),l=u?e(t.candidates):i;0===c?u?n.push.apply(n,l):n.push(i):r.push({documentOrder:o,tabIndex:c,item:t,isScope:u,content:l})})),r.sort(Ae).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},Be=function(e,t){var n;return n=(t=t||{}).getShadowRoot?Se([e],t.includeContainer,{filter:He.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:qe}):function(e,t,n){if(Te(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ke));return t&&Ce.call(e,ke)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,He.bind(null,t)),_e(n)};function We(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}let Ue=new WeakMap,ze=new WeakSet,Xe={},Ye=0;const Ve=e=>e&&(e.host||Ve(e.parentNode)),Ge=(e,t)=>t.map((t=>{if(e.contains(t))return t;const n=Ve(t);return e.contains(n)?n:null})).filter((e=>null!=e));function Ze(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=C(e[0]).body;return function(e,t,n,r){const o="data-floating-ui-inert",u=r?"inert":n?"aria-hidden":null,i=Ge(t,e),c=new Set,l=new Set(i),s=[];Xe[o]||(Xe[o]=new WeakMap);const a=Xe[o];return i.forEach((function e(t){t&&!c.has(t)&&(c.add(t),t.parentNode&&e(t.parentNode))})),function e(t){t&&!l.has(t)&&Array.prototype.forEach.call(t.children,(t=>{if(c.has(t))e(t);else{const e=u?t.getAttribute(u):null,n=null!==e&&"false"!==e,r=(Ue.get(t)||0)+1,i=(a.get(t)||0)+1;Ue.set(t,r),a.set(t,i),s.push(t),1===r&&n&&ze.add(t),1===i&&t.setAttribute(o,""),!n&&u&&t.setAttribute(u,"true")}}))}(t),c.clear(),Ye++,()=>{s.forEach((e=>{const t=(Ue.get(e)||0)-1,n=(a.get(e)||0)-1;Ue.set(e,t),a.set(e,n),t||(!ze.has(e)&&u&&e.removeAttribute(u),ze.delete(e)),n||e.removeAttribute(o)})),Ye--,Ye||(Ue=new WeakMap,Ue=new WeakMap,ze=new WeakSet,Xe={})}}(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const $e=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Qe(e,t){const n=Be(e,$e());"prev"===t&&n.reverse();const r=n.indexOf(h(C(e)));return n.slice(r+1)[0]}function Je(){return Qe(document.body,"next")}function et(){return Qe(document.body,"prev")}function tt(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!y(n,r)}function nt(e){Be(e,$e()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function rt(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 ot={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function ut(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const it=u.forwardRef((function(e,t){const[n,r]=u.useState();Z((()=>(R()&&r("button"),document.addEventListener("keydown",ut),()=>{document.removeEventListener("keydown",ut)})),[]);const o={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[be("focus-guard")]:"",style:ot};return u.createElement("span",le({},e,o))})),ct=u.createContext(null);function lt(e){let{id:t,root:n}=void 0===e?{}:e;const[r,o]=u.useState(null),i=de(),c=st(),l=u.useMemo((()=>({id:t,root:n,portalContext:c,uniqueId:i})),[t,n,c,i]),s=u.useRef();return Z((()=>()=>{null==r||r.remove()}),[r,l]),Z((()=>{if(s.current===l)return;s.current=l;const{id:e,root:t,portalContext:n,uniqueId:r}=l,u=e?document.getElementById(e):null,i=be("portal");if(u){const e=document.createElement("div");e.id=r,e.setAttribute(i,""),u.appendChild(e),o(e)}else{let u=t||(null==n?void 0:n.portalNode);u&&!d(u)&&(u=u.current),u=u||document.body;let c=null;e&&(c=document.createElement("div"),c.id=e,u.appendChild(c));const l=document.createElement("div");l.id=r,l.setAttribute(i,""),u=c||u,u.appendChild(l),o(l)}}),[l]),r}const st=()=>u.useContext(ct),at=20;let ft=[];function dt(e){ft=ft.filter((e=>e.isConnected)),e&&"body"!==s(e)&&(ft.push(e),ft.length>at&&(ft=ft.slice(-at)))}function vt(){return ft.slice().reverse().find((e=>e.isConnected))}const mt=u.forwardRef((function(e,t){return u.createElement("button",le({},e,{type:"button",ref:t,tabIndex:-1,style:ot}))}));const pt=new Set,gt=u.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;const o=de();return Z((()=>{if(!n)return;pt.add(o);const e=/iP(hone|ad|od)|iOS/.test(b()),t=document.body.style,r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",u=window.innerWidth-document.documentElement.clientWidth,i=t.left?parseFloat(t.left):window.pageXOffset,c=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",u&&(t[r]=u+"px"),e){var l,s;const e=(null==(l=window.visualViewport)?void 0:l.offsetLeft)||0,n=(null==(s=window.visualViewport)?void 0:s.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(c-Math.floor(n))+"px",left:-(i-Math.floor(e))+"px",right:"0"})}return()=>{pt.delete(o),0===pt.size&&(Object.assign(t,{overflow:"",[r]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(i,c)))}}),[o,n]),u.createElement("div",le({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function ht(e){return v(e.target)&&"BUTTON"===e.target.tagName}function yt(e){return P(e)}function bt(e){return null!=e&&null!=e.clientX}const Et={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},wt={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},xt=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}};const Rt="active",It="selected";function kt(e,t,n){const r=new Map,o="item"===n;let u=e;if(o&&e){const{[Rt]:t,[It]:n,...r}=e;u=r}return{..."floating"===n&&{tabIndex:-1},...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&&[Rt,It].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),{})}}let Ot=!1;function Ct(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Mt(e,t){return Ct(t,e===N||e===F,e===j||e===K)}function Tt(e,t,n){return Ct(t,e===F,n?e===j:e===K)||"Enter"===e||" "==e||""===e}function St(e,t,n){return Ct(t,n?e===K:e===j,e===N)}const Pt=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);const Lt=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function At(e,t){return"function"==typeof e?e(t):e}function Dt(e,t){void 0===t&&(t={});const{open:n,elements:{floating:r}}=e,{duration:o=250}=t,i=("number"==typeof o?o:o.close)||0,[c,l]=u.useState(!1),[s,a]=u.useState("unmounted"),f=function(e,t){const[n,r]=u.useState(e);return e&&!n&&r(!0),u.useEffect((()=>{if(!e){const e=setTimeout((()=>r(!1)),t);return()=>clearTimeout(e)}}),[e,t]),n}(n,i);return Z((()=>{c&&!f&&a("unmounted")}),[c,f]),Z((()=>{if(r){if(n){a("initial");const e=requestAnimationFrame((()=>{a("open")}));return()=>{cancelAnimationFrame(e)}}l(!0),a("close")}}),[n,r]),{isMounted:f,status:s}}function Nt(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}function Ft(e,t){const[n,r]=e;let o=!1;const u=t.length;for(let e=0,i=u-1;e<u;i=e++){const[u,c]=t[e]||[0,0],[l,s]=t[i]||[0,0];c>=r!=s>=r&&n<=(l-u)*(r-c)/(s-c)+u&&(o=!o)}return o}Object.defineProperty(e,"arrow",{enumerable:!0,get:function(){return n.arrow}}),Object.defineProperty(e,"autoPlacement",{enumerable:!0,get:function(){return n.autoPlacement}}),Object.defineProperty(e,"autoUpdate",{enumerable:!0,get:function(){return n.autoUpdate}}),Object.defineProperty(e,"computePosition",{enumerable:!0,get:function(){return n.computePosition}}),Object.defineProperty(e,"detectOverflow",{enumerable:!0,get:function(){return n.detectOverflow}}),Object.defineProperty(e,"flip",{enumerable:!0,get:function(){return n.flip}}),Object.defineProperty(e,"getOverflowAncestors",{enumerable:!0,get:function(){return n.getOverflowAncestors}}),Object.defineProperty(e,"hide",{enumerable:!0,get:function(){return n.hide}}),Object.defineProperty(e,"inline",{enumerable:!0,get:function(){return n.inline}}),Object.defineProperty(e,"limitShift",{enumerable:!0,get:function(){return n.limitShift}}),Object.defineProperty(e,"offset",{enumerable:!0,get:function(){return n.offset}}),Object.defineProperty(e,"platform",{enumerable:!0,get:function(){return n.platform}}),Object.defineProperty(e,"shift",{enumerable:!0,get:function(){return n.shift}}),Object.defineProperty(e,"size",{enumerable:!0,get:function(){return n.size}}),e.Composite=ie,e.CompositeItem=ce,e.FloatingArrow=ve,e.FloatingDelayGroup=e=>{let{children:t,delay:n,timeoutMs:r=0}=e;const[o,i]=u.useReducer(((e,t)=>({...e,...t})),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),c=u.useRef(null),l=u.useCallback((e=>{i({currentId:e})}),[]);return Z((()=>{o.currentId?null===c.current?c.current=o.currentId:i({isInstantPhase:!0}):(i({isInstantPhase:!1}),c.current=null)}),[o.currentId]),u.createElement(Re.Provider,{value:u.useMemo((()=>({...o,setState:i,setCurrentId:l})),[o,i,l])},t)},e.FloatingFocusManager=function(e){const{context:t,children:n,disabled:r=!1,order:o=["content"],guards:i=!0,initialFocus:c=0,returnFocus:l=!0,modal:s=!0,visuallyHiddenDismiss:a=!1,closeOnFocusOut:f=!0}=e,{open:d,refs:m,nodeId:p,onOpenChange:g,events:b,dataRef:E,elements:{domReference:R,floating:I}}=t,k="number"==typeof c&&c<0,O=A(R)&&k,M="undefined"==typeof HTMLElement||!("inert"in HTMLElement.prototype)||i,S=Ee(o),P=Ee(c),D=Ee(l),N=ye(),F=st(),j=u.useRef(null),K=u.useRef(null),H=u.useRef(!1),q=u.useRef(!1),_=null!=F,B=u.useCallback((function(e){return void 0===e&&(e=I),e?Be(e,$e()):[]}),[I]),W=u.useCallback((e=>{const t=B(e);return S.current.map((e=>R&&"reference"===e?R:I&&"floating"===e?I:t)).filter(Boolean).flat()}),[R,I,S,B]);function U(e){return!r&&a&&s?u.createElement(mt,{ref:"start"===e?j:K,onClick:e=>g(!1,e.nativeEvent)},"string"==typeof a?a:"Dismiss"):null}u.useEffect((()=>{if(r||!s)return;function e(e){if("Tab"===e.key){y(I,h(C(I)))&&0===B().length&&!O&&L(e);const t=W(),n=T(e);"reference"===S.current[0]&&n===R&&(L(e),e.shiftKey?G(t[t.length-1]):G(t[1])),"floating"===S.current[1]&&n===I&&e.shiftKey&&(L(e),G(t[0]))}}const t=C(I);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[r,R,I,s,S,m,O,B,W]),u.useEffect((()=>{if(!r&&f)return I&&v(R)?(R.addEventListener("focusout",t),R.addEventListener("pointerdown",e),!s&&I.addEventListener("focusout",t),()=>{R.removeEventListener("focusout",t),R.removeEventListener("pointerdown",e),!s&&I.removeEventListener("focusout",t)}):void 0;function e(){q.current=!0,setTimeout((()=>{q.current=!1}))}function t(e){const t=e.relatedTarget;queueMicrotask((()=>{const n=!(y(R,t)||y(I,t)||y(t,I)||y(null==F?void 0:F.portalNode,t)||null!=t&&t.hasAttribute(be("focus-guard"))||N&&(We(N.nodesRef.current,p).find((e=>{var n,r;return y(null==(n=e.context)?void 0:n.elements.floating,t)||y(null==(r=e.context)?void 0:r.elements.domReference,t)}))||function(e,t){var n;let r=[],o=null==(n=e.find((e=>e.id===t)))?void 0:n.parentId;for(;o;){const t=e.find((e=>e.id===o));o=null==t?void 0:t.parentId,t&&(r=r.concat(t))}return r}(N.nodesRef.current,p).find((e=>{var n,r;return(null==(n=e.context)?void 0:n.elements.floating)===t||(null==(r=e.context)?void 0:r.elements.domReference)===t}))));t&&n&&!q.current&&t!==vt()&&(H.current=!0,g(!1,e))}))}}),[r,R,I,s,p,N,F,g,f]),u.useEffect((()=>{var e;if(r)return;const t=Array.from((null==F||null==(e=F.portalNode)?void 0:e.querySelectorAll("["+be("portal")+"]"))||[]);if(I){const e=[I,...t,j.current,K.current,S.current.includes("reference")||O?R:null].filter((e=>null!=e)),n=s||O?Ze(e,M,!M):Ze(e);return()=>{n()}}}),[r,R,I,s,S,F,O,M]),Z((()=>{if(r||!I)return;const e=h(C(I));queueMicrotask((()=>{const t=W(I),n=P.current,r=("number"==typeof n?t[n]:n.current)||I,o=y(I,e);k||o||!d||G(r,{preventScroll:r===I})}))}),[r,d,I,k,W,P]),Z((()=>{if(r||!I)return;let e=!1;const t=C(I),n=h(t),o=E.current;function u(t){let{reason:n,event:r,nested:o}=t;"escape-key"===n&&m.domReference.current&&dt(m.domReference.current),"hover"===n&&"mouseleave"===r.type&&(H.current=!0),"outside-press"===n&&(o?(H.current=!1,e=!0):H.current=!(w(r)||x(r)))}return dt(n),b.on("openchange",u),()=>{b.off("openchange",u);const n=h(t),r=y(I,n)||N&&We(N.nodesRef.current,p).some((e=>{var t;return y(null==(t=e.context)?void 0:t.elements.floating,n)}));(r||o.openEvent&&["click","mousedown"].includes(o.openEvent.type))&&m.domReference.current&&dt(m.domReference.current);const i=vt();D.current&&!H.current&&v(i)&&(i===n||n===t.body||r)&&G(i,{cancelPrevious:!1,preventScroll:e})}}),[r,I,D,E,m,b,N,p]),Z((()=>{if(!r&&F)return F.setFocusManagerState({modal:s,closeOnFocusOut:f,open:d,onOpenChange:g,refs:m}),()=>{F.setFocusManagerState(null)}}),[r,F,s,d,g,m,f]),Z((()=>{if(r||!I||"function"!=typeof MutationObserver||k)return;const e=()=>{const e=I.getAttribute("tabindex");S.current.includes("floating")||h(C(I))!==m.domReference.current&&0===B().length?"0"!==e&&I.setAttribute("tabindex","0"):"-1"!==e&&I.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(I,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}}),[r,I,m,S,B,k]);const z=!r&&M&&(_||s);return u.createElement(u.Fragment,null,z&&u.createElement(it,{"data-type":"inside",ref:null==F?void 0:F.beforeInsideRef,onFocus:e=>{if(s){const e=W();G("reference"===o[0]?e[0]:e[e.length-1])}else if(null!=F&&F.preserveTabOrder&&F.portalNode)if(H.current=!1,tt(e,F.portalNode)){const e=Je()||R;null==e||e.focus()}else{var t;null==(t=F.beforeOutsideRef.current)||t.focus()}}}),!O&&U("start"),n,U("end"),z&&u.createElement(it,{"data-type":"inside",ref:null==F?void 0:F.afterInsideRef,onFocus:e=>{if(s)G(W()[0]);else if(null!=F&&F.preserveTabOrder&&F.portalNode)if(f&&(H.current=!0),tt(e,F.portalNode)){const e=et()||R;null==e||e.focus()}else{var t;null==(t=F.afterOutsideRef.current)||t.focus()}}}))},e.FloatingList=J,e.FloatingNode=function(e){let{children:t,id:n}=e;const r=he();return u.createElement(pe.Provider,{value:u.useMemo((()=>({id:n,parentId:r})),[n,r])},t)},e.FloatingOverlay=gt,e.FloatingPortal=function(e){let{children:t,id:n,root:o=null,preserveTabOrder:i=!0}=e;const c=lt({id:n,root:o}),[l,s]=u.useState(null),a=u.useRef(null),f=u.useRef(null),d=u.useRef(null),v=u.useRef(null),m=!!l&&!l.modal&&l.open&&i&&!(!o&&!c);return u.useEffect((()=>{if(c&&i&&(null==l||!l.modal))return c.addEventListener("focusin",e,!0),c.addEventListener("focusout",e,!0),()=>{c.removeEventListener("focusin",e,!0),c.removeEventListener("focusout",e,!0)};function e(e){if(c&&tt(e)){("focusin"===e.type?rt:nt)(c)}}}),[c,i,null==l?void 0:l.modal]),u.createElement(ct.Provider,{value:u.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:a,afterOutsideRef:f,beforeInsideRef:d,afterInsideRef:v,portalNode:c,setFocusManagerState:s})),[i,c])},m&&c&&u.createElement(it,{"data-type":"outside",ref:a,onFocus:e=>{if(tt(e,c)){var t;null==(t=d.current)||t.focus()}else{const e=et()||(null==l?void 0:l.refs.domReference.current);null==e||e.focus()}}}),m&&c&&u.createElement("span",{"aria-owns":c.id,style:ot}),c&&r.createPortal(t,c),m&&c&&u.createElement(it,{"data-type":"outside",ref:f,onFocus:e=>{if(tt(e,c)){var t;null==(t=v.current)||t.focus()}else{const t=Je()||(null==l?void 0:l.refs.domReference.current);null==t||t.focus(),(null==l?void 0:l.closeOnFocusOut)&&(null==l||l.onOpenChange(!1,e.nativeEvent))}}}))},e.FloatingTree=function(e){let{children:t}=e;const n=u.useRef([]),r=u.useCallback((e=>{n.current=[...n.current,e]}),[]),o=u.useCallback((e=>{n.current=n.current.filter((t=>t!==e))}),[]),i=u.useState((()=>me()))[0];return u.createElement(ge.Provider,{value:u.useMemo((()=>({nodesRef:n,addNode:r,removeNode:o,events:i})),[n,r,o,i])},t)},e.inner=e=>({name:"inner",options:e,async fn(t){const{listRef:o,overflowRef:u,onFallbackChange:i,offset:c=0,index:l=0,minItemsVisible:s=4,referenceOverflowThreshold:a=0,scrollRef:f,...d}=e,{rects:v,elements:{floating:m}}=t,p=o.current[l];if(!p)return{};const g={...t,...await n.offset(-p.offsetTop-m.clientTop-v.reference.height/2-p.offsetHeight/2-c).fn(t)},h=(null==f?void 0:f.current)||m,y=await n.detectOverflow(Nt(g,h.scrollHeight),d),b=await n.detectOverflow(g,{...d,elementContext:"reference"}),E=Math.max(0,y.top),w=g.y+E,x=Math.max(0,h.scrollHeight-E-Math.max(0,y.bottom));return h.style.maxHeight=x+"px",h.scrollTop=E,i&&(h.offsetHeight<p.offsetHeight*Math.min(s,o.current.length-1)-1||b.top>=-a||b.bottom>=-a?r.flushSync((()=>i(!0))):r.flushSync((()=>i(!1)))),u&&(u.current=await n.detectOverflow(Nt({...g,y:w},h.offsetHeight),d)),{y:w}}}),e.safePolygon=function(e){void 0===e&&(e={});const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e;let o,u=!1,i=null,c=null,l=performance.now();const s=e=>{let{x:n,y:s,placement:a,elements:f,onClose:v,nodeId:m,tree:p}=e;return function(e){function g(){clearTimeout(o),v()}if(clearTimeout(o),!f.domReference||!f.floating||null==a||null==n||null==s)return;const{clientX:h,clientY:b}=e,E=[h,b],w=T(e),x="mouseleave"===e.type,R=y(f.floating,w),I=y(f.domReference,w),k=f.domReference.getBoundingClientRect(),O=f.floating.getBoundingClientRect(),C=a.split("-")[0],M=n>O.right-O.width/2,S=s>O.bottom-O.height/2,P=function(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}(E,k),L=O.width>k.width,A=O.height>k.height,D=(L?k:O).left,N=(L?k:O).right,F=(A?k:O).top,j=(A?k:O).bottom;if(R&&(u=!0,!x))return;if(I&&(u=!1),I&&!x)return void(u=!0);if(x&&d(e.relatedTarget)&&y(f.floating,e.relatedTarget))return;if(p&&We(p.nodesRef.current,m).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if("top"===C&&s>=k.bottom-1||"bottom"===C&&s<=k.top+1||"left"===C&&n>=k.right-1||"right"===C&&n<=k.left+1)return g();let K=[];switch(C){case"top":K=[[D,k.top+1],[D,O.bottom-1],[N,O.bottom-1],[N,k.top+1]];break;case"bottom":K=[[D,O.top+1],[D,k.bottom-1],[N,k.bottom-1],[N,O.top+1]];break;case"left":K=[[O.right-1,j],[O.right-1,F],[k.left+1,F],[k.left+1,j]];break;case"right":K=[[k.right-1,j],[k.right-1,F],[O.left+1,F],[O.left+1,j]]}if(!Ft([h,b],K)){if(u&&!P)return g();if(!x&&r){const t=function(e,t){const n=performance.now(),r=n-l;if(null===i||null===c||0===r)return i=e,c=t,l=n,null;const o=e-i,u=t-c,s=Math.sqrt(o*o+u*u);return i=e,c=t,l=n,s/r}(e.clientX,e.clientY);if(null!==t&&t<.1)return g()}Ft([h,b],function(e){let[n,r]=e;switch(C){case"top":return[[L?n+t/2:M?n+4*t:n-4*t,r+t+1],[L?n-t/2:M?n+4*t:n-4*t,r+t+1],...[[O.left,M||L?O.bottom-t:O.top],[O.right,M?L?O.bottom-t:O.top:O.bottom-t]]];case"bottom":return[[L?n+t/2:M?n+4*t:n-4*t,r-t],[L?n-t/2:M?n+4*t:n-4*t,r-t],...[[O.left,M||L?O.top+t:O.bottom],[O.right,M?L?O.top+t:O.bottom:O.top+t]]];case"left":{const e=[n+t+1,A?r+t/2:S?r+4*t:r-4*t],o=[n+t+1,A?r-t/2:S?r+4*t:r-4*t];return[...[[S||A?O.right-t:O.left,O.top],[S?A?O.right-t:O.left:O.right-t,O.bottom]],e,o]}case"right":return[[n-t,A?r+t/2:S?r+4*t:r-4*t],[n-t,A?r-t/2:S?r+4*t:r-4*t],...[[S||A?O.left+t:O.right,O.top],[S?A?O.left+t:O.right:O.left+t,O.bottom]]]}}([n,s]))?!u&&r&&(o=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:c=!0,event:l="click",toggle:s=!0,ignoreMouse:a=!1,keyboardHandlers:f=!0}=t,d=u.useRef(),v=u.useRef(!1);return u.useMemo((()=>c?{reference:{onPointerDown(e){d.current=e.pointerType},onMouseDown(e){0===e.button&&(O(d.current,!0)&&a||"click"!==l&&(!n||!s||o.current.openEvent&&"mousedown"!==o.current.openEvent.type?(e.preventDefault(),r(!0,e.nativeEvent,"click")):r(!1,e.nativeEvent,"click")))},onClick(e){"mousedown"===l&&d.current?d.current=void 0:O(d.current,!0)&&a||(!n||!s||o.current.openEvent&&"click"!==o.current.openEvent.type?r(!0,e.nativeEvent,"click"):r(!1,e.nativeEvent,"click"))},onKeyDown(e){d.current=void 0,e.defaultPrevented||!f||ht(e)||(" "!==e.key||yt(i)||(e.preventDefault(),v.current=!0),"Enter"===e.key&&r(!n||!s,e.nativeEvent,"click"))},onKeyUp(e){e.defaultPrevented||!f||ht(e)||yt(i)||" "===e.key&&v.current&&(v.current=!1,r(!n||!s,e.nativeEvent,"click"))}}}:{}),[c,o,l,a,f,i,s,n,r])},e.useClientPoint=function(e,t){void 0===t&&(t={});const{open:n,refs:r,dataRef:o,elements:{floating:i}}=e,{enabled:c=!0,axis:s="both",x:f=null,y:d=null}=t,v=u.useRef(!1),m=u.useRef(null),[p,g]=u.useState(),[h,b]=u.useState([]),E=l(((e,t)=>{v.current||o.current.openEvent&&!bt(o.current.openEvent)||r.setPositionReference(function(e,t){let n=null,r=null,o=!1;return{contextElement:e.current||void 0,getBoundingClientRect(){var u,i;const c=(null==(u=e.current)?void 0:u.getBoundingClientRect())||{width:0,height:0,x:0,y:0},l="x"===t.axis||"both"===t.axis,s="y"===t.axis||"both"===t.axis,a=["mouseenter","mousemove"].includes((null==(i=t.dataRef.current.openEvent)?void 0:i.type)||"")&&"touch"!==t.pointerType;let f=c.width,d=c.height,v=c.x,m=c.y;return null==n&&t.x&&l&&(n=c.x-t.x),null==r&&t.y&&s&&(r=c.y-t.y),v-=n||0,m-=r||0,f=0,d=0,!o||a?(f="y"===t.axis?c.width:0,d="x"===t.axis?c.height:0,v=l&&null!=t.x?t.x:v,m=s&&null!=t.y?t.y:m):o&&!a&&(d="x"===t.axis?c.height:d,f="y"===t.axis?c.width:f),o=!0,{width:f,height:d,x:v,y:m,top:m,right:v+f,bottom:m+d,left:v}}}}(r.domReference,{x:e,y:t,axis:s,dataRef:o,pointerType:p}))})),w=l((e=>{null==f&&null==d&&(n?m.current||b([]):E(e.clientX,e.clientY))})),x=O(p)?i:n,R=u.useCallback((()=>{if(!x||!c||null!=f||null!=d)return;const e=a(r.floating.current);function t(n){const o=T(n);y(r.floating.current,o)?(e.removeEventListener("mousemove",t),m.current=null):E(n.clientX,n.clientY)}if(!o.current.openEvent||bt(o.current.openEvent)){e.addEventListener("mousemove",t);const n=()=>{e.removeEventListener("mousemove",t),m.current=null};return m.current=n,n}r.setPositionReference(r.domReference.current)}),[o,c,x,r,E,f,d]);return u.useEffect((()=>R()),[R,h]),u.useEffect((()=>{c&&!i&&(v.current=!1)}),[c,i]),u.useEffect((()=>{!c&&n&&(v.current=!0)}),[c,n]),Z((()=>{!c||null==f&&null==d||(v.current=!1,E(f,d))}),[c,f,d,E]),u.useMemo((()=>{if(!c)return{};function e(e){let{pointerType:t}=e;g(t)}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove:w,onMouseEnter:w}}}),[c,w])},e.useDelayGroup=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:o}=t;const{currentId:u,setCurrentId:i,initialDelay:c,setState:l,timeoutMs:s}=Ie();Z((()=>{u&&(l({delay:{open:1,close:xe(c,"close")}}),u!==o&&r(!1))}),[o,r,l,u,c]),Z((()=>{function e(){r(!1),l({delay:c,currentId:null})}if(!n&&u===o){if(s){const t=window.setTimeout(e,s);return()=>{clearTimeout(t)}}e()}}),[n,l,u,o,r,c,s]),Z((()=>{n&&i(o)}),[n,i,o])},e.useDelayGroupContext=Ie,e.useDismiss=function(e,t){void 0===t&&(t={});const{open:r,onOpenChange:o,nodeId:i,elements:{reference:c,domReference:s,floating:f},dataRef:m}=e,{enabled:h=!0,escapeKey:b=!0,outsidePress:E=!0,outsidePressEvent:w="pointerdown",referencePress:x=!1,referencePressEvent:R="pointerdown",ancestorScroll:I=!1,bubbles:k,capture:O}=t,S=ye(),P=l("function"==typeof E?E:()=>!1),L="function"==typeof E?P:E,A=u.useRef(!1),D=u.useRef(!1),{escapeKey:N,outsidePress:F}=xt(k),{escapeKey:j,outsidePress:K}=xt(O),H=l((e=>{if(!r||!h||!b||"Escape"!==e.key)return;const t=S?We(S.nodesRef.current,i):[];if(!N&&(e.stopPropagation(),t.length>0)){let e=!0;if(t.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)})),!e)return}o(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")})),q=l((e=>{var t;const n=()=>{var t;H(e),null==(t=T(e))||t.removeEventListener("keydown",n)};null==(t=T(e))||t.addEventListener("keydown",n)})),_=l((e=>{const t=A.current;A.current=!1;const n=D.current;if(D.current=!1,"click"===w&&n)return;if(t)return;if("function"==typeof L&&!L(e))return;const r=T(e),u="["+be("inert")+"]",c=C(f).querySelectorAll(u);let l=d(r)?r:null;for(;l&&!p(l);){const e=g(l);if(p(e)||!d(e))break;l=e}if(c.length&&d(r)&&!r.matches("html,body")&&!y(r,f)&&Array.from(c).every((e=>!y(l,e))))return;if(v(r)&&f){const t=r.clientWidth>0&&r.scrollWidth>r.clientWidth,n=r.clientHeight>0&&r.scrollHeight>r.clientHeight;let o=n&&e.offsetX>r.clientWidth;if(n){const t="rtl"===function(e){return a(e).getComputedStyle(e)}(r).direction;t&&(o=e.offsetX<=r.offsetWidth-r.clientWidth)}if(o||t&&e.offsetY>r.clientHeight)return}const m=S&&We(S.nodesRef.current,i).some((t=>{var n;return M(e,null==(n=t.context)?void 0:n.elements.floating)}));if(M(e,f)||M(e,s)||m)return;const h=S?We(S.nodesRef.current,i):[];if(h.length>0){let e=!0;if(h.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}o(!1,e,"outside-press")})),B=l((e=>{var t;const n=()=>{var t;_(e),null==(t=T(e))||t.removeEventListener(w,n)};null==(t=T(e))||t.addEventListener(w,n)}));return u.useEffect((()=>{if(!r||!h)return;function e(e){o(!1,e,"ancestor-scroll")}m.current.__escapeKeyBubbles=N,m.current.__outsidePressBubbles=F;const t=C(f);b&&t.addEventListener("keydown",j?q:H,j),L&&t.addEventListener(w,K?B:_,K);let u=[];return I&&(d(s)&&(u=n.getOverflowAncestors(s)),d(f)&&(u=u.concat(n.getOverflowAncestors(f))),!d(c)&&c&&c.contextElement&&(u=u.concat(n.getOverflowAncestors(c.contextElement)))),u=u.filter((e=>{var n;return e!==(null==(n=t.defaultView)?void 0:n.visualViewport)})),u.forEach((t=>{t.addEventListener("scroll",e,{passive:!0})})),()=>{b&&t.removeEventListener("keydown",j?q:H,j),L&&t.removeEventListener(w,K?B:_,K),u.forEach((t=>{t.removeEventListener("scroll",e)}))}}),[m,f,s,c,b,L,w,r,o,I,h,N,F,H,j,q,_,K,B]),u.useEffect((()=>{A.current=!1}),[L,w]),u.useMemo((()=>h?{reference:{onKeyDown:H,[Et[R]]:e=>{x&&o(!1,e.nativeEvent,"reference-press")}},floating:{onKeyDown:H,onMouseDown(){D.current=!0},onMouseUp(){D.current=!0},[wt[w]]:()=>{A.current=!0}}}:{}),[h,x,w,R,o,H])},e.useFloating=function(e){var t;void 0===e&&(e={});const{open:r=!1,onOpenChange:o,nodeId:i}=e,[c,s]=u.useState(null),a=(null==(t=e.elements)?void 0:t.reference)||c,f=n.useFloating(e),v=ye(),m=null!=he(),p=l(((e,t,n)=>{e&&(h.current.openEvent=t),y.emit("openchange",{open:e,event:t,reason:n,nested:m}),null==o||o(e,t,n)})),g=u.useRef(null),h=u.useRef({}),y=u.useState((()=>me()))[0],b=de(),E=u.useCallback((e=>{const t=d(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;f.refs.setReference(t)}),[f.refs]),w=u.useCallback((e=>{(d(e)||null===e)&&(g.current=e,s(e)),(d(f.refs.reference.current)||null===f.refs.reference.current||null!==e&&!d(e))&&f.refs.setReference(e)}),[f.refs]),x=u.useMemo((()=>({...f.refs,setReference:w,setPositionReference:E,domReference:g})),[f.refs,w,E]),R=u.useMemo((()=>({...f.elements,domReference:a})),[f.elements,a]),I=u.useMemo((()=>({...f,refs:x,elements:R,dataRef:h,nodeId:i,floatingId:b,events:y,open:r,onOpenChange:p})),[f,i,b,y,r,p,x,R]);return Z((()=>{const e=null==v?void 0:v.nodesRef.current.find((e=>e.id===i));e&&(e.context=I)})),u.useMemo((()=>({...f,context:I,refs:x,elements:R})),[f,x,R,I])},e.useFloatingNodeId=function(e){const t=de(),n=ye(),r=he(),o=e||r;return Z((()=>{const e={id:t,parentId:o};return null==n||n.addNode(e),()=>{null==n||n.removeNode(e)}}),[n,t,o]),t},e.useFloatingParentNodeId=he,e.useFloatingPortalNode=lt,e.useFloatingTree=ye,e.useFocus=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,events:o,refs:i,elements:{floating:c,domReference:l}}=e,{enabled:s=!0,visibleOnly:f=!0}=t,m=u.useRef(!1),p=u.useRef(),g=u.useRef(!0);return u.useEffect((()=>{if(!s)return;const e=a(l);function t(){!n&&v(l)&&l===h(C(l))&&(m.current=!0)}function r(){g.current=!0}return e.addEventListener("blur",t),e.addEventListener("keydown",r,!0),()=>{e.removeEventListener("blur",t),e.removeEventListener("keydown",r,!0)}}),[c,l,n,s]),u.useEffect((()=>{if(s)return o.on("openchange",e),()=>{o.off("openchange",e)};function e(e){let{reason:t}=e;"reference-press"!==t&&"escape-key"!==t||(m.current=!0)}}),[o,s]),u.useEffect((()=>()=>{clearTimeout(p.current)}),[]),u.useMemo((()=>s?{reference:{onPointerDown(e){x(e.nativeEvent)||(g.current=!1)},onMouseLeave(){m.current=!1},onFocus(e){if(m.current)return;const t=T(e.nativeEvent);if(f&&d(t))try{if(R()&&k())throw Error();if(!t.matches(":focus-visible"))return}catch(e){if(!g.current&&!P(t))return}r(!0,e.nativeEvent,"focus")},onBlur(e){m.current=!1;const t=e.relatedTarget,n=d(t)&&t.hasAttribute(be("focus-guard"))&&"outside"===t.getAttribute("data-type");p.current=window.setTimeout((()=>{const o=h(l?l.ownerDocument:document);(t||o!==l)&&(y(i.floating.current,t)||y(l,t)||n||r(!1,e.nativeEvent,"focus"))}))}}}:{}),[s,f,l,i,r])},e.useHover=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:{domReference:c,floating:l},refs:s}=e,{enabled:a=!0,delay:f=0,handleClose:v=null,mouseOnly:m=!1,restMs:p=0,move:g=!0}=t,h=ye(),b=he(),E=Ee(v),w=Ee(f),x=u.useRef(),R=u.useRef(),I=u.useRef(),k=u.useRef(),M=u.useRef(!0),T=u.useRef(!1),S=u.useRef((()=>{})),P=u.useCallback((()=>{var e;const t=null==(e=o.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[o]);u.useEffect((()=>{if(a)return i.on("openchange",e),()=>{i.off("openchange",e)};function e(e){let{open:t}=e;t||(clearTimeout(R.current),clearTimeout(k.current),M.current=!0)}}),[a,i]),u.useEffect((()=>{if(!a||!E.current||!n)return;function e(e){P()&&r(!1,e,"hover")}const t=C(l).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[l,n,r,a,E,o,P]);const L=u.useCallback((function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");const o=xe(w.current,"close",x.current);o&&!I.current?(clearTimeout(R.current),R.current=setTimeout((()=>r(!1,e,n)),o)):t&&(clearTimeout(R.current),r(!1,e,n))}),[w,r]),A=u.useCallback((()=>{S.current(),I.current=void 0}),[]),D=u.useCallback((()=>{if(T.current){const e=C(s.floating.current).body;e.style.pointerEvents="",e.removeAttribute(we),T.current=!1}}),[s]);return u.useEffect((()=>{if(a&&d(c)){const e=c;return n&&e.addEventListener("mouseleave",s),null==l||l.addEventListener("mouseleave",s),g&&e.addEventListener("mousemove",u,{once:!0}),e.addEventListener("mouseenter",u),e.addEventListener("mouseleave",i),()=>{n&&e.removeEventListener("mouseleave",s),null==l||l.removeEventListener("mouseleave",s),g&&e.removeEventListener("mousemove",u),e.removeEventListener("mouseenter",u),e.removeEventListener("mouseleave",i)}}function t(){return!!o.current.openEvent&&["click","mousedown"].includes(o.current.openEvent.type)}function u(e){if(clearTimeout(R.current),M.current=!1,m&&!O(x.current)||p>0&&0===xe(w.current,"open"))return;const t=xe(w.current,"open",x.current);t?R.current=setTimeout((()=>{r(!0,e,"hover")}),t):r(!0,e,"hover")}function i(r){if(t())return;S.current();const o=C(l);if(clearTimeout(k.current),E.current){n||clearTimeout(R.current),I.current=E.current({...e,tree:h,x:r.clientX,y:r.clientY,onClose(){D(),A(),L(r,!0,"safe-polygon")}});const t=I.current;return o.addEventListener("mousemove",t),void(S.current=()=>{o.removeEventListener("mousemove",t)})}("touch"!==x.current||!y(l,r.relatedTarget))&&L(r)}function s(n){t()||null==E.current||E.current({...e,tree:h,x:n.clientX,y:n.clientY,onClose(){D(),A(),L(n)}})(n)}}),[c,l,a,e,m,p,g,L,A,D,r,n,h,w,E,o]),Z((()=>{var e;if(a&&n&&null!=(e=E.current)&&e.__options.blockPointerEvents&&P()){const e=C(l).body;if(e.setAttribute(we,""),e.style.pointerEvents="none",T.current=!0,d(c)&&l){var t;const e=c,n=null==h||null==(t=h.nodesRef.current.find((e=>e.id===b)))||null==(t=t.context)?void 0:t.elements.floating;return n&&(n.style.pointerEvents=""),e.style.pointerEvents="auto",l.style.pointerEvents="auto",()=>{e.style.pointerEvents="",l.style.pointerEvents=""}}}}),[a,n,b,l,c,h,E,o,P]),Z((()=>{n||(x.current=void 0,A(),D())}),[n,A,D]),u.useEffect((()=>()=>{A(),clearTimeout(R.current),clearTimeout(k.current),D()}),[a,c,A,D]),u.useMemo((()=>{if(!a)return{};function e(e){x.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(e){n||0===p||(clearTimeout(k.current),k.current=setTimeout((()=>{M.current||r(!0,e.nativeEvent,"hover")}),p))}},floating:{onMouseEnter(){clearTimeout(R.current)},onMouseLeave(e){L(e.nativeEvent,!1)}}}}),[a,p,n,r,L])},e.useId=de,e.useInnerOffset=function(e,t){const{open:n,elements:o}=e,{enabled:i=!0,overflowRef:c,scrollRef:s,onChange:a}=t,f=l(a),d=u.useRef(!1),v=u.useRef(null),m=u.useRef(null);return u.useEffect((()=>{if(!i)return;function e(e){if(e.ctrlKey||!t||null==c.current)return;const n=e.deltaY,o=c.current.top>=-.5,u=c.current.bottom>=-.5,i=t.scrollHeight-t.clientHeight,l=n<0?-1:1,s=n<0?"max":"min";t.scrollHeight<=t.clientHeight||(!o&&n>0||!u&&n<0?(e.preventDefault(),r.flushSync((()=>{f((e=>e+Math[s](n,i*l)))}))):/firefox/i.test(E())&&(t.scrollTop+=n))}const t=(null==s?void 0:s.current)||o.floating;return n&&t?(t.addEventListener("wheel",e),requestAnimationFrame((()=>{v.current=t.scrollTop,null!=c.current&&(m.current={...c.current})})),()=>{v.current=null,m.current=null,t.removeEventListener("wheel",e)}):void 0}),[i,n,o.floating,c,s,f]),u.useMemo((()=>i?{floating:{onKeyDown(){d.current=!0},onWheel(){d.current=!1},onPointerMove(){d.current=!1},onScroll(){const e=(null==s?void 0:s.current)||o.floating;if(c.current&&e&&d.current){if(null!==v.current){const t=e.scrollTop-v.current;(c.current.bottom<-.5&&t<-1||c.current.top<-.5&&t>1)&&r.flushSync((()=>f((e=>e+t))))}requestAnimationFrame((()=>{v.current=e.scrollTop}))}}}}:{}),[i,c,o.floating,s,f])},e.useInteractions=function(e){void 0===e&&(e=[]);const t=e,n=u.useCallback((t=>kt(t,e,"reference")),t),r=u.useCallback((t=>kt(t,e,"floating")),t),o=u.useCallback((t=>kt(t,e,"item")),e.map((e=>null==e?void 0:e.item)));return u.useMemo((()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:o})),[n,r,o])},e.useListItem=ee,e.useListNavigation=function(e,t){const{open:n,onOpenChange:r,refs:o,elements:{domReference:i,floating:c}}=e,{listRef:s,activeIndex:a,onNavigate:f=(()=>{}),enabled:d=!0,selectedIndex:m=null,allowEscape:p=!1,loop:g=!1,nested:b=!1,rtl:E=!1,virtual:I=!1,focusItemOnOpen:O="auto",focusItemOnHover:M=!0,openOnArrowKeyDown:T=!0,disabledIndices:S,orientation:P="vertical",cols:D=1,scrollItemIntoView:N=!0,virtualItemRef:H,itemSizes:V,dense:$=!1}=t,Q=he(),J=ye(),ee=l(f),te=u.useRef(O),ne=u.useRef(null!=m?m:-1),re=u.useRef(null),oe=u.useRef(!0),ue=u.useRef(ee),ie=u.useRef(!!c),ce=u.useRef(!1),le=u.useRef(!1),se=Ee(S),ae=Ee(n),fe=Ee(N),[de,ve]=u.useState(),[me,pe]=u.useState(),ge=l((function(e,t,n){void 0===n&&(n=!1);const r=e.current[t.current];r&&(I?(ve(r.id),null==J||J.events.emit("virtualfocus",r),H&&(H.current=r)):G(r,{preventScroll:!0,sync:!(!k()||!R())&&(Ot||ce.current)}),requestAnimationFrame((()=>{const e=fe.current;e&&r&&(n||!oe.current)&&(null==r.scrollIntoView||r.scrollIntoView("boolean"==typeof e?{block:"nearest",inline:"nearest"}:e))})))}));Z((()=>{document.createElement("div").focus({get preventScroll(){return Ot=!0,!1}})}),[]),Z((()=>{d&&(n&&c?te.current&&null!=m&&(le.current=!0,ee(m)):ie.current&&(ne.current=-1,ue.current(null)))}),[d,n,c,m,ee]),Z((()=>{if(d&&n&&c)if(null==a){if(ce.current=!1,null!=m)return;if(ie.current&&(ne.current=-1,ge(s,ne)),!ie.current&&te.current&&(null!=re.current||!0===te.current&&null==re.current)){let e=0;const t=()=>{if(null==s.current[0]){if(e<2){(e?requestAnimationFrame:queueMicrotask)(t)}e++}else ne.current=null==re.current||Tt(re.current,P,E)||b?_(s,se.current):B(s,se.current),re.current=null,ee(ne.current)};t()}}else q(s,a)||(ne.current=a,ge(s,ne,le.current),le.current=!1)}),[d,n,c,a,m,b,s,P,E,ee,ge,se]),Z((()=>{var e;if(!d||c||!J||I||!ie.current)return;const t=J.nodesRef.current,n=null==(e=t.find((e=>e.id===Q)))||null==(e=e.context)?void 0:e.elements.floating,r=h(C(c)),o=t.some((e=>e.context&&y(e.context.elements.floating,r)));n&&!o&&oe.current&&n.focus({preventScroll:!0})}),[d,c,J,Q,I]),Z((()=>{if(d&&J&&I&&!Q)return J.events.on("virtualfocus",e),()=>{J.events.off("virtualfocus",e)};function e(e){pe(e.id),H&&(H.current=e)}}),[d,J,I,Q,H]),Z((()=>{ue.current=ee,ie.current=!!c})),Z((()=>{n||(re.current=null)}),[n]);const be=null!=a,we=u.useMemo((()=>{function e(e){if(!n)return;const t=s.current.indexOf(e);-1!==t&&ee(t)}return{onFocus(t){let{currentTarget:n}=t;e(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...M&&{onMouseMove(t){let{currentTarget:n}=t;e(n)},onPointerLeave(e){let{pointerType:t}=e;oe.current&&"touch"!==t&&(ne.current=-1,ge(s,ne),ee(null),I||G(o.floating.current,{preventScroll:!0}))}}}}),[n,o,ge,M,s,ee,I]);return u.useMemo((()=>{if(!d)return{};const e=se.current;function t(t){if(oe.current=!1,ce.current=!0,!ae.current&&t.currentTarget===o.floating.current)return;if(b&&St(t.key,P,E))return L(t),r(!1,t.nativeEvent,"list-navigation"),void(v(i)&&!I&&i.focus());const u=ne.current,c=_(s,e),l=B(s,e);if("Home"===t.key&&(L(t),ne.current=c,ee(ne.current)),"End"===t.key&&(L(t),ne.current=l,ee(ne.current)),D>1){const n=V||Array.from({length:s.current.length},(()=>({width:1,height:1}))),r=z(n,D,$),o=r.findIndex((t=>null!=t&&!(null!=e&&e.includes(t)))),u=r.reduce(((t,n,r)=>null==n||null!=e&&e.includes(n)?t:r),-1);if(ne.current=r[U({current:r.map((e=>null!=e?s.current[e]:null))},{event:t,orientation:P,loop:g,cols:D,disabledIndices:Y([...e||[],void 0],r),minIndex:o,maxIndex:u,prevIndex:X(ne.current,n,r,D,t.key===F?"bl":t.key===K?"tr":"tl"),stopEvent:!0})],ee(ne.current),"both"===P)return}if(Mt(t.key,P)){if(L(t),n&&!I&&h(t.currentTarget.ownerDocument)===t.currentTarget)return ne.current=Tt(t.key,P,E)?c:l,void ee(ne.current);Tt(t.key,P,E)?ne.current=g?u>=l?p&&u!==s.current.length?-1:c:W(s,{startingIndex:u,disabledIndices:e}):Math.min(l,W(s,{startingIndex:u,disabledIndices:e})):ne.current=g?u<=c?p&&-1!==u?s.current.length:l:W(s,{startingIndex:u,decrement:!0,disabledIndices:e}):Math.max(c,W(s,{startingIndex:u,decrement:!0,disabledIndices:e})),q(s,ne.current)?ee(null):ee(ne.current)}}function u(e){"auto"===O&&w(e.nativeEvent)&&(te.current=!0)}const c=I&&n&&be&&{"aria-activedescendant":me||de},l=s.current.find((e=>(null==e?void 0:e.id)===de));return{reference:{...c,onKeyDown(o){oe.current=!1;const u=0===o.key.indexOf("Arrow"),i=function(e,t,n){return Ct(t,n?e===j:e===K,e===F)}(o.key,P,E),c=St(o.key,P,E),a=Mt(o.key,P),f=(b?i:a)||"Enter"===o.key||""===o.key.trim();if(I&&n){const e=null==J?void 0:J.nodesRef.current.find((e=>null==e.parentId)),n=J&&e?function(e,t){let n,r=-1;return function t(o,u){u>r&&(n=o,r=u),We(e,o).forEach((e=>{t(e.id,u+1)}))}(t,0),e.find((e=>e.id===n))}(J.nodesRef.current,e.id):null;if(u&&n&&H){const e=new KeyboardEvent("keydown",{key:o.key,bubbles:!0});if(i||c){var d,v;const t=(null==(d=n.context)?void 0:d.elements.domReference)===o.currentTarget,r=c&&!t?null==(v=n.context)?void 0:v.elements.domReference:i?l:null;r&&(L(o),r.dispatchEvent(e),pe(void 0))}var p;if(a&&n.context)if(n.context.open&&n.parentId&&o.currentTarget!==n.context.elements.domReference)return L(o),void(null==(p=n.context.elements.domReference)||p.dispatchEvent(e))}return t(o)}(n||T||!u)&&(f&&(re.current=b&&a?null:o.key),b?i&&(L(o),n?(ne.current=_(s,e),ee(ne.current)):r(!0,o.nativeEvent,"list-navigation")):a&&(null!=m&&(ne.current=m),L(o),!n&&T?r(!0,o.nativeEvent,"list-navigation"):t(o),n&&ee(ne.current)))},onFocus(){n&&ee(null)},onPointerDown:function(e){te.current=O,"auto"===O&&x(e.nativeEvent)&&(te.current=!0)},onMouseDown:u,onClick:u},floating:{"aria-orientation":"both"===P?void 0:P,...!A(i)&&c,onKeyDown:t,onPointerMove(){oe.current=!0}},item:we}}),[i,o,de,me,se,ae,s,d,P,E,I,n,be,b,m,T,p,D,g,O,ee,r,we,J,H,V,$])},e.useMergeRefs=i,e.useRole=function(e,t){var n;void 0===t&&(t={});const{open:r,floatingId:o}=e,{enabled:i=!0,role:c="dialog"}=t,l=null!=(n=Pt.get(c))?n:c,s=de(),a=null!=he();return u.useMemo((()=>{if(!i)return{};const e={id:o,...l&&{role:l}};return"tooltip"===l||"label"===c?{reference:{["aria-"+("label"===c?"labelledby":"describedby")]:r?o:void 0},floating:e}:{reference:{"aria-expanded":r?"true":"false","aria-haspopup":"alertdialog"===l?"dialog":l,"aria-controls":r?o:void 0,..."listbox"===l&&{role:"combobox"},..."menu"===l&&{id:s},..."menu"===l&&a&&{role:"menuitem"},..."select"===c&&{"aria-autocomplete":"none"},..."combobox"===c&&{"aria-autocomplete":"list"}},floating:{...e,..."menu"===l&&{"aria-labelledby":s}},item(e){let{active:t,selected:n}=e;const r={role:"option",...t&&{id:o+"-option"}};switch(c){case"select":return{...r,"aria-selected":t&&n};case"combobox":return{...r,...t&&{"aria-selected":!0}}}return{}}}}),[i,c,l,r,o,s,a])},e.useTransitionStatus=Dt,e.useTransitionStyles=function(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:r,close:o,common:i,duration:c=250}=t,l=e.placement,s=l.split("-")[0],a=u.useMemo((()=>({side:s,placement:l})),[s,l]),f="number"==typeof c,d=(f?c:c.open)||0,v=(f?c:c.close)||0,[m,p]=u.useState((()=>({...At(i,a),...At(n,a)}))),{isMounted:g,status:h}=Dt(e,{duration:c}),y=Ee(n),b=Ee(r),E=Ee(o),w=Ee(i);return Z((()=>{const e=At(y.current,a),t=At(E.current,a),n=At(w.current,a),r=At(b.current,a)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===h&&p((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===h&&p({transitionProperty:Object.keys(r).map(Lt).join(","),transitionDuration:d+"ms",...n,...r}),"close"===h){const r=t||e;p({transitionProperty:Object.keys(r).map(Lt).join(","),transitionDuration:v+"ms",...n,...r})}}),[v,E,y,b,w,d,h,a]),{isMounted:g,styles:m}},e.useTypeahead=function(e,t){var n;const{open:r,dataRef:o}=e,{listRef:i,activeIndex:c,onMatch:s,onTypingChange:a,enabled:f=!0,findMatch:d=null,resetMs:v=750,ignoreKeys:m=[],selectedIndex:p=null}=t,g=u.useRef(),h=u.useRef(""),y=u.useRef(null!=(n=null!=p?p:c)?n:-1),b=u.useRef(null),E=l(s),w=l(a),x=Ee(d),R=Ee(m);return Z((()=>{r&&(clearTimeout(g.current),b.current=null,h.current="")}),[r]),Z((()=>{var e;r&&""===h.current&&(y.current=null!=(e=null!=p?p:c)?e:-1)}),[r,p,c]),u.useMemo((()=>{if(!f)return{};function e(e){e?o.current.typing||(o.current.typing=e,w(e)):o.current.typing&&(o.current.typing=e,w(e))}function t(e,t,n){const r=x.current?x.current(t,n):t.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(n.toLocaleLowerCase()))));return r?e.indexOf(r):-1}function n(n){const o=i.current;if(h.current.length>0&&" "!==h.current[0]&&(-1===t(o,o,h.current)?e(!1):" "===n.key&&L(n)),null==o||R.current.includes(n.key)||1!==n.key.length||n.ctrlKey||n.metaKey||n.altKey)return;r&&" "!==n.key&&(L(n),e(!0));o.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&h.current===n.key&&(h.current="",y.current=b.current),h.current+=n.key,clearTimeout(g.current),g.current=setTimeout((()=>{h.current="",y.current=b.current,e(!1)}),v);const u=y.current,c=t(o,[...o.slice((u||0)+1),...o.slice(0,(u||0)+1)],h.current);-1!==c?(E(c),b.current=c):" "!==n.key&&(h.current="",e(!1))}return{reference:{onKeyDown:n},floating:{onKeyDown:n,onKeyUp(t){" "===t.key&&e(!1)}}}}),[f,r,o,i,v,R,x,E,w])}})); |
{ | ||
"name": "@floating-ui/react", | ||
"version": "0.26.4", | ||
"version": "0.26.5", | ||
"description": "Floating UI for React", | ||
@@ -11,12 +11,11 @@ "publishConfig": { | ||
"unpkg": "./dist/floating-ui.react.umd.min.js", | ||
"types": "./src/types.d.ts", | ||
"types": "./dist/floating-ui.react.d.ts", | ||
"exports": { | ||
"./package.json": "./package.json", | ||
"./utils/package.json": "./utils/package.json", | ||
".": { | ||
"import": { | ||
"types": "./src/types.d.ts", | ||
"types": "./dist/floating-ui.react.d.mts", | ||
"default": "./dist/floating-ui.react.mjs" | ||
}, | ||
"types": "./src/types.d.ts", | ||
"types": "./dist/floating-ui.react.d.ts", | ||
"module": "./dist/floating-ui.react.esm.js", | ||
@@ -27,8 +26,8 @@ "default": "./dist/floating-ui.react.umd.js" | ||
"import": { | ||
"types": "./utils/src/index.d.ts", | ||
"default": "./utils/dist/floating-ui.react.utils.mjs" | ||
"types": "./dist/floating-ui.react.utils.d.mts", | ||
"default": "./dist/floating-ui.react.utils.mjs" | ||
}, | ||
"types": "./utils/src/index.d.ts", | ||
"module": "./utils/dist/floating-ui.react.utils.esm.js", | ||
"default": "./utils/dist/floating-ui.react.utils.umd.js" | ||
"types": "./dist/floating-ui.react.utils.d.ts", | ||
"module": "./dist/floating-ui.react.utils.esm.js", | ||
"default": "./dist/floating-ui.react.utils.umd.js" | ||
} | ||
@@ -38,13 +37,5 @@ }, | ||
"files": [ | ||
"dist/", | ||
"utils/dist/", | ||
"utils/package.json", | ||
"**/*.d.ts", | ||
"**/*.d.mts" | ||
"dist", | ||
"utils" | ||
], | ||
"scripts": { | ||
"test": "vitest", | ||
"build": "NODE_ENV=build rollup -c", | ||
"dev": "vite" | ||
}, | ||
"author": "atomiks", | ||
@@ -74,16 +65,16 @@ "license": "MIT", | ||
"dependencies": { | ||
"@floating-ui/react-dom": "^2.0.3", | ||
"@floating-ui/utils": "^0.1.5", | ||
"tabbable": "^6.0.1" | ||
"tabbable": "^6.0.1", | ||
"@floating-ui/react-dom": "^2.0.5", | ||
"@floating-ui/utils": "^0.2.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/preset-react": "^7.16.0", | ||
"@radix-ui/react-checkbox": "^1.0.2", | ||
"@radix-ui/react-icons": "^1.2.0", | ||
"@testing-library/jest-dom": "^5.16.4", | ||
"@testing-library/react": "^13.1.1", | ||
"@testing-library/react-hooks": "^7.0.2", | ||
"@testing-library/user-event": "^14.4.3", | ||
"@types/react": "^18.2.14", | ||
"@vitejs/plugin-react": "^4.2.0", | ||
"@babel/preset-react": "^7.23.3", | ||
"@radix-ui/react-checkbox": "^1.0.4", | ||
"@radix-ui/react-icons": "^1.3.0", | ||
"@testing-library/jest-dom": "^6.2.0", | ||
"@testing-library/react": "^14.1.2", | ||
"@testing-library/user-event": "^14.5.2", | ||
"@types/react": "^18.2.46", | ||
"@types/react-dom": "^18.2.18", | ||
"@vitejs/plugin-react": "^4.2.1", | ||
"clsx": "^1.2.1", | ||
@@ -93,6 +84,18 @@ "react": "^18.2.0", | ||
"react-responsive": "^9.0.2", | ||
"react-router-dom": "^6.3.0", | ||
"react-router-dom": "^6.21.1", | ||
"resize-observer-polyfill": "^1.5.1", | ||
"use-isomorphic-layout-effect": "^1.1.1" | ||
"use-isomorphic-layout-effect": "^1.1.2", | ||
"config": "0.0.0" | ||
}, | ||
"scripts": { | ||
"lint": "eslint .", | ||
"clean": "rimraf dist out-tsc utils", | ||
"test": "vitest run", | ||
"test:watch": "vitest watch", | ||
"build": "rollup -c", | ||
"build:api": "build-api --tsc tsconfig.lib.json --aec api-extractor.json --aec api-extractor.utils.json", | ||
"dev": "vite", | ||
"publint": "publint", | ||
"typecheck": "tsc -b" | ||
} | ||
} | ||
} |
{ | ||
"sideEffects": false, | ||
"main": "./dist/floating-ui.react.utils.umd.js", | ||
"module": "./dist/floating-ui.react.utils.esm.js", | ||
"types": "./src/types.d.ts" | ||
"main": "floating-ui.react.utils.umd.js", | ||
"module": "floating-ui.react.utils.esm.js", | ||
"types": "floating-ui.react.utils.d.ts" | ||
} |
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
863213
19557
14
17
23
- Removed@floating-ui/utils@0.1.6(transitive)
Updated@floating-ui/utils@^0.2.0