import{ai as _,z as y,aj as h,ak as I,r as k,al as P,am as w,an as b,A as L,ao as T,ap as j,aq as B,s as H,y as Y}from"./CGQLQ9ei.js";function p(e){var t;const o=w(e);return(t=o==null?void 0:o.$el)!=null?t:o}const O=B?window:void 0;function E(...e){let t,o,n,l;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,n,l]=e,t=O):[t,o,n,l]=e,!t)return h;Array.isArray(o)||(o=[o]),Array.isArray(n)||(n=[n]);const c=[],m=()=>{c.forEach(d=>d()),c.length=0},s=(d,v,r,i)=>(d.addEventListener(v,r,i),()=>d.removeEventListener(v,r,i)),f=y(()=>[p(t),w(l)],([d,v])=>{if(m(),!d)return;const r=P(v)?{...v}:v;c.push(...o.flatMap(i=>n.map(u=>s(d,i,u,r))))},{immediate:!0,flush:"post"}),a=()=>{f(),m()};return b(a),a}let C=!1;function W(e,t,o={}){const{window:n=O,ignore:l=[],capture:c=!0,detectIframe:m=!1}=o;if(!n)return h;I&&!C&&(C=!0,Array.from(n.document.body.children).forEach(r=>r.addEventListener("click",h)),n.document.documentElement.addEventListener("click",h));let s=!0;const f=r=>l.some(i=>{if(typeof i=="string")return Array.from(n.document.querySelectorAll(i)).some(u=>u===r.target||r.composedPath().includes(u));{const u=p(i);return u&&(r.target===u||r.composedPath().includes(u))}}),d=[E(n,"click",r=>{const i=p(e);if(!(!i||i===r.target||r.composedPath().includes(i))){if(r.detail===0&&(s=!f(r)),!s){s=!0;return}t(r)}},{passive:!0,capture:c}),E(n,"pointerdown",r=>{const i=p(e);s=!f(r)&&!!(i&&!r.composedPath().includes(i))},{passive:!0}),m&&E(n,"blur",r=>{setTimeout(()=>{var i;const u=p(e);((i=n.document.activeElement)==null?void 0:i.tagName)==="IFRAME"&&!(u!=null&&u.contains(n.document.activeElement))&&t(r)},0)})].filter(Boolean);return()=>d.forEach(r=>r())}const G={[_.mounted](e,t){const o=!t.modifiers.bubble;if(typeof t.value=="function")e.__onClickOutside_stop=W(e,t.value,{capture:o});else{const[n,l]=t.value;e.__onClickOutside_stop=W(e,n,Object.assign({capture:o},l))}},[_.unmounted](e){e.__onClickOutside_stop()}};function q(){const e=k(!1),t=Y();return t&&H(()=>{e.value=!0},t),e}function x(e){const t=q();return L(()=>(t.value,!!e()))}function R(e,t,o={}){const{root:n,rootMargin:l="0px",threshold:c=.1,window:m=O,immediate:s=!0}=o,f=x(()=>m&&"IntersectionObserver"in m),a=L(()=>{const u=w(e);return(Array.isArray(u)?u:[u]).map(p).filter(T)});let d=h;const v=k(s),r=f.value?y(()=>[a.value,p(n),v.value],([u,N])=>{if(d(),!v.value||!u.length)return;const M=new IntersectionObserver(t,{root:p(N),rootMargin:l,threshold:c});u.forEach(S=>S&&M.observe(S)),d=()=>{M.disconnect(),d=h}},{immediate:s,flush:"post"}):h,i=()=>{d(),r(),v.value=!1};return b(i),{isSupported:f,isActive:v,pause(){d(),v.value=!1},resume(){v.value=!0},stop:i}}function D(e,t={}){const{window:o=O,scrollTarget:n,threshold:l=0}=t,c=k(!1);return R(e,m=>{let s=c.value,f=0;for(const a of m)a.time>=f&&(f=a.time,s=a.isIntersecting);c.value=s},{root:n,window:o,threshold:l}),c}const J={[_.mounted](e,t){if(typeof t.value=="function"){const o=t.value,n=D(e);y(n,l=>o(l),{immediate:!0})}else{const[o,n]=t.value,l=D(e,n);y(l,c=>o(c),{immediate:!0})}}};function g(e){return typeof Window<"u"&&e instanceof Window?e.document.documentElement:typeof Document<"u"&&e instanceof Document?e.documentElement:e}function V(e){const t=window.getComputedStyle(e);if(t.overflowX==="scroll"||t.overflowY==="scroll"||t.overflowX==="auto"&&e.clientWidth<e.scrollWidth||t.overflowY==="auto"&&e.clientHeight<e.scrollHeight)return!0;{const o=e.parentNode;return!o||o.tagName==="BODY"?!1:V(o)}}function X(e){const t=e||window.event,o=t.target;return V(o)?!1:t.touches.length>1?!0:(t.preventDefault&&t.preventDefault(),!1)}const A=new WeakMap;function z(e,t=!1){const o=k(t);let n=null,l="";y(j(e),s=>{const f=g(w(s));if(f){const a=f;if(A.get(a)||A.set(a,a.style.overflow),a.style.overflow!=="hidden"&&(l=a.style.overflow),a.style.overflow==="hidden")return o.value=!0;if(o.value)return a.style.overflow="hidden"}},{immediate:!0});const c=()=>{const s=g(w(e));!s||o.value||(I&&(n=E(s,"touchmove",f=>{X(f)},{passive:!1})),s.style.overflow="hidden",o.value=!0)},m=()=>{const s=g(w(e));!s||!o.value||(I&&(n==null||n()),s.style.overflow=l,A.delete(s),o.value=!1)};return b(m),L({get(){return o.value},set(s){s?c():m()}})}function F(){let e=!1;const t=k(!1);return(o,n)=>{if(t.value=n.value,e)return;e=!0;const l=z(o,n.value);y(t,c=>l.value=c)}}F();export{G as a,J as v};