Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

any-touch

Package Overview
Dependencies
Maintainers
1
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

any-touch - npm Package Compare versions

Comparing version 2.0.2-alpha.0 to 2.0.2-alpha.1

1063

dist/any-touch.umd.js

@@ -1,2 +0,1063 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).AnyTouch=e()}(this,(function(){"use strict";var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},n.apply(this,arguments)};function r(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var i=function(){function t(){this.__map={}}return t.prototype.beforeEach=function(t){this.__interceptor=t},t.prototype.on=function(t,e){var n,i,o=Array.isArray(t)?t:[t];try{for(var a=r(o),u=a.next();!u.done;u=a.next()){var c=u.value;this.__map[c]=this.__map[c]||[];var s=this.__map[c];s&&s.push(e)}}catch(t){n={error:t}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return this},t.prototype.emit=function(t,e,n){var r=this;void 0!==this.__interceptor?this.__interceptor(t,(function(){r.__emit(t,e),n&&n()})):(this.__emit(t,e),n&&n())},t.prototype.__emit=function(t,e){var i,o,a=this.__map[t];if(Array.isArray(a)&&(null==a?void 0:a.length))try{for(var u=r(a),c=u.next();!c.done;c=u.next()){(0,c.value)(e)}}catch(t){i={error:t}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}this.event=n(n({},e),{__type:t})},t.prototype.off=function(t,e){var n=this.__map[t];if(void 0!==n)if(void 0===e)delete this.__map[t];else{var r=n.findIndex((function(t){return t===e}));n.splice(r,1)}},t.prototype.destroy=function(){this.__map={}},t}(),o=Object.prototype.toString;var a,u="start",c="move",s="cancel",p="end",f="computed",v="up",l="down",h="touch",d="touchstart",m="touchmove",y=h+p,g=h+s,_="mouseup",b="mousemove",T="mousedown",x=((a={})[4]=u,a[5]=c,a[1]=p,a[3]=s,a);function E(t){return x[t]}function L(t,e,n){var r,i,o,a,u,c,f,v={1:(r={},r[0]=(i={},i.move=4,i),r[4]=(o={},o.move=5,o[p]=1,o[s]=3,o),r[5]=(a={},a.move=5,a[p]=1,a[s]=3,a),r),0:(u={},u[4]=(c={},c.move=2,c[p]=1,c[s]=3,c),u[5]=(f={},f.start=2,f.move=2,f[p]=1,f[s]=3,f),u)}[Number(t)][e];return void 0!==v&&v[n]||0}function w(t){[1,3,2].includes(t.state)&&(t.state=0)}function M(t){return[4,5].includes(t)}function O(t){if(t.disabled)return t.state=0,!0}function P(t,e){return n(n(n({},t),e),{state:0,disabled:!1})}function A(t){return Math.round(100*t)/100}function S(){var t,e,r,i,o=0;return function(a){if(t=e,void 0!==a){var c=function(t,e){var n=t.phase,r=t.points,i=t.changedPoints,o=t.nativeEvent,a=r.length,c=u===n,f=p===n&&0===a||s===n,v=Date.now(),l=X(r)||X(i),h=l.x,d=l.y,m=o.currentTarget;return Object.assign(t,{id:e,x:h,y:d,timestamp:v,isStart:c,isEnd:f,pointLength:a,currentTarget:m,getOffset:function(t){void 0===t&&(t=m);var e=t.getBoundingClientRect();return{x:h-Math.round(e.left),y:d-Math.round(e.top)}}})}(a,o=Number.MAX_SAFE_INTEGER>o?++o:1);e=c;var f=c.isStart,v=c.pointLength;return f&&(r=c,t=void 0,i=1<v?c:void 0),n(n({},c),{prevInput:t,startMultiInput:i,startInput:r})}}}function X(t){var e=t.length;if(0<e){if(1===e){var n=t[0],r=n.clientX,i=n.clientY;return{x:Math.round(r),y:Math.round(i)}}var o=t.reduce((function(t,e){return t.x+=e.clientX,t.y+=e.clientY,t}),{x:0,y:0});return{x:Math.round(o.x/e),y:Math.round(o.y/e)}}}function Y(t,e,n,r){n.target,n.currentTarget,n.type;var i,o=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(n,["target","currentTarget","type"]);return document.createEvent?(i=document.createEvent("HTMLEvents")).initEvent(t,null==r?void 0:r.bubbles,null==r?void 0:r.cancelable):i=new Event(t,r),Object.assign(i,o,{match:function(){return n.targets&&0<n.targets.length&&n.targets.every((function(t){return i.currentTarget.contains(t)}))}}),e.dispatchEvent(i)}function I(t,e){var n,r=e.preventDefault;return n=r,"[object Function]"===o.call(n)?r(t):!!r}var D=[d,m,y,g];var j={domEvents:{bubbles:!0,cancelable:!0},preventDefault:function(t){if(t.target&&"tagName"in t.target){var e=t.target.tagName;return!/^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/.test(e)}return!1}},C="at:after",N=function(t){function i(e,r){var i,o=t.call(this)||this;o.__computeFunctionList=[],o.__computeFunctionCreatorList=[],o.__pluginContexts=[],o.el=e,o.c={},o.__options=n(n({},j),r);var a,s,f,v,l=function(t){var e=S();return function(n){var r=[],i=[];Array.from(n.touches).forEach((function(e){var n=e.clientX,o=e.clientY,a=e.target;(null==t?void 0:t.contains(a))&&(r.push(a),i.push({clientX:n,clientY:o,target:a}))}));var o=Array.from(n.changedTouches).map((function(t){return{clientX:t.clientX,clientY:t.clientY,target:t.target}}));return e({phase:n.type.replace("touch",""),changedPoints:o,points:i,nativeEvent:n,target:n.target,targets:r})}}(o.el),h=(s=!1,f=null,v=S(),function(t){var e,n=t.clientX,r=t.clientY,i=t.type,o=t.button,l=t.target,h=[{clientX:n,clientY:r,target:l}];if(T===i&&0===o)f=l,s=!0,e=u;else{if(!s)return;b===i?e=c:_===i&&(h=[],e=p,s=!1)}var d=a||[{clientX:n,clientY:r,target:l}];if(a=[{clientX:n,clientY:r,target:l}],void 0!==e)return v({phase:e,changedPoints:d,points:h,target:f,targets:[f],nativeEvent:t})});if(o.__inputCreatorMap=((i={}).touchstart=l,i.touchmove=l,i[y]=l,i[g]=l,i.mousedown=h,i.mousemove=h,i.mouseup=h,i),o.on(C,(function(t){var e=t.target,n=t.__type,r=o.__options.domEvents;r&&void 0!==o.el&&e&&(Y(n,e,t,r),Y(C,e,t,r))})),void 0!==e){e.style.webkitTapHighlightColor="rgba(0,0,0,0)";var d=!1;try{var m={};Object.defineProperty(m,"passive",{get:function(){d=!0}}),window.addEventListener("_",(function(){}),m)}catch(t){}o.on("u",function(t,e,n){return D.forEach((function(r){t.addEventListener(r,e,n)})),t.addEventListener(T,e,n),window.addEventListener(b,e,n),window.addEventListener(_,e,n),function(){D.forEach((function(n){t.removeEventListener(n,e)})),t.removeEventListener(T,e,n),window.removeEventListener(b,e,n),window.removeEventListener(_,e,n)}}(e,o.catchEvent.bind(o),!(!1!==o.__options.preventDefault||!d)&&{passive:!0}))}return o}return e(i,t),i.prototype.use=function(t,e){this.__pluginContexts.push(t(this,e))},i.prototype.catchEvent=function(t){var e=this.__inputCreatorMap[t.type](t);if(void 0!==e){var r=function(){return t.preventDefault()};I(t,this.__options)&&r(),this.emit("input",e),this.emit2("at:"+e.phase,e,{});var i={};this.__computeFunctionList.forEach((function(t){var n=t(e,i);if(void 0!==n)for(var r in n)i[r]=n[r]})),this.emit(f,n(n(n({},e),i),{stopPropagation:function(){return t.stopPropagation()},stopImmediatePropagation:function(){return t.stopImmediatePropagation()},preventDefault:r}))}},i.prototype.compute=function(t,e){var n,i;try{for(var o=r(t),a=o.next();!a.done;a=o.next()){var u=a.value;this.__computeFunctionCreatorList.includes(u)||(this.__computeFunctionCreatorList.push(u),this.__computeFunctionList.push(u()))}}catch(t){n={error:t}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}this.on(f,e)},i.prototype.beforeEach=function(e){var n=this;t.prototype.beforeEach.call(this,(function(t,r){var i;(null===(i=n.c)||void 0===i?void 0:i.name)?e(t,r):r()}))},i.prototype.get=function(t){return this.__pluginContexts.find((function(e){return t===e.name}))},i.prototype.set=function(t){this.__options=n(n({},this.__options),t)},i.prototype.emit2=function(t,e,r){var i=this;this.c=r,this.emit(t,n(n({},e),{type:t}),(function(){i.emit(C,n(n({},e),{name:t,__type:t}))}))},i.prototype.destroy=function(){this.emit("u"),t.prototype.destroy.call(this)},i}(i),F=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},V=function(t){return t/Math.PI*180},R=function(t,e){var n=function(t,e){var n=F(t)*F(e);if(0===n)return 0;var r=function(t,e){return t.x*e.x+t.y*e.y}(t,e)/n;return r>1&&(r=1),Math.acos(r)}(t,e);return function(t,e){return t.x*e.y-e.x*t.y}(t,e)>0&&(n*=-1),V(n)},B=function(t,e){if(0!==t||0!==e)return Math.abs(t)>=Math.abs(e)?0<t?"right":"left":0<e?l:v};function q(){var t=0,e=0;return function(n,r){var i=r.prevVecotr,o=r.startVecotr,a=r.activeVecotr;return a&&(e=Math.round(R(a,i)),t=Math.round(R(a,o))),{angle:t,deltaAngle:e}}}function G(){return function(t){var e=t.prevInput,n=0,r=0,i=0;if(void 0!==e&&(n=t.x-e.x,r=t.y-e.y,0!==n||0!==r)){var o=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));i=Math.round(V(Math.acos(Math.abs(n)/o)))}return{deltaX:n,deltaY:r,deltaXYAngle:i}}}function H(){var t,e=0,n=0,r=0,i=0,o=0;return function(a){var s=a.phase,p=a.startInput;return u===s?(e=0,n=0,r=0,i=0,o=0):c===s&&(e=Math.round(a.points[0].clientX-p.points[0].clientX),n=Math.round(a.points[0].clientY-p.points[0].clientY),r=Math.abs(e),i=Math.abs(n),o=Math.round(F({x:r,y:i})),t=B(e,n)),{displacementX:e,displacementY:n,distanceX:r,distanceY:i,distance:o,overallDirection:t}}}function U(){var t=1;return function(e,n){var r=1,i=n.prevVecotr,o=n.startVecotr,a=n.activeVecotr;return a&&(r=A(F(a)/F(i)),t=A(F(a)/F(o))),{scale:t,deltaScale:r}}}function k(){var t,e,n=0,r=0,i=0,o=0;return function(a){if(void 0!==a){e=e||a.startInput;var u=a.timestamp-e.timestamp;if(16<u){var c=a.x-e.x,s=a.y-e.y;i=Math.round(c/u*100)/100,o=Math.round(s/u*100)/100,n=Math.abs(i),r=Math.abs(o),t=B(c,s),e=a}}return{velocityX:n,velocityY:r,speedX:i,speedY:o,direction:t}}}function Z(){var t=0;return function(e){var n=e.phase;return u===n&&(t=e.pointLength),{maxPointLength:t}}}function $(t){return{x:t.points[1].clientX-t.points[0].clientX,y:t.points[1].clientY-t.points[0].clientY}}function z(){var t,e,n;return function(r){var i=r.prevInput,o=r.startMultiInput;return void 0!==o&&void 0!==i&&r.id!==o.id&&1<i.pointLength&&1<r.pointLength?(t=$(o),e=$(i),n=$(r)):n=void 0,{startVecotr:t,prevVecotr:e,activeVecotr:n}}}var J={name:"tap",pointLength:1,tapTimes:1,waitNextTapTime:300,maxDistance:2,maxDistanceFromPrevTap:9,maxPressTime:250};function K(t,e){var n,r,i,o=P(J,e),a=0;function u(){a=0,n=void 0,r=void 0}return t.compute([H,Z],(function(e){if(!O(o)){var c,s,f,v,l=e.phase,h=e.x,d=e.y;if(p===l)o.state=0,c=e.startInput,s=e.pointLength,f=e.timestamp-c.timestamp,v=e.distance,e.maxPointLength===o.pointLength&&0===s&&o.maxDistance>=v&&o.maxPressTime>f?(clearTimeout(i),function(t,e){if(void 0!==n){var r=F({x:t.x-n.x,y:t.y-n.y});return n=t,e.maxDistanceFromPrevTap>=r}return n=t,!0}({x:h,y:d},o)&&function(t){var e=performance.now();if(void 0===r)return r=e,!0;var n=e-r;return r=e,n<t}(o.waitNextTapTime)?a++:a=1,0==a%o.tapTimes?(o.state=1,t.emit2(o.name,e,o),u()):i=setTimeout((function(){o.state=2,u()}),o.waitNextTapTime)):(u(),o.state=2)}})),o}var Q={name:"pan",threshold:10,pointLength:1};function W(t,e){var n=P(Q,e);return t.compute([k,H,G],(function(e){if(w(n),!O(n)){var r,i,o,a,u,c=(r=e.pointLength,i=e.distance,o=e.direction,a=e.phase,(M(u=n.state)||n.threshold<=i)&&n.pointLength===r&&void 0!==o||M(u)&&[s,p].includes(a));if(n.state=L(c,n.state,e.phase),c){var f=n.name;t.emit2(f,e,n),t.emit2(f+E(n.state),e,n),![p,s].includes(e.phase)&&e.direction&&t.emit2(f+e.direction,e,n)}}})),n}var tt={name:"swipe",threshold:10,velocity:.3,pointLength:1};function et(t,e){var n=P(tt,e);return t.compute([H,k,Z],(function(e){if(n.state=0,!n.disabled&&function(){if(p!==e.phase)return!1;var t=e.velocityX,r=e.velocityY,i=e.distance;return e.maxPointLength===n.pointLength&&0===e.points.length&&n.threshold<i&&n.velocity<Math.max(t,r)}()){var r=n.name;n.state=1,t.emit2(r,e,n),t.emit2(r+e.direction,e,n)}})),n}var nt={name:"press",pointLength:1,maxDistance:9,minPressTime:251};function rt(t,e){var n=P(nt,e),r=0;return t.compute([H],(function(e){if(!O(n)){var i,o=e.phase,a=e.startInput,c=e.pointLength;if(u===o&&n.pointLength===c)w(n),clearTimeout(r),r=setTimeout((function(){n.state=1,t.emit2(n.name,e,n)}),n.minPressTime);else if(p===o&&1===n.state)t.emit2(""+n.name+v,e,n);else if(1!==n.state){var f=e.timestamp-a.timestamp;(!((i=e.distance)&&n.maxDistance>i)||n.minPressTime>f&&[p,s].includes(o))&&(clearTimeout(r),n.state=2)}}})),n}var it={name:"pinch",threshold:0,pointLength:2};function ot(t,e){var n=P(it,e);return t.compute([z,U],(function(e){if(w(n),!O(n)){var r=function(){var t=e.pointLength,r=e.scale,i=e.deltaScale,o=e.phase;return n.pointLength===t&&(void 0!==r&&void 0!==i&&n.threshold<Math.abs(r-1)||M(n.state))||M(n.state)&&[p,s].includes(o)}();n.state=L(r,n.state,e.phase);var i=n.name;if(r){t.emit2(i,e,n);var o=e.deltaScale;1!==o&&t.emit2(i+(1<o?"in":"out"),e,n)}var a=E(n.state);a&&t.emit2(i+a,e,n)}})),n}var at={name:"rotate",threshold:0,pointLength:2};function ut(t,e){var n=P(at,e);return t.compute([z,q],(function(e){if(!O(n)){w(n);var r,i,o,a=(r=e.pointLength,i=e.angle,o=e.phase,n.pointLength===r&&(n.threshold<Math.abs(i)||M(n.state))||M(n.state)&&[p,s].includes(o));n.state=L(a,n.state,e.phase);var u=n.name;a&&t.emit2(u,e,n);var c=E(n.state);c&&t.emit2(u+c,e,n)}})),n}var ct=window.setTimeout;function st(t){t.use(K,{name:"doubletap",tapTimes:2});var e,n=t.get("doubletap");return t.beforeEach((function(t,r){"tap"===t?(clearTimeout(e),e=ct((function(){[0,2].includes(n.state)&&r()}),300)):r()})),n}return function(t){function n(e,n){var r=t.call(this,e,n)||this;return r.use(K),r.use(W),r.use(et),r.use(rt),r.use(ot),r.use(ut),r}return e(n,t),n.version="2.0.1",n.STATE_POSSIBLE=0,n.STATE_START=4,n.STATE_MOVE=5,n.STATE_END=1,n.STATE_CANCELLED=3,n.STATE_FAILED=2,n.STATE_RECOGNIZED=1,n.tap=K,n.pan=W,n.swipe=et,n.press=rt,n.rotate=ut,n.pinch=ot,n.doubletap=st,n}(N)}));
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.AnyTouch = factory());
})(this, (function () { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
var AnyEvent = (function () {
function AnyEvent() {
this.__map = {};
}
AnyEvent.prototype.beforeEach = function (interceptor) {
this.__interceptor = interceptor;
};
AnyEvent.prototype.on = function (typeOrTypes, listener) {
var e_1, _a;
var types = Array.isArray(typeOrTypes) ? typeOrTypes : [typeOrTypes];
try {
for (var types_1 = __values(types), types_1_1 = types_1.next(); !types_1_1.done; types_1_1 = types_1.next()) {
var type = types_1_1.value;
this.__map[type] = this.__map[type] || [];
var listeners = this.__map[type];
if (listeners) {
listeners.push(listener);
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (types_1_1 && !types_1_1.done && (_a = types_1.return)) _a.call(types_1);
}
finally { if (e_1) throw e_1.error; }
}
return this;
};
AnyEvent.prototype.emit = function (type, payload, callback) {
var _this = this;
if (void 0 !== this.__interceptor) {
this.__interceptor(type, function () {
_this.__emit(type, payload);
callback && callback();
});
}
else {
this.__emit(type, payload);
callback && callback();
}
};
AnyEvent.prototype.__emit = function (type, event) {
var e_2, _a;
var listeners = this.__map[type];
if (Array.isArray(listeners) && (listeners === null || listeners === void 0 ? void 0 : listeners.length)) {
try {
for (var listeners_1 = __values(listeners), listeners_1_1 = listeners_1.next(); !listeners_1_1.done; listeners_1_1 = listeners_1.next()) {
var listener = listeners_1_1.value;
listener(event);
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (listeners_1_1 && !listeners_1_1.done && (_a = listeners_1.return)) _a.call(listeners_1);
}
finally { if (e_2) throw e_2.error; }
}
}
this.event = __assign(__assign({}, event), { __type: type });
};
AnyEvent.prototype.off = function (type, listener) {
var listeners = this.__map[type];
if (void 0 !== listeners) {
if (void 0 === listener) {
delete this.__map[type];
}
else {
var index = listeners.findIndex(function (cb) { return cb === listener; });
listeners.splice(index, 1);
}
}
};
AnyEvent.prototype.destroy = function () {
this.__map = {};
};
return AnyEvent;
}());
var ObjectToString = Object.prototype.toString;
function isFunction(input) {
return '[object Function]' === ObjectToString.call(input);
}
var CLIENT_X = 'clientX';
var CLIENT_Y = 'clientY';
var COMPUTE_INTERVAL = 16;
var TYPE_START = 'start';
var TYPE_MOVE = 'move';
var TYPE_CANCEL = 'cancel';
var TYPE_END = 'end';
var TYPE_COMPUTED = 'computed';
var DIRECTION_LEFT = 'left';
var DIRECTION_RIGHT = 'right';
var DIRECTION_UP = 'up';
var DIRECTION_DOWN = 'down';
var TOUCH = 'touch';
var MOUSE = 'mouse';
var TOUCH_START = TOUCH + TYPE_START;
var TOUCH_MOVE = TOUCH + TYPE_MOVE;
var TOUCH_END = TOUCH + TYPE_END;
var TOUCH_CANCEL = TOUCH + TYPE_CANCEL;
var MOUSE_UP = MOUSE + DIRECTION_UP;
var MOUSE_MOVE = MOUSE + TYPE_MOVE;
var MOUSE_DOWN = MOUSE + DIRECTION_DOWN;
var _a;
var STATUS_CODE_AND_NAME_MAP = (_a = {},
_a[4] = TYPE_START,
_a[5] = TYPE_MOVE,
_a[1] = TYPE_END,
_a[3] = TYPE_CANCEL,
_a);
function getStatusName(code) {
return STATUS_CODE_AND_NAME_MAP[code];
}
function flow(isVaild, lastStatus, phase) {
var _a, _b, _c, _d, _e, _f, _g;
var STATE_MAP = {
1: (_a = {},
_a[0] = (_b = {},
_b[TYPE_MOVE] = 4,
_b),
_a[4] = (_c = {},
_c[TYPE_MOVE] = 5,
_c[TYPE_END] = 1,
_c[TYPE_CANCEL] = 3,
_c),
_a[5] = (_d = {},
_d[TYPE_MOVE] = 5,
_d[TYPE_END] = 1,
_d[TYPE_CANCEL] = 3,
_d),
_a),
0: (_e = {},
_e[4] = (_f = {},
_f[TYPE_MOVE] = 2,
_f[TYPE_END] = 1,
_f[TYPE_CANCEL] = 3,
_f),
_e[5] = (_g = {},
_g[TYPE_START] = 2,
_g[TYPE_MOVE] = 2,
_g[TYPE_END] = 1,
_g[TYPE_CANCEL] = 3,
_g),
_e),
};
var map = STATE_MAP[Number(isVaild)][lastStatus];
return (void 0 !== map && map[phase]) || 0;
}
function resetState(context) {
if ([1, 3, 2].includes(context.state)) {
context.state = 0;
}
}
function isRecognized(state) {
return [4, 5].includes(state);
}
function isDisabled(context) {
if (context.disabled) {
context.state = 0;
return true;
}
}
function createPluginContext(defaultOptions, options) {
return __assign(__assign(__assign({}, defaultOptions), options), { state: 0, disabled: false });
}
function round2(n) {
return Math.round(n * 100) / 100;
}
function inputCreator () {
var id = 0;
var prevInput;
var activeInput;
var startInput;
var startMultiInput;
return function (basicsInput) {
prevInput = activeInput;
if (void 0 !== basicsInput) {
id = Number.MAX_SAFE_INTEGER > id ? ++id : 1;
var pureInput = extendInput(basicsInput, id);
activeInput = pureInput;
var isStart = pureInput.isStart, pointLength = pureInput.pointLength;
if (isStart) {
startInput = pureInput;
prevInput = void 0;
if (1 < pointLength) {
startMultiInput = pureInput;
}
else {
startMultiInput = void 0;
}
}
return __assign(__assign({}, pureInput), { prevInput: prevInput, startMultiInput: startMultiInput, startInput: startInput });
}
};
}
function getCenter(points) {
var length = points.length;
if (0 < length) {
if (1 === length) {
var _a = points[0], clientX = _a.clientX, clientY = _a.clientY;
return { x: Math.round(clientX), y: Math.round(clientY) };
}
var countPoint = points.reduce(function (countPoint, point) {
countPoint.x += point[CLIENT_X];
countPoint.y += point[CLIENT_Y];
return countPoint;
}, { x: 0, y: 0 });
return { x: Math.round(countPoint.x / length), y: Math.round(countPoint.y / length) };
}
}
function extendInput(basicsInput, id) {
var phase = basicsInput.phase, points = basicsInput.points, changedPoints = basicsInput.changedPoints, nativeEvent = basicsInput.nativeEvent;
var pointLength = points.length;
var isStart = TYPE_START === phase;
var isEnd = (TYPE_END === phase && 0 === pointLength) || TYPE_CANCEL === phase;
var timestamp = Date.now();
var _a = getCenter(points) || getCenter(changedPoints), x = _a.x, y = _a.y;
var currentTarget = nativeEvent.currentTarget;
return Object.assign(basicsInput, {
id: id,
x: x, y: y,
timestamp: timestamp,
isStart: isStart, isEnd: isEnd,
pointLength: pointLength,
currentTarget: currentTarget,
getOffset: function (el) {
if (el === void 0) { el = currentTarget; }
var rect = el.getBoundingClientRect();
return { x: x - Math.round(rect.left), y: y - Math.round(rect.top) };
}
});
}
function mouse () {
var prevPoints;
var isPressed = false;
var _target = null;
var createInput = inputCreator();
return function (event) {
var clientX = event.clientX, clientY = event.clientY, type = event.type, button = event.button, target = event.target;
var points = [{ clientX: clientX, clientY: clientY, target: target }];
var phase;
if (MOUSE_DOWN === type && 0 === button) {
_target = target;
isPressed = true;
phase = TYPE_START;
}
else if (isPressed) {
if (MOUSE_MOVE === type) {
phase = TYPE_MOVE;
}
else if (MOUSE_UP === type) {
points = [];
phase = TYPE_END;
isPressed = false;
}
}
else {
return;
}
var changedPoints = prevPoints || [{ clientX: clientX, clientY: clientY, target: target }];
prevPoints = [{ clientX: clientX, clientY: clientY, target: target }];
if (void 0 !== phase) {
return createInput({
phase: phase,
changedPoints: changedPoints,
points: points,
target: _target,
targets: [_target],
nativeEvent: event
});
}
};
}
function touch (el) {
var createInput = inputCreator();
return function (event) {
var targets = [];
var points = [];
Array.from(event.touches).forEach(function (_a) {
var clientX = _a.clientX, clientY = _a.clientY, target = _a.target;
if (el === null || el === void 0 ? void 0 : el.contains(target)) {
targets.push(target);
points.push({ clientX: clientX, clientY: clientY, target: target });
}
});
var changedPoints = Array.from(event.changedTouches).map(function (_a) {
var clientX = _a.clientX, clientY = _a.clientY, target = _a.target;
return ({ clientX: clientX, clientY: clientY, target: target });
});
return createInput({
phase: event.type.replace('touch', ''),
changedPoints: changedPoints,
points: points,
nativeEvent: event,
target: event.target,
targets: targets
});
};
}
function dispatchDomEvent (typeName, el, payload, eventInit) {
payload.target; payload.currentTarget; payload.type; var data = __rest(payload, ["target", "currentTarget", "type"]);
var event;
if (document.createEvent) {
event = document.createEvent('HTMLEvents');
event.initEvent(typeName, eventInit === null || eventInit === void 0 ? void 0 : eventInit.bubbles, eventInit === null || eventInit === void 0 ? void 0 : eventInit.cancelable);
}
else {
event = new Event(typeName, eventInit);
}
Object.assign(event, data, {
match: function () {
return payload.targets && 0 < payload.targets.length && payload.targets.every(function (target) { return event.currentTarget.contains(target); });
},
});
return el.dispatchEvent(event);
}
function canPreventDefault (event, options) {
var preventDefault = options.preventDefault;
if (isFunction(preventDefault)) {
return preventDefault(event);
}
else {
return !!preventDefault;
}
}
var TOUCH_EVENTS = [TOUCH_START, TOUCH_MOVE, TOUCH_END, TOUCH_CANCEL];
function bindElement (el, catchEvent, options) {
TOUCH_EVENTS.forEach(function (eventName) {
el.addEventListener(eventName, catchEvent, options);
});
el.addEventListener(MOUSE_DOWN, catchEvent, options);
window.addEventListener(MOUSE_MOVE, catchEvent, options);
window.addEventListener(MOUSE_UP, catchEvent, options);
return function () {
TOUCH_EVENTS.forEach(function (eventName) {
el.removeEventListener(eventName, catchEvent);
});
el.removeEventListener(MOUSE_DOWN, catchEvent, options);
window.removeEventListener(MOUSE_MOVE, catchEvent, options);
window.removeEventListener(MOUSE_UP, catchEvent, options);
};
}
var DEFAULT_OPTIONS$6 = {
domEvents: { bubbles: true, cancelable: true },
preventDefault: function (event) {
if (event.target && 'tagName' in event.target) {
var tagName = event.target.tagName;
return !/^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/.test(tagName);
}
return false;
},
};
var TYPE_UNBIND = 'u';
var TYPE_INPUT = 'input';
var TYPE_AT_AFTER = 'at:after';
var default_1$1 = (function (_super) {
__extends(default_1, _super);
function default_1(el, options) {
var _a;
var _this = _super.call(this) || this;
_this.__computeFunctionList = [];
_this.__computeFunctionCreatorList = [];
_this.__pluginContexts = [];
_this.el = el;
_this.c = {};
_this.__options = __assign(__assign({}, DEFAULT_OPTIONS$6), options);
var createInputFromTouch = touch(_this.el);
var createInputFromMouse = mouse();
_this.__inputCreatorMap = (_a = {},
_a[TOUCH_START] = createInputFromTouch,
_a[TOUCH_MOVE] = createInputFromTouch,
_a[TOUCH_END] = createInputFromTouch,
_a[TOUCH_CANCEL] = createInputFromTouch,
_a[MOUSE_DOWN] = createInputFromMouse,
_a[MOUSE_MOVE] = createInputFromMouse,
_a[MOUSE_UP] = createInputFromMouse,
_a);
_this.on(TYPE_AT_AFTER, function (payload) {
var target = payload.target, __type = payload.__type;
var domEvents = _this.__options.domEvents;
if (!!domEvents && void 0 !== _this.el && !!target) {
dispatchDomEvent(__type, target, payload, domEvents);
dispatchDomEvent(TYPE_AT_AFTER, target, payload, domEvents);
}
});
if (void 0 !== el) {
el.style.webkitTapHighlightColor = 'rgba(0,0,0,0)';
var supportsPassive_1 = false;
try {
var opts = {};
Object.defineProperty(opts, 'passive', {
get: function () {
supportsPassive_1 = true;
},
});
window.addEventListener('_', function () { return void 0; }, opts);
}
catch (_b) { }
_this.on(TYPE_UNBIND, bindElement(el, _this.catchEvent.bind(_this), false === _this.__options.preventDefault && supportsPassive_1 ? { passive: true } : false));
}
return _this;
}
default_1.prototype.use = function (plugin, pluginOptions) {
this.__pluginContexts.push(plugin(this, pluginOptions));
};
default_1.prototype.catchEvent = function (event) {
var input = this.__inputCreatorMap[event.type](event);
if (void 0 !== input) {
var stopPropagation = function () { return event.stopPropagation(); };
var stopImmediatePropagation = function () { return event.stopImmediatePropagation(); };
var preventDefault = function () { return event.preventDefault(); };
if (canPreventDefault(event, this.__options)) {
preventDefault();
}
this.emit(TYPE_INPUT, input);
this.emit2("at:" + input.phase, input, {});
var computed_1 = {};
this.__computeFunctionList.forEach(function (compute) {
var result = compute(input, computed_1);
if (void 0 !== result) {
for (var key in result) {
computed_1[key] = result[key];
}
}
});
this.emit(TYPE_COMPUTED, __assign(__assign(__assign({}, input), computed_1), { stopPropagation: stopPropagation, stopImmediatePropagation: stopImmediatePropagation, preventDefault: preventDefault }));
}
};
default_1.prototype.compute = function (computeFunctionCreatorList, callback) {
var e_1, _a;
try {
for (var computeFunctionCreatorList_1 = __values(computeFunctionCreatorList), computeFunctionCreatorList_1_1 = computeFunctionCreatorList_1.next(); !computeFunctionCreatorList_1_1.done; computeFunctionCreatorList_1_1 = computeFunctionCreatorList_1.next()) {
var computeFunctionCreator = computeFunctionCreatorList_1_1.value;
if (!this.__computeFunctionCreatorList.includes(computeFunctionCreator)) {
this.__computeFunctionCreatorList.push(computeFunctionCreator);
this.__computeFunctionList.push(computeFunctionCreator());
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (computeFunctionCreatorList_1_1 && !computeFunctionCreatorList_1_1.done && (_a = computeFunctionCreatorList_1.return)) _a.call(computeFunctionCreatorList_1);
}
finally { if (e_1) throw e_1.error; }
}
this.on(TYPE_COMPUTED, callback);
};
default_1.prototype.beforeEach = function (interceptor) {
var _this = this;
_super.prototype.beforeEach.call(this, function (type, next) {
var _a;
if ((_a = _this.c) === null || _a === void 0 ? void 0 : _a.name) {
interceptor(type, next);
}
else {
next();
}
});
};
default_1.prototype.get = function (name) {
return this.__pluginContexts.find(function (pluginContext) { return name === pluginContext.name; });
};
default_1.prototype.set = function (newOptions) {
this.__options = __assign(__assign({}, this.__options), newOptions);
};
default_1.prototype.emit2 = function (type, payload, pluginContext) {
var _this = this;
this.c = pluginContext;
this.emit(type, __assign(__assign({}, payload), { type: type }), function () {
_this.emit(TYPE_AT_AFTER, __assign(__assign({}, payload), { name: type, __type: type }));
});
};
default_1.prototype.destroy = function () {
this.emit(TYPE_UNBIND);
_super.prototype.destroy.call(this);
};
return default_1;
}(AnyEvent));
var getVLength = (function (v) {
return Math.sqrt(v.x * v.x + v.y * v.y);
});
var getDotProduct = (function (v1, v2) {
return v1.x * v2.x + v1.y * v2.y;
});
var getRadian = (function (v1, v2) {
var mr = getVLength(v1) * getVLength(v2);
if (mr === 0)
return 0;
var r = getDotProduct(v1, v2) / mr;
if (r > 1)
r = 1;
return Math.acos(r);
});
var getCross = (function (v1, v2) {
return v1.x * v2.y - v2.x * v1.y;
});
var radianToAngle = (function (radian) { return radian / Math.PI * 180; });
var getAngle = (function (v1, v2) {
var angle = getRadian(v1, v2);
if (getCross(v1, v2) > 0) {
angle *= -1;
}
return radianToAngle(angle);
});
var getDirection = (function (x, y) {
if (0 === x && 0 === y) {
return;
}
if (Math.abs(x) >= Math.abs(y)) {
return 0 < x ? DIRECTION_RIGHT : DIRECTION_LEFT;
}
else {
return 0 < y ? DIRECTION_DOWN : DIRECTION_UP;
}
});
function ComputeAngle() {
var angle = 0;
var deltaAngle = 0;
return function (input, computed) {
var prevVecotr = computed.prevVecotr, startVecotr = computed.startVecotr, activeVecotr = computed.activeVecotr;
if (activeVecotr) {
deltaAngle = Math.round(getAngle(activeVecotr, prevVecotr));
angle = Math.round(getAngle(activeVecotr, startVecotr));
}
return { angle: angle, deltaAngle: deltaAngle };
};
}
function ComputeDeltaXY () {
return function (input) {
var prevInput = input.prevInput;
var deltaX = 0;
var deltaY = 0;
var deltaXYAngle = 0;
if (void 0 !== prevInput) {
deltaX = input.x - prevInput.x;
deltaY = input.y - prevInput.y;
if (0 !== deltaX || 0 !== deltaY) {
var deltaXY = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));
deltaXYAngle = Math.round(radianToAngle(Math.acos(Math.abs(deltaX) / deltaXY)));
}
}
return { deltaX: deltaX, deltaY: deltaY, deltaXYAngle: deltaXYAngle };
};
}
function ComputeDistance () {
var displacementX = 0;
var displacementY = 0;
var distanceX = 0;
var distanceY = 0;
var distance = 0;
var overallDirection;
return function (input) {
var phase = input.phase, startInput = input.startInput;
if (TYPE_START === phase) {
displacementX = 0;
displacementY = 0;
distanceX = 0;
distanceY = 0;
distance = 0;
}
else if (TYPE_MOVE === phase) {
displacementX = Math.round(input.points[0][CLIENT_X] - startInput.points[0][CLIENT_X]);
displacementY = Math.round(input.points[0][CLIENT_Y] - startInput.points[0][CLIENT_Y]);
distanceX = Math.abs(displacementX);
distanceY = Math.abs(displacementY);
distance = Math.round(getVLength({ x: distanceX, y: distanceY }));
overallDirection = getDirection(displacementX, displacementY);
}
return {
displacementX: displacementX, displacementY: displacementY, distanceX: distanceX, distanceY: distanceY, distance: distance, overallDirection: overallDirection
};
};
}
function ComputeScale () {
var scale = 1;
return function (input, computed) {
var deltaScale = 1;
var prevVecotr = computed.prevVecotr, startVecotr = computed.startVecotr, activeVecotr = computed.activeVecotr;
if (activeVecotr) {
deltaScale = round2(getVLength(activeVecotr) / getVLength(prevVecotr));
scale = round2(getVLength(activeVecotr) / getVLength(startVecotr));
}
return { scale: scale, deltaScale: deltaScale };
};
}
function ComputeVAndDir () {
var velocityX = 0;
var velocityY = 0;
var speedX = 0;
var speedY = 0;
var direction;
var lastValidInput;
return function (input) {
if (void 0 !== input) {
lastValidInput = lastValidInput || input.startInput;
var deltaTime = input.timestamp - lastValidInput.timestamp;
if (COMPUTE_INTERVAL < deltaTime) {
var deltaX = input.x - lastValidInput.x;
var deltaY = input.y - lastValidInput.y;
speedX = Math.round(deltaX / deltaTime * 100) / 100;
speedY = Math.round(deltaY / deltaTime * 100) / 100;
velocityX = Math.abs(speedX);
velocityY = Math.abs(speedY);
direction = getDirection(deltaX, deltaY);
lastValidInput = input;
}
}
return { velocityX: velocityX, velocityY: velocityY, speedX: speedX, speedY: speedY, direction: direction };
};
}
function ComputeMaxLength() {
var maxPointLength = 0;
return function (input) {
var phase = input.phase;
if (TYPE_START === phase) {
maxPointLength = input.pointLength;
}
return { maxPointLength: maxPointLength };
};
}
function computeVector(input) {
return {
x: input.points[1][CLIENT_X] - input.points[0][CLIENT_X],
y: input.points[1][CLIENT_Y] - input.points[0][CLIENT_Y]
};
}
function ComputeVectorForMutli () {
var startVecotr;
var prevVecotr;
var activeVecotr;
return function (input) {
var prevInput = input.prevInput, startMultiInput = input.startMultiInput;
if (void 0 !== startMultiInput &&
void 0 !== prevInput &&
input.id !== startMultiInput.id &&
1 < prevInput.pointLength &&
1 < input.pointLength) {
startVecotr = computeVector(startMultiInput);
prevVecotr = computeVector(prevInput);
activeVecotr = computeVector(input);
}
else {
activeVecotr = void 0;
}
return {
startVecotr: startVecotr,
prevVecotr: prevVecotr,
activeVecotr: activeVecotr
};
};
}
var DEFAULT_OPTIONS$5 = {
name: 'tap',
pointLength: 1,
tapTimes: 1,
waitNextTapTime: 300,
maxDistance: 2,
maxDistanceFromPrevTap: 9,
maxPressTime: 250,
};
function tap (at, options) {
var context = createPluginContext(DEFAULT_OPTIONS$5, options);
var tapCount = 0;
var prevTapPoint;
var prevTapTime;
var countDownToFailTimer;
function reset() {
tapCount = 0;
prevTapPoint = void 0;
prevTapTime = void 0;
}
function countDownToFail() {
countDownToFailTimer = setTimeout(function () {
context.state = 2;
reset();
}, context.waitNextTapTime);
}
function isValidDistanceFromPrevTap(center, options) {
if (void 0 !== prevTapPoint) {
var distanceFromPreviousTap = getVLength({ x: center.x - prevTapPoint.x, y: center.y - prevTapPoint.y });
prevTapPoint = center;
return options.maxDistanceFromPrevTap >= distanceFromPreviousTap;
}
else {
prevTapPoint = center;
return true;
}
}
function isValidInterval(waitNextTapTime) {
var now = performance.now();
if (void 0 === prevTapTime) {
prevTapTime = now;
return true;
}
else {
var interval = now - prevTapTime;
prevTapTime = now;
return interval < waitNextTapTime;
}
}
at.compute([ComputeDistance, ComputeMaxLength], function (computed) {
if (isDisabled(context))
return;
var phase = computed.phase, x = computed.x, y = computed.y;
if (TYPE_END !== phase)
return;
context.state = 0;
if (test()) {
clearTimeout(countDownToFailTimer);
if (isValidDistanceFromPrevTap({ x: x, y: y }, context) && isValidInterval(context.waitNextTapTime)) {
tapCount++;
}
else {
tapCount = 1;
}
if (0 === tapCount % context.tapTimes) {
context.state = 1;
at.emit2(context.name, computed, context);
reset();
}
else {
countDownToFail();
}
}
else {
reset();
context.state = 2;
}
function test() {
var startInput = computed.startInput, pointLength = computed.pointLength, timestamp = computed.timestamp;
var deltaTime = timestamp - startInput.timestamp;
var distance = computed.distance, maxPointLength = computed.maxPointLength;
return (maxPointLength === context.pointLength &&
0 === pointLength &&
context.maxDistance >= distance &&
context.maxPressTime > deltaTime);
}
});
return context;
}
var DEFAULT_OPTIONS$4 = { name: 'pan', threshold: 10, pointLength: 1 };
function pan (at, options) {
var context = createPluginContext(DEFAULT_OPTIONS$4, options);
at.compute([ComputeVAndDir, ComputeDistance, ComputeDeltaXY], function (computed) {
resetState(context);
if (isDisabled(context))
return;
var isValid = test();
context.state = flow(isValid, context.state, computed.phase);
if (isValid) {
var name_1 = context.name;
at.emit2(name_1, computed, context);
at.emit2(name_1 + getStatusName(context.state), computed, context);
if (![TYPE_END, TYPE_CANCEL].includes(computed.phase) && computed.direction) {
at.emit2(name_1 + computed.direction, computed, context);
}
}
function test() {
var pointLength = computed.pointLength, distance = computed.distance, direction = computed.direction, phase = computed.phase;
var state = context.state;
return (((isRecognized(state) || (context.threshold <= distance)) &&
context.pointLength === pointLength &&
void 0 !== direction) ||
(isRecognized(state) && [TYPE_CANCEL, TYPE_END].includes(phase)));
}
});
return context;
}
var DEFAULT_OPTIONS$3 = {
name: 'swipe',
threshold: 10,
velocity: 0.3,
pointLength: 1,
};
function swipe (at, options) {
var context = createPluginContext(DEFAULT_OPTIONS$3, options);
at.compute([ComputeDistance, ComputeVAndDir, ComputeMaxLength], function (computed) {
context.state = 0;
if (context.disabled)
return;
if (test()) {
var name_1 = context.name;
context.state = 1;
at.emit2(name_1, computed, context);
at.emit2(name_1 + computed.direction, computed, context);
}
function test() {
if (TYPE_END !== computed.phase)
return false;
var velocityX = computed.velocityX, velocityY = computed.velocityY, distance = computed.distance, maxPointLength = computed.maxPointLength;
return (maxPointLength === context.pointLength &&
0 === computed.points.length &&
context.threshold < distance &&
context.velocity < Math.max(velocityX, velocityY));
}
});
return context;
}
var DEFAULT_OPTIONS$2 = {
name: 'press',
pointLength: 1,
maxDistance: 9,
minPressTime: 251,
};
function press (at, options) {
var context = createPluginContext(DEFAULT_OPTIONS$2, options);
var timeoutId = 0;
at.compute([ComputeDistance], function (computed) {
if (isDisabled(context))
return;
var phase = computed.phase, startInput = computed.startInput, pointLength = computed.pointLength;
if (TYPE_START === phase && context.pointLength === pointLength) {
resetState(context);
clearTimeout(timeoutId);
timeoutId = setTimeout(function () {
context.state = 1;
at.emit2(context.name, computed, context);
}, context.minPressTime);
}
else if (TYPE_END === phase && 1 === context.state) {
at.emit2("" + context.name + DIRECTION_UP, computed, context);
}
else if (1 !== context.state) {
var deltaTime = computed.timestamp - startInput.timestamp;
if (!test() ||
(context.minPressTime > deltaTime && [TYPE_END, TYPE_CANCEL].includes(phase))) {
clearTimeout(timeoutId);
context.state = 2;
}
}
function test() {
var distance = computed.distance;
return distance && context.maxDistance > distance;
}
});
return context;
}
var DEFAULT_OPTIONS$1 = {
name: 'pinch',
threshold: 0,
pointLength: 2,
};
function pinch (at, options) {
var context = createPluginContext(DEFAULT_OPTIONS$1, options);
at.compute([ComputeVectorForMutli, ComputeScale], function (computed) {
resetState(context);
if (isDisabled(context))
return;
var isValid = test();
context.state = flow(isValid, context.state, computed.phase);
var name = context.name;
if (isValid) {
at.emit2(name, computed, context);
var deltaScale = computed.deltaScale;
if (1 !== deltaScale) {
at.emit2(name + (1 < deltaScale ? 'in' : 'out'), computed, context);
}
}
var stateName = getStatusName(context.state);
if (stateName) {
at.emit2(name + stateName, computed, context);
}
function test() {
var pointLength = computed.pointLength, scale = computed.scale, deltaScale = computed.deltaScale, phase = computed.phase;
return ((context.pointLength === pointLength &&
((void 0 !== scale && void 0 !== deltaScale && context.threshold < Math.abs(scale - 1)) ||
isRecognized(context.state))) ||
(isRecognized(context.state) && [TYPE_END, TYPE_CANCEL].includes(phase)));
}
});
return context;
}
var DEFAULT_OPTIONS = {
name: 'rotate',
threshold: 0,
pointLength: 2,
};
function rotate (at, options) {
var context = createPluginContext(DEFAULT_OPTIONS, options);
at.compute([ComputeVectorForMutli, ComputeAngle], function (computed) {
if (isDisabled(context))
return;
resetState(context);
var isValid = test();
context.state = flow(isValid, context.state, computed.phase);
var name = context.name;
if (isValid) {
at.emit2(name, computed, context);
}
var stateName = getStatusName(context.state);
if (stateName) {
at.emit2(name + stateName, computed, context);
}
function test() {
var pointLength = computed.pointLength, angle = computed.angle, phase = computed.phase;
return ((context.pointLength === pointLength && (context.threshold < Math.abs(angle) || isRecognized(context.state))) ||
(isRecognized(context.state) && [TYPE_END, TYPE_CANCEL].includes(phase)));
}
});
return context;
}
var setTimeout$1 = window.setTimeout;
function doubletap (at) {
at.use(tap, { name: 'doubletap', tapTimes: 2 });
var doubleTapContext = at.get('doubletap');
var timeID;
at.beforeEach(function (type, next) {
if ('tap' === type) {
clearTimeout(timeID);
timeID = setTimeout$1(function () {
if ([0, 2].includes(doubleTapContext.state)) {
next();
}
}, 300);
}
else {
next();
}
});
return doubleTapContext;
}
var default_1 = (function (_super) {
__extends(default_1, _super);
function default_1(el, options) {
var _this = _super.call(this, el, options) || this;
_this.use(tap);
_this.use(pan);
_this.use(swipe);
_this.use(press);
_this.use(pinch);
_this.use(rotate);
return _this;
}
default_1.version = '2.0.2-alpha.0';
default_1.STATE_POSSIBLE = 0;
default_1.STATE_START = 4;
default_1.STATE_MOVE = 5;
default_1.STATE_END = 1;
default_1.STATE_CANCELLED = 3;
default_1.STATE_FAILED = 2;
default_1.STATE_RECOGNIZED = 1;
default_1.tap = tap;
default_1.pan = pan;
default_1.swipe = swipe;
default_1.press = press;
default_1.rotate = rotate;
default_1.pinch = pinch;
default_1.doubletap = doubletap;
return default_1;
}(default_1$1));
return default_1;
}));
//# sourceMappingURL=any-touch.umd.js.map

2

dist/any-touch.umd.min.js

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).AnyTouch=e()}(this,(function(){"use strict";var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},n.apply(this,arguments)};function r(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var i=function(){function t(){this.__map={}}return t.prototype.beforeEach=function(t){this.__interceptor=t},t.prototype.on=function(t,e){var n,i,o=Array.isArray(t)?t:[t];try{for(var a=r(o),u=a.next();!u.done;u=a.next()){var c=u.value;this.__map[c]=this.__map[c]||[];var s=this.__map[c];s&&s.push(e)}}catch(t){n={error:t}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return this},t.prototype.emit=function(t,e,n){var r=this;void 0!==this.__interceptor?this.__interceptor(t,(function(){r.__emit(t,e),n&&n()})):(this.__emit(t,e),n&&n())},t.prototype.__emit=function(t,e){var i,o,a=this.__map[t];if(Array.isArray(a)&&(null==a?void 0:a.length))try{for(var u=r(a),c=u.next();!c.done;c=u.next()){(0,c.value)(e)}}catch(t){i={error:t}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}this.event=n(n({},e),{__type:t})},t.prototype.off=function(t,e){var n=this.__map[t];if(void 0!==n)if(void 0===e)delete this.__map[t];else{var r=n.findIndex((function(t){return t===e}));n.splice(r,1)}},t.prototype.destroy=function(){this.__map={}},t}(),o=Object.prototype.toString;var a,u="start",c="move",s="cancel",p="end",f="computed",v="up",l="down",h="touch",d="touchstart",m="touchmove",y=h+p,g=h+s,_="mouseup",b="mousemove",T="mousedown",x=((a={})[4]=u,a[5]=c,a[1]=p,a[3]=s,a);function E(t){return x[t]}function L(t,e,n){var r,i,o,a,u,c,f,v={1:(r={},r[0]=(i={},i.move=4,i),r[4]=(o={},o.move=5,o[p]=1,o[s]=3,o),r[5]=(a={},a.move=5,a[p]=1,a[s]=3,a),r),0:(u={},u[4]=(c={},c.move=2,c[p]=1,c[s]=3,c),u[5]=(f={},f.start=2,f.move=2,f[p]=1,f[s]=3,f),u)}[Number(t)][e];return void 0!==v&&v[n]||0}function w(t){[1,3,2].includes(t.state)&&(t.state=0)}function M(t){return[4,5].includes(t)}function O(t){if(t.disabled)return t.state=0,!0}function P(t,e){return n(n(n({},t),e),{state:0,disabled:!1})}function A(t){return Math.round(100*t)/100}function S(){var t,e,r,i,o=0;return function(a){if(t=e,void 0!==a){var c=function(t,e){var n=t.phase,r=t.points,i=t.changedPoints,o=t.nativeEvent,a=r.length,c=u===n,f=p===n&&0===a||s===n,v=Date.now(),l=X(r)||X(i),h=l.x,d=l.y,m=o.currentTarget;return Object.assign(t,{id:e,x:h,y:d,timestamp:v,isStart:c,isEnd:f,pointLength:a,currentTarget:m,getOffset:function(t){void 0===t&&(t=m);var e=t.getBoundingClientRect();return{x:h-Math.round(e.left),y:d-Math.round(e.top)}}})}(a,o=Number.MAX_SAFE_INTEGER>o?++o:1);e=c;var f=c.isStart,v=c.pointLength;return f&&(r=c,t=void 0,i=1<v?c:void 0),n(n({},c),{prevInput:t,startMultiInput:i,startInput:r})}}}function X(t){var e=t.length;if(0<e){if(1===e){var n=t[0],r=n.clientX,i=n.clientY;return{x:Math.round(r),y:Math.round(i)}}var o=t.reduce((function(t,e){return t.x+=e.clientX,t.y+=e.clientY,t}),{x:0,y:0});return{x:Math.round(o.x/e),y:Math.round(o.y/e)}}}function Y(t,e,n,r){n.target,n.currentTarget,n.type;var i,o=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(n,["target","currentTarget","type"]);return document.createEvent?(i=document.createEvent("HTMLEvents")).initEvent(t,null==r?void 0:r.bubbles,null==r?void 0:r.cancelable):i=new Event(t,r),Object.assign(i,o,{match:function(){return n.targets&&0<n.targets.length&&n.targets.every((function(t){return i.currentTarget.contains(t)}))}}),e.dispatchEvent(i)}function I(t,e){var n,r=e.preventDefault;return n=r,"[object Function]"===o.call(n)?r(t):!!r}var D=[d,m,y,g];var j={domEvents:{bubbles:!0,cancelable:!0},preventDefault:function(t){if(t.target&&"tagName"in t.target){var e=t.target.tagName;return!/^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/.test(e)}return!1}},C="at:after",N=function(t){function i(e,r){var i,o=t.call(this)||this;o.__computeFunctionList=[],o.__computeFunctionCreatorList=[],o.__pluginContexts=[],o.el=e,o.c={},o.__options=n(n({},j),r);var a,s,f,v,l=function(t){var e=S();return function(n){var r=[],i=[];Array.from(n.touches).forEach((function(e){var n=e.clientX,o=e.clientY,a=e.target;(null==t?void 0:t.contains(a))&&(r.push(a),i.push({clientX:n,clientY:o,target:a}))}));var o=Array.from(n.changedTouches).map((function(t){return{clientX:t.clientX,clientY:t.clientY,target:t.target}}));return e({phase:n.type.replace("touch",""),changedPoints:o,points:i,nativeEvent:n,target:n.target,targets:r})}}(o.el),h=(s=!1,f=null,v=S(),function(t){var e,n=t.clientX,r=t.clientY,i=t.type,o=t.button,l=t.target,h=[{clientX:n,clientY:r,target:l}];if(T===i&&0===o)f=l,s=!0,e=u;else{if(!s)return;b===i?e=c:_===i&&(h=[],e=p,s=!1)}var d=a||[{clientX:n,clientY:r,target:l}];if(a=[{clientX:n,clientY:r,target:l}],void 0!==e)return v({phase:e,changedPoints:d,points:h,target:f,targets:[f],nativeEvent:t})});if(o.__inputCreatorMap=((i={}).touchstart=l,i.touchmove=l,i[y]=l,i[g]=l,i.mousedown=h,i.mousemove=h,i.mouseup=h,i),o.on(C,(function(t){var e=t.target,n=t.__type,r=o.__options.domEvents;r&&void 0!==o.el&&e&&(Y(n,e,t,r),Y(C,e,t,r))})),void 0!==e){e.style.webkitTapHighlightColor="rgba(0,0,0,0)";var d=!1;try{var m={};Object.defineProperty(m,"passive",{get:function(){d=!0}}),window.addEventListener("_",(function(){}),m)}catch(t){}o.on("u",function(t,e,n){return D.forEach((function(r){t.addEventListener(r,e,n)})),t.addEventListener(T,e,n),window.addEventListener(b,e,n),window.addEventListener(_,e,n),function(){D.forEach((function(n){t.removeEventListener(n,e)})),t.removeEventListener(T,e,n),window.removeEventListener(b,e,n),window.removeEventListener(_,e,n)}}(e,o.catchEvent.bind(o),!(!1!==o.__options.preventDefault||!d)&&{passive:!0}))}return o}return e(i,t),i.prototype.use=function(t,e){this.__pluginContexts.push(t(this,e))},i.prototype.catchEvent=function(t){var e=this.__inputCreatorMap[t.type](t);if(void 0!==e){var r=function(){return t.preventDefault()};I(t,this.__options)&&r(),this.emit("input",e),this.emit2("at:"+e.phase,e,{});var i={};this.__computeFunctionList.forEach((function(t){var n=t(e,i);if(void 0!==n)for(var r in n)i[r]=n[r]})),this.emit(f,n(n(n({},e),i),{stopPropagation:function(){return t.stopPropagation()},stopImmediatePropagation:function(){return t.stopImmediatePropagation()},preventDefault:r}))}},i.prototype.compute=function(t,e){var n,i;try{for(var o=r(t),a=o.next();!a.done;a=o.next()){var u=a.value;this.__computeFunctionCreatorList.includes(u)||(this.__computeFunctionCreatorList.push(u),this.__computeFunctionList.push(u()))}}catch(t){n={error:t}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}this.on(f,e)},i.prototype.beforeEach=function(e){var n=this;t.prototype.beforeEach.call(this,(function(t,r){var i;(null===(i=n.c)||void 0===i?void 0:i.name)?e(t,r):r()}))},i.prototype.get=function(t){return this.__pluginContexts.find((function(e){return t===e.name}))},i.prototype.set=function(t){this.__options=n(n({},this.__options),t)},i.prototype.emit2=function(t,e,r){var i=this;this.c=r,this.emit(t,n(n({},e),{type:t}),(function(){i.emit(C,n(n({},e),{name:t,__type:t}))}))},i.prototype.destroy=function(){this.emit("u"),t.prototype.destroy.call(this)},i}(i),F=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},V=function(t){return t/Math.PI*180},R=function(t,e){var n=function(t,e){var n=F(t)*F(e);if(0===n)return 0;var r=function(t,e){return t.x*e.x+t.y*e.y}(t,e)/n;return r>1&&(r=1),Math.acos(r)}(t,e);return function(t,e){return t.x*e.y-e.x*t.y}(t,e)>0&&(n*=-1),V(n)},B=function(t,e){if(0!==t||0!==e)return Math.abs(t)>=Math.abs(e)?0<t?"right":"left":0<e?l:v};function q(){var t=0,e=0;return function(n,r){var i=r.prevVecotr,o=r.startVecotr,a=r.activeVecotr;return a&&(e=Math.round(R(a,i)),t=Math.round(R(a,o))),{angle:t,deltaAngle:e}}}function G(){return function(t){var e=t.prevInput,n=0,r=0,i=0;if(void 0!==e&&(n=t.x-e.x,r=t.y-e.y,0!==n||0!==r)){var o=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));i=Math.round(V(Math.acos(Math.abs(n)/o)))}return{deltaX:n,deltaY:r,deltaXYAngle:i}}}function H(){var t,e=0,n=0,r=0,i=0,o=0;return function(a){var s=a.phase,p=a.startInput;return u===s?(e=0,n=0,r=0,i=0,o=0):c===s&&(e=Math.round(a.points[0].clientX-p.points[0].clientX),n=Math.round(a.points[0].clientY-p.points[0].clientY),r=Math.abs(e),i=Math.abs(n),o=Math.round(F({x:r,y:i})),t=B(e,n)),{displacementX:e,displacementY:n,distanceX:r,distanceY:i,distance:o,overallDirection:t}}}function U(){var t=1;return function(e,n){var r=1,i=n.prevVecotr,o=n.startVecotr,a=n.activeVecotr;return a&&(r=A(F(a)/F(i)),t=A(F(a)/F(o))),{scale:t,deltaScale:r}}}function k(){var t,e,n=0,r=0,i=0,o=0;return function(a){if(void 0!==a){e=e||a.startInput;var u=a.timestamp-e.timestamp;if(16<u){var c=a.x-e.x,s=a.y-e.y;i=Math.round(c/u*100)/100,o=Math.round(s/u*100)/100,n=Math.abs(i),r=Math.abs(o),t=B(c,s),e=a}}return{velocityX:n,velocityY:r,speedX:i,speedY:o,direction:t}}}function Z(){var t=0;return function(e){var n=e.phase;return u===n&&(t=e.pointLength),{maxPointLength:t}}}function $(t){return{x:t.points[1].clientX-t.points[0].clientX,y:t.points[1].clientY-t.points[0].clientY}}function z(){var t,e,n;return function(r){var i=r.prevInput,o=r.startMultiInput;return void 0!==o&&void 0!==i&&r.id!==o.id&&1<i.pointLength&&1<r.pointLength?(t=$(o),e=$(i),n=$(r)):n=void 0,{startVecotr:t,prevVecotr:e,activeVecotr:n}}}var J={name:"tap",pointLength:1,tapTimes:1,waitNextTapTime:300,maxDistance:2,maxDistanceFromPrevTap:9,maxPressTime:250};function K(t,e){var n,r,i,o=P(J,e),a=0;function u(){a=0,n=void 0,r=void 0}return t.compute([H,Z],(function(e){if(!O(o)){var c,s,f,v,l=e.phase,h=e.x,d=e.y;if(p===l)o.state=0,c=e.startInput,s=e.pointLength,f=e.timestamp-c.timestamp,v=e.distance,e.maxPointLength===o.pointLength&&0===s&&o.maxDistance>=v&&o.maxPressTime>f?(clearTimeout(i),function(t,e){if(void 0!==n){var r=F({x:t.x-n.x,y:t.y-n.y});return n=t,e.maxDistanceFromPrevTap>=r}return n=t,!0}({x:h,y:d},o)&&function(t){var e=performance.now();if(void 0===r)return r=e,!0;var n=e-r;return r=e,n<t}(o.waitNextTapTime)?a++:a=1,0==a%o.tapTimes?(o.state=1,t.emit2(o.name,e,o),u()):i=setTimeout((function(){o.state=2,u()}),o.waitNextTapTime)):(u(),o.state=2)}})),o}var Q={name:"pan",threshold:10,pointLength:1};function W(t,e){var n=P(Q,e);return t.compute([k,H,G],(function(e){if(w(n),!O(n)){var r,i,o,a,u,c=(r=e.pointLength,i=e.distance,o=e.direction,a=e.phase,(M(u=n.state)||n.threshold<=i)&&n.pointLength===r&&void 0!==o||M(u)&&[s,p].includes(a));if(n.state=L(c,n.state,e.phase),c){var f=n.name;t.emit2(f,e,n),t.emit2(f+E(n.state),e,n),![p,s].includes(e.phase)&&e.direction&&t.emit2(f+e.direction,e,n)}}})),n}var tt={name:"swipe",threshold:10,velocity:.3,pointLength:1};function et(t,e){var n=P(tt,e);return t.compute([H,k,Z],(function(e){if(n.state=0,!n.disabled&&function(){if(p!==e.phase)return!1;var t=e.velocityX,r=e.velocityY,i=e.distance;return e.maxPointLength===n.pointLength&&0===e.points.length&&n.threshold<i&&n.velocity<Math.max(t,r)}()){var r=n.name;n.state=1,t.emit2(r,e,n),t.emit2(r+e.direction,e,n)}})),n}var nt={name:"press",pointLength:1,maxDistance:9,minPressTime:251};function rt(t,e){var n=P(nt,e),r=0;return t.compute([H],(function(e){if(!O(n)){var i,o=e.phase,a=e.startInput,c=e.pointLength;if(u===o&&n.pointLength===c)w(n),clearTimeout(r),r=setTimeout((function(){n.state=1,t.emit2(n.name,e,n)}),n.minPressTime);else if(p===o&&1===n.state)t.emit2(""+n.name+v,e,n);else if(1!==n.state){var f=e.timestamp-a.timestamp;(!((i=e.distance)&&n.maxDistance>i)||n.minPressTime>f&&[p,s].includes(o))&&(clearTimeout(r),n.state=2)}}})),n}var it={name:"pinch",threshold:0,pointLength:2};function ot(t,e){var n=P(it,e);return t.compute([z,U],(function(e){if(w(n),!O(n)){var r=function(){var t=e.pointLength,r=e.scale,i=e.deltaScale,o=e.phase;return n.pointLength===t&&(void 0!==r&&void 0!==i&&n.threshold<Math.abs(r-1)||M(n.state))||M(n.state)&&[p,s].includes(o)}();n.state=L(r,n.state,e.phase);var i=n.name;if(r){t.emit2(i,e,n);var o=e.deltaScale;1!==o&&t.emit2(i+(1<o?"in":"out"),e,n)}var a=E(n.state);a&&t.emit2(i+a,e,n)}})),n}var at={name:"rotate",threshold:0,pointLength:2};function ut(t,e){var n=P(at,e);return t.compute([z,q],(function(e){if(!O(n)){w(n);var r,i,o,a=(r=e.pointLength,i=e.angle,o=e.phase,n.pointLength===r&&(n.threshold<Math.abs(i)||M(n.state))||M(n.state)&&[p,s].includes(o));n.state=L(a,n.state,e.phase);var u=n.name;a&&t.emit2(u,e,n);var c=E(n.state);c&&t.emit2(u+c,e,n)}})),n}var ct=window.setTimeout;function st(t){t.use(K,{name:"doubletap",tapTimes:2});var e,n=t.get("doubletap");return t.beforeEach((function(t,r){"tap"===t?(clearTimeout(e),e=ct((function(){[0,2].includes(n.state)&&r()}),300)):r()})),n}return function(t){function n(e,n){var r=t.call(this,e,n)||this;return r.use(K),r.use(W),r.use(et),r.use(rt),r.use(ot),r.use(ut),r}return e(n,t),n.version="2.0.1",n.STATE_POSSIBLE=0,n.STATE_START=4,n.STATE_MOVE=5,n.STATE_END=1,n.STATE_CANCELLED=3,n.STATE_FAILED=2,n.STATE_RECOGNIZED=1,n.tap=K,n.pan=W,n.swipe=et,n.press=rt,n.rotate=ut,n.pinch=ot,n.doubletap=st,n}(N)}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).AnyTouch=e()}(this,(function(){"use strict";var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},n.apply(this,arguments)};function r(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var i=function(){function t(){this.__map={}}return t.prototype.beforeEach=function(t){this.__interceptor=t},t.prototype.on=function(t,e){var n,i,o=Array.isArray(t)?t:[t];try{for(var a=r(o),u=a.next();!u.done;u=a.next()){var c=u.value;this.__map[c]=this.__map[c]||[];var s=this.__map[c];s&&s.push(e)}}catch(t){n={error:t}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return this},t.prototype.emit=function(t,e,n){var r=this;void 0!==this.__interceptor?this.__interceptor(t,(function(){r.__emit(t,e),n&&n()})):(this.__emit(t,e),n&&n())},t.prototype.__emit=function(t,e){var i,o,a=this.__map[t];if(Array.isArray(a)&&(null==a?void 0:a.length))try{for(var u=r(a),c=u.next();!c.done;c=u.next()){(0,c.value)(e)}}catch(t){i={error:t}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}this.event=n(n({},e),{__type:t})},t.prototype.off=function(t,e){var n=this.__map[t];if(void 0!==n)if(void 0===e)delete this.__map[t];else{var r=n.findIndex((function(t){return t===e}));n.splice(r,1)}},t.prototype.destroy=function(){this.__map={}},t}(),o=Object.prototype.toString;var a,u="start",c="move",s="cancel",p="end",f="computed",v="up",l="down",h="touch",d="touchstart",m="touchmove",y=h+p,g=h+s,_="mouseup",b="mousemove",T="mousedown",x=((a={})[4]=u,a[5]=c,a[1]=p,a[3]=s,a);function E(t){return x[t]}function L(t,e,n){var r,i,o,a,u,c,f,v={1:(r={},r[0]=(i={},i.move=4,i),r[4]=(o={},o.move=5,o[p]=1,o[s]=3,o),r[5]=(a={},a.move=5,a[p]=1,a[s]=3,a),r),0:(u={},u[4]=(c={},c.move=2,c[p]=1,c[s]=3,c),u[5]=(f={},f.start=2,f.move=2,f[p]=1,f[s]=3,f),u)}[Number(t)][e];return void 0!==v&&v[n]||0}function w(t){[1,3,2].includes(t.state)&&(t.state=0)}function M(t){return[4,5].includes(t)}function O(t){if(t.disabled)return t.state=0,!0}function P(t,e){return n(n(n({},t),e),{state:0,disabled:!1})}function A(t){return Math.round(100*t)/100}function S(){var t,e,r,i,o=0;return function(a){if(t=e,void 0!==a){var c=function(t,e){var n=t.phase,r=t.points,i=t.changedPoints,o=t.nativeEvent,a=r.length,c=u===n,f=p===n&&0===a||s===n,v=Date.now(),l=X(r)||X(i),h=l.x,d=l.y,m=o.currentTarget;return Object.assign(t,{id:e,x:h,y:d,timestamp:v,isStart:c,isEnd:f,pointLength:a,currentTarget:m,getOffset:function(t){void 0===t&&(t=m);var e=t.getBoundingClientRect();return{x:h-Math.round(e.left),y:d-Math.round(e.top)}}})}(a,o=Number.MAX_SAFE_INTEGER>o?++o:1);e=c;var f=c.isStart,v=c.pointLength;return f&&(r=c,t=void 0,i=1<v?c:void 0),n(n({},c),{prevInput:t,startMultiInput:i,startInput:r})}}}function X(t){var e=t.length;if(0<e){if(1===e){var n=t[0],r=n.clientX,i=n.clientY;return{x:Math.round(r),y:Math.round(i)}}var o=t.reduce((function(t,e){return t.x+=e.clientX,t.y+=e.clientY,t}),{x:0,y:0});return{x:Math.round(o.x/e),y:Math.round(o.y/e)}}}function Y(t,e,n,r){n.target,n.currentTarget,n.type;var i,o=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(n,["target","currentTarget","type"]);return document.createEvent?(i=document.createEvent("HTMLEvents")).initEvent(t,null==r?void 0:r.bubbles,null==r?void 0:r.cancelable):i=new Event(t,r),Object.assign(i,o,{match:function(){return n.targets&&0<n.targets.length&&n.targets.every((function(t){return i.currentTarget.contains(t)}))}}),e.dispatchEvent(i)}function I(t,e){var n,r=e.preventDefault;return n=r,"[object Function]"===o.call(n)?r(t):!!r}var D=[d,m,y,g];var j={domEvents:{bubbles:!0,cancelable:!0},preventDefault:function(t){if(t.target&&"tagName"in t.target){var e=t.target.tagName;return!/^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/.test(e)}return!1}},C="at:after",N=function(t){function i(e,r){var i,o=t.call(this)||this;o.__computeFunctionList=[],o.__computeFunctionCreatorList=[],o.__pluginContexts=[],o.el=e,o.c={},o.__options=n(n({},j),r);var a,s,f,v,l=function(t){var e=S();return function(n){var r=[],i=[];Array.from(n.touches).forEach((function(e){var n=e.clientX,o=e.clientY,a=e.target;(null==t?void 0:t.contains(a))&&(r.push(a),i.push({clientX:n,clientY:o,target:a}))}));var o=Array.from(n.changedTouches).map((function(t){return{clientX:t.clientX,clientY:t.clientY,target:t.target}}));return e({phase:n.type.replace("touch",""),changedPoints:o,points:i,nativeEvent:n,target:n.target,targets:r})}}(o.el),h=(s=!1,f=null,v=S(),function(t){var e,n=t.clientX,r=t.clientY,i=t.type,o=t.button,l=t.target,h=[{clientX:n,clientY:r,target:l}];if(T===i&&0===o)f=l,s=!0,e=u;else{if(!s)return;b===i?e=c:_===i&&(h=[],e=p,s=!1)}var d=a||[{clientX:n,clientY:r,target:l}];if(a=[{clientX:n,clientY:r,target:l}],void 0!==e)return v({phase:e,changedPoints:d,points:h,target:f,targets:[f],nativeEvent:t})});if(o.__inputCreatorMap=((i={}).touchstart=l,i.touchmove=l,i[y]=l,i[g]=l,i.mousedown=h,i.mousemove=h,i.mouseup=h,i),o.on(C,(function(t){var e=t.target,n=t.__type,r=o.__options.domEvents;r&&void 0!==o.el&&e&&(Y(n,e,t,r),Y(C,e,t,r))})),void 0!==e){e.style.webkitTapHighlightColor="rgba(0,0,0,0)";var d=!1;try{var m={};Object.defineProperty(m,"passive",{get:function(){d=!0}}),window.addEventListener("_",(function(){}),m)}catch(t){}o.on("u",function(t,e,n){return D.forEach((function(r){t.addEventListener(r,e,n)})),t.addEventListener(T,e,n),window.addEventListener(b,e,n),window.addEventListener(_,e,n),function(){D.forEach((function(n){t.removeEventListener(n,e)})),t.removeEventListener(T,e,n),window.removeEventListener(b,e,n),window.removeEventListener(_,e,n)}}(e,o.catchEvent.bind(o),!(!1!==o.__options.preventDefault||!d)&&{passive:!0}))}return o}return e(i,t),i.prototype.use=function(t,e){this.__pluginContexts.push(t(this,e))},i.prototype.catchEvent=function(t){var e=this.__inputCreatorMap[t.type](t);if(void 0!==e){var r=function(){return t.preventDefault()};I(t,this.__options)&&r(),this.emit("input",e),this.emit2("at:"+e.phase,e,{});var i={};this.__computeFunctionList.forEach((function(t){var n=t(e,i);if(void 0!==n)for(var r in n)i[r]=n[r]})),this.emit(f,n(n(n({},e),i),{stopPropagation:function(){return t.stopPropagation()},stopImmediatePropagation:function(){return t.stopImmediatePropagation()},preventDefault:r}))}},i.prototype.compute=function(t,e){var n,i;try{for(var o=r(t),a=o.next();!a.done;a=o.next()){var u=a.value;this.__computeFunctionCreatorList.includes(u)||(this.__computeFunctionCreatorList.push(u),this.__computeFunctionList.push(u()))}}catch(t){n={error:t}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}this.on(f,e)},i.prototype.beforeEach=function(e){var n=this;t.prototype.beforeEach.call(this,(function(t,r){var i;(null===(i=n.c)||void 0===i?void 0:i.name)?e(t,r):r()}))},i.prototype.get=function(t){return this.__pluginContexts.find((function(e){return t===e.name}))},i.prototype.set=function(t){this.__options=n(n({},this.__options),t)},i.prototype.emit2=function(t,e,r){var i=this;this.c=r,this.emit(t,n(n({},e),{type:t}),(function(){i.emit(C,n(n({},e),{name:t,__type:t}))}))},i.prototype.destroy=function(){this.emit("u"),t.prototype.destroy.call(this)},i}(i),F=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},V=function(t){return t/Math.PI*180},R=function(t,e){var n=function(t,e){var n=F(t)*F(e);if(0===n)return 0;var r=function(t,e){return t.x*e.x+t.y*e.y}(t,e)/n;return r>1&&(r=1),Math.acos(r)}(t,e);return function(t,e){return t.x*e.y-e.x*t.y}(t,e)>0&&(n*=-1),V(n)},B=function(t,e){if(0!==t||0!==e)return Math.abs(t)>=Math.abs(e)?0<t?"right":"left":0<e?l:v};function q(){var t=0,e=0;return function(n,r){var i=r.prevVecotr,o=r.startVecotr,a=r.activeVecotr;return a&&(e=Math.round(R(a,i)),t=Math.round(R(a,o))),{angle:t,deltaAngle:e}}}function G(){return function(t){var e=t.prevInput,n=0,r=0,i=0;if(void 0!==e&&(n=t.x-e.x,r=t.y-e.y,0!==n||0!==r)){var o=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));i=Math.round(V(Math.acos(Math.abs(n)/o)))}return{deltaX:n,deltaY:r,deltaXYAngle:i}}}function H(){var t,e=0,n=0,r=0,i=0,o=0;return function(a){var s=a.phase,p=a.startInput;return u===s?(e=0,n=0,r=0,i=0,o=0):c===s&&(e=Math.round(a.points[0].clientX-p.points[0].clientX),n=Math.round(a.points[0].clientY-p.points[0].clientY),r=Math.abs(e),i=Math.abs(n),o=Math.round(F({x:r,y:i})),t=B(e,n)),{displacementX:e,displacementY:n,distanceX:r,distanceY:i,distance:o,overallDirection:t}}}function U(){var t=1;return function(e,n){var r=1,i=n.prevVecotr,o=n.startVecotr,a=n.activeVecotr;return a&&(r=A(F(a)/F(i)),t=A(F(a)/F(o))),{scale:t,deltaScale:r}}}function k(){var t,e,n=0,r=0,i=0,o=0;return function(a){if(void 0!==a){e=e||a.startInput;var u=a.timestamp-e.timestamp;if(16<u){var c=a.x-e.x,s=a.y-e.y;i=Math.round(c/u*100)/100,o=Math.round(s/u*100)/100,n=Math.abs(i),r=Math.abs(o),t=B(c,s),e=a}}return{velocityX:n,velocityY:r,speedX:i,speedY:o,direction:t}}}function Z(){var t=0;return function(e){var n=e.phase;return u===n&&(t=e.pointLength),{maxPointLength:t}}}function $(t){return{x:t.points[1].clientX-t.points[0].clientX,y:t.points[1].clientY-t.points[0].clientY}}function z(){var t,e,n;return function(r){var i=r.prevInput,o=r.startMultiInput;return void 0!==o&&void 0!==i&&r.id!==o.id&&1<i.pointLength&&1<r.pointLength?(t=$(o),e=$(i),n=$(r)):n=void 0,{startVecotr:t,prevVecotr:e,activeVecotr:n}}}var J={name:"tap",pointLength:1,tapTimes:1,waitNextTapTime:300,maxDistance:2,maxDistanceFromPrevTap:9,maxPressTime:250};function K(t,e){var n,r,i,o=P(J,e),a=0;function u(){a=0,n=void 0,r=void 0}return t.compute([H,Z],(function(e){if(!O(o)){var c,s,f,v,l=e.phase,h=e.x,d=e.y;if(p===l)o.state=0,c=e.startInput,s=e.pointLength,f=e.timestamp-c.timestamp,v=e.distance,e.maxPointLength===o.pointLength&&0===s&&o.maxDistance>=v&&o.maxPressTime>f?(clearTimeout(i),function(t,e){if(void 0!==n){var r=F({x:t.x-n.x,y:t.y-n.y});return n=t,e.maxDistanceFromPrevTap>=r}return n=t,!0}({x:h,y:d},o)&&function(t){var e=performance.now();if(void 0===r)return r=e,!0;var n=e-r;return r=e,n<t}(o.waitNextTapTime)?a++:a=1,0==a%o.tapTimes?(o.state=1,t.emit2(o.name,e,o),u()):i=setTimeout((function(){o.state=2,u()}),o.waitNextTapTime)):(u(),o.state=2)}})),o}var Q={name:"pan",threshold:10,pointLength:1};function W(t,e){var n=P(Q,e);return t.compute([k,H,G],(function(e){if(w(n),!O(n)){var r,i,o,a,u,c=(r=e.pointLength,i=e.distance,o=e.direction,a=e.phase,(M(u=n.state)||n.threshold<=i)&&n.pointLength===r&&void 0!==o||M(u)&&[s,p].includes(a));if(n.state=L(c,n.state,e.phase),c){var f=n.name;t.emit2(f,e,n),t.emit2(f+E(n.state),e,n),![p,s].includes(e.phase)&&e.direction&&t.emit2(f+e.direction,e,n)}}})),n}var tt={name:"swipe",threshold:10,velocity:.3,pointLength:1};function et(t,e){var n=P(tt,e);return t.compute([H,k,Z],(function(e){if(n.state=0,!n.disabled&&function(){if(p!==e.phase)return!1;var t=e.velocityX,r=e.velocityY,i=e.distance;return e.maxPointLength===n.pointLength&&0===e.points.length&&n.threshold<i&&n.velocity<Math.max(t,r)}()){var r=n.name;n.state=1,t.emit2(r,e,n),t.emit2(r+e.direction,e,n)}})),n}var nt={name:"press",pointLength:1,maxDistance:9,minPressTime:251};function rt(t,e){var n=P(nt,e),r=0;return t.compute([H],(function(e){if(!O(n)){var i,o=e.phase,a=e.startInput,c=e.pointLength;if(u===o&&n.pointLength===c)w(n),clearTimeout(r),r=setTimeout((function(){n.state=1,t.emit2(n.name,e,n)}),n.minPressTime);else if(p===o&&1===n.state)t.emit2(""+n.name+v,e,n);else if(1!==n.state){var f=e.timestamp-a.timestamp;(!((i=e.distance)&&n.maxDistance>i)||n.minPressTime>f&&[p,s].includes(o))&&(clearTimeout(r),n.state=2)}}})),n}var it={name:"pinch",threshold:0,pointLength:2};function ot(t,e){var n=P(it,e);return t.compute([z,U],(function(e){if(w(n),!O(n)){var r=function(){var t=e.pointLength,r=e.scale,i=e.deltaScale,o=e.phase;return n.pointLength===t&&(void 0!==r&&void 0!==i&&n.threshold<Math.abs(r-1)||M(n.state))||M(n.state)&&[p,s].includes(o)}();n.state=L(r,n.state,e.phase);var i=n.name;if(r){t.emit2(i,e,n);var o=e.deltaScale;1!==o&&t.emit2(i+(1<o?"in":"out"),e,n)}var a=E(n.state);a&&t.emit2(i+a,e,n)}})),n}var at={name:"rotate",threshold:0,pointLength:2};function ut(t,e){var n=P(at,e);return t.compute([z,q],(function(e){if(!O(n)){w(n);var r,i,o,a=(r=e.pointLength,i=e.angle,o=e.phase,n.pointLength===r&&(n.threshold<Math.abs(i)||M(n.state))||M(n.state)&&[p,s].includes(o));n.state=L(a,n.state,e.phase);var u=n.name;a&&t.emit2(u,e,n);var c=E(n.state);c&&t.emit2(u+c,e,n)}})),n}var ct=window.setTimeout;function st(t){t.use(K,{name:"doubletap",tapTimes:2});var e,n=t.get("doubletap");return t.beforeEach((function(t,r){"tap"===t?(clearTimeout(e),e=ct((function(){[0,2].includes(n.state)&&r()}),300)):r()})),n}return function(t){function n(e,n){var r=t.call(this,e,n)||this;return r.use(K),r.use(W),r.use(et),r.use(rt),r.use(ot),r.use(ut),r}return e(n,t),n.version="2.0.2-alpha.0",n.STATE_POSSIBLE=0,n.STATE_START=4,n.STATE_MOVE=5,n.STATE_END=1,n.STATE_CANCELLED=3,n.STATE_FAILED=2,n.STATE_RECOGNIZED=1,n.tap=K,n.pan=W,n.swipe=et,n.press=rt,n.rotate=ut,n.pinch=ot,n.doubletap=st,n}(N)}));
//# sourceMappingURL=any-touch.umd.min.js.map

@@ -1,2 +0,2 @@

import{__extends as o}from"tslib";import t from"@any-touch/core";import r from"@any-touch/tap";import p from"@any-touch/pan";import a from"@any-touch/swipe";import u from"@any-touch/press";import e from"@any-touch/pinch";import i from"@any-touch/rotate";import n from"@any-touch/doubletap";var m=function(t){function m(o,n){var m=t.call(this,o,n)||this;return m.use(r),m.use(p),m.use(a),m.use(u),m.use(e),m.use(i),m}return o(m,t),m.version="2.0.1",m.STATE_POSSIBLE=0,m.STATE_START=4,m.STATE_MOVE=5,m.STATE_END=1,m.STATE_CANCELLED=3,m.STATE_FAILED=2,m.STATE_RECOGNIZED=1,m.tap=r,m.pan=p,m.swipe=a,m.press=u,m.rotate=i,m.pinch=e,m.doubletap=n,m}(t);export{m as default};
import{__extends as o}from"tslib";import t from"@any-touch/core";import r from"@any-touch/tap";import a from"@any-touch/pan";import p from"@any-touch/swipe";import u from"@any-touch/press";import e from"@any-touch/pinch";import i from"@any-touch/rotate";import n from"@any-touch/doubletap";var m=function(t){function m(o,n){var m=t.call(this,o,n)||this;return m.use(r),m.use(a),m.use(p),m.use(u),m.use(e),m.use(i),m}return o(m,t),m.version="2.0.2-alpha.0",m.STATE_POSSIBLE=0,m.STATE_START=4,m.STATE_MOVE=5,m.STATE_END=1,m.STATE_CANCELLED=3,m.STATE_FAILED=2,m.STATE_RECOGNIZED=1,m.tap=r,m.pan=a,m.swipe=p,m.press=u,m.rotate=i,m.pinch=e,m.doubletap=n,m}(t);export{m as default};
//# sourceMappingURL=index.es.js.map

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("@any-touch/core"),u=require("@any-touch/tap"),a=require("@any-touch/pan"),r=require("@any-touch/swipe"),n=require("@any-touch/press"),l=require("@any-touch/pinch"),i=require("@any-touch/rotate"),o=require("@any-touch/doubletap");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=d(t),s=d(u),c=d(a),p=d(r),T=d(n),E=d(l),h=d(i),_=d(o),y=function(t){function u(e,u){var a=t.call(this,e,u)||this;return a.use(s.default),a.use(c.default),a.use(p.default),a.use(T.default),a.use(E.default),a.use(h.default),a}return e.__extends(u,t),u.version="2.0.1",u.STATE_POSSIBLE=0,u.STATE_START=4,u.STATE_MOVE=5,u.STATE_END=1,u.STATE_CANCELLED=3,u.STATE_FAILED=2,u.STATE_RECOGNIZED=1,u.tap=s.default,u.pan=c.default,u.swipe=p.default,u.press=T.default,u.rotate=h.default,u.pinch=E.default,u.doubletap=_.default,u}(f.default);exports.default=y;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("@any-touch/core"),u=require("@any-touch/tap"),a=require("@any-touch/pan"),r=require("@any-touch/swipe"),l=require("@any-touch/press"),n=require("@any-touch/pinch"),i=require("@any-touch/rotate"),o=require("@any-touch/doubletap");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=d(t),s=d(u),c=d(a),p=d(r),T=d(l),E=d(n),h=d(i),_=d(o),y=function(t){function u(e,u){var a=t.call(this,e,u)||this;return a.use(s.default),a.use(c.default),a.use(p.default),a.use(T.default),a.use(E.default),a.use(h.default),a}return e.__extends(u,t),u.version="2.0.2-alpha.0",u.STATE_POSSIBLE=0,u.STATE_START=4,u.STATE_MOVE=5,u.STATE_END=1,u.STATE_CANCELLED=3,u.STATE_FAILED=2,u.STATE_RECOGNIZED=1,u.tap=s.default,u.pan=c.default,u.swipe=p.default,u.press=T.default,u.rotate=h.default,u.pinch=E.default,u.doubletap=_.default,u}(f.default);exports.default=y;
{
"name": "any-touch",
"version": "2.0.2-alpha.0",
"version": "2.0.2-alpha.1",
"description": "一个小巧的手势库",

@@ -25,2 +25,13 @@ "unpkg": "dist/any-touch.umd.min.js",

"dependencies": {
"@any-touch/core": "^2.0.2-alpha.1",
"@any-touch/pan": "^2.0.2-alpha.1",
"@any-touch/pinch": "^2.0.2-alpha.1",
"@any-touch/press": "^2.0.2-alpha.1",
"@any-touch/rotate": "^2.0.2-alpha.1",
"@any-touch/swipe": "^2.0.2-alpha.1",
"@any-touch/tap": "^2.0.2-alpha.1",
"any-event": "^2.0.2-alpha.1",
"tslib": "^2.3.1"
},
"peerDependencies": {
"@any-touch/core": "^2.0.2-alpha.0",

@@ -33,8 +44,4 @@ "@any-touch/pan": "^2.0.2-alpha.0",

"@any-touch/tap": "^2.0.2-alpha.0",
"any-event": "^2.0.2-alpha.0",
"tslib": "^2.3.1"
"any-event": "^2.0.2-alpha.0"
},
"peerDependencies": {
"@any-touch/core": "^2.0.1"
},
"keywords": [

@@ -46,3 +53,3 @@ "touch",

"sideEffects": false,
"gitHead": "05b7cc6e0af8a0018f7edfe0c0ac8a4843a65441"
"gitHead": "6448e271ecbc59ba49d220264ff4f5ab19950b87"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc