import{c as o,r as i,O as j,w as g,aS as B,aT as F,aU as r,aV as I,aW as T,M as U,aX as W}from"./index-ChhimAZ-.js";function X(e){return e!=null&&typeof e=="object"&&"$el"in e}function R(e){if(X(e)){const a=e.$el;return I(a)&&T(a)==="#comment"?null:a}return e}function c(e){return typeof e=="function"?e():U(e)}function b(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function S(e,a){const t=b(e);return Math.round(a*t)/t}function q(e,a,t){t===void 0&&(t={});const V=t.whileElementsMounted,f=o(()=>{var n;return(n=c(t.open))!=null?n:!0}),D=o(()=>c(t.middleware)),p=o(()=>{var n;return(n=c(t.placement))!=null?n:"bottom"}),w=o(()=>{var n;return(n=c(t.strategy))!=null?n:"absolute"}),C=o(()=>{var n;return(n=c(t.transform))!=null?n:!0}),s=o(()=>R(e.value)),l=o(()=>R(a.value)),y=i(0),h=i(0),v=i(w.value),O=i(p.value),P=j({}),x=i(!1),_=o(()=>{const n={position:v.value,left:"0",top:"0"};if(!l.value)return n;const u=S(l.value,y.value),M=S(l.value,h.value);return C.value?{...n,transform:"translate("+u+"px, "+M+"px)",...b(l.value)>=1.5&&{willChange:"transform"}}:{position:v.value,left:u+"px",top:M+"px"}});let d;function m(){if(s.value==null||l.value==null)return;const n=f.value;W(s.value,l.value,{middleware:D.value,placement:p.value,strategy:w.value}).then(u=>{y.value=u.x,h.value=u.y,v.value=u.strategy,O.value=u.placement,P.value=u.middlewareData,x.value=n!==!1})}function E(){typeof d=="function"&&(d(),d=void 0)}function N(){if(E(),V===void 0){m();return}if(s.value!=null&&l.value!=null){d=V(s.value,l.value,m);return}}function $(){f.value||(x.value=!1)}return g([D,p,w,f],m,{flush:"sync"}),g([s,l],N,{flush:"sync"}),g(f,$,{flush:"sync"}),B()&&F(E),{x:r(y),y:r(h),strategy:r(v),placement:r(O),middlewareData:r(P),isPositioned:r(x),floatingStyles:_,update:m}}export{q as u};
