text: !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.rexswipe=e():t.rexswipe=e()}(window,function(){return function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=166)}({0:function(t,e){t.exports=function(t,e,i){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return t[e];if(-1!==e.indexOf(".")){for(var n=e.split("."),r=t,o=i,s=0;s<n.length;s++){if(!r.hasOwnProperty(n[s])){o=i;break}o=r[n[s]],r=r[n[s]]}return o}return i}return i}},1:function(t,e,i){"use strict";e.a={setEventEmitter:function(t,e){return void 0===e&&(e=Phaser.Events.EventEmitter),this._privateEE=void 0===t,this._eventEmitter=this._privateEE?new e:t,this},destroyEventEmitter:function(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter:function(){return this._eventEmitter},on:function(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once:function(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off:function(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit:function(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener:function(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener:function(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners:function(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount:function(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners:function(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]}}},102:function(t,e,i){"use strict";e.a={"up&down":0,"left&right":1,"4dir":2,"8dir":3}},103:function(t,e,i){"use strict";var n={};e.a=function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=n),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}return i}},131:function(t,e,i){"use strict";var n=i(51),r=i(16),o=Phaser.Math.Distance.Between,s=Phaser.Math.Angle.Between,a={getDt:function(){return this.scene.sys.game.loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return o(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return s(e.x,e.y,t.x,t.y)}},u=i(102),c=i(103);function h(t){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function p(t,e,i){return(p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=v(t)););return t}(t,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(i):r.value}})(t,e,i||t)}function v(t){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function d(t,e){return(d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var y=Phaser.Utils.Objects.GetValue,g=Phaser.Math.RadToDeg,b=function(t){function e(t,i){var n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=l(n=function(t,e){return!e||"object"!==h(e)&&"function"!=typeof e?l(t):e}(this,v(e).call(this,t,i))),s={states:{IDLE:{},BEGIN:{enter:function(){o.validDrag=!1}},RECOGNIZED:{enter:function(){o.start(),o.updateDirectionStates(),o.emit("swipe",o,o.gameObject,o.lastPointer)},exit:function(){o.stop(),o.clearDirectionStates()}}},init:function(){this.state=m},eventEmitter:!1};return n.setRecongizedStateObject(new r.a(s)),n.clearDirectionStates(),n}var i,o,s;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&d(t,e)}(e,n["a"]),i=e,(o=[{key:"resetFromJSON",value:function(t){return p(v(e.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(y(t,"threshold",10)),this.setMinDragVelocity(y(t,"velocityThreshold",1e3)),this.setDirectionMode(y(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=k}},{key:"onDragEnd",value:function(){this.state=m}},{key:"onDrag",value:function(){this.state===k&&(this.vaildDrag||(this.vaildDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.vaildDrag&&this.dragVelocity>this.minDragVelocity&&(this.state=_))}},{key:"postUpdate",value:function(t,e){this.state===_&&(this.state=m)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setMinDragVelocity",value:function(t){return this.minDragVelocity=t,this}},{key:"setDirectionMode",value:function(t){return"string"==typeof t&&(t=u.a[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){var t=g(this.getVelocityAngle());return Object(c.a)(t,this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}},{key:"isSwiped",get:function(){return this.state===_}},{key:"dragVelocity",get:function(){var t;switch(this.dirMode){case 0:t=this.getVelocityX();break;case 1:t=this.getVelocityY();break;default:t=this.getVelocity()}return t}}])&&f(i.prototype,o),s&&f(i,s),e}();Object.assign(b.prototype,a);var m="IDLE",k="BEGIN",_="RECOGNIZED";e.a=b},16:function(t,e,i){"use strict";var n=i(1),r=i(0),o=i.n(r);function s(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var a=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var i=o()(e,"states",void 0);i&&this.addStates(i);var n=o()(e,"extend",void 0);if(n)for(var r in n)this.hasOwnProperty(r)&&void 0!==this[r]||(this[r]=n[r]);var s=o()(e,"eventEmitter",void 0),a=o()(e,"EventEmitterClass",void 0);this.setEventEmitter(s,a),this._stateLock=!1,this.resetFromJSON(e)}var e,i,n;return e=t,(i=[{key:"shutdown",value:function(){this.destroyEventEmitter()}},{key:"destroy",value:function(){this.shutdown()}},{key:"resetFromJSON",value:function(t){this.setEnable(o()(t,"enable",!0)),this.start(o()(t,"start",void 0));var e=o()(t,"init",void 0);return e&&e.call(this),this}},{key:"toJSON",value:function(){return{curState:this.state,prevState:this.prevState,enable:this.enable,start:this._start}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"start",value:function(t){return this._start=t,this._prevState=void 0,this._state=t,this}},{key:"goto",value:function(t){return null!=t&&(this.state=t),this}},{key:"next",value:function(){var t,e=this["next_"+this.state];return e&&(t="string"==typeof e?e:e.call(this)),this.goto(t),this}},{key:"addState",value:function(t,e){var i=o()(e,"next",void 0);i&&(this["next_"+t]=i);var n=o()(e,"exit",void 0);n&&(this["exit_"+t]=n);var r=o()(e,"enter",void 0);return r&&(this["enter_"+t]=r),this}},{key:"addStates",value:function(t){for(var e in t)this.addState(e,t[e]);return this}},{key:"update",value:function(t,e,i){void 0===i&&(i="update");var n=this[i+"_"+this.state];n&&n.call(this,t,e)}},{key:"preupdate",value:function(t,e){this.update(t,e,"preupdate")}},{key:"postupdate",value:function(t,e){this.update(t,e,"postupdate")}},{key:"state",set:function(t){if(this.enable&&!this._stateLock&&this._state!==t){if(this._prevState=this._state,this._state=t,this._stateLock=!0,this.emit("statechange",this),null!=this._prevState){var e="exit_"+this._prevState,i=this[e];i&&i.call(this),this.emit(e,this)}if(this._stateLock=!1,null!=this._state){var n="enter_"+this._state,r=this[n];r&&r.call(this),this.emit(n,this)}}},get:function(){return this._state}},{key:"prevState",get:function(){return this._prevState}}])&&s(e.prototype,i),n&&s(e,n),t}();Object.assign(a.prototype,n.a);var u=a;e.a=u},166:function(t,e,i){"use strict";i.r(e);var n=i(131);e.default=n.a},17:function(t,e,i){"use strict";var n=i(1);function r(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var o=Phaser.Utils.Objects.GetValue,s=function(){function t(e,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.parent=e,this._isRunning=!1,this.tickingState=!1,this.setEventEmitter(o(i,"eventEmitter",void 0)),this.setTickingMode(o(i,"tickingMode",1))}var e,i,n;return e=t,(i=[{key:"boot",value:function(){2!==this.tickingMode||this.tickingState||this.startTicking()}},{key:"shutdown",value:function(){this.destroyEventEmitter(),this.tickingState&&this.stopTicking()}},{key:"setTickingMode",value:function(t){"string"==typeof t&&(t=a[t]),this.tickingMode=t}},{key:"startTicking",value:function(){this.tickingState=!0}},{key:"stopTicking",value:function(){this.tickingState=!1}},{key:"start",value:function(){return this.isRunning=!0,this}},{key:"pause",value:function(){return this.isRunning=!1,this}},{key:"resume",value:function(){return this.isRunning=!0,this}},{key:"stop",value:function(){return this.isRunning=!1,this}},{key:"complete",value:function(){this.isRunning=!1,this.emit("complete",this.parent,this)}},{key:"isRunning",get:function(){return this._isRunning},set:function(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()))}}])&&r(e.prototype,i),n&&r(e,n),t}();Object.assign(s.prototype,n.a);var a={no:0,lazy:1,always:2};e.a=s},2:function(t,e,i){"use strict";var n=Phaser.Scene;e.a=function(t){return t instanceof n}},3:function(t,e,i){"use strict";var n=i(2);e.a=function(t){return Object(n.a)(t)?t:t.scene&&Object(n.a)(t.scene)?t.scene:t.parent&&t.parent.scene&&Object(n.a)(t.parent.scene)?t.parent.scene:void 0}},51:function(t,e,i){"use strict";var n=i(17),r=i(3);function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function a(t,e){return!e||"object"!==o(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function u(t,e,i){return(u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=c(t)););return t}(t,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(i):r.value}})(t,e,i||t)}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function h(t,e){return(h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var f=Phaser.Utils.Objects.GetValue,l=function(t){function e(t,i){var n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=Object(r.a)(t);return o===t&&(t=void 0),(n=a(this,c(e).call(this,o,i))).scene=o,n.gameObject=t,t&&t.setInteractive(f(i,"inputConfig",void 0)),n.resetFromJSON(i),n.boot(),n}var i,o,l;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&h(t,e)}(e,n["a"]),i=e,(o=[{key:"resetFromJSON",value:function(t){return this.setEnable(f(t,"enable",!0)),void 0===this.gameObject?this.bounds=f(t,"bounds",void 0):this.bounds=void 0,this.tracerState=p,this.pointer=void 0,this.lastPointer=void 0,this.movedState=!1,this.isTouchingAnyObject=!1,this}},{key:"boot",value:function(){u(c(e.prototype),"boot",this).call(this),this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.events.once("shutdown",this.destroy,this)}},{key:"shutdown",value:function(){this.gameObject?this.gameObject.off("pointerdown",this.onPointerDown,this):this.scene&&this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene&&(this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.events.off("destroy",this.destroy,this),this.scene=void 0),this.scene=void 0,this.gameObject=void 0,this.bounds=void 0,this.pointer=void 0,this.lastPointer=void 0,this.movedState=!1,u(c(e.prototype),"shutdown",this).call(this)}},{key:"destroy",value:function(){this.shutdown()}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable===t?this:(t||this.dragCancel(),this.enable=t,this)}},{key:"onPointerDown",value:function(t,e){this.enable&&(void 0===this.pointer&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer!==t&&(this.pointer=t,this.lastPointer=t,this.movedState=!1,this.tracerState=v,void 0===this.gameObject&&(this.isTouchingAnyObject=e.length>0),this.onDragStart()))}},{key:"onPointerUp",value:function(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.movedState=!1,this.tracerState=p,this.onDragEnd()))}},{key:"onPointerMove",value:function(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}},{key:"dragCancel",value:function(){return this.tracerState===v&&this.onDragEnd(),this.pointer=void 0,this.tracerState=p,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this)}},{key:"onDragEnd",value:function(){this.emit("dragend",this)}},{key:"onDrag",value:function(){this.emit("drag",this)}},{key:"preUpdate",value:function(t,e){}},{key:"postUpdate",value:function(t,e){}},{key:"startTicking",value:function(){u(c(e.prototype),"startTicking",this).call(this),this.scene.events.on("preupdate",this.preUpdate,this),this.scene.events.on("postupdate",this.postUpdate,this)}},{key:"stopTicking",value:function(){u(c(e.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.events.off("preupdate",this.preUpdate,this),this.scene.events.off("postupdate",this.postUpdate,this))}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"cancel",value:function(){return this.state=d,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t}}])&&s(i.prototype,o),l&&s(i,l),e}(),p=0,v=1,d="IDLE";e.a=l}}).default});