import{k as U,e as M,y as T,u as k}from"./vue-fWJEtAed.js";const R=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const W=Object.prototype.toString,q=o=>W.call(o)==="[object Object]";function P(o){return Array.isArray(o)?o:[o]}function C(o,r,e){return U(o,r,{...e,immediate:!0})}const F=R?window:void 0;function A(o){var r;const e=T(o);return(r=e?.$el)!==null&&r!==void 0?r:e}function _(...o){const r=(t,l,n,u)=>(t.addEventListener(l,n,u),()=>t.removeEventListener(l,n,u)),e=M(()=>{const t=P(T(o[0])).filter(l=>l!=null);return t.every(l=>typeof l!="string")?t:void 0});return C(()=>{var t,l;return[(t=(l=e.value)===null||l===void 0?void 0:l.map(n=>A(n)))!==null&&t!==void 0?t:[F].filter(n=>n!=null),P(T(e.value?o[1]:o[0])),P(k(e.value?o[2]:o[1])),T(e.value?o[3]:o[2])]},([t,l,n,u],v,m)=>{if(!t?.length||!l?.length||!n?.length)return;const y=q(u)?{...u}:u,p=t.flatMap(h=>l.flatMap(L=>n.map(g=>r(h,L,g,y))));m(()=>{p.forEach(h=>h())})},{flush:"post"})}const G=500,H=10;function S(o,r,e){var t,l;const n=M(()=>A(o));let u,v,m,y=!1;function p(){u&&(clearTimeout(u),u=void 0),v=void 0,m=void 0,y=!1}function h(i){const d=e?.delay;return typeof d=="function"?d(i):d??G}function L(i){var d,f,a;const[s,c,$]=[m,v,y];if(p(),!e?.onMouseUp||!c||!s||!(e==null||(d=e.modifiers)===null||d===void 0)&&d.self&&i.target!==n.value)return;!(e==null||(f=e.modifiers)===null||f===void 0)&&f.prevent&&i.preventDefault(),!(e==null||(a=e.modifiers)===null||a===void 0)&&a.stop&&i.stopPropagation();const x=i.x-c.x,D=i.y-c.y,j=Math.sqrt(x*x+D*D);e.onMouseUp(i.timeStamp-s,j,$)}function g(i){var d,f,a;!(e==null||(d=e.modifiers)===null||d===void 0)&&d.self&&i.target!==n.value||(p(),!(e==null||(f=e.modifiers)===null||f===void 0)&&f.prevent&&i.preventDefault(),!(e==null||(a=e.modifiers)===null||a===void 0)&&a.stop&&i.stopPropagation(),v={x:i.x,y:i.y},m=i.timeStamp,u=setTimeout(()=>{y=!0,r(i)},h(i)))}function O(i){var d,f,a,s;if(!(e==null||(d=e.modifiers)===null||d===void 0)&&d.self&&i.target!==n.value||!v||e?.distanceThreshold===!1)return;!(e==null||(f=e.modifiers)===null||f===void 0)&&f.prevent&&i.preventDefault(),!(e==null||(a=e.modifiers)===null||a===void 0)&&a.stop&&i.stopPropagation();const c=i.x-v.x,$=i.y-v.y;Math.sqrt(c*c+$*$)>=((s=e?.distanceThreshold)!==null&&s!==void 0?s:H)&&p()}const E={capture:e==null||(t=e.modifiers)===null||t===void 0?void 0:t.capture,once:e==null||(l=e.modifiers)===null||l===void 0?void 0:l.once},b=[_(n,"pointerdown",g,E),_(n,"pointermove",O,E),_(n,["pointerup","pointerleave"],L,E)];return()=>b.forEach(i=>i())}const Y={mounted(o,r){typeof r.value=="function"?S(o,r.value,{modifiers:r.modifiers}):S(o,...r.value)}};export{Y as v};
