index-7a5476f8.js 1.6 KB

1
  1. import{n as E,t as O,a as h,i as S}from"./index-b80e435e.js";import{w as _,e as A,r as p,aT as w,y as M}from"./index-40af15f1.js";function d(e){var n;const t=O(e);return(n=t==null?void 0:t.$el)!=null?n:t}const m=S?window:void 0;function $(...e){let n,t,r,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([t,r,i]=e,n=m):[n,t,r,i]=e,!n)return E;Array.isArray(t)||(t=[t]),Array.isArray(r)||(r=[r]);const c=[],o=()=>{c.forEach(s=>s()),c.length=0},f=(s,u,a,l)=>(s.addEventListener(u,a,l),()=>s.removeEventListener(u,a,l)),v=_(()=>[d(n),O(i)],([s,u])=>{o(),s&&c.push(...t.flatMap(a=>r.map(l=>f(s,a,l,u))))},{immediate:!0,flush:"post"}),y=()=>{v(),o()};return h(y),y}function g(){const e=p(!1);return w()&&M(()=>{e.value=!0}),e}function j(e){const n=g();return A(()=>(n.value,!!e()))}var b=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,R=(e,n)=>{var t={};for(var r in e)x.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&b)for(var r of b(e))n.indexOf(r)<0&&P.call(e,r)&&(t[r]=e[r]);return t};function I(e,n,t={}){const r=t,{window:i=m}=r,c=R(r,["window"]);let o;const f=j(()=>i&&"ResizeObserver"in i),v=()=>{o&&(o.disconnect(),o=void 0)},y=A(()=>Array.isArray(e)?e.map(a=>d(a)):[d(e)]),s=_(y,a=>{if(v(),f.value&&i){o=new ResizeObserver(n);for(const l of a)l&&o.observe(l,c)}},{immediate:!0,flush:"post",deep:!0}),u=()=>{v(),s()};return h(u),{isSupported:f,stop:u}}function L({window:e=m}={}){if(!e)return{x:p(0),y:p(0)};const n=p(e.scrollX),t=p(e.scrollY);return $(e,"scroll",()=>{n.value=e.scrollX,t.value=e.scrollY},{capture:!1,passive:!0}),{x:n,y:t}}export{L as a,I as b,$ as u};