import{k as T,c as W,q,s as J,v as K,x as w,y as A,z as X,A as Q,B as Y,C as U,D as Z,E as ee,G as te,H as z,l as oe,I as ne}from"./D5UsCBwS.js";const k=ee?window:void 0;function L(e){var o;const t=w(e);return(o=t==null?void 0:t.$el)!=null?o:t}function V(...e){let o,t,i,v;if(typeof e[0]=="string"||Array.isArray(e[0])?([t,i,v]=e,o=k):[o,t,i,v]=e,!o)return A;Array.isArray(t)||(t=[t]),Array.isArray(i)||(i=[i]);const f=[],u=()=>{f.forEach(c=>c()),f.length=0},r=(c,s,d,g)=>(c.addEventListener(s,d,g),()=>c.removeEventListener(s,d,g)),a=X(()=>[L(o),w(v)],([c,s])=>{if(u(),!c)return;const d=Q(s)?{...s}:s;f.push(...t.flatMap(g=>i.map(p=>r(c,g,p,d))))},{immediate:!0,flush:"post"}),l=()=>{a(),u()};return Y(l),l}function le(){const e=T(!1),o=ne();return o&&oe(()=>{e.value=!0},o),e}function re(e){const o=le();return W(()=>(o.value,!!e()))}function se(e,o,t={}){const{root:i,rootMargin:v="0px",threshold:f=0,window:u=k,immediate:r=!0}=t,a=re(()=>u&&"IntersectionObserver"in u),l=W(()=>{const p=w(e);return(Array.isArray(p)?p:[p]).map(L).filter(U)});let c=A;const s=T(r),d=a.value?X(()=>[l.value,L(i),s.value],([p,H])=>{if(c(),!s.value||!p.length)return;const S=new IntersectionObserver(o,{root:L(H),rootMargin:v,threshold:f});p.forEach(m=>m&&S.observe(m)),c=()=>{S.disconnect(),c=A}},{immediate:r,flush:"post"}):A,g=()=>{c(),d(),s.value=!1};return Y(g),{isSupported:a,isActive:s,pause(){c(),s.value=!1},resume(){s.value=!0},stop:g}}function ce(e,o={}){const{window:t=k,scrollTarget:i,threshold:v=0}=o,f=T(!1);return se(e,u=>{let r=f.value,a=0;for(const l of u)l.time>=a&&(a=l.time,r=l.isIntersecting);f.value=r},{root:i,window:t,threshold:v}),f}function C(e){return typeof Window<"u"&&e instanceof Window?e.document.documentElement:typeof Document<"u"&&e instanceof Document?e.documentElement:e}const G=1;function ae(e,o={}){const{throttle:t=0,idle:i=200,onStop:v=A,onScroll:f=A,offset:u={left:0,right:0,top:0,bottom:0},eventListenerOptions:r={capture:!1,passive:!0},behavior:a="auto",window:l=k,onError:c=n=>{console.error(n)}}=o,s=T(0),d=T(0),g=W({get(){return s.value},set(n){H(n,void 0)}}),p=W({get(){return d.value},set(n){H(void 0,n)}});function H(n,_){var h,M,O,E;if(!l)return;const y=w(e);if(!y)return;(O=y instanceof Document?l.document.body:y)==null||O.scrollTo({top:(h=w(_))!=null?h:p.value,left:(M=w(n))!=null?M:g.value,behavior:w(a)});const I=((E=y==null?void 0:y.document)==null?void 0:E.documentElement)||(y==null?void 0:y.documentElement)||y;g!=null&&(s.value=I.scrollLeft),p!=null&&(d.value=I.scrollTop)}const S=T(!1),m=q({left:!0,right:!1,top:!0,bottom:!1}),b=q({left:!1,right:!1,top:!1,bottom:!1}),B=n=>{S.value&&(S.value=!1,b.left=!1,b.right=!1,b.top=!1,b.bottom=!1,v(n))},$=te(B,t+i),x=n=>{var _;if(!l)return;const h=((_=n==null?void 0:n.document)==null?void 0:_.documentElement)||(n==null?void 0:n.documentElement)||L(n),{display:M,flexDirection:O}=getComputedStyle(h),E=h.scrollLeft;b.left=E<s.value,b.right=E>s.value;const y=Math.abs(E)<=(u.left||0),I=Math.abs(E)+h.clientWidth>=h.scrollWidth-(u.right||0)-G;M==="flex"&&O==="row-reverse"?(m.left=I,m.right=y):(m.left=y,m.right=I),s.value=E;let D=h.scrollTop;n===l.document&&!D&&(D=l.document.body.scrollTop),b.top=D<d.value,b.bottom=D>d.value;const F=Math.abs(D)<=(u.top||0),j=Math.abs(D)+h.clientHeight>=h.scrollHeight-(u.bottom||0)-G;M==="flex"&&O==="column-reverse"?(m.top=j,m.bottom=F):(m.top=F,m.bottom=j),d.value=D},N=n=>{var _;if(!l)return;const h=(_=n.target.documentElement)!=null?_:n.target;x(h),S.value=!0,$(n),f(n)};return V(e,"scroll",t?J(N,t,!0,!1):N,r),K(()=>{try{const n=w(e);if(!n)return;x(n)}catch(n){c(n)}}),V(e,"scrollend",B,r),{x:g,y:p,isScrolling:S,arrivedState:m,directions:b,measure(){const n=w(e);l&&n&&x(n)}}}function P(e){const o=window.getComputedStyle(e);if(o.overflowX==="scroll"||o.overflowY==="scroll"||o.overflowX==="auto"&&e.clientWidth<e.scrollWidth||o.overflowY==="auto"&&e.clientHeight<e.scrollHeight)return!0;{const t=e.parentNode;return!t||t.tagName==="BODY"?!1:P(t)}}function ie(e){const o=e||window.event,t=o.target;return P(t)?!1:o.touches.length>1?!0:(o.preventDefault&&o.preventDefault(),!1)}const R=new WeakMap;function fe(e,o=!1){const t=T(o);let i=null,v="";X(Z(e),r=>{const a=C(w(r));if(a){const l=a;if(R.get(l)||R.set(l,l.style.overflow),l.style.overflow!=="hidden"&&(v=l.style.overflow),l.style.overflow==="hidden")return t.value=!0;if(t.value)return l.style.overflow="hidden"}},{immediate:!0});const f=()=>{const r=C(w(e));!r||t.value||(z&&(i=V(r,"touchmove",a=>{ie(a)},{passive:!1})),r.style.overflow="hidden",t.value=!0)},u=()=>{const r=C(w(e));!r||!t.value||(z&&(i==null||i()),r.style.overflow=v,R.delete(r),t.value=!1)};return Y(u),W({get(){return t.value},set(r){r?f():u()}})}export{ce as a,ae as b,fe as u};