import{t as k,w as j,i as q,h as A,j as F,k as N,l as W}from"./index-Ct76C36l.js";import{e as O,x as h,u as X,s as H,k as U}from"./vue-CbNcDebW.js";const B=F?window:void 0;function Y(t){var n;const e=h(t);return(n=e?.$el)!=null?n:e}function g(...t){const n=[],e=()=>{n.forEach(l=>l()),n.length=0},f=(l,r,u,c)=>(l.addEventListener(r,u,c),()=>l.removeEventListener(r,u,c)),a=O(()=>{const l=k(h(t[0])).filter(r=>r!=null);return l.every(r=>typeof r!="string")?l:void 0}),s=j(()=>{var l,r;return[(r=(l=a.value)==null?void 0:l.map(u=>Y(u)))!=null?r:[B].filter(u=>u!=null),k(h(a.value?t[1]:t[0])),k(X(a.value?t[2]:t[1])),h(a.value?t[3]:t[2])]},([l,r,u,c])=>{if(e(),!l?.length||!r?.length||!u?.length)return;const D=q(c)?{...c}:c;n.push(...l.flatMap(L=>r.flatMap(E=>u.map(_=>f(L,E,_,D)))))},{flush:"post"}),d=()=>{s(),e()};return A(e),d}const V=500,$=10;function R(t,n,e){var f,a;const s=O(()=>Y(t));let d,l,r,u=!1;function c(){d&&(clearTimeout(d),d=void 0),l=void 0,r=void 0,u=!1}function D(o){const i=e?.delay;return typeof i=="function"?i(o):i??V}function L(o){var i,v,m;const[y,p,w]=[r,l,u];if(c(),!e?.onMouseUp||!p||!y||(i=e?.modifiers)!=null&&i.self&&o.target!==s.value)return;(v=e?.modifiers)!=null&&v.prevent&&o.preventDefault(),(m=e?.modifiers)!=null&&m.stop&&o.stopPropagation();const T=o.x-p.x,P=o.y-p.y,b=Math.sqrt(T*T+P*P);e.onMouseUp(o.timeStamp-y,b,w)}function E(o){var i,v,m;(i=e?.modifiers)!=null&&i.self&&o.target!==s.value||(c(),(v=e?.modifiers)!=null&&v.prevent&&o.preventDefault(),(m=e?.modifiers)!=null&&m.stop&&o.stopPropagation(),l={x:o.x,y:o.y},r=o.timeStamp,d=setTimeout(()=>{u=!0,n(o)},D(o)))}function _(o){var i,v,m,y;if((i=e?.modifiers)!=null&&i.self&&o.target!==s.value||!l||e?.distanceThreshold===!1)return;(v=e?.modifiers)!=null&&v.prevent&&o.preventDefault(),(m=e?.modifiers)!=null&&m.stop&&o.stopPropagation();const p=o.x-l.x,w=o.y-l.y;Math.sqrt(p*p+w*w)>=((y=e?.distanceThreshold)!=null?y:$)&&c()}const S={capture:(f=e?.modifiers)==null?void 0:f.capture,once:(a=e?.modifiers)==null?void 0:a.once},I=[g(s,"pointerdown",E,S),g(s,"pointermove",_,S),g(s,["pointerup","pointerleave"],L,S)];return()=>I.forEach(o=>o())}const ee={mounted(t,n){typeof n.value=="function"?R(t,n.value,{modifiers:n.modifiers}):R(t,...n.value)}};function x(t){return typeof Window<"u"&&t instanceof Window?t.document.documentElement:typeof Document<"u"&&t instanceof Document?t.documentElement:t}function C(t){const n=window.getComputedStyle(t);if(n.overflowX==="scroll"||n.overflowY==="scroll"||n.overflowX==="auto"&&t.clientWidth<t.scrollWidth||n.overflowY==="auto"&&t.clientHeight<t.scrollHeight)return!0;{const e=t.parentNode;return!e||e.tagName==="BODY"?!1:C(e)}}function z(t){const n=t||window.event,e=n.target;return C(e)?!1:n.touches.length>1?!0:(n.preventDefault&&n.preventDefault(),!1)}const M=new WeakMap;function G(t,n=!1){const e=H(n);let f=null,a="";U(N(t),l=>{const r=x(h(l));if(r){const u=r;if(M.get(u)||M.set(u,u.style.overflow),u.style.overflow!=="hidden"&&(a=u.style.overflow),u.style.overflow==="hidden")return e.value=!0;if(e.value)return u.style.overflow="hidden"}},{immediate:!0});const s=()=>{const l=x(h(t));!l||e.value||(W&&(f=g(l,"touchmove",r=>{z(r)},{passive:!1})),l.style.overflow="hidden",e.value=!0)},d=()=>{const l=x(h(t));!l||!e.value||(W&&f?.(),l.style.overflow=a,M.delete(l),e.value=!1)};return A(d),O({get(){return e.value},set(l){l?s():d()}})}function J(){let t=!1;const n=H(!1);return(e,f)=>{if(n.value=f.value,t)return;t=!0;const a=G(e,f.value);U(n,s=>a.value=s)}}J();export{ee as v};
