text: !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).rexknob=e()}(this,function(){"use strict";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 v(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function f(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}function p(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&&i(t,e)}function y(t){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function g(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function m(n){var s=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 t,e=y(n);if(s){var i=y(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.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 g(t)}(this,t)}}function u(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function k(t,e,i){return(k="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var n=u(t,e);if(n){var s=Object.getOwnPropertyDescriptor(n,e);return s.get?s.get.call(i):s.value}})(t,e,i||t)}function a(t,e,i,n){return(a="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,i,n){var s,r,a,o,h=u(t,e);if(h){if((s=Object.getOwnPropertyDescriptor(h,e)).set)return s.set.call(n,i),!0;if(!s.writable)return!1}if(s=Object.getOwnPropertyDescriptor(n,e)){if(!s.writable)return!1;s.value=i,Object.defineProperty(n,e,s)}else o=i,(a=e)in(r=n)?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o;return!0})(t,e,i,n)}function e(t,e,i,n,s){if(!a(t,e,i,n||t)&&s)throw new Error("failed to set property");return i}function o(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return s(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return s(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var t=Phaser.GameObjects.Zone,h=Phaser.Utils.Array.Add,l=Phaser.Utils.Array.Remove,c=function(){p(o,t);var a=m(o);function o(t,e,i,n,s){var r;return v(this,o),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===s&&(s=1),(r=a.call(this,t,e,i,n,s)).children=[],r}return f(o,[{key:"destroy",value:function(t){if(this.scene){if(t)for(var e,i=this.children.length-1;0<=i;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),k(y(o.prototype),"destroy",this).call(this,t)}}},{key:"contains",value:function(t){return-1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return h(this.children,t,0,function(t){t.once("destroy",e.onChildDestroy,e)},this),this}},{key:"remove",value:function(t,e){var i=this;return l(this.children,t,function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()}),this}},{key:"onChildDestroy",value:function(t){this.remove(t,!1)}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i<n;i++)(e=this.children[i]).off("destroy",this.onChildDestroy,this),t&&e.destroy();return this.children.length=0,this}}]),o}(),d=Phaser.GameObjects.Components;Phaser.Class.mixin(c,[d.Alpha,d.Flip]);function b(t){var e;return t.hasOwnProperty("rexContainer")&&(e=t.rexContainer.parent),e}function C(e){if(!e.hasOwnProperty("rexContainer")){var t={parent:null,self:null,x:0,y:0,rotation:0,scaleX:0,scaleY:0,alpha:0,visible:!0,active:!0};Object.defineProperty(t,"angle",{get:function(){return T(this.rotation)},set:function(t){this.rotation=D(t)}}),Object.defineProperty(t,"displayWidth",{get:function(){return e.width*this.scaleX},set:function(t){this.scaleX=t/e.width}}),Object.defineProperty(t,"displayHeight",{get:function(){return e.height*this.scaleY},set:function(t){this.scaleY=t/e.height}}),e.rexContainer=t}return e.rexContainer}function S(t){return this.setParent(t),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),R.call(this,t),this}function P(t){this.setParent(t);var e=C(t);return e.x=t.x,e.y=t.y,e.rotation=t.rotation,e.scaleX=t.scaleX,e.scaleY=t.scaleY,e.alpha=t.alpha,e.visible=t.visible,e.active=t.active,this.updateChildPosition(t).updateChildAlpha(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),R.call(this,t),this}function w(t,e){return t===e?1:t/e}function x(t,e){if(0===t.length)return t;void 0===e&&(e=!1);var i=t[0].scene.sys.displayList;return i.depthSort(),e?t.sort(function(t,e){return i.getIndex(e)-i.getIndex(t)}):t.sort(function(t,e){return i.getIndex(t)-i.getIndex(e)}),t}function E(t,e){for(var i=[t];0<i.length;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,o(n.children))}}function O(t){return"[object Array]"===Object.prototype.toString.call(t)}function _(t){var e=this.getAllChildren([this]);return x(e),t.add(e),this}var D=Phaser.Math.DegToRad,T=Phaser.Math.RadToDeg,M={setParent:function(t,e){void 0===e&&(e=this);var i=C(t);return e?(i.parent=e,i.self=t):(i.parent=null,i.self=null),this},getParent:function(t){return void 0===t&&(t=this),b(t)},getTopmostParent:function(t){return void 0===t&&(t=this),function(t){for(var e=b(t);e;)e=b(t=e);return t}(t)}},R=c.prototype.add,z={add:function(t){return Array.isArray(t)?this.addMultiple(t):S.call(this,t),this},pin:function(t){return Array.isArray(t)?this.addMultiple(t):S.call(this,t),this},addMultiple:function(t){for(var e=0,i=t.length;e<i;e++)S.call(this,t[e]);return this},addLocal:function(t){return Array.isArray(t)?this.addMultiple(t):P.call(this,t),this},addLocalMultiple:function(t){for(var e=0,i=t.length;e<i;e++)P.call(this,t[e]);return this}},A=c.prototype.remove,X=c.prototype.clear,Y={remove:function(t,e){return b(t)!==this||(this.setParent(t,null),A.call(this,t,e)),this},clear:function(t){for(var e=0,i=this.children.length;e<i;e++)this.setParent(this.children[e],null);return X.call(this,t),this}},j={getLocalState:function(t){return C(t)},resetChildState:function(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState:function(t){for(var e=0,i=t.length;e<i;e++)this.resetChildState(t[e]);return this},syncProperties:function(){return this.syncPosition().syncVisible().syncAlpha().syncActive().syncScrollFactor().syncMask(),this}},V=Phaser.Math.RotateAround,F={worldToLocal:function(t){return t.x-=this.x,t.y-=this.y,V(t,0,0,-this.rotation),t.x/=this.scaleX,t.y/=this.scaleY,t},localToWorld:function(t){return t.x*=this.scaleX,t.y*=this.scaleY,V(t,0,0,this.rotation),t.x+=this.x,t.y+=this.y,t}},N={updateChildPosition:function(t){t.isRexContainerLite&&(t.syncChildrenEnable=!1);var e=C(t),i=e.parent;return t.x=e.x,t.y=e.y,i.localToWorld(t),t.scaleX=e.scaleX*i.scaleX,t.scaleY=e.scaleY*i.scaleY,t.rotation=e.rotation+i.rotation,t.isRexContainerLite&&(t.syncChildrenEnable=!0,t.syncPosition()),this},syncPosition:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildPosition,this),this},resetChildPositionState:function(t){var e=C(t),i=e.parent;return e.x=t.x,e.y=t.y,i.worldToLocal(e),e.scaleX=w(t.scaleX,i.scaleX),e.scaleY=w(t.scaleY,i.scaleY),e.rotation=t.rotation-i.rotation,this},setChildPosition:function(t,e,i){return t.x=e,t.y=i,this.resetChildPositionState(t),this},setChildLocalPosition:function(t,e,i){var n=C(t);return n.x=e,n.y=i,this.updateChildPosition(t),this},resetLocalPositionState:function(){var t=C(this).parent;return t&&t.resetChildPositionState(this),this}},I={updateChildRotation:function(t){var e=C(t),i=e.parent;return t.rotation=i.rotation+e.rotation,this},syncRotation:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState:function(t){var e=C(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation:function(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle:function(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation:function(t,e){return C(t).rotation=e,this.updateChildRotation(t),this},resetLocalRotationState:function(){var t=C(this).parent;return t&&t.resetChildRotationState(this),this}},L={updateChildScale:function(t){var e=C(t),i=e.parent;return t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY,this},syncScale:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState:function(t){var e=C(t),i=e.parent;return e.scaleX=w(t.scaleX,i.scaleX),e.scaleY=w(t.scaleY,i.scaleY),this},setChildScale:function(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale:function(t,e,i){void 0===i&&(i=e);var n=C(t);return n.scaleX=e,n.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize:function(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState:function(){var t=C(this).parent;return t&&t.resetChildScaleState(this),this}},U={updateChildVisible:function(t){var e=C(t),i=e.parent,n=!e.hasOwnProperty("maskVisible")||e.maskVisible;return t.visible=i.visible&&e.visible&&n,this},syncVisible:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState:function(t){var e=C(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible:function(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible:function(t,e){return void 0===e&&(e=!0),C(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible:function(t,e){return void 0===e&&(e=!0),C(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState:function(){var t=C(this).parent;return t&&t.resetChildVisibleState(this),this}},W={updateChildAlpha:function(t){var e=C(t),i=e.parent;return t.alpha=i.alpha*e.alpha,this},syncAlpha:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState:function(t){var e=C(t),i=e.parent;return e.alpha=w(t.alpha,i.alpha),this},setChildAlpha:function(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha:function(t,e){return C(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState:function(){var t=C(this).parent;return t&&t.resetChildAlphaState(this),this}},G={updateChildActive:function(t){var e=C(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState:function(t){return C(t).active=t.active,this},setChildActive:function(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive:function(t,e){return void 0===e&&(e=!0),C(t).active=e,this.updateChildActive(t),this},resetLocalActiveState:function(){var t=C(this).parent;return t&&t.resetChildActiveState(this),this}},H={updateChildScrollFactor:function(t){var e=C(t).parent;return t.setScrollFactor(e.scrollFactorX,e.scrollFactorY),this},syncScrollFactor:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},B={updateChildMask:function(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask:function(t){return this.mask=t,this},clearMask:function(t){return void 0===t&&(t=!1),t&&this.mask&&this.mask.destroy(),this.mask=null,this}},J={setDepth:function(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),n=0,s=i.length;n<s;n++)i[n].depth=t;return this},swapDepth:function(t){var e=this.depth,i=t.depth;return this.setDepth(i),t.setDepth(e),this},incDepth:function(t){if(this.depth+=t,this.children)for(var e=this.getAllChildren(),i=0,n=e.length;i<n;i++)e[i].depth+=t;return this},moveDepthBelow:function(t){var e=t.scene.children,i=this.getAllChildren([this]);x(i);for(var n=0,s=i.length;n<s;n++){var r=i[n];if(e.exists(r)){e.moveBelow(t,r);break}}return this},moveDepthAbove:function(t){var e=t.scene.children,i=this.getAllChildren([this]);x(i,!0);for(var n=0,s=i.length;n<s;n++){var r=i[n];if(e.exists(r)){e.moveAbove(t,r);break}}return this}},Z=Phaser.Utils.Array,K={getChildren:function(t){if(t)for(var e=0,i=this.children.length;e<i;e++)t.push(this.children[e]);else t=this.children;return t},getAllChildren:function(e){void 0===e&&(e=[]);var i=this;return E(i,function(t){t!==i&&e.push(t)}),e},getAllVisibleChildren:function(e){void 0===e&&(e=[]);var i=this;return E(i,function(t){if(t!==i)return!t.visible||void e.push(t)}),e},bfs:function(t,e){return void 0===e&&(e=this),E(e,t),this},dfs:function(t,e){return void 0===e&&(e=this),function t(e,i){if(!i(e)&&e.isRexContainerLite)for(var n=e.children,s=0,r=n.length;s<r;s++)t(n[s],i)}(e,t),this},contains:function(t){var e=b(t);return!!e&&(e===this||this.contains(e))},getByName:function(t,e){if(e){for(var i,n,s=[this];s.length;)for(var r=0,a=(i=s.shift()).children.length;r<a;r++){if((n=i.children[r]).name===t)return n;n.isRexContainerLite&&s.push(n)}return null}return Z.GetFirst(this.children,"name",t)},getRandom:function(t,e){return Z.GetRandom(this.children,t,e)},getFirst:function(t,e,i,n){return Z.GetFirstElement(this.children,t,e,i,n)},getAll:function(t,e,i,n){return Z.GetAll(this.children,t,e,i,n)},count:function(t,e,i,n){return Z.CountAllMatching(this.children,t,e,i,n)},swap:function(t,e){return Z.Swap(this.children,t,e),this},setAll:function(t,e,i,n){return Z.SetAll(this.children,t,e,i,n),this}},q={tweenChild:function(t){var e=t.targets;O(e)||(e=[e]);for(var r,i,n=[],s=0,a=e.length;s<a;s++)(i=e[s]).hasOwnProperty("rexContainer")&&(r=i.scene,n.push(i.rexContainer));if(r){t.targets=n;var o=r.tweens.add(t);return o.on("update",function(t,e,i){if(i.parent){var n=i.parent,s=i.self;switch(e){case"x":case"y":n.updateChildPosition(s);break;case"angle":case"rotation":n.updateChildRotation(s);break;case"scaleX":case"scaleY":case"displayWidth":case"displayHeight":n.updateChildScale(s);break;case"alpha":n.updateChildAlpha(s)}}else r.tweens.remove(t)}),o}},tween:function(t){var e=this.scene;return t.targets||(t.targets=this),e.tweens.add(t)}},Q={addToLayer:_,addToContainer:_},$=Phaser.Math.RotateAround,tt={changeOrigin:function(t,e){this.syncChildrenEnable=!1,function(t,e,i){void 0===i&&(i=e);var n={x:(e-t.originX)*t.displayWidth,y:(i-t.originY)*t.displayHeight};$(n,0,0,t.rotation),t.originX=e,t.originY=i,t.x=t.x+n.x,t.y=t.y+n.y}(this,t,e),this.syncChildrenEnable=!0;for(var i=this.getAllChildren(),n=0,s=i.length;n<s;n++)this.resetChildPositionState(i[n]);return this}};Object.assign(tt,M,z,Y,j,F,N,I,L,U,W,G,H,B,J,K,q,Q);var et=function(){p(h,c);var o=m(h);function h(t,e,i,n,s,r){var a;return v(this,h),(a=o.call(this,t,e,i,n,s)).type="rexContainerLite",a.isRexContainerLite=!0,a.syncChildrenEnable=!0,a._active=!0,a._mask=null,a._scrollFactorX=1,a._scrollFactorY=1,r&&a.add(r),a}return f(h,[{key:"destroy",value:function(t){this.scene&&(this.syncChildrenEnable=!1,k(y(h.prototype),"destroy",this).call(this,t))}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"x",get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this.syncPosition())}},{key:"y",get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.syncPosition())}},{key:"rotation",get:function(){return k(y(h.prototype),"rotation",this)},set:function(t){this.rotation!==t&&(e(y(h.prototype),"rotation",t,this,!0),this.syncPosition())}},{key:"scaleX",get:function(){return k(y(h.prototype),"scaleX",this)},set:function(t){this.scaleX!==t&&(e(y(h.prototype),"scaleX",t,this,!0),this.syncPosition())}},{key:"scaleY",get:function(){return k(y(h.prototype),"scaleY",this)},set:function(t){this.scaleY!==t&&(e(y(h.prototype),"scaleY",t,this,!0),this.syncPosition())}},{key:"visible",get:function(){return k(y(h.prototype),"visible",this)},set:function(t){k(y(h.prototype),"visible",this)!==t&&(e(y(h.prototype),"visible",t,this,!0),this.syncVisible())}},{key:"alpha",get:function(){return k(y(h.prototype),"alpha",this)},set:function(t){k(y(h.prototype),"alpha",this)!==t&&(e(y(h.prototype),"alpha",t,this,!0),this.syncAlpha())}},{key:"active",get:function(){return this._active},set:function(t){this._active!==t&&(this._active=t,this.syncActive())}},{key:"mask",get:function(){return this._mask},set:function(t){this._mask!==t&&(this._mask=t,this.syncMask())}},{key:"scrollFactorX",get:function(){return this._scrollFactorX},set:function(t){this._scrollFactorX!==t&&(this._scrollFactorX=t,this.syncScrollFactor())}},{key:"scrollFactorY",get:function(){return this._scrollFactorY},set:function(t){this._scrollFactorY!==t&&(this._scrollFactorY=t,this.syncScrollFactor())}},{key:"list",get:function(){return this.children}}],[{key:"GetParent",value:function(t){return b(t)}}]),h}();Object.assign(et.prototype,tt);function it(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer}function nt(){}var st,rt=Phaser.Display.Align,at={center:rt.CENTER,left:rt.LEFT_CENTER,right:rt.RIGHT_CENTER,top:rt.TOP_CENTER,bottom:rt.BOTTOM_CENTER,"left-top":rt.TOP_LEFT,"left-center":rt.LEFT_CENTER,"left-bottom":rt.BOTTOM_LEFT,"center-top":rt.TOP_CENTER,"center-center":rt.CENTER,"center-bottom":rt.BOTTOM_CENTER,"right-top":rt.TOP_RIGHT,"right-center":rt.RIGHT_CENTER,"right-bottom":rt.BOTTOM_RIGHT},ot=new Phaser.GameObjects.Zone({sys:{queueDepthSort:nt,events:{once:nt}}},0,0,1,1);ot.setOrigin(0);function ht(t){return void 0!==t.displayWidth?t.displayWidth:t.width}function ut(t){return void 0!==t.displayHeight?t.displayHeight:t.height}function lt(t){var e=ut(t);return t.y+e-e*t.originY}function ct(t){var e=ht(t);return t.x-e*t.originX+.5*e}function dt(t,e){var i=ut(t);return t.y=e-i+i*t.originY,t}function vt(t,e){var i=ht(t),n=i*t.originX;return t.x=e+n-.5*i,t}function ft(t){var e=ht(t);return t.x-e*t.originX}function pt(t,e){var i=ht(t);return t.x=e+i*t.originX,t}function yt(t){var e=ht(t);return t.x+e-e*t.originX}function gt(t,e){var i=ht(t);return t.x=e-i+i*t.originX,t}function mt(t,e){var i=ut(t),n=i*t.originY;return t.y=e+n-.5*i,t}function kt(t){var e=ut(t);return t.y-e*t.originY+.5*e}function bt(t){var e=ut(t);return t.y-e*t.originY}function Ct(t,e){var i=ut(t);return t.y=e+i*t.originY,t}var St=0,Pt=1,wt=2,xt=4,Et=6,Ot=8,_t=10,Dt=12,Tt=[];Tt[11]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),vt(t,ct(e)+i),dt(t,lt(e)+n),t},Tt[_t]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),pt(t,ft(e)-i),dt(t,lt(e)+n),t},Tt[Dt]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),gt(t,yt(e)+i),dt(t,lt(e)+n),t},Tt[Et]=function(t,e,i,n){var s,r,a;return void 0===i&&(i=0),void 0===n&&(n=0),s=t,r=ct(e)+i,a=kt(e)+n,vt(s,r),mt(s,a),t},Tt[xt]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),pt(t,ft(e)-i),mt(t,kt(e)+n),t},Tt[Ot]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),gt(t,yt(e)+i),mt(t,kt(e)+n),t},Tt[Pt]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),vt(t,ct(e)+i),Ct(t,bt(e)-n),t},Tt[St]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),pt(t,ft(e)-i),Ct(t,bt(e)-n),t},Tt[wt]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),gt(t,yt(e)+i),Ct(t,bt(e)-n),t};function Mt(t,e,i,n,s,r){var a,o,h,u;ot.setPosition(e,i).setSize(n,s),a=t,o=ot,Tt[r](a,o,h,u)}function Rt(t,e){return void 0===e&&(e={}),"number"==typeof t?(e.left=t,e.right=t,e.top=t,e.bottom=t):(e.left=Ut(t,"left",0),e.right=Ut(t,"right",0),e.top=Ut(t,"top",0),e.bottom=Ut(t,"bottom",0)),e}function zt(t){return Wt.call(this,t),this.sizerEventsEnable&&(t.emit("sizer.add",t,this),this.emit("add",t,this)),this}function At(t,e){return void 0===this.childrenMap&&(this.childrenMap={}),this.childrenMap[t]=e,this}function Xt(t,e){return void 0===e?t:t[e]}function Yt(t,e,i){var n=r(e);"string"===n?t[e]=i:"number"===n?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Bt(e,"left",0),t.right=Bt(e,"right",0),t.top=Bt(e,"top",0),t.bottom=Bt(e,"bottom",0))}function jt(t){return t instanceof qt}function Vt(t){return null==t||"object"!==r(t)?null:jt(t)?t:t.scene&&jt(t.scene)?t.scene:t.parent&&t.parent.scene&&jt(t.parent.scene)?t.parent.scene:void 0}var Ft=Phaser.Utils.Objects.GetValue,Nt=Phaser.GameObjects.Group,It=function(t){return t.add.text(0,0,"")},Lt=new Phaser.Geom.Rectangle,Ut=Phaser.Utils.Objects.GetValue,Wt=et.prototype.add,Gt={addBackground:function(t,e,i){return void 0===this.backgroundChildren&&(this.backgroundChildren=[]),"string"==typeof e&&(i=e,e=void 0),void 0===e&&(e=0),zt.call(this,t),this.backgroundChildren.push(t),this.getSizerConfig(t).padding=Rt(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground:function(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},Ht=/(\S+)\[(\d+)\]/i,Bt=Phaser.Utils.Objects.GetValue,Jt={getInnerPadding:function(t){return Xt(this.space,t)},setInnerPadding:function(t,e){return Yt(this.space,t,e),this},getOuterPadding:function(t){return Xt(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return Yt(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return"string"==typeof t&&(t=this.getElement(t)),Xt(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Yt(this.getSizerConfig(t).padding,e,i),this}},Zt={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,s=i.length;n<s;n++)(e=i[n]).rexSizer&&e.rexSizer.hidden||t.push(e);return t},getAllShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,s=i.length;n<s;n++){if(!(e=i[n]).rexSizer||!e.rexSizer.hidden)if(t.push(e),e.hasOwnProperty("isRexContainerLite"))t.push.apply(t,o(e.getAllShownChildren()))}return t}},Kt={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):[]}},qt=Phaser.Scene,Qt=Phaser.Utils.Objects.GetValue,$t=function(){function i(t,e){v(this,i),this.parent=t,this.scene=Vt(t),this.isShutdown=!1,this.setEventEmitter(Qt(e,"eventEmitter",!0)),this.parent&&this.parent===this.scene?this.scene.events.once("shutdown",this.onSceneDestroy,this):this.parent&&this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this)}return f(i,[{key:"shutdown",value:function(){this.isShutdown||(this.parent&&this.parent===this.scene?this.scene.events.off("shutdown",this.onSceneDestroy,this):this.parent&&this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.isShutdown=!0)}},{key:"destroy",value:function(t){this.shutdown(t)}},{key:"onSceneDestroy",value:function(){this.destroy(!0)}},{key:"onParentDestroy",value:function(t,e){this.destroy(e)}}]),i}();Object.assign($t.prototype,Kt);var te=Phaser.Geom.Rectangle;Phaser.Scale.Center;function ee(t){return i=t,n="complete",new Promise(function(t,e){i.once(n,function(){t()})});var i,n}function ie(e,t){t.completeEventName=void 0,t.on("complete",function(){t.completeEventName&&(e.emit(t.completeEventName,e),t.completeEventName=void 0)}),t.on("update",function(){var t=e.getParentSizer();t&&t.resetChildPositionState(e)})}function ne(e,t){t.completeEventName=void 0,t.on("complete",function(){t.completeEventName&&(e.emit(t.completeEventName,e),t.completeEventName=void 0)}),t.on("update",function(){var t=e.getParentSizer();t&&t.resetChildAlphaState(e)})}function se(t,e){if("number"==typeof t)return t;var i=t[0],n=parseFloat(t.substr(2));switch(i){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return e/n}}function re(e,t){t.completeEventName=void 0,t.on("complete",function(){t.completeEventName&&(e.emit(t.completeEventName,e),t.completeEventName=void 0)}),t.on("update",function(){var t=e.getParentSizer();t&&t.resetChildPositionState(e)})}function ae(t,e,i,n,s){return!(!t||!t.getBounds)&&(!(n&&!n(t,e,i))&&(!!(li=t.getBounds(li)).contains(e,i)&&!(s&&!s(t,e,i))))}function oe(t,e,i,n,s){return ae(t,e,i,ci(n),di(s))}function he(t){return!(t.rexSizer&&t.rexSizer.hidden)}function ue(t,e,i){!t||void 0===e&&void 0===i||(t.resize?(void 0===e&&(e=t.width),void 0===i&&(i=t.height),t.resize(e,i)):(void 0!==e&&(t.displayWidth=e),void 0!==i&&(t.displayHeight=i)))}function le(t){var e,i;this.sizerEventsEnable&&(e=t,void 0===(i=this.getChildPrevState(t))?i={}:!0===i&&(i=vi),i.x=e.x,i.y=e.y,i.scaleX=e.scaleX,i.scaleY=e.scaleY,i.width=e.width,i.height=e.height,i.displayWidth=e.displayWidth,i.displayHeight=e.displayHeight,this.layoutedChildren.push(t))}function ce(t,e,i,n,s,r,a,o){Mt(t,e,i,n,s,r),void 0!==a&&(t.x+=a),void 0!==o&&(t.y+=o),this.resetChildPositionState(t),this.sizerEventsEnable&&t.emit("sizer.postlayout",t,this)}function de(t,e,i){for(var n,s=0,r=t.length;s<r;s++)if(n=t[s],oe(n,e,i))return n.pointToChild(e,i);return null}function ve(t,e,i,n,s,r,a){var o;(o=void 0===s?n:de(i,n,s))&&t.emit(e,o,r,a)}function fe(t,e,i){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;for(var n=e.split("."),s=t,r=i,a=0;a<n.length;a++){if(!s.hasOwnProperty(n[a])){r=i;break}r=s[n[a]],s=s[n[a]]}return r}return i}var pe=new te,ye=function(){p(s,$t);var n=m(s);function s(t,e){var i;return v(this,s),(i=n.call(this,t,{eventEmitter:!1})).viewport=void 0,i.resetFromJSON(e),i.boot(),i}return f(s,[{key:"resetFromJSON",value:function(t){var e,i,n,s,r,a,o,h;void 0===t&&(t={}),void 0!==t.x?(e=null,i=t.x):void 0!==t.left?(e=0,i=t.left):void 0!==t.right?(e=1,i=t.right):void 0!==t.centerX&&(e=.5,i=t.centerX),void 0!==t.y?(n=null,s=t.y):void 0!==t.top?(n=0,s=t.top):void 0!==t.bottom?(n=1,s=t.bottom):void 0!==t.centerY&&(n=.5,s=t.centerY),void 0!==i&&(i=i.replace("left","0%").replace("right","100%").replace("center","50%").split("%"),r=parseFloat(i[0])/100,a=""===i[1]?0:parseFloat(i[1])),void 0!==s&&(s=s.replace("top","0%").replace("bottom","100%").replace("center","50%").split("%"),o=parseFloat(s[0])/100,h=""===s[1]?0:parseFloat(s[1]));var u,l,c=t.width;void 0!==c&&(c=c.split("%"),u=parseFloat(c[0])/100,l=""===c[1]?0:parseFloat(c[1]));var d,v,f=t.height;void 0!==f&&(f=f.split("%"),d=parseFloat(f[0])/100,v=""===f[1]?0:parseFloat(f[1])),this.setAlign(e,n),this.setPercentage(r,o),this.setOffset(a,h),this.setSizePercentage(u,d),this.setSizePadding(l,v);var p=t.onResizeCallback,y=t.onResizeCallbackScope;void 0!==p&&this.setResizeCallback(p,y);var g=t.onUpdateViewportCallback,m=t.onUpdateViewportCallbackScope;return void 0!==g&&this.setUpdateViewportCallback(g,m),this}},{key:"boot",value:function(){this.scene.scale.on("resize",this.anchor,this),this.anchor()}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.scale.off("resize",this.anchor,this),this.viewport=void 0,this.onUpdateViewportCallback=void 0,this.onUpdateViewportCallbackScope=void 0,this.onResizeCallback=void 0,this.onResizeCallbackScope=void 0,k(y(s.prototype),"shutdown",this).call(this,t))}},{key:"setAlign",value:function(t,e){return this.alignX=t,this.alignY=e,this}},{key:"setPercentage",value:function(t,e){return this.percentageX=t,this.percentageY=e,this}},{key:"setOffset",value:function(t,e){return this.offsetX=t,this.offsetY=e,this}},{key:"setSizePercentage",value:function(t,e){return this.percentageWidth=t,this.percentageHeight=e,this}},{key:"setSizePadding",value:function(t,e){return this.paddingWidth=t,this.paddingHeight=e,this}},{key:"setResizeCallback",value:function(t,e){return this.onResizeCallback=t,this.onResizeCallbackScope=e,this}},{key:"setUpdateViewportCallback",value:function(t,e){return this.onUpdateViewportCallback=t,this.onUpdateViewportCallbackScope=e,this}},{key:"anchor",value:function(){return this.updateViewport(),this.updateSize(),this.updatePosition(),this}},{key:"updateSize",value:function(){var t=this.onResizeCallback,e=this.onResizeCallbackScope,i=this.anchorWidth,n=this.anchorHeight;if((void 0!==i||void 0!==n)&&t){var s=this.parent;void 0===i&&(i=s.width),void 0===n&&(n=s.height),e?t.call(e,i,n,s,this):t(i,n,s,this)}}},{key:"updatePosition",value:function(){var t=this.parent;return null===this.alignX?t.x=this.anchorX:void 0!==this.alignX&&(t.x=this.anchorX+t.displayWidth*(t.originX-this.alignX)),null===this.alignY?t.y=this.anchorY:void 0!==this.alignY&&(t.y=this.anchorY+t.displayHeight*(t.originY-this.alignY)),this}},{key:"anchorX",get:function(){return this.viewport.x+this.viewport.width*this.percentageX+this.offsetX}},{key:"anchorY",get:function(){return this.viewport.y+this.viewport.height*this.percentageY+this.offsetY}},{key:"anchorWidth",get:function(){if(void 0!==this.percentageWidth)return this.viewport.width*this.percentageWidth+this.paddingWidth}},{key:"anchorHeight",get:function(){if(void 0!==this.percentageHeight)return this.viewport.height*this.percentageHeight+this.paddingHeight}},{key:"updateViewport",value:function(){this.viewport=function(t,e){void 0===e?e=new te:!0===e&&(e=pe);var i,n,s=t.scale,r=s.baseSize,a=s.parentSize,o=s.canvasBounds,h=s.displayScale,u=0<=o.x?0:-(o.x*h.x),l=0<=o.y?0:-(o.y*h.y);return i=a.width>=o.width?r.width:r.width-(o.width-a.width)*h.x,n=a.height>=o.height?r.height:r.height-(o.height-a.height)*h.y,e.setTo(u,l,i,n),e}(this.scene,!this.viewport||this.viewport);var t=this.onUpdateViewportCallback,e=this.onUpdateViewportCallbackScope;t&&(e?t.call(e,this.viewport,this.parent,this):t(this.viewport,this.parent,this))}}]),s}(),ge=Phaser.Utils.Objects.GetValue,me=function(){p(s,$t);var n=m(s);function s(t,e){var i;return v(this,s),(i=n.call(this,t,e))._isRunning=!1,i.isPaused=!1,i.tickingState=!1,i.setTickingMode(ge(e,"tickingMode",1)),i}return f(s,[{key:"boot",value:function(){2!==this.tickingMode||this.tickingState||this.startTicking()}},{key:"shutdown",value:function(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),k(y(s.prototype),"shutdown",this).call(this,t))}},{key:"setTickingMode",value:function(t){"string"==typeof t&&(t=ke[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)}}]),s}(),ke={no:0,lazy:1,always:2},be=function(){p(e,me);var t=m(e);function e(){return v(this,e),t.apply(this,arguments)}return f(e,[{key:"startTicking",value:function(){k(y(e.prototype),"startTicking",this).call(this),this.scene.events.on("update",this.update,this)}},{key:"stopTicking",value:function(){k(y(e.prototype),"stopTicking",this).call(this),this.scene&&this.scene.events.off("update",this.update,this)}}]),e}(),Ce=Phaser.Utils.Objects.GetValue,Se=Phaser.Math.Clamp,Pe=function(){function e(t){v(this,e),this.resetFromJSON(t)}return f(e,[{key:"resetFromJSON",value:function(t){this.state=Ce(t,"state",we),this.timeScale=Ce(t,"timeScale",1),this.delay=Ce(t,"delay",0),this.repeat=Ce(t,"repeat",0),this.repeatCounter=Ce(t,"repeatCounter",0),this.duration=Ce(t,"duration",0),this.nowTime=Ce(t,"nowTime",0),this.justRestart=Ce(t,"justRestart",!1)}},{key:"toJSON",value:function(){return{state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,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:"start",value:function(){return this.nowTime=0<this.delay?-this.delay:0,this.state=0<=this.nowTime?Ee:xe,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=we,this}},{key:"update",value:function(t,e){this.state!==we&&this.state!==Oe&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.state=0<=this.nowTime?Ee:xe,this.justRestart=!1,this.nowTime>=this.duration&&(-1===this.repeat||this.repeatCounter<this.repeat?(this.repeatCounter++,this.justRestart=!0,this.nowTime-=this.duration):(this.nowTime=this.duration,this.state=Oe)))}},{key:"t",get:function(){var t;switch(this.state){case we:case xe:t=0;break;case Ee:t=this.nowTime/this.duration;break;case Oe:t=1}return Se(t,0,1)},set:function(t){(t=Se(t,-1,1))<0?(this.state=xe,this.nowTime=-this.delay*t):(this.state=Ee,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}},{key:"isIdle",get:function(){return this.state===we}},{key:"isDelay",get:function(){return this.state===xe}},{key:"isCountDown",get:function(){return this.state===Ee}},{key:"isRunning",get:function(){return this.state===xe||this.state===Ee}},{key:"isDone",get:function(){return this.state===Oe}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),e}(),we=0,xe=1,Ee=2,Oe=-1,_e=function(){p(s,be);var n=m(s);function s(t,e){var i;return v(this,s),(i=n.call(this,t,e)).timer=new Pe,i}return f(s,[{key:"shutdown",value:function(t){this.isShutdown||(k(y(s.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0)}},{key:"start",value:function(){return this.timer.start(),k(y(s.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),k(y(s.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),k(y(s.prototype),"complete",this).call(this),this}}]),s}(),De=Phaser.Utils.Objects.GetValue,Te=Phaser.Utils.Objects.GetAdvancedValue,Me=Phaser.Tweens.Builders.GetEaseFunction,Re=function(){p(e,_e);var t=m(e);function e(){return v(this,e),t.apply(this,arguments)}return f(e,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(De(t,"timer")),this.setEnable(De(t,"enable",!0)),this.setDelay(Te(t,"delay",0)),this.setDuration(Te(t,"duration",1e3)),this.setEase(De(t,"ease","Linear")),this.setRepeat(De(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Me(t),this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"start",value:function(){return this.timer.isRunning||k(y(e.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;var n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(){}}]),e}(),ze=Phaser.Utils.Objects.GetValue,Ae=Phaser.Utils.Objects.GetAdvancedValue,Xe=Phaser.Math.Linear,Ye=function(){p(s,Re);var n=m(s);function s(t,e){var i;return v(this,s),(i=n.call(this,t,e)).scaleStart={},i.scaleEnd={},i.resetFromJSON(e),i.boot(),i}return f(s,[{key:"resetFromJSON",value:function(t){return k(y(s.prototype),"resetFromJSON",this).call(this,t),this.setMode(ze(t,"mode",0)),this.setScaleRange(Ae(t,"start",void 0),Ae(t,"end",0)),this}},{key:"setMode",value:function(t){return"string"==typeof t&&(t=je[t]),this.mode=t,this}},{key:"setScaleRange",value:function(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ae(t,"x",this.parent.scaleX),this.startY=Ae(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ae(e,"x",void 0),this.endY=Ae(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;return this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),k(y(s.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Xe(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Xe(this.startY,this.endY,i))}},{key:"complete",value:function(){return k(y(s.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),s}(),je={stop:0,destroy:1,yoyo:2},Ve=Phaser.Utils.Objects.IsPlainObject,Fe={popUp:function(t,e,i){if(Ve(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease}var s=void 0===this._scale;return this._scale=function(t,e,i,n,s){var r;switch(i){case 0:case"x":r={x:0};break;case 1:case"y":r={y:0};break;default:r=0}var a={mode:0,start:r,end:1,duration:e,ease:void 0===n?"Cubic":n};return void 0===s?s=new Ye(t,a):s.resetFromJSON(a),s.restart(),s}(this,t,e,i,this._scale),s&&ie(this,this._scale),this._scale.completeEventName="popup.complete",this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),ee(this._scale)},scaleDownDestroy:function(t,e,i,n){if(Ve(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease,n=s.destroy}var r=void 0===this._scale;return this._scale=function(t,e,i,n,s,r){s instanceof Ye&&(r=s,s=void 0),void 0===s&&(s=!0);var a={};switch(a.mode=s?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=void 0===n?"Linear":n,void 0===r?r=new Ye(t,a):r.resetFromJSON(a),r.restart(),r}(this,t,e,i,n,this._scale),r&&ie(this,this._scale),this._scale.completeEventName="scaledown.complete",this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),ee(this._scale)},scaleDown:function(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise:function(t,e,i){return this.scaleDown(t,e,i),ee(this._scale)}},Ne=Phaser.Utils.Objects.GetValue,Ie=Phaser.Utils.Objects.GetAdvancedValue,Le=Phaser.Math.Linear,Ue=function(){p(s,Re);var n=m(s);function s(t,e){var i;return v(this,s),(i=n.call(this,t,e)).resetFromJSON(e),i.boot(),i}return f(s,[{key:"resetFromJSON",value:function(t){return k(y(s.prototype),"resetFromJSON",this).call(this,t),this.setMode(Ne(t,"mode",0)),this.setAlphaRange(Ie(t,"start",this.parent.alpha),Ie(t,"end",0)),this}},{key:"setMode",value:function(t){return"string"==typeof t&&(t=We[t]),this.mode=t,this}},{key:"setAlphaRange",value:function(t,e){return this.alphaStart=t,this.alphaEnd=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),k(y(s.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Le(this.alphaStart,this.alphaEnd,i)}},{key:"complete",value:function(){return k(y(s.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),s}(),We={stop:0,destroy:1,yoyo:2},Ge=Phaser.Utils.Objects.IsPlainObject,He=Phaser.Utils.Objects.IsPlainObject,Be={fadeIn:function(t,e){if(He(t)){var i=t;t=i.duration,e=i.alpha}var n=void 0===this._fade;return this._fade=function(t,e,i,n){var s,r;r=Ge(i)?(s=i.start,i.end):i,void 0===s&&(s=0),void 0===r&&(r=1);var a={mode:0,start:s,end:r,duration:e};return void 0===n?n=new Ue(t,a):n.resetFromJSON(a),n.restart(),n}(this,t,e,this._fade),n&&ne(this,this._fade),this._fade.completeEventName="fadein.complete",this},fadeInPromise:function(t,e){return this.fadeIn(t,e),ee(this._fade)},fadeOutDestroy:function(t,e){if(He(t)){var i=t;t=i.duration,e=i.destroy}var n=void 0===this._fade;return this._fade=function(t,e,i,n){i instanceof Ue&&(n=i,i=void 0),void 0===i&&(i=!0);var s={mode:i?1:0,end:0,duration:e};return void 0===n?n=new Ue(t,s):n.resetFromJSON(s),n.restart(),n}(this,t,e,this._fade),n&&ne(this,this._fade),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),ee(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),ee(this._fade)}},Je=Phaser.Utils.Objects.GetValue,Ze=Phaser.Utils.Objects.GetAdvancedValue,Ke=Phaser.Math.Linear,qe=function(){p(s,Re);var n=m(s);function s(t,e){var i;return v(this,s),(i=n.call(this,t,e)).resetFromJSON(e),i.boot(),i}return f(s,[{key:"resetFromJSON",value:function(t){if(k(y(s.prototype),"resetFromJSON",this).call(this,t),this.setMode(Je(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ze(t,"x",void 0),i=Ze(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}},{key:"setMode",value:function(t){return"string"==typeof t&&(t=Qe[t]),this.mode=t,this}},{key:"setTargetPosition",value:function(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ze(i,"startX",void 0),this.startY=Ze(i,"startY",void 0),this.endX=Ze(i,"endX",void 0),this.endY=Ze(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}},{key:"start",value:function(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),k(y(s.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ke(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ke(this.startY,this.endY,i))}},{key:"complete",value:function(){return k(y(s.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),s}(),Qe={stop:0,destroy:1,yoyo:2},$e=Phaser.Utils.Objects.IsPlainObject,ti=Phaser.Math.Distance.Between,ei={moveFrom:function(t,e,i,n,s){if($e(t)){var r=t;e=r.x,i=r.y,t=r.hasOwnProperty("speed")?1e3*ti(e,i,this.x,this.y)/r.speed:r.duration,n=r.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,s,r,a){r instanceof qe&&(a=r,r=void 0),void 0===r&&(r=!1);var o={};return o.mode=r?1:0,void 0!==i&&(o.startX=se(i,t.x),o.endX=t.x),void 0!==n&&(o.startY=se(n,t.y),o.endY=t.y),o.duration=e,o.ease=void 0===s?"Linear":s,void 0===a?a=new qe(t,o):a.resetFromJSON(o),a.restart(),a}(this,t,e,i,n,s,this._easeMove),a&&re(this,this._easeMove),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise:function(t,e,i,n,s){return this.moveFrom(t,e,i,n,s),ee(this._easeMove)},moveFromDestroy:function(t,e,i,n){return this.moveFrom(t,e,i,n,!0),this},moveFromDestroyPromise:function(t,e,i,n){return this.moveFromDestroy(t,e,i,n),ee(this._easeMove)},moveTo:function(t,e,i,n,s){if($e(t)){var r=t;e=r.x,i=r.y,t=r.hasOwnProperty("speed")?1e3*ti(e,i,this.x,this.y)/r.speed:r.duration,n=r.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,s,r,a){r instanceof qe&&(a=r,r=void 0),void 0===r&&(r=!1);var o={};return o.mode=r?1:0,void 0!==i&&(o.startX=t.x,o.endX=se(i,t.x)),void 0!==n&&(o.startY=t.y,o.endY=se(n,t.y)),o.duration=e,o.ease=void 0===s?"Linear":s,void 0===a?a=new qe(t,o):a.resetFromJSON(o),a.restart(),a}(this,t,e,i,n,s,this._easeMove),a&&re(this,this._easeMove),this._easeMove.completeEventName="moveto.complete",this},moveToPromise:function(t,e,i,n,s){return this.moveTo(t,e,i,n,s),ee(this._easeMove)},moveToDestroy:function(t,e,i,n){return this.moveTo(t,e,i,n,!0),this},moveToDestroyPromise:function(t,e,i,n){return this.moveToDestroy(t,e,i,n,!0),ee(this._easeMove)}},ii=Phaser.Utils.Objects.GetValue,ni=function(){p(s,me);var n=m(s);function s(t,e){var i;return v(this,s),(i=n.call(this,t,e)).timer=new Pe,i.resetFromJSON(e),i.boot(),i}return f(s,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(ii(t,"timer")),this.setEnable(ii(t,"enable",!0)),this.setMode(ii(t,"mode",1)),this.isRunning=ii(t,"isRunning",!1),this.setMagnitudeMode(ii(t,"magnitudeMode",1)),this.setDuration(ii(t,"duration",500)),this.setMagnitude(ii(t,"magnitude",10)),this.ox=ii(t,"ox",void 0),this.oy=ii(t,"oy",void 0),this}},{key:"toJSON",value:function(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}},{key:"shutdown",value:function(t){this.isShutdown||(k(y(s.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0)}},{key:"startTicking",value:function(){k(y(s.prototype),"startTicking",this).call(this),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.events.on("preupdate",this.update,this)}},{key:"stopTicking",value:function(){k(y(s.prototype),"stopTicking",this).call(this),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.events.off("preupdate",this.update,this))}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setMode",value:function(t){return"string"==typeof t&&(t=si[t]),this.mode=t,this}},{key:"setMagnitudeMode",value:function(t){return"string"==typeof t&&(t=ri[t]),this.magnitudeMode=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setMagnitude",value:function(t){return this.magnitude=t,this}},{key:"start",value:function(t,e){if("number"!=typeof t){var i=t;e=ii(i,"magnitude",void 0),t=ii(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),k(y(s.prototype),"start",this).call(this),this}},{key:"shake",value:function(t,e){return this.start(t,e),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var n=this.magnitude;1===this.magnitudeMode&&(n*=1-this.timer.t);var s=Math.random()*Math.PI*2,r=Math.cos(s)*n,a=Math.sin(s)*n;i.setPosition(this.ox+r,this.oy+a)}return this}},{key:"backToOrigin",value:function(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;return this.ox===t.x&&this.oy===t.y||(t.setPosition(this.ox,this.oy),this.ox=void 0,this.oy=void 0),this}}]),s}(),si={effect:0,behavior:1},ri={constant:0,decay:1},ai=Phaser.Utils.Objects.IsPlainObject,oi={shake:function(t,e,i){if(ai(t)){var n=t;t=n.duration,e=n.magnitude,i=n.magnitudeMode}var s,r;return void 0===this._shake&&(this._shake=new ni(this,{mode:0,magnitudeMode:1}),(r=(s=this)._shake).completeEventName=void 0,r.on("complete",function(){r.completeEventName&&(s.emit(r.completeEventName,s),r.completeEventName=void 0)})),this._shake.completeEventName="shake.complete",void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise:function(t,e){return this.shake(t,e),ee(this._shake)}},hi=function(t,e){t&&(it(t).hidden=e,t.rexContainer.parent.setChildVisible(t,!e))},ui={show:function(t){return void 0===t&&(t=this),hi(t,!1),this},hide:function(t){return void 0===t&&(t=this),hi(t,!0),this},isShow:function(t){return void 0===t&&(t=this),!!(e=t)&&!it(e).hidden;var e}},li=void 0,ci=function(n){return n?function(t,e,i){return!!he(t)&&(n(t,e,i),!0)}:he},di=function(t){return t},vi={},fi=Phaser.Display.Align.CENTER,pi=Phaser.Utils.Objects.GetValue,yi=function(){p(s,$t);var n=m(s);function s(t,e){var i;return v(this,s),(i=n.call(this,t,e))._enable=void 0,t.setInteractive(pi(e,"inputConfig",void 0)),i.resetFromJSON(e),i.boot(),i}return f(s,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(pi(t,"enable",!0)),this.setMode(pi(t,"mode",1)),this.setClickInterval(pi(t,"clickInterval",100)),this.setDragThreshold(pi(t,"threshold",void 0)),this}},{key:"boot",value:function(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointeroutr",this.onOut,this)}},{key:"shutdown",value:function(t){this.isShutdown||(this.pointer=null,k(y(s.prototype),"shutdown",this).call(this,t))}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel();var e=(this._enable=t)?"enable":"disable";this.emit(e,this,this.parent)}}},{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:"setMode",value:function(t){return"string"==typeof t&&(t=gi[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"onPress",value:function(t,e,i,n){void 0===this.pointer&&(this.pointer=t,0===this.mode&&this.click(t.downTime,t,n))}},{key:"onRelease",value:function(t,e,i,n){this.pointer===t&&(1===this.mode&&this.click(t.upTime,t,n),this.pointer=void 0)}},{key:"onPointOut",value:function(t){this.pointer===t&&this.cancel()}},{key:"onMove",value:function(t){this.pointer===t&&void 0!==this.dragThreshold&&t.getDistance()>=this.dragThreshold&&this.cancel()}},{key:"click",value:function(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var n=this.lastClickTime;return void 0!==n&&t-n<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}},{key:"onOver",value:function(t,e,i,n){return this.enable&&this.emit("over",this,this.parent,t,n),this}},{key:"onOut",value:function(t,e){return this.enable&&this.emit("out",this,this.parent,t,e),this}}]),s}(),gi={press:0,pointerdown:0,release:1,pointerup:1},mi={onClick:function(t,e,i){return t&&(void 0===this._click&&(this._click=new yi(this,i)),this._click.on("click",t,e)),this},offClick:function(t,e){return void 0===this._click||this._click.off("click",t,e),this},enableClick:function(t){return void 0===this._click||this._click.setEnable(t),this},disableClick:function(){return void 0===this._click||this._click.setEnable(!1),this}},ki=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetValue,Ci=function(t,e,i,n){var s=this._childrenInteractive,r=de(s.targetSizers,t.x,t.y),a=s.lastOverChild;r&&a&&r===a||(s.lastOverChild=r,ve(s.eventEmitter,"".concat(s.eventNamePrefix,"out"),s.targetSizers,a,void 0,t,n),ve(s.eventEmitter,"".concat(s.eventNamePrefix,"over"),s.targetSizers,r,void 0,t,n))},Si=function(t,e){var i=this._childrenInteractive,n=i.lastOverChild;i.lastOverChild=null,ve(i.eventEmitter,"".concat(i.eventNamePrefix,"out"),i.targetSizers,n,void 0,t,e)},Pi=Phaser.Utils.Objects.GetValue,wi=function(){p(r,me);var s=m(r);function r(t,e){var i;v(this,r);var n=Vt(t);return n===t&&(t=void 0),((i=s.call(this,n,e)).gameObject=t)&&t.setInteractive(Pi(e,"inputConfig",void 0)),i._enable=void 0,i.resetFromJSON(e),i.boot(),i}return f(r,[{key:"resetFromJSON",value:function(t){return this.setEnable(Pi(t,"enable",!0)),this.setDetectBounds(),void 0===this.gameObject?this.setDetectBounds(Pi(t,"bounds",void 0)):this.setDetectBounds(),this.tracerState=xi,this.pointer=void 0,this.lastPointer=void 0,this.movedState=!1,this.isTouchingAnyObject=!1,this}},{key:"boot",value:function(){k(y(r.prototype),"boot",this).call(this),this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.events.once("shutdown",this.destroy,this)}},{key:"shutdown",value:function(t){this.scene&&(this.gameObject||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("shutdown",this.destroy,this),this.gameObject=void 0,this.bounds=void 0,this.pointer=void 0,this.lastPointer=void 0,this.movedState=!1,k(y(r.prototype),"shutdown",this).call(this,t))}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setDetectBounds",value:function(t){return this.bounds=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(t,e){this.enable&&void 0===this.pointer&&(this.bounds&&!this.bounds.contains(t.x,t.y)||this.pointer===t||(this.pointer=t,this.lastPointer=t,this.movedState=!1,this.tracerState=Ei,void 0===this.gameObject&&(this.isTouchingAnyObject=0<e.length),this.onDragStart()))}},{key:"onPointerUp",value:function(t){this.enable&&(this.bounds&&!this.bounds.contains(t.x,t.y)||this.pointer!==t||(this.pointer=void 0,this.movedState=!1,this.tracerState=xi,this.onDragEnd()))}},{key:"onPointerMove",value:function(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}},{key:"dragCancel",value:function(){return this.tracerState===Ei&&this.onDragEnd(),this.pointer=void 0,this.tracerState=xi,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this)}},{key:"onDragEnd",value:function(){this.emit("dragend",this)}},{key:"onDrag",value:function(){this.emit("drag",this)}},{key:"preUpdate",value:function(){}},{key:"postUpdate",value:function(){}},{key:"startTicking",value:function(){k(y(r.prototype),"startTicking",this).call(this),this.scene.events.on("preupdate",this.preUpdate,this),this.scene.events.on("postupdate",this.postUpdate,this)}},{key:"stopTicking",value:function(){k(y(r.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.events.off("preupdate",this.preUpdate,this),this.scene.events.off("postupdate",this.postUpdate,this))}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t}},{key:"cancel",value:function(){return this.state=Oi,this}}]),r}(),xi=0,Ei=1,Oi="IDLE",_i=function(){function a(t){v(this,a);var e=fe(t,"states",void 0);e&&this.addStates(e);var i=fe(t,"extend",void 0);if(i)for(var n in i)this.hasOwnProperty(n)&&void 0!==this[n]||(this[n]=i[n]);var s=fe(t,"eventEmitter",void 0),r=fe(t,"EventEmitterClass",void 0);this.setEventEmitter(s,r),this._stateLock=!1,this.resetFromJSON(t)}return f(a,[{key:"shutdown",value:function(){this.destroyEventEmitter()}},{key:"destroy",value:function(){this.shutdown()}},{key:"resetFromJSON",value:function(t){this.setEnable(fe(t,"enable",!0)),this.start(fe(t,"start",void 0));var e=fe(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,i=this[e];i&&i.call(this),this.emit(e,this)}if(this._stateLock=!1,null!=this._state){var n="enter_"+this._state,s=this[n];s&&s.call(this),this.emit(n,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:"addState",value:function(t,e){var i=fe(e,"next",void 0);i&&(this["next_"+t]=i);var n=fe(e,"exit",void 0);n&&(this["exit_"+t]=n);var s=fe(e,"enter",void 0);return s&&(this["enter_"+t]=s),this}},{key:"addStates",value:function(t){for(var e in t)this.addState(e,t[e]);return this}},{key:"update",value:function(t,e,i){void 0===i&&(i="update");var n=this[i+"_"+this.state];n&&n.call(this,t,e)}},{key:"preupdate",value:function(t,e){this.update(t,e,"preupdate")}},{key:"postupdate",value:function(t,e){this.update(t,e,"postupdate")}}]),a}();Object.assign(_i.prototype,Kt);var Di=Phaser.Utils.Objects.GetValue,Ti=Phaser.Math.Distance.Between,Mi=function(){p(a,wi);var r=m(a);function a(t,e){var i;v(this,a);var n=g(i=r.call(this,t,e)),s={states:{IDLE:{enter:function(){n.stop(),n.tapsCount=0,n.x=0,n.y=0,n.worldX=0,n.worldY=0},exit:function(){var t=n.lastPointer;n.x=t.x,n.y=t.y,n.worldX=t.worldX,n.worldY=t.worldY}},BEGIN:{enter:function(){n.start(),n.tapsCount=0,n.emit("tappingstart",n,n.gameObject,n.lastPointer)}},RECOGNIZED:{enter:function(){n.start(),n.emit("tap",n,n.gameObject,n.lastPointer),n.emit("".concat(n.tapsCount,"tap"),n,n.gameObject,n.lastPointer)}}},init:function(){this.state=Ri},eventEmitter:!1};return i.setRecongizedStateObject(new _i(s)),i}return f(a,[{key:"resetFromJSON",value:function(t){k(y(a.prototype),"resetFromJSON",this).call(this,t),this.setHoldTime(Di(t,"time",250)),this.setTapInterval(Di(t,"tapInterval",200)),this.setDragThreshold(Di(t,"threshold",9)),this.setTapOffset(Di(t,"tapOffset",10));var e=Di(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Di(t,"maxTaps",void 0)),this.setMinTaps(Di(t,"minTaps",void 0))),this}},{key:"onDragStart",value:function(){switch(this.state){case Ri:this.state=zi;break;case zi:var t=this.lastPointer;Ti(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Ai,this.state=zi);break;case Ai:this.state=zi}}},{key:"onDragEnd",value:function(){this.state===zi&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Ai))}},{key:"onDrag",value:function(){this.state!==Ri&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Ri)}},{key:"preUpdate",value:function(t){if(this.isRunning&&this.enable&&this.state===zi){var e=this.lastPointer;if(e.isDown)t-e.downTime>this.holdTime&&(this.state=Ri);else t-e.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Ai:this.state=Ri)}}},{key:"postUpdate",value:function(){this.isRunning&&this.enable&&this.state===Ai&&(this.state=Ri)}},{key:"isTapped",get:function(){return this.state===Ai}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setTapInterval",value:function(t){return this.tapInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setTapOffset",value:function(t){return this.tapOffset=t,this}},{key:"setMaxTaps",value:function(t){return this.maxTaps=t,this}},{key:"setMinTaps",value:function(t){return this.minTaps=t,this}},{key:"setTaps",value:function(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}]),a}(),Ri="IDLE",zi="BEGIN",Ai="RECOGNIZED",Xi=Phaser.Utils.Objects.GetValue,Yi=function(){p(a,wi);var r=m(a);function a(t,e){var i;v(this,a);var n=g(i=r.call(this,t,e)),s={states:{IDLE:{enter:function(){n.x=0,n.y=0,n.worldX=0,n.worldY=0},exit:function(){var t=n.lastPointer;n.x=t.x,n.y=t.y,n.worldX=t.worldX,n.worldY=t.worldY}},BEGIN:{enter:function(){n.start()},exit:function(){n.stop()}},RECOGNIZED:{enter:function(){n.emit("pressstart",n,n.gameObject,n.lastPointer)},exit:function(){n.emit("pressend",n,n.gameObject,n.lastPointer)}}},init:function(){this.state=ji},eventEmitter:!1};return i.setRecongizedStateObject(new _i(s)),i}return f(a,[{key:"resetFromJSON",value:function(t){return k(y(a.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Xi(t,"threshold",9)),this.setHoldTime(Xi(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=Vi,0===this.holdTime&&(this.state=Fi)}},{key:"onDragEnd",value:function(){this.state=ji}},{key:"onDrag",value:function(){this.state!==ji&&this.pointer.getDistance()>this.dragThreshold&&(this.state=ji)}},{key:"preUpdate",value:function(t){this.isRunning&&this.enable&&this.state===Vi&&t-this.pointer.downTime>=this.holdTime&&(this.state=Fi)}},{key:"isPressed",get:function(){return this.state===Fi}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),a}(),ji="IDLE",Vi="BEGIN",Fi="RECOGNIZED";Phaser.Utils.Objects.GetValue;var Ni=Phaser.Math.Distance.Between,Ii=Phaser.Math.Angle.Between,Li={getDt:function(){return this.scene.sys.game.loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Ni(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Ii(e.x,e.y,t.x,t.y)}},Ui={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Wi={},Gi=Phaser.Utils.Objects.GetValue,Hi=Phaser.Math.RadToDeg,Bi=function(){p(a,wi);var r=m(a);function a(t,e){var i;v(this,a);var n=g(i=r.call(this,t,e)),s={states:{IDLE:{enter:function(){n.x=0,n.y=0,n.worldX=0,n.worldY=0},exit:function(){var t=n.lastPointer;n.x=t.x,n.y=t.y,n.worldX=t.worldX,n.worldY=t.worldY}},BEGIN:{enter:function(){n.validDrag=!1}},RECOGNIZED:{enter:function(){n.start(),n.updateDirectionStates(),n.emit("swipe",n,n.gameObject,n.lastPointer)},exit:function(){n.stop(),n.clearDirectionStates()}}},init:function(){this.state=Zi},eventEmitter:!1};return i.setRecongizedStateObject(new _i(s)),i.clearDirectionStates(),i}return f(a,[{key:"resetFromJSON",value:function(t){return k(y(a.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Gi(t,"threshold",10)),this.setVelocityThreshold(Gi(t,"velocityThreshold",1e3)),this.setDirectionMode(Gi(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=Ki}},{key:"onDragEnd",value:function(){this.state=Zi}},{key:"onDrag",value:function(){this.state===Ki&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=qi))}},{key:"postUpdate",value:function(){this.isRunning&&this.enable&&this.state===qi&&(this.state=Zi)}},{key:"isSwiped",get:function(){return this.state===qi}},{key:"dragVelocity",get:function(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setVelocityThreshold",value:function(t){return this.velocityThreshold=t,this}},{key:"setDirectionMode",value:function(t){return"string"==typeof t&&(t=Ui[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Wi),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:90<t&&t<=270?i.left=!0:i.right=!0;break;case 2:45<t&&t<=135?i.down=!0:135<t&&t<=225?i.left=!0:225<t&&t<=315?i.up=!0:i.right=!0;break;case 3:22.5<t&&t<=67.5?(i.down=!0,i.right=!0):67.5<t&&t<=112.5?i.down=!0:112.5<t&&t<=157.5?(i.down=!0,i.left=!0):157.5<t&&t<=202.5?i.left=!0:202.5<t&&t<=247.5?(i.left=!0,i.up=!0):247.5<t&&t<=292.5?i.up=!0:(292.5<t&&t<=337.5&&(i.up=!0),i.right=!0)}}(Hi(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}]),a}();Object.assign(Bi.prototype,Li);function Ji(t){if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e]}var Zi="IDLE",Ki="BEGIN",qi="RECOGNIZED",Qi=Phaser.Utils.Objects.GetValue,$i=Phaser.Utils.Array.SpliceOne,tn=Phaser.Math.Distance.Between,en=Phaser.Math.Angle.Between,nn=function(){function n(t,e){v(this,n);var i=t.input.manager.pointersTotal-1;i<2&&t.input.addPointer(2-i),this.scene=t,this.setEventEmitter(Qi(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}return f(n,[{key:"resetFromJSON",value:function(t){return this.setEnable(Qi(t,"enable",!0)),this.bounds=Qi(t,"bounds",void 0),this.tracerState=rn,this.pointers.length=0,Ji(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.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Ji(this.movedState),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("shutdown",this.destroy,this),this.scene=void 0)}},{key:"destroy",value:function(){this.shutdown()}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{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:"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 rn:this.tracerState=an,this.onDrag1Start();break;case an:this.tracerState=on,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],$i(this.pointers,e),this.tracerState){case an:this.tracerState=rn,this.onDrag1End();break;case on:this.tracerState=an,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),i=-1!==this.pointers.indexOf(t);if(i||!e)if(i&&!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 an:this.onDrag1();break;case on:this.onDrag2()}}}},{key:"dragCancel",value:function(){return this.tracerState===on&&this.onDrag2End(),this.pointers.length=0,Ji(this.movedState),this.tracerState=rn,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:"distanceBetween",get:function(){if(this.tracerState!==on)return 0;var t=this.pointers[0],e=this.pointers[1];return tn(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==on)return 0;var t=this.pointers[0],e=this.pointers[1];return en(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,i=t.prevPosition;sn.x=e.x-i.x,sn.y=e.y-i.y}else sn.x=0,sn.y=0;return sn}},{key:"centerX",get:function(){if(this.tracerState!==on)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!==on)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!==on)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!==on)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:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t}},{key:"cancel",value:function(){return this.state=hn,this}}]),n}();Object.assign(nn.prototype,Kt);var sn={},rn=0,an=1,on=2,hn="IDLE";Phaser.Utils.Objects.GetValue;function un(t,e,i,n){return ln(t,e,i,n),t.rotation+=n,t}var ln=Phaser.Math.RotateAround,cn={},dn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.Angle.WrapDegrees,fn=Phaser.Math.Angle.ShortestBetween,pn=Phaser.Math.RadToDeg,yn=Phaser.Math.DegToRad,gn=function(){p(a,nn);var r=m(a);function a(t,e){var i;v(this,a);var n=g(i=r.call(this,t,e)),s={states:{IDLE:{enter:function(){n.prevAngle=void 0,n.angle=0}},BEGIN:{},RECOGNIZED:{enter:function(){n.emit("rotatestart",n)},exit:function(){n.emit("rotateend",n)}}},init:function(){this.state=bn},eventEmitter:!1};return i.setRecongizedStateObject(new _i(s)),i}return f(a,[{key:"resetFromJSON",value:function(t){return k(y(a.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(dn(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=vn(pn(this.angleBetween)),this.state=Cn,0===this.dragThreshold&&(this.state=Sn)}},{key:"onDrag2End",value:function(){this.state=bn}},{key:"onDrag2",value:function(){switch(this.state){case Cn:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=vn(pn(this.angleBetween));this.angle=fn(this.prevAngle,t),this.prevAngle=t,this.state=Sn}break;case Sn:t=vn(pn(this.angleBetween));this.angle=fn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}},{key:"isRotated",get:function(){return this.state===Sn}},{key:"rotation",get:function(){return yn(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),a}(),mn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,n=this.movementCenterY;e.getWorldPoint(this.centerX,this.centerY,cn);var s=cn.x,r=cn.y,a=this.rotation;if(Array.isArray(t))for(var o=t,h=0,u=o.length;h<u;h++)(t=o[h]).x+=i,t.y+=n,un(t,s,r,a);else t.x+=i,t.y+=n,un(t,s,r,a);return this}};Object.assign(gn.prototype,mn);function kn(t,e){return t.setInteractive(),t._childrenInteractive={targetSizers:En(e,"targets",[t]),eventEmitter:En(e,"eventEmitter",t),eventNamePrefix:En(e,"inputEventPrefix","child.")},function(t){var e=ki(t,"click",void 0);if(!1!==e){void 0===e&&(e={}),e.hasOwnProperty("threshold")||(e.threshold=10);var s=this._childrenInteractive;this._click=new yi(this,e),this._click.on("click",function(t,e,i,n){ve(s.eventEmitter,"".concat(s.eventNamePrefix,"click"),s.targetSizers,i.x,i.y,i,n)},this)}}.call(t,e),function(t){!1!==bi(t,"over",void 0)&&this.on("pointermove",Ci,this).on("pointerover",Ci,this).on("pointerout",Si,this)}.call(t,e),function(t){var e=Pn(t,"tap",void 0);if(!1!==e){var n=this._childrenInteractive;this._tap=new Mi(this,e),this._tap.on("tap",function(t,e,i){ve(n.eventEmitter,"".concat(n.eventNamePrefix).concat(t.tapsCount,"tap"),n.targetSizers,t.x,t.y,i)},this)}}.call(t,e),function(t){var e=wn(t,"press",void 0);if(!1!==e){var n=this._childrenInteractive;this._press=new Yi(this,e),this._press.on("pressstart",function(t,e,i){ve(n.eventEmitter,"".concat(n.eventNamePrefix,"pressstart"),n.targetSizers,t.x,t.y,i)},this).on("pressend",function(t,e,i){ve(n.eventEmitter,"".concat(n.eventNamePrefix,"pressend"),n.targetSizers,t.x,t.y,i)},this)}}.call(t,e),function(t){var e=xn(t,"swipe",void 0);if(!1!==e){void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var s=this._childrenInteractive;this._swipe=new Bi(this,e),this._swipe.on("swipe",function(t,e,i){var n=t.left?"left":t.right?"right":t.up?"up":"down";ve(s.eventEmitter,"".concat(s.eventNamePrefix,"swipe").concat(n),s.targetSizers,t.x,t.y,i)},this)}}.call(t,e),t}var bn="IDLE",Cn="BEGIN",Sn="RECOGNIZED",Pn=Phaser.Utils.Objects.GetValue,wn=Phaser.Utils.Objects.GetValue,xn=Phaser.Utils.Objects.GetValue,En=Phaser.Utils.Objects.GetValue,On={getSizerConfig:it,getChildPrevState:function(t){var e=it(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=function(t,e){void 0===e&&(void 0===st&&(st=new Phaser.Geom.Rectangle),e=st);var i=t.game.config;return e.setTo(0,0,i.width,i.height),e}(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,n,s,r,a=t.scene;if("number"==typeof e)i=e;else{i=Ft(e,"color",16777215);var o=Ft(e,"name",!1);o&&(n=Ft(o,"createTextCallback",It),s=Ft(o,"createTextCallbackScope",void 0),"string"==typeof(r=Ft(o,"align","left-top"))&&(r=at[r]))}if(n&&!t.children){t.children=new Nt(a),t.once("destroy",function(t,e){t.children.destroy(!e),t.children=void 0});var h=t.clear.bind(t);t.clear=function(){h(),t.children.clear(!1,!0)}}for(var u,l,c=this.getAllShownChildren([this]),d=0,v=c.length;d<v;d++)(u=c[d]).getBounds&&(i&&t.lineStyle(1,i).strokeRectShape(u.getBounds(Lt)),u.name&&n&&(l=s?n.call(s,a):n(a))&&(l.setText(u.name),t.children.add(l),Mt(l,Lt.x,Lt.y,Lt.width,Lt.height,r)));return this},resolveWidth:function(t){return void 0===t&&(t=Math.max(this.childrenWidth,this.minWidth)),t},resolveChildrenWidth:function(t){var e,i;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(i=this.getExpandedChildWidth(e,t),i=e.resolveWidth(i),e.resolveChildrenWidth(i))},resolveHeight:function(t){var e=Math.max(this.childrenHeight,this.minHeight);return void 0===t&&(t=e),t},getChildWidth:function(t){return t.isRexSizer?Math.max(t.minWidth,t.childrenWidth):void 0!==t.minWidth?t.minWidth:ht(t)},getChildHeight:function(t){return t.isRexSizer?Math.max(t.minHeight,t.childrenHeight):void 0!==t.minHeight?t.minHeight:ut(t)},getExpandedChildWidth:function(t,e){return e},getExpandedChildHeight:function(t,e){return e},getChildrenWidth:function(){return 0},getChildrenHeight:function(){return 0},addChildrenMap:At,addElement:At,getElement:function(t,e){if("string"==typeof t&&(t=t.split(".")),0!==t.length){var i=t.shift(),n=null;if("#"===i.charAt(0))i=i.substring(1),n=this.getByName(i,e);else if(-1===i.indexOf("["))this.childrenMap&&(n=this.childrenMap[i]);else{var s=i.match(Ht);if(null!=s&&this.childrenMap){var r=this.childrenMap[s[1]];r&&(n=r[s[2]])}}return 0===t.length?n:n&&n.childrenMap?n.getElement(t):null}},getAllChildrenSizers:function(t){void 0===t&&(t=[]);for(var e=t.length,i=this.getChildrenSizers(t),n=t.length,s=e;s<n;s++)i[s].getAllChildrenSizers(t);return t},getChildrenSizers:function(t){return void 0===t&&(t=[]),t},preLayout:function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,n=e.length;i<n;i++)(t=e[i]).ignoreLayout||t.preLayout()},layout:function(){return this.runLayout(),this},runLayout:function(t,e,i){if(this.ignoreLayout)return this;var n=!t;return n&&this.preLayout(),e=this.resolveWidth(e),n&&(this.resolveChildrenWidth(e),this.runWidthWrap(e)),i=this.resolveHeight(i),this.resize(e,i),this.sizerEventsEnable&&void 0===this.layoutedChildren&&(this.layoutedChildren=[]),this.layoutChildren(),this.layoutBackgrounds(),this.sizerEventsEnable&&(this.emit("postlayout",this.layoutedChildren,this),this.layoutedChildren.length=0),this.postLayout()},layoutChildren:function(){},runWidthWrap:function(t){var e,i;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer&&(i=e.resolveWidth(i)),e.runWidthWrap(i));return this},layoutBackgrounds:function(){if(void 0!==this.backgroundChildren)for(var t,e,i,n,s,r,a,o=this.backgroundChildren,h=this.left,u=this.top,l=this.width,c=this.height,d=0,v=o.length;d<v;d++)(e=(t=o[d]).rexSizer).hidden||(i=e.padding,le.call(this,t),n=h+i.left,s=u+i.top,r=l-i.left-i.right,a=c-i.top-i.bottom,ue(t,r,a),ce.call(this,t,n,s,r,a,fi))},postLayout:function(){return this._anchor&&this._anchor.updatePosition(),this},setAnchor:function(t){void 0===t&&(t={});var n=t.hasOwnProperty("width"),s=t.hasOwnProperty("height"),e=t.hasOwnProperty("onResizeCallback");return!n&&!s||e||(t.onResizeCallback=function(t,e,i){n&&i.setMinWidth(t),s&&i.setMinHeight(e),i.layout()}),void 0===this._anchor?this._anchor=new ye(this,t):this._anchor.resetFromJSON(t),this},isInTouching:function(t,e){return void 0===e&&(e=this),function(t,e,i,n){if(e)return ae(t,e.x,e.y,i,n);for(var s=t.scene.input.manager,r=s.pointersTotal,a=s.pointers,o=0;o<r;o++)if(e=a[o],ae(t,e.x,e.y,i,n))return!0;return!1}(e,t)},pointToChild:function(t,e,i,n,s){var r;if((r=i)&&"function"==typeof r||(s=i,n=i=void 0),void 0===s&&(s=this.sizerChildren?this.sizerChildren:this.children),O(s)){for(var a,o=0,h=s.length;o<h;o++)if(a=s[o],oe(a,t,e,i,n))return a}else for(var u in s)if(a=s[u],oe(a,t,e,i,n))return a;return null},setDraggable:function(s,t){var e=r(s);return"string"===e?s=this.getElement(s):void 0!==s&&"object"==e||(t=s,s=this),void 0===t&&(t=!0),s.input&&s.input.hasOwnProperty("draggable")?s.input.draggable=t:t&&(s.setInteractive(),s.scene.input.setDraggable(s),s.on("drag",function(t,e,i){var n=this.getTopmostSizer();n.x+=e-s.x,n.y+=i-s.y},this)),this},setChildrenInteractive:function(t){return kn(this,t),this},broadcastEvent:function(){for(var t=this.getAllChildren([this]),e=0,i=t.length;e<i;e++){var n=t[e];n.emit.apply(n,arguments)}return this}};Object.assign(On,Jt,Gt,{removeFromParentSizer:function(){var t=this.getParentSizer();return t&&t.remove(this),this}},{getParentSizer:function(t){return this.getParent(t)},getTopmostSizer:function(t){return this.getTopmostParent(t)}},Fe,Be,ei,oi,mi,ui,Zt);var _n=Phaser.Utils.Objects.GetValue,Dn=function(){p(u,et);var h=m(u);function u(t,e,i,n,s,r){var a;v(this,u),(a=h.call(this,t,e,i,2,2)).isRexSizer=!0,a.setMinSize(n,s),a.setName(_n(r,"name","")),a.rexSizer={},a.space={},a.backgroundChildren=void 0,a.sizerChildren=void 0,a.layoutedChildren=void 0;var o=_n(r,"anchor",void 0);return o&&a.setAnchor(o),a.setInnerPadding(_n(r,"space",0)),a.setDraggable(_n(r,"draggable",!1)),a.setSizerEventsEnable(_n(r,"sizerEvents",!1)),a.setDirty(!0),a}return f(u,[{key:"destroy",value:function(t){if(this.scene){if(t)for(var e=this.getAllChildrenSizers([this]),i=0,n=e.length;i<n;i++)e[i].sizerEventsEnable=!1;k(y(u.prototype),"destroy",this).call(this,t),this.backgroundChildren=void 0,this.sizerChildren=void 0,this.childrenMap=void 0,this.space=void 0,this.rexSizer=void 0,this.layoutedChildren=void 0}}},{key:"setMinSize",value:function(t,e){return this.setMinWidth(t).setMinHeight(e),this}},{key:"setMinWidth",value:function(t){return null==t&&(t=0),this.minWidth=t,this}},{key:"setMinHeight",value:function(t){return null==t&&(t=0),this.minHeight=t,this}},{key:"setDirty",value:function(t){return void 0===t&&(t=!0),this.dirty=t,this}},{key:"setSizerEventsEnable",value:function(t){return void 0===t&&(t=!0),this.sizerEventsEnable=t,this}},{key:"ignoreLayout",get:function(){return this.rexSizer.hidden||!this.dirty}},{key:"childrenWidth",get:function(){return void 0===this._childrenWidth&&(this._childrenWidth=this.getChildrenWidth()),this._childrenWidth}},{key:"childrenHeight",get:function(){return void 0===this._childrenHeight&&(this._childrenHeight=this.getChildrenHeight()),this._childrenHeight}},{key:"left",get:function(){return this.x-ht(this)*this.originX},set:function(t){this.x+=t-this.left}},{key:"alignLeft",value:function(t){return this.left=t,this}},{key:"right",get:function(){return this.left+ht(this)},set:function(t){this.x+=t-this.right}},{key:"alignRight",value:function(t){return this.right=t,this}},{key:"centerX",get:function(){return this.left+ht(this)/2},set:function(t){this.x+=t-this.centerX}},{key:"alignCenterX",value:function(t){return this.centerX=t,this}},{key:"top",get:function(){return this.y-ut(this)*this.originY},set:function(t){this.y+=t-this.top}},{key:"alignTop",value:function(t){return this.top=t,this}},{key:"bottom",get:function(){return this.top+ut(this)},set:function(t){this.y+=t-this.bottom}},{key:"alignBottom",value:function(t){return this.bottom=t,this}},{key:"centerY",get:function(){return this.top+ut(this)/2},set:function(t){this.y+=t-this.centerY}},{key:"alignCenterY",value:function(t){return this.centerY=t,this}},{key:"innerLeft",get:function(){return this.left+this.space.left}},{key:"innerRight",get:function(){return this.right-this.space.right}},{key:"innerTop",get:function(){return this.top+this.space.top}},{key:"innerBottom",get:function(){return this.bottom-this.space.bottom}},{key:"innerWidth",get:function(){return this.width-this.space.left-this.space.right}},{key:"innerHeight",get:function(){return this.height-this.space.top-this.space.bottom}},{key:"minInnerWidth",get:function(){var t=this.minWidth-this.space.left-this.space.right;return Math.max(t,0)}},{key:"minInnerHeight",get:function(){var t=this.minHeight-this.space.top-this.space.bottom;return Math.max(t,0)}}]),u}();Object.assign(Dn.prototype,On);var Tn=Phaser.Utils.Objects.IsPlainObject,Mn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Display.Align.CENTER,zn=Phaser.Utils.String.UUID,An={add:function(t,e,i,n,s,r,a,o,h){zt.call(this,t),Tn(e)&&(e=Mn(u=e,"key",void 0),i=Mn(u,"align",Rn),o=Mn(u,"offsetX",0),h=Mn(u,"offsetY",0),n=Mn(u,"padding",0),s=Mn(u,"expand",!0),t.isRexSizer||(r=Mn(u,"minWidth",t._minWidth),a=Mn(u,"minHeight",t._minHeighted)));var u,l=void 0!==e;return l||(e=zn()),"string"==typeof i&&(i=at[i]),void 0===i&&(i=Rn),void 0===o&&(o=0),void 0===h&&(h=0),void 0===n&&(n=0),void 0===s&&(s=!0),t.isRexSizer||(void 0===r&&(r=t._minWidth),void 0===a&&(a=t._minHeight)),(u=this.getSizerConfig(t)).align=i,u.alignOffsetX=o,u.alignOffsetY=h,u.padding=Rt(n),Tn(s)?(u.expandWidth=Mn(s,"width",!1),u.expandHeight=Mn(s,"height",!1)):(u.expandWidth=s,u.expandHeight=s),t.isRexSizer||(u.expandWidth?t.minWidth=void 0===r?ht(t):r:t.minWidth=void 0,u.expandHeight?t.minHeight=void 0===a?ut(t):a:t.minHeight=void 0),this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,l&&this.addChildrenMap(e,t),this}},Xn=Phaser.Utils.Array.Remove,Yn=et.prototype.remove,jn=et.prototype.clear,Vn={remove:function(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),function(t,e){return this.isBackground(t)&&Xn(this.backgroundChildren,t),Yn.call(this,t,e),!e&&this.sizerEventsEnable&&(t.emit("sizer.remove",t,this),this.emit("remove",t,this)),this}.call(this,t,e),this},removeAll:function(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear:function(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),jn.call(this,t),i)for(var n,s=0,r=e.length;s<r;s++)(n=e[s]).emit("sizer.remove",n,this),this.emit("remove",n,this);return this}.call(this,t),this}},Fn={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,s=this.sizerChildren;for(var r in s)e=(t=s[r]).rexSizer.padding,i=this.getChildWidth(t)+e.left+e.right,n=Math.max(i,n);return n+this.space.left+this.space.right},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,s=this.sizerChildren;for(var r in s)i=(t=s[r]).isRexSizer?Math.max(t.minHeight,t.childrenHeight):void 0!==t.minHeight?t.minHeight:ut(t),i+=(e=t.rexSizer.padding).top+e.bottom,n=Math.max(i,n);return n+this.space.top+this.space.bottom},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width);var n=t.rexSizer;if(n.expandWidth){var s=e-this.space.left-this.space.right,r=n.padding;i=s-r.left-r.right}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer;if(n.expandHeight){var s=e-this.space.top-this.space.bottom,r=n.padding;i=s-r.top-r.bottom}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var n in i)(e=i[n]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,n,s,r,a,o,h,u,l,c=this.innerLeft,d=this.innerTop,v=this.innerWidth,f=this.innerHeight,p=this.sizerChildren;for(var y in p)(t=p[y]).rexSizer.hidden||(i=(e=t.rexSizer).padding,le.call(this,t),t.isRexSizer?(t.runLayout(this,this.getExpandedChildWidth(t),this.getExpandedChildHeight(t)),l=this,(u=t).width<u.childrenWidth&&console.warn("Layout width error: Parent=".concat(l.constructor.name,", Child=").concat(u.constructor.name)),u.height<u.childrenHeight&&console.warn("Layout height error: Parent=".concat(l.constructor.name,", Child=").concat(u.constructor.name))):(h=o=void 0,e.expandWidth&&(o=v-i.left-i.right),e.expandHeight&&(h=f-i.top-i.bottom),ue(t,o,h)),n=c+i.left,r=v-i.left-i.right,s=d+i.top,a=f-i.top-i.bottom,ce.call(this,t,n,s,r,a,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(Fn,An,Vn);var Nn=Phaser.Utils.Objects.IsPlainObject,In=Phaser.Utils.Objects.GetValue,Ln=function(){p(h,Dn);var o=m(h);function h(t,e,i,n,s,r){var a;return v(this,h),Nn(e)?(e=In(r=e,"x",0),i=In(r,"y",0),n=In(r,"width",void 0),s=In(r,"height",void 0)):Nn(n)&&(n=In(r=n,"width",void 0),s=In(r,"height",void 0)),(a=o.call(this,t,e,i,n,s,r)).type="rexOverlapSizer",a.sizerChildren={},a.addChildrenMap("items",a.sizerChildren),a}return f(h,[{key:"childToKey",value:function(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}]),h}();Object.assign(Ln.prototype,Fn);var Un=Phaser.GameObjects.Components.TransformMatrix,Wn=new Un,Gn=new Un,Hn=new Un,Bn={camera:Wn,sprite:Gn,calc:Hn},Jn=Phaser.Renderer.Canvas.SetTransform,Zn={renderWebGL:function(t,e,i,n){e.updateData(),i.addToRenderList(e);var s,r,a,o,h,u,l=t.pipelines.set(e.pipeline),c=(s=e,r=i,a=n,o=Wn,u=Hn,(h=Gn).applyITRS(s.x,s.y,s.rotation,s.scaleX,s.scaleY),o.copyFrom(r.matrix),a?(o.multiplyWithOffset(a,-r.scrollX*s.scrollFactorX,-r.scrollY*s.scrollFactorY),h.e=s.x,h.f=s.y):(h.e-=r.scrollX*s.scrollFactorX,h.f-=r.scrollY*s.scrollFactorY),o.multiply(h,u),Bn),d=l.calcMatrix.copyFrom(c.calc),v=e._displayOriginX,f=e._displayOriginY,p=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var y=e.geom,g=0,m=y.length;g<m;g++)y[g].webglRender(l,d,p,v,f);t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,n){e.updateData(),i.addToRenderList(e);var s=t.currentContext;if(Jn(t,s,e,i,n)){for(var r=e._displayOriginX,a=e._displayOriginY,o=e.geom,h=0,u=o.length;h<u;h++)o[h].canvasRender(s,r,a);s.restore()}}},Kn=Phaser.GameObjects.Shape,qn=Phaser.Utils.Array.Remove,Qn=function(){p(o,Kn);var a=m(o);function o(t,e,i,n,s){var r;return v(this,o),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=n),(r=a.call(this,t,"rexShapes",[]))._width=-1,r._height=-1,r.dirty=!0,r.isSizeChanged=!0,r.shapes={},r.setPosition(e,i),r.setSize(n,s),r.updateDisplayOrigin(),r}return f(o,[{key:"width",get:function(){return this._width},set:function(t){this.setSize(t,this._height)}},{key:"height",get:function(){return this._height},set:function(t){this.setSize(this._width,t)}},{key:"setDirty",value:function(t){return void 0===t&&(t=!0),this.dirty=t,this}},{key:"setSize",value:function(t,e){this.isSizeChanged=this.isSizeChanged||this._width!==t||this._height!==e,this.dirty=this.dirty||this.isSizeChanged,this._width=t,this._height=e,this.updateDisplayOrigin();var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"setFillStyle",value:function(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.fillColor!==t||this.fillAlpha!==e,this.fillColor=t,this.fillAlpha=e,this}},{key:"setStrokeStyle",value:function(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.lineWidth!==t||this.strokeColor!==e||this.strokeAlpha!==i,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}},{key:"updateShapes",value:function(){}},{key:"updateData",value:function(){if(!this.dirty)return this;this.updateShapes();for(var t=this.geom,e=0,i=t.length;e<i;e++){var n=t[e];n.dirty&&n.updateData()}return this.dirty=!1,this.isSizeChanged=!1,this}},{key:"clear",value:function(){return this.geom.length=0,Ji(this.shapes),this}},{key:"getShape",value:function(t){return this.shapes[t]}},{key:"getShapes",value:function(){return this.geom}},{key:"addShape",value:function(t){this.geom.push(t);var e=t.name;return e&&(this.shapes[e]=t),this.dirty=!0,this}},{key:"deleteShape",value:function(t){var e=this.getShape(t);return e&&(delete this.shapes[t],qn(this.geom,e)),this}}]),o}();Object.assign(Qn.prototype,Zn);var $n={fillStyle:function(t,e){return void 0===t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return void 0===t||void 0===e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},ts={setData:function(t,e){return void 0===this.data&&(this.data={}),this.data[t]=e,this},getData:function(t,e){return void 0===this.data&&(this.data={}),this.data.hasOwnProperty(t)||(this.data[t]=e),this.data[t]}},es=function(){function t(){v(this,t),this.name=void 0,this.dirty=!0,this.data=void 0,this.isFilled=!1,this.fillColor=void 0,this.fillAlpha=1,this.isStroked=!1,this.lineWidth=1,this.strokeColor=void 0,this.strokeAlpha=1}return f(t,[{key:"setName",value:function(t){return this.name=t,this}},{key:"reset",value:function(){return this.fillStyle(),this.lineStyle(),this}},{key:"webglRender",value:function(){}},{key:"canvasRender",value:function(){}},{key:"updateData",value:function(){}}]),t}();Object.assign(es.prototype,$n,ts);function is(t,e,i,n){var s=i||e.fillColor,r=n||e.fillAlpha,a=(16711680&s)>>>16,o=(65280&s)>>>8,h=255&s;t.fillStyle="rgba("+a+","+o+","+h+","+r+")"}function ns(t,e,i,n){var s=i||e.strokeColor,r=n||e.strokeAlpha,a=(16711680&s)>>>16,o=(65280&s)>>>8,h=255&s;t.strokeStyle="rgba("+a+","+o+","+h+","+r+")",t.lineWidth=e.lineWidth}function ss(t,e,i){var n=i.length;if(2<=n){var s=i[n-2],r=i[n-1];if(t===s&&e===r)return i}return i.push(t,e),i}var rs=Phaser.Renderer.WebGL.Utils,as=Phaser.Renderer.WebGL.Utils,os=Phaser.Geom.Polygon.Earcut,hs=function(){p(i,es);var e=m(i);function i(){var t;return v(this,i),(t=e.call(this)).pathData=[],t.pathIndexes=[],t.closePath=!1,t}return f(i,[{key:"updateData",value:function(){return this.pathIndexes=os(this.pathData),this}},{key:"webglRender",value:function(t,e,i,n,s){this.isFilled&&function(t,e,i,n,s,r){for(var a=rs.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*n),o=i.pathData,h=i.pathIndexes,u=0;u<h.length;u+=3){var l=2*h[u],c=2*h[u+1],d=2*h[u+2],v=o[0+l]-s,f=o[1+l]-r,p=o[0+c]-s,y=o[1+c]-r,g=o[0+d]-s,m=o[1+d]-r,k=e.getX(v,f),b=e.getY(v,f),C=e.getX(p,y),S=e.getY(p,y),P=e.getX(g,m),w=e.getY(g,m);t.batchTri(i,k,b,C,S,P,w,0,0,1,1,a,a,a,2)}}(t,e,this,i,n,s),this.isStroked&&function(t,e,i,n,s){var r=t.strokeTint,a=as.getTintAppendFloatAlpha(e.strokeColor,e.strokeAlpha*i);r.TL=a,r.TR=a,r.BL=a,r.BR=a;var o=e.pathData,h=o.length-1,u=e.lineWidth,l=u/2,c=o[0]-n,d=o[1]-s;e.closePath||(h-=2);for(var v=2;v<h;v+=2){var f=o[v]-n,p=o[v+1]-s;t.batchLine(c,d,f,p,l,l,u,v-2,!!e.closePath&&v===h-1),c=f,d=p}}(t,this,i,n,s)}},{key:"canvasRender",value:function(t,e,i){var n=this.pathData,s=n.length-1,r=n[0]-e,a=n[1]-i;t.beginPath(),t.moveTo(r,a),this.closePath||(s-=2);for(var o=2;o<s;o+=2){var h=n[o]-e,u=n[o+1]-i;t.lineTo(h,u)}this.closePath&&t.closePath(),this.isFilled&&(is(t,this),t.fill()),this.isStroked&&(ns(t,this),t.stroke())}}]),i}(),us=Phaser.Math.DegToRad,ls=Phaser.Math.DegToRad,cs=function(){p(l,hs);var u=m(l);function l(t,e,i,n,s,r,a,o){var h;return v(this,l),void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=360),void 0===a&&(a=!1),void 0===o&&(o=!1),(h=u.call(this)).setCenterPosition(t,e),h.setRadius(i,n),h.setAngle(s,r,a),h.setPie(o),h.setIterations(32),h}return f(l,[{key:"x",get:function(){return this._x},set:function(t){this.dirty=this.dirty||this._x!==t,this._x=t}},{key:"y",get:function(){return this._y},set:function(t){this.dirty=this.dirty||this._y!==t,this._y=t}},{key:"setCenterPosition",value:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this}},{key:"radiusX",get:function(){return this._radiusX},set:function(t){this.dirty=this.dirty||this._radiusX!==t,this._radiusX=t}},{key:"radiusY",get:function(){return this._radiusY},set:function(t){this.dirty=this.dirty||this._radiusY!==t,this._radiusY=t}},{key:"setRadius",value:function(t,e){return void 0===e&&(e=t),this.radiusX=t,this.radiusY=e,this}},{key:"startAngle",get:function(){return this._startAngle},set:function(t){this.dirty=this.dirty||this._startAngle!==t,this._startAngle=t}},{key:"endAngle",get:function(){return this._endAngle},set:function(t){this.dirty=this.dirty||this._endAngle!==t,this._endAngle=t}},{key:"anticlockwise",get:function(){return this._anticlockwise},set:function(t){this.dirty=this.dirty||this._anticlockwise!==t,this._anticlockwise=t}},{key:"setAngle",value:function(t,e,i){return void 0===i&&(i=!1),this.startAngle=t,this.endAngle=e,this.anticlockwise=i,this}},{key:"pie",get:function(){return this._pie},set:function(t){this.dirty=this.dirty||this._pie!==t,this._pie=t}},{key:"setPie",value:function(t){return void 0===t&&(t=!0),this.pie=t,this}},{key:"iterations",get:function(){return this._iterations},set:function(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}},{key:"setIterations",value:function(t){return this.iterations=t,this}},{key:"updateData",value:function(){return this.pathData.length=0,this.pie&&this.pathData.push(this.x,this.y),function(t,e,i,n,s,r,a,o,h){a&&s<r?r-=360:!a&&r<s&&(r+=360);var u=us(r-s)/o;s=us(s);for(var l=0;l<=o;l++){var c=s+u*l,d=t+i*Math.cos(c),v=e+n*Math.sin(c);ss(d,v,h)}}(this.x,this.y,this.radiusX,this.radiusY,this.startAngle,this.endAngle,this.anticlockwise,this.iterations,this.pathData),this.pie&&this.pathData.push(this.x,this.y),this.pathData.push(this.pathData[0],this.pathData[1]),k(y(l.prototype),"updateData",this).call(this),this}},{key:"canvasRender",value:function(t,e,i){t.beginPath();var n=this.x-e,s=this.y-i,r=ls(this.startAngle),a=ls(this.endAngle);this.pie&&(t.moveTo(n,s),t.lineTo(n+Math.cos(r)*this.radiusX,s+Math.sin(r)*this.radiusY)),t.ellipse(n,s,this.radiusX,this.radiusY,0,r,a,this.anticlockwise),this.pie&&t.lineTo(n,s),this.isFilled&&(is(t,this),t.fill()),this.isStroked&&(ns(t,this),t.stroke())}}]),l}(),ds=function(){p(s,cs);var n=m(s);function s(t,e,i){return v(this,s),n.call(this,t,e,i,i,0,360)}return s}();Phaser.Math.Interpolation.QuadraticBezier,Phaser.Math.RotateAround,Phaser.Geom.Polygon,Phaser.Math.DegToRad,Phaser.Math.Distance.Between,Phaser.Math.Linear,Phaser.Renderer.WebGL.Utils,Phaser.Renderer.WebGL.Utils;var vs=Phaser.Utils.Objects.GetValue,fs=Phaser.Math.Linear,ps=function(){p(s,Re);var n=m(s);function s(t,e){var i;return v(this,s),(i=n.call(this,t,e)).resetFromJSON(),i.boot(),i}return f(s,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.parent;this.propertyKey=vs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=vs(t,"from",i),this.toValue=vs(t,"to",i),this.setEase(vs(t,"ease",this.ease)),this.setDuration(vs(t,"duration",this.duration)),this.timer.setDuration(this.duration),e[this.propertyKey]=this.fromValue,k(y(s.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=fs(this.fromValue,this.toValue,i)}}]),s}(),ys=Phaser.Math.Percent,gs={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=ys(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new ps(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this}},ms=Phaser.Utils.Objects.GetValue,ks=Phaser.Utils.Objects.IsPlainObject,bs=Phaser.Math.Clamp,Cs=Phaser.Math.Linear,Ss=Phaser.Math.Percent,Ps=Phaser.Math.DegToRad(270),ws=Phaser.Math.RadToDeg,xs=function(){p(d,Qn);var c=m(d);function d(t,e,i,n,s,r,a){var o;v(this,d),ks(e)&&(e=ms(a=e,"x",0),i=ms(a,"y",0),n=ms(a,"radius",1),s=ms(a,"barColor",void 0),r=ms(a,"value",0));var h=2*n;(o=c.call(this,t,e,i,h,h)).type="rexCircularProgress",o.eventEmitter=ms(a,"eventEmitter",g(o)),o.addShape((new ds).setName("track")).addShape((new cs).setName("bar")).addShape((new ds).setName("center")),o.setRadius(n),o.setTrackColor(ms(a,"trackColor",void 0)),o.setBarColor(s),o.setCenterColor(ms(a,"centerColor",void 0)),o.setThickness(ms(a,"thickness",.2)),o.setStartAngle(ms(a,"startAngle",Ps)),o.setAnticlockwise(ms(a,"anticlockwise",!1));var u=ms(a,"valuechangeCallback",null);if(null!==u){var l=ms(a,"valuechangeCallbackScope",void 0);o.eventEmitter.on("valuechange",u,l)}return o.setEaseValuePropName("value").setEaseValueDuration(ms(a,"easeValue.duration",0)).setEaseValueFunction(ms(a,"easeValue.ease","Linear")),o.setValue(r),o}return f(d,[{key:"resize",value:function(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(k(y(d.prototype),"resize",this).call(this,t,t),this.setRadius(t/2)),this}},{key:"value",get:function(){return this._value},set:function(t){t=bs(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}},{key:"setValue",value:function(t,e,i){return null==t||(void 0!==e&&(t=Ss(t,e,i)),this.value=t),this}},{key:"addValue",value:function(t,e,i){return void 0!==e&&(t=Ss(t,e,i)),this.value+=t,this}},{key:"getValue",value:function(t,e){var i=this.value;return void 0!==t&&(i=Cs(t,e,i)),i}},{key:"radius",get:function(){return this._radius},set:function(t){this.dirty=this.dirty||this._radius!=t;var e=2*(this._radius=t);this.resize(e,e)}},{key:"setRadius",value:function(t){return this.radius=t,this}},{key:"trackColor",get:function(){return this._trackColor},set:function(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}},{key:"setTrackColor",value:function(t){return this.trackColor=t,this}},{key:"barColor",get:function(){return this._barColor},set:function(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}},{key:"setBarColor",value:function(t){return this.barColor=t,this}},{key:"startAngle",get:function(){return this._startAngle},set:function(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t}},{key:"setStartAngle",value:function(t){return this.startAngle=t,this}},{key:"anticlockwise",get:function(){return this._anticlockwise},set:function(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t}},{key:"setAnticlockwise",value:function(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}},{key:"thickness",get:function(){return this._thickness},set:function(t){t=bs(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}},{key:"setThickness",value:function(t){return this.thickness=t,this}},{key:"centerColor",get:function(){return this._centerColor},set:function(t){this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}},{key:"setCenterColor",value:function(t){return this.centerColor=t,this}},{key:"updateShapes",value:function(){var t=this.radius,e=this.thickness*this.radius,i=this.radius-e/2,n=this.radius-e,s=this.getShape("track");null!=this.trackColor&&0<e?s.setCenterPosition(t,t).setRadius(i).lineStyle(e,this.trackColor):s.reset();var r=this.getShape("bar");if(null!=this.barColor&&0<i){var a,o,h;if(1===this.value)a=!1,o=0,h=360;else a=this.anticlockwise,o=ws(this.startAngle),h=360*(a?1-this.value:this.value)+o;r.setCenterPosition(t,t).setRadius(i).setAngle(o,h,a).lineStyle(e,this.barColor)}else r.reset();var u=this.getShape("center");this.centerColor&&0<n?u.setCenterPosition(t,t).setRadius(n).fillStyle(this.centerColor):u.reset()}}]),d}();Object.assign(xs.prototype,gs);function Es(t,e,i){var n=t.width/2;return Rs(n,n,e,i)<=n}function Os(t,e,i){if(this.enable&&t.isDown){var n=this.sizerChildren.knob;if(Es(n,e,i)){var s=n.width/2,r=n.startAngle,a=zs(s,s,e,i),o=n.anticlockwise?r-a:a-r,h=As(o)/(2*Math.PI);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-h)<.1?this.value=h:this.easeValueTo(h)}}}function _s(t,e,i){if(this.enable&&!this.panPointer){var n=this.sizerChildren.knob;Es(n,e,i)&&js.call(this,t)}}function Ds(t,e,i){if(this.enable&&t.isDown){var n=this.sizerChildren.knob;switch(this.panState){case Ns:Es(n,e,i)&&js.call(this,t);break;case Is:Es(n,e,i)?Fs.call(this):Vs.call(this)}}}function Ts(t){this.enable&&this.panPointer===t&&Vs.call(this)}function Ms(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)}var Rs=Phaser.Math.Distance.Between,zs=Phaser.Math.Angle.Between,As=Phaser.Math.Angle.Normalize,Xs=Phaser.Math.Angle.Between,Ys=Phaser.Math.Angle.Wrap,js=function(t){this.panPointer=t,this.panState=Is},Vs=function(){this.panPointer=void 0,this.panState=Ns},Fs=function(){var t=this.panPointer.prevPosition,e=this.panPointer.position,i=this.sizerChildren.knob,n=Xs(i.x,i.y,t.x,t.y),s=Xs(i.x,i.y,e.x,e.y),r=i.anticlockwise?n-s:s-n,a=Ys(r)/(2*Math.PI);this.stopEaseValue(),this.value+=a},Ns=0,Is=1,Ls={setTextFormatCallback:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this},getFormatText:Ms,updateText:function(){var t=this.sizerChildren.text;return t&&(t.setText(Ms.call(this)),t.layout&&t.layout()),this}},Us=Phaser.Utils.Objects.GetValue,Ws=Phaser.Math.Linear,Gs=Phaser.Math.Percent,Hs=Phaser.Math.Snap.To,Bs=function(){p(l,Ln);var u=m(l);function l(t,e){var i;v(this,l),void 0===e&&(e={}),(i=u.call(this,t,e)).type="rexKnob",i.eventEmitter=Us(e,"eventEmitter",g(i));var n=Us(e,"background",void 0),s=Us(e,"text",void 0);n&&i.addBackground(n),s&&(e.textColor=void 0,e.textStrokeColor=void 0,i.setTextFormatCallback(Us(e,"textFormatCallback",void 0),Us(e,"textFormatCallbackScope",void 0)));var r=new xs(t,e);r.setDepth(Us(e,"knobDepth",0)),r._value=-1,t.add.existing(r),i.add(r,"knob"),s&&(i.add(s,"text","center",0,!1),t.children.moveBelow(r,s)),i.addChildrenMap("background",n),i.addChildrenMap("knob",r),i.addChildrenMap("text",s);var a=Us(e,"valuechangeCallback",null);if(null!==a){var o=Us(e,"valuechangeCallbackScope",void 0);i.eventEmitter.on("valuechange",a,o)}i.setEnable(Us(e,"enable",void 0)),i.setEaseValuePropName("value").setEaseValueDuration(Us(e,"easeValue.duration",0)).setEaseValueFunction(Us(e,"easeValue.ease","Linear")),i.setGap(Us(e,"gap",void 0)),i.setValue(Us(e,"value",0),Us(e,"min",void 0),Us(e,"max",void 0));var h=Us(e,"input",0);switch("string"==typeof h&&(h=Js[h]),h){case 0:(function(){this.sizerChildren.knob.setInteractive().on("pointerdown",_s,this).on("pointermove",Ds,this).on("pointerup",Ts,this),this.panPointer=void 0,this.panState=Ns}).call(g(i));break;case 1:(function(){this.sizerChildren.knob.setInteractive().on("pointerdown",Os,this).on("pointermove",Os,this)}).call(g(i))}return i}return f(l,[{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setGap",value:function(t){return this.gap=t,this}},{key:"value",get:function(){return this.sizerChildren.knob.value},set:function(t){void 0!==this.gap&&(t=Hs(t,this.gap));var e=this.value;this.sizerChildren.knob.value=t;var i=this.value;e!==i&&(this.updateText(),this.eventEmitter.emit("valuechange",i,e,this.eventEmitter))}},{key:"setValue",value:function(t,e,i){return null==t||(void 0!==e&&(t=Gs(t,e,i)),this.value=t),this}},{key:"addValue",value:function(t,e,i){return void 0!==e&&(t=Gs(t,e,i)),this.value+=t,this}},{key:"getValue",value:function(t,e){var i=this.value;return void 0!==t&&(i=Ws(t,e,i)),i}}]),l}(),Js={pan:0,drag:0,click:1,none:-1};return Object.assign(Bs.prototype,Ls,gs),Bs});
  