import{createPluginContext as t,isDisabled as e,TYPE_END as n}from"@any-touch/shared";import{getVLength as a}from"@any-touch/vector";import{ComputeDistance as i,ComputeMaxLength as o}from"@any-touch/compute";const m={name:"tap",pointLength:1,tapTimes:1,waitNextTapTime:300,maxDistance:2,maxDistanceFromPrevTap:9,maxPressTime:250};function r(r,s){const c=t(m,s);let p,u,x,T=0;function f(){T=0,p=void 0,u=void 0}return r.compute([i,o],(t=>{if(e(c))return;const{phase:i,x:o,y:m}=t;n===i&&(c.state=0,!function(){const{startInput:e,pointLength:n,timestamp:a}=t,i=a-e.timestamp,{distance:o,maxPointLength:m}=t;return m===c.pointLength&&0===n&&c.maxDistance>=o&&c.maxPressTime>i}()?(f(),c.state=2):(clearTimeout(x),function(t,e){if(void 0!==p){const n=a({x:t.x-p.x,y:t.y-p.y});return p=t,e.maxDistanceFromPrevTap>=n}return p=t,!0}({x:o,y:m},c)&&function(t){const e=performance.now();if(void 0===u)return u=e,!0;{const n=e-u;return u=e,n{c.state=2,f()}),c.waitNextTapTime)))})),c}export{r as default}; //# sourceMappingURL=index.es.js.map