@react-hive/honey-layout 18.5.0 → 18.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -33,7 +33,7 @@
33
33
  min-height: ${t};
34
34
  }
35
35
  `}
36
- `,_=({ref:e,children:t,columns:n,spacing:r,columnsGrowing:i=!0,applyColumnMaxWidth:c=!1,...s})=>{const l=(0,u().useMemo)(()=>({columns:n,spacing:r,isColumnsGrowing:i,applyColumnMaxWidth:c}),[n,r,i,c]);return(0,o().jsx)(O,{value:l,children:(0,o().jsx)(S,{ref:e,spacing:r,"data-testid":"honey-grid",...s,children:t})})},j=()=>{const e=(0,u().useContext)(O);if(!e)throw new Error("The `useHoneyGridContext()` hook can only be used inside <HoneyGrid/> component!");return e},L=({children:e,...t})=>{const{columns:n,spacing:r,isColumnsGrowing:i,applyColumnMaxWidth:u}=j();return(0,o().jsx)(C,{columns:n,spacing:r,applyMaxWidth:u,$flexGrow:i?1:0,"data-testid":"honey-grid-column",...t,children:e})},k=(e,t,n)=>"function"==typeof t?t(e):"string"==typeof e||"number"==typeof e?e:t?e[t]:n,T=({children:e,loading:t=!1,loadingOverContent:n=!1,error:r=!1,empty:i=!1,loadingContent:u=null,errorContent:c=null,emptyContent:s=null})=>r?c:!n&&t?u:(0,o().jsxs)(o().Fragment,{children:[n&&t&&u,i?s:e]}),A=(0,c.styled)(E,({$overflow:e="hidden auto"})=>({$overflow:e}))``,P=({children:e,items:t,itemKey:n,loading:r,loadingOverContent:i,loadingContent:c,error:s,errorContent:l,empty:a=!1,emptyContent:f,...d})=>(0,o().jsx)(A,{role:"list","aria-busy":r,"data-testid":"honey-list",...d,children:(0,o().jsx)(T,{loading:r,loadingOverContent:i,loadingContent:c,error:s,errorContent:l,empty:a||0===t?.length,emptyContent:f,children:t?.map((t,r,i)=>(0,o().jsx)(u().Fragment,{children:e(t,r,i)},String(k(t,n,r))))})}),M=({children:e,mount:t,unmountDelay:n,alwaysMounted:r=!1,keepAfterMount:o=!1})=>{const[i,c]=(0,u().useState)(r||t),s=(0,u().useRef)(void 0);return(0,u().useLayoutEffect)(()=>{if(t&&!r)return clearTimeout(s.current),c(!0),()=>{o||(s.current=setTimeout(()=>c(!1),n))}},[t,r,n]),i?e:null};var D={551(e,t,n){var r="Expected a function",o=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,s=parseInt,l="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,a="object"==typeof self&&self&&self.Object===Object&&self,f=l||a||Function("return this")(),d=Object.prototype.toString,p=Math.max,v=Math.min,m=function(){return f.Date.now()};function h(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function y(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==d.call(e)}(e))return NaN;if(h(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=h(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(o,"");var n=u.test(e);return n||c.test(e)?s(e.slice(2),n?2:8):i.test(e)?NaN:+e}e.exports=function(e,t,n){var o=!0,i=!0;if("function"!=typeof e)throw new TypeError(r);return h(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),function(e,t,n){var o,i,u,c,s,l,a=0,f=!1,d=!1,g=!0;if("function"!=typeof e)throw new TypeError(r);function b(t){var n=o,r=i;return o=i=void 0,a=t,c=e.apply(r,n)}function x(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-a>=u}function w(){var e=m();if(x(e))return E(e);s=setTimeout(w,function(e){var n=t-(e-l);return d?v(n,u-(e-a)):n}(e))}function E(e){return s=void 0,g&&o?b(e):(o=i=void 0,c)}function R(){var e=m(),n=x(e);if(o=arguments,i=this,l=e,n){if(void 0===s)return function(e){return a=e,s=setTimeout(w,t),f?b(e):c}(l);if(d)return s=setTimeout(w,t),b(l)}return void 0===s&&(s=setTimeout(w,t)),c}return t=y(t)||0,h(n)&&(f=!!n.leading,u=(d="maxWait"in n)?p(y(n.maxWait)||0,t):u,g="trailing"in n?!!n.trailing:g),R.cancel=function(){void 0!==s&&clearTimeout(s),a=0,o=l=i=s=void 0},R.flush=function(){return void 0===s?c:E(m())},R}(e,t,{leading:o,maxWait:t,trailing:i})}}},$={};function I(e){var t=$[e];if(void 0!==t)return t.exports;var n=$[e]={exports:{}};return D[e](n,n.exports,I),n.exports}I.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return I.d(t,{a:t}),t},I.d=(e,t)=>{for(var n in t)I.o(t,n)&&!I.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},I.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),I.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const N=e=>{const t=(0,u().useRef)(e);return t.current=e,t};var H=I(551);I.n(H);var F=n(551),W=n.n(F);const z=(e,{resizeThrottle:t=0,overrideScreenState:n}={})=>{const[r,o]=(0,u().useState)(()=>({...y(e.breakpoints),...n}));return(0,u().useEffect)(()=>{const r=W()(()=>{o({...y(e.breakpoints),...n})},t);return r(),window.addEventListener("resize",r),window.screen.orientation.addEventListener("change",r),()=>{r.cancel(),window.removeEventListener("resize",r),window.screen.orientation.removeEventListener("change",r)}},[]),r},B=(0,u().createContext)(void 0),U=()=>{const e=(0,u().useContext)(B);return l(e,"[@react-hive/honey-layout]: The `useHoneyLayout()` hook must be used inside <HoneyLayoutProvider/> component."),e},K=(e,t)=>{const{registerOverlay:n,unregisterOverlay:r}=U(),o=(0,u().useRef)(null);return(0,u().useEffect)(()=>{if(!e)return;const i=n(t);return o.current=i,()=>{o.current=null,r(i.id)}},[e,t.onKeyUp]),o.current},V=()=>()=>{},q=(e,{enabled:t=!0,onKeyUp:n}={})=>{const{getOverlaysSnapshot:r,subscribeOverlays:o}=U(),i=(0,u().useCallback)(()=>t?r().find(t=>t.id===e)??null:null,[t,e]),c=(0,u().useSyncExternalStore)(t?o:V,i,i);return(0,u().useEffect)(()=>{if(c&&n)return c.addListener("keyup",n),()=>{c.removeListener("keyup",n)}},[c,n]),c},X=({ref:e,children:t,active:n,overlayId:r,onDeactivate:i,onKeyUp:c,...s})=>{const l=N(c),a=N(i),d=(0,u().useCallback)((e,...t)=>{l.current?l.current(e,...t):"Escape"===e&&a.current()},[]),v=K(n,{id:r,onKeyUp:d}),m=p(v?.setContainerRef,e);return(0,o().jsx)(E,{ref:m,inert:!n,...s,children:f(t,{overlay:v,isActive:n,deactivateOverlay:a.current})})},Y=(0,u().createContext)(void 0);function G(){return"undefined"!=typeof window}function Z(e){return ee(e)?(e.nodeName||"").toLowerCase():"#document"}function Q(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function J(e){var t;return null==(t=(ee(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function ee(e){return!!G()&&(e instanceof Node||e instanceof Q(e).Node)}function te(e){return!!G()&&(e instanceof Element||e instanceof Q(e).Element)}function ne(e){return!!G()&&(e instanceof HTMLElement||e instanceof Q(e).HTMLElement)}function re(e){return!(!G()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Q(e).ShadowRoot)}function oe(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ve(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==o&&"contents"!==o}function ie(e){return/^(table|td|th)$/.test(Z(e))}function ue(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}const ce=/transform|translate|scale|rotate|perspective|filter/,se=/paint|layout|strict|content/,le=e=>!!e&&"none"!==e;let ae;function fe(e){const t=te(e)?ve(e):e;return le(t.transform)||le(t.translate)||le(t.scale)||le(t.rotate)||le(t.perspective)||!de()&&(le(t.backdropFilter)||le(t.filter))||ce.test(t.willChange||"")||se.test(t.contain||"")}function de(){return null==ae&&(ae="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ae}function pe(e){return/^(html|body|#document)$/.test(Z(e))}function ve(e){return Q(e).getComputedStyle(e)}function me(e){return te(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function he(e){if("html"===Z(e))return e;const t=e.assignedSlot||e.parentNode||re(e)&&e.host||J(e);return re(t)?t.host:t}function ye(e){const t=he(e);return pe(t)?(e.ownerDocument||e).body:ne(t)&&oe(t)?t:ye(t)}function ge(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=ye(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),u=Q(o);if(i){const e=be(u);return t.concat(u,u.visualViewport||[],oe(o)?o:[],e&&n?ge(e):[])}return t.concat(o,ge(o,[],n))}function be(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var xe=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","area[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"].join(","),we="undefined"==typeof Element,Ee=we?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Re=!we&&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},Oe=function(e,t){var n;void 0===t&&(t=!0);var r=null==e||null===(n=e.getAttribute)||void 0===n?void 0:n.call(e,"inert");return""===r||"true"===r||t&&e&&("function"==typeof e.closest?e.closest("[inert]"):Oe(e.parentNode))},Ce=function(e,t,n){if(Oe(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(xe));return t&&Ee.call(e,xe)&&r.unshift(e),r.filter(n)},Se=function(e,t,n){for(var r=[],o=Array.from(e);o.length;){var i=o.shift();if(!Oe(i,!1))if("SLOT"===i.tagName){var u=i.assignedElements(),c=u.length?u:i.children,s=Se(c,!0,n);n.flatten?r.push.apply(r,s):r.push({scopeParent:i,candidates:s})}else{Ee.call(i,xe)&&n.filter(i)&&(t||!e.includes(i))&&r.push(i);var l=i.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(i),a=!Oe(l,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(i));if(l&&a){var f=Se(!0===l?i.children:l.children,!0,n);n.flatten?r.push.apply(r,f):r.push({scopeParent:i,candidates:f})}else o.unshift.apply(o,i.children)}}return r},_e=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},je=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))&&!_e(e)?0:e.tabIndex},Le=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},ke=function(e){return"INPUT"===e.tagName},Te=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Ae=function(e,t){return!(t.disabled||function(e){return ke(e)&&"hidden"===e.type}(t)||function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("full-native"===n&&"checkVisibility"in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});var o=getComputedStyle(e).visibility;if("hidden"===o||"collapse"===o)return!0;var i=Ee.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Ee.call(i,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"full-native"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Te(e)}else{if("function"==typeof r){for(var u=e;e;){var c=e.parentElement,s=Re(e);if(c&&!c.shadowRoot&&!0===r(c))return Te(e);e=e.assignedSlot?e.assignedSlot:c||s===e.ownerDocument?c:s.host}e=u}if(function(e){var t,n,r,o,i=e&&Re(e),u=null===(t=i)||void 0===t?void 0:t.host,c=!1;if(i&&i!==e)for(c=!!(null!==(n=u)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(u)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!c&&u;){var s,l,a;c=!(null===(l=u=null===(s=i=Re(u))||void 0===s?void 0:s.host)||void 0===l||null===(a=l.ownerDocument)||void 0===a||!a.contains(u))}return c}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1}(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!!Ee.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Pe=function(e,t){return!(function(e){return function(e){return ke(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Re(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)}(t)||je(t)<0||!Ae(e,t))},Me=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},De=function(e){var t=[],n=[];return e.forEach(function(e,r){var o=!!e.scopeParent,i=o?e.scopeParent:e,u=function(e,t){var n=je(e);return n<0&&t&&!_e(e)?0:n}(i,o),c=o?De(e.candidates):i;0===u?o?t.push.apply(t,c):t.push(i):n.push({documentOrder:r,tabIndex:u,item:e,isScope:o,content:c})}),n.sort(Le).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},$e=function(e,t){var n;return n=(t=t||{}).getShadowRoot?Se([e],t.includeContainer,{filter:Pe.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Me}):Ce(e,t.includeContainer,Pe.bind(null,t)),De(n)},Ie=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Ee.call(e,xe)&&Pe(t,e)};function Ne(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function He(){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 Fe(){return/apple/i.test(navigator.vendor)}function We(){const e=/android/i;return e.test(Ne())||e.test(He())}function ze(){return He().includes("jsdom/")}const Be="data-floating-ui-focusable";function Ue(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 Ke(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&re(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Ve(e){return"composedPath"in e?e.composedPath()[0]:e.target}function qe(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 Xe(e){return(null==e?void 0:e.ownerDocument)||document}function Ye(e){return ne(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function Ge(e){return!!e&&"combobox"===e.getAttribute("role")&&Ye(e)}function Ze(e){return e?e.hasAttribute(Be)?e:e.querySelector("["+Be+"]")||e:null}function Qe(e,t,n){return void 0===n&&(n=!0),e.filter(e=>{var r;return e.parentId===t&&(!n||(null==(r=e.context)?void 0:r.open))}).flatMap(t=>[t,...Qe(e,t.id,n)])}function Je(e,t){var n;let r=[],o=null==(n=e.find(e=>e.id===t))?void 0:n.parentId;for(;o;){const t=e.find(e=>e.id===o);o=null==t?void 0:t.parentId,t&&(r=r.concat(t))}return r}function et(e){e.preventDefault(),e.stopPropagation()}function tt(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var nt="undefined"!=typeof document?u().useLayoutEffect:function(){};function rt(e){const t=u().useRef(e);return nt(()=>{t.current=e}),t}const ot={...R()}.useInsertionEffect||(e=>e());function it(e){const t=u().useRef(()=>{});return ot(()=>{t.current=e}),u().useCallback(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}const ut=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function ct(e,t){const n=$e(e,ut()),r=n.length;if(0===r)return;const o=Ue(Xe(e)),i=n.indexOf(o);return n[-1===i?1===t?0:r-1:i+t]}function st(e){return ct(Xe(e).body,1)||e}function lt(e){return ct(Xe(e).body,-1)||e}function at(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Ke(n,r)}function ft(e){$e(e,ut()).forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")})}function dt(e){e.querySelectorAll("[data-tabindex]").forEach(e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")})}t();const pt=["start","end"],vt=["top","right","bottom","left"].reduce((e,t)=>e.concat(t,t+"-"+pt[0],t+"-"+pt[1]),[]),mt=Math.min,ht=Math.max,yt=Math.round,gt=Math.floor,bt=e=>({x:e,y:e}),xt={left:"right",right:"left",bottom:"top",top:"bottom"};function wt(e,t,n){return ht(e,mt(t,n))}function Et(e,t){return"function"==typeof e?e(t):e}function Rt(e){return e.split("-")[0]}function Ot(e){return e.split("-")[1]}function Ct(e){return"x"===e?"y":"x"}function St(e){return"y"===e?"height":"width"}function _t(e){const t=e[0];return"t"===t||"b"===t?"y":"x"}function jt(e){return Ct(_t(e))}function Lt(e,t,n){void 0===n&&(n=!1);const r=Ot(e),o=jt(e),i=St(o);let u="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(u=Dt(u)),[u,Dt(u)]}function kt(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Tt=["left","right"],At=["right","left"],Pt=["top","bottom"],Mt=["bottom","top"];function Dt(e){const t=Rt(e);return xt[t]+e.slice(t.length)}function $t(e){return"number"!=typeof e?function(e){var t,n,r,o;return{top:null!=(t=e.top)?t:0,right:null!=(n=e.right)?n:0,bottom:null!=(r=e.bottom)?r:0,left:null!=(o=e.left)?o:0}}(e):{top:e,right:e,bottom:e,left:e}}function It(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Nt(e,t,n){let{reference:r,floating:o}=e;const i=_t(t),u=jt(t),c=St(u),s=Rt(t),l="y"===i,a=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let p;switch(s){case"top":p={x:a,y:r.y-o.height};break;case"bottom":p={x:a,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}const v=Ot(t);return v&&(p[u]+=d*("end"===v?1:-1)*(n&&l?-1:1)),p}async function Ht(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:u,elements:c,strategy:s}=e,{boundary:l="clippingAncestors",rootBoundary:a="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=Et(t,e),v=$t(p),m=c[d?"floating"===f?"reference":"floating":f],h=It(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(c.floating)),boundary:l,rootBoundary:a,strategy:s})),y="floating"===f?{x:r,y:o,width:u.floating.width,height:u.floating.height}:u.reference,g=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c.floating)),b=await(null==i.isElement?void 0:i.isElement(g))&&await(null==i.getScale?void 0:i.getScale(g))||{x:1,y:1},x=It(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:g,strategy:s}):y);return{top:(h.top-x.top+v.top)/b.y,bottom:(x.bottom-h.bottom+v.bottom)/b.y,left:(h.left-x.left+v.left)/b.x,right:(x.right-h.right+v.right)/b.x}}const Ft=new Set(["left","top"]);function Wt(e){const t=ve(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=ne(e),i=o?e.offsetWidth:n,u=o?e.offsetHeight:r,c=yt(n)!==i||yt(r)!==u;return c&&(n=i,r=u),{width:n,height:r,$:c}}function zt(e){return te(e)?e:e.contextElement}function Bt(e){const t=zt(e);if(!ne(t))return bt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Wt(t);let u=(i?yt(n.width):n.width)/r,c=(i?yt(n.height):n.height)/o;return u&&Number.isFinite(u)||(u=1),c&&Number.isFinite(c)||(c=1),{x:u,y:c}}const Ut=bt(0);function Kt(e){const t=Q(e);return de()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Ut}function Vt(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=zt(e);let u=bt(1);t&&(r?te(r)&&(u=Bt(r)):u=Bt(e));const c=function(e,t,n){return void 0===t&&(t=!1),!!n&&t&&n===Q(e)}(i,n,r)?Kt(i):bt(0);let s=(o.left+c.x)/u.x,l=(o.top+c.y)/u.y,a=o.width/u.x,f=o.height/u.y;if(i&&r){const e=Q(i),t=te(r)?Q(r):r;let n=e,o=be(n);for(;o&&t!==n;){const e=Bt(o),t=o.getBoundingClientRect(),r=ve(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,u=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,l*=e.y,a*=e.x,f*=e.y,s+=i,l+=u,n=Q(o),o=be(n)}}return It({width:a,height:f,x:s,y:l})}function qt(e,t){const n=me(e).scrollLeft;return t?t.left+n:Vt(J(e)).left+n}function Xt(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-qt(e,n),y:n.top+t.scrollTop}}function Yt(e,t,n){let r;if("viewport"===t||"layoutViewport"===t)r=function(e,t,n){void 0===n&&(n="viewport");const r="layoutViewport"===n,o=Q(e),i=J(e),u=o.visualViewport;let c=i.clientWidth,s=i.clientHeight,l=0,a=0;if(u){const e=!de()||"fixed"===t;r?e||(l=-u.offsetLeft,a=-u.offsetTop):(c=u.width,s=u.height,e&&(l=u.offsetLeft,a=u.offsetTop))}if(qt(i)<=0){const e=i.ownerDocument,t=e.body,n=getComputedStyle(t),r="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(i.clientWidth-t.clientWidth-r),u="stable both-edges"===getComputedStyle(i).scrollbarGutter?o/2:o;u<=25&&(c-=u)}return{width:c,height:s,x:l,y:a}}(e,n,t);else if("document"===t)r=function(e){const t=me(e),n=e.ownerDocument.body,r=ht(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=ht(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+qt(e);const u=-t.scrollTop;return"rtl"===ve(n).direction&&(i+=ht(e.clientWidth,n.clientWidth)-r),{width:r,height:o,x:i,y:u}}(J(e));else if(te(t))r=function(e,t){const n=Vt(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Bt(e);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=Kt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return It(r)}function Gt(e,t,n){const r=ne(t),o=J(t),i="fixed"===n,u=Vt(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const s=bt(0);if((r||!i)&&(("body"!==Z(t)||oe(o))&&(c=me(t)),r)){const e=Vt(t,!0,i,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}!r&&o&&(s.x=qt(o));const l=!o||r||i?bt(0):Xt(o,c);return{x:u.left+c.scrollLeft-s.x-l.x,y:u.top+c.scrollTop-s.y-l.y,width:u.width,height:u.height}}function Zt(e){return"static"===ve(e).position}function Qt(e,t){if(!ne(e)||"fixed"===ve(e).position)return null;if(t)return t(e);let n=e.offsetParent;return J(e)===n&&(n=n.ownerDocument.body),n}function Jt(e,t){const n=Q(e);if(ue(e))return n;if(!ne(e)){let t=he(e);for(;t&&!pe(t);){if(te(t)&&!Zt(t))return t;t=he(t)}return n}let r=Qt(e,t);for(;r&&ie(r)&&Zt(r);)r=Qt(r,t);return r&&pe(r)&&Zt(r)&&!fe(r)?n:r||function(e){let t=he(e);for(;ne(t)&&!pe(t);){if(fe(t))return t;if(ue(t))return null;t=he(t)}return null}(e)||n}const en={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,u=J(r),c=!!t&&ue(t.floating);if(r===u||c&&i)return n;let s={scrollLeft:0,scrollTop:0},l=bt(1);const a=bt(0),f=ne(r);if((f||!i)&&(("body"!==Z(r)||oe(u))&&(s=me(r)),f)){const e=Vt(r);l=Bt(r),a.x=e.x+r.clientLeft,a.y=e.y+r.clientTop}const d=!u||f||i?bt(0):Xt(u,s);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-s.scrollLeft*l.x+a.x+d.x,y:n.y*l.y-s.scrollTop*l.y+a.y+d.y}},getDocumentElement:J,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?ue(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=ge(e,[],!1).filter(e=>te(e)&&"body"!==Z(e)),o=null;const i="fixed"===ve(e).position;let u=i?he(e):e;for(;te(u)&&!pe(u);){const e=ve(u),t=fe(u),n=o?o.position:i?"fixed":"";t||"fixed"!==n&&("absolute"!==n||"static"!==e.position)?o=e:r=r.filter(e=>e!==u),u=he(u)}return t.set(e,r),r}(t,this._c):[].concat(n),r],u=Yt(t,i[0],o);let c=u.top,s=u.right,l=u.bottom,a=u.left;for(let e=1;e<i.length;e++){const n=Yt(t,i[e],o);c=ht(n.top,c),s=mt(n.right,s),l=mt(n.bottom,l),a=ht(n.left,a)}return{width:s-a,height:l-c,x:a,y:c}},getOffsetParent:Jt,getElementRects:async function(e){const t=this.getOffsetParent||Jt,n=this.getDimensions,r=await n(e.floating);return{reference:Gt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return e.getClientRects?Array.from(e.getClientRects()):[]},getDimensions:function(e){const{width:t,height:n}=Wt(e);return{width:t,height:n}},getScale:Bt,isElement:te,isRTL:function(e){return"rtl"===ve(e).direction}};function tn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}const nn=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:u,initialPlacement:c,platform:s,elements:l}=t,{mainAxis:a=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:m=!0,...h}=Et(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const y=Rt(o),g=_t(c),b=Rt(c)===c,x=await(null==s.isRTL?void 0:s.isRTL(l.floating)),w=d||(b||!m?[Dt(c)]:function(e){const t=Dt(e);return[kt(e),t,kt(t)]}(c)),E="none"!==v;!d&&E&&w.push(...function(e,t,n,r){const o=Ot(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?At:Tt:t?Tt:At;case"left":case"right":return t?Pt:Mt;default:return[]}}(Rt(e),"start"===n,r);return o&&(i=i.map(e=>e+"-"+o),t&&(i=i.concat(i.map(kt)))),i}(c,m,v,x));const R=[c,...w],O=await s.detectOverflow(t,h),C=[];let S=(null==(r=i.flip)?void 0:r.overflows)||[];if(a&&C.push(O[y]),f){const e=Lt(o,u,x);C.push(O[e[0]],O[e[1]])}if(S=[...S,{placement:o,overflows:C}],!C.every(e=>e<=0)){var _,j;const e=((null==(_=i.flip)?void 0:_.index)||0)+1,t=R[e];if(t&&("alignment"!==f||g===_t(t)||S.every(e=>_t(e.placement)!==g||e.overflows[0]>0)))return{data:{index:e,overflows:S},reset:{placement:t}};let n=null==(j=S.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:j.placement;if(!n)switch(p){case"bestFit":{var L;const e=null==(L=S.filter(e=>{if(E){const t=_t(e.placement);return t===g||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:L[0];e&&(n=e);break}case"initialPlacement":n=c}if(o!==n)return{reset:{placement:n}}}return{}}}},rn=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:u,elements:c,middlewareData:s}=t,{element:l,padding:a=0}=Et(e,t)||{};if(null==l)return{};const f=$t(a),d={x:n,y:r},p=jt(o),v=St(p),m=await u.getDimensions(l),h="y"===p,y=h?"top":"left",g=h?"bottom":"right",b=h?"clientHeight":"clientWidth",x=i.reference[v]+i.reference[p]-d[p]-i.floating[v],w=d[p]-i.reference[p],E=await(null==u.getOffsetParent?void 0:u.getOffsetParent(l));let R=E?E[b]:0;R&&await(null==u.isElement?void 0:u.isElement(E))||(R=c.floating[b]||i.floating[v]);const O=x/2-w/2,C=R/2-m[v]/2-1,S=mt(f[y],C),_=mt(f[g],C),j=R-m[v]-_,L=R/2-m[v]/2+O,k=wt(S,L,j),T=!s.arrow&&null!=Ot(o)&&L!==k&&i.reference[v]/2-(L<S?S:_)-m[v]/2<0,A=T?L<S?L-S:L-j:0;return{[p]:d[p]+A,data:{[p]:k,centerOffset:L-k-A,...T&&{alignmentOffset:A}},reset:T}}}),on=(e,t,n)=>{const r=new Map,o=null!=n?n:{},i={...en,...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:u}=n,c=u.detectOverflow?u:{...u,detectOverflow:Ht},s=await(null==u.isRTL?void 0:u.isRTL(t));let l=await u.getElementRects({reference:e,floating:t,strategy:o}),{x:a,y:f}=Nt(l,r,s),d=r,p=0;const v={};for(let n=0;n<i.length;n++){const m=i[n];if(!m)continue;const{name:h,fn:y}=m,{x:g,y:b,data:x,reset:w}=await y({x:a,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:v,rects:l,platform:c,elements:{reference:e,floating:t}});a=null!=g?g:a,f=null!=b?b:f,v[h]={...v[h],...x},w&&p<50&&(p++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(l=!0===w.rects?await u.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:a,y:f}=Nt(l,d,s))),n=-1)}return{x:a,y:f,placement:d,strategy:o,middlewareData:v}})(e,t,{...o,platform:i})};var un="undefined"!=typeof document?u().useLayoutEffect:function(){};function cn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!cn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!==r--;){const n=o[r];if(!("_owner"===n&&e.$$typeof||cn(e[n],t[n])))return!1}return!0}return e!=e&&t!=t}function sn(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ln(e,t){const n=sn(e);return Math.round(t*n)/n}function an(e){const t=u().useRef(e);return un(()=>{t.current=e}),t}const fn="data-floating-ui-focusable",dn="active",pn="selected",vn={...R()};let mn=!1,hn=0;const yn=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+hn++,gn=vn.useId||function(){const[e,t]=u().useState(()=>mn?yn():void 0);return nt(()=>{null==e&&t(yn())},[]),u().useEffect(()=>{mn=!0},[]),e},bn=u().forwardRef(function(e,t){const{context:{placement:n,elements:{floating:r},middlewareData:{arrow:i,shift:c}},width:s=14,height:l=7,tipRadius:a=0,strokeWidth:f=0,staticOffset:d,stroke:p,d:v,style:{transform:m,...h}={},...y}=e,g=gn(),[b,x]=u().useState(!1);if(nt(()=>{r&&"rtl"===ve(r).direction&&x(!0)},[r]),!r)return null;const[w,E]=n.split("-"),R="top"===w||"bottom"===w;let O=d;(R&&null!=c&&c.x||!R&&null!=c&&c.y)&&(O=null);const C=2*f,S=C/2,_=s/2*(a/-8+1),j=l/2*a/4,L=!!v,k=O&&"end"===E?"bottom":"top";let T=O&&"end"===E?"right":"left";O&&b&&(T="end"===E?"left":"right");const A=null!=(null==i?void 0:i.x)?O||i.x:"",P=null!=(null==i?void 0:i.y)?O||i.y:"",M=v||"M0,0 H"+s+" L"+(s-_)+","+(l-j)+" Q"+s/2+","+l+" "+_+","+(l-j)+" Z",D={top:L?"rotate(180deg)":"",left:L?"rotate(90deg)":"rotate(-90deg)",bottom:L?"":"rotate(180deg)",right:L?"rotate(-90deg)":"rotate(90deg)"}[w];return(0,o().jsxs)("svg",{...y,"aria-hidden":!0,ref:t,width:L?s:s+C,height:s,viewBox:"0 0 "+s+" "+(l>s?l:s),style:{position:"absolute",pointerEvents:"none",[T]:A,[k]:P,[w]:R||L?"100%":"calc(100% - "+C/2+"px)",transform:[D,m].filter(e=>!!e).join(" "),...h},children:[C>0&&(0,o().jsx)("path",{clipPath:"url(#"+g+")",fill:"none",stroke:p,strokeWidth:C+(v?0:1),d:M}),(0,o().jsx)("path",{stroke:C&&!v?y.fill:"none",d:M}),(0,o().jsx)("clipPath",{id:g,children:(0,o().jsx)("rect",{x:-S,y:S*(L?-1:1),width:s+C,height:s})})]})});function xn(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;null==(r=e.get(t))||r.delete(n)}}}const wn=u().createContext(null),En=u().createContext(null),Rn=()=>{var e;return(null==(e=u().useContext(wn))?void 0:e.id)||null},On=()=>u().useContext(En);function Cn(e){const{children:t,id:n}=e,r=Rn();return(0,o().jsx)(wn.Provider,{value:u().useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Sn(e){const{children:t}=e,n=u().useRef([]),r=u().useCallback(e=>{n.current=[...n.current,e]},[]),i=u().useCallback(e=>{n.current=n.current.filter(t=>t!==e)},[]),[c]=u().useState(()=>xn());return(0,o().jsx)(En.Provider,{value:u().useMemo(()=>({nodesRef:n,addNode:r,removeNode:i,events:c}),[r,i,c]),children:t})}function _n(e){return"data-floating-ui-"+e}function jn(e){-1!==e.current&&(clearTimeout(e.current),e.current=-1)}const Ln=_n("safe-polygon");function kn(e,t,n){if(n&&!tt(n))return 0;if("number"==typeof e)return e;if("function"==typeof e){const n=e();return"number"==typeof n?n:null==n?void 0:n[t]}return null==e?void 0:e[t]}function Tn(e){return"function"==typeof e?e():e}let An=0;function Pn(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(An);const i=()=>null==e?void 0:e.focus({preventScroll:n});o?i():An=requestAnimationFrame(i)}function Mn(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&re(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}const Dn={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function $n(e){return"inert"===e?Dn.inert:"aria-hidden"===e?Dn["aria-hidden"]:Dn.none}let In=new WeakSet,Nn={},Hn=0;function Fn(e){return e?re(e)?e.host:Fn(e.parentNode):null}const Wn=(e,t)=>t.map(t=>{if(e.contains(t))return t;const n=Fn(t);return e.contains(n)?n:null}).filter(e=>null!=e);function zn(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=(o=e[0],(null==o?void 0:o.ownerDocument)||document).body;var o;return function(e,t,n,r){const o="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,u=Wn(t,e),c=new Set,s=new Set(u),l=[];Nn[o]||(Nn[o]=new WeakMap);const a=Nn[o];return u.forEach(function e(t){t&&!c.has(t)&&(c.add(t),t.parentNode&&e(t.parentNode))}),function e(t){t&&!s.has(t)&&[].forEach.call(t.children,t=>{if("script"!==Z(t))if(c.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,r=$n(i),u=(r.get(t)||0)+1,c=(a.get(t)||0)+1;r.set(t,u),a.set(t,c),l.push(t),1===u&&n&&In.add(t),1===c&&t.setAttribute(o,""),!n&&i&&t.setAttribute(i,"inert"===i?"":"true")}})}(t),c.clear(),Hn++,()=>{l.forEach(e=>{const t=$n(i),n=(t.get(e)||0)-1,r=(a.get(e)||0)-1;t.set(e,n),a.set(e,r),n||(!In.has(e)&&i&&e.removeAttribute(i),In.delete(e)),r||e.removeAttribute(o)}),Hn--,Hn||(Dn.inert=new WeakMap,Dn["aria-hidden"]=new WeakMap,Dn.none=new WeakMap,In=new WeakSet,Nn={})}}(e.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))),r,t,n)}const Bn={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},Un=u().forwardRef(function(e,t){const[n,r]=u().useState();nt(()=>{Fe()&&r("button")},[]);const i={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[_n("focus-guard")]:"",style:Bn};return(0,o().jsx)("span",{...e,...i})}),Kn={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Vn=u().createContext(null),qn=_n("portal");function Xn(t){const{children:n,id:r,root:i,preserveTabOrder:c=!0}=t,s=function(e){void 0===e&&(e={});const{id:t,root:n}=e,r=gn(),o=Yn(),[i,c]=u().useState(null),s=u().useRef(null);return nt(()=>()=>{null==i||i.remove(),queueMicrotask(()=>{s.current=null})},[i]),nt(()=>{if(!r)return;if(s.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=r,n.setAttribute(qn,""),e.appendChild(n),s.current=n,c(n)},[t,r]),nt(()=>{if(null===n)return;if(!r)return;if(s.current)return;let e=n||(null==o?void 0:o.portalNode);e&&!ee(e)&&(e=e.current),e=e||document.body;let i=null;t&&(i=document.createElement("div"),i.id=t,e.appendChild(i));const u=document.createElement("div");u.id=r,u.setAttribute(qn,""),e=i||e,e.appendChild(u),s.current=u,c(u)},[t,n,r,o]),i}({id:r,root:i}),[l,a]=u().useState(null),f=u().useRef(null),d=u().useRef(null),p=u().useRef(null),v=u().useRef(null),m=null==l?void 0:l.modal,h=null==l?void 0:l.open,y=!!l&&!l.modal&&l.open&&c&&!(!i&&!s);return u().useEffect(()=>{if(s&&c&&!m)return s.addEventListener("focusin",e,!0),s.addEventListener("focusout",e,!0),()=>{s.removeEventListener("focusin",e,!0),s.removeEventListener("focusout",e,!0)};function e(e){s&&at(e)&&("focusin"===e.type?dt:ft)(s)}},[s,c,m]),u().useEffect(()=>{s&&(h||dt(s))},[h,s]),(0,o().jsxs)(Vn.Provider,{value:u().useMemo(()=>({preserveTabOrder:c,beforeOutsideRef:f,afterOutsideRef:d,beforeInsideRef:p,afterInsideRef:v,portalNode:s,setFocusManagerState:a}),[c,s]),children:[y&&s&&(0,o().jsx)(Un,{"data-type":"outside",ref:f,onFocus:e=>{if(at(e,s)){var t;null==(t=p.current)||t.focus()}else{const e=lt(l?l.domReference:null);null==e||e.focus()}}}),y&&s&&(0,o().jsx)("span",{"aria-owns":s.id,style:Kn}),s&&e().createPortal(n,s),y&&s&&(0,o().jsx)(Un,{"data-type":"outside",ref:d,onFocus:e=>{if(at(e,s)){var t;null==(t=v.current)||t.focus()}else{const t=st(l?l.domReference:null);null==t||t.focus(),(null==l?void 0:l.closeOnFocusOut)&&(null==l||l.onOpenChange(!1,e.nativeEvent,"focus-out"))}}})]})}const Yn=()=>u().useContext(Vn);function Gn(e){return u().useMemo(()=>t=>{e.forEach(e=>{e&&(e.current=t)})},e)}let Zn=[];function Qn(){Zn=Zn.filter(e=>{var t;return null==(t=e.deref())?void 0:t.isConnected})}function Jn(){Qn();const e=Zn[Zn.length-1];return null==e?void 0:e.deref()}function er(e,t){var n;if(!(t.current.includes("floating")||null!=(n=e.getAttribute("role"))&&n.includes("dialog")))return;const r=ut(),o=function(e,t){return(t=t||{}).getShadowRoot?Se([e],t.includeContainer,{filter:Ae.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):Ce(e,t.includeContainer,Ae.bind(null,t))}(e,r),i=o.filter(e=>{const t=e.getAttribute("data-tabindex")||"";return Ie(e,r)||e.hasAttribute("data-tabindex")&&!t.startsWith("-")}),u=e.getAttribute("tabindex");t.current.includes("floating")||0===i.length?"0"!==u&&e.setAttribute("tabindex","0"):("-1"!==u||e.hasAttribute("data-tabindex")&&"-1"!==e.getAttribute("data-tabindex"))&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}const tr=u().forwardRef(function(e,t){return(0,o().jsx)("button",{...e,type:"button",ref:t,tabIndex:-1,style:Bn})});function nr(e){const{context:t,children:n,disabled:r=!1,order:i=["content"],guards:c=!0,initialFocus:s=0,returnFocus:l=!0,restoreFocus:a=!1,modal:f=!0,visuallyHiddenDismiss:d=!1,closeOnFocusOut:p=!0,outsideElementsInert:v=!1,getInsideElements:m=()=>[]}=e,{open:h,onOpenChange:y,events:g,dataRef:b,elements:{domReference:x,floating:w}}=t,E=it(()=>{var e;return null==(e=b.current.floatingContext)?void 0:e.nodeId}),R=it(m),O="number"==typeof s&&s<0,C=Ge(x)&&O,S="undefined"!=typeof HTMLElement&&"inert"in HTMLElement.prototype,_=!S||c,j=!_||S&&v,L=rt(i),k=rt(s),T=rt(l),A=On(),P=Yn(),M=u().useRef(null),D=u().useRef(null),$=u().useRef(!1),I=u().useRef(!1),N=u().useRef(-1),H=u().useRef(-1),F=null!=P,W=Ze(w),z=it(function(e){return void 0===e&&(e=W),e?$e(e,ut()):[]}),B=it(e=>{const t=z(e);return L.current.map(e=>x&&"reference"===e?x:W&&"floating"===e?W:t).filter(Boolean).flat()});u().useEffect(()=>{if(r)return;if(!f)return;function e(e){if("Tab"===e.key){Ke(W,Ue(Xe(W)))&&0===z().length&&!C&&et(e);const t=B(),n=Ve(e);"reference"===L.current[0]&&n===x&&(et(e),e.shiftKey?Pn(t[t.length-1]):Pn(t[1])),"floating"===L.current[1]&&n===W&&e.shiftKey&&(et(e),Pn(t[0]))}}const t=Xe(W);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}},[r,x,W,f,L,C,z,B]),u().useEffect(()=>{if(!r&&w)return w.addEventListener("focusin",e),()=>{w.removeEventListener("focusin",e)};function e(e){const t=Ve(e),n=z().indexOf(t);-1!==n&&(N.current=n)}},[r,w,z]),u().useEffect(()=>{if(r)return;if(!p)return;function e(){I.current=!0,setTimeout(()=>{I.current=!1})}function t(e){const t=e.relatedTarget,n=e.currentTarget,r=Ve(e);queueMicrotask(()=>{const o=E(),i=!(Ke(x,t)||Ke(w,t)||Ke(t,w)||Ke(null==P?void 0:P.portalNode,t)||null!=t&&t.hasAttribute(_n("focus-guard"))||A&&(Qe(A.nodesRef.current,o).find(e=>{var n,r;return Ke(null==(n=e.context)?void 0:n.elements.floating,t)||Ke(null==(r=e.context)?void 0:r.elements.domReference,t)})||Je(A.nodesRef.current,o).find(e=>{var n,r,o;return[null==(n=e.context)?void 0:n.elements.floating,Ze(null==(r=e.context)?void 0:r.elements.floating)].includes(t)||(null==(o=e.context)?void 0:o.elements.domReference)===t})));if(n===x&&W&&er(W,L),a&&n!==x&&(null==r||!r.isConnected)&&Ue(Xe(W))===Xe(W).body){ne(W)&&W.focus();const e=N.current,t=z(),n=t[e]||t[t.length-1]||W;ne(n)&&n.focus()}b.current.insideReactTree?b.current.insideReactTree=!1:!C&&f||!t||!i||I.current||t===Jn()||($.current=!0,y(!1,e,"focus-out"))})}const n=Boolean(!A&&P);function o(){jn(H),b.current.insideReactTree=!0,H.current=window.setTimeout(()=>{b.current.insideReactTree=!1})}return w&&ne(x)?(x.addEventListener("focusout",t),x.addEventListener("pointerdown",e),w.addEventListener("focusout",t),n&&w.addEventListener("focusout",o,!0),()=>{x.removeEventListener("focusout",t),x.removeEventListener("pointerdown",e),w.removeEventListener("focusout",t),n&&w.removeEventListener("focusout",o,!0)}):void 0},[r,x,w,W,f,A,P,y,p,a,z,C,E,L,b]);const U=u().useRef(null),K=u().useRef(null),V=Gn([U,null==P?void 0:P.beforeInsideRef]),q=Gn([K,null==P?void 0:P.afterInsideRef]);function X(e){return!r&&d&&f?(0,o().jsx)(tr,{ref:"start"===e?M:D,onClick:e=>y(!1,e.nativeEvent),children:"string"==typeof d?d:"Dismiss"}):null}u().useEffect(()=>{var e,t;if(r)return;if(!w)return;const n=Array.from((null==P||null==(e=P.portalNode)?void 0:e.querySelectorAll("["+_n("portal")+"]"))||[]),o=null==(t=(A?Je(A.nodesRef.current,E()):[]).find(e=>{var t;return Ge((null==(t=e.context)?void 0:t.elements.domReference)||null)}))||null==(t=t.context)?void 0:t.elements.domReference,i=[w,o,...n,...R(),M.current,D.current,U.current,K.current,null==P?void 0:P.beforeOutsideRef.current,null==P?void 0:P.afterOutsideRef.current,L.current.includes("reference")||C?x:null].filter(e=>null!=e),u=f||C?zn(i,!j,j):zn(i);return()=>{u()}},[r,x,w,f,L,P,C,_,j,A,E,R]),nt(()=>{if(r||!ne(W))return;const e=Ue(Xe(W));queueMicrotask(()=>{const t=B(W),n=k.current,r=("number"==typeof n?t[n]:n.current)||W,o=Ke(W,e);O||o||!h||Pn(r,{preventScroll:r===W})})},[r,h,W,O,B,k]),nt(()=>{if(r||!W)return;const e=Xe(W);var t;function n(e){let{reason:t,event:n,nested:r}=e;if(["hover","safe-polygon"].includes(t)&&"mouseleave"===n.type&&($.current=!0),"outside-press"===t)if(r)$.current=!1;else if(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(We()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}(n)||function(e){return!ze()&&(!We()&&0===e.width&&0===e.height||We()&&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)}(n))$.current=!1;else{let e=!1;document.createElement("div").focus({get preventScroll(){return e=!0,!1}}),$.current=!e}}t=Ue(e),Qn(),t&&"body"!==Z(t)&&(Zn.push(new WeakRef(t)),Zn.length>20&&(Zn=Zn.slice(-20))),g.on("openchange",n);const o=e.createElement("span");return o.setAttribute("tabindex","-1"),o.setAttribute("aria-hidden","true"),Object.assign(o.style,Bn),F&&x&&x.insertAdjacentElement("afterend",o),()=>{g.off("openchange",n);const t=Ue(e),r=Ke(w,t)||A&&Qe(A.nodesRef.current,E(),!1).some(e=>{var n;return Ke(null==(n=e.context)?void 0:n.elements.floating,t)}),i=function(){if("boolean"==typeof T.current){const e=x||Jn();return e&&e.isConnected?e:o}return T.current.current||o}();queueMicrotask(()=>{const n=function(e){const t=ut();return Ie(e,t)?e:$e(e,t)[0]||e}(i);T.current&&!$.current&&ne(n)&&(n===t||t===e.body||r)&&n.focus({preventScroll:!0}),o.remove()})}},[r,w,W,T,b,g,A,F,x,E]),u().useEffect(()=>(queueMicrotask(()=>{$.current=!1}),()=>{queueMicrotask(Qn)}),[r]),nt(()=>{if(!r&&P)return P.setFocusManagerState({modal:f,closeOnFocusOut:p,open:h,onOpenChange:y,domReference:x}),()=>{P.setFocusManagerState(null)}},[r,P,f,h,y,p,x]),nt(()=>{r||W&&er(W,L)},[r,W,L]);const Y=!r&&_&&(!f||!C)&&(F||f);return(0,o().jsxs)(o().Fragment,{children:[Y&&(0,o().jsx)(Un,{"data-type":"inside",ref:V,onFocus:e=>{if(f){const e=B();Pn("reference"===i[0]?e[0]:e[e.length-1])}else if(null!=P&&P.preserveTabOrder&&P.portalNode)if($.current=!1,at(e,P.portalNode)){const e=st(x);null==e||e.focus()}else{var t;null==(t=P.beforeOutsideRef.current)||t.focus()}}}),!C&&X("start"),n,X("end"),Y&&(0,o().jsx)(Un,{"data-type":"inside",ref:q,onFocus:e=>{if(f)Pn(B()[0]);else if(null!=P&&P.preserveTabOrder&&P.portalNode)if(p&&($.current=!0),at(e,P.portalNode)){const e=lt(x);null==e||e.focus()}else{var t;null==(t=P.afterOutsideRef.current)||t.focus()}}})]})}function rr(e){return ne(e.target)&&"BUTTON"===e.target.tagName}function or(e){return Ye(e)}function ir(e){return null!=e&&null!=e.clientX}const ur={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},cr={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},sr=e=>{var t,n;return{escapeKey:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePress:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}};function lr(){return Ne().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints&&Fe()}function ar(e,t,n){const r=new Map,o="item"===n;let i=e;if(o&&e){const{[dn]:t,[pn]:n,...r}=e;i=r}return{..."floating"===n&&{tabIndex:-1,[fn]:""},...i,...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,i]=t;var u;o&&[dn,pn].includes(n)||(0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof i&&(null==(u=r.get(n))||u.push(i),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];return null==(e=r.get(n))?void 0:e.map(e=>e(...o)).find(e=>void 0!==e)})):e[n]=i)}),e):e,{})}}const fr=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]),dr=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?"-":"")+e.toLowerCase());function pr(e,t){return"function"==typeof e?e(t):e}function vr(e,t,n){return void 0===n&&(n=!0),e.filter(e=>{var r;return e.parentId===t&&(!n||(null==(r=e.context)?void 0:r.open))}).flatMap(t=>[t,...vr(e,t.id,n)])}function mr(e,t){const[n,r]=e;let o=!1;const i=t.length;for(let e=0,u=i-1;e<i;u=e++){const[i,c]=t[e]||[0,0],[s,l]=t[u]||[0,0];c>=r!=l>=r&&n<=(s-i)*(r-c)/(l-c)+i&&(o=!o)}return o}function hr(e){void 0===e&&(e={});const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,o={current:-1};let i=!1,u=null,c=null,s="undefined"!=typeof performance?performance.now():0;const l=e=>{let{x:n,y:l,placement:a,elements:f,onClose:d,nodeId:p,tree:v}=e;return function(e){function m(){jn(o),d()}if(jn(o),!f.domReference||!f.floating||null==a||null==n||null==l)return;const{clientX:h,clientY:y}=e,g=[h,y],b=function(e){return"composedPath"in e?e.composedPath()[0]:e.target}(e),x="mouseleave"===e.type,w=Mn(f.floating,b),E=Mn(f.domReference,b),R=f.domReference.getBoundingClientRect(),O=f.floating.getBoundingClientRect(),C=a.split("-")[0],S=n>O.right-O.width/2,_=l>O.bottom-O.height/2,j=function(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}(g,R),L=O.width>R.width,k=O.height>R.height,T=(L?R:O).left,A=(L?R:O).right,P=(k?R:O).top,M=(k?R:O).bottom;if(w&&(i=!0,!x))return;if(E&&(i=!1),E&&!x)return void(i=!0);if(x&&te(e.relatedTarget)&&Mn(f.floating,e.relatedTarget))return;if(v&&vr(v.nodesRef.current,p).length)return;if("top"===C&&l>=R.bottom-1||"bottom"===C&&l<=R.top+1||"left"===C&&n>=R.right-1||"right"===C&&n<=R.left+1)return m();let D=[];switch(C){case"top":D=[[T,R.top+1],[T,O.bottom-1],[A,O.bottom-1],[A,R.top+1]];break;case"bottom":D=[[T,O.top+1],[T,R.bottom-1],[A,R.bottom-1],[A,O.top+1]];break;case"left":D=[[O.right-1,M],[O.right-1,P],[R.left+1,P],[R.left+1,M]];break;case"right":D=[[R.right-1,M],[R.right-1,P],[O.left+1,P],[O.left+1,M]]}if(!mr([h,y],D)){if(i&&!j)return m();if(!x&&r){const t=function(e,t){const n=performance.now(),r=n-s;if(null===u||null===c||0===r)return u=e,c=t,s=n,null;const o=e-u,i=t-c,l=Math.sqrt(o*o+i*i);return u=e,c=t,s=n,l/r}(e.clientX,e.clientY);if(null!==t&&t<.1)return m()}mr([h,y],function(e){let[n,r]=e;switch(C){case"top":return[[L?n+t/2:S?n+4*t:n-4*t,r+t+1],[L?n-t/2:S?n+4*t:n-4*t,r+t+1],[O.left,S||L?O.bottom-t:O.top],[O.right,S?L?O.bottom-t:O.top:O.bottom-t]];case"bottom":return[[L?n+t/2:S?n+4*t:n-4*t,r-t],[L?n-t/2:S?n+4*t:n-4*t,r-t],[O.left,S||L?O.top+t:O.bottom],[O.right,S?L?O.top+t:O.bottom:O.top+t]];case"left":{const e=[n+t+1,k?r+t/2:_?r+4*t:r-4*t],o=[n+t+1,k?r-t/2:_?r+4*t:r-4*t];return[[_||k?O.right-t:O.left,O.top],[_?k?O.right-t:O.left:O.right-t,O.bottom],e,o]}case"right":return[[n-t,k?r+t/2:_?r+4*t:r-4*t],[n-t,k?r-t/2:_?r+4*t:r-4*t],[_||k?O.left+t:O.right,O.top],[_?k?O.left+t:O.right:O.left+t,O.bottom]]}}([n,l]))?!i&&r&&(o.current=window.setTimeout(m,40)):m()}}};return l.__options={blockPointerEvents:n},l}const yr=({children:e,enabled:t=!0,...n})=>{const r=Rn();return!t||r?e:(0,o().jsx)(Sn,{...n,children:e})},gr=(0,c.styled)(E,({$width:e="max-content"})=>({$width:e}))``,br=({children:e,enabled:t=!0,...n})=>t?(0,o().jsx)(Xn,{...n,children:e}):e,xr=(e,{enabled:t=!0,event:n="click",dismissOptions:r,clickOptions:o,hoverOptions:i,focusOptions:c,clientPointsOptions:s,roleOptions:l,extraInteractions:a=[]})=>{const f=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=e,{enabled:c=!0,escapeKey:s=!0,outsidePress:l=!0,outsidePressEvent:a="pointerdown",referencePress:f=!1,referencePressEvent:d="pointerdown",ancestorScroll:p=!1,bubbles:v,capture:m}=t,h=On(),y=it("function"==typeof l?l:()=>!1),g="function"==typeof l?y:l,b=u().useRef(!1),{escapeKey:x,outsidePress:w}=sr(v),{escapeKey:E,outsidePress:R}=sr(m),O=u().useRef(!1),C=it(e=>{var t;if(!n||!c||!s||"Escape"!==e.key)return;if(O.current)return;const o=null==(t=i.current.floatingContext)?void 0:t.nodeId,u=h?Qe(h.nodesRef.current,o):[];if(!x&&(e.stopPropagation(),u.length>0)){let e=!0;if(u.forEach(t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)}),!e)return}r(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")}),S=it(e=>{var t;const n=()=>{var t;C(e),null==(t=Ve(e))||t.removeEventListener("keydown",n)};null==(t=Ve(e))||t.addEventListener("keydown",n)}),_=it(e=>{var t;const n=i.current.insideReactTree;i.current.insideReactTree=!1;const u=b.current;if(b.current=!1,"click"===a&&u)return;if(n)return;if("function"==typeof g&&!g(e))return;const c=Ve(e),s="["+_n("inert")+"]",l=Xe(o.floating).querySelectorAll(s);let f=te(c)?c:null;for(;f&&!pe(f);){const e=he(f);if(pe(e)||!te(e))break;f=e}if(l.length&&te(c)&&!c.matches("html,body")&&!Ke(c,o.floating)&&Array.from(l).every(e=>!Ke(f,e)))return;if(ne(c)&&k){const t=pe(c),n=ve(c),r=/auto|scroll/,o=t||r.test(n.overflowX),i=t||r.test(n.overflowY),u=o&&c.clientWidth>0&&c.scrollWidth>c.clientWidth,s=i&&c.clientHeight>0&&c.scrollHeight>c.clientHeight,l="rtl"===n.direction,a=s&&(l?e.offsetX<=c.offsetWidth-c.clientWidth:e.offsetX>c.clientWidth),f=u&&e.offsetY>c.clientHeight;if(a||f)return}const d=null==(t=i.current.floatingContext)?void 0:t.nodeId,p=h&&Qe(h.nodesRef.current,d).some(t=>{var n;return qe(e,null==(n=t.context)?void 0:n.elements.floating)});if(qe(e,o.floating)||qe(e,o.domReference)||p)return;const v=h?Qe(h.nodesRef.current,d):[];if(v.length>0){let e=!0;if(v.forEach(t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)}),!e)return}r(!1,e,"outside-press")}),j=it(e=>{var t;const n=()=>{var t;_(e),null==(t=Ve(e))||t.removeEventListener(a,n)};null==(t=Ve(e))||t.addEventListener(a,n)});u().useEffect(()=>{if(!n||!c)return;i.current.__escapeKeyBubbles=x,i.current.__outsidePressBubbles=w;let e=-1;function t(e){r(!1,e,"ancestor-scroll")}function u(){window.clearTimeout(e),O.current=!0}function l(){e=window.setTimeout(()=>{O.current=!1},de()?5:0)}const f=Xe(o.floating);s&&(f.addEventListener("keydown",E?S:C,E),f.addEventListener("compositionstart",u),f.addEventListener("compositionend",l)),g&&f.addEventListener(a,R?j:_,R);let d=[];return p&&(te(o.domReference)&&(d=ge(o.domReference)),te(o.floating)&&(d=d.concat(ge(o.floating))),!te(o.reference)&&o.reference&&o.reference.contextElement&&(d=d.concat(ge(o.reference.contextElement)))),d=d.filter(e=>{var t;return e!==(null==(t=f.defaultView)?void 0:t.visualViewport)}),d.forEach(e=>{e.addEventListener("scroll",t)}),()=>{s&&(f.removeEventListener("keydown",E?S:C,E),f.removeEventListener("compositionstart",u),f.removeEventListener("compositionend",l)),g&&f.removeEventListener(a,R?j:_,R),d.forEach(e=>{e.removeEventListener("scroll",t)}),window.clearTimeout(e)}},[i,o,s,g,a,n,r,p,c,x,w,C,E,S,_,R,j]),u().useEffect(()=>{i.current.insideReactTree=!1},[i,g,a]);const L=u().useMemo(()=>({onKeyDown:C,...f&&{[ur[d]]:e=>{r(!1,e.nativeEvent,"reference-press")},..."click"!==d&&{onClick(e){r(!1,e.nativeEvent,"reference-press")}}}}),[C,r,f,d]),k=u().useMemo(()=>{function e(e){0===e.button&&(b.current=!0)}return{onKeyDown:C,onMouseDown:e,onMouseUp:e,[cr[a]]:()=>{i.current.insideReactTree=!0}}},[C,a,i]);return u().useMemo(()=>c?{reference:L,floating:k}:{},[c,L,k])}(e,{escapeKey:!1,...r}),d=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:i}}=e,{enabled:c=!0,event:s="click",toggle:l=!0,ignoreMouse:a=!1,keyboardHandlers:f=!0,stickIfOpen:d=!0}=t,p=u().useRef(),v=u().useRef(!1),m=u().useMemo(()=>({onPointerDown(e){p.current=e.pointerType},onMouseDown(e){const t=p.current;0===e.button&&"click"!==s&&(tt(t,!0)&&a||(!n||!l||o.current.openEvent&&d&&"mousedown"!==o.current.openEvent.type?(e.preventDefault(),r(!0,e.nativeEvent,"click")):r(!1,e.nativeEvent,"click")))},onClick(e){const t=p.current;"mousedown"===s&&p.current?p.current=void 0:tt(t,!0)&&a||(!n||!l||o.current.openEvent&&d&&"click"!==o.current.openEvent.type?r(!0,e.nativeEvent,"click"):r(!1,e.nativeEvent,"click"))},onKeyDown(e){p.current=void 0,e.defaultPrevented||!f||rr(e)||(" "!==e.key||or(i)||(e.preventDefault(),v.current=!0),function(e){return ne(e.target)&&"A"===e.target.tagName}(e)||"Enter"===e.key&&r(!n||!l,e.nativeEvent,"click"))},onKeyUp(e){e.defaultPrevented||!f||rr(e)||or(i)||" "===e.key&&v.current&&(v.current=!1,r(!n||!l,e.nativeEvent,"click"))}}),[o,i,s,a,f,r,n,d,l]);return u().useMemo(()=>c?{reference:m}:{},[c,m])}(e,{enabled:t&&"click"===n,...o}),p=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:c}=e,{enabled:s=!0,delay:l=0,handleClose:a=null,mouseOnly:f=!1,restMs:d=0,move:p=!0}=t,v=On(),m=Rn(),h=rt(a),y=rt(l),g=rt(n),b=rt(d),x=u().useRef(),w=u().useRef(-1),E=u().useRef(),R=u().useRef(-1),O=u().useRef(!0),C=u().useRef(!1),S=u().useRef(()=>{}),_=u().useRef(!1),j=it(()=>{var e;const t=null==(e=o.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t});u().useEffect(()=>{if(s)return i.on("openchange",e),()=>{i.off("openchange",e)};function e(e){let{open:t}=e;t||(jn(w),jn(R),O.current=!0,_.current=!1)}},[s,i]),u().useEffect(()=>{if(!s)return;if(!h.current)return;if(!n)return;function e(e){j()&&r(!1,e,"hover")}const t=Xe(c.floating).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}},[c.floating,n,r,s,h,j]);const L=u().useCallback(function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");const o=kn(y.current,"close",x.current);o&&!E.current?(jn(w),w.current=window.setTimeout(()=>r(!1,e,n),o)):t&&(jn(w),r(!1,e,n))},[y,r]),k=it(()=>{S.current(),E.current=void 0}),T=it(()=>{if(C.current){const e=Xe(c.floating).body;e.style.pointerEvents="",e.removeAttribute(Ln),C.current=!1}}),A=it(()=>!!o.current.openEvent&&["click","mousedown"].includes(o.current.openEvent.type));u().useEffect(()=>{if(s&&te(c.domReference)){const r=c.domReference,o=c.floating;return n&&r.addEventListener("mouseleave",i),p&&r.addEventListener("mousemove",e,{once:!0}),r.addEventListener("mouseenter",e),r.addEventListener("mouseleave",t),o&&(o.addEventListener("mouseleave",i),o.addEventListener("mouseenter",u),o.addEventListener("mouseleave",l)),()=>{n&&r.removeEventListener("mouseleave",i),p&&r.removeEventListener("mousemove",e),r.removeEventListener("mouseenter",e),r.removeEventListener("mouseleave",t),o&&(o.removeEventListener("mouseleave",i),o.removeEventListener("mouseenter",u),o.removeEventListener("mouseleave",l))}}function e(e){if(jn(w),O.current=!1,f&&!tt(x.current)||Tn(b.current)>0&&!kn(y.current,"open"))return;const t=kn(y.current,"open",x.current);t?w.current=window.setTimeout(()=>{g.current||r(!0,e,"hover")},t):n||r(!0,e,"hover")}function t(e){if(A())return void T();S.current();const t=Xe(c.floating);if(jn(R),_.current=!1,h.current&&o.current.floatingContext){n||jn(w),E.current=h.current({...o.current.floatingContext,tree:v,x:e.clientX,y:e.clientY,onClose(){T(),k(),A()||L(e,!0,"safe-polygon")}});const r=E.current;return t.addEventListener("mousemove",r),void(S.current=()=>{t.removeEventListener("mousemove",r)})}("touch"!==x.current||!Ke(c.floating,e.relatedTarget))&&L(e)}function i(e){A()||o.current.floatingContext&&(null==h.current||h.current({...o.current.floatingContext,tree:v,x:e.clientX,y:e.clientY,onClose(){T(),k(),A()||L(e)}})(e))}function u(){jn(w)}function l(e){A()||L(e,!1)}},[c,s,e,f,p,L,k,T,r,n,g,v,y,h,o,A,b]),nt(()=>{var e;if(s&&n&&null!=(e=h.current)&&null!=(e=e.__options)&&e.blockPointerEvents&&j()){C.current=!0;const e=c.floating;if(te(c.domReference)&&e){var t;const n=Xe(c.floating).body;n.setAttribute(Ln,"");const r=c.domReference,o=null==v||null==(t=v.nodesRef.current.find(e=>e.id===m))||null==(t=t.context)?void 0:t.elements.floating;return o&&(o.style.pointerEvents=""),n.style.pointerEvents="none",r.style.pointerEvents="auto",e.style.pointerEvents="auto",()=>{n.style.pointerEvents="",r.style.pointerEvents="",e.style.pointerEvents=""}}}},[s,n,m,c,v,h,j]),nt(()=>{n||(x.current=void 0,_.current=!1,k(),T())},[n,k,T]),u().useEffect(()=>()=>{k(),jn(w),jn(R),T()},[s,c.domReference,k,T]);const P=u().useMemo(()=>{function e(e){x.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){const{nativeEvent:t}=e;function o(){O.current||g.current||r(!0,t,"hover")}f&&!tt(x.current)||n||0===Tn(b.current)||_.current&&e.movementX**2+e.movementY**2<2||(jn(R),"touch"===x.current?o():(_.current=!0,R.current=window.setTimeout(o,Tn(b.current))))}}},[f,r,n,g,b]);return u().useMemo(()=>s?{reference:P}:{},[s,P])}(e,{restMs:150,enabled:t&&"hover"===n,handleClose:hr(),...i}),v=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:i,elements:c}=e,{enabled:s=!0,visibleOnly:l=!0}=t,a=u().useRef(!1),f=u().useRef(-1),d=u().useRef(!0);u().useEffect(()=>{if(!s)return;const e=Q(c.domReference);function t(){!n&&ne(c.domReference)&&c.domReference===Ue(Xe(c.domReference))&&(a.current=!0)}function r(){d.current=!0}function o(){d.current=!1}return e.addEventListener("blur",t),lr()&&(e.addEventListener("keydown",r,!0),e.addEventListener("pointerdown",o,!0)),()=>{e.removeEventListener("blur",t),lr()&&(e.removeEventListener("keydown",r,!0),e.removeEventListener("pointerdown",o,!0))}},[c.domReference,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||(a.current=!0)}},[o,s]),u().useEffect(()=>()=>{jn(f)},[]);const p=u().useMemo(()=>({onMouseLeave(){a.current=!1},onFocus(e){if(a.current)return;const t=Ve(e.nativeEvent);if(l&&te(t))if(lr()&&!e.relatedTarget){if(!d.current&&!Ye(t))return}else if(!function(e){if(!e||ze())return!0;try{return e.matches(":focus-visible")}catch(e){return!0}}(t))return;r(!0,e.nativeEvent,"focus")},onBlur(e){a.current=!1;const t=e.relatedTarget,n=e.nativeEvent,o=te(t)&&t.hasAttribute(_n("focus-guard"))&&"outside"===t.getAttribute("data-type");f.current=window.setTimeout(()=>{var e;const u=Ue(c.domReference?c.domReference.ownerDocument:document);(t||u!==c.domReference)&&(Ke(null==(e=i.current.floatingContext)?void 0:e.refs.floating.current,u)||Ke(c.domReference,u)||o||r(!1,n,"focus"))})}}),[i,c.domReference,r,l]);return u().useMemo(()=>s?{reference:p}:{},[s,p])}(e,{enabled:t&&"focus"===n,...c}),m=function(e,t){void 0===t&&(t={});const{open:n,dataRef:r,elements:{floating:o,domReference:i},refs:c}=e,{enabled:s=!0,axis:l="both",x:a=null,y:f=null}=t,d=u().useRef(!1),p=u().useRef(null),[v,m]=u().useState(),[h,y]=u().useState([]),g=it((e,t)=>{d.current||r.current.openEvent&&!ir(r.current.openEvent)||c.setPositionReference(function(e,t){let n=null,r=null,o=!1;return{contextElement:e||void 0,getBoundingClientRect(){var i;const u=(null==e?void 0:e.getBoundingClientRect())||{width:0,height:0,x:0,y:0},c="x"===t.axis||"both"===t.axis,s="y"===t.axis||"both"===t.axis,l=["mouseenter","mousemove"].includes((null==(i=t.dataRef.current.openEvent)?void 0:i.type)||"")&&"touch"!==t.pointerType;let a=u.width,f=u.height,d=u.x,p=u.y;return null==n&&t.x&&c&&(n=u.x-t.x),null==r&&t.y&&s&&(r=u.y-t.y),d-=n||0,p-=r||0,a=0,f=0,!o||l?(a="y"===t.axis?u.width:0,f="x"===t.axis?u.height:0,d=c&&null!=t.x?t.x:d,p=s&&null!=t.y?t.y:p):o&&!l&&(f="x"===t.axis?u.height:f,a="y"===t.axis?u.width:a),o=!0,{width:a,height:f,x:d,y:p,top:p,right:d+a,bottom:p+f,left:d}}}}(i,{x:e,y:t,axis:l,dataRef:r,pointerType:v}))}),b=it(e=>{null==a&&null==f&&(n?p.current||y([]):g(e.clientX,e.clientY))}),x=tt(v)?o:n,w=u().useCallback(()=>{if(!x||!s||null!=a||null!=f)return;const e=Q(o);function t(n){const r=Ve(n);Ke(o,r)?(e.removeEventListener("mousemove",t),p.current=null):g(n.clientX,n.clientY)}if(!r.current.openEvent||ir(r.current.openEvent)){e.addEventListener("mousemove",t);const n=()=>{e.removeEventListener("mousemove",t),p.current=null};return p.current=n,n}c.setPositionReference(i)},[x,s,a,f,o,r,c,i,g]);u().useEffect(()=>w(),[w,h]),u().useEffect(()=>{s&&!o&&(d.current=!1)},[s,o]),u().useEffect(()=>{!s&&n&&(d.current=!0)},[s,n]),nt(()=>{!s||null==a&&null==f||(d.current=!1,g(a,f))},[s,a,f,g]);const E=u().useMemo(()=>{function e(e){let{pointerType:t}=e;m(t)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:b,onMouseEnter:b}},[b]);return u().useMemo(()=>s?{reference:E}:{},[s,E])}(e,{enabled:t&&"point"===n,...s}),h=function(e,t){var n,r;void 0===t&&(t={});const{open:o,elements:i,floatingId:c}=e,{enabled:s=!0,role:l="dialog"}=t,a=gn(),f=(null==(n=i.domReference)?void 0:n.id)||a,d=u().useMemo(()=>{var e;return(null==(e=Ze(i.floating))?void 0:e.id)||c},[i.floating,c]),p=null!=(r=fr.get(l))?r:l,v=null!=Rn(),m=u().useMemo(()=>"tooltip"===p||"label"===l?{["aria-"+("label"===l?"labelledby":"describedby")]:o?d:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":"alertdialog"===p?"dialog":p,"aria-controls":o?d:void 0,..."listbox"===p&&{role:"combobox"},..."menu"===p&&{id:f},..."menu"===p&&v&&{role:"menuitem"},..."select"===l&&{"aria-autocomplete":"none"},..."combobox"===l&&{"aria-autocomplete":"list"}},[p,d,v,o,f,l]),h=u().useMemo(()=>{const e={id:d,...p&&{role:p}};return"tooltip"===p||"label"===l?e:{...e,..."menu"===p&&{"aria-labelledby":f}}},[p,d,f,l]),y=u().useCallback(e=>{let{active:t,selected:n}=e;const r={role:"option",...t&&{id:d+"-fui-option"}};switch(l){case"select":case"combobox":return{...r,"aria-selected":n}}return{}},[d,l]);return u().useMemo(()=>s?{reference:m,floating:h,item:y}:{},[s,m,h,y])}(e,l);return function(e){void 0===e&&(e=[]);const t=e.map(e=>null==e?void 0:e.reference),n=e.map(e=>null==e?void 0:e.floating),r=e.map(e=>null==e?void 0:e.item),o=u().useCallback(t=>ar(t,e,"reference"),t),i=u().useCallback(t=>ar(t,e,"floating"),n),c=u().useCallback(t=>ar(t,e,"item"),r);return u().useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:c}),[o,i,c])}([f,d,p,v,m,h,...a])},wr=({enabled:t=!0,event:n,dismissOptions:r,clickOptions:o,hoverOptions:i,focusOptions:c,clientPointsOptions:s,roleOptions:l,extraInteractions:f,open:d,floatingOptions:p,useOffset:v=!0,offsetOptions:m,useFlip:h=!0,flipOptions:y,useShift:g=!0,shiftOptions:b,useArrow:x=!1,arrowOptions:w,transitionOptions:E,useAutoPlacement:R=!1,autoPlacementOptions:O,useAutoUpdate:C=!1,autoUpdateOptions:S,useAutoSize:_=!1,sizeOptions:j,minAcceptableWidth:L=null,minAcceptableHeight:k=null,maxAcceptableWidth:T,maxAcceptableHeight:A,onOpen:P,onClose:M})=>{const{theme:D}=U(),$=function(){const e=gn(),t=On(),n=Rn();return nt(()=>{if(!e)return;const r={id:e,parentId:n};return null==t||t.addNode(r),()=>{null==t||t.removeNode(r)}},[t,e,n]),e}(),[I,N]=(0,u().useState)(!1),H=(0,u().useRef)(null),F=t&&(d??I);(0,u().useEffect)(()=>{F&&P?.()},[F]),((e,t)=>{const n=(0,u().useRef)(e);(0,u().useEffect)(()=>{if(n.current!==e)return n.current=e,t(e)},[e])})(t,e=>{e||N(!1)});const W=[];v&&W.push((e=>{const t=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:u,middlewareData:c}=t,s=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),u=Rt(n),c=Ot(n),s="y"===_t(n),l=Ft.has(u)?-1:1,a=i&&s?-1:1,f=Et(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:v}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&"number"==typeof v&&(p="end"===c?-1*v:v),s?{x:p*a,y:d*l}:{x:d*l,y:p*a}}(t,e);return u===(null==(n=c.offset)?void 0:n.placement)&&null!=(r=c.arrow)&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:u}}}}}(e);return{name:t.name,fn:t.fn,options:[e,void 0]}})(m??D.spacings.base));let z=null;if(R?W.push((e=>{const t=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,o;const{rects:i,middlewareData:u,placement:c,platform:s,elements:l}=t,{crossAxis:a=!1,alignment:f,allowedPlacements:d=vt,autoAlignment:p=!0,...v}=Et(e,t),m=void 0!==f||d===vt?function(e,t,n){return(e?[...n.filter(t=>Ot(t)===e),...n.filter(t=>Ot(t)!==e)]:n.filter(e=>Rt(e)===e)).filter(n=>!e||Ot(n)===e||!!t&&kt(n)!==n)}(f||null,p,d):d,h=(null==(n=u.autoPlacement)?void 0:n.index)||0,y=m[h];if(null==y)return{};if(c!==y)return{reset:{placement:m[0]}};const g=await s.detectOverflow(t,v),b=Lt(y,i,await(null==s.isRTL?void 0:s.isRTL(l.floating))),x=[g[Rt(y)],g[b[0]],g[b[1]]],w=[...(null==(r=u.autoPlacement)?void 0:r.overflows)||[],{placement:y,overflows:x}],E=m[h+1];if(E)return{data:{index:h+1,overflows:w},reset:{placement:E}};const R=w.map(e=>{const t=Ot(e.placement);return[e.placement,t&&a?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),O=(null==(o=R.filter(e=>e[2].slice(0,Ot(e[0])?2:3).every(e=>e<=0))[0])?void 0:o[0])||R[0][0];return O!==c?{data:{index:h+1,overflows:w},reset:{placement:O}}:{}}}}(e);return{name:t.name,fn:t.fn,options:[e,void 0]}})(O)):h&&(z=(e=>{const t=nn(e);return{name:t.name,fn:t.fn,options:[e,void 0]}})({crossAxis:!1,fallbackStrategy:"bestFit",...y})),_){const e=(e=>{const t=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:u=()=>{},...c}=Et(e,t),s=await o.detectOverflow(t,c),l=Rt(n),a=Ot(n),f="y"===_t(n),{width:d,height:p}=r.floating;let v,m;"top"===l||"bottom"===l?(v=l,m=a===(await(null==o.isRTL?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(m=l,v="end"===a?"top":"bottom");const h=p-s.top-s.bottom,y=d-s.left-s.right,g=mt(p-s[v],h),b=mt(d-s[m],y),x=t.middlewareData.shift,w=!x;let E=g,R=b;null!=x&&x.enabled.x&&(R=y),null!=x&&x.enabled.y&&(E=h),w&&!a&&(f?R=d-2*ht(s.left,s.right):E=p-2*ht(s.top,s.bottom)),await u({...t,availableWidth:R,availableHeight:E});const O=await o.getDimensions(i.floating);return d!==O.width||p!==O.height?{reset:{rects:!0}}:{}}}}(e);return{name:t.name,fn:t.fn,options:[e,void 0]}})({...j,apply({elements:e,rects:t,availableWidth:n,availableHeight:r}){const o=a(L)?L(t.reference):L??t.reference.width,i=a(T)?T(t.reference):Math.min(n,T??1/0),u=a(k)?k(t.reference):k??0,c=a(A)?A(t.reference):Math.min(r,A??1/0);Object.assign(e.floating.style,{minWidth:`${Math.min(o,i)}px`,maxWidth:`${i}px`,minHeight:`${Math.min(u,c)}px`,maxHeight:`${c}px`})}});z?"initialPlacement"===y?.fallbackStrategy?W.push(e,z):W.push(z,e):W.push(e)}else z&&W.push(z);g&&W.push((e=>{const t=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:u=!0,crossAxis:c=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Et(e,t),a={x:n,y:r},f=await i.detectOverflow(t,l),d=_t(o),p=Ct(d);let v=a[p],m=a[d];const h=(e,t)=>wt(t+f["y"===e?"top":"left"],t,t-f["y"===e?"bottom":"right"]);u&&(v=h(p,v)),c&&(m=h(d,m));const y=s.fn({...t,[p]:v,[d]:m});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[p]:u,[d]:c}}}}}}(e);return{name:t.name,fn:t.fn,options:[e,void 0]}})({padding:D.spacings.base,...b})),x&&W.push(((e,t)=>{const n=(e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&(o=n,{}.hasOwnProperty.call(o,"current"))?null!=n.current?rn({element:n.current,padding:r}).fn(t):{}:n?rn({element:n,padding:r}).fn(t):{};var o}}))(e);return{name:n.name,fn:n.fn,options:[e,t]}})({element:H,padding:D.spacings.base,...w}));const B=function(t){var n,r;let{elements:o,...i}=void 0===t?{}:t;const{nodeId:c}=i,s=function(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=gn(),i=u().useRef({}),[c]=u().useState(()=>xn()),s=null!=Rn(),[l,a]=u().useState(r.reference),f=it((e,t,r)=>{i.current.openEvent=e?t:void 0,c.emit("openchange",{open:e,event:t,reason:r,nested:s}),null==n||n(e,t,r)}),d=u().useMemo(()=>({setPositionReference:a}),[]),p=u().useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return u().useMemo(()=>({dataRef:i,open:t,onOpenChange:f,elements:p,events:c,floatingId:o,refs:d}),[t,f,p,c,o,d])}({...i,elements:{reference:null!=(n=null==o?void 0:o.reference)?n:null,floating:null!=(r=null==o?void 0:o.floating)?r:null}}),l=i.rootContext||s,a=l.elements,[f,d]=u().useState(null),[p,v]=u().useState(null),m=(null==a?void 0:a.domReference)||f,h=u().useRef(null),y=On();nt(()=>{m&&(h.current=m)},[m]);const g=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:c,floating:s}={},transform:l=!0,whileElementsMounted:a,open:f}=t,[d,p]=u().useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[v,m]=u().useState(o);cn(v,o)||m(o);const[h,y]=u().useState(null),[g,b]=u().useState(null),x=u().useCallback(e=>{e!==O.current&&(O.current=e,y(e))},[]),w=u().useCallback(e=>{e!==C.current&&(C.current=e,b(e))},[]),E=c||h,R=s||g,O=u().useRef(null),C=u().useRef(null),S=u().useRef(d),_=null!=a,j=an(a),L=an(i),k=an(f),T=u().useCallback(()=>{if(!O.current||!C.current)return;const t={placement:n,strategy:r,middleware:v};L.current&&(t.platform=L.current),on(O.current,C.current,t).then(t=>{const n={...t,isPositioned:!1!==k.current};A.current&&!cn(S.current,n)&&(S.current=n,e().flushSync(()=>{p(n)}))})},[v,n,r,L,k]);un(()=>{!1===f&&S.current.isPositioned&&(S.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[f]);const A=u().useRef(!1);un(()=>(A.current=!0,()=>{A.current=!1}),[]),un(()=>{if(E&&(O.current=E),R&&(C.current=R),E&&R){if(j.current)return j.current(E,R,T);T()}},[E,R,T,j,_]);const P=u().useMemo(()=>({reference:O,floating:C,setReference:x,setFloating:w}),[x,w]),M=u().useMemo(()=>({reference:E,floating:R}),[E,R]),D=u().useMemo(()=>{const e={position:r,left:0,top:0};if(!M.floating)return e;const t=ln(M.floating,d.x),n=ln(M.floating,d.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...sn(M.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,M.floating,d.x,d.y]);return u().useMemo(()=>({...d,update:T,refs:P,elements:M,floatingStyles:D}),[d,T,P,M,D])}({...i,elements:{...a,...p&&{reference:p}}}),b=u().useCallback(e=>{const t=te(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;v(t),g.refs.setReference(t)},[g.refs]),x=u().useCallback(e=>{(te(e)||null===e)&&(h.current=e,d(e)),(te(g.refs.reference.current)||null===g.refs.reference.current||null!==e&&!te(e))&&g.refs.setReference(e)},[g.refs]),w=u().useMemo(()=>({...g.refs,setReference:x,setPositionReference:b,domReference:h}),[g.refs,x,b]),E=u().useMemo(()=>({...g.elements,domReference:m}),[g.elements,m]),R=u().useMemo(()=>({...g,...l,refs:w,elements:E,nodeId:c}),[g,w,E,c,l]);return nt(()=>{l.dataRef.current.floatingContext=R;const e=null==y?void 0:y.nodesRef.current.find(e=>e.id===c);e&&(e.context=R)}),u().useMemo(()=>({...g,context:R,refs:w,elements:E}),[g,w,E,R])}({nodeId:$,open:F,middleware:W,onOpenChange:(e,t,n)=>{N(e),e||M?.(n,t)},...C&&{whileElementsMounted:(e,t,n)=>function(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:u="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:s=!1}=r,l=zt(e),a=o||i?[...l?ge(l):[],...t?ge(t):[]]:[];a.forEach(e=>{o&&e.addEventListener("scroll",n),i&&e.addEventListener("resize",n)});const f=l&&c?function(e,t,n){let r,o=null;const i=J(e);function u(){var e;clearTimeout(r),null==(e=o)||e.disconnect(),o=null}function c(n,s){void 0===n&&(n=!1),void 0===s&&(s=1),u();const l=e.getBoundingClientRect(),{left:a,top:f,width:d,height:p}=l;if(n||t(),!d||!p)return;const v={rootMargin:-gt(f)+"px "+-gt(i.clientWidth-(a+d))+"px "+-gt(i.clientHeight-(f+p))+"px "+-gt(a)+"px",threshold:ht(0,mt(1,s))||1};let m=!0;function h(t){const n=t[0].intersectionRatio;if(!tn(l,e.getBoundingClientRect()))return c();if(n!==s){if(!m)return c();n?c(!1,n):r=setTimeout(()=>{c(!1,1e-7)},1e3)}m=!1}try{o=new IntersectionObserver(h,{...v,root:i.ownerDocument})}catch(e){o=new IntersectionObserver(h,v)}o.observe(e)}const s=Q(e),l=()=>c(n);return s.addEventListener("resize",l),c(!0),()=>{s.removeEventListener("resize",l),u()}}(l,n,i):null;let d,p=-1,v=null;u&&(v=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&v&&t&&(v.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=v)||e.observe(t)})),n()}),l&&!s&&v.observe(l),t&&v.observe(t));let m=s?Vt(e):null;return s&&function t(){const r=Vt(e);m&&!tn(m,r)&&n(),m=r,d=requestAnimationFrame(t)}(),n(),()=>{var e;a.forEach(e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==f||f(),null==(e=v)||e.disconnect(),v=null,s&&cancelAnimationFrame(d)}}(e,t,n,S)},...p}),K=xr(B.context,{enabled:t,event:n,dismissOptions:r,clickOptions:o,hoverOptions:i,focusOptions:c,clientPointsOptions:s,roleOptions:l,extraInteractions:f}),V=function(t,n){void 0===n&&(n={});const{initial:r={opacity:0},open:o,close:i,common:c,duration:s=250}=n,l=t.placement,a=l.split("-")[0],f=u().useMemo(()=>({side:a,placement:l}),[a,l]),d="number"==typeof s,p=(d?s:s.open)||0,v=(d?s:s.close)||0,[m,h]=u().useState(()=>({...pr(c,f),...pr(r,f)})),{isMounted:y,status:g}=function(t,n){void 0===n&&(n={});const{open:r,elements:{floating:o}}=t,{duration:i=250}=n,c=("number"==typeof i?i:i.close)||0,[s,l]=u().useState("unmounted"),a=function(e,t){const[n,r]=u().useState(e);return e&&!n&&r(!0),u().useEffect(()=>{if(!e&&n){const e=setTimeout(()=>r(!1),t);return()=>clearTimeout(e)}},[e,n,t]),n}(r,c);return a||"close"!==s||l("unmounted"),nt(()=>{if(o){if(r){l("initial");const t=requestAnimationFrame(()=>{e().flushSync(()=>{l("open")})});return()=>{cancelAnimationFrame(t)}}l("close")}},[r,o]),{isMounted:a,status:s}}(t,{duration:s}),b=rt(r),x=rt(o),w=rt(i),E=rt(c);return nt(()=>{const e=pr(b.current,f),t=pr(w.current,f),n=pr(E.current,f),r=pr(x.current,f)||Object.keys(e).reduce((e,t)=>(e[t]="",e),{});if("initial"===g&&h(t=>({transitionProperty:t.transitionProperty,...n,...e})),"open"===g&&h({transitionProperty:Object.keys(r).map(dr).join(","),transitionDuration:p+"ms",...n,...r}),"close"===g){const r=t||e;h({transitionProperty:Object.keys(r).map(dr).join(","),transitionDuration:v+"ms",...n,...r})}},[v,w,b,x,E,p,g,f]),{isMounted:y,styles:m}}(B.context,{duration:250,...E});return{nodeId:$,isOpen:F,floating:B,arrowRef:H,interactions:K,transition:V}},Er=()=>{const e=(0,u().useContext)(Y);return l(e,"[@react-hive/honey-layout]: The `useHoneyPopupContext()` hook can only be used inside <HoneyPopup/> component."),e},Rr=({children:e,referenceUserProps:t,referenceProps:n,content:r,contentProps:i,focusManagerProps:c,arrowProps:s,portalProps:l,adjustStyles:a,context:d,...p})=>{const{useArrow:v,onClose:m}=p,h=N(m),{nodeId:y,floating:g,isOpen:b,arrowRef:x,interactions:w,transition:E}=wr(p),R=(0,u().useCallback)(()=>{h.current?.("escape-key")},[]),O=(0,u().useMemo)(()=>({context:d,floatingContext:g.context}),[d,g.context]);return(0,o().jsx)(gr,{ref:g.refs.setReference,...w.getReferenceProps(t),...n,"data-testid":"honey-popup",children:(0,o().jsxs)(Y,{value:O,children:[f(e,O),(0,o().jsx)(Cn,{id:y,children:E.isMounted&&(0,o().jsx)(br,{...l,children:(0,o().jsx)(nr,{context:g.context,disabled:!b,...c,children:(0,o().jsxs)(X,{ref:g.refs.setFloating,active:b,style:a?.({...g.floatingStyles,...E.styles},{middlewareData:g.middlewareData})??{...g.floatingStyles,...E.styles},onDeactivate:R,...w.getFloatingProps(),...i,"data-testid":"honey-popup-floating-content",children:[v&&(0,o().jsx)(bn,{ref:x,context:g.context,fill:"white",...s}),f(r,O)]})})})})]})})},Or=({useTree:e=!1,...t})=>(0,o().jsx)(yr,{enabled:e,children:(0,o().jsx)(Rr,{...t})}),Cr=(0,c.styled)(E,{row:!0,centerY:!0})`
36
+ `,_=({ref:e,children:t,columns:n,spacing:r,columnsGrowing:i=!0,applyColumnMaxWidth:c=!1,...s})=>{const l=(0,u().useMemo)(()=>({columns:n,spacing:r,isColumnsGrowing:i,applyColumnMaxWidth:c}),[n,r,i,c]);return(0,o().jsx)(O,{value:l,children:(0,o().jsx)(S,{ref:e,spacing:r,"data-testid":"honey-grid",...s,children:t})})},j=()=>{const e=(0,u().useContext)(O);if(!e)throw new Error("The `useHoneyGridContext()` hook can only be used inside <HoneyGrid/> component!");return e},L=({children:e,...t})=>{const{columns:n,spacing:r,isColumnsGrowing:i,applyColumnMaxWidth:u}=j();return(0,o().jsx)(C,{columns:n,spacing:r,applyMaxWidth:u,$flexGrow:i?1:0,"data-testid":"honey-grid-column",...t,children:e})},k=(e,t,n)=>"function"==typeof t?t(e):"string"==typeof e||"number"==typeof e?e:t?e[t]:n,T=({children:e,loading:t=!1,loadingOverContent:n=!1,error:r=!1,empty:i=!1,loadingContent:u=null,errorContent:c=null,emptyContent:s=null})=>r?c:!n&&t?u:(0,o().jsxs)(o().Fragment,{children:[n&&t&&u,i?s:e]}),A=(0,c.styled)(E,({$overflow:e="hidden auto"})=>({$overflow:e}))``,P=({children:e,items:t,itemKey:n,loading:r,loadingOverContent:i,loadingContent:c,error:s,errorContent:l,empty:a=!1,emptyContent:f,...d})=>(0,o().jsx)(A,{role:"list","aria-busy":r,"data-testid":"honey-list",...d,children:(0,o().jsx)(T,{loading:r,loadingOverContent:i,loadingContent:c,error:s,errorContent:l,empty:a||0===t?.length,emptyContent:f,children:t?.map((t,r,i)=>(0,o().jsx)(u().Fragment,{children:e(t,r,i)},String(k(t,n,r))))})}),M=({children:e,mount:t,unmountDelay:n,alwaysMounted:r=!1,keepAfterMount:o=!1})=>{const[i,c]=(0,u().useState)(r||t),s=(0,u().useRef)(void 0);return(0,u().useLayoutEffect)(()=>{if(t&&!r)return clearTimeout(s.current),c(!0),()=>{o||(s.current=setTimeout(()=>c(!1),n))}},[t,r,n]),i?e:null};var D={551(e,t,n){var r="Expected a function",o=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,s=parseInt,l="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,a="object"==typeof self&&self&&self.Object===Object&&self,f=l||a||Function("return this")(),d=Object.prototype.toString,p=Math.max,v=Math.min,m=function(){return f.Date.now()};function h(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function y(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==d.call(e)}(e))return NaN;if(h(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=h(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(o,"");var n=u.test(e);return n||c.test(e)?s(e.slice(2),n?2:8):i.test(e)?NaN:+e}e.exports=function(e,t,n){var o=!0,i=!0;if("function"!=typeof e)throw new TypeError(r);return h(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),function(e,t,n){var o,i,u,c,s,l,a=0,f=!1,d=!1,g=!0;if("function"!=typeof e)throw new TypeError(r);function b(t){var n=o,r=i;return o=i=void 0,a=t,c=e.apply(r,n)}function x(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-a>=u}function w(){var e=m();if(x(e))return E(e);s=setTimeout(w,function(e){var n=t-(e-l);return d?v(n,u-(e-a)):n}(e))}function E(e){return s=void 0,g&&o?b(e):(o=i=void 0,c)}function R(){var e=m(),n=x(e);if(o=arguments,i=this,l=e,n){if(void 0===s)return function(e){return a=e,s=setTimeout(w,t),f?b(e):c}(l);if(d)return s=setTimeout(w,t),b(l)}return void 0===s&&(s=setTimeout(w,t)),c}return t=y(t)||0,h(n)&&(f=!!n.leading,u=(d="maxWait"in n)?p(y(n.maxWait)||0,t):u,g="trailing"in n?!!n.trailing:g),R.cancel=function(){void 0!==s&&clearTimeout(s),a=0,o=l=i=s=void 0},R.flush=function(){return void 0===s?c:E(m())},R}(e,t,{leading:o,maxWait:t,trailing:i})}}},$={};function I(e){var t=$[e];if(void 0!==t)return t.exports;var n=$[e]={exports:{}};return D[e](n,n.exports,I),n.exports}I.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return I.d(t,{a:t}),t},I.d=(e,t)=>{for(var n in t)I.o(t,n)&&!I.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},I.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),I.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const N=e=>{const t=(0,u().useRef)(e);return t.current=e,t};var H=I(551);I.n(H);var F=n(551),W=n.n(F);const z=(e,{resizeThrottle:t=0,overrideScreenState:n}={})=>{const[r,o]=(0,u().useState)(()=>({...y(e.breakpoints),...n}));return(0,u().useEffect)(()=>{const r=W()(()=>{const t={...y(e.breakpoints),...n};o(e=>{return n=e,r=t,Object.keys(r).every(e=>n[e]===r[e])?e:t;var n,r})},t);return r(),window.addEventListener("resize",r),window.screen.orientation.addEventListener("change",r),()=>{r.cancel(),window.removeEventListener("resize",r),window.screen.orientation.removeEventListener("change",r)}},[]),r},B=(0,u().createContext)(void 0),U=()=>{const e=(0,u().useContext)(B);return l(e,"[@react-hive/honey-layout]: The `useHoneyLayout()` hook must be used inside <HoneyLayoutProvider/> component."),e},K=(e,t)=>{const{registerOverlay:n,unregisterOverlay:r}=U(),o=(0,u().useRef)(null);return(0,u().useEffect)(()=>{if(!e)return;const i=n(t);return o.current=i,()=>{o.current=null,r(i.id)}},[e,t.onKeyUp]),o.current},V=()=>()=>{},q=(e,{enabled:t=!0,onKeyUp:n}={})=>{const{getOverlaysSnapshot:r,subscribeOverlays:o}=U(),i=(0,u().useCallback)(()=>t?r().find(t=>t.id===e)??null:null,[t,e]),c=(0,u().useSyncExternalStore)(t?o:V,i,i);return(0,u().useEffect)(()=>{if(c&&n)return c.addListener("keyup",n),()=>{c.removeListener("keyup",n)}},[c,n]),c},X=({ref:e,children:t,active:n,overlayId:r,onDeactivate:i,onKeyUp:c,...s})=>{const l=N(c),a=N(i),d=(0,u().useCallback)((e,...t)=>{l.current?l.current(e,...t):"Escape"===e&&a.current()},[]),v=K(n,{id:r,onKeyUp:d}),m=p(v?.setContainerRef,e);return(0,o().jsx)(E,{ref:m,inert:!n,...s,children:f(t,{overlay:v,isActive:n,deactivateOverlay:a.current})})},Y=(0,u().createContext)(void 0);function G(){return"undefined"!=typeof window}function Z(e){return ee(e)?(e.nodeName||"").toLowerCase():"#document"}function Q(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function J(e){var t;return null==(t=(ee(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function ee(e){return!!G()&&(e instanceof Node||e instanceof Q(e).Node)}function te(e){return!!G()&&(e instanceof Element||e instanceof Q(e).Element)}function ne(e){return!!G()&&(e instanceof HTMLElement||e instanceof Q(e).HTMLElement)}function re(e){return!(!G()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Q(e).ShadowRoot)}function oe(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ve(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==o&&"contents"!==o}function ie(e){return/^(table|td|th)$/.test(Z(e))}function ue(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}const ce=/transform|translate|scale|rotate|perspective|filter/,se=/paint|layout|strict|content/,le=e=>!!e&&"none"!==e;let ae;function fe(e){const t=te(e)?ve(e):e;return le(t.transform)||le(t.translate)||le(t.scale)||le(t.rotate)||le(t.perspective)||!de()&&(le(t.backdropFilter)||le(t.filter))||ce.test(t.willChange||"")||se.test(t.contain||"")}function de(){return null==ae&&(ae="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ae}function pe(e){return/^(html|body|#document)$/.test(Z(e))}function ve(e){return Q(e).getComputedStyle(e)}function me(e){return te(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function he(e){if("html"===Z(e))return e;const t=e.assignedSlot||e.parentNode||re(e)&&e.host||J(e);return re(t)?t.host:t}function ye(e){const t=he(e);return pe(t)?(e.ownerDocument||e).body:ne(t)&&oe(t)?t:ye(t)}function ge(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=ye(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),u=Q(o);if(i){const e=be(u);return t.concat(u,u.visualViewport||[],oe(o)?o:[],e&&n?ge(e):[])}return t.concat(o,ge(o,[],n))}function be(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var xe=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","area[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"].join(","),we="undefined"==typeof Element,Ee=we?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Re=!we&&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},Oe=function(e,t){var n;void 0===t&&(t=!0);var r=null==e||null===(n=e.getAttribute)||void 0===n?void 0:n.call(e,"inert");return""===r||"true"===r||t&&e&&("function"==typeof e.closest?e.closest("[inert]"):Oe(e.parentNode))},Ce=function(e,t,n){if(Oe(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(xe));return t&&Ee.call(e,xe)&&r.unshift(e),r.filter(n)},Se=function(e,t,n){for(var r=[],o=Array.from(e);o.length;){var i=o.shift();if(!Oe(i,!1))if("SLOT"===i.tagName){var u=i.assignedElements(),c=u.length?u:i.children,s=Se(c,!0,n);n.flatten?r.push.apply(r,s):r.push({scopeParent:i,candidates:s})}else{Ee.call(i,xe)&&n.filter(i)&&(t||!e.includes(i))&&r.push(i);var l=i.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(i),a=!Oe(l,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(i));if(l&&a){var f=Se(!0===l?i.children:l.children,!0,n);n.flatten?r.push.apply(r,f):r.push({scopeParent:i,candidates:f})}else o.unshift.apply(o,i.children)}}return r},_e=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},je=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))&&!_e(e)?0:e.tabIndex},Le=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},ke=function(e){return"INPUT"===e.tagName},Te=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Ae=function(e,t){return!(t.disabled||function(e){return ke(e)&&"hidden"===e.type}(t)||function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("full-native"===n&&"checkVisibility"in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});var o=getComputedStyle(e).visibility;if("hidden"===o||"collapse"===o)return!0;var i=Ee.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Ee.call(i,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"full-native"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Te(e)}else{if("function"==typeof r){for(var u=e;e;){var c=e.parentElement,s=Re(e);if(c&&!c.shadowRoot&&!0===r(c))return Te(e);e=e.assignedSlot?e.assignedSlot:c||s===e.ownerDocument?c:s.host}e=u}if(function(e){var t,n,r,o,i=e&&Re(e),u=null===(t=i)||void 0===t?void 0:t.host,c=!1;if(i&&i!==e)for(c=!!(null!==(n=u)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(u)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!c&&u;){var s,l,a;c=!(null===(l=u=null===(s=i=Re(u))||void 0===s?void 0:s.host)||void 0===l||null===(a=l.ownerDocument)||void 0===a||!a.contains(u))}return c}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1}(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!!Ee.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Pe=function(e,t){return!(function(e){return function(e){return ke(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Re(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)}(t)||je(t)<0||!Ae(e,t))},Me=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},De=function(e){var t=[],n=[];return e.forEach(function(e,r){var o=!!e.scopeParent,i=o?e.scopeParent:e,u=function(e,t){var n=je(e);return n<0&&t&&!_e(e)?0:n}(i,o),c=o?De(e.candidates):i;0===u?o?t.push.apply(t,c):t.push(i):n.push({documentOrder:r,tabIndex:u,item:e,isScope:o,content:c})}),n.sort(Le).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},$e=function(e,t){var n;return n=(t=t||{}).getShadowRoot?Se([e],t.includeContainer,{filter:Pe.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Me}):Ce(e,t.includeContainer,Pe.bind(null,t)),De(n)},Ie=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Ee.call(e,xe)&&Pe(t,e)};function Ne(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function He(){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 Fe(){return/apple/i.test(navigator.vendor)}function We(){const e=/android/i;return e.test(Ne())||e.test(He())}function ze(){return He().includes("jsdom/")}const Be="data-floating-ui-focusable";function Ue(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 Ke(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&re(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Ve(e){return"composedPath"in e?e.composedPath()[0]:e.target}function qe(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 Xe(e){return(null==e?void 0:e.ownerDocument)||document}function Ye(e){return ne(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function Ge(e){return!!e&&"combobox"===e.getAttribute("role")&&Ye(e)}function Ze(e){return e?e.hasAttribute(Be)?e:e.querySelector("["+Be+"]")||e:null}function Qe(e,t,n){return void 0===n&&(n=!0),e.filter(e=>{var r;return e.parentId===t&&(!n||(null==(r=e.context)?void 0:r.open))}).flatMap(t=>[t,...Qe(e,t.id,n)])}function Je(e,t){var n;let r=[],o=null==(n=e.find(e=>e.id===t))?void 0:n.parentId;for(;o;){const t=e.find(e=>e.id===o);o=null==t?void 0:t.parentId,t&&(r=r.concat(t))}return r}function et(e){e.preventDefault(),e.stopPropagation()}function tt(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var nt="undefined"!=typeof document?u().useLayoutEffect:function(){};function rt(e){const t=u().useRef(e);return nt(()=>{t.current=e}),t}const ot={...R()}.useInsertionEffect||(e=>e());function it(e){const t=u().useRef(()=>{});return ot(()=>{t.current=e}),u().useCallback(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}const ut=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function ct(e,t){const n=$e(e,ut()),r=n.length;if(0===r)return;const o=Ue(Xe(e)),i=n.indexOf(o);return n[-1===i?1===t?0:r-1:i+t]}function st(e){return ct(Xe(e).body,1)||e}function lt(e){return ct(Xe(e).body,-1)||e}function at(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Ke(n,r)}function ft(e){$e(e,ut()).forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")})}function dt(e){e.querySelectorAll("[data-tabindex]").forEach(e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")})}t();const pt=["start","end"],vt=["top","right","bottom","left"].reduce((e,t)=>e.concat(t,t+"-"+pt[0],t+"-"+pt[1]),[]),mt=Math.min,ht=Math.max,yt=Math.round,gt=Math.floor,bt=e=>({x:e,y:e}),xt={left:"right",right:"left",bottom:"top",top:"bottom"};function wt(e,t,n){return ht(e,mt(t,n))}function Et(e,t){return"function"==typeof e?e(t):e}function Rt(e){return e.split("-")[0]}function Ot(e){return e.split("-")[1]}function Ct(e){return"x"===e?"y":"x"}function St(e){return"y"===e?"height":"width"}function _t(e){const t=e[0];return"t"===t||"b"===t?"y":"x"}function jt(e){return Ct(_t(e))}function Lt(e,t,n){void 0===n&&(n=!1);const r=Ot(e),o=jt(e),i=St(o);let u="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(u=Dt(u)),[u,Dt(u)]}function kt(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Tt=["left","right"],At=["right","left"],Pt=["top","bottom"],Mt=["bottom","top"];function Dt(e){const t=Rt(e);return xt[t]+e.slice(t.length)}function $t(e){return"number"!=typeof e?function(e){var t,n,r,o;return{top:null!=(t=e.top)?t:0,right:null!=(n=e.right)?n:0,bottom:null!=(r=e.bottom)?r:0,left:null!=(o=e.left)?o:0}}(e):{top:e,right:e,bottom:e,left:e}}function It(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Nt(e,t,n){let{reference:r,floating:o}=e;const i=_t(t),u=jt(t),c=St(u),s=Rt(t),l="y"===i,a=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let p;switch(s){case"top":p={x:a,y:r.y-o.height};break;case"bottom":p={x:a,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}const v=Ot(t);return v&&(p[u]+=d*("end"===v?1:-1)*(n&&l?-1:1)),p}async function Ht(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:u,elements:c,strategy:s}=e,{boundary:l="clippingAncestors",rootBoundary:a="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=Et(t,e),v=$t(p),m=c[d?"floating"===f?"reference":"floating":f],h=It(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(c.floating)),boundary:l,rootBoundary:a,strategy:s})),y="floating"===f?{x:r,y:o,width:u.floating.width,height:u.floating.height}:u.reference,g=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c.floating)),b=await(null==i.isElement?void 0:i.isElement(g))&&await(null==i.getScale?void 0:i.getScale(g))||{x:1,y:1},x=It(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:g,strategy:s}):y);return{top:(h.top-x.top+v.top)/b.y,bottom:(x.bottom-h.bottom+v.bottom)/b.y,left:(h.left-x.left+v.left)/b.x,right:(x.right-h.right+v.right)/b.x}}const Ft=new Set(["left","top"]);function Wt(e){const t=ve(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=ne(e),i=o?e.offsetWidth:n,u=o?e.offsetHeight:r,c=yt(n)!==i||yt(r)!==u;return c&&(n=i,r=u),{width:n,height:r,$:c}}function zt(e){return te(e)?e:e.contextElement}function Bt(e){const t=zt(e);if(!ne(t))return bt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Wt(t);let u=(i?yt(n.width):n.width)/r,c=(i?yt(n.height):n.height)/o;return u&&Number.isFinite(u)||(u=1),c&&Number.isFinite(c)||(c=1),{x:u,y:c}}const Ut=bt(0);function Kt(e){const t=Q(e);return de()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Ut}function Vt(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=zt(e);let u=bt(1);t&&(r?te(r)&&(u=Bt(r)):u=Bt(e));const c=function(e,t,n){return void 0===t&&(t=!1),!!n&&t&&n===Q(e)}(i,n,r)?Kt(i):bt(0);let s=(o.left+c.x)/u.x,l=(o.top+c.y)/u.y,a=o.width/u.x,f=o.height/u.y;if(i&&r){const e=Q(i),t=te(r)?Q(r):r;let n=e,o=be(n);for(;o&&t!==n;){const e=Bt(o),t=o.getBoundingClientRect(),r=ve(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,u=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,l*=e.y,a*=e.x,f*=e.y,s+=i,l+=u,n=Q(o),o=be(n)}}return It({width:a,height:f,x:s,y:l})}function qt(e,t){const n=me(e).scrollLeft;return t?t.left+n:Vt(J(e)).left+n}function Xt(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-qt(e,n),y:n.top+t.scrollTop}}function Yt(e,t,n){let r;if("viewport"===t||"layoutViewport"===t)r=function(e,t,n){void 0===n&&(n="viewport");const r="layoutViewport"===n,o=Q(e),i=J(e),u=o.visualViewport;let c=i.clientWidth,s=i.clientHeight,l=0,a=0;if(u){const e=!de()||"fixed"===t;r?e||(l=-u.offsetLeft,a=-u.offsetTop):(c=u.width,s=u.height,e&&(l=u.offsetLeft,a=u.offsetTop))}if(qt(i)<=0){const e=i.ownerDocument,t=e.body,n=getComputedStyle(t),r="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(i.clientWidth-t.clientWidth-r),u="stable both-edges"===getComputedStyle(i).scrollbarGutter?o/2:o;u<=25&&(c-=u)}return{width:c,height:s,x:l,y:a}}(e,n,t);else if("document"===t)r=function(e){const t=me(e),n=e.ownerDocument.body,r=ht(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=ht(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+qt(e);const u=-t.scrollTop;return"rtl"===ve(n).direction&&(i+=ht(e.clientWidth,n.clientWidth)-r),{width:r,height:o,x:i,y:u}}(J(e));else if(te(t))r=function(e,t){const n=Vt(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Bt(e);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=Kt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return It(r)}function Gt(e,t,n){const r=ne(t),o=J(t),i="fixed"===n,u=Vt(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const s=bt(0);if((r||!i)&&(("body"!==Z(t)||oe(o))&&(c=me(t)),r)){const e=Vt(t,!0,i,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}!r&&o&&(s.x=qt(o));const l=!o||r||i?bt(0):Xt(o,c);return{x:u.left+c.scrollLeft-s.x-l.x,y:u.top+c.scrollTop-s.y-l.y,width:u.width,height:u.height}}function Zt(e){return"static"===ve(e).position}function Qt(e,t){if(!ne(e)||"fixed"===ve(e).position)return null;if(t)return t(e);let n=e.offsetParent;return J(e)===n&&(n=n.ownerDocument.body),n}function Jt(e,t){const n=Q(e);if(ue(e))return n;if(!ne(e)){let t=he(e);for(;t&&!pe(t);){if(te(t)&&!Zt(t))return t;t=he(t)}return n}let r=Qt(e,t);for(;r&&ie(r)&&Zt(r);)r=Qt(r,t);return r&&pe(r)&&Zt(r)&&!fe(r)?n:r||function(e){let t=he(e);for(;ne(t)&&!pe(t);){if(fe(t))return t;if(ue(t))return null;t=he(t)}return null}(e)||n}const en={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,u=J(r),c=!!t&&ue(t.floating);if(r===u||c&&i)return n;let s={scrollLeft:0,scrollTop:0},l=bt(1);const a=bt(0),f=ne(r);if((f||!i)&&(("body"!==Z(r)||oe(u))&&(s=me(r)),f)){const e=Vt(r);l=Bt(r),a.x=e.x+r.clientLeft,a.y=e.y+r.clientTop}const d=!u||f||i?bt(0):Xt(u,s);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-s.scrollLeft*l.x+a.x+d.x,y:n.y*l.y-s.scrollTop*l.y+a.y+d.y}},getDocumentElement:J,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?ue(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=ge(e,[],!1).filter(e=>te(e)&&"body"!==Z(e)),o=null;const i="fixed"===ve(e).position;let u=i?he(e):e;for(;te(u)&&!pe(u);){const e=ve(u),t=fe(u),n=o?o.position:i?"fixed":"";t||"fixed"!==n&&("absolute"!==n||"static"!==e.position)?o=e:r=r.filter(e=>e!==u),u=he(u)}return t.set(e,r),r}(t,this._c):[].concat(n),r],u=Yt(t,i[0],o);let c=u.top,s=u.right,l=u.bottom,a=u.left;for(let e=1;e<i.length;e++){const n=Yt(t,i[e],o);c=ht(n.top,c),s=mt(n.right,s),l=mt(n.bottom,l),a=ht(n.left,a)}return{width:s-a,height:l-c,x:a,y:c}},getOffsetParent:Jt,getElementRects:async function(e){const t=this.getOffsetParent||Jt,n=this.getDimensions,r=await n(e.floating);return{reference:Gt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return e.getClientRects?Array.from(e.getClientRects()):[]},getDimensions:function(e){const{width:t,height:n}=Wt(e);return{width:t,height:n}},getScale:Bt,isElement:te,isRTL:function(e){return"rtl"===ve(e).direction}};function tn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}const nn=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:u,initialPlacement:c,platform:s,elements:l}=t,{mainAxis:a=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:m=!0,...h}=Et(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const y=Rt(o),g=_t(c),b=Rt(c)===c,x=await(null==s.isRTL?void 0:s.isRTL(l.floating)),w=d||(b||!m?[Dt(c)]:function(e){const t=Dt(e);return[kt(e),t,kt(t)]}(c)),E="none"!==v;!d&&E&&w.push(...function(e,t,n,r){const o=Ot(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?At:Tt:t?Tt:At;case"left":case"right":return t?Pt:Mt;default:return[]}}(Rt(e),"start"===n,r);return o&&(i=i.map(e=>e+"-"+o),t&&(i=i.concat(i.map(kt)))),i}(c,m,v,x));const R=[c,...w],O=await s.detectOverflow(t,h),C=[];let S=(null==(r=i.flip)?void 0:r.overflows)||[];if(a&&C.push(O[y]),f){const e=Lt(o,u,x);C.push(O[e[0]],O[e[1]])}if(S=[...S,{placement:o,overflows:C}],!C.every(e=>e<=0)){var _,j;const e=((null==(_=i.flip)?void 0:_.index)||0)+1,t=R[e];if(t&&("alignment"!==f||g===_t(t)||S.every(e=>_t(e.placement)!==g||e.overflows[0]>0)))return{data:{index:e,overflows:S},reset:{placement:t}};let n=null==(j=S.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:j.placement;if(!n)switch(p){case"bestFit":{var L;const e=null==(L=S.filter(e=>{if(E){const t=_t(e.placement);return t===g||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:L[0];e&&(n=e);break}case"initialPlacement":n=c}if(o!==n)return{reset:{placement:n}}}return{}}}},rn=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:u,elements:c,middlewareData:s}=t,{element:l,padding:a=0}=Et(e,t)||{};if(null==l)return{};const f=$t(a),d={x:n,y:r},p=jt(o),v=St(p),m=await u.getDimensions(l),h="y"===p,y=h?"top":"left",g=h?"bottom":"right",b=h?"clientHeight":"clientWidth",x=i.reference[v]+i.reference[p]-d[p]-i.floating[v],w=d[p]-i.reference[p],E=await(null==u.getOffsetParent?void 0:u.getOffsetParent(l));let R=E?E[b]:0;R&&await(null==u.isElement?void 0:u.isElement(E))||(R=c.floating[b]||i.floating[v]);const O=x/2-w/2,C=R/2-m[v]/2-1,S=mt(f[y],C),_=mt(f[g],C),j=R-m[v]-_,L=R/2-m[v]/2+O,k=wt(S,L,j),T=!s.arrow&&null!=Ot(o)&&L!==k&&i.reference[v]/2-(L<S?S:_)-m[v]/2<0,A=T?L<S?L-S:L-j:0;return{[p]:d[p]+A,data:{[p]:k,centerOffset:L-k-A,...T&&{alignmentOffset:A}},reset:T}}}),on=(e,t,n)=>{const r=new Map,o=null!=n?n:{},i={...en,...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:u}=n,c=u.detectOverflow?u:{...u,detectOverflow:Ht},s=await(null==u.isRTL?void 0:u.isRTL(t));let l=await u.getElementRects({reference:e,floating:t,strategy:o}),{x:a,y:f}=Nt(l,r,s),d=r,p=0;const v={};for(let n=0;n<i.length;n++){const m=i[n];if(!m)continue;const{name:h,fn:y}=m,{x:g,y:b,data:x,reset:w}=await y({x:a,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:v,rects:l,platform:c,elements:{reference:e,floating:t}});a=null!=g?g:a,f=null!=b?b:f,v[h]={...v[h],...x},w&&p<50&&(p++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(l=!0===w.rects?await u.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:a,y:f}=Nt(l,d,s))),n=-1)}return{x:a,y:f,placement:d,strategy:o,middlewareData:v}})(e,t,{...o,platform:i})};var un="undefined"!=typeof document?u().useLayoutEffect:function(){};function cn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!cn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!==r--;){const n=o[r];if(!("_owner"===n&&e.$$typeof||cn(e[n],t[n])))return!1}return!0}return e!=e&&t!=t}function sn(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ln(e,t){const n=sn(e);return Math.round(t*n)/n}function an(e){const t=u().useRef(e);return un(()=>{t.current=e}),t}const fn="data-floating-ui-focusable",dn="active",pn="selected",vn={...R()};let mn=!1,hn=0;const yn=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+hn++,gn=vn.useId||function(){const[e,t]=u().useState(()=>mn?yn():void 0);return nt(()=>{null==e&&t(yn())},[]),u().useEffect(()=>{mn=!0},[]),e},bn=u().forwardRef(function(e,t){const{context:{placement:n,elements:{floating:r},middlewareData:{arrow:i,shift:c}},width:s=14,height:l=7,tipRadius:a=0,strokeWidth:f=0,staticOffset:d,stroke:p,d:v,style:{transform:m,...h}={},...y}=e,g=gn(),[b,x]=u().useState(!1);if(nt(()=>{r&&"rtl"===ve(r).direction&&x(!0)},[r]),!r)return null;const[w,E]=n.split("-"),R="top"===w||"bottom"===w;let O=d;(R&&null!=c&&c.x||!R&&null!=c&&c.y)&&(O=null);const C=2*f,S=C/2,_=s/2*(a/-8+1),j=l/2*a/4,L=!!v,k=O&&"end"===E?"bottom":"top";let T=O&&"end"===E?"right":"left";O&&b&&(T="end"===E?"left":"right");const A=null!=(null==i?void 0:i.x)?O||i.x:"",P=null!=(null==i?void 0:i.y)?O||i.y:"",M=v||"M0,0 H"+s+" L"+(s-_)+","+(l-j)+" Q"+s/2+","+l+" "+_+","+(l-j)+" Z",D={top:L?"rotate(180deg)":"",left:L?"rotate(90deg)":"rotate(-90deg)",bottom:L?"":"rotate(180deg)",right:L?"rotate(-90deg)":"rotate(90deg)"}[w];return(0,o().jsxs)("svg",{...y,"aria-hidden":!0,ref:t,width:L?s:s+C,height:s,viewBox:"0 0 "+s+" "+(l>s?l:s),style:{position:"absolute",pointerEvents:"none",[T]:A,[k]:P,[w]:R||L?"100%":"calc(100% - "+C/2+"px)",transform:[D,m].filter(e=>!!e).join(" "),...h},children:[C>0&&(0,o().jsx)("path",{clipPath:"url(#"+g+")",fill:"none",stroke:p,strokeWidth:C+(v?0:1),d:M}),(0,o().jsx)("path",{stroke:C&&!v?y.fill:"none",d:M}),(0,o().jsx)("clipPath",{id:g,children:(0,o().jsx)("rect",{x:-S,y:S*(L?-1:1),width:s+C,height:s})})]})});function xn(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;null==(r=e.get(t))||r.delete(n)}}}const wn=u().createContext(null),En=u().createContext(null),Rn=()=>{var e;return(null==(e=u().useContext(wn))?void 0:e.id)||null},On=()=>u().useContext(En);function Cn(e){const{children:t,id:n}=e,r=Rn();return(0,o().jsx)(wn.Provider,{value:u().useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Sn(e){const{children:t}=e,n=u().useRef([]),r=u().useCallback(e=>{n.current=[...n.current,e]},[]),i=u().useCallback(e=>{n.current=n.current.filter(t=>t!==e)},[]),[c]=u().useState(()=>xn());return(0,o().jsx)(En.Provider,{value:u().useMemo(()=>({nodesRef:n,addNode:r,removeNode:i,events:c}),[r,i,c]),children:t})}function _n(e){return"data-floating-ui-"+e}function jn(e){-1!==e.current&&(clearTimeout(e.current),e.current=-1)}const Ln=_n("safe-polygon");function kn(e,t,n){if(n&&!tt(n))return 0;if("number"==typeof e)return e;if("function"==typeof e){const n=e();return"number"==typeof n?n:null==n?void 0:n[t]}return null==e?void 0:e[t]}function Tn(e){return"function"==typeof e?e():e}let An=0;function Pn(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(An);const i=()=>null==e?void 0:e.focus({preventScroll:n});o?i():An=requestAnimationFrame(i)}function Mn(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&re(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}const Dn={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function $n(e){return"inert"===e?Dn.inert:"aria-hidden"===e?Dn["aria-hidden"]:Dn.none}let In=new WeakSet,Nn={},Hn=0;function Fn(e){return e?re(e)?e.host:Fn(e.parentNode):null}const Wn=(e,t)=>t.map(t=>{if(e.contains(t))return t;const n=Fn(t);return e.contains(n)?n:null}).filter(e=>null!=e);function zn(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=(o=e[0],(null==o?void 0:o.ownerDocument)||document).body;var o;return function(e,t,n,r){const o="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,u=Wn(t,e),c=new Set,s=new Set(u),l=[];Nn[o]||(Nn[o]=new WeakMap);const a=Nn[o];return u.forEach(function e(t){t&&!c.has(t)&&(c.add(t),t.parentNode&&e(t.parentNode))}),function e(t){t&&!s.has(t)&&[].forEach.call(t.children,t=>{if("script"!==Z(t))if(c.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,r=$n(i),u=(r.get(t)||0)+1,c=(a.get(t)||0)+1;r.set(t,u),a.set(t,c),l.push(t),1===u&&n&&In.add(t),1===c&&t.setAttribute(o,""),!n&&i&&t.setAttribute(i,"inert"===i?"":"true")}})}(t),c.clear(),Hn++,()=>{l.forEach(e=>{const t=$n(i),n=(t.get(e)||0)-1,r=(a.get(e)||0)-1;t.set(e,n),a.set(e,r),n||(!In.has(e)&&i&&e.removeAttribute(i),In.delete(e)),r||e.removeAttribute(o)}),Hn--,Hn||(Dn.inert=new WeakMap,Dn["aria-hidden"]=new WeakMap,Dn.none=new WeakMap,In=new WeakSet,Nn={})}}(e.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))),r,t,n)}const Bn={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},Un=u().forwardRef(function(e,t){const[n,r]=u().useState();nt(()=>{Fe()&&r("button")},[]);const i={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[_n("focus-guard")]:"",style:Bn};return(0,o().jsx)("span",{...e,...i})}),Kn={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Vn=u().createContext(null),qn=_n("portal");function Xn(t){const{children:n,id:r,root:i,preserveTabOrder:c=!0}=t,s=function(e){void 0===e&&(e={});const{id:t,root:n}=e,r=gn(),o=Yn(),[i,c]=u().useState(null),s=u().useRef(null);return nt(()=>()=>{null==i||i.remove(),queueMicrotask(()=>{s.current=null})},[i]),nt(()=>{if(!r)return;if(s.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=r,n.setAttribute(qn,""),e.appendChild(n),s.current=n,c(n)},[t,r]),nt(()=>{if(null===n)return;if(!r)return;if(s.current)return;let e=n||(null==o?void 0:o.portalNode);e&&!ee(e)&&(e=e.current),e=e||document.body;let i=null;t&&(i=document.createElement("div"),i.id=t,e.appendChild(i));const u=document.createElement("div");u.id=r,u.setAttribute(qn,""),e=i||e,e.appendChild(u),s.current=u,c(u)},[t,n,r,o]),i}({id:r,root:i}),[l,a]=u().useState(null),f=u().useRef(null),d=u().useRef(null),p=u().useRef(null),v=u().useRef(null),m=null==l?void 0:l.modal,h=null==l?void 0:l.open,y=!!l&&!l.modal&&l.open&&c&&!(!i&&!s);return u().useEffect(()=>{if(s&&c&&!m)return s.addEventListener("focusin",e,!0),s.addEventListener("focusout",e,!0),()=>{s.removeEventListener("focusin",e,!0),s.removeEventListener("focusout",e,!0)};function e(e){s&&at(e)&&("focusin"===e.type?dt:ft)(s)}},[s,c,m]),u().useEffect(()=>{s&&(h||dt(s))},[h,s]),(0,o().jsxs)(Vn.Provider,{value:u().useMemo(()=>({preserveTabOrder:c,beforeOutsideRef:f,afterOutsideRef:d,beforeInsideRef:p,afterInsideRef:v,portalNode:s,setFocusManagerState:a}),[c,s]),children:[y&&s&&(0,o().jsx)(Un,{"data-type":"outside",ref:f,onFocus:e=>{if(at(e,s)){var t;null==(t=p.current)||t.focus()}else{const e=lt(l?l.domReference:null);null==e||e.focus()}}}),y&&s&&(0,o().jsx)("span",{"aria-owns":s.id,style:Kn}),s&&e().createPortal(n,s),y&&s&&(0,o().jsx)(Un,{"data-type":"outside",ref:d,onFocus:e=>{if(at(e,s)){var t;null==(t=v.current)||t.focus()}else{const t=st(l?l.domReference:null);null==t||t.focus(),(null==l?void 0:l.closeOnFocusOut)&&(null==l||l.onOpenChange(!1,e.nativeEvent,"focus-out"))}}})]})}const Yn=()=>u().useContext(Vn);function Gn(e){return u().useMemo(()=>t=>{e.forEach(e=>{e&&(e.current=t)})},e)}let Zn=[];function Qn(){Zn=Zn.filter(e=>{var t;return null==(t=e.deref())?void 0:t.isConnected})}function Jn(){Qn();const e=Zn[Zn.length-1];return null==e?void 0:e.deref()}function er(e,t){var n;if(!(t.current.includes("floating")||null!=(n=e.getAttribute("role"))&&n.includes("dialog")))return;const r=ut(),o=function(e,t){return(t=t||{}).getShadowRoot?Se([e],t.includeContainer,{filter:Ae.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):Ce(e,t.includeContainer,Ae.bind(null,t))}(e,r),i=o.filter(e=>{const t=e.getAttribute("data-tabindex")||"";return Ie(e,r)||e.hasAttribute("data-tabindex")&&!t.startsWith("-")}),u=e.getAttribute("tabindex");t.current.includes("floating")||0===i.length?"0"!==u&&e.setAttribute("tabindex","0"):("-1"!==u||e.hasAttribute("data-tabindex")&&"-1"!==e.getAttribute("data-tabindex"))&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}const tr=u().forwardRef(function(e,t){return(0,o().jsx)("button",{...e,type:"button",ref:t,tabIndex:-1,style:Bn})});function nr(e){const{context:t,children:n,disabled:r=!1,order:i=["content"],guards:c=!0,initialFocus:s=0,returnFocus:l=!0,restoreFocus:a=!1,modal:f=!0,visuallyHiddenDismiss:d=!1,closeOnFocusOut:p=!0,outsideElementsInert:v=!1,getInsideElements:m=()=>[]}=e,{open:h,onOpenChange:y,events:g,dataRef:b,elements:{domReference:x,floating:w}}=t,E=it(()=>{var e;return null==(e=b.current.floatingContext)?void 0:e.nodeId}),R=it(m),O="number"==typeof s&&s<0,C=Ge(x)&&O,S="undefined"!=typeof HTMLElement&&"inert"in HTMLElement.prototype,_=!S||c,j=!_||S&&v,L=rt(i),k=rt(s),T=rt(l),A=On(),P=Yn(),M=u().useRef(null),D=u().useRef(null),$=u().useRef(!1),I=u().useRef(!1),N=u().useRef(-1),H=u().useRef(-1),F=null!=P,W=Ze(w),z=it(function(e){return void 0===e&&(e=W),e?$e(e,ut()):[]}),B=it(e=>{const t=z(e);return L.current.map(e=>x&&"reference"===e?x:W&&"floating"===e?W:t).filter(Boolean).flat()});u().useEffect(()=>{if(r)return;if(!f)return;function e(e){if("Tab"===e.key){Ke(W,Ue(Xe(W)))&&0===z().length&&!C&&et(e);const t=B(),n=Ve(e);"reference"===L.current[0]&&n===x&&(et(e),e.shiftKey?Pn(t[t.length-1]):Pn(t[1])),"floating"===L.current[1]&&n===W&&e.shiftKey&&(et(e),Pn(t[0]))}}const t=Xe(W);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}},[r,x,W,f,L,C,z,B]),u().useEffect(()=>{if(!r&&w)return w.addEventListener("focusin",e),()=>{w.removeEventListener("focusin",e)};function e(e){const t=Ve(e),n=z().indexOf(t);-1!==n&&(N.current=n)}},[r,w,z]),u().useEffect(()=>{if(r)return;if(!p)return;function e(){I.current=!0,setTimeout(()=>{I.current=!1})}function t(e){const t=e.relatedTarget,n=e.currentTarget,r=Ve(e);queueMicrotask(()=>{const o=E(),i=!(Ke(x,t)||Ke(w,t)||Ke(t,w)||Ke(null==P?void 0:P.portalNode,t)||null!=t&&t.hasAttribute(_n("focus-guard"))||A&&(Qe(A.nodesRef.current,o).find(e=>{var n,r;return Ke(null==(n=e.context)?void 0:n.elements.floating,t)||Ke(null==(r=e.context)?void 0:r.elements.domReference,t)})||Je(A.nodesRef.current,o).find(e=>{var n,r,o;return[null==(n=e.context)?void 0:n.elements.floating,Ze(null==(r=e.context)?void 0:r.elements.floating)].includes(t)||(null==(o=e.context)?void 0:o.elements.domReference)===t})));if(n===x&&W&&er(W,L),a&&n!==x&&(null==r||!r.isConnected)&&Ue(Xe(W))===Xe(W).body){ne(W)&&W.focus();const e=N.current,t=z(),n=t[e]||t[t.length-1]||W;ne(n)&&n.focus()}b.current.insideReactTree?b.current.insideReactTree=!1:!C&&f||!t||!i||I.current||t===Jn()||($.current=!0,y(!1,e,"focus-out"))})}const n=Boolean(!A&&P);function o(){jn(H),b.current.insideReactTree=!0,H.current=window.setTimeout(()=>{b.current.insideReactTree=!1})}return w&&ne(x)?(x.addEventListener("focusout",t),x.addEventListener("pointerdown",e),w.addEventListener("focusout",t),n&&w.addEventListener("focusout",o,!0),()=>{x.removeEventListener("focusout",t),x.removeEventListener("pointerdown",e),w.removeEventListener("focusout",t),n&&w.removeEventListener("focusout",o,!0)}):void 0},[r,x,w,W,f,A,P,y,p,a,z,C,E,L,b]);const U=u().useRef(null),K=u().useRef(null),V=Gn([U,null==P?void 0:P.beforeInsideRef]),q=Gn([K,null==P?void 0:P.afterInsideRef]);function X(e){return!r&&d&&f?(0,o().jsx)(tr,{ref:"start"===e?M:D,onClick:e=>y(!1,e.nativeEvent),children:"string"==typeof d?d:"Dismiss"}):null}u().useEffect(()=>{var e,t;if(r)return;if(!w)return;const n=Array.from((null==P||null==(e=P.portalNode)?void 0:e.querySelectorAll("["+_n("portal")+"]"))||[]),o=null==(t=(A?Je(A.nodesRef.current,E()):[]).find(e=>{var t;return Ge((null==(t=e.context)?void 0:t.elements.domReference)||null)}))||null==(t=t.context)?void 0:t.elements.domReference,i=[w,o,...n,...R(),M.current,D.current,U.current,K.current,null==P?void 0:P.beforeOutsideRef.current,null==P?void 0:P.afterOutsideRef.current,L.current.includes("reference")||C?x:null].filter(e=>null!=e),u=f||C?zn(i,!j,j):zn(i);return()=>{u()}},[r,x,w,f,L,P,C,_,j,A,E,R]),nt(()=>{if(r||!ne(W))return;const e=Ue(Xe(W));queueMicrotask(()=>{const t=B(W),n=k.current,r=("number"==typeof n?t[n]:n.current)||W,o=Ke(W,e);O||o||!h||Pn(r,{preventScroll:r===W})})},[r,h,W,O,B,k]),nt(()=>{if(r||!W)return;const e=Xe(W);var t;function n(e){let{reason:t,event:n,nested:r}=e;if(["hover","safe-polygon"].includes(t)&&"mouseleave"===n.type&&($.current=!0),"outside-press"===t)if(r)$.current=!1;else if(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(We()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}(n)||function(e){return!ze()&&(!We()&&0===e.width&&0===e.height||We()&&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)}(n))$.current=!1;else{let e=!1;document.createElement("div").focus({get preventScroll(){return e=!0,!1}}),$.current=!e}}t=Ue(e),Qn(),t&&"body"!==Z(t)&&(Zn.push(new WeakRef(t)),Zn.length>20&&(Zn=Zn.slice(-20))),g.on("openchange",n);const o=e.createElement("span");return o.setAttribute("tabindex","-1"),o.setAttribute("aria-hidden","true"),Object.assign(o.style,Bn),F&&x&&x.insertAdjacentElement("afterend",o),()=>{g.off("openchange",n);const t=Ue(e),r=Ke(w,t)||A&&Qe(A.nodesRef.current,E(),!1).some(e=>{var n;return Ke(null==(n=e.context)?void 0:n.elements.floating,t)}),i=function(){if("boolean"==typeof T.current){const e=x||Jn();return e&&e.isConnected?e:o}return T.current.current||o}();queueMicrotask(()=>{const n=function(e){const t=ut();return Ie(e,t)?e:$e(e,t)[0]||e}(i);T.current&&!$.current&&ne(n)&&(n===t||t===e.body||r)&&n.focus({preventScroll:!0}),o.remove()})}},[r,w,W,T,b,g,A,F,x,E]),u().useEffect(()=>(queueMicrotask(()=>{$.current=!1}),()=>{queueMicrotask(Qn)}),[r]),nt(()=>{if(!r&&P)return P.setFocusManagerState({modal:f,closeOnFocusOut:p,open:h,onOpenChange:y,domReference:x}),()=>{P.setFocusManagerState(null)}},[r,P,f,h,y,p,x]),nt(()=>{r||W&&er(W,L)},[r,W,L]);const Y=!r&&_&&(!f||!C)&&(F||f);return(0,o().jsxs)(o().Fragment,{children:[Y&&(0,o().jsx)(Un,{"data-type":"inside",ref:V,onFocus:e=>{if(f){const e=B();Pn("reference"===i[0]?e[0]:e[e.length-1])}else if(null!=P&&P.preserveTabOrder&&P.portalNode)if($.current=!1,at(e,P.portalNode)){const e=st(x);null==e||e.focus()}else{var t;null==(t=P.beforeOutsideRef.current)||t.focus()}}}),!C&&X("start"),n,X("end"),Y&&(0,o().jsx)(Un,{"data-type":"inside",ref:q,onFocus:e=>{if(f)Pn(B()[0]);else if(null!=P&&P.preserveTabOrder&&P.portalNode)if(p&&($.current=!0),at(e,P.portalNode)){const e=lt(x);null==e||e.focus()}else{var t;null==(t=P.afterOutsideRef.current)||t.focus()}}})]})}function rr(e){return ne(e.target)&&"BUTTON"===e.target.tagName}function or(e){return Ye(e)}function ir(e){return null!=e&&null!=e.clientX}const ur={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},cr={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},sr=e=>{var t,n;return{escapeKey:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePress:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}};function lr(){return Ne().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints&&Fe()}function ar(e,t,n){const r=new Map,o="item"===n;let i=e;if(o&&e){const{[dn]:t,[pn]:n,...r}=e;i=r}return{..."floating"===n&&{tabIndex:-1,[fn]:""},...i,...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,i]=t;var u;o&&[dn,pn].includes(n)||(0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof i&&(null==(u=r.get(n))||u.push(i),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];return null==(e=r.get(n))?void 0:e.map(e=>e(...o)).find(e=>void 0!==e)})):e[n]=i)}),e):e,{})}}const fr=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]),dr=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?"-":"")+e.toLowerCase());function pr(e,t){return"function"==typeof e?e(t):e}function vr(e,t,n){return void 0===n&&(n=!0),e.filter(e=>{var r;return e.parentId===t&&(!n||(null==(r=e.context)?void 0:r.open))}).flatMap(t=>[t,...vr(e,t.id,n)])}function mr(e,t){const[n,r]=e;let o=!1;const i=t.length;for(let e=0,u=i-1;e<i;u=e++){const[i,c]=t[e]||[0,0],[s,l]=t[u]||[0,0];c>=r!=l>=r&&n<=(s-i)*(r-c)/(l-c)+i&&(o=!o)}return o}function hr(e){void 0===e&&(e={});const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,o={current:-1};let i=!1,u=null,c=null,s="undefined"!=typeof performance?performance.now():0;const l=e=>{let{x:n,y:l,placement:a,elements:f,onClose:d,nodeId:p,tree:v}=e;return function(e){function m(){jn(o),d()}if(jn(o),!f.domReference||!f.floating||null==a||null==n||null==l)return;const{clientX:h,clientY:y}=e,g=[h,y],b=function(e){return"composedPath"in e?e.composedPath()[0]:e.target}(e),x="mouseleave"===e.type,w=Mn(f.floating,b),E=Mn(f.domReference,b),R=f.domReference.getBoundingClientRect(),O=f.floating.getBoundingClientRect(),C=a.split("-")[0],S=n>O.right-O.width/2,_=l>O.bottom-O.height/2,j=function(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}(g,R),L=O.width>R.width,k=O.height>R.height,T=(L?R:O).left,A=(L?R:O).right,P=(k?R:O).top,M=(k?R:O).bottom;if(w&&(i=!0,!x))return;if(E&&(i=!1),E&&!x)return void(i=!0);if(x&&te(e.relatedTarget)&&Mn(f.floating,e.relatedTarget))return;if(v&&vr(v.nodesRef.current,p).length)return;if("top"===C&&l>=R.bottom-1||"bottom"===C&&l<=R.top+1||"left"===C&&n>=R.right-1||"right"===C&&n<=R.left+1)return m();let D=[];switch(C){case"top":D=[[T,R.top+1],[T,O.bottom-1],[A,O.bottom-1],[A,R.top+1]];break;case"bottom":D=[[T,O.top+1],[T,R.bottom-1],[A,R.bottom-1],[A,O.top+1]];break;case"left":D=[[O.right-1,M],[O.right-1,P],[R.left+1,P],[R.left+1,M]];break;case"right":D=[[R.right-1,M],[R.right-1,P],[O.left+1,P],[O.left+1,M]]}if(!mr([h,y],D)){if(i&&!j)return m();if(!x&&r){const t=function(e,t){const n=performance.now(),r=n-s;if(null===u||null===c||0===r)return u=e,c=t,s=n,null;const o=e-u,i=t-c,l=Math.sqrt(o*o+i*i);return u=e,c=t,s=n,l/r}(e.clientX,e.clientY);if(null!==t&&t<.1)return m()}mr([h,y],function(e){let[n,r]=e;switch(C){case"top":return[[L?n+t/2:S?n+4*t:n-4*t,r+t+1],[L?n-t/2:S?n+4*t:n-4*t,r+t+1],[O.left,S||L?O.bottom-t:O.top],[O.right,S?L?O.bottom-t:O.top:O.bottom-t]];case"bottom":return[[L?n+t/2:S?n+4*t:n-4*t,r-t],[L?n-t/2:S?n+4*t:n-4*t,r-t],[O.left,S||L?O.top+t:O.bottom],[O.right,S?L?O.top+t:O.bottom:O.top+t]];case"left":{const e=[n+t+1,k?r+t/2:_?r+4*t:r-4*t],o=[n+t+1,k?r-t/2:_?r+4*t:r-4*t];return[[_||k?O.right-t:O.left,O.top],[_?k?O.right-t:O.left:O.right-t,O.bottom],e,o]}case"right":return[[n-t,k?r+t/2:_?r+4*t:r-4*t],[n-t,k?r-t/2:_?r+4*t:r-4*t],[_||k?O.left+t:O.right,O.top],[_?k?O.left+t:O.right:O.left+t,O.bottom]]}}([n,l]))?!i&&r&&(o.current=window.setTimeout(m,40)):m()}}};return l.__options={blockPointerEvents:n},l}const yr=({children:e,enabled:t=!0,...n})=>{const r=Rn();return!t||r?e:(0,o().jsx)(Sn,{...n,children:e})},gr=(0,c.styled)(E,({$width:e="max-content"})=>({$width:e}))``,br=({children:e,enabled:t=!0,...n})=>t?(0,o().jsx)(Xn,{...n,children:e}):e,xr=(e,{enabled:t=!0,event:n="click",dismissOptions:r,clickOptions:o,hoverOptions:i,focusOptions:c,clientPointsOptions:s,roleOptions:l,extraInteractions:a=[]})=>{const f=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=e,{enabled:c=!0,escapeKey:s=!0,outsidePress:l=!0,outsidePressEvent:a="pointerdown",referencePress:f=!1,referencePressEvent:d="pointerdown",ancestorScroll:p=!1,bubbles:v,capture:m}=t,h=On(),y=it("function"==typeof l?l:()=>!1),g="function"==typeof l?y:l,b=u().useRef(!1),{escapeKey:x,outsidePress:w}=sr(v),{escapeKey:E,outsidePress:R}=sr(m),O=u().useRef(!1),C=it(e=>{var t;if(!n||!c||!s||"Escape"!==e.key)return;if(O.current)return;const o=null==(t=i.current.floatingContext)?void 0:t.nodeId,u=h?Qe(h.nodesRef.current,o):[];if(!x&&(e.stopPropagation(),u.length>0)){let e=!0;if(u.forEach(t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)}),!e)return}r(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")}),S=it(e=>{var t;const n=()=>{var t;C(e),null==(t=Ve(e))||t.removeEventListener("keydown",n)};null==(t=Ve(e))||t.addEventListener("keydown",n)}),_=it(e=>{var t;const n=i.current.insideReactTree;i.current.insideReactTree=!1;const u=b.current;if(b.current=!1,"click"===a&&u)return;if(n)return;if("function"==typeof g&&!g(e))return;const c=Ve(e),s="["+_n("inert")+"]",l=Xe(o.floating).querySelectorAll(s);let f=te(c)?c:null;for(;f&&!pe(f);){const e=he(f);if(pe(e)||!te(e))break;f=e}if(l.length&&te(c)&&!c.matches("html,body")&&!Ke(c,o.floating)&&Array.from(l).every(e=>!Ke(f,e)))return;if(ne(c)&&k){const t=pe(c),n=ve(c),r=/auto|scroll/,o=t||r.test(n.overflowX),i=t||r.test(n.overflowY),u=o&&c.clientWidth>0&&c.scrollWidth>c.clientWidth,s=i&&c.clientHeight>0&&c.scrollHeight>c.clientHeight,l="rtl"===n.direction,a=s&&(l?e.offsetX<=c.offsetWidth-c.clientWidth:e.offsetX>c.clientWidth),f=u&&e.offsetY>c.clientHeight;if(a||f)return}const d=null==(t=i.current.floatingContext)?void 0:t.nodeId,p=h&&Qe(h.nodesRef.current,d).some(t=>{var n;return qe(e,null==(n=t.context)?void 0:n.elements.floating)});if(qe(e,o.floating)||qe(e,o.domReference)||p)return;const v=h?Qe(h.nodesRef.current,d):[];if(v.length>0){let e=!0;if(v.forEach(t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)}),!e)return}r(!1,e,"outside-press")}),j=it(e=>{var t;const n=()=>{var t;_(e),null==(t=Ve(e))||t.removeEventListener(a,n)};null==(t=Ve(e))||t.addEventListener(a,n)});u().useEffect(()=>{if(!n||!c)return;i.current.__escapeKeyBubbles=x,i.current.__outsidePressBubbles=w;let e=-1;function t(e){r(!1,e,"ancestor-scroll")}function u(){window.clearTimeout(e),O.current=!0}function l(){e=window.setTimeout(()=>{O.current=!1},de()?5:0)}const f=Xe(o.floating);s&&(f.addEventListener("keydown",E?S:C,E),f.addEventListener("compositionstart",u),f.addEventListener("compositionend",l)),g&&f.addEventListener(a,R?j:_,R);let d=[];return p&&(te(o.domReference)&&(d=ge(o.domReference)),te(o.floating)&&(d=d.concat(ge(o.floating))),!te(o.reference)&&o.reference&&o.reference.contextElement&&(d=d.concat(ge(o.reference.contextElement)))),d=d.filter(e=>{var t;return e!==(null==(t=f.defaultView)?void 0:t.visualViewport)}),d.forEach(e=>{e.addEventListener("scroll",t)}),()=>{s&&(f.removeEventListener("keydown",E?S:C,E),f.removeEventListener("compositionstart",u),f.removeEventListener("compositionend",l)),g&&f.removeEventListener(a,R?j:_,R),d.forEach(e=>{e.removeEventListener("scroll",t)}),window.clearTimeout(e)}},[i,o,s,g,a,n,r,p,c,x,w,C,E,S,_,R,j]),u().useEffect(()=>{i.current.insideReactTree=!1},[i,g,a]);const L=u().useMemo(()=>({onKeyDown:C,...f&&{[ur[d]]:e=>{r(!1,e.nativeEvent,"reference-press")},..."click"!==d&&{onClick(e){r(!1,e.nativeEvent,"reference-press")}}}}),[C,r,f,d]),k=u().useMemo(()=>{function e(e){0===e.button&&(b.current=!0)}return{onKeyDown:C,onMouseDown:e,onMouseUp:e,[cr[a]]:()=>{i.current.insideReactTree=!0}}},[C,a,i]);return u().useMemo(()=>c?{reference:L,floating:k}:{},[c,L,k])}(e,{escapeKey:!1,...r}),d=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:i}}=e,{enabled:c=!0,event:s="click",toggle:l=!0,ignoreMouse:a=!1,keyboardHandlers:f=!0,stickIfOpen:d=!0}=t,p=u().useRef(),v=u().useRef(!1),m=u().useMemo(()=>({onPointerDown(e){p.current=e.pointerType},onMouseDown(e){const t=p.current;0===e.button&&"click"!==s&&(tt(t,!0)&&a||(!n||!l||o.current.openEvent&&d&&"mousedown"!==o.current.openEvent.type?(e.preventDefault(),r(!0,e.nativeEvent,"click")):r(!1,e.nativeEvent,"click")))},onClick(e){const t=p.current;"mousedown"===s&&p.current?p.current=void 0:tt(t,!0)&&a||(!n||!l||o.current.openEvent&&d&&"click"!==o.current.openEvent.type?r(!0,e.nativeEvent,"click"):r(!1,e.nativeEvent,"click"))},onKeyDown(e){p.current=void 0,e.defaultPrevented||!f||rr(e)||(" "!==e.key||or(i)||(e.preventDefault(),v.current=!0),function(e){return ne(e.target)&&"A"===e.target.tagName}(e)||"Enter"===e.key&&r(!n||!l,e.nativeEvent,"click"))},onKeyUp(e){e.defaultPrevented||!f||rr(e)||or(i)||" "===e.key&&v.current&&(v.current=!1,r(!n||!l,e.nativeEvent,"click"))}}),[o,i,s,a,f,r,n,d,l]);return u().useMemo(()=>c?{reference:m}:{},[c,m])}(e,{enabled:t&&"click"===n,...o}),p=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:c}=e,{enabled:s=!0,delay:l=0,handleClose:a=null,mouseOnly:f=!1,restMs:d=0,move:p=!0}=t,v=On(),m=Rn(),h=rt(a),y=rt(l),g=rt(n),b=rt(d),x=u().useRef(),w=u().useRef(-1),E=u().useRef(),R=u().useRef(-1),O=u().useRef(!0),C=u().useRef(!1),S=u().useRef(()=>{}),_=u().useRef(!1),j=it(()=>{var e;const t=null==(e=o.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t});u().useEffect(()=>{if(s)return i.on("openchange",e),()=>{i.off("openchange",e)};function e(e){let{open:t}=e;t||(jn(w),jn(R),O.current=!0,_.current=!1)}},[s,i]),u().useEffect(()=>{if(!s)return;if(!h.current)return;if(!n)return;function e(e){j()&&r(!1,e,"hover")}const t=Xe(c.floating).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}},[c.floating,n,r,s,h,j]);const L=u().useCallback(function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");const o=kn(y.current,"close",x.current);o&&!E.current?(jn(w),w.current=window.setTimeout(()=>r(!1,e,n),o)):t&&(jn(w),r(!1,e,n))},[y,r]),k=it(()=>{S.current(),E.current=void 0}),T=it(()=>{if(C.current){const e=Xe(c.floating).body;e.style.pointerEvents="",e.removeAttribute(Ln),C.current=!1}}),A=it(()=>!!o.current.openEvent&&["click","mousedown"].includes(o.current.openEvent.type));u().useEffect(()=>{if(s&&te(c.domReference)){const r=c.domReference,o=c.floating;return n&&r.addEventListener("mouseleave",i),p&&r.addEventListener("mousemove",e,{once:!0}),r.addEventListener("mouseenter",e),r.addEventListener("mouseleave",t),o&&(o.addEventListener("mouseleave",i),o.addEventListener("mouseenter",u),o.addEventListener("mouseleave",l)),()=>{n&&r.removeEventListener("mouseleave",i),p&&r.removeEventListener("mousemove",e),r.removeEventListener("mouseenter",e),r.removeEventListener("mouseleave",t),o&&(o.removeEventListener("mouseleave",i),o.removeEventListener("mouseenter",u),o.removeEventListener("mouseleave",l))}}function e(e){if(jn(w),O.current=!1,f&&!tt(x.current)||Tn(b.current)>0&&!kn(y.current,"open"))return;const t=kn(y.current,"open",x.current);t?w.current=window.setTimeout(()=>{g.current||r(!0,e,"hover")},t):n||r(!0,e,"hover")}function t(e){if(A())return void T();S.current();const t=Xe(c.floating);if(jn(R),_.current=!1,h.current&&o.current.floatingContext){n||jn(w),E.current=h.current({...o.current.floatingContext,tree:v,x:e.clientX,y:e.clientY,onClose(){T(),k(),A()||L(e,!0,"safe-polygon")}});const r=E.current;return t.addEventListener("mousemove",r),void(S.current=()=>{t.removeEventListener("mousemove",r)})}("touch"!==x.current||!Ke(c.floating,e.relatedTarget))&&L(e)}function i(e){A()||o.current.floatingContext&&(null==h.current||h.current({...o.current.floatingContext,tree:v,x:e.clientX,y:e.clientY,onClose(){T(),k(),A()||L(e)}})(e))}function u(){jn(w)}function l(e){A()||L(e,!1)}},[c,s,e,f,p,L,k,T,r,n,g,v,y,h,o,A,b]),nt(()=>{var e;if(s&&n&&null!=(e=h.current)&&null!=(e=e.__options)&&e.blockPointerEvents&&j()){C.current=!0;const e=c.floating;if(te(c.domReference)&&e){var t;const n=Xe(c.floating).body;n.setAttribute(Ln,"");const r=c.domReference,o=null==v||null==(t=v.nodesRef.current.find(e=>e.id===m))||null==(t=t.context)?void 0:t.elements.floating;return o&&(o.style.pointerEvents=""),n.style.pointerEvents="none",r.style.pointerEvents="auto",e.style.pointerEvents="auto",()=>{n.style.pointerEvents="",r.style.pointerEvents="",e.style.pointerEvents=""}}}},[s,n,m,c,v,h,j]),nt(()=>{n||(x.current=void 0,_.current=!1,k(),T())},[n,k,T]),u().useEffect(()=>()=>{k(),jn(w),jn(R),T()},[s,c.domReference,k,T]);const P=u().useMemo(()=>{function e(e){x.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){const{nativeEvent:t}=e;function o(){O.current||g.current||r(!0,t,"hover")}f&&!tt(x.current)||n||0===Tn(b.current)||_.current&&e.movementX**2+e.movementY**2<2||(jn(R),"touch"===x.current?o():(_.current=!0,R.current=window.setTimeout(o,Tn(b.current))))}}},[f,r,n,g,b]);return u().useMemo(()=>s?{reference:P}:{},[s,P])}(e,{restMs:150,enabled:t&&"hover"===n,handleClose:hr(),...i}),v=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:i,elements:c}=e,{enabled:s=!0,visibleOnly:l=!0}=t,a=u().useRef(!1),f=u().useRef(-1),d=u().useRef(!0);u().useEffect(()=>{if(!s)return;const e=Q(c.domReference);function t(){!n&&ne(c.domReference)&&c.domReference===Ue(Xe(c.domReference))&&(a.current=!0)}function r(){d.current=!0}function o(){d.current=!1}return e.addEventListener("blur",t),lr()&&(e.addEventListener("keydown",r,!0),e.addEventListener("pointerdown",o,!0)),()=>{e.removeEventListener("blur",t),lr()&&(e.removeEventListener("keydown",r,!0),e.removeEventListener("pointerdown",o,!0))}},[c.domReference,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||(a.current=!0)}},[o,s]),u().useEffect(()=>()=>{jn(f)},[]);const p=u().useMemo(()=>({onMouseLeave(){a.current=!1},onFocus(e){if(a.current)return;const t=Ve(e.nativeEvent);if(l&&te(t))if(lr()&&!e.relatedTarget){if(!d.current&&!Ye(t))return}else if(!function(e){if(!e||ze())return!0;try{return e.matches(":focus-visible")}catch(e){return!0}}(t))return;r(!0,e.nativeEvent,"focus")},onBlur(e){a.current=!1;const t=e.relatedTarget,n=e.nativeEvent,o=te(t)&&t.hasAttribute(_n("focus-guard"))&&"outside"===t.getAttribute("data-type");f.current=window.setTimeout(()=>{var e;const u=Ue(c.domReference?c.domReference.ownerDocument:document);(t||u!==c.domReference)&&(Ke(null==(e=i.current.floatingContext)?void 0:e.refs.floating.current,u)||Ke(c.domReference,u)||o||r(!1,n,"focus"))})}}),[i,c.domReference,r,l]);return u().useMemo(()=>s?{reference:p}:{},[s,p])}(e,{enabled:t&&"focus"===n,...c}),m=function(e,t){void 0===t&&(t={});const{open:n,dataRef:r,elements:{floating:o,domReference:i},refs:c}=e,{enabled:s=!0,axis:l="both",x:a=null,y:f=null}=t,d=u().useRef(!1),p=u().useRef(null),[v,m]=u().useState(),[h,y]=u().useState([]),g=it((e,t)=>{d.current||r.current.openEvent&&!ir(r.current.openEvent)||c.setPositionReference(function(e,t){let n=null,r=null,o=!1;return{contextElement:e||void 0,getBoundingClientRect(){var i;const u=(null==e?void 0:e.getBoundingClientRect())||{width:0,height:0,x:0,y:0},c="x"===t.axis||"both"===t.axis,s="y"===t.axis||"both"===t.axis,l=["mouseenter","mousemove"].includes((null==(i=t.dataRef.current.openEvent)?void 0:i.type)||"")&&"touch"!==t.pointerType;let a=u.width,f=u.height,d=u.x,p=u.y;return null==n&&t.x&&c&&(n=u.x-t.x),null==r&&t.y&&s&&(r=u.y-t.y),d-=n||0,p-=r||0,a=0,f=0,!o||l?(a="y"===t.axis?u.width:0,f="x"===t.axis?u.height:0,d=c&&null!=t.x?t.x:d,p=s&&null!=t.y?t.y:p):o&&!l&&(f="x"===t.axis?u.height:f,a="y"===t.axis?u.width:a),o=!0,{width:a,height:f,x:d,y:p,top:p,right:d+a,bottom:p+f,left:d}}}}(i,{x:e,y:t,axis:l,dataRef:r,pointerType:v}))}),b=it(e=>{null==a&&null==f&&(n?p.current||y([]):g(e.clientX,e.clientY))}),x=tt(v)?o:n,w=u().useCallback(()=>{if(!x||!s||null!=a||null!=f)return;const e=Q(o);function t(n){const r=Ve(n);Ke(o,r)?(e.removeEventListener("mousemove",t),p.current=null):g(n.clientX,n.clientY)}if(!r.current.openEvent||ir(r.current.openEvent)){e.addEventListener("mousemove",t);const n=()=>{e.removeEventListener("mousemove",t),p.current=null};return p.current=n,n}c.setPositionReference(i)},[x,s,a,f,o,r,c,i,g]);u().useEffect(()=>w(),[w,h]),u().useEffect(()=>{s&&!o&&(d.current=!1)},[s,o]),u().useEffect(()=>{!s&&n&&(d.current=!0)},[s,n]),nt(()=>{!s||null==a&&null==f||(d.current=!1,g(a,f))},[s,a,f,g]);const E=u().useMemo(()=>{function e(e){let{pointerType:t}=e;m(t)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:b,onMouseEnter:b}},[b]);return u().useMemo(()=>s?{reference:E}:{},[s,E])}(e,{enabled:t&&"point"===n,...s}),h=function(e,t){var n,r;void 0===t&&(t={});const{open:o,elements:i,floatingId:c}=e,{enabled:s=!0,role:l="dialog"}=t,a=gn(),f=(null==(n=i.domReference)?void 0:n.id)||a,d=u().useMemo(()=>{var e;return(null==(e=Ze(i.floating))?void 0:e.id)||c},[i.floating,c]),p=null!=(r=fr.get(l))?r:l,v=null!=Rn(),m=u().useMemo(()=>"tooltip"===p||"label"===l?{["aria-"+("label"===l?"labelledby":"describedby")]:o?d:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":"alertdialog"===p?"dialog":p,"aria-controls":o?d:void 0,..."listbox"===p&&{role:"combobox"},..."menu"===p&&{id:f},..."menu"===p&&v&&{role:"menuitem"},..."select"===l&&{"aria-autocomplete":"none"},..."combobox"===l&&{"aria-autocomplete":"list"}},[p,d,v,o,f,l]),h=u().useMemo(()=>{const e={id:d,...p&&{role:p}};return"tooltip"===p||"label"===l?e:{...e,..."menu"===p&&{"aria-labelledby":f}}},[p,d,f,l]),y=u().useCallback(e=>{let{active:t,selected:n}=e;const r={role:"option",...t&&{id:d+"-fui-option"}};switch(l){case"select":case"combobox":return{...r,"aria-selected":n}}return{}},[d,l]);return u().useMemo(()=>s?{reference:m,floating:h,item:y}:{},[s,m,h,y])}(e,l);return function(e){void 0===e&&(e=[]);const t=e.map(e=>null==e?void 0:e.reference),n=e.map(e=>null==e?void 0:e.floating),r=e.map(e=>null==e?void 0:e.item),o=u().useCallback(t=>ar(t,e,"reference"),t),i=u().useCallback(t=>ar(t,e,"floating"),n),c=u().useCallback(t=>ar(t,e,"item"),r);return u().useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:c}),[o,i,c])}([f,d,p,v,m,h,...a])},wr=({enabled:t=!0,event:n,dismissOptions:r,clickOptions:o,hoverOptions:i,focusOptions:c,clientPointsOptions:s,roleOptions:l,extraInteractions:f,open:d,floatingOptions:p,useOffset:v=!0,offsetOptions:m,useFlip:h=!0,flipOptions:y,useShift:g=!0,shiftOptions:b,useArrow:x=!1,arrowOptions:w,transitionOptions:E,useAutoPlacement:R=!1,autoPlacementOptions:O,useAutoUpdate:C=!1,autoUpdateOptions:S,useAutoSize:_=!1,sizeOptions:j,minAcceptableWidth:L=null,minAcceptableHeight:k=null,maxAcceptableWidth:T,maxAcceptableHeight:A,onOpen:P,onClose:M})=>{const{theme:D}=U(),$=function(){const e=gn(),t=On(),n=Rn();return nt(()=>{if(!e)return;const r={id:e,parentId:n};return null==t||t.addNode(r),()=>{null==t||t.removeNode(r)}},[t,e,n]),e}(),[I,N]=(0,u().useState)(!1),H=(0,u().useRef)(null),F=t&&(d??I);(0,u().useEffect)(()=>{F&&P?.()},[F]),((e,t)=>{const n=(0,u().useRef)(e);(0,u().useEffect)(()=>{if(n.current!==e)return n.current=e,t(e)},[e])})(t,e=>{e||N(!1)});const W=[];v&&W.push((e=>{const t=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:u,middlewareData:c}=t,s=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),u=Rt(n),c=Ot(n),s="y"===_t(n),l=Ft.has(u)?-1:1,a=i&&s?-1:1,f=Et(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:v}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&"number"==typeof v&&(p="end"===c?-1*v:v),s?{x:p*a,y:d*l}:{x:d*l,y:p*a}}(t,e);return u===(null==(n=c.offset)?void 0:n.placement)&&null!=(r=c.arrow)&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:u}}}}}(e);return{name:t.name,fn:t.fn,options:[e,void 0]}})(m??D.spacings.base));let z=null;if(R?W.push((e=>{const t=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,o;const{rects:i,middlewareData:u,placement:c,platform:s,elements:l}=t,{crossAxis:a=!1,alignment:f,allowedPlacements:d=vt,autoAlignment:p=!0,...v}=Et(e,t),m=void 0!==f||d===vt?function(e,t,n){return(e?[...n.filter(t=>Ot(t)===e),...n.filter(t=>Ot(t)!==e)]:n.filter(e=>Rt(e)===e)).filter(n=>!e||Ot(n)===e||!!t&&kt(n)!==n)}(f||null,p,d):d,h=(null==(n=u.autoPlacement)?void 0:n.index)||0,y=m[h];if(null==y)return{};if(c!==y)return{reset:{placement:m[0]}};const g=await s.detectOverflow(t,v),b=Lt(y,i,await(null==s.isRTL?void 0:s.isRTL(l.floating))),x=[g[Rt(y)],g[b[0]],g[b[1]]],w=[...(null==(r=u.autoPlacement)?void 0:r.overflows)||[],{placement:y,overflows:x}],E=m[h+1];if(E)return{data:{index:h+1,overflows:w},reset:{placement:E}};const R=w.map(e=>{const t=Ot(e.placement);return[e.placement,t&&a?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),O=(null==(o=R.filter(e=>e[2].slice(0,Ot(e[0])?2:3).every(e=>e<=0))[0])?void 0:o[0])||R[0][0];return O!==c?{data:{index:h+1,overflows:w},reset:{placement:O}}:{}}}}(e);return{name:t.name,fn:t.fn,options:[e,void 0]}})(O)):h&&(z=(e=>{const t=nn(e);return{name:t.name,fn:t.fn,options:[e,void 0]}})({crossAxis:!1,fallbackStrategy:"bestFit",...y})),_){const e=(e=>{const t=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:u=()=>{},...c}=Et(e,t),s=await o.detectOverflow(t,c),l=Rt(n),a=Ot(n),f="y"===_t(n),{width:d,height:p}=r.floating;let v,m;"top"===l||"bottom"===l?(v=l,m=a===(await(null==o.isRTL?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(m=l,v="end"===a?"top":"bottom");const h=p-s.top-s.bottom,y=d-s.left-s.right,g=mt(p-s[v],h),b=mt(d-s[m],y),x=t.middlewareData.shift,w=!x;let E=g,R=b;null!=x&&x.enabled.x&&(R=y),null!=x&&x.enabled.y&&(E=h),w&&!a&&(f?R=d-2*ht(s.left,s.right):E=p-2*ht(s.top,s.bottom)),await u({...t,availableWidth:R,availableHeight:E});const O=await o.getDimensions(i.floating);return d!==O.width||p!==O.height?{reset:{rects:!0}}:{}}}}(e);return{name:t.name,fn:t.fn,options:[e,void 0]}})({...j,apply({elements:e,rects:t,availableWidth:n,availableHeight:r}){const o=a(L)?L(t.reference):L??t.reference.width,i=a(T)?T(t.reference):Math.min(n,T??1/0),u=a(k)?k(t.reference):k??0,c=a(A)?A(t.reference):Math.min(r,A??1/0);Object.assign(e.floating.style,{minWidth:`${Math.min(o,i)}px`,maxWidth:`${i}px`,minHeight:`${Math.min(u,c)}px`,maxHeight:`${c}px`})}});z?"initialPlacement"===y?.fallbackStrategy?W.push(e,z):W.push(z,e):W.push(e)}else z&&W.push(z);g&&W.push((e=>{const t=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:u=!0,crossAxis:c=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Et(e,t),a={x:n,y:r},f=await i.detectOverflow(t,l),d=_t(o),p=Ct(d);let v=a[p],m=a[d];const h=(e,t)=>wt(t+f["y"===e?"top":"left"],t,t-f["y"===e?"bottom":"right"]);u&&(v=h(p,v)),c&&(m=h(d,m));const y=s.fn({...t,[p]:v,[d]:m});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[p]:u,[d]:c}}}}}}(e);return{name:t.name,fn:t.fn,options:[e,void 0]}})({padding:D.spacings.base,...b})),x&&W.push(((e,t)=>{const n=(e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&(o=n,{}.hasOwnProperty.call(o,"current"))?null!=n.current?rn({element:n.current,padding:r}).fn(t):{}:n?rn({element:n,padding:r}).fn(t):{};var o}}))(e);return{name:n.name,fn:n.fn,options:[e,t]}})({element:H,padding:D.spacings.base,...w}));const B=function(t){var n,r;let{elements:o,...i}=void 0===t?{}:t;const{nodeId:c}=i,s=function(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=gn(),i=u().useRef({}),[c]=u().useState(()=>xn()),s=null!=Rn(),[l,a]=u().useState(r.reference),f=it((e,t,r)=>{i.current.openEvent=e?t:void 0,c.emit("openchange",{open:e,event:t,reason:r,nested:s}),null==n||n(e,t,r)}),d=u().useMemo(()=>({setPositionReference:a}),[]),p=u().useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return u().useMemo(()=>({dataRef:i,open:t,onOpenChange:f,elements:p,events:c,floatingId:o,refs:d}),[t,f,p,c,o,d])}({...i,elements:{reference:null!=(n=null==o?void 0:o.reference)?n:null,floating:null!=(r=null==o?void 0:o.floating)?r:null}}),l=i.rootContext||s,a=l.elements,[f,d]=u().useState(null),[p,v]=u().useState(null),m=(null==a?void 0:a.domReference)||f,h=u().useRef(null),y=On();nt(()=>{m&&(h.current=m)},[m]);const g=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:c,floating:s}={},transform:l=!0,whileElementsMounted:a,open:f}=t,[d,p]=u().useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[v,m]=u().useState(o);cn(v,o)||m(o);const[h,y]=u().useState(null),[g,b]=u().useState(null),x=u().useCallback(e=>{e!==O.current&&(O.current=e,y(e))},[]),w=u().useCallback(e=>{e!==C.current&&(C.current=e,b(e))},[]),E=c||h,R=s||g,O=u().useRef(null),C=u().useRef(null),S=u().useRef(d),_=null!=a,j=an(a),L=an(i),k=an(f),T=u().useCallback(()=>{if(!O.current||!C.current)return;const t={placement:n,strategy:r,middleware:v};L.current&&(t.platform=L.current),on(O.current,C.current,t).then(t=>{const n={...t,isPositioned:!1!==k.current};A.current&&!cn(S.current,n)&&(S.current=n,e().flushSync(()=>{p(n)}))})},[v,n,r,L,k]);un(()=>{!1===f&&S.current.isPositioned&&(S.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[f]);const A=u().useRef(!1);un(()=>(A.current=!0,()=>{A.current=!1}),[]),un(()=>{if(E&&(O.current=E),R&&(C.current=R),E&&R){if(j.current)return j.current(E,R,T);T()}},[E,R,T,j,_]);const P=u().useMemo(()=>({reference:O,floating:C,setReference:x,setFloating:w}),[x,w]),M=u().useMemo(()=>({reference:E,floating:R}),[E,R]),D=u().useMemo(()=>{const e={position:r,left:0,top:0};if(!M.floating)return e;const t=ln(M.floating,d.x),n=ln(M.floating,d.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...sn(M.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,M.floating,d.x,d.y]);return u().useMemo(()=>({...d,update:T,refs:P,elements:M,floatingStyles:D}),[d,T,P,M,D])}({...i,elements:{...a,...p&&{reference:p}}}),b=u().useCallback(e=>{const t=te(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;v(t),g.refs.setReference(t)},[g.refs]),x=u().useCallback(e=>{(te(e)||null===e)&&(h.current=e,d(e)),(te(g.refs.reference.current)||null===g.refs.reference.current||null!==e&&!te(e))&&g.refs.setReference(e)},[g.refs]),w=u().useMemo(()=>({...g.refs,setReference:x,setPositionReference:b,domReference:h}),[g.refs,x,b]),E=u().useMemo(()=>({...g.elements,domReference:m}),[g.elements,m]),R=u().useMemo(()=>({...g,...l,refs:w,elements:E,nodeId:c}),[g,w,E,c,l]);return nt(()=>{l.dataRef.current.floatingContext=R;const e=null==y?void 0:y.nodesRef.current.find(e=>e.id===c);e&&(e.context=R)}),u().useMemo(()=>({...g,context:R,refs:w,elements:E}),[g,w,E,R])}({nodeId:$,open:F,middleware:W,onOpenChange:(e,t,n)=>{N(e),e||M?.(n,t)},...C&&{whileElementsMounted:(e,t,n)=>function(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:u="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:s=!1}=r,l=zt(e),a=o||i?[...l?ge(l):[],...t?ge(t):[]]:[];a.forEach(e=>{o&&e.addEventListener("scroll",n),i&&e.addEventListener("resize",n)});const f=l&&c?function(e,t,n){let r,o=null;const i=J(e);function u(){var e;clearTimeout(r),null==(e=o)||e.disconnect(),o=null}function c(n,s){void 0===n&&(n=!1),void 0===s&&(s=1),u();const l=e.getBoundingClientRect(),{left:a,top:f,width:d,height:p}=l;if(n||t(),!d||!p)return;const v={rootMargin:-gt(f)+"px "+-gt(i.clientWidth-(a+d))+"px "+-gt(i.clientHeight-(f+p))+"px "+-gt(a)+"px",threshold:ht(0,mt(1,s))||1};let m=!0;function h(t){const n=t[0].intersectionRatio;if(!tn(l,e.getBoundingClientRect()))return c();if(n!==s){if(!m)return c();n?c(!1,n):r=setTimeout(()=>{c(!1,1e-7)},1e3)}m=!1}try{o=new IntersectionObserver(h,{...v,root:i.ownerDocument})}catch(e){o=new IntersectionObserver(h,v)}o.observe(e)}const s=Q(e),l=()=>c(n);return s.addEventListener("resize",l),c(!0),()=>{s.removeEventListener("resize",l),u()}}(l,n,i):null;let d,p=-1,v=null;u&&(v=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&v&&t&&(v.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=v)||e.observe(t)})),n()}),l&&!s&&v.observe(l),t&&v.observe(t));let m=s?Vt(e):null;return s&&function t(){const r=Vt(e);m&&!tn(m,r)&&n(),m=r,d=requestAnimationFrame(t)}(),n(),()=>{var e;a.forEach(e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==f||f(),null==(e=v)||e.disconnect(),v=null,s&&cancelAnimationFrame(d)}}(e,t,n,S)},...p}),K=xr(B.context,{enabled:t,event:n,dismissOptions:r,clickOptions:o,hoverOptions:i,focusOptions:c,clientPointsOptions:s,roleOptions:l,extraInteractions:f}),V=function(t,n){void 0===n&&(n={});const{initial:r={opacity:0},open:o,close:i,common:c,duration:s=250}=n,l=t.placement,a=l.split("-")[0],f=u().useMemo(()=>({side:a,placement:l}),[a,l]),d="number"==typeof s,p=(d?s:s.open)||0,v=(d?s:s.close)||0,[m,h]=u().useState(()=>({...pr(c,f),...pr(r,f)})),{isMounted:y,status:g}=function(t,n){void 0===n&&(n={});const{open:r,elements:{floating:o}}=t,{duration:i=250}=n,c=("number"==typeof i?i:i.close)||0,[s,l]=u().useState("unmounted"),a=function(e,t){const[n,r]=u().useState(e);return e&&!n&&r(!0),u().useEffect(()=>{if(!e&&n){const e=setTimeout(()=>r(!1),t);return()=>clearTimeout(e)}},[e,n,t]),n}(r,c);return a||"close"!==s||l("unmounted"),nt(()=>{if(o){if(r){l("initial");const t=requestAnimationFrame(()=>{e().flushSync(()=>{l("open")})});return()=>{cancelAnimationFrame(t)}}l("close")}},[r,o]),{isMounted:a,status:s}}(t,{duration:s}),b=rt(r),x=rt(o),w=rt(i),E=rt(c);return nt(()=>{const e=pr(b.current,f),t=pr(w.current,f),n=pr(E.current,f),r=pr(x.current,f)||Object.keys(e).reduce((e,t)=>(e[t]="",e),{});if("initial"===g&&h(t=>({transitionProperty:t.transitionProperty,...n,...e})),"open"===g&&h({transitionProperty:Object.keys(r).map(dr).join(","),transitionDuration:p+"ms",...n,...r}),"close"===g){const r=t||e;h({transitionProperty:Object.keys(r).map(dr).join(","),transitionDuration:v+"ms",...n,...r})}},[v,w,b,x,E,p,g,f]),{isMounted:y,styles:m}}(B.context,{duration:250,...E});return{nodeId:$,isOpen:F,floating:B,arrowRef:H,interactions:K,transition:V}},Er=()=>{const e=(0,u().useContext)(Y);return l(e,"[@react-hive/honey-layout]: The `useHoneyPopupContext()` hook can only be used inside <HoneyPopup/> component."),e},Rr=({children:e,referenceUserProps:t,referenceProps:n,content:r,contentProps:i,focusManagerProps:c,arrowProps:s,portalProps:l,adjustStyles:a,context:d,...p})=>{const{useArrow:v,onClose:m}=p,h=N(m),{nodeId:y,floating:g,isOpen:b,arrowRef:x,interactions:w,transition:E}=wr(p),R=(0,u().useCallback)(()=>{h.current?.("escape-key")},[]),O=(0,u().useMemo)(()=>({context:d,floatingContext:g.context}),[d,g.context]);return(0,o().jsx)(gr,{ref:g.refs.setReference,...w.getReferenceProps(t),...n,"data-testid":"honey-popup",children:(0,o().jsxs)(Y,{value:O,children:[f(e,O),(0,o().jsx)(Cn,{id:y,children:E.isMounted&&(0,o().jsx)(br,{...l,children:(0,o().jsx)(nr,{context:g.context,disabled:!b,...c,children:(0,o().jsxs)(X,{ref:g.refs.setFloating,active:b,style:a?.({...g.floatingStyles,...E.styles},{middlewareData:g.middlewareData})??{...g.floatingStyles,...E.styles},onDeactivate:R,...w.getFloatingProps(),...i,"data-testid":"honey-popup-floating-content",children:[v&&(0,o().jsx)(bn,{ref:x,context:g.context,fill:"white",...s}),f(r,O)]})})})})]})})},Or=({useTree:e=!1,...t})=>(0,o().jsx)(yr,{enabled:e,children:(0,o().jsx)(Rr,{...t})}),Cr=(0,c.styled)(E,{row:!0,centerY:!0})`
37
37
  cursor: pointer;
38
38
  `,Sr=({option:e,renderOption:t,...n})=>{const{context:r,floatingContext:i}=Er(),u=a(e.disabled)?e.disabled({context:r,floatingContext:i}):!0===e.disabled;return(0,o().jsx)(Cr,{onClick:()=>{u||e.onClick?.({context:r,floatingContext:i})},role:"menuitem","aria-disabled":u,"data-testid":"honey-context-menu-option",...n,children:t?.({option:e,context:r,isDisabled:u})??e.label})},_r=({options:e,renderOption:t,optionProps:n,popupProps:r,...i})=>{const{floatingOptions:c}=r??{},{context:s,floatingContext:l}=Er(),f=(0,u().useMemo)(()=>e?.filter(e=>a(e.visible)?e.visible({context:s,floatingContext:l}):!1!==e.visible),[e]);return(0,o().jsx)(P,{items:f,itemKey:"id","data-testid":"honey-context-menu-options",...i,children:e=>e.options?.length?(0,o().jsx)(Or,{context:s,content:(0,o().jsx)(_r,{options:e.options,renderOption:t,optionProps:n,popupProps:r,...i}),event:"hover",referenceProps:{$width:"100%"},floatingOptions:{placement:"right-start",...c},useArrow:!0,"data-testid":"honey-sub-context-menu",...r,children:(0,o().jsx)(Sr,{option:e,renderOption:t,...n})}):(0,o().jsx)(Sr,{option:e,renderOption:t,...n})})},jr=({options:e,renderOption:t,optionProps:n,referenceUserProps:r,roleOptions:i,optionsProps:u,context:c,...s})=>(0,o().jsx)(Or,{context:c,referenceUserProps:{onClick:e=>e.stopPropagation(),...r},content:(0,o().jsx)(_r,{options:e,renderOption:t,optionProps:n,popupProps:s,...u}),roleOptions:{role:"menu",...i},useArrow:!0,"data-testid":"honey-context-menu",...s}),Lr=(0,u().createContext)(void 0),kr=()=>{const e=(0,u().useContext)(Lr);return l(e,"[@react-hive/honey-layout]: The `useHoneyLayerRegistryContext()` hook can only be used inside <HoneyLayerRegistry/> component."),e},Tr=({children:e})=>{const t=(0,u().useContext)(Lr),[n,r]=(0,u().useState)([]),i=(0,u().useMemo)(()=>({layers:n,registerLayer:e=>{const t=d();return r(n=>[...n,{id:t,payload:e}]),t},unregisterLayer:e=>{r(t=>t.filter(t=>t.id!==e))},getLayerIndex:e=>n.findIndex(t=>t.id===e)}),[n]);return t?e:(0,o().jsx)(Lr,{value:i,children:e})},Ar=({children:e,theme:t,mediaQueryOptions:n,...r})=>{const i=z(t,n),{getOverlaysSnapshot:s,registerOverlay:l,subscribeOverlays:a,unregisterOverlay:f}=(()=>{const e=(0,u().useRef)([]),t=(0,u().useRef)(new Set),n=(0,u().useCallback)(()=>e.current,[]),r=(0,u().useCallback)(e=>(t.current.add(e),()=>{t.current.delete(e)}),[]),o=(0,u().useCallback)(()=>{t.current.forEach(e=>e())},[]);(0,u().useEffect)(()=>{const t=t=>{e.current.length&&e.current[e.current.length-1].notifyListeners("keyup",t.code,t)};return document.addEventListener("keyup",t),()=>{document.removeEventListener("keyup",t)}},[]);const i=(0,u().useCallback)(t=>{const n=t.id??d(),r=[["keyup",t.onKeyUp]],i={current:null},u={containerRef:i,id:n,setContainerRef:e=>{i.current=e},addListener:(e,t)=>{r.push([e,t])},removeListener:(e,t)=>{const n=r.findIndex(([n,r])=>n===e&&r===t);-1!==n&&r.splice(n,1)},notifyListeners:(e,n,o)=>{const i=t.listenKeys??[];i.length&&!i.includes(n)||(o.preventDefault(),r.forEach(([t,r])=>{t===e&&r(n,u,o)}))}};return e.current=[...e.current,u],o(),u},[]),c=(0,u().useCallback)(t=>{const n=e.current.filter(e=>e.id!==t);n.length!==e.current.length&&(e.current=n,o())},[]);return(0,u().useMemo)(()=>({getOverlaysSnapshot:n,registerOverlay:i,subscribeOverlays:r,unregisterOverlay:c}),[])})(),p=(0,u().useMemo)(()=>({theme:t,screenState:i,getOverlaysSnapshot:s,registerOverlay:l,subscribeOverlays:a,unregisterOverlay:f}),[t,i]);return(0,o().jsx)(c.HoneyStyleProvider,{theme:t,...r,children:(0,o().jsx)(B,{value:p,children:e})})};var Pr=n(117),Mr=n.n(Pr);const Dr=({theme:e,...t})=>{const n=(0,u().useContext)(B),r=(0,u().useMemo)(()=>Mr()(n?.theme,e),[n?.theme,e]);return(0,o().jsx)(c.HoneyStyleProvider,{theme:r,...t})},$r=({durationMs:e,timingFunction:t="ease-in-out",extraProperties:n=[],activeClassName:r})=>({active:o=!1})=>c.css`
39
39
  opacity: ${o?1:0};