phaser3-rex-plugins
Version:
2 lines (1 loc) • 32.5 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexdropdownplugin=e();}(undefined,(function(){function t(e){return t="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(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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,(s=i.key,r=void 0,"symbol"==typeof(r=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return ("string"===e?String:Number)(t)}(s,"string"))?r:String(r)),i);}var s,r;}function i(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(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}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e);}function r(t){return r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},r(t)}function a(t,e){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},a(t,e)}function o(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return !1;if(Reflect.construct.sham)return !1;if("function"==typeof Proxy)return !0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return !1}}();return function(){var n,i=r(t);if(e){var s=r(this).constructor;n=Reflect.construct(i,arguments,s);}else n=i.apply(this,arguments);return function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return o(t)}(this,n)}}function h(){return h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var i=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=r(t)););return t}(t,e);if(i){var s=Object.getOwnPropertyDescriptor(i,e);return s.get?s.get.call(arguments.length<3?t:n):s.value}},h.apply(this,arguments)}var c={setEventEmitter:function(t,e){return void 0===e&&(e=Phaser.Events.EventEmitter),this._privateEE=!0===t||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):[]},eventNames:function(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}},l=Phaser.Scene,f=function(t){return t instanceof l},v=function(e){return null==e||"object"!==t(e)?null:f(e)?e:e.scene&&f(e.scene)?e.scene:e.parent&&e.parent.scene&&f(e.parent.scene)?e.parent.scene:null},p=Phaser.Game,y=function(t){return t instanceof p},d=Phaser.Utils.Objects.GetValue,m=function(){function n(t,i){e(this,n),this.setParent(t),this.isShutdown=!1,this.setEventEmitter(d(i,"eventEmitter",!0)),this.parent&&(this.parent===this.scene?this.scene.sys.events.once("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.once("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this));}return i(n,[{key:"shutdown",value:function(t){this.isShutdown||(this.parent&&(this.parent===this.scene?this.scene.sys.events.off("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.off("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this)),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.game=void 0,this.isShutdown=!0);}},{key:"destroy",value:function(t){this.shutdown(t);}},{key:"onEnvDestroy",value:function(){this.destroy(!0);}},{key:"onParentDestroy",value:function(t,e){this.destroy(e);}},{key:"setParent",value:function(e){var n;return this.parent=e,this.scene=v(e),this.game=null==(n=e)||"object"!==t(n)?null:y(n)?n:y(n.game)?n.game:f(n)?n.sys.game:f(n.scene)?n.scene.sys.game:void 0,this}}]),n}();function k(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}Object.assign(m.prototype,c);var _={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,n="~";function i(){}function s(t,e,n){this.fn=t,this.context=e,this.once=n||!1;}function r(t,e,i,r,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var o=new s(i,r||t,a),u=n?n+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],o]:t._events[u].push(o):(t._events[u]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e];}function o(){this._events=new i,this._eventsCount=0;}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),o.prototype.eventNames=function(){var t,i,s=[];if(0===this._eventsCount)return s;for(i in t=this._events)e.call(t,i)&&s.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},o.prototype.listeners=function(t){var e=n?n+t:t,i=this._events[e];if(!i)return [];if(i.fn)return [i.fn];for(var s=0,r=i.length,a=new Array(r);s<r;s++)a[s]=i[s].fn;return a},o.prototype.listenerCount=function(t){var e=n?n+t:t,i=this._events[e];return i?i.fn?1:i.length:0},o.prototype.emit=function(t,e,i,s,r,a){var o=n?n+t:t;if(!this._events[o])return !1;var u,h,c=this._events[o],l=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,i),!0;case 4:return c.fn.call(c.context,e,i,s),!0;case 5:return c.fn.call(c.context,e,i,s,r),!0;case 6:return c.fn.call(c.context,e,i,s,r,a),!0}for(h=1,u=new Array(l-1);h<l;h++)u[h-1]=arguments[h];c.fn.apply(c.context,u);}else {var f,v=c.length;for(h=0;h<v;h++)switch(c[h].once&&this.removeListener(t,c[h].fn,void 0,!0),l){case 1:c[h].fn.call(c[h].context);break;case 2:c[h].fn.call(c[h].context,e);break;case 3:c[h].fn.call(c[h].context,e,i);break;case 4:c[h].fn.call(c[h].context,e,i,s);break;default:if(!u)for(f=1,u=new Array(l-1);f<l;f++)u[f-1]=arguments[f];c[h].fn.apply(c[h].context,u);}}return !0},o.prototype.on=function(t,e,n){return r(this,t,e,n,!1)},o.prototype.once=function(t,e,n){return r(this,t,e,n,!0)},o.prototype.removeListener=function(t,e,i,s){var r=n?n+t:t;if(!this._events[r])return this;if(!e)return a(this,r),this;var o=this._events[r];if(o.fn)o.fn!==e||s&&!o.once||i&&o.context!==i||a(this,r);else {for(var u=0,h=[],c=o.length;u<c;u++)(o[u].fn!==e||s&&!o[u].once||i&&o[u].context!==i)&&h.push(o[u]);h.length?this._events[r]=1===h.length?h[0]:h:a(this,r);}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&a(this,e)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=n,o.EventEmitter=o,t.exports=o;}(_);var g=function(t){s(r,t);var n=u(r);function r(){return e(this,r),n.apply(this,arguments)}return i(r,[{key:"shutdown",value:function(){this.removeAllListeners();}},{key:"destroy",value:function(){this.removeAllListeners();}}]),r}(k(_.exports)),E={setEventEmitter:function(t,e){return void 0===e&&(e=g),this._privateEE=!0===t||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):[]},eventNames:function(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}},O=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("."),s=t,r=n,a=0;a<i.length;a++){if(!s.hasOwnProperty(i[a])){r=n;break}r=s[i[a]],s=s[i[a]];}return r}return n}return n},b=["next","exit","enter"],w=function(){function t(n){e(this,t);var i=O(n,"states",void 0);i&&this.addStates(i);var s=O(n,"extend",void 0);if(s)for(var r in s)this.hasOwnProperty(r)&&void 0!==this[r]||(this[r]=s[r]);var a=O(n,"eventEmitter",void 0),o=O(n,"EventEmitterClass",void 0);this.setEventEmitter(a,o),this._stateLock=!1,this.resetFromJSON(n);}return i(t,[{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:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"state",get:function(){return this._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,s=this[i];s&&s.call(this),this.emit(i,this);}}}},{key:"prevState",get:function(){return this._prevState}},{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:"stateProperties",get:function(){return b}},{key:"addState",value:function(t,e){"string"!=typeof t&&(t=(e=t).name);for(var n=this.stateProperties,i=0,s=n.length;i<s;i++){var r=n[i],a=e[r];a&&(this["".concat(r,"_").concat(t)]=a);}return this}},{key:"addStates",value:function(t){if(Array.isArray(t))for(var e=0,n=t.length;e<n;e++)this.addState(t[e]);else for(var i in t)this.addState(i,t[i]);return this}},{key:"runMethod",value:function(t,e,n,i,s,r){var a=this[t+"_"+this.state];if(a){var o=arguments.length;switch(o){case 1:return a.call(this);case 2:return a.call(this,e);case 3:return a.call(this,e,n);case 4:return a.call(this,e,n,i);case 5:return a.call(this,e,n,i,s);case 6:return a.call(this,e,n,i,s,r)}for(var u=new Array(o-1),h=1;h<o;h++)u[h-1]=arguments[h];return a.apply(this,u)}}}]),t}();Object.assign(w.prototype,E);var T=function(t,e,n,i,s){void 0===s&&(s=!1);var r=t._events[e];if(!r)return !1;for(var a=0,o=r.length;a<o;a++){var u=r[a];if(u.fn===n&&u.context===i&&u.once===s)return !0}return !1},S=["next","exit","enter","update","preupdate","postupdate"],C=function(t){s(a,t);var n=u(a);function a(){return e(this,a),n.apply(this,arguments)}return i(a,[{key:"shutdown",value:function(){this.stopUpdate(),this.stopPreUpdate(),this.stopPostUpdate(),this._scene=void 0,h(r(a.prototype),"shutdown",this).call(this);}},{key:"resetFromJSON",value:function(t){return h(r(a.prototype),"resetFromJSON",this).call(this,t),this._scene=O(t,"scene",void 0),this}},{key:"stateProperties",get:function(){return S}},{key:"update",value:function(t,e){this.runMethod("update",t,e);}},{key:"preupdate",value:function(t,e){this.runMethod("preupdate",t,e);}},{key:"postupdate",value:function(t,e){this.runMethod("postupdate",t,e);}},{key:"startUpdate",value:function(t){t||(t=this._scene);var e=t.sys.events;return T(e,"update",this.update,this)||(this._scene=t,e.on("update",this.update,this)),this}},{key:"stopUpdate",value:function(){return this._scene?(this._scene.sys.events.off("update",this.update,this),this):this}},{key:"startPreUpdate",value:function(t){t||(t=this._scene);var e=t.sys.events;return T(e,"preupdate",this.preupdate,this)||(this._scene=t,e.on("preupdate",this.preupdate,this)),this}},{key:"stopPreUpdate",value:function(){return this._scene?(this._scene.sys.events.off("preupdate",this.preupdate,this),this):this}},{key:"startPostUpdate",value:function(t){t||(t=this._scene);var e=t.sys.events;return T(e,"postupdate",this.postupdate,this)||(this._scene=t,e.on("postupdate",this.postupdate,this)),this}},{key:"stopPostUpdate",value:function(){return this._scene?(this._scene.sys.events.off("postupdate",this.postupdate,this),this):this}}]),a}(w),x=function(t){s(r,t);var n=u(r);function r(t,i){var s;e(this,r),(s=n.call(this,i)).parent=t;var a=i.initState||"IDLE";return s.start(a),s}return i(r,[{key:"init",value:function(){this.start("IDLE");}},{key:"next_IDLE",value:function(){return "TRANS_OPNE"}},{key:"next_TRANS_OPNE",value:function(){return "OPEN"}},{key:"enter_TRANS_OPNE",value:function(){var t=this.parent;if(t.transitInTime>0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_OPNE",value:function(){this.parent.removeDelayCall();}},{key:"next_OPEN",value:function(){return "TRANS_CLOSE"}},{key:"enter_OPEN",value:function(){this.parent.onOpen();}},{key:"exit_OPEN",value:function(){this.parent.removeDelayCall();}},{key:"next_TRANS_CLOSE",value:function(){return "CLOSE"}},{key:"enter_TRANS_CLOSE",value:function(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_CLOSE",value:function(){this.parent.removeDelayCall();}},{key:"next_CLOSE",value:function(){return "TRANS_OPNE"}},{key:"enter_CLOSE",value:function(){this.parent.onClose();}},{key:"exit_CLOSE",value:function(){}},{key:"canOpen",value:function(){return "IDLE"===this.state||"CLOSE"===this.state}},{key:"canClose",value:function(){return "IDLE"===this.state||"OPEN"===this.state}}]),r}(C),P={delayCall:function(t,e,n){return this.delayCallTimer=function(t,e,n,i,s){var r=v(t);return r.time.delayedCall(e,(function(){r.game.events.once("poststep",(function(){n.call(i,s);}));}))}(this,t,e,n),this},removeDelayCall:function(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},R=function(){},L={setTransitInTime:function(t){return this.transitInTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInCallback:function(t){return t||(t=R),this.transitInCallback=t,this},setTransitOutCallback:function(t){return t||(t=R),this.transitOutCallback=t,this}},D={runTransitionInCallback:function(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen:function(){},requestOpen:function(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var n=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=n,this}},N={runTransitionOutCallback:function(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose:function(){this.oneShotMode&&this.parent.destroy();},requestClose:function(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var n=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=n,this}},j={};Object.assign(j,P,L,D,N);var I=Phaser.Utils.Objects.GetValue,A=function(t){s(a,t);var n=u(a);function a(t,i){var s;return e(this,a),(s=n.call(this,t,i)).setTransitInTime(I(i,"duration.in",200)),s.setTransitOutTime(I(i,"duration.out",200)),s.setTransitInCallback(I(i,"transitIn")),s.setTransitOutCallback(I(i,"transitOut")),s.oneShotMode=I(i,"destroy",!1),s.delayCallTimer=void 0,s._state=new x(o(s),{eventEmitter:!1,initState:I(i,"initState","IDLE")}),s.openEventData=void 0,s.closeEventData=void 0,s}return i(a,[{key:"state",get:function(){return this._state.state}},{key:"shutdown",value:function(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),h(r(a.prototype),"shutdown",this).call(this,t));}}]),a}(m);Object.assign(A.prototype,j);var M=Phaser.Utils.Objects.GetValue,X=function(t){s(a,t);var n=u(a);function a(t,i){var s;return e(this,a),(s=n.call(this,t,i))._isRunning=!1,s.isPaused=!1,s.tickingState=!1,s.setTickingMode(M(i,"tickingMode",1)),s}return i(a,[{key:"boot",value:function(){2!==this.tickingMode||this.tickingState||this.startTicking();}},{key:"shutdown",value:function(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),h(r(a.prototype),"shutdown",this).call(this,t));}},{key:"setTickingMode",value:function(t){"string"==typeof t&&(t=Y[t]),this.tickingMode=t;}},{key:"startTicking",value:function(){this.tickingState=!0;}},{key:"stopTicking",value:function(){this.tickingState=!1;}},{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()));}},{key:"start",value:function(){return this.isPaused=!1,this.isRunning=!0,this}},{key:"pause",value:function(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}},{key:"resume",value:function(){return this.isPaused&&(this.isRunning=!0),this}},{key:"stop",value:function(){return this.isPaused=!1,this.isRunning=!1,this}},{key:"complete",value:function(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this);}}]),a}(m),Y={no:0,lazy:1,always:2},U=Phaser.Utils.Objects.GetValue,G=function(t){s(a,t);var n=u(a);function a(t,i){var s;e(this,a);var r=(s=n.call(this,t,i)).scene?"update":"step";return s.tickEventName=U(i,"tickEventName",r),s.isSceneTicker=!F(s.tickEventName),s}return i(a,[{key:"startTicking",value:function(){h(r(a.prototype),"startTicking",this).call(this),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this);}},{key:"stopTicking",value:function(){h(r(a.prototype),"stopTicking",this).call(this),this.isSceneTicker&&this.scene?this.scene.sys.events.off(this.tickEventName,this.update,this):this.game&&this.game.events.off(this.tickEventName,this.update,this);}}]),a}(X),F=function(t){return "step"===t||"poststep"===t},B=Phaser.Utils.Objects.GetValue,J=Phaser.Math.Clamp,V=function(){function t(n){e(this,t),this.resetFromJSON(n);}return i(t,[{key:"resetFromJSON",value:function(t){this.state=B(t,"state",q),this.timeScale=B(t,"timeScale",1),this.delay=B(t,"delay",0),this.repeat=B(t,"repeat",0),this.repeatCounter=B(t,"repeatCounter",0),this.repeatDelay=B(t,"repeatDelay",0),this.duration=B(t,"duration",0),this.nowTime=B(t,"nowTime",0),this.justRestart=B(t,"justRestart",!1);}},{key:"toJSON",value:function(){return {state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,repeatDelay:this.repeatDelay,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}},{key:"destroy",value:function(){}},{key:"setTimeScale",value:function(t){return this.timeScale=t,this}},{key:"setDelay",value:function(t){return void 0===t&&(t=0),this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatInfinity",value:function(){return this.repeat=-1,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"start",value:function(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?H:z,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=q,this}},{key:"update",value:function(t,e){this.state!==q&&this.state!==K&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter<this.repeat?(this.repeatCounter++,this.justRestart=!0,this.nowTime-=this.duration,this.repeatDelay>0&&(this.nowTime-=this.repeatDelay,this.state=W)):(this.nowTime=this.duration,this.state=K):this.nowTime>=0&&(this.state=H));}},{key:"t",get:function(){var t;switch(this.state){case q:case z:case W:t=0;break;case H:t=this.nowTime/this.duration;break;case K:t=1;}return J(t,0,1)},set:function(t){(t=J(t,-1,1))<0?(this.state=z,this.nowTime=-this.delay*t):(this.state=H,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===q}},{key:"isDelay",get:function(){return this.state===z}},{key:"isCountDown",get:function(){return this.state===H}},{key:"isRunning",get:function(){return this.state===z||this.state===H}},{key:"isDone",get:function(){return this.state===K}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),q=0,z=1,H=2,W=3,K=-1,Q=function(t){s(a,t);var n=u(a);function a(t,i){var s;return e(this,a),(s=n.call(this,t,i)).timer=new V,s}return i(a,[{key:"shutdown",value:function(t){this.isShutdown||(h(r(a.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),h(r(a.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),h(r(a.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),h(r(a.prototype),"complete",this).call(this),this}}]),a}(G),Z=Phaser.Utils.Objects.GetValue,$=Phaser.Utils.Objects.GetAdvancedValue,tt=Phaser.Tweens.Builders.GetEaseFunction,et=function(t){s(a,t);var n=u(a);function a(){return e(this,a),n.apply(this,arguments)}return i(a,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Z(t,"timer")),this.setEnable(Z(t,"enable",!0)),this.setTarget(Z(t,"target",this.parent)),this.setDelay($(t,"delay",0)),this.setDuration($(t,"duration",1e3)),this.setEase(Z(t,"ease","Linear")),this.setRepeat(Z(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=tt(t),this}},{key:"start",value:function(){return this.timer.isRunning||h(r(a.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),h(r(a.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var n=this.target,i=this.timer;return i.update(t,e),i.isDelay||this.updateGameObject(n,i),this.emit("update",n,this),i.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),a}(Q),nt=Phaser.Utils.Objects.GetValue,it=Phaser.Utils.Objects.GetAdvancedValue,st=Phaser.Math.Linear,rt=function(t){s(a,t);var n=u(a);function a(t,i){var s;return e(this,a),(s=n.call(this,t,i)).scaleStart={},s.scaleEnd={},s.resetFromJSON(i),s.boot(),s}return i(a,[{key:"resetFromJSON",value:function(t){return h(r(a.prototype),"resetFromJSON",this).call(this,t),this.setMode(nt(t,"mode",0)),this.setScaleRange(it(t,"start",void 0),it(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=at[t]),this.mode=t,this}},{key:"setScaleRange",value:function(t,e){return "number"==typeof t?(this.startX=t,this.startY=t):(this.startX=it(t,"x",this.parent.scaleX),this.startY=it(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=it(e,"x",void 0),this.endY=it(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}},{key:"start",value:function(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),h(r(a.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var n=e.t;e.isOddIteration&&(n=1-n),n=this.easeFn(n),this.hasScaleX&&(t.scaleX=st(this.startX,this.endX,n)),this.hasScaleY&&(t.scaleY=st(this.startY,this.endY,n));}},{key:"complete",value:function(){return h(r(a.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),a}(et),at={stop:0,destroy:1,yoyo:2},ot=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return !0;if(-1!==e.indexOf(".")){for(var n=e.split("."),i=t,s=0;s<n.length;s++){if(!i.hasOwnProperty(n[s]))return !1;i=i[n[s]];}return !0}return !1}return !1},ut=Phaser.Cameras.Scene2D.BaseCamera,ht=Phaser.Geom.Rectangle,ct=function(t,e,n){return e instanceof ut||(n=e,e=void 0),void 0===n?n=new ht:!0===n&&(n=lt),e?t.scale.getViewPort(e,n):t.scale.getViewPort(n)},lt=new ht,ft=Phaser.Utils.Objects.GetValue,vt=function(t,e){var n=ft(e,"expandDirection",void 0);"string"==typeof n&&(n=pt[n]);var i,s,r,o,u,h,c=(r="alignTargetX",ot(i=e,s="alignTarget")?O(i,s):r&&ot(i,r)?O(i,r):o),l=ft(e,"alignTargetY",c),f=ft(e,"alignOffsetX",0),v=ft(e,"alignOffsetY",0),p=ft(e,"alignSide","").includes("right"),y=ft(e,"bounds"),d=0===n,m=!d&&!(1===n),k=p?1:0,_=d||m?0:1;t.setOrigin(k,_),u=p?c.getTopRight().x:c.getTopLeft().x,h=l.getBottomLeft().y,t.setPosition(u+f,h+v);var g=y;g||(g=ct(t.scene)),m&&t.getBottomLeft().y>g.bottom&&(h=l.getTopLeft().y,t.setOrigin(0,1).setPosition(u+f,h+v));},pt={down:0,up:1},yt=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},dt=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height},mt=Phaser.Geom.Rectangle,kt=Phaser.Math.Vector2,_t=Phaser.Math.RotateAround,gt=void 0,Et=function(t,e,n){return void 0===e?e=new kt:!0===e&&(void 0===Tt&&(Tt=new kt),e=Tt),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-yt(t)*t.originX,e.y=t.y-dt(t)*t.originY,St(t,e,n))},Ot=function(t,e,n){return void 0===e?e=new kt:!0===e&&(void 0===Tt&&(Tt=new kt),e=Tt),t.getTopRight?t.getTopRight(e):(e.x=t.x-yt(t)*t.originX+yt(t),e.y=t.y-dt(t)*t.originY,St(t,e,n))},bt=function(t,e,n){return void 0===e?e=new kt:!0===e&&(void 0===Tt&&(Tt=new kt),e=Tt),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-yt(t)*t.originX,e.y=t.y-dt(t)*t.originY+dt(t),St(t,e,n))},wt=function(t,e,n){return void 0===e?e=new kt:!0===e&&(void 0===Tt&&(Tt=new kt),e=Tt),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-yt(t)*t.originX+yt(t),e.y=t.y-dt(t)*t.originY+dt(t),St(t,e,n))},Tt=void 0,St=function(t,e,n){(void 0===n&&(n=!1),0!==t.rotation&&_t(e,t.x,t.y,t.rotation),n&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e},Ct=function(t,e,n,i,s){if(!t)return !1;if(i&&!i(t,e,n))return !1;var r=function(t,e){if(void 0===e?e=new mt:!0===e&&(void 0===gt&&(gt=new mt),e=gt),t.getBounds)return t.getBounds(e);var n,i,s,r,a,o,u,h;if(t.parentContainer){var c=t.parentContainer.getBoundsTransformMatrix();Et(t,e),c.transformPoint(e.x,e.y,e),n=e.x,i=e.y,Ot(t,e),c.transformPoint(e.x,e.y,e),s=e.x,r=e.y,bt(t,e),c.transformPoint(e.x,e.y,e),a=e.x,o=e.y,wt(t,e),c.transformPoint(e.x,e.y,e),u=e.x,h=e.y;}else Et(t,e),n=e.x,i=e.y,Ot(t,e),s=e.x,r=e.y,bt(t,e),a=e.x,o=e.y,wt(t,e),u=e.x,h=e.y;return e.x=Math.min(n,s,a,u),e.y=Math.min(i,r,o,h),e.width=Math.max(n,s,a,u)-e.x,e.height=Math.max(i,r,o,h)-e.y,e}(t,!0);return !!r.contains(e,n)&&!(s&&!s(t,e,n))},xt=Phaser.Utils.Objects.GetValue,Pt=function(t){s(a,t);var n=u(a);function a(t,i){var s;e(this,a),void 0===i&&(i={}),null==i.transitIn&&(i.transitIn=function(t,e){!function(t,e,n,i,s){var r,a;switch(void 0===i&&(i="Cubic"),n){case 0:case"x":r={x:0},a={x:t.scaleX};break;case 1:case"y":r={y:0},a={y:t.scaleY};break;default:r=0,a=t.scale;}var o={mode:0,start:r,end:a,duration:e,ease:i};void 0===s?s=new rt(t,o):s.resetFromJSON(o),s.restart();}(t,e,"y","Cubic");}),null==i.transitOut&&(i.transitOut=function(t,e){!function(t,e,n,i,s){void 0===i&&(i="Linear");var r={mode:0};switch(n){case 0:case"x":r.end={x:0};break;case 1:case"y":r.end={y:0};break;default:r.end=0;}r.duration=e,r.ease=i,void 0===s?s=new rt(t,r):s.resetFromJSON(r),s.restart();}(t,e,"y","Linear");}),i.manualClose=!0,i.clickOutsideClose=!0,i.destroy=!0,s=n.call(this,t,i),vt(t,i),t.isRexSizer&&t.layout();var r=xt(i,"touchOutsideClose",!1),u=xt(i,"anyTouchClose",!1);return u&&(r=!1),u?s.once("open",s.anyTouchClose,o(s)):r&&s.once("open",s.touchOutsideClose,o(s)),s.requestOpen(),s}return i(a,[{key:"shutdown",value:function(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),h(r(a.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&Ct(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"onOpen",value:function(){this.emit("open",this.parent,this),h(r(a.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.parent,this),h(r(a.prototype),"onClose",this).call(this);}}]),a}(A);return function(t){s(r,Phaser.Plugins.BasePlugin);var n=u(r);function r(t){return e(this,r),n.call(this,t)}return i(r,[{key:"start",value:function(){this.game.events.on("destroy",this.destroy,this);}},{key:"add",value:function(t,e){return new Pt(t,e)}}]),r}()}));