text: (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.rexswipe = factory());
  })(this, (function () { 'use strict';
  
    function _typeof(obj) {
      "@babel/helpers - typeof";
  
      return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
        return typeof obj;
      } : function (obj) {
        return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
      }, _typeof(obj);
    }
  
    function _classCallCheck(instance, Constructor) {
      if (!(instance instanceof Constructor)) {
        throw new TypeError("Cannot call a class as a function");
      }
    }
  
    function _defineProperties(target, props) {
      for (var i = 0; i < props.length; i++) {
        var descriptor = props[i];
        descriptor.enumerable = descriptor.enumerable || false;
        descriptor.configurable = true;
        if ("value" in descriptor) descriptor.writable = true;
        Object.defineProperty(target, descriptor.key, descriptor);
      }
    }
  
    function _createClass(Constructor, protoProps, staticProps) {
      if (protoProps) _defineProperties(Constructor.prototype, protoProps);
      if (staticProps) _defineProperties(Constructor, staticProps);
      Object.defineProperty(Constructor, "prototype", {
        writable: false
      });
      return Constructor;
    }
  
    function _inherits(subClass, superClass) {
      if (typeof superClass !== "function" && superClass !== null) {
        throw new TypeError("Super expression must either be null or a function");
      }
  
      subClass.prototype = Object.create(superClass && superClass.prototype, {
        constructor: {
          value: subClass,
          writable: true,
          configurable: true
        }
      });
      Object.defineProperty(subClass, "prototype", {
        writable: false
      });
      if (superClass) _setPrototypeOf(subClass, superClass);
    }
  
    function _getPrototypeOf(o) {
      _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
        return o.__proto__ || Object.getPrototypeOf(o);
      };
      return _getPrototypeOf(o);
    }
  
    function _setPrototypeOf(o, p) {
      _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
        o.__proto__ = p;
        return o;
      };
      return _setPrototypeOf(o, p);
    }
  
    function _isNativeReflectConstruct() {
      if (typeof Reflect === "undefined" || !Reflect.construct) return false;
      if (Reflect.construct.sham) return false;
      if (typeof Proxy === "function") return true;
  
      try {
        Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
        return true;
      } catch (e) {
        return false;
      }
    }
  
    function _assertThisInitialized(self) {
      if (self === void 0) {
        throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
      }
  
      return self;
    }
  
    function _possibleConstructorReturn(self, call) {
      if (call && (typeof call === "object" || typeof call === "function")) {
        return call;
      } else if (call !== void 0) {
        throw new TypeError("Derived constructors may only return object or undefined");
      }
  
      return _assertThisInitialized(self);
    }
  
    function _createSuper(Derived) {
      var hasNativeReflectConstruct = _isNativeReflectConstruct();
  
      return function _createSuperInternal() {
        var Super = _getPrototypeOf(Derived),
            result;
  
        if (hasNativeReflectConstruct) {
          var NewTarget = _getPrototypeOf(this).constructor;
  
          result = Reflect.construct(Super, arguments, NewTarget);
        } else {
          result = Super.apply(this, arguments);
        }
  
        return _possibleConstructorReturn(this, result);
      };
    }
  
    function _superPropBase(object, property) {
      while (!Object.prototype.hasOwnProperty.call(object, property)) {
        object = _getPrototypeOf(object);
        if (object === null) break;
      }
  
      return object;
    }
  
    function _get() {
      if (typeof Reflect !== "undefined" && Reflect.get) {
        _get = Reflect.get.bind();
      } else {
        _get = function _get(target, property, receiver) {
          var base = _superPropBase(target, property);
  
          if (!base) return;
          var desc = Object.getOwnPropertyDescriptor(base, property);
  
          if (desc.get) {
            return desc.get.call(arguments.length < 3 ? target : receiver);
          }
  
          return desc.value;
        };
      }
  
      return _get.apply(this, arguments);
    }
  
    var EventEmitterMethods = {
      setEventEmitter: function setEventEmitter(eventEmitter, EventEmitterClass) {
        if (EventEmitterClass === undefined) {
          EventEmitterClass = Phaser.Events.EventEmitter; // Use built-in EventEmitter class by default
        }
  
        this._privateEE = eventEmitter === true || eventEmitter === undefined;
        this._eventEmitter = this._privateEE ? new EventEmitterClass() : eventEmitter;
        return this;
      },
      destroyEventEmitter: function destroyEventEmitter() {
        if (this._eventEmitter && this._privateEE) {
          this._eventEmitter.shutdown();
        }
  
        return this;
      },
      getEventEmitter: function getEventEmitter() {
        return this._eventEmitter;
      },
      on: function on() {
        if (this._eventEmitter) {
          this._eventEmitter.on.apply(this._eventEmitter, arguments);
        }
  
        return this;
      },
      once: function once() {
        if (this._eventEmitter) {
          this._eventEmitter.once.apply(this._eventEmitter, arguments);
        }
  
        return this;
      },
      off: function off() {
        if (this._eventEmitter) {
          this._eventEmitter.off.apply(this._eventEmitter, arguments);
        }
  
        return this;
      },
      emit: function emit(event) {
        if (this._eventEmitter && event) {
          this._eventEmitter.emit.apply(this._eventEmitter, arguments);
        }
  
        return this;
      },
      addListener: function addListener() {
        if (this._eventEmitter) {
          this._eventEmitter.addListener.apply(this._eventEmitter, arguments);
        }
  
        return this;
      },
      removeListener: function removeListener() {
        if (this._eventEmitter) {
          this._eventEmitter.removeListener.apply(this._eventEmitter, arguments);
        }
  
        return this;
      },
      removeAllListeners: function removeAllListeners() {
        if (this._eventEmitter) {
          this._eventEmitter.removeAllListeners.apply(this._eventEmitter, arguments);
        }
  
        return this;
      },
      listenerCount: function listenerCount() {
        if (this._eventEmitter) {
          return this._eventEmitter.listenerCount.apply(this._eventEmitter, arguments);
        }
  
        return 0;
      },
      listeners: function listeners() {
        if (this._eventEmitter) {
          return this._eventEmitter.listeners.apply(this._eventEmitter, arguments);
        }
  
        return [];
      },
      eventNames: function eventNames() {
        if (this._eventEmitter) {
          return this._eventEmitter.eventNames.apply(this._eventEmitter, arguments);
        }
  
        return [];
      }
    };
  
    var SceneClass = Phaser.Scene;
  
    var IsSceneObject = function IsSceneObject(object) {
      return object instanceof SceneClass;
    };
  
    var GetSceneObject = function GetSceneObject(object) {
      if (object == null || _typeof(object) !== 'object') {
        return null;
      } else if (IsSceneObject(object)) {
        // object = scene
        return object;
      } else if (object.scene && IsSceneObject(object.scene)) {
        // object = game object
        return object.scene;
      } else if (object.parent && object.parent.scene && IsSceneObject(object.parent.scene)) {
        // parent = bob object
        return object.parent.scene;
      }
    };
  
    var GetValue$6 = Phaser.Utils.Objects.GetValue;
  
    var ComponentBase = /*#__PURE__*/function () {
      function ComponentBase(parent, config) {
        _classCallCheck(this, ComponentBase);
  
        this.parent = parent; // gameObject or scene
  
        this.scene = GetSceneObject(parent);
        this.isShutdown = false; // Event emitter, default is private event emitter
  
        this.setEventEmitter(GetValue$6(config, 'eventEmitter', true)); // Register callback of parent destroy event, also see `shutdown` method
  
        if (this.parent && this.parent === this.scene) {
          // parent is a scene
          this.scene.sys.events.once('shutdown', this.onSceneDestroy, this);
        } else if (this.parent && this.parent.once) {
          // bob object does not have event emitter
          this.parent.once('destroy', this.onParentDestroy, this);
        }
      }
  
      _createClass(ComponentBase, [{
        key: "shutdown",
        value: function shutdown(fromScene) {
          // Already shutdown
          if (this.isShutdown) {
            return;
          } // parent might not be shutdown yet
  
  
          if (this.parent && this.parent === this.scene) {
            // parent is a scene
            this.scene.sys.events.off('shutdown', this.onSceneDestroy, this);
          } else if (this.parent && this.parent.once) {
            // bob object does not have event emitter
            this.parent.off('destroy', this.onParentDestroy, this);
          }
  
          this.destroyEventEmitter();
          this.parent = undefined;
          this.scene = undefined;
          this.isShutdown = true;
        }
      }, {
        key: "destroy",
        value: function destroy(fromScene) {
          this.shutdown(fromScene);
        }
      }, {
        key: "onSceneDestroy",
        value: function onSceneDestroy() {
          this.destroy(true);
        }
      }, {
        key: "onParentDestroy",
        value: function onParentDestroy(parent, fromScene) {
          this.destroy(fromScene);
        }
      }]);
  
      return ComponentBase;
    }();
    Object.assign(ComponentBase.prototype, EventEmitterMethods);
  
    var GetValue$5 = Phaser.Utils.Objects.GetValue;
  
    var TickTask = /*#__PURE__*/function (_ComponentBase) {
      _inherits(TickTask, _ComponentBase);
  
      var _super = _createSuper(TickTask);
  
      function TickTask(parent, config) {
        var _this;
  
        _classCallCheck(this, TickTask);
  
        _this = _super.call(this, parent, config);
        _this._isRunning = false;
        _this.isPaused = false;
        _this.tickingState = false;
  
        _this.setTickingMode(GetValue$5(config, 'tickingMode', 1)); // boot() later
  
  
        return _this;
      } // override
  
  
      _createClass(TickTask, [{
        key: "boot",
        value: function boot() {
          if (this.tickingMode === 2 && !this.tickingState) {
            this.startTicking();
          }
        } // override
  
      }, {
        key: "shutdown",
        value: function shutdown(fromScene) {
          // Already shutdown
          if (this.isShutdown) {
            return;
          }
  
          this.stop();
  
          if (this.tickingState) {
            this.stopTicking();
          }
  
          _get(_getPrototypeOf(TickTask.prototype), "shutdown", this).call(this, fromScene);
        }
      }, {
        key: "setTickingMode",
        value: function setTickingMode(mode) {
          if (typeof mode === 'string') {
            mode = TICKINGMODE[mode];
          }
  
          this.tickingMode = mode;
        } // override
  
      }, {
        key: "startTicking",
        value: function startTicking() {
          this.tickingState = true;
        } // override
  
      }, {
        key: "stopTicking",
        value: function stopTicking() {
          this.tickingState = false;
        }
      }, {
        key: "isRunning",
        get: function get() {
          return this._isRunning;
        },
        set: function set(value) {
          if (this._isRunning === value) {
            return;
          }
  
          this._isRunning = value;
  
          if (this.tickingMode === 1 && value != this.tickingState) {
            if (value) {
              this.startTicking();
            } else {
              this.stopTicking();
            }
          }
        }
      }, {
        key: "start",
        value: function start() {
          this.isPaused = false;
          this.isRunning = true;
          return this;
        }
      }, {
        key: "pause",
        value: function pause() {
          // Only can ba paused in running state
          if (this.isRunning) {
            this.isPaused = true;
            this.isRunning = false;
          }
  
          return this;
        }
      }, {
        key: "resume",
        value: function resume() {
          // Only can ba resumed in paused state (paused from running state)
          if (this.isPaused) {
            this.isRunning = true;
          }
  
          return this;
        }
      }, {
        key: "stop",
        value: function stop() {
          this.isPaused = false;
          this.isRunning = false;
          return this;
        }
      }, {
        key: "complete",
        value: function complete() {
          this.isPaused = false;
          this.isRunning = false;
          this.emit('complete', this.parent, this);
        }
      }]);
  
      return TickTask;
    }(ComponentBase);
  
    var TICKINGMODE = {
      'no': 0,
      'lazy': 1,
      'always': 2
    };
  
    var GetValue$4 = Phaser.Utils.Objects.GetValue;
  
    var OnePointerTracer = /*#__PURE__*/function (_TickTask) {
      _inherits(OnePointerTracer, _TickTask);
  
      var _super = _createSuper(OnePointerTracer);
  
      function OnePointerTracer(gameObject, config) {
        var _this;
  
        _classCallCheck(this, OnePointerTracer);
  
        var scene = GetSceneObject(gameObject);
  
        if (scene === gameObject) {
          gameObject = undefined;
        }
  
        _this = _super.call(this, scene, config);
        _this.gameObject = gameObject;
  
        if (gameObject) {
          gameObject.setInteractive(GetValue$4(config, "inputConfig", undefined));
        }
  
        _this._enable = undefined;
  
        _this.resetFromJSON(config);
  
        _this.boot();
  
        return _this;
      }
  
      _createClass(OnePointerTracer, [{
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          this.setEnable(GetValue$4(o, 'enable', true));
          this.setDetectBounds();
  
          if (this.gameObject === undefined) {
            this.setDetectBounds(GetValue$4(o, 'bounds', undefined));
          } else {
            this.setDetectBounds();
          }
  
          this.tracerState = TOUCH0$1; // this.recongizedState = new stateClass(this);
  
          this.pointer = undefined;
          this.lastPointer = undefined; // Last catched pointer
  
          this.movedState = false;
          this.isTouchingAnyObject = false;
          return this;
        }
      }, {
        key: "boot",
        value: function boot() {
          _get(_getPrototypeOf(OnePointerTracer.prototype), "boot", this).call(this);
  
          if (this.gameObject) {
            this.gameObject.on('pointerdown', this.onPointerDown, this);
          } else {
            this.scene.input.on('pointerdown', this.onPointerDown, this);
          }
  
          this.scene.input.on('pointerup', this.onPointerUp, this);
          this.scene.input.on('gameout', this.dragCancel, this);
          this.scene.input.on('pointermove', this.onPointerMove, this);
          this.scene.sys.events.once('shutdown', this.destroy, this);
        }
      }, {
        key: "shutdown",
        value: function shutdown(fromScene) {
          if (!this.scene) {
            return;
          }
  
          if (this.gameObject) ; else {
            this.scene.input.off('pointerdown', this.onPointerDown, this);
          }
  
          this.scene.input.off('pointerup', this.onPointerUp, this);
          this.scene.input.off('gameout', this.dragCancel, this);
          this.scene.input.off('pointermove', this.onPointerMove, this);
          this.scene.sys.events.off('shutdown', this.destroy, this);
          this.gameObject = undefined;
          this.bounds = undefined;
          this.pointer = undefined;
          this.lastPointer = undefined; // Last catched pointer
  
          this.movedState = false;
  
          _get(_getPrototypeOf(OnePointerTracer.prototype), "shutdown", this).call(this, fromScene);
        }
      }, {
        key: "enable",
        get: function get() {
          return this._enable;
        },
        set: function set(e) {
          if (this._enable === e) {
            return;
          }
  
          if (!e) {
            this.dragCancel();
          }
  
          this._enable = e;
          return this;
        }
      }, {
        key: "setEnable",
        value: function setEnable(e) {
          if (e === undefined) {
            e = true;
          }
  
          this.enable = e;
          return this;
        }
      }, {
        key: "setDetectBounds",
        value: function setDetectBounds(bounds) {
          this.bounds = bounds;
          return this;
        }
      }, {
        key: "toggleEnable",
        value: function toggleEnable() {
          this.setEnable(!this.enable);
          return this;
        }
      }, {
        key: "onPointerDown",
        value: function onPointerDown(pointer, gameObjects) {
          if (!this.enable) {
            return;
          }
  
          if (this.pointer !== undefined) {
            return;
          }
  
          var isInsideBounds = this.bounds ? this.bounds.contains(pointer.x, pointer.y) : true;
  
          if (!isInsideBounds) {
            return;
          }
  
          if (this.pointer === pointer) {
            return;
          }
  
          this.pointer = pointer;
          this.lastPointer = pointer;
          this.movedState = false;
          this.tracerState = TOUCH1$1;
  
          if (this.gameObject === undefined) {
            this.isTouchingAnyObject = gameObjects.length > 0;
          }
  
          this.onDragStart();
        }
      }, {
        key: "onPointerUp",
        value: function onPointerUp(pointer) {
          if (!this.enable) {
            return;
          }
  
          var isInsideBounds = this.bounds ? this.bounds.contains(pointer.x, pointer.y) : true;
  
          if (!isInsideBounds) {
            return;
          }
  
          if (this.pointer !== pointer) {
            return;
          }
  
          this.pointer = undefined;
          this.movedState = false;
          this.tracerState = TOUCH0$1;
          this.onDragEnd();
        }
      }, {
        key: "onPointerMove",
        value: function onPointerMove(pointer) {
          if (!this.enable) {
            return;
          }
  
          if (pointer.isDown) {
            var isInsideBounds = this.bounds ? this.bounds.contains(pointer.x, pointer.y) : true;
            var isCatchedPointer = this.pointer === pointer;
  
            if (!isCatchedPointer && isInsideBounds) ; else if (isCatchedPointer && !isInsideBounds) {
              // Pointer moves out of bounds
              this.onPointerUp(pointer);
            } else {
              // Pointer drags in bounds
              if (!this.movedState) {
                this.movedState = pointer.x !== pointer.downX || pointer.y !== pointer.downY;
              }
  
              if (this.movedState) {
                this.onDrag();
              }
            }
          }
        }
      }, {
        key: "dragCancel",
        value: function dragCancel() {
          if (this.tracerState === TOUCH1$1) {
            this.onDragEnd();
          }
  
          this.pointer = undefined;
          this.tracerState = TOUCH0$1;
          return this;
        }
      }, {
        key: "onDragStart",
        value: function onDragStart() {
          this.emit('dragstart', this);
        }
      }, {
        key: "onDragEnd",
        value: function onDragEnd() {
          this.emit('dragend', this);
        }
      }, {
        key: "onDrag",
        value: function onDrag() {
          this.emit('drag', this);
        } // onLastPointerMove() { }
  
      }, {
        key: "preUpdate",
        value: function preUpdate(time, delta) {}
      }, {
        key: "postUpdate",
        value: function postUpdate(time, delta) {}
      }, {
        key: "startTicking",
        value: function startTicking() {
          _get(_getPrototypeOf(OnePointerTracer.prototype), "startTicking", this).call(this);
  
          this.scene.sys.events.on('preupdate', this.preUpdate, this);
          this.scene.sys.events.on('postupdate', this.postUpdate, this);
        }
      }, {
        key: "stopTicking",
        value: function stopTicking() {
          _get(_getPrototypeOf(OnePointerTracer.prototype), "stopTicking", this).call(this);
  
          if (this.scene) {
            // Scene might be destoryed
            this.scene.sys.events.off('preupdate', this.preUpdate, this);
            this.scene.sys.events.off('postupdate', this.postUpdate, this);
          }
        }
      }, {
        key: "setRecongizedStateObject",
        value: function setRecongizedStateObject(stateObject) {
          this.recongizedState = stateObject;
          return this;
        }
      }, {
        key: "state",
        get: function get() {
          return this.recongizedState.state;
        },
        set: function set(newState) {
          this.recongizedState.state = newState;
        }
      }, {
        key: "cancel",
        value: function cancel() {
          this.state = IDLE$3;
          return this;
        }
      }]);
  
      return OnePointerTracer;
    }(TickTask);
  
    var TOUCH0$1 = 0;
    var TOUCH1$1 = 1;
    var IDLE$3 = 'IDLE';
  
    /**
     * @author       Richard Davey <rich@photonstorm.com>
     * @copyright    2019 Photon Storm Ltd.
     * @license      {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
     */
    //  Source object
    //  The key as a string, or an array of keys, i.e. 'banner', or 'banner.hideBanner'
    //  The default value to use if the key doesn't exist
  
    /**
     * Retrieves a value from an object.
     *
     * @function Phaser.Utils.Objects.GetValue
     * @since 3.0.0
     *
     * @param {object} source - The object to retrieve the value from.
     * @param {string} key - The name of the property to retrieve from the object. If a property is nested, the names of its preceding properties should be separated by a dot (`.`) - `banner.hideBanner` would return the value of the `hideBanner` property from the object stored in the `banner` property of the `source` object.
     * @param {*} defaultValue - The value to return if the `key` isn't found in the `source` object.
     *
     * @return {*} The value of the requested key.
     */
    var GetValue$3 = function GetValue(source, key, defaultValue) {
      if (!source || typeof source === 'number') {
        return defaultValue;
      } else if (source.hasOwnProperty(key)) {
        return source[key];
      } else if (key.indexOf('.') !== -1) {
        var keys = key.split('.');
        var parent = source;
        var value = defaultValue; //  Use for loop here so we can break early
  
        for (var i = 0; i < keys.length; i++) {
          if (parent.hasOwnProperty(keys[i])) {
            //  Yes it has a key property, let's carry on down
            value = parent[keys[i]];
            parent = parent[keys[i]];
          } else {
            //  Can't go any further, so reset to default
            value = defaultValue;
            break;
          }
        }
  
        return value;
      } else {
        return defaultValue;
      }
    };
  
    var FSM = /*#__PURE__*/function () {
      /*
      var config = {
          start: 'A',   // default: undefined
          states: {
              A: {
                  next: 'B',  // function() { return 'B'; }
                  enter: function() {},
                  exit: function() {}
              },
              // ...
          },        
          extend: {
              i: 0,
              name: 'abc'
              // ...
          },
          init: function() {},
          enable: true,
          eventEmitter: true,
      };
      */
      function FSM(config) {
        _classCallCheck(this, FSM);
  
        // Attach get-next-state function
        var states = GetValue$3(config, 'states', undefined);
  
        if (states) {
          this.addStates(states);
        } // Attach extend members
  
  
        var extend = GetValue$3(config, 'extend', undefined);
  
        if (extend) {
          for (var name in extend) {
            if (!this.hasOwnProperty(name) || this[name] === undefined) {
              this[name] = extend[name];
            }
          }
        } // Event emitter
  
  
        var eventEmitter = GetValue$3(config, 'eventEmitter', undefined);
        var EventEmitterClass = GetValue$3(config, 'EventEmitterClass', undefined);
        this.setEventEmitter(eventEmitter, EventEmitterClass);
        this._stateLock = false;
        this.resetFromJSON(config);
      }
  
      _createClass(FSM, [{
        key: "shutdown",
        value: function shutdown() {
          this.destroyEventEmitter();
        }
      }, {
        key: "destroy",
        value: function destroy() {
          this.shutdown();
        }
      }, {
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          this.setEnable(GetValue$3(o, 'enable', true));
          this.start(GetValue$3(o, 'start', undefined));
          var init = GetValue$3(o, 'init', undefined);
  
          if (init) {
            init.call(this);
          }
  
          return this;
        }
      }, {
        key: "toJSON",
        value: function toJSON() {
          return {
            curState: this.state,
            prevState: this.prevState,
            enable: this.enable,
            start: this._start
          };
        }
      }, {
        key: "setEnable",
        value: function setEnable(e) {
          if (e === undefined) {
            e = true;
          }
  
          this.enable = e;
          return this;
        }
      }, {
        key: "toggleEnable",
        value: function toggleEnable() {
          this.setEnable(!this.enable);
          return this;
        }
      }, {
        key: "state",
        get: function get() {
          return this._state;
        },
        set: function set(newState) {
          if (!this.enable || this._stateLock) {
            return;
          }
  
          if (this._state === newState) {
            return;
          }
  
          this._prevState = this._state;
          this._state = newState;
          this._stateLock = true; // lock state
  
          this.emit('statechange', this);
  
          if (this._prevState != null) {
            var exitEventName = 'exit_' + this._prevState;
            var exitCallback = this[exitEventName];
  
            if (exitCallback) {
              exitCallback.call(this);
            }
  
            this.emit(exitEventName, this);
          }
  
          this._stateLock = false;
  
          if (this._state != null) {
            var enterEventName = 'enter_' + this._state;
            var enterCallback = this[enterEventName];
  
            if (enterCallback) {
              enterCallback.call(this);
            }
  
            this.emit(enterEventName, this);
          }
        }
      }, {
        key: "prevState",
        get: function get() {
          return this._prevState;
        }
      }, {
        key: "start",
        value: function start(state) {
          this._start = state;
          this._prevState = undefined;
          this._state = state; // Won't fire statechange events
  
          return this;
        }
      }, {
        key: "goto",
        value: function goto(nextState) {
          if (nextState != null) {
            this.state = nextState;
          }
  
          return this;
        }
      }, {
        key: "next",
        value: function next() {
          var nextState;
          var getNextState = this['next_' + this.state];
  
          if (getNextState) {
            if (typeof getNextState === 'string') {
              nextState = getNextState;
            } else {
              nextState = getNextState.call(this);
            }
          }
  
          this["goto"](nextState);
          return this;
        }
      }, {
        key: "addState",
        value: function addState(name, state) {
          if (typeof name !== 'string') {
            state = name;
            name = state.name;
          }
  
          var getNextStateCallback = state.next;
  
          if (getNextStateCallback) {
            this['next_' + name] = getNextStateCallback;
          }
  
          var exitCallback = state.exit;
  
          if (exitCallback) {
            this['exit_' + name] = exitCallback;
          }
  
          var enterCallback = state.enter;
  
          if (enterCallback) {
            this['enter_' + name] = enterCallback;
          }
  
          return this;
        }
      }, {
        key: "addStates",
        value: function addStates(states) {
          if (Array.isArray(states)) {
            for (var i = 0, cnt = states.length; i < cnt; i++) {
              this.addState(states[i]);
            }
          } else {
            for (var name in states) {
              this.addState(name, states[name]);
            }
          }
  
          return this;
        }
      }, {
        key: "runMethod",
        value: function runMethod(methodName, a1, a2, a3, a4, a5) {
          var fn = this[methodName + '_' + this.state];
  
          if (!fn) {
            return undefined;
          } // Copy from eventemitter3
  
  
          var len = arguments.length;
  
          switch (len) {
            case 1:
              return fn.call(this);
  
            case 2:
              return fn.call(this, a1);
  
            case 3:
              return fn.call(this, a1, a2);
  
            case 4:
              return fn.call(this, a1, a2, a3);
  
            case 5:
              return fn.call(this, a1, a2, a3, a4);
  
            case 6:
              return fn.call(this, a1, a2, a3, a4, a5);
          }
  
          var args = new Array(len - 1);
  
          for (var i = 1; i < len; i++) {
            args[i - 1] = arguments[i];
          }
  
          return fn.apply(this, args);
        }
      }, {
        key: "update",
        value: function update(time, delta) {
          this.runMethod('update', time, delta);
        }
      }, {
        key: "preupdate",
        value: function preupdate(time, delta) {
          this.runMethod('preupdate', time, delta);
        }
      }, {
        key: "postupdate",
        value: function postupdate(time, delta) {
          this.runMethod('postupdate', time, delta);
        }
      }]);
  
      return FSM;
    }();
  
    Object.assign(FSM.prototype, EventEmitterMethods);
  
    Phaser.Utils.Objects.GetValue;
    Phaser.Math.Distance.Between;
  
    Phaser.Utils.Objects.GetValue;
  
    Phaser.Utils.Objects.GetValue;
  
    var DistanceBetween$1 = Phaser.Math.Distance.Between;
    var AngleBetween$1 = Phaser.Math.Angle.Between;
    var VelocityMethods = {
      getDt: function getDt() {
        var game = this.scene.sys.game;
        var dt = game.loop.delta;
        return dt;
      },
      getVelocity: function getVelocity() {
        var p1 = this.pointer.position;
        var p0 = this.pointer.prevPosition;
        var d = DistanceBetween$1(p0.x, p0.y, p1.x, p1.y);
        var velocity = d / (this.getDt() * 0.001);
        return velocity;
      },
      getVelocityX: function getVelocityX() {
        var p1 = this.pointer.position;
        var p0 = this.pointer.prevPosition;
        var d = Math.abs(p1.x - p0.x);
        var velocity = d / (this.getDt() * 0.001);
        return velocity;
      },
      getVelocityY: function getVelocityY() {
        var p1 = this.pointer.position;
        var p0 = this.pointer.prevPosition;
        var d = Math.abs(p1.y - p0.y);
        var velocity = d / (this.getDt() * 0.001);
        return velocity;
      },
      getVelocityAngle: function getVelocityAngle() {
        var p1 = this.pointer.position;
        var p0 = this.pointer.prevPosition;
        var angle = AngleBetween$1(p0.x, p0.y, p1.x, p1.y);
        return angle;
      }
    };
  
    var DIRMODE = {
      'up&down': 0,
      'left&right': 1,
      '4dir': 2,
      '8dir': 3
    };
  
    var AngleToDirections = function AngleToDirections(angle, dirMode, out) {
      if (out === undefined) {
        out = {};
      } else if (out === true) {
        out = globOut;
      }
  
      out.left = false;
      out.right = false;
      out.up = false;
      out.down = false;
      angle = (angle + 360) % 360;
  
      switch (dirMode) {
        case 0:
          // up & down
          if (angle < 180) {
            out.down = true;
          } else {
            out.up = true;
          }
  
          break;
  
        case 1:
          // left & right
          if (angle > 90 && angle <= 270) {
            out.left = true;
          } else {
            out.right = true;
          }
  
          break;
  
        case 2:
          // 4 dir
          if (angle > 45 && angle <= 135) {
            out.down = true;
          } else if (angle > 135 && angle <= 225) {
            out.left = true;
          } else if (angle > 225 && angle <= 315) {
            out.up = true;
          } else {
            out.right = true;
          }
  
          break;
  
        case 3:
          // 8 dir
          if (angle > 22.5 && angle <= 67.5) {
            out.down = true;
            out.right = true;
          } else if (angle > 67.5 && angle <= 112.5) {
            out.down = true;
          } else if (angle > 112.5 && angle <= 157.5) {
            out.down = true;
            out.left = true;
          } else if (angle > 157.5 && angle <= 202.5) {
            out.left = true;
          } else if (angle > 202.5 && angle <= 247.5) {
            out.left = true;
            out.up = true;
          } else if (angle > 247.5 && angle <= 292.5) {
            out.up = true;
          } else if (angle > 292.5 && angle <= 337.5) {
            out.up = true;
            out.right = true;
          } else {
            out.right = true;
          }
  
          break;
      }
  
      return out;
    };
  
    var globOut = {};
  
    var GetValue$2 = Phaser.Utils.Objects.GetValue;
    var RadToDeg$1 = Phaser.Math.RadToDeg;
  
    var Swipe = /*#__PURE__*/function (_OnePointerTracer) {
      _inherits(Swipe, _OnePointerTracer);
  
      var _super = _createSuper(Swipe);
  
      function Swipe(gameObject, config) {
        var _this;
  
        _classCallCheck(this, Swipe);
  
        _this = _super.call(this, gameObject, config);
  
        var self = _assertThisInitialized(_this);
  
        var stateConfig = {
          states: {
            IDLE: {
              enter: function enter() {
                self.x = 0;
                self.y = 0;
                self.worldX = 0;
                self.worldY = 0;
              },
              exit: function exit() {
                var pointer = self.lastPointer;
                self.x = pointer.x;
                self.y = pointer.y;
                self.worldX = pointer.worldX;
                self.worldY = pointer.worldY;
              }
            },
            BEGIN: {
              enter: function enter() {
                self.validDrag = false;
              }
            },
            RECOGNIZED: {
              enter: function enter() {
                self.start();
                self.updateDirectionStates();
                self.emit('swipe', self, self.gameObject, self.lastPointer);
              },
              exit: function exit() {
                self.stop();
                self.clearDirectionStates();
              }
            }
          },
          init: function init() {
            this.state = IDLE$2;
          },
          eventEmitter: false
        };
  
        _this.setRecongizedStateObject(new FSM(stateConfig));
  
        _this.clearDirectionStates();
  
        return _this;
      }
  
      _createClass(Swipe, [{
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          _get(_getPrototypeOf(Swipe.prototype), "resetFromJSON", this).call(this, o);
  
          this.setDragThreshold(GetValue$2(o, 'threshold', 10));
          this.setVelocityThreshold(GetValue$2(o, 'velocityThreshold', 1000));
          this.setDirectionMode(GetValue$2(o, 'dir', '8dir'));
          return this;
        }
      }, {
        key: "onDragStart",
        value: function onDragStart() {
          this.state = BEGIN$1;
        }
      }, {
        key: "onDragEnd",
        value: function onDragEnd() {
          this.state = IDLE$2;
        }
      }, {
        key: "onDrag",
        value: function onDrag() {
          if (this.state === BEGIN$1) {
            if (!this.validDrag) {
              this.validDrag = this.dragThreshold === 0 || this.pointer.getDistance() >= this.dragThreshold;
            }
  
            if (this.validDrag && this.dragVelocity > this.velocityThreshold) {
              this.state = RECOGNIZED$1;
            }
          }
        }
      }, {
        key: "postUpdate",
        value: function postUpdate(time, delta) {
          if (!this.isRunning || !this.enable) {
            return;
          } // Clear RECOGNIZED after update()
  
  
          if (this.state === RECOGNIZED$1) {
            this.state = IDLE$2;
          }
        }
      }, {
        key: "isSwiped",
        get: function get() {
          return this.state === RECOGNIZED$1;
        }
      }, {
        key: "dragVelocity",
        get: function get() {
          var velocity;
  
          switch (this.dirMode) {
            case 0:
              velocity = this.getVelocityY();
              break;
            // up & down
  
            case 1:
              velocity = this.getVelocityX();
              break;
            // left & right
  
            default:
              velocity = this.getVelocity();
              break;
            // 4 dir, 8 dir
          }
  
          return velocity;
        }
      }, {
        key: "setDragThreshold",
        value: function setDragThreshold(distance) {
          this.dragThreshold = distance;
          return this;
        }
      }, {
        key: "setVelocityThreshold",
        value: function setVelocityThreshold(velocity) {
          this.velocityThreshold = velocity;
          return this;
        }
      }, {
        key: "setDirectionMode",
        value: function setDirectionMode(m) {
          if (typeof m === 'string') {
            m = DIRMODE[m];
          }
  
          this.dirMode = m;
          return this;
        }
      }, {
        key: "updateDirectionStates",
        value: function updateDirectionStates() {
          var angle = RadToDeg$1(this.getVelocityAngle());
          AngleToDirections(angle, this.dirMode, this);
          return this;
        }
      }, {
        key: "clearDirectionStates",
        value: function clearDirectionStates() {
          this.left = false;
          this.right = false;
          this.up = false;
          this.down = false;
          return this;
        }
      }]);
  
      return Swipe;
    }(OnePointerTracer);
  
    Object.assign(Swipe.prototype, VelocityMethods);
    var IDLE$2 = 'IDLE';
    var BEGIN$1 = 'BEGIN';
    var RECOGNIZED$1 = 'RECOGNIZED';
  
    var Clear = function Clear(obj) {
      if (_typeof(obj) !== 'object' || obj === null) {
        return obj;
      }
  
      if (Array.isArray(obj)) {
        obj.length = 0;
      } else {
        for (var key in obj) {
          delete obj[key];
        }
      }
  
      return obj;
    };
  
    var GetValue$1 = Phaser.Utils.Objects.GetValue;
    var SpliceOne = Phaser.Utils.Array.SpliceOne;
    var DistanceBetween = Phaser.Math.Distance.Between;
    var AngleBetween = Phaser.Math.Angle.Between;
  
    var TwoPointersTracer = /*#__PURE__*/function () {
      function TwoPointersTracer(scene, config) {
        _classCallCheck(this, TwoPointersTracer);
  
        var amount = scene.input.manager.pointersTotal - 1;
  
        if (amount < 2) {
          scene.input.addPointer(2 - amount);
        }
  
        this.scene = scene; // Event emitter
  
        this.setEventEmitter(GetValue$1(config, 'eventEmitter', undefined));
        this._enable = undefined;
        this.pointers = [];
        this.movedState = {};
        this.resetFromJSON(config);
        this.boot();
      }
  
      _createClass(TwoPointersTracer, [{
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          this.setEnable(GetValue$1(o, "enable", true));
          this.bounds = GetValue$1(o, 'bounds', undefined);
          this.tracerState = TOUCH0;
          this.pointers.length = 0;
          Clear(this.movedState);
          return this;
        }
      }, {
        key: "boot",
        value: function boot() {
          this.scene.input.on('pointerdown', this.onPointerDown, this);
          this.scene.input.on('pointerup', this.onPointerUp, this);
          this.scene.input.on('gameout', this.dragCancel, this);
          this.scene.input.on('pointermove', this.onPointerMove, this);
          this.scene.sys.events.once('shutdown', this.destroy, this);
        }
      }, {
        key: "shutdown",
        value: function shutdown() {
          if (!this.scene) {
            return;
          }
  
          this.destroyEventEmitter();
          this.pointers.length = 0;
          Clear(this.movedState);
          this.scene.input.off('pointerdown', this.onPointerDown, this);
          this.scene.input.off('pointerup', this.onPointerUp, this);
          this.scene.input.off('gameout', this.dragCancel, this);
          this.scene.input.off('pointermove', this.onPointerMove, this);
          this.scene.sys.events.off('shutdown', this.destroy, this);
          this.scene = undefined;
        }
      }, {
        key: "destroy",
        value: function destroy() {
          this.shutdown();
        }
      }, {
        key: "enable",
        get: function get() {
          return this._enable;
        },
        set: function set(e) {
          if (this._enable === e) {
            return;
          }
  
          if (!e) {
            this.dragCancel();
          }
  
          this._enable = e;
          return this;
        }
      }, {
        key: "setEnable",
        value: function setEnable(e) {
          if (e === undefined) {
            e = true;
          }
  
          this.enable = e;
          return this;
        }
      }, {
        key: "toggleEnable",
        value: function toggleEnable() {
          this.setEnable(!this.enable);
          return this;
        }
      }, {
        key: "onPointerDown",
        value: function onPointerDown(pointer) {
          if (!this.enable) {
            return;
          }
  
          if (this.pointers.length === 2) {
            return;
          }
  
          var isInsideBounds = this.bounds ? this.bounds.contains(pointer.x, pointer.y) : true;
  
          if (!isInsideBounds) {
            return;
          }
  
          var index = this.pointers.indexOf(pointer);
  
          if (index !== -1) {
            // Already in catched pointers
            return;
          }
  
          this.movedState[pointer.id] = false;
          this.pointers.push(pointer);
  
          switch (this.tracerState) {
            case TOUCH0:
              this.tracerState = TOUCH1;
              this.onDrag1Start();
              break;
  
            case TOUCH1:
              this.tracerState = TOUCH2;
              this.onDrag2Start();
              break;
          }
        }
      }, {
        key: "onPointerUp",
        value: function onPointerUp(pointer) {
          if (!this.enable) {
            return;
          }
  
          var isInsideBounds = this.bounds ? this.bounds.contains(pointer.x, pointer.y) : true;
  
          if (!isInsideBounds) {
            return;
          }
  
          var index = this.pointers.indexOf(pointer);
  
          if (index === -1) {
            // Not in catched pointers
            return;
          } else {
            delete this.movedState[pointer.id];
            SpliceOne(this.pointers, index);
          }
  
          switch (this.tracerState) {
            case TOUCH1:
              this.tracerState = TOUCH0;
              this.onDrag1End();
              break;
  
            case TOUCH2:
              this.tracerState = TOUCH1;
              this.onDrag2End();
              this.onDrag1Start();
              break;
          }
        }
      }, {
        key: "onPointerMove",
        value: function onPointerMove(pointer) {
          if (!this.enable) {
            return;
          }
  
          if (pointer.isDown) {
            var isInsideBounds = this.bounds ? this.bounds.contains(pointer.x, pointer.y) : true;
            var isCatchedPointer = this.pointers.indexOf(pointer) !== -1;
  
            if (!isCatchedPointer && isInsideBounds) ; else if (isCatchedPointer && !isInsideBounds) {
              // Pointer moves out of bounds, lose pointer
              this.onPointerUp(pointer);
            } else {
              // Pointer drags in bounds
              if (!this.movedState[pointer.id]) {
                this.movedState[pointer.id] = pointer.x !== pointer.downX || pointer.y !== pointer.downY;
              }
  
              if (this.movedState[pointer.id]) {
                switch (this.tracerState) {
                  case TOUCH1:
                    this.onDrag1();
                    break;
  
                  case TOUCH2:
                    this.onDrag2();
                    break;
                }
              }
            }
          }
        }
      }, {
        key: "dragCancel",
        value: function dragCancel() {
          if (this.tracerState === TOUCH2) {
            this.onDrag2End();
          }
  
          this.pointers.length = 0;
          Clear(this.movedState);
          this.tracerState = TOUCH0;
          return this;
        }
      }, {
        key: "onDrag1Start",
        value: function onDrag1Start() {
          this.emit('drag1start', this);
        }
      }, {
        key: "onDrag1End",
        value: function onDrag1End() {
          this.emit('drag1end', this);
        }
      }, {
        key: "onDrag1",
        value: function onDrag1() {
          this.emit('drag1', this);
        }
      }, {
        key: "onDrag2Start",
        value: function onDrag2Start() {
          this.emit('drag2start', this);
        }
      }, {
        key: "onDrag2End",
        value: function onDrag2End() {
          this.emit('drag2end', this);
        }
      }, {
        key: "onDrag2",
        value: function onDrag2() {
          this.emit('drag2', this);
        }
      }, {
        key: "distanceBetween",
        get: function get() {
          if (this.tracerState !== TOUCH2) {
            return 0;
          }
  
          var p0 = this.pointers[0],
              p1 = this.pointers[1];
          return DistanceBetween(p0.x, p0.y, p1.x, p1.y);
        }
      }, {
        key: "angleBetween",
        get: function get() {
          if (this.tracerState !== TOUCH2) {
            return 0;
          }
  
          var p0 = this.pointers[0],
              p1 = this.pointers[1];
          return AngleBetween(p0.x, p0.y, p1.x, p1.y);
        }
      }, {
        key: "drag1Vector",
        get: function get() {
          var pointer = this.pointers[0];
  
          if (pointer && this.movedState[pointer.id]) {
            var p1 = pointer.position;
            var p0 = pointer.prevPosition;
            tmpDragVector.x = p1.x - p0.x;
            tmpDragVector.y = p1.y - p0.y;
          } else {
            tmpDragVector.x = 0;
            tmpDragVector.y = 0;
          }
  
          return tmpDragVector;
        }
      }, {
        key: "centerX",
        get: function get() {
          if (this.tracerState !== TOUCH2) {
            return 0;
          }
  
          var p0 = this.pointers[0].position;
          var p1 = this.pointers[1].position;
          return (p0.x + p1.x) / 2;
        }
      }, {
        key: "centerY",
        get: function get() {
          if (this.tracerState !== TOUCH2) {
            return 0;
          }
  
          var p0 = this.pointers[0].position;
          var p1 = this.pointers[1].position;
          return (p0.y + p1.y) / 2;
        }
      }, {
        key: "prevCenterX",
        get: function get() {
          if (this.tracerState !== TOUCH2) {
            return 0;
          }
  
          var preP0 = this.movedState[this.pointers[0].id] ? this.pointers[0].prevPosition : this.pointers[0].position;
          var preP1 = this.movedState[this.pointers[1].id] ? this.pointers[1].prevPosition : this.pointers[1].position;
          return (preP0.x + preP1.x) / 2;
        }
      }, {
        key: "prevCenterY",
        get: function get() {
          if (this.tracerState !== TOUCH2) {
            return 0;
          }
  
          var preP0 = this.movedState[this.pointers[0].id] ? this.pointers[0].prevPosition : this.pointers[0].position;
          var preP1 = this.movedState[this.pointers[1].id] ? this.pointers[1].prevPosition : this.pointers[1].position;
          return (preP0.y + preP1.y) / 2;
        }
      }, {
        key: "movementCenterX",
        get: function get() {
          return this.centerX - this.prevCenterX;
        }
      }, {
        key: "movementCenterY",
        get: function get() {
          return this.centerY - this.prevCenterY;
        }
      }, {
        key: "setRecongizedStateObject",
        value: function setRecongizedStateObject(stateObject) {
          this.recongizedState = stateObject;
          return this;
        }
      }, {
        key: "state",
        get: function get() {
          return this.recongizedState.state;
        },
        set: function set(newState) {
          this.recongizedState.state = newState;
        }
      }, {
        key: "cancel",
        value: function cancel() {
          this.state = IDLE$1;
          return this;
        }
      }]);
  
      return TwoPointersTracer;
    }();
  
    Object.assign(TwoPointersTracer.prototype, EventEmitterMethods);
    var tmpDragVector = {};
    var TOUCH0 = 0;
    var TOUCH1 = 1;
    var TOUCH2 = 2;
    var IDLE$1 = 'IDLE';
  
    Phaser.Utils.Objects.GetValue;
  
    var RotateAround = Phaser.Math.RotateAround;
  
    var RotateObjectAround = function RotateObjectAround(gameObject, x, y, angle) {
      RotateAround(gameObject, x, y, angle);
      gameObject.rotation += angle;
      return gameObject;
    };
  
    var ScreenXYToWorldXY = function ScreenXYToWorldXY(screenX, screenY, camera, out) {
      if (out === undefined) {
        out = {};
      } else if (out === true) {
        out = globalOut;
      }
  
      camera.getWorldPoint(screenX, screenY, out);
      return out;
    };
  
    var globalOut = {};
  
    var SpinObject = function SpinObject(gameObject, camera) {
      if (!this.isRotation) {
        return this;
      }
  
      if (camera === undefined) {
        camera = this.pointers[0].camera;
      }
  
      var movementX = this.movementCenterX,
          movementY = this.movementCenterY;
      var worldXY = ScreenXYToWorldXY(this.centerX, this.centerY, camera, true);
      var centerWorldX = worldXY.x;
      var centerWorldY = worldXY.y;
      var angle = this.rotation;
  
      if (Array.isArray(gameObject)) {
        var gameObjects = gameObject;
  
        for (var i = 0, cnt = gameObjects.length; i < cnt; i++) {
          gameObject = gameObjects[i];
          gameObject.x += movementX;
          gameObject.y += movementY;
          RotateObjectAround(gameObject, centerWorldX, centerWorldY, angle);
        }
      } else {
        gameObject.x += movementX;
        gameObject.y += movementY;
        RotateObjectAround(gameObject, centerWorldX, centerWorldY, angle);
      }
  
      return this;
    };
  
    var GetValue = Phaser.Utils.Objects.GetValue;
    var WrapDegrees = Phaser.Math.Angle.WrapDegrees; // Wrap degrees: -180 to 180 
  
    var ShortestBetween = Phaser.Math.Angle.ShortestBetween;
    var RadToDeg = Phaser.Math.RadToDeg;
    var DegToRad = Phaser.Math.DegToRad;
  
    var Rotate = /*#__PURE__*/function (_TwoPointersTracer) {
      _inherits(Rotate, _TwoPointersTracer);
  
      var _super = _createSuper(Rotate);
  
      function Rotate(scene, config) {
        var _this;
  
        _classCallCheck(this, Rotate);
  
        _this = _super.call(this, scene, config);
  
        var self = _assertThisInitialized(_this);
  
        var stateConfig = {
          states: {
            IDLE: {
              enter: function enter() {
                self.prevAngle = undefined;
                self.angle = 0;
              }
            },
            BEGIN: {},
            RECOGNIZED: {
              enter: function enter() {
                self.emit('rotatestart', self);
              },
              exit: function exit() {
                self.emit('rotateend', self);
              }
            }
          },
          init: function init() {
            this.state = IDLE;
          },
          eventEmitter: false
        };
  
        _this.setRecongizedStateObject(new FSM(stateConfig));
  
        return _this;
      }
  
      _createClass(Rotate, [{
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          _get(_getPrototypeOf(Rotate.prototype), "resetFromJSON", this).call(this, o);
  
          this.setDragThreshold(GetValue(o, 'threshold', 0));
          return this;
        }
      }, {
        key: "onDrag2Start",
        value: function onDrag2Start() {
          this.prevAngle = WrapDegrees(RadToDeg(this.angleBetween)); // Degrees
  
          this.state = BEGIN;
  
          if (this.dragThreshold === 0) {
            this.state = RECOGNIZED;
          }
        }
      }, {
        key: "onDrag2End",
        value: function onDrag2End() {
          this.state = IDLE;
        }
      }, {
        key: "onDrag2",
        value: function onDrag2() {
          switch (this.state) {
            case BEGIN:
              if (this.pointers[0].getDistance() >= this.dragThreshold && this.pointers[1].getDistance() >= this.dragThreshold) {
                var curAngle = WrapDegrees(RadToDeg(this.angleBetween));
                this.angle = ShortestBetween(this.prevAngle, curAngle);
                this.prevAngle = curAngle;
                this.state = RECOGNIZED;
              }
  
              break;
  
            case RECOGNIZED:
              var curAngle = WrapDegrees(RadToDeg(this.angleBetween));
              this.angle = ShortestBetween(this.prevAngle, curAngle);
              this.prevAngle = curAngle;
              this.emit('rotate', this);
              break;
          }
        }
      }, {
        key: "isRotated",
        get: function get() {
          return this.state === RECOGNIZED;
        }
      }, {
        key: "rotation",
        get: function get() {
          return DegToRad(this.angle);
        }
      }, {
        key: "setDragThreshold",
        value: function setDragThreshold(distance) {
          this.dragThreshold = distance;
          return this;
        }
      }]);
  
      return Rotate;
    }(TwoPointersTracer);
  
    var methods = {
      spinObject: SpinObject
    };
    Object.assign(Rotate.prototype, methods);
    var IDLE = 'IDLE';
    var BEGIN = 'BEGIN';
    var RECOGNIZED = 'RECOGNIZED';
  
    return Swipe;
  
  }));
  