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KAAK,QAAQ,kBAErG,KAAK,QAAQ,WACb,KAAK,SAAS,CAAE,MAAO,EAAG,KAAM,eAG5C,EACA,EAAQ,UAAU,YAAc,SAAU,GACtC,KAAK,mBAAqB,KAC1B,KAAK,MAAO,EACZ,KAAK,SAAS,CAAE,MAAO,EAAG,KAAM,gBACpC,EACA,EAAQ,UAAU,oBAAsB,SAAU,GAC9C,KAAK,qBAAuB,KACxB,KAAK,QAAQ,SACb,KAAK,SAAS,CAAE,MAAO,EAAG,KAAM,WAExC,EACA,EAAQ,UAAU,kBAAoB,SAAU,GAC5C,OAA2B,IAAvB,KAAK,QAAQ,SAGe,IAAvB,KAAK,QAAQ,QAGA,IAAb,EAAE,QACwC,IAAxC,KAAK,QAAQ,MAAM,QAAQ,QAEhB,IAAb,EAAE,QAC0C,IAA1C,KAAK,QAAQ,MAAM,QAAQ,UAEhB,IAAb,EAAE,QACyC,IAAzC,KAAK,QAAQ,MAAM,QAAQ,cADjC,GAGT,EACA,EAAQ,UAAU,UAAY,SAAU,GAChC,KAAK,kBAAkB,MACL,IAAd,KAAK,KACL,KAAK,MAAO,EAGZ,KAAK,WAAW,EAAG,EAAE,QAAS,EAAE,SAG5C,EACA,EAAQ,UAAU,UAAY,SAAU,GACpC,GAAI,KAAK,KAAM,CACX,IAAI,EAAI,EAAE,QACN,EAAI,EAAE,QACN,KAAK,cAAc,EAAG,IACtB,KAAK,QAEb,CACJ,EACA,EAAQ,UAAU,QAAU,SAAU,GAC9B,KAAK,OACL,EAAE,iBACF,KAAK,aAAa,GAE1B,EACA,EAAQ,UAAU,WAAa,SAAU,EAAU,GAC/C,OAAO,WAAW,EAAU,EAChC,EACO,CACX,CAzLc,GA0Ld,QAAQ,QAAU","file":"/npm/clicked@4.0.3/dist/clicked.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/clicked@4.0.3/dist/clicked.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nvar __assign = (this && this.__assign) || function () {\n    __assign = Object.assign || function(t) {\n        for (var s, i = 1, n = arguments.length; i < n; i++) {\n            s = arguments[i];\n            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n                t[p] = s[p];\n        }\n        return t;\n    };\n    return __assign.apply(this, arguments);\n};\nexports.__esModule = true;\nexports.Clicked = exports.clicked = void 0;\nvar defaultOptions = {\n    threshold: 10,\n    clicked: true,\n    mouse: true,\n    touch: 1,\n    doubleClicked: false,\n    doubleClickedTime: 300,\n    longClicked: false,\n    longClickedTime: 500,\n    capture: false,\n    clickDown: false\n};\nfunction clicked(element, callback, options) {\n    return new Clicked(element, callback, options);\n}\nexports.clicked = clicked;\nvar Clicked = (function () {\n    function Clicked(element, callback, options) {\n        if (typeof element === 'string') {\n            element = document.querySelector(element);\n            if (!element) {\n                console.warn(\"Unknown element: document.querySelector(\" + element + \") in clicked()\");\n                return;\n            }\n        }\n        this.element = element;\n        this.callback = callback;\n        this.options = __assign(__assign({}, defaultOptions), options);\n        this.createListeners();\n    }\n    Clicked.prototype.createListeners = function () {\n        var _this = this;\n        this.events = {\n            mousedown: function (e) { return _this.mousedown(e); },\n            mouseup: function (e) { return _this.mouseup(e); },\n            mousemove: function (e) { return _this.mousemove(e); },\n            touchstart: function (e) { return _this.touchstart(e); },\n            touchmove: function (e) { return _this.touchmove(e); },\n            touchcancel: function () { return _this.cancel(); },\n            touchend: function (e) { return _this.touchend(e); }\n        };\n        this.element.addEventListener('mousedown', this.events.mousedown, { capture: this.options.capture });\n        this.element.addEventListener('mouseup', this.events.mouseup, { capture: this.options.capture });\n        this.element.addEventListener('mousemove', this.events.mousemove, { capture: this.options.capture });\n        this.element.addEventListener('touchstart', this.events.touchstart, { passive: true, capture: this.options.capture });\n        this.element.addEventListener('touchmove', this.events.touchmove, { passive: true, capture: this.options.capture });\n        this.element.addEventListener('touchcancel', this.events.touchcancel, { capture: this.options.capture });\n        this.element.addEventListener('touchend', this.events.touchend, { capture: this.options.capture });\n    };\n    Clicked.prototype.destroy = function () {\n        this.element.removeEventListener('mousedown', this.events.mousedown);\n        this.element.removeEventListener('mouseup', this.events.mouseup);\n        this.element.removeEventListener('mousemove', this.events.mousemove);\n        this.element.removeEventListener('touchstart', this.events.touchstart);\n        this.element.removeEventListener('touchmove', this.events.touchmove);\n        this.element.removeEventListener('touchcancel', this.events.touchcancel);\n        this.element.removeEventListener('touchend', this.events.touchend);\n    };\n    Clicked.prototype.touchstart = function (e) {\n        if (this.options.touch) {\n            if (this.down === true) {\n                this.cancel();\n            }\n            else {\n                if (this.options.touch === true || e.touches.length <= this.options.touch) {\n                    this.handleDown(e, e.changedTouches[0].screenX, e.changedTouches[0].screenY);\n                }\n            }\n        }\n    };\n    Clicked.prototype.pastThreshold = function (x, y) {\n        return Math.abs(this.lastX - x) > this.options.threshold || Math.abs(this.lastY - y) > this.options.threshold;\n    };\n    Clicked.prototype.touchmove = function (e) {\n        if (this.down) {\n            if (e.touches.length !== 1) {\n                this.cancel();\n            }\n            else {\n                var x = e.changedTouches[0].screenX;\n                var y = e.changedTouches[0].screenY;\n                if (this.pastThreshold(x, y)) {\n                    this.cancel();\n                }\n            }\n        }\n    };\n    Clicked.prototype.cancel = function () {\n        this.down = false;\n        if (this.doubleClickedTimeout) {\n            clearTimeout(this.doubleClickedTimeout);\n            this.doubleClickedTimeout = null;\n        }\n        if (this.longClickedTimeout) {\n            clearTimeout(this.longClickedTimeout);\n            this.longClickedTimeout = null;\n        }\n    };\n    Clicked.prototype.touchend = function (e) {\n        if (this.down) {\n            e.preventDefault();\n            this.handleClicks(e);\n        }\n    };\n    Clicked.prototype.handleClicks = function (e) {\n        var _this = this;\n        if (this.options.doubleClicked) {\n            this.doubleClickedTimeout = this.setTimeout(function () { return _this.doubleClickedCancel(e); }, this.options.doubleClickedTime);\n        }\n        else if (this.options.clicked) {\n            this.callback({ event: e, type: 'clicked' });\n        }\n        if (this.longClickedTimeout) {\n            clearTimeout(this.longClickedTimeout);\n            this.longClickedTimeout = null;\n        }\n        this.down = false;\n    };\n    Clicked.prototype.handleDown = function (e, x, y) {\n        var _this = this;\n        if (this.doubleClickedTimeout) {\n            if (this.pastThreshold(x, y)) {\n                if (this.options.clicked) {\n                    this.callback({ event: e, type: 'clicked' });\n                }\n                this.cancel();\n            }\n            else {\n                this.callback({ event: e, type: 'double-clicked' });\n                this.cancel();\n            }\n        }\n        else {\n            this.lastX = x;\n            this.lastY = y;\n            this.down = true;\n            if (this.options.longClicked) {\n                this.longClickedTimeout = this.setTimeout(function () { return _this.longClicked(e); }, this.options.longClickedTime);\n            }\n            if (this.options.clickDown) {\n                this.callback({ event: e, type: 'click-down' });\n            }\n        }\n    };\n    Clicked.prototype.longClicked = function (e) {\n        this.longClickedTimeout = null;\n        this.down = false;\n        this.callback({ event: e, type: 'long-clicked' });\n    };\n    Clicked.prototype.doubleClickedCancel = function (e) {\n        this.doubleClickedTimeout = null;\n        if (this.options.clicked) {\n            this.callback({ event: e, type: 'clicked' });\n        }\n    };\n    Clicked.prototype.checkMouseButtons = function (e) {\n        if (this.options.mouse === false) {\n            return false;\n        }\n        else if (this.options.mouse === true) {\n            return true;\n        }\n        else if (e.button === 0) {\n            return this.options.mouse.indexOf('left') !== -1;\n        }\n        else if (e.button === 1) {\n            return this.options.mouse.indexOf('middle') !== -1;\n        }\n        else if (e.button === 2) {\n            return this.options.mouse.indexOf('right') !== -1;\n        }\n    };\n    Clicked.prototype.mousedown = function (e) {\n        if (this.checkMouseButtons(e)) {\n            if (this.down === true) {\n                this.down = false;\n            }\n            else {\n                this.handleDown(e, e.screenX, e.screenY);\n            }\n        }\n    };\n    Clicked.prototype.mousemove = function (e) {\n        if (this.down) {\n            var x = e.screenX;\n            var y = e.screenY;\n            if (this.pastThreshold(x, y)) {\n                this.cancel();\n            }\n        }\n    };\n    Clicked.prototype.mouseup = function (e) {\n        if (this.down) {\n            e.preventDefault();\n            this.handleClicks(e);\n        }\n    };\n    Clicked.prototype.setTimeout = function (callback, time) {\n        return setTimeout(callback, time);\n    };\n    return Clicked;\n}());\nexports.Clicked = Clicked;\n"]}