import{r as f,bk as E,bl as P,bm as $,bn as I,w as b}from"./index-971588a5.js";function y(e){return E()?(P(e),!0):!1}function _(e){return typeof e=="function"?e():$(e)}const d=typeof window<"u",S=()=>{};function g(e,t=1e3,r={}){const{immediate:s=!0,immediateCallback:l=!1}=r;let n=null;const a=f(!1);function u(){n&&(clearInterval(n),n=null)}function c(){a.value=!1,u()}function i(){const o=_(t);o<=0||(a.value=!0,l&&e(),u(),n=setInterval(e,o))}if(s&&d&&i(),I(t)||typeof t=="function"){const o=b(t,()=>{a.value&&d&&i()});y(o)}return y(c),{isActive:a,pause:c,resume:i}}var x=Object.defineProperty,h=Object.getOwnPropertySymbols,C=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,O=(e,t,r)=>t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,w=(e,t)=>{for(var r in t||(t={}))C.call(t,r)&&O(e,r,t[r]);if(h)for(var r of h(t))W.call(t,r)&&O(e,r,t[r]);return e};function D(e=1e3,t={}){const{controls:r=!1,immediate:s=!0,callback:l}=t,n=f(0),a=()=>n.value+=1,u=()=>{n.value=0},c=g(l?()=>{a(),l(n.value)}:a,e,{immediate:s});return r?w({counter:n,reset:u},c):n}function L(e){var t;const r=_(e);return(t=r==null?void 0:r.$el)!=null?t:r}const A=d?window:void 0;function V(...e){let t,r,s,l;if(typeof e[0]=="string"||Array.isArray(e[0])?([r,s,l]=e,t=A):[t,r,s,l]=e,!t)return S;Array.isArray(r)||(r=[r]),Array.isArray(s)||(s=[s]);const n=[],a=()=>{n.forEach(o=>o()),n.length=0},u=(o,p,v,m)=>(o.addEventListener(p,v,m),()=>o.removeEventListener(p,v,m)),c=b(()=>[L(t),_(l)],([o,p])=>{a(),o&&n.push(...r.flatMap(v=>s.map(m=>u(o,v,m,p))))},{immediate:!0,flush:"post"}),i=()=>{c(),a()};return y(i),i}function X({window:e=A}={}){if(!e)return{x:f(0),y:f(0)};const t=f(e.scrollX),r=f(e.scrollY);return V(e,"scroll",()=>{t.value=e.scrollX,r.value=e.scrollY},{capture:!1,passive:!0}),{x:t,y:r}}export{X as a,D as b,V as u};
