text: !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.rexpinchplugin=e():t.rexpinchplugin=e()}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=287)}({0:function(t,e){t.exports=function(t,e,n){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return t[e];if(-1!==e.indexOf(".")){for(var i=e.split("."),r=t,s=n,o=0;o<i.length;o++){if(!r.hasOwnProperty(i[o])){s=n;break}s=r[i[o]],r=r[i[o]]}return s}return n}return n}},13:function(t,e,n){"use strict";var i=n(3),r=n(0),s=n.n(r);function o(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}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 n=s()(e,"states",void 0);n&&this.addStates(n);var i=s()(e,"extend",void 0);if(i)for(var r in i)this.hasOwnProperty(r)&&void 0!==this[r]||(this[r]=i[r]);var o=s()(e,"eventEmitter",void 0),a=s()(e,"EventEmitterClass",void 0);this.setEventEmitter(o,a),this._stateLock=!1,this.resetFromJSON(e)}var e,n,i;return e=t,(n=[{key:"shutdown",value:function(){this.destroyEventEmitter()}},{key:"destroy",value:function(){this.shutdown()}},{key:"resetFromJSON",value:function(t){this.setEnable(s()(t,"enable",!0)),this.start(s()(t,"start",void 0));var e=s()(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 n=s()(e,"next",void 0);n&&(this["next_"+t]=n);var i=s()(e,"exit",void 0);i&&(this["exit_"+t]=i);var r=s()(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,n){void 0===n&&(n="update");var i=this[n+"_"+this.state];i&&i.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,n=this[e];n&&n.call(this),this.emit(e,this)}if(this._stateLock=!1,null!=this._state){var i="enter_"+this._state,r=this[i];r&&r.call(this),this.emit(i,this)}}},get:function(){return this._state}},{key:"prevState",get:function(){return this._prevState}}])&&o(e.prototype,n),i&&o(e,i),t}();Object.assign(a.prototype,i.a);var u=a;e.a=u},193:function(t,e,n){"use strict";var i=n(90);e.a=i.a},287:function(t,e,n){"use strict";n.r(e);var i=n(193);function r(t){return(r="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 n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function o(t,e){return!e||"object"!==r(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 a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var h=function(t){function e(t){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),o(this,a(e).call(this,t))}var n,r,h;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&&u(t,e)}(e,Phaser.Plugins.BasePlugin),n=e,(r=[{key:"start",value:function(){this.game.events.once("destroy",this.destroy,this)}},{key:"add",value:function(t,e){return new i.a(t,e)}}])&&s(n.prototype,r),h&&s(n,h),e}();e.default=h},3:function(t,e,n){"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(){this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown()},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(){return this._eventEmitter&&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):[]}}},7:function(t,e,n){"use strict";e.a=function(t){if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e]}},73:function(t,e,n){"use strict";var i=n(3),r=n(7);function s(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var o=Phaser.Utils.Objects.GetValue,a=Phaser.Utils.Array.SpliceOne,u=Phaser.Math.Distance.Between,h=Phaser.Math.Angle.Between,c=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var i=e.input.manager.pointersTotal-1;i<2&&e.input.addPointer(2-i),this.scene=e,this.setEventEmitter(o(n,"eventEmitter",void 0)),this.pointers=[],this.movedState={},this.resetFromJSON(n),this.boot()}var e,n,i;return e=t,(n=[{key:"resetFromJSON",value:function(t){return this.setEnable(o(t,"enable",!0)),this.bounds=o(t,"bounds",void 0),this.tracerState=l,this.pointers.length=0,Object(r.a)(this.movedState),this}},{key:"boot",value:function(){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.destroyEventEmitter(),this.pointers.length=0,Object(r.a)(this.movedState),this.scene&&(this.scene.input.off("pointerdown",this.onPointerDown,this),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}},{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){if(this.enable&&(2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t)))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.tracerState){case l:this.tracerState=p,this.onDrag1Start();break;case p:this.tracerState=v,this.onDrag2Start()}}},{key:"onPointerUp",value:function(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],a(this.pointers,e),this.tracerState){case p:this.tracerState=l,this.onDrag1End();break;case v:this.tracerState=p,this.onDrag2End(),this.onDrag1Start()}}}},{key:"onPointerMove",value:function(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),n=-1!==this.pointers.indexOf(t);if(!n&&e);else if(n&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case p:this.onDrag1();break;case v:this.onDrag2()}}}},{key:"dragCancel",value:function(){return this.tracerState===v&&this.onDrag2End(),this.pointers.length=0,Object(r.a)(this.movedState),this.tracerState=l,this}},{key:"onDrag1Start",value:function(){this.emit("drag1start",this)}},{key:"onDrag1End",value:function(){this.emit("drag1end",this)}},{key:"onDrag1",value:function(){this.emit("drag1",this)}},{key:"onDrag2Start",value:function(){this.emit("drag2start",this)}},{key:"onDrag2End",value:function(){this.emit("drag2end",this)}},{key:"onDrag2",value:function(){this.emit("drag2",this)}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"cancel",value:function(){return this.state=d,this}},{key:"distanceBetween",get:function(){if(this.tracerState!==v)return 0;var t=this.pointers[0],e=this.pointers[1];return u(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==v)return 0;var t=this.pointers[0],e=this.pointers[1];return h(t.x,t.y,e.x,e.y)}},{key:"drag1Vector",get:function(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,n=t.prevPosition;f.x=e.x-n.x,f.y=e.y-n.y}else f.x=0,f.y=0;return f}},{key:"centerX",get:function(){if(this.tracerState!==v)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}},{key:"centerY",get:function(){if(this.tracerState!==v)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}},{key:"prevCenterX",get:function(){if(this.tracerState!==v)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}},{key:"prevCenterY",get:function(){if(this.tracerState!==v)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}},{key:"movementCenterX",get:function(){return this.centerX-this.prevCenterX}},{key:"movementCenterY",get:function(){return this.centerY-this.prevCenterY}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t}}])&&s(e.prototype,n),i&&s(e,i),t}();Object.assign(c.prototype,i.a);var f={},l=0,p=1,v=2,d="IDLE";e.a=c},90:function(t,e,n){"use strict";var i=n(73),r=n(13);function s(t){return(s="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 o(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t,e,n){return(u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var i=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=h(t)););return t}(t,e);if(i){var r=Object.getOwnPropertyDescriptor(i,e);return r.get?r.get.call(n):r.value}})(t,e,n||t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var f=Phaser.Utils.Objects.GetValue,l=function(t){function e(t,n){var i;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=a(i=function(t,e){return!e||"object"!==s(e)&&"function"!=typeof e?a(t):e}(this,h(e).call(this,t,n))),u={states:{IDLE:{enter:function(){o.prevDistance=void 0,o.scaleFactor=1}},BEGIN:{},RECOGNIZED:{enter:function(){o.emit("pinchstart",o)},exit:function(){o.emit("pinchend",o)}}},init:function(){this.state=p},eventEmitter:!1};return i.setRecongizedStateObject(new r.a(u)),i}var n,l,y;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&&c(t,e)}(e,i["a"]),n=e,(l=[{key:"resetFromJSON",value:function(t){return u(h(e.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(f(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=0===this.dragThreshold?d:v}},{key:"onDrag2End",value:function(){this.state=p}},{key:"onDrag2",value:function(){switch(this.state){case v:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.prevDistance=t,this.state=d}break;case d:t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"isPinch",get:function(){return this.state===d}}])&&o(n.prototype,l),y&&o(n,y),e}(),p="IDLE",v="BEGIN",d="RECOGNIZED";e.a=l}}).default});