import{c as F,d as G}from"./floating-ui.dom-BYy0T0oh.js";import{r as f}from"./core.browser.esm-d7c2p9jk.js";import{r as H}from"./index-CB_Xdy7y.js";import{_ as J}from"./extends-F__sVjJM.js";import{$ as K}from"./index-sYpBCPze.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="829ff55d-baa3-4145-a821-eeca25aed9bd",e._sentryDebugIdIdentifier="sentry-dbid-829ff55d-baa3-4145-a821-eeca25aed9bd")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="01ce5800-ba30-4cc0-938f-65b5c5161d7f",e._sentryDebugIdIdentifier="sentry-dbid-01ce5800-ba30-4cc0-938f-65b5c5161d7f")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="00e30be9-48ce-4d19-8d24-16b48c973875",e._sentryDebugIdIdentifier="sentry-dbid-00e30be9-48ce-4d19-8d24-16b48c973875")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="144ae31d-2bd0-4016-9ce3-247cb23dbf87",e._sentryDebugIdIdentifier="sentry-dbid-144ae31d-2bd0-4016-9ce3-247cb23dbf87")}catch{}})();const Y=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?F({element:r.current,padding:s}).fn(n):{}:r?F({element:r,padding:s}).fn(n):{}}}};var m=typeof document<"u"?f.useLayoutEffect:f.useEffect;function h(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!h(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!h(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function A(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function O(e,t){const n=A(e);return Math.round(t*n)/n}function j(e){const t=f.useRef(e);return m(()=>{t.current=e}),t}function Z(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:L}={},transform:x=!0,whileElementsMounted:B,open:E}=e,[u,$]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[D,q]=f.useState(r);h(D,r)||q(r);const[V,P]=f.useState(null),[z,k]=f.useState(null),M=f.useCallback(o=>{o!=l.current&&(l.current=o,P(o))},[P]),v=f.useCallback(o=>{o!==y.current&&(y.current=o,k(o))},[k]),c=i||V,a=L||z,l=f.useRef(null),y=f.useRef(null),w=f.useRef(u),_=j(B),R=j(s),b=f.useCallback(()=>{if(!l.current||!y.current)return;const o={placement:t,strategy:n,middleware:D};R.current&&(o.platform=R.current),G(l.current,y.current,o).then(p=>{const g={...p,isPositioned:!0};I.current&&!h(w.current,g)&&(w.current=g,H.flushSync(()=>{$(g)}))})},[D,t,n,R]);m(()=>{E===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,$(o=>({...o,isPositioned:!1})))},[E]);const I=f.useRef(!1);m(()=>(I.current=!0,()=>{I.current=!1}),[]),m(()=>{if(c&&(l.current=c),a&&(y.current=a),c&&a){if(_.current)return _.current(c,a,b);b()}},[c,a,b,_]);const S=f.useMemo(()=>({reference:l,floating:y,setReference:M,setFloating:v}),[M,v]),d=f.useMemo(()=>({reference:c,floating:a}),[c,a]),C=f.useMemo(()=>{const o={position:n,left:0,top:0};if(!d.floating)return o;const p=O(d.floating,u.x),g=O(d.floating,u.y);return x?{...o,transform:"translate("+p+"px, "+g+"px)",...A(d.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:p,top:g}},[n,x,d.floating,u.x,u.y]);return f.useMemo(()=>({...u,update:b,refs:S,elements:d,floatingStyles:C}),[u,b,S,d,C])}const N=f.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return f.createElement(K.svg,J({},i,{ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),e.asChild?n:f.createElement("polygon",{points:"0,0 30,0 15,10"}))}),ee=N;export{ee as $,Y as a,Z as u};
