import{r as y,bv as A,bw as E,bx as I,by as g,w as O,e as S,au as j,y as x}from"./index-74aaacd7.js";function d(e){return A()?(E(e),!0):!1}function b(e){return typeof e=="function"?e():I(e)}const m=typeof window<"u",C=()=>{};function M(e,t=1e3,r={}){const{immediate:n=!0,immediateCallback:u=!1}=r;let o=null;const s=y(!1);function l(){o&&(clearInterval(o),o=null)}function i(){s.value=!1,l()}function c(){const a=b(t);a<=0||(s.value=!0,u&&e(),l(),o=setInterval(e,a))}if(n&&m&&c(),g(t)||typeof t=="function"){const a=O(t,()=>{s.value&&m&&c()});d(a)}return d(i),{isActive:s,pause:i,resume:c}}var R=Object.defineProperty,w=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,P=(e,t,r)=>t in e?R(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,L=(e,t)=>{for(var r in t||(t={}))W.call(t,r)&&P(e,r,t[r]);if(w)for(var r of w(t))z.call(t,r)&&P(e,r,t[r]);return e};function k(e=1e3,t={}){const{controls:r=!1,immediate:n=!0,callback:u}=t,o=y(0),s=()=>o.value+=1,l=()=>{o.value=0},i=M(u?()=>{s(),u(o.value)}:s,e,{immediate:n});return r?L({counter:o,reset:l},i):o}function _(e){var t;const r=b(e);return(t=r==null?void 0:r.$el)!=null?t:r}const h=m?window:void 0;function V(...e){let t,r,n,u;if(typeof e[0]=="string"||Array.isArray(e[0])?([r,n,u]=e,t=h):[t,r,n,u]=e,!t)return C;Array.isArray(r)||(r=[r]),Array.isArray(n)||(n=[n]);const o=[],s=()=>{o.forEach(a=>a()),o.length=0},l=(a,p,f,v)=>(a.addEventListener(p,f,v),()=>a.removeEventListener(p,f,v)),i=O(()=>[_(t),b(u)],([a,p])=>{s(),a&&o.push(...r.flatMap(f=>n.map(v=>l(a,f,v,p))))},{immediate:!0,flush:"post"}),c=()=>{i(),s()};return d(c),c}function D(){const e=y(!1);return j()&&x(()=>{e.value=!0}),e}function X(e){const t=D();return S(()=>(t.value,!!e()))}var $=Object.getOwnPropertySymbols,Y=Object.prototype.hasOwnProperty,B=Object.prototype.propertyIsEnumerable,F=(e,t)=>{var r={};for(var n in e)Y.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&$)for(var n of $(e))t.indexOf(n)<0&&B.call(e,n)&&(r[n]=e[n]);return r};function q(e,t,r={}){const n=r,{window:u=h}=n,o=F(n,["window"]);let s;const l=X(()=>u&&"ResizeObserver"in u),i=()=>{s&&(s.disconnect(),s=void 0)},c=S(()=>Array.isArray(e)?e.map(f=>_(f)):[_(e)]),a=O(c,f=>{if(i(),l.value&&u){s=new ResizeObserver(t);for(const v of f)v&&s.observe(v,o)}},{immediate:!0,flush:"post",deep:!0}),p=()=>{i(),a()};return d(p),{isSupported:l,stop:p}}function G({window:e=h}={}){if(!e)return{x:y(0),y:y(0)};const t=y(e.scrollX),r=y(e.scrollY);return V(e,"scroll",()=>{t.value=e.scrollX,r.value=e.scrollY},{capture:!1,passive:!0}),{x:t,y:r}}export{G as a,k as b,q as c,V as u};