phaser3-rex-plugins
Version:
2 lines • 156 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextoast=e();}(undefined,(function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(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,f(n.key),n);}}function n(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e);}function r(t){return r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},r(t)}function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return !1;if(Reflect.construct.sham)return !1;if("function"==typeof Proxy)return !0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return !1}}();return function(){var i,n=r(t);if(e){var s=r(this).constructor;i=Reflect.construct(n,arguments,s);}else i=n.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 a(t)}(this,i)}}function u(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=r(t)););return t}function c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,i){var n=u(t,e);if(n){var s=Object.getOwnPropertyDescriptor(n,e);return s.get?s.get.call(arguments.length<3?t:i):s.value}},c.apply(this,arguments)}function l(t,e,i,n){return l="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,i,n){var s,r=u(t,e);if(r){if((s=Object.getOwnPropertyDescriptor(r,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 !function(t,e,i){(e=f(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i;}(n,e,i);return !0},l(t,e,i,n)}function d(t,e,i,n,s){if(!l(t,e,i,n||t)&&s)throw new TypeError("failed to set property");return i}function v(t){return function(t){if(Array.isArray(t))return p(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 p(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 p(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 p(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}function f(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return ("string"===e?String:Number)(t)}(t,"string");return "symbol"==typeof e?e:String(e)}var y,g=!1;g||(void 0===y&&(y=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])<y&&console.error("Minimum supported version : 3.".concat(y)),g=!0);var m=Phaser.GameObjects.Zone,k=Phaser.Utils.Array.Add,b=Phaser.Utils.Array.Remove,C=function(t){s(o,t);var i=h(o);function o(t,n,s,r,a){var h;return e(this,o),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=1),void 0===a&&(a=1),(h=i.call(this,t,n,s,r,a)).children=[],h}return n(o,[{key:"destroy",value:function(t){if(this.scene&&!this.ignoreDestroy){if(t)for(var e,i=this.children.length-1;i>=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),c(r(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 k(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return b(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy();})),this}},{key:"onChildDestroy",value:function(t,e){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}(m),S=Phaser.GameObjects.Components;Phaser.Class.mixin(C,[S.Alpha,S.Flip]);var w,T=function t(e,i){var n;if(void 0===i)e.hasOwnProperty("rexContainer")&&(n=e.rexContainer.parent);else for(n=t(e);n&&n.name!==i;)n=t(n);return n},x=Phaser.Math.DegToRad,O=Phaser.Math.RadToDeg,P=function(t){if(!t.hasOwnProperty("rexContainer")){var e={parent:null,self:null,layer:null,x:0,y:0,syncPosition:!0,rotation:0,syncRotation:!0,scaleX:0,scaleY:0,syncScale:!0,alpha:0,syncAlpha:!0,visible:!0,active:!0};Object.defineProperty(e,"angle",{get:function(){return O(this.rotation)},set:function(t){this.rotation=x(t);}}),Object.defineProperty(e,"displayWidth",{get:function(){return t.width*this.scaleX},set:function(e){this.scaleX=e/t.width;}}),Object.defineProperty(e,"displayHeight",{get:function(){return t.height*this.scaleY},set:function(e){this.scaleY=e/t.height;}}),t.rexContainer=e;}return t.rexContainer},E={setParent:function(t,e){void 0===e&&(e=this);var i=P(t);return e?(i.parent=e,i.self=t):(i.parent=null,i.self=null),this},getParent:function(t,e){return "string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),T(t,e)},getTopmostParent:function(t){return void 0===t&&(t=this),function(t){for(var e=T(t);e;)t=e,e=T(e);return t}(t)}},_=Phaser.Utils.Objects.GetValue,D=C.prototype.add,M=function(t,e){this.setParent(t);var i=P(t);return z(i,e),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),D.call(this,t),this.addToParentContainer(t),this.addToRenderLayer(t),this},R=function(t,e){this.setParent(t);var i=P(t);return z(i,e),i.x=t.x,i.y=t.y,i.rotation=t.rotation,i.scaleX=t.scaleX,i.scaleY=t.scaleY,i.alpha=t.alpha,i.visible=t.visible,i.active=t.active,this.updateChildPosition(t).updateChildAlpha(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),D.call(this,t),this.addToRenderLayer(t),this},z=function(t,e){void 0===e&&(e=!0),"boolean"==typeof e?(t.syncPosition=e,t.syncRotation=e,t.syncScale=e,t.syncAlpha=e,t.syncScrollFactor=e):(t.syncPosition=_(e,"syncPosition",!0),t.syncRotation=_(e,"syncRotation",!0),t.syncScale=_(e,"syncScale",!0),t.syncAlpha=_(e,"syncAlpha",!0),t.syncScrollFactor=_(e,"syncScrollFactor",!0));},L={add:function(t){return Array.isArray(t)?this.addMultiple(t):M.call(this,t),this},pin:function(t,e){return Array.isArray(t)?this.addMultiple(t,e):M.call(this,t,e),this},addMultiple:function(t){for(var e=0,i=t.length;e<i;e++)M.call(this,t[e]);return this},addLocal:function(t){return Array.isArray(t)?this.addMultiple(t):R.call(this,t),this},pinLocal:function(t,e){return Array.isArray(t)?this.addMultiple(t,e):R.call(this,t,e),this},addLocalMultiple:function(t){for(var e=0,i=t.length;e<i;e++)R.call(this,t[e]);return this}},A=C.prototype.remove,I=C.prototype.clear,j={remove:function(t,e){return T(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),A.call(this,t,e)),this},unpin:function(t,e){return T(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),A.call(this,t,e)),this},clear:function(t){for(var e=this.children,i=0,n=e.length;i<n;i++){var s=e[i];this.setParent(s,null),t||this.removeFromRenderLayer(s);}return I.call(this,t),this}},N={getLocalState:function(t){return P(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}},X=Phaser.Math.RotateAround,Y={worldToLocal:function(t){return t.x-=this.x,t.y-=this.y,X(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,X(t,0,0,this.rotation),t.x+=this.x,t.y+=this.y,t}},F=function(t,e){return t===e?1:t/e},U={updateChildPosition:function(t){t.isRexContainerLite&&(t.syncChildrenEnable=!1);var e=P(t),i=e.parent;return e.syncPosition&&(t.x=e.x,t.y=e.y,i.localToWorld(t)),e.syncRotation&&(t.rotation=e.rotation+i.rotation),e.syncScale&&(t.scaleX=e.scaleX*i.scaleX,t.scaleY=e.scaleY*i.scaleY),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=P(t),i=e.parent;return e.x=t.x,e.y=t.y,i.worldToLocal(e),e.scaleX=F(t.scaleX,i.scaleX),e.scaleY=F(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=P(t);return n.x=e,n.y=i,this.updateChildPosition(t),this},resetLocalPositionState:function(){var t=P(this).parent;return t&&t.resetChildPositionState(this),this}},V=Phaser.Math.DegToRad,W={updateChildRotation:function(t){var e=P(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState:function(t){var e=P(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 P(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle:function(t,e){return P(t).rotation=V(e),this.updateChildRotation(t),this},resetLocalRotationState:function(){var t=P(this).parent;return t&&t.resetChildRotationState(this),this}},G={updateChildScale:function(t){var e=P(t),i=e.parent;return e.syncScale&&(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=P(t),i=e.parent;return e.scaleX=F(t.scaleX,i.scaleX),e.scaleY=F(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=P(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=P(this).parent;return t&&t.resetChildScaleState(this),this}},B={updateChildVisible:function(t){var e=P(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=P(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),P(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible:function(t,e){return void 0===e&&(e=!0),P(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState:function(){var t=P(this).parent;return t&&t.resetChildVisibleState(this),this}},H={updateChildAlpha:function(t){var e=P(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState:function(t){var e=P(t),i=e.parent;return e.alpha=F(t.alpha,i.alpha),this},setChildAlpha:function(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha:function(t,e){return P(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState:function(){var t=P(this).parent;return t&&t.resetChildAlphaState(this),this}},J={updateChildActive:function(t){var e=P(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 P(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),P(t).active=e,this.updateChildActive(t),this},resetLocalActiveState:function(){var t=P(this).parent;return t&&t.resetChildActiveState(this),this}},q={updateChildScrollFactor:function(t){var e=P(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Z={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){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t);})),t&&this.mask&&this.mask.destroy(),this}},K=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);var n=t[0];return (i=n.displayList?n.displayList:n.parentContainer?n.parentContainer.list:n.scene.sys.displayList).depthSort&&(i.depthSort(),i=i.list),e?t.sort((function(t,e){return i.indexOf(e)-i.indexOf(t)})):t.sort((function(t,e){return i.indexOf(t)-i.indexOf(e)})),t},$={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},bringToTop:function(){var t=this.displayList,e=this.getAllChildren([this]);K(e,!1);for(var i=0,n=e.length;i<n;i++){var s=e[i];t.exists(s)&&t.bringToTop(s);}return this},moveDepthBelow:function(t){var e=this.displayList;if(t.displayList!==e)return this;var i=this.getAllChildren([this]);K(i,!1);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=this.displayList;if(t.displayList!==e)return this;var i=this.getAllChildren([this]);K(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},bringChildToTop:function(t){var e=this.getAllChildren([this]);K(e,!0);var i=e[0];return i===t||i.displayList!==t.displayList||i.displayList.moveAbove(t,i),this},sendChildToBack:function(t){var e=this.getAllChildren([this]);K(e,!1);var i=e[0];return i===t||i.displayList!==t.displayList||i.displayList.moveBelow(t,i),this}},Q=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);},tt=function(t,e){for(var i=[t];i.length>0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,v(n.children));}},et=Phaser.Utils.Array,it={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(t){void 0===t&&(t=[]);var e=this;return tt(e,(function(i){i!==e&&t.push(i);})),t},getAllVisibleChildren:function(t){void 0===t&&(t=[]);var e=this;return tt(e,(function(i){if(i!==e)return !i.visible||void t.push(i)})),t},bfs:function(t,e){return void 0===e&&(e=this),tt(e,t),this},dfs:function(t,e){return void 0===e&&(e=this),Q(e,t),this},contains:function(t){var e=T(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,o=(i=s.shift()).children.length;r<o;r++){if((n=i.children[r]).name===t)return n;n.isRexContainerLite&&s.push(n);}return null}return et.GetFirst(this.children,"name",t)},getRandom:function(t,e){return et.GetRandom(this.children,t,e)},getFirst:function(t,e,i,n){return et.GetFirstElement(this.children,t,e,i,n)},getAll:function(t,e,i,n){return et.GetAll(this.children,t,e,i,n)},count:function(t,e,i,n){return et.CountAllMatching(this.children,t,e,i,n)},swap:function(t,e){return et.Swap(this.children,t,e),this},setAll:function(t,e,i,n){return et.SetAll(this.children,t,e,i,n),this}},nt=function(t){for(var e=[],i=0,n=t.length;i<n;i++){var s=t[i];s.hasOwnProperty("rexContainer")&&e.push(s.rexContainer);}return e},st=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);break;default:n.updateChildPosition(s),n.updateChildRotation(s),n.updateChildScale(s),n.updateChildAlpha(s);}}else t.remove();},rt={tweenChild:function(t){var e=t.targets;Array.isArray(e)||(e=[e]);var i=this.scene||function(t){for(var e=0,i=t.length;e<i;e++){var n=t[e].scene;if(n)return n}return null}(e);if(i){t.targets=nt(e);var n=i.tweens.add(t);return n.on("update",st),n}},tweenSelf:function(t){return t.targets=[this],this.tweenChild(t)},createTweenChildConfig:function(t){var e=t.targets;e&&(Array.isArray(e)||(e=[e]),t.targets=nt(e));var i=t.onUpdate;return t.onUpdate=function(t,e){i&&i(t,e),st(t,void 0,e);},t},tween:function(t){var e=this.scene;return t.targets||(t.targets=this),e.tweens.add(t)}},ot=Phaser.GameObjects.Container,at=Phaser.GameObjects.Layer,ht=function(t){return t instanceof at},ut=function(t){var e=t.getAllChildren([t]);return e=e.filter((function(t){return !!t.displayList||!!t.parentContainer}))},ct=function(t){var e=ut(this);return K(e),t.add(e),this},lt=function(t,e,i){var n=ut(this);return K(n,e),t.remove(n),i&&n.forEach((function(t){t.addToDisplayList();})),this},dt={addToContainer:function(t){return function(t){return t instanceof ot}(t)?(this._setParentContainerFlag=!0,ct.call(this,t),this._setParentContainerFlag=!1,this):this},addToLayer:function(t){return ht(t)?(ct.call(this,t),this):this},removeFromContainer:function(){return this.parentContainer?(this._setParentContainerFlag=!0,lt.call(this,this.parentContainer,!0,!1),this._setParentContainerFlag=!1,this):this},removeFromLayer:function(t){return void 0===t&&(t=!0),ht(this.displayList)?(lt.call(this,this.displayList,!1,t),this):this},getParentContainer:function(){if(this.parentContainer)return this.parentContainer;for(var t=this.getParent();t;){var e=t.parentContainer;if(e)return e;t=t.getParent();}return null},addToParentContainer:function(t){if(!t.displayList)return this;var e=this.getParentContainer();return e?(t.isRexContainerLite?t.addToContainer(e):e.add(t),this):this}},vt={hasLayer:function(){return !!this.privateRenderLayer},enableLayer:function(){if(this.hasLayer())return this;var t=this.scene.add.layer();return this.moveDepthBelow(t),this.addToLayer(t),this.privateRenderLayer=t,this},getLayer:function(){return this.hasLayer()||this.enableLayer(),this.privateRenderLayer},getRenderLayer:function(){if(this.hasLayer())return this.privateRenderLayer;for(var t=this.getParent();t;){var e=t.privateRenderLayer;if(e)return e;t=t.getParent();}return null},addToRenderLayer:function(t){if(!t.displayList)return this;var e=this.getRenderLayer();return e?(t.isRexContainerLite?t.addToLayer(e):e.add(t),P(t).layer=e,this):this},removeFromRenderLayer:function(t){var e=P(t),i=e.layer;return i?(t.isRexContainerLite?t.removeFromLayer(!0):i.remove(t),e.layer=null,this):this}},pt=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},ft=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height},yt=Phaser.Geom.Rectangle,gt=Phaser.Math.Vector2,mt=Phaser.Math.RotateAround,kt=function(t,e){if(void 0===e?e=new yt:!0===e&&(void 0===bt&&(bt=new yt),e=bt),t.getBounds)return t.getBounds(e);var i,n,s,r,o,a,h,u;if(t.parentContainer){var c=t.parentContainer.getBoundsTransformMatrix();Ct(t,e),c.transformPoint(e.x,e.y,e),i=e.x,n=e.y,St(t,e),c.transformPoint(e.x,e.y,e),s=e.x,r=e.y,wt(t,e),c.transformPoint(e.x,e.y,e),o=e.x,a=e.y,Tt(t,e),c.transformPoint(e.x,e.y,e),h=e.x,u=e.y;}else Ct(t,e),i=e.x,n=e.y,St(t,e),s=e.x,r=e.y,wt(t,e),o=e.x,a=e.y,Tt(t,e),h=e.x,u=e.y;return e.x=Math.min(i,s,o,h),e.y=Math.min(n,r,a,u),e.width=Math.max(i,s,o,h)-e.x,e.height=Math.max(n,r,a,u)-e.y,e},bt=void 0,Ct=function(t,e,i){return void 0===e?e=new gt:!0===e&&(void 0===xt&&(xt=new gt),e=xt),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-pt(t)*t.originX,e.y=t.y-ft(t)*t.originY,Ot(t,e,i))},St=function(t,e,i){return void 0===e?e=new gt:!0===e&&(void 0===xt&&(xt=new gt),e=xt),t.getTopRight?t.getTopRight(e):(e.x=t.x-pt(t)*t.originX+pt(t),e.y=t.y-ft(t)*t.originY,Ot(t,e,i))},wt=function(t,e,i){return void 0===e?e=new gt:!0===e&&(void 0===xt&&(xt=new gt),e=xt),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-pt(t)*t.originX,e.y=t.y-ft(t)*t.originY+ft(t),Ot(t,e,i))},Tt=function(t,e,i){return void 0===e?e=new gt:!0===e&&(void 0===xt&&(xt=new gt),e=xt),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-pt(t)*t.originX+pt(t),e.y=t.y-ft(t)*t.originY+ft(t),Ot(t,e,i))},xt=void 0,Ot=function(t,e,i){(void 0===i&&(i=!1),0!==t.rotation&&mt(e,t.x,t.y,t.rotation),i&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e},Pt=Phaser.Geom.Rectangle,Et=Phaser.Geom.Rectangle.Union,_t=function(e){if("object"!==t(e)||null===e)return e;if(Array.isArray(e))e.length=0;else for(var i in e)delete e[i];return e},Dt=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:_t(e),i){e.length=t.length;for(var n=0,s=t.length;n<s;n++)e[n]=t[n];}else for(var r in t)e[r]=t[r];return e},Mt=Phaser.GameObjects.GameObject,Rt=function(t){return t instanceof Mt},zt=Phaser.Utils.Objects.GetValue,Lt=Phaser.Textures.DynamicTexture,At=Phaser.Utils.String.UUID,It=function(t){if(t){var e,i,n=t.gameObjects,s=t.renderTexture,r=zt(t,"x",void 0),o=zt(t,"y",void 0),a=zt(t,"width",void 0),h=zt(t,"height",void 0),u=zt(t,"originX",0),c=zt(t,"originY",0),l=zt(t,"padding",0);if(void 0===a||void 0===h||void 0===r||void 0===o){var d=function(t,e){var i;void 0===e?e=new Pt:!0===e&&(void 0===w&&(w=new Pt),e=w),e.setTo(0,0,0,0);for(var n=!0,s=0,r=t.length;s<r;s++)if((i=t[s]).getBounds){var o=kt(i,!0);n?(e.setTo(o.x,o.y,o.width,o.height),n=!1):Et(o,e,e);}return e}(n,!0);void 0!==r&&void 0!==o?(a=2*Math.max(r-d.left,d.right-r),h=2*Math.max(o-d.top,d.bottom-o),u=.5,c=.5):(r=d.x,o=d.y,a=d.width,h=d.height,u=0,c=0),e=d.x,i=d.y;}else e=r+(0-u)*a,i=o+(0-c)*h;e-=l,i-=l,a+=2*l,h+=2*l;var v=n[0].scene;p&&!s&&(s=new Lt(v.sys.textures,At(),a,h)),s||(s=v.add.renderTexture(0,0,a,h)),s.setPosition&&s.setPosition(r,o),s.width===a&&s.height===h||s.setSize(a,h),s.setOrigin&&s.setOrigin(u,c),s.camera.setScroll(e,i),n=K(Dt(n)),s.draw(n);var p=t.saveTexture;if(p)if(Rt(s))s.saveTexture(p);else {var f=s,y=f.manager;y.exists(f.key)?y.renameTexture(f.key,key):(f.key=key,y.list[key]=f,y.emit("addtexture",key,f),y.emit("addtexture-".concat(key),f));}return s}},jt={snapshot:function(t){var e=this.scaleX,i=this.scaleY,n=1===e&&1===i;n||this.setScale(1),void 0===t&&(t={}),t.gameObjects=this.getAllVisibleChildren(),t.x=this.x,t.y=this.y,t.originX=this.originX,t.originY=this.originY;var s=It(t),r=!!s.scene;return n||(this.setScale(e,i),r&&s.setScale(e,i)),r?s:this}},Nt=Phaser.Utils.Objects.GetValue,Xt=function(t,e,i,n,s,r,o){if(t.getBounds||void 0!==t.width&&void 0!==t.height){void 0===i&&(i=16777215),void 0===n&&(n=1),void 0===s&&(s=null),void 0===r&&(r=1),void 0===o&&(o=0);var a=Ct(t,Yt[0]);a.x-=o,a.y-=o;var h=St(t,Yt[1]);h.x+=o,h.y-=o;var u=Tt(t,Yt[2]);u.x+=o,u.y+=o;var c=wt(t,Yt[3]);c.x-=o,c.y+=o,null!==s&&e.fillStyle(s,r).fillPoints(Yt,!0,!0),null!==i&&e.lineStyle(n,i).strokePoints(Yt,!0,!0);}},Yt=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Ft=Phaser.Utils.Objects.GetValue,Ut=Phaser.Math.RotateAround,Vt={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};Ut(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},drawBounds:function(t,e){var i=Ft(e,"drawContainer",!0),n=Ft(e,"children");return void 0===n&&(n=this.getAllVisibleChildren([this])),i||(n=n.filter((function(t){return !t.isRexContainerLite}))),function(t,e,i){var n,s,r,o,a;if("number"==typeof i?n=i:(n=Nt(i,"color"),s=Nt(i,"lineWidth"),r=Nt(i,"fillColor"),o=Nt(i,"fillAlpha",1),a=Nt(i,"padding",0)),Array.isArray(t))for(var h=0,u=t.length;h<u;h++)Xt(t[h],e,n,s,r,o,a);else Xt(t,e,n,s,r,o,a);}(n,t,e),this}};Object.assign(Vt,E,L,j,N,Y,U,W,G,B,H,J,q,Z,$,it,rt,dt,vt,jt);var Wt=function(t){s(o,t);var i=h(o);function o(t,n,s,r,a,h){var u;return e(this,o),Array.isArray(r)&&(h=r,r=void 0,a=void 0),(u=i.call(this,t,n,s,r,a)).type="rexContainerLite",u.isRexContainerLite=!0,u.syncChildrenEnable=!0,u._active=!0,u._mask=null,u._scrollFactorX=1,u._scrollFactorY=1,u.privateRenderLayer=void 0,h&&u.add(h),u}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.syncChildrenEnable=!1,c(r(o.prototype),"destroy",this).call(this,t),this.privateRenderLayer&&(this.privateRenderLayer.list.length=0,this.privateRenderLayer.destroy()));}},{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 c(r(o.prototype),"rotation",this)},set:function(t){this.rotation!==t&&(d(r(o.prototype),"rotation",t,this,!0),this.syncPosition());}},{key:"scaleX",get:function(){return c(r(o.prototype),"scaleX",this)},set:function(t){this.scaleX!==t&&(d(r(o.prototype),"scaleX",t,this,!0),this.syncPosition());}},{key:"scaleY",get:function(){return c(r(o.prototype),"scaleY",this)},set:function(t){this.scaleY!==t&&(d(r(o.prototype),"scaleY",t,this,!0),this.syncPosition());}},{key:"scale",get:function(){return c(r(o.prototype),"scale",this)},set:function(t){this.scale!==t&&(d(r(o.prototype),"scale",t,this,!0),this.syncPosition());}},{key:"visible",get:function(){return c(r(o.prototype),"visible",this)},set:function(t){c(r(o.prototype),"visible",this)!==t&&(d(r(o.prototype),"visible",t,this,!0),this.syncVisible());}},{key:"alpha",get:function(){return c(r(o.prototype),"alpha",this)},set:function(t){c(r(o.prototype),"alpha",this)!==t&&(d(r(o.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:"parentContainer",get:function(){return this._parentContainer},set:function(t){this._parentContainer||t?this.setParentContainerFlag?this._parentContainer=t:this._parentContainer&&!t?(this.removeFromContainer(),this._parentContainer=t):t?(this._parentContainer=t,this.addToContainer(t)):this._parentContainer=t:this._parentContainer=t;}},{key:"setParentContainerFlag",get:function(){if(this._setParentContainerFlag)return !0;var t=T(this);return !!t&&t.setParentContainerFlag}}],[{key:"GetParent",value:function(t){return T(t)}}]),o}(C);Object.assign(Wt.prototype,Vt);var Gt=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};var Bt=Phaser.Cameras.Scene2D.BaseCamera,Ht=Phaser.Geom.Rectangle,Jt=function(t,e,i){return e instanceof Bt||(i=e,e=void 0),void 0===i?i=new Ht:!0===i&&(i=qt),e?t.scale.getViewPort(e,i):t.scale.getViewPort(i)},qt=new Ht,Zt=Phaser.Display.Align,Kt={center:Zt.CENTER,left:Zt.LEFT_CENTER,right:Zt.RIGHT_CENTER,top:Zt.TOP_CENTER,bottom:Zt.BOTTOM_CENTER,"left-top":Zt.TOP_LEFT,"top-left":Zt.TOP_LEFT,"left-center":Zt.LEFT_CENTER,"center-left":Zt.LEFT_CENTER,"left-bottom":Zt.BOTTOM_LEFT,"bottom-left":Zt.BOTTOM_LEFT,"center-top":Zt.TOP_CENTER,"top-center":Zt.TOP_CENTER,"center-center":Zt.CENTER,"center-bottom":Zt.BOTTOM_CENTER,"bottom-center":Zt.BOTTOM_CENTER,"right-top":Zt.TOP_RIGHT,"top-right":Zt.TOP_RIGHT,"right-center":Zt.RIGHT_CENTER,"center-right":Zt.RIGHT_CENTER,"right-bottom":Zt.BOTTOM_RIGHT,"bottom-right":Zt.BOTTOM_RIGHT},$t=function(){},Qt=new Phaser.GameObjects.Zone({sys:{queueDepthSort:$t,events:{once:$t}}},0,0,1,1);Qt.setOrigin(0);var te=0,ee=1,ie=2,ne=4,se=6,re=8,oe=10,ae=12,he=function(t){var e=ft(t);return t.y+e-e*t.originY},ue=function(t){var e=pt(t);return t.x-e*t.originX+.5*e},ce=function(t,e){var i=ft(t);return t.y=e-i+i*t.originY,t},le=function(t,e){var i=pt(t),n=i*t.originX;return t.x=e+n-.5*i,t},de=function(t){var e=pt(t);return t.x-e*t.originX},ve=function(t,e){var i=pt(t);return t.x=e+i*t.originX,t},pe=function(t){var e=pt(t);return t.x+e-e*t.originX},fe=function(t,e){var i=pt(t);return t.x=e-i+i*t.originX,t},ye=function(t,e){var i=ft(t),n=i*t.originY;return t.y=e+n-.5*i,t},ge=function(t){var e=ft(t);return t.y-e*t.originY+.5*e},me=function(t){var e=ft(t);return t.y-e*t.originY},ke=function(t,e){var i=ft(t);return t.y=e+i*t.originY,t},be=[];be[11]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),le(t,ue(e)+i),ce(t,he(e)+n),t},be[oe]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ve(t,de(e)-i),ce(t,he(e)+n),t},be[ae]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),fe(t,pe(e)+i),ce(t,he(e)+n),t},be[se]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),function(t,e,i){le(t,e),ye(t,i);}(t,ue(e)+i,ge(e)+n),t},be[ne]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ve(t,de(e)-i),ye(t,ge(e)+n),t},be[re]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),fe(t,pe(e)+i),ye(t,ge(e)+n),t},be[ee]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),le(t,ue(e)+i),ke(t,me(e)-n),t},be[te]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ve(t,de(e)-i),ke(t,me(e)-n),t},be[ie]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),fe(t,pe(e)+i),ke(t,me(e)-n),t};var Ce=function(t,e,i,n,s,r){Qt.setPosition(e,i).setSize(n,s),function(t,e,i,n,s){be[i](t,e,n,s);}(t,Qt,r);},Se=Phaser.Utils.Objects.GetValue,we=Phaser.GameObjects.Group,Te=function(t,e,i){return t.add.text(0,0,"")},xe=void 0,Oe=Phaser.Utils.Objects.GetValue,Pe=function(t,e){return void 0===t&&(t=0),void 0===e&&(e={}),"number"==typeof t?(e.left=t,e.right=t,e.top=t,e.bottom=t):(e.left=Oe(t,"left",0),e.right=Oe(t,"right",0),e.top=Oe(t,"top",0),e.bottom=Oe(t,"bottom",0)),e},Ee=Wt.prototype.add,_e=function(t){return Ee.call(this,t),this.sizerEventsEnable&&(t.emit("sizer.add",t,this),this.emit("add",t,this)),this},De={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),_e.call(this,t),this.backgroundChildren.push(t),this.getSizerConfig(t).padding=Pe(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground:function(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},Me=function t(e,i){var n=null;if(void 0===i)e.hasOwnProperty("rexContainer")&&((n=e.rexContainer.parent)?n.isRexSizer||(n=t(n)):n=null);else for(n=t(e);n&&n.name!==i;)n=t(n);return n},Re={getParentSizer:function(t,e){return "string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),Me(t,e)},getTopmostSizer:function(t){return void 0===t&&(t=this),function(t){for(var e=Me(t);e;)t=e,e=Me(e);return t}(t)},hasParentSizer:function(t,e){void 0===e&&(e=this);for(var i=Me(e);i;){if(i===t)return !0;i=Me(i);}return !1},hasChild:function(t,e){return void 0===e&&(e=this),this.hasParentSizer(e,t)}},ze=Phaser.Utils.Array.Remove,Le=Wt.prototype.remove,Ae=Re.getParentSizer,Ie=function(t,e){for(var i=Ae(t);i;)i.removeChildCallback&&i.removeChildCallback(t,e),i=Ae(i);return this.isBackground(t)&&ze(this.backgroundChildren,t),Le.call(this,t,e),!e&&this.sizerEventsEnable&&(t.emit("sizer.remove",t,this),this.emit("remove",t,this)),this},je=Phaser.Utils.Array.Remove,Ne=Re.getParentSizer,Xe={removeFromParentSizer:function(){var t=Ne(gameObject);return t&&t.remove(this),this},removeBackground:function(t,e){return void 0===this.backgroundChildren||this.getParentSizer(t)!==this||(je(this.backgroundChildren,t),Ie.call(this,t,e)),this},removeAllBackgrounds:function(t){if(void 0===this.backgroundChildren)return this;for(var e=this.backgroundChildren.length-1;e>=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ye=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else {var i=t;for(t in i)this.childrenMap[t]=i[t];}return this},Fe=/(\S+)\[(\d+)\]/i,Ue=Phaser.Utils.Objects.GetValue,Ve=function(t,e){return void 0===e?t:t[e]},We=function(e,i,n){void 0===e&&(e={}),void 0===i&&(i=0);var s=t(i);return "string"===s?e[i]=n:"number"===s?(e.left=i,e.right=i,e.top=i,e.bottom=i):(e.left=Ue(i,"left",0),e.right=Ue(i,"right",0),e.top=Ue(i,"top",0),e.bottom=Ue(i,"bottom",0)),e},Ge={getInnerPadding:function(t){return Ve(this.space,t)},setInnerPadding:function(t,e){return We(this.space,t,e),this},getOuterPadding:function(t){return Ve(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return We(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return "string"==typeof t&&(t=this.getElement(t)),Ve(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return "string"==typeof t&&(t=this.getElement(t)),We(this.getSizerConfig(t).padding,e,i),this}},Be=function(t){var e=this.childrenWidth,i=void 0!==this.minWidth?this.minWidth:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") < childrenWidth (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") or childrenWidth (").concat(e," > targetWidth ").concat(t,")")),t},He=function(t){var e=this.childrenHeight,i=void 0!==this.minHeight?this.minHeight:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") < childrenHeight (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") or childrenHeight (").concat(e,") > targetHeight (").concat(t,")")),t},Je={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=[this];e.length>0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push.apply(e,v(i.children)));}return t}},qe=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();},Ze={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):[]}},Ke=Phaser.Scene,$e=function(t){return t instanceof Ke},Qe=function(e){return null==e||"object"!==t(e)?null:$e(e)?e:e.scene&&$e(e.scene)?e.scene:e.parent&&e.parent.scene&&$e(e.parent.scene)?e.parent.scene:null},ti=Phaser.Game,ei=function(t){return t instanceof ti},ii=function(e){return null==e||"object"!==t(e)?null:ei(e)?e:ei(e.game)?e.game:$e(e)?e.sys.game:$e(e.scene)?e.scene.sys.game:void 0},ni=Phaser.Utils.Objects.GetValue,si=function(){function t(i,n){e(this,t),this.setParent(i),this.isShutdown=!1,this.setEventEmitter(ni(n,"eventEmitter",!0)),this.parent&&(this.parent===this.scene?this.scene.sys.events.once("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.once("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this));}return n(t,[{key:"shutdown",value:function(t){this.isShutdown||(this.parent&&(this.parent===this.scene?this.scene.sys.events.off("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.off("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this)),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.game=void 0,this.isShutdown=!0);}},{key:"destroy",value:function(t){this.shutdown(t);}},{key:"onEnvDestroy",value:function(){this.destroy(!0);}},{key:"onParentDestroy",value:function(t,e){this.destroy(e);}},{key:"setParent",value:function(t){return this.parent=t,this.scene=Qe(t),this.game=ii(t),this}}]),t}();Object.assign(si.prototype,Ze);var ri=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,{eventEmitter:!1})).viewport=void 0,s.resetFromJSON(n),s}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.autoAnchor(!1),this.viewport=void 0,this.onUpdateViewportCallback=void 0,this.onUpdateViewportCallbackScope=void 0,this.onResizeCallback=void 0,this.onResizeCallbackScope=void 0,c(r(o.prototype),"shutdown",this).call(this,t));}},{key:"resetFromJSON",value:function(t){var e,i,n,s,r,o,a,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,o=""===i[1]?0:parseFloat(i[1])),void 0!==s&&(s=s.replace("top","0%").replace("bottom","100%").replace("center","50%").split("%"),a=parseFloat(s[0])/100,h=""===s[1]?0:parseFloat(s[1]));var u,c,l=t.width;void 0!==l&&(l=l.split("%"),u=parseFloat(l[0])/100,c=""===l[1]?0:parseFloat(l[1]));var d,v,p=t.height;void 0!==p&&(p=p.split("%"),d=parseFloat(p[0])/100,v=""===p[1]?0:parseFloat(p[1])),this.setAlign(e,n),this.setPercentage(r,a),this.setOffset(o,h),this.setSizePercentage(u,d),this.setSizePadding(c,v);var f=t.onResizeCallback,y=t.onResizeCallbackScope;void 0!==f&&this.setResizeCallback(f,y);var g=t.onUpdateViewportCallback,m=t.onUpdateViewportCallbackScope;return void 0!==g&&this.setUpdateViewportCallback(g,m),this.autoAnchor(t.enable),this}},{key:"autoAnchor",value:function(t){return void 0===t&&(t=!0),t=!!t,this.autoAnchorEnable===t||(t?(this.scene.sys.scale.on("resize",this.anchor,this),this.anchor()):this.scene.sys.scale.off("resize",this.anchor,this),this.autoAnchorEnable=t),this}},{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(){var t=this.parent.scene.cameras.main;this.viewport=Jt(this.scene,t,this.viewport);var e=this.viewport,i=this.onUpdateViewportCallback,n=this.onUpdateViewportCallbackScope;i&&(n?i.call(n,e,this.parent,this):i(e,this.parent,this));}}]),o}(si),oi=Phaser.Utils.Objects.GetValue,ai=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n))._isRunning=!1,s.isPaused=!1,s.tickingState=!1,s.setTickingMode(oi(n,"tickingMode",1)),s}return n(o,[{key:"boot",value:function(){2!==this.tickingMode||this.tickingState||this.startTicking();}},{key:"shutdown",value:function(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),c(r(o.prototype),"shutdown",this).call(this,t));}},{key:"setTickingMode",value:function(t){"string"==typeof t&&(t=hi[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);}}]),o}(si),hi={no:0,lazy:1,always:2},ui=Phaser.Utils.Objects.GetValue,ci=function(t){s(o,t);var i=h(o);function o(t,n){var s;e(this,o);var r=(s=i.call(this,t,n)).scene?"update":"step";return s.tickEventName=ui(n,"tickEventName",r),s.isSceneTicker=!li(s.tickEventName),s}return n(o,[{key:"startTicking",value:function(){c(r(o.prototype),"startTicking",this).call(this),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this);}},{key:"stopTicking",value:function(){c(r(o.prototype),"stopTicking",this).call(this),this.isSceneTicker&&this.scene?this.scene.sys.events.off(this.tickEventName,this.update,this):this.game&&this.game.events.off(this.tickEventName,this.update,this);}}]),o}(ai),li=function(t){return "step"===t||"poststep"===t},di=Phaser.Utils.Objects.GetValue,vi=Phaser.Math.Clamp,pi=function(){function t(i){e(this,t),this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){this.state=di(t,"state",fi),this.timeScale=di(t,"timeScale",1),this.delay=di(t,"delay",0),this.repeat=di(t,"repeat",0),this.repeatCounter=di(t,"repeatCounter",0),this.repeatDelay=di(t,"repeatDelay",0),this.duration=di(t,"duration",0),this.nowTime=di(t,"nowTime",0),this.justRestart=di(t,"justRestart",!1);}},{key:"toJSON",value:function(){return {state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,repeatDelay:this.repeatDelay,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}},{key:"destroy",value:function(){}},{key:"setTimeScale",value:function(t){return this.timeScale=t,this}},{key:"setDelay",value:function(t){return void 0===t&&(t=0),this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatInfinity",value:function(){return this.repeat=-1,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"start",value:function(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?gi:yi,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=fi,this}},{key:"update",value:function(t,e){this.state!==fi&&this.state!==ki&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter<this.repeat?(this.repeatCounter++,this.justRestart=!0,this.nowTime-=this.duration,this.repeatDelay>0&&(this.nowTime-=this.repeatDelay,this.state=mi)):(this.nowTime=this.duration,this.state=ki):this.nowTime>=0&&(this.state=gi));}},{key:"t",get:function(){var t;switch(this.state){case fi:case yi:case mi:t=0;break;case gi:t=this.nowTime/this.duration;break;case ki:t=1;}return vi(t,0,1)},set:function(t){(t=vi(t,-1,1))<0?(this.state=yi,this.nowTime=-this.delay*t):(this.state=gi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===fi}},{key:"isDelay",get:function(){return this.state===yi}},{key:"isCountDown",get:function(){return this.state===gi}},{key:"isRunning",get:function(){return this.state===yi||this.state===gi}},{key:"isDone",get:function(){return this.state===ki}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),fi=0,yi=1,gi=2,mi=3,ki=-1,bi=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n)).timer=new pi,s}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(c(r(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),c(r(o.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),c(r(o.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),c(r(o.prototype),"complete",this).call(this),this}}]),o}(ci),Ci=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction,Ti=function(t){s(o,t);var i=h(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}},{key:"start",value:function(){return this.timer.isRunning||c(r(o.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),c(r(o.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,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(t,e){}}]),o}(bi),xi=Phaser.Utils.Objects.GetValue,Oi=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear,Ei=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n)).scaleStart={},s.scaleEnd={},s.resetFromJSON(n),s.boot(),s}return n(o,[{key:"resetFromJSON",value:function(t){return c(r(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(xi(t,"mode",0)),this.setScaleRange(Oi(t,"start",void 0),Oi(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=_i[t]),this.mode=t,this}},{key:"setScaleRange",value:function(t,e){return "number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Oi(t,"x",this.parent.scaleX),this.startY=Oi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Oi(e,"x",void 0),this.endY=Oi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}},{key:"start",value:function(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),c(r(o.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=Pi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Pi(this.startY,this.endY,i));}},{key:"complete",value:function(){return c(r(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Ti),_i={stop:0,destroy:1,yoyo:2},Di=function(t,e,i,n,s){var r,o;switch(void 0===n&&(n="Cubic"),i){case 0:case"x":r={x:0},o={x:t.scaleX};break;case 1:case"y":r={y:0},o={y:t.scaleY};break;default:r=0,o=t.scale;}var a={mode:0,start:r,end:o,duration:e,ease:n};return void 0===s?s=new Ei(t,a):s.resetFromJSON(a),s.restart(),s},Mi=function(t,e,i,n,s,r){void 0===n&&(n="Linear"),s instanceof Ei&&(r=s,s=void 0),void 0===s&&(s=!0);var o={};switch(o.mode=s?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0;}return o.duration=e,o.ease=n,void 0===r?r=new Ei(t,o):r.resetFromJSON(o),r.restart(),r},Ri=function(t,e){return new Promise((function(i,n){t.once(e,(function(){i();}));}))},zi=function(t){return Ri(t,"complete")},Li=Phaser.Utils.Objects.IsPlainObject,Ai=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=Re.getParentSizer(t);e&&e.resetChildPositionState(t);}));},Ii={popUp:function(t,e,i){if(Li(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease;}var s=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,this._scaleBehavior),s&&Ai(this,this._scaleBehavior),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),zi(this._scaleBehavior)},scaleDownDestroy:function(t,e,i,n){if(Li(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease,n=s.destroy;}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,n,this._scaleBehavior),r&&Ai(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),zi(this._scaleBehavior)},scaleDown:function(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise:function(t,e,i){return this.scaleDown(t,e,i),zi(this._scaleBehavior)},scaleYoyo:function(t,e,i,n,s){if(Li(t)){var r=t;t=r.duration,e=r.peakValue,i=r.repeat,n=r.orientation,s=r.ease;}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,n,s,r,o){var a,h;switch(void 0===i&&(i=1.2),void 0===n&&(n=0),void 0===r&&(r="Cubic"),s){case 0:case"x":a={x:t.scaleX},h={x:i};break;case 1:case"y":a={y:t.scaleX},h={y:i};break;default:a=t.scaleX,h=i;}var u={mode:2,start:a,end:h,duration:e/2,ease:r,repeat:n};return void 0===o?o=new Ei(t,u):o.resetFromJSON(u),o.restart(),o}(this,t,e,i,n,s,this._scaleBehavior),o&&Ai(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise:function(t,e,i,n,s){return this.scaleYoyo(t,e,i,n,s),zi(this._scaleBehavior)}},ji=Phaser.Utils.Objects.GetValue,Ni=Phaser.Utils.Objects.GetAdvancedValue,Xi=Phaser.Math.Linear,Yi=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n)).resetFromJSON(n),s.boot(),s}return n(o,[{key:"resetFromJSON",value:function(t){return c(r(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(ji(t,"mode",0)),this.setAlphaRange(Ni(t,"start",this.parent.alpha),Ni(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Fi[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),c(r(o.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Xi(this.alphaStart,this.alphaEnd,i);}},{key:"complete",value:function(){return c(r(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Ti),Fi={stop:0,destroy:1,yoyo:2},Ui=Phaser.Utils.Objects.IsPlainObject,Vi=function(t,e,i,n){var s,r;Ui(i)?(s=i.start,r=i.end):r=i,void 0===s&&(s=0),void 0===r&&(r=1);var o={mode:0,start:s,end:r,duration:e};return void 0===n?n=new Yi(t,o):n.resetFromJSON(o),n.restart(),n},Wi=function(t,e,i,n){i instanceof Yi&&(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 Yi(t,s):n.resetFromJSON(s),n.restart(),n},Gi=Phaser.Utils.Objects.IsPlainObject,Bi=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=Re.getParentSizer(t);e&&e.resetChildAlphaState(t);}));},Hi={fadeIn:function(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha;}var n=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),n&&Bi(this,this._fade),this._fade.completeEventName="fadein.complete",this},fadeInPromise:function(t,e){return this.fadeIn(t,e),zi(this._fade)},fadeOutDestroy:function(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy;}var n=void 0===this._fade;return this._fade=Wi(this,t,e,this._fade),n&&Bi(this,this._fade),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),zi(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),zi(this._fade)}},Ji=Phaser.Utils.Objects.GetValue,qi=Phaser.Utils.Objects.GetAdvancedValue,Zi=Phaser.Math.Linear,Ki=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n)).resetFromJSON(n),s.boot(),s}return n(o,[{key:"resetFromJSON",value:function(t){if(c(r(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Ji(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=qi(t,"x",void 0),i=qi(t,"y",void 0);this.setTargetPosition(e,i);}else this.setTargetPosition(t);return this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=$i[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=qi(i,"startX",void 0),this.startY=qi(i,"startY",void 0),this.endX=qi(i,"endX",void 0),this.endY=qi(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),c(r(o.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=Zi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Zi(this.startY,this.endY,i));}},{key:"complete",value:function(){return c(r(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Ti),$i={stop:0,destroy:1,yoyo:2},Qi=function(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}},tn=Phaser.Utils.Objects.IsPlainObject,en=Phaser.Math.Distance.Between,nn=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=Re.getParentSizer(t);e&&e.resetChildPositionState(t);}));},sn={moveFrom:function(t,e,i,n,s){if(tn(t)){var r=t;e=r.x,i=r.y,t=r.hasOwnProperty("speed")?1e3*en(e,i,this.x,this.y)/r.speed:r.duration,n=r.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,s,r,o){r instanceof Ki&&(o=r,r=void 0),void 0===r&&(r=!1);var a={};return a.mode=r?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==n&&(a.startY=Qi(n,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===s?"Linear":s,void 0===o?o=new Ki(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,s,this._easeMove),o&&nn(this,this._easeMove),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise:function(t,e,i,n,s){return this.moveFrom(t,e,i,n,s),zi(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),zi(this._easeMove)},moveTo:function(t,e,i,n,s){if(tn(t)){var r=t;e=r.x,i=r.y,t=r.hasOwnProperty("speed")?1e3*en(e,i,this.x,this.y)/r.speed:r.duration,n=r.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,s,r,o){r instanceof Ki&&(o=r,r=void 0),void 0===r&&(r=!1);var a={};return a.mode=r?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==n&&(a.startY=t.y,a.endY=Qi(n,t.y)),a.duration=e,a.ease=void 0===s?"Linear":s,void 0===o?o=new Ki(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,s,this._easeMove),o&&nn(this,this._easeMove),this._easeMove.completeEventName="moveto.complete",this},moveToPromise:function(t,e,i,n,s){return this.moveTo(t,e,i,n,s),zi(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),zi(this._easeMove)},moveStop:function(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rn=Phaser.Utils.Objects.GetValue,on=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n)).timer=new pi,s.resetFromJSON(n),s.boot(),s}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(rn(t,"timer")),this.setEnable(rn(t,"enable",!0)),this.setMode(rn(t,"mode",1)),this.isRunning=rn(t,"isRunning",!1),this.setMagnitudeMode(rn(t,"magnitudeMode",1)),this.setAxisMode(rn(t,"axis",0)),this.setDuration(rn(t,"duration",500)),this.setMagnitude(rn(t,"magnitude",10)),this.ox=rn(t,"ox",void 0),this.oy=rn(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||(c(r(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"startTicking",value:function(){c(r(o.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.sys.events.on("preupdate",this.update,this);}},{key:"stopTicking",value:function(){c(r(o.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.sys.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=an[t]),this.mode=t,this}},{key:"setMagnitudeMode",value:function(t){return "string"==typeof t&&(t=un[t]),this.magnitudeMode=t,this}},{key:"setAxisMode",value:function(t){return "string"==typeof t&&(t=hn[t]),this.axisMode=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=rn(i,"magnitude",void 0),t=rn(i,"duration",void 0);}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),c(r(o.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=this.ox+Math.cos(s)*n,o=this.oy+Math.sin(s)*n;switch(this.axisMode){case 1:i.x=r;break;case 2:i.y=o;break;default:i.x=r,i.y=o;}}return this}},{key:"backToOrigin",value:function(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy;}return this.ox=void 0,this.oy=void 0,this}}]),o}(ai),an={effect:0,behavior:1},hn={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},un={constant:0,decay:1},cn=Phaser.Utils.Objects.IsPlainObject,ln={shake:function(t,e,i){if(cn(t)){var n=t;t=n.duration,e=n.magnitude,i=n.magnitudeMode;}return void 0===this._shake&&(this._shake=new on(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t);}));}(this,this._shake)),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),zi(this._shake)}},dn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.Linear,pn=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n)).resetFromJSON(),s.boot(),s}return n(o,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=dn(t,"key","value");var i=e[this.propertyKey];return this.fromValue=dn(t,"from",i),this.toValue=dn(t,"to",i),this.setEase(dn(t,"ease",this.ease)),this.setDuration(dn(t,"duration",this.duration)),this.setRepeat(dn(t,"repeat",0)),this.setDelay(dn(t,"delay",0)),this.setRepeatDelay(dn(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,c(r(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=vn(this.fromValue,this.toValue,i);}}]),o}(Ti),fn=Phaser.Utils.Objects.IsPlainObject,yn=function(t){s(r,t);var i=h(r);function r(t,n){var s;return e(this,r),(s=i.call(this,t,n)).parent.setDataEnabled(),s.easeTasks={},s}return n(r,[{key:"complete",value:function(t){this.emit("complete-".concat(t),this.parent,this),this.emit("complete",t,this.parent,this);}},{key:"getEaseTask",value:function(t){var e=this.easeTasks[t];return void 0===e&&(e=new pn(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t);}),this)),e}},{key:"easeTo",value:function(t,e,i,n){if(fn(t)){var s=t;t=s.key,e=s.value,i=s.duration,n=s.ease;var r=s.speed;void 0===i&&void 0!==r&&(i=Math.abs(e-this.parent.data.values[t])/r*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:n}),this}},{key:"easeFrom",value:function(t,e,i,n){if(fn(t)){var s=t;t=s.key,e=s.value,i=s.duration,n=s.ease;var r=s.speed;void 0===i&&void 0!==r&&(i=Math.abs(e-this.parent.data.values[t])/r*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:n}),this}},{key:"stopEase",value:function(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}},{key:"stopAll",value:function(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}]),r}(si),gn={easeDataTo:function(t,e,i,n){return this._easeData||(this._easeData=new yn(this),function(t,e){e.on("complete",(function(e){t.emit("easedata.".concat(e,".complete"),t),t.emit("easedata.complete",e,t);}));}(this,this._easeData)),this._easeData.easeTo(t,e,i,n),this},easeDataToPromise:function(t,e,i,n){return this.easeDataTo(t,e,i,n),Ri(this._easeData,"complete-".concat(t))},stopEaseData:function(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData:function(t){return this._easeData?(this._easeData.stopAll(t),this):this}},mn=function(t,e){if(t){Gt(t).hidden=e;var i=T(t);i?i.setChildVisible(t,!e):t.setVisible(!e);}},kn={show:function(t){return void 0===t&&(t=this),function(t){mn(t,!1);}(t),this},hide:function(t){return void 0===t&&(t=this),function(t){mn(t,!0);}(t),this},isShow:function(t){return void 0===t&&(t=this),function(t){return !!t&&!Gt(t).hidden}(t)}};function bn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Cn={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1;}function r(t,e,n,r,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new s(n,r||t,o),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e];}function a(){this._events=new n,this._eventsCount=0;}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,s=[];if(0===this._eventsCount)return s;for(n in t=this._events)e.call(t,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return [];if(n.fn)return [n.fn];for(var s=0,r=n.length,o=new Array(r);s<r;s++)o[s]=n[s].fn;return o},a.prototype.listenerCount=function(t){var e=i?i+t:t,n=this._events[e];return n?n.fn?1:n.length:0},a.prototype.emit=function(t,e,n,s,r,o){var a=i?i+t:t;if(!this._events[a])return !1;var h,u,c=this._events[a],l=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,n),!0;case 4:return c.fn.call(c.context,e,n,s),!0;case 5:return c.fn.call(c.context,e,n,s,r),!0;case 6:return c.fn.call(c.context,e,n,s,r,o),!0}for(u=1,h=new Array(l-1);u<l;u++)h[u-1]=arguments[u];c.fn.apply(c.context,h);}else {var d,v=c.length;for(u=0;u<v;u++)switch(c[u].once&&this.removeListener(t,c[u].fn,void 0,!0),l){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,e);break;case 3:c[u].fn.call(c[u].context,e,n);break;case 4:c[u].fn.call(c[u].context,e,n,s);break;default:if(!h)for(d=1,h=new Array(l-1);d<l;d++)h[d-1]=arguments[d];c[u].fn.apply(c[u].context,h);}}return !0},a.prototype.on=function(t,e,i){return r(this,t,e,i,!1)},a.prototype.once=function(t,e,i){return r(this,t,e,i,!0)},a.prototype.removeListener=function(t,e,n,s){var r=i?i+t:t;if(!this._events[r])return this;if(!e)return o(this,r),this;var a=this._events[r];if(a.fn)a.fn!==e||s&&!a.once||n&&a.context!==n||o(this,r);else {for(var h=0,u=[],c=a.length;h<c;h++)(a[h].fn!==e||s&&!a[h].once||n&&a[h].context!==n)&&u.push(a[h]);u.length?this._events[r]=1===u.length?u[0]:u:o(this,r);}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&o(this,e)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,t.exports=a;}(Cn);var Sn=function(t){s(r,t);var i=h(r);function r(){return e(this,r),i.apply(this,arguments)}return n(r,[{key:"shutdown",value:function(){this.removeAllListeners();}},{key:"destroy",value:function(){this.removeAllListeners();}}]),r}(bn(Cn.exports)),wn={setEventEmitter:function(t,e){return void 0===e&&(e=Sn),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):[]}},Tn=function(t,e,i){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return t[e];if(-1!==e.indexOf(".")){for(var n=e.split("."),s=t,r=i,o=0;o<n.length;o++){if(!s.hasOwnProperty(n[o])){r=i;break}r=s[n[o]],s=s[n[o]];}return r}return i}return i},xn=["next","exit","enter"],On=function(){function t(i){e(this,t);var n=Tn(i,"states",void 0);n&&this.addStates(n);var s=Tn(i,"extend",void 0);if(s)for(var r in s)this.hasOwnProperty(r)&&void 0!==this[r]||(this[r]=s[r]);var o=Tn(i,"eventEmitter",void 0),a=Tn(i,"EventEmitterClass",void 0);this.setEventEmitter(o,a),this._stateLock=!1,this.resetFromJSON(i);}return n(t,[{key:"shutdown",value:function(){this.destroyEventEmitter();}},{key:"destroy",value:function(){this.shutdown();}},{key:"resetFromJSON",value:function(t){this.setEnable(Tn(t,"enable",!0)),this.start(Tn(t,"start",void 0));var e=Tn(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:"stateProperties",get:function(){return xn}},{key:"addState",value:function(t,e){"string"!=typeof t&&(t=(e=t).name);for(var i=this.stateProperties,n=0,s=i.length;n<s;n++){var r=i[n],o=e[r];o&&(this["".concat(r,"_").concat(t)]=o);}return this}},{key:"addStates",value:function(t){if(Array.isArray(t))for(var e=0,i=t.length;e<i;e++)this.addState(t[e]);else for(var n in t)this.addState(n,t[n]);return this}},{key:"runMethod",value:function(t,e,i,n,s,r){var o=this[t+"_"+this.state];if(o){var a=arguments.length;switch(a){case 1:return o.call(this);case 2:return o.call(this,e);case 3:return o.call(this,e,i);case 4:return o.call(this,e,i,n);case 5:return o.call(this,e,i,n,s);case 6:return o.call(this,e,i,n,s,r)}for(var h=new Array(a-1),u=1;u<a;u++)h[u-1]=arguments[u];return o.apply(this,h)}}}]),t}();Object.assign(On.prototype,wn);var Pn=function(t,e,i,n,s){void 0===s&&(s=!1);var r=t._events[e];if(!r)return !1;for(var o=0,a=r.length;o<a;o++){var h=r[o];if(h.fn===i&&h.context===n&&h.once===s)return !0}return !1},En=["next","exit","enter","update","preupdate","postupdate"],_n=function(t){s(o,t);var i=h(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"shutdown",value:function(){this.stopUpdate(),this.stopPreUpdate(),this.stopPostUpdate(),this._scene=void 0,c(r(o.prototype),"shutdown",this).call(this);}},{key:"resetFromJSON",value:function(t){return c(r(o.prototype),"resetFromJSON",this).call(this,t),this._scene=Tn(t,"scene",void 0),this}},{key:"stateProperties",get:function(){return En}},{key:"update",value:function(t,e){this.runMethod("update",t,e);}},{key:"preupdate",value:function(t,e){this.runMethod("preupdate",t,e);}},{key:"postupdate",value:function(t,e){this.runMethod("postupdate",t,e);}},{key:"startUpdate",value:function(t){t||(t=this._scene);var e=t.sys.events;return Pn(e,"update",this.update,this)||(this._scene=t,e.on("update",this.update,this)),this}},{key:"stopUpdate",value:function(){return this._scene?(this._scene.sys.events.off("update",this.update,this),this):this}},{key:"startPreUpdate",value:function(t){t||(t=this._scene);var e=t.sys.events;return Pn(e,"preupdate",this.preupdate,this)||(this._scene=t,e.on("preupdate",this.preupdate,this)),this}},{key:"stopPreUpdate",value:function(){return this._scene?(this._scene.sys.events.off("preupdate",this.preupdate,this),this):this}},{key:"startPostUpdate",value:function(t){t||(t=this._scene);var e=t.sys.events;return Pn(e,"postupdate",this.postupdate,this)||(this._scene=t,e.on("postupdate",this.postupdate,this)),this}},{key:"stopPostUpdate",value:function(){return this._scene?(this._scene.sys.events.off("postupdate",this.postupdate,this),this):this}}]),o}(On),Dn=function(t){s(r,t);var i=h(r);function r(t,n){var s;e(this,r),(s=i.call(this,n)).parent=t;var o=n.initState||"IDLE";return s.start(o),s}return n(r,[{key:"init",value:function(){this.start("IDLE");}},{key:"next_IDLE",value:function(){return "TRANS_OPNE"}},{key:"next_TRANS_OPNE",value:function(){return "OPEN"}},{key:"enter_TRANS_OPNE",value:function(){var t=this.parent;if(t.transitInTime>0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_OPNE",value:function(){this.parent.removeDelayCall();}},{key:"next_OPEN",value:function(){return "TRANS_CLOSE"}},{key:"enter_OPEN",value:function(){this.parent.onOpen();}},{key:"exit_OPEN",value:function(){this.parent.removeDelayCall();}},{key:"next_TRANS_CLOSE",value:function(){return "CLOSE"}},{key:"enter_TRANS_CLOSE",value:function(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_CLOSE",value:function(){this.parent.removeDelayCall();}},{key:"next_CLOSE",value:function(){return "TRANS_OPNE"}},{key:"enter_CLOSE",value:function(){this.parent.onClose();}},{key:"exit_CLOSE",value:function(){}},{key:"canOpen",value:function(){return "IDLE"===this.state||"CLOSE"===this.state}},{key:"canClose",value:function(){return "IDLE"===this.state||"OPEN"===this.state}}]),r}(_n),Mn={delayCall:function(t,e,i){return this.delayCallTimer=function(t,e,i,n,s){var r=Qe(t);return r.time.delayedCall(e,(function(){r.game.events.once("poststep",(function(){i.call(n,s);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Rn={setTransitInTime:function(t){return this.transitInTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInCallback:function(t){return t||(t=$t),this.transitInCallback=t,this},setTransitOutCallback:function(t){return t||(t=$t),this.transitOutCallback=t,this}},zn={runTransitionInCallback:function(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen:function(){},requestOpen:function(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ln={runTransitionOutCallback:function(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose:function(){this.oneShotMode&&this.parent.destroy();},requestClose:function(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},An={};Object.assign(An,Mn,Rn,zn,Ln);var In=Phaser.Utils.Objects.GetValue,jn=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n)).setTransitInTime(In(n,"duration.in",200)),s.setTransitOutTime(In(n,"duration.out",200)),s.setTransitInCallback(In(n,"transitIn")),s.setTransitOutCallback(In(n,"transitOut")),s.oneShotMode=In(n,"destroy",!1),s.delayCallTimer=void 0,s._state=new Dn(a(s),{eventEmitter:!1,initState:In(n,"initState","IDLE")}),s.openEventData=void 0,s.closeEventData=void 0,s}return n(o,[{key:"state",get:function(){return this._state.state}},{key:"shutdown",value:function(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),c(r(o.prototype),"shutdown",this).call(this,t));}}]),o}(si);Object.assign(jn.prototype,An);var Nn=function(t){s(o,t);var i=h(o);function o(t,n,s){var r;return e(this,o),(r=i.call(this,t,0,0,2,2,n,1)).setAlpha(s),r.setScrollFactor(0),r.boot(),r}return n(o,[{key:"boot",value:function(){this.scene.sys.events.on("prerender",this.resize,this);}},{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.scene.sys.events.off("prerender",this.resize,this),c(r(o.prototype),"destroy",this).call(this,t));}},{key:"tint",get:function(){return this.fillColor},set:function(t){this.setFillStyle(t,this.fillAlpha);}},{key:"resize",value:function(){var t=this.scene,e=t.sys.scale.gameSize,i=t.sys.cameras.main,n=e.width,s=e.height,r=1/i.zoom,o=n/2,a=s/2,h=n*r,u=s*r;this.x===o&&this.y===a||this.setPosition(o,a),this.width===h&&this.height===u||this.setSize(h,u).setOrigin(.5);}}]),o}(Phaser.GameObjects.Rectangle),Xn=Phaser.Utils.Objects.GetValue,Yn=function(t){s(r,t);var i=h(r);function r(t,n){var s;return e(this,r),(s=i.call(this,t,{eventEmitter:!1})).resetFromJSON(n),s.boot(),s}return n(r,[{key:"resetFromJSON",value:function(t){return this.setHitAreaMode(Xn(t,"hitAreaMode",0)),this.setEnable(Xn(t,"enable",!0)),this.setStopMode(Xn(t,"stopAllLevels",!0)),this}},{key:"boot",value:function(){this.parent.on("pointerdown",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerup",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointermove",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerover",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation();}),this);}},{key:"setHitAreaMode",value:function(t){"string"==typeof t&&(t=Fn[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return !0}}),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}},{key:"setStopMode",value:function(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}}]),r}(si),Fn={default:0,fullWindow:1},Un=Phaser.Utils.Objects.GetValue,Vn=function(t){s(r,t);var i=h(r);function r(t,n){var s;e(this,r);var o=Un(n,"color",0),h=Un(n,"alpha",.8);return (s=i.call(this,t,o,h)).touchEventStop=new Yn(a(s),{hitAreaMode:1}),s}return n(r)}(Nn),Wn=function(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Di(t,e);},Gn=function(t,e){Mi(t,e,void 0,void 0,!1);},Bn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e);},Hn=function(t,e){Wi(t,e,!1);},Jn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e,t.alpha);},qn=function(t,e){Wi(t,e,!1);},Zn=function(t,e,i,n,s){return !!t&&(!(n&&!n(t,e,i))&&(!!kt(t,!0).contains(e,i)&&!(s&&!s(t,e,i))))},Kn=Phaser.Utils.Objects.GetValue,$n=function(t){s(o,t);var i=h(o);function o(t,n){var s;e(this,o),void 0===n&&(n={}),null==n.transitIn&&(n.transitIn=Qn.popUp),null==n.transitOut&&(n.transitOut=Qn.scaleDown),n.destroy=Kn(n,"destroy",!0),s=i.call(this,t,n);var r=Kn(n,"cover");s.cover=!1!==r?function(t,e){var i=t.scene,n=new Vn(i,e);return i.add.existing(n),t.isRexContainerLite?(t.pin(n,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(n)):i.children.moveBelow(n,t),n}(t,r):void 0,s.cover&&(s.setCoverTransitInCallback(Kn(r,"transitIn",Jn)),s.setCoverTransitOutCallback(Kn(r,"transitOut",qn)));var h=Kn(n,"touchOutsideClose",!1),u=Kn(n,"duration.hold",-1),c=Kn(n,"timeOutClose",u>=0),l=Kn(n,"anyTouchClose",!1);return Kn(n,"manualClose",!1)&&(h=!1,l=!1,c=!1),l&&(h=!1),c?s.setDisplayTime(u):s.setDisplayTime(-1),l?s.once("open",s.anyTouchClose,a(s)):h&&s.once("open",s.touchOutsideClose,a(s)),Kn(n,"openOnStart",!0)&&s.delayCall(0,s.requestOpen,a(s)),s}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),c(r(o.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&Zn(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"runTransitionInCallback",value:function(){var t=c(r(o.prototype),"runTransitionInCallback",this).call(this),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}},{key:"runTransitionOutCallback",value:function(){var t=c(r(o.prototype),"runTransitionOutCallback",this).call(this),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}},{key:"onOpen",value:function(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),c(r(o.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.closeEventData),c(r(o.prototype),"onClose",this).call(this);}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=Qn[t]),t){case Qn.popUp:t=Wn;break;case Qn.fadeIn:t=Bn;}return c(r(o.prototype),"setTransitInCallback",this).call(this,t),this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=Qn[t]),t){case Qn.scaleDown:t=Gn;break;case Qn.fadeOut:t=Hn;}return c(r(o.prototype),"setTransitOutCallback",this).call(this,t),this}},{key:"setCoverTransitInCallback",value:function(t){return this.coverTransitInCallback=t,this}},{key:"setCoverTransitOutCallback",value:function(t){return this.coverTransitOutCallback=t,this}}]),o}(jn),Qn={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},ts=function(t){return t&&"function"==typeof t},es={modal:function(t,e){return ts(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new $n(t,e);return i.on("open",(function(){t.emit("modal.open",i);})),i.on("close",(function(e){t.emit("modal.close",e,i);})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise:function(t){var e=this;return new Promise((function(i,n){e.modal(t,i);}))},modalClose:function(t){return function(t,e){t.emit("modal.requestClose",e);}(this,t),this}},is=function(t,e,i,n){if(e)return Zn(t,e.worldX,e.worldY,i,n);for(var s=t.scene.input.manager,r=s.pointersTotal,o=s.pointers,a=0;a<r;a++)if(e=o[a],Zn(t,e.worldX,e.worldY,i,n))return !0;return !1},ns=function(t){return "[object Array]"===Object.prototype.toString.call(t)},ss=function(t,e,i,n,s){return Zn(t,e,i,os(n),as(s))},rs=function(t){return !(t.rexSizer&&t.rexSizer.hidden)},os=function(t){return t?function(e,i,n){return !!rs(e)&&(t(e,i,n),!0)}:rs},as=function(t){return t},hs=function(t,e,i){!t||void 0===e&&void 0===i||(cs(t)?(void 0===e&&(e=t.width),void 0===i&&(i=t.height),t.resize?t.resize(e,i):t.setSize(e,i)):(void 0!==e&&(t.displayWidth=e),void 0!==i&&(t.displayHeight=i)));},us=[Phaser.GameObjects.Image,Phaser.GameObjects.Sprite,Phaser.GameObjects.Mesh,Phaser.GameObjects.Shader,Phaser.GameObjects.Video],cs=function(t){if(t.resize)return !0;if(!t.setSize)return !1;for(var e=0,i=us.length;e<i;e++){var n=us[e];if(n&&t instanceof n)return !1}return !0},ls={},ds=function(t){var e,i;this.sizerEventsEnable&&(e=t,void 0===(i=this.getChildPrevState(t))?i={}:!0===i&&(i=ls),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));},vs=function(t,e,i,n,s,r,o,a){Ce(t,e,i,n,s,r),void 0!==o&&(t.x+=o),void 0!==a&&(t.y+=a),this.resetChildPositionState(t),this.sizerEventsEnable&&t.emit("sizer.postlayout",t,this);},ps=Phaser.Display.Align.CENTER,fs=Phaser.Utils.Objects.IsPlainObject,ys=Phaser.Utils.Objects.GetValue,gs=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n))._enable=void 0,t.setInteractive(ys(n,"inputConfig",void 0)),s.resetFromJSON(n),s.boot(),s}return n(o,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(ys(t,"enable",!0)),this.setMode(ys(t,"mode",1)),this.setClickInterval(ys(t,"clickInterval",100)),this.setDragThreshold(ys(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("pointerout",this.onOut,this);}},{key:"shutdown",value:function(t){this.isShutdown||(this.pointer=null,c(r(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=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=ms[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,this.emit("down",this,this.parent,t,n),0===this.mode&&this.click(t.downTime,t,n));}},{key:"onRelease",value:function(t,e,i,n){this.pointer===t&&(this.emit("up",this,this.parent,t,n),1===this.mode&&this.click(t.upTime,t,n),this.pointer=void 0);}},{key:"onPointOut",value:function(t,e){this.pointer===t&&this.cancel();}},{key:"onMove",value:function(t,e,i,n){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&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):this}},{key:"onOut",value:function(t,e){return this.enable?(this.emit("out",this,this.parent,t,e),this):this}}]),o}(si),ms={press:0,pointerdown:0,release:1,pointerup:1},ks={onClick:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new gs(t,n)),t._click.on("click",e,i),this):this},offClick:function(t,e,i){return "function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._click||e._click.setEnable(i),this},disableClick:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._click||e._click.setEnable(!1),this}},bs=function(t,e,i,n){if(e)return !(i&&!i(t,e))&&(!!Cs(t,e)&&!(n&&!n(t,e)));for(var s=t.scene.input.manager,r=s.pointersTotal,o=s.pointers,a=0;a<r;a++)if(e=o[a],(!i||i(t,e))&&Cs(t,e)&&(!n||n(t,e)))return !0;return !1},Cs=function(t,e){for(var i=t.scene,n=i.input.cameras.getCamerasBelowPointer(e),s=i.input.manager,r=[t],o=0,a=n.length;o<a;o++)if(s.hitTest(e,r,n[o],Ss),Ss.length>0)return Ss.length=0,!0;return Ss.length=0,!1},Ss=[],ws=Phaser.Utils.Objects.GetValue,Ts=function(t){s(o,t);var i=h(o);function o(t,n){var s;e(this,o),(s=i.call(this,t,n))._enable=void 0;var r=ws(n,"inputConfig",void 0);return r&&t.setInteractive(r),s.resetFromJSON(n),s.boot(),s}return n(o,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(ws(t,"enable",!0)),this.setMode(ws(t,"mode",1)),this.setClickInterval(ws(t,"clickInterval",100)),this.setDragThreshold(ws(t,"threshold",void 0)),this}},{key:"boot",value:function(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this);}},{key:"shutdown",value:function(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,c(r(o.prototype),"shutdown",this).call(this,t);}}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=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=xs[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:"isPointerInside",value:function(t){var e=this.parent;return (e.input?bs:is)(e,t)}},{key:"onPress",value:function(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t)));}},{key:"onRelease",value:function(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0);}},{key:"onMove",value:function(t,e,i,n){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel();}},{key:"click",value:function(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}}]),o}(si),xs={press:0,pointerdown:0,release:1,pointerup:1},Os={onClickOutside:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Ts(t,n)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside:function(t,e,i){return "function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._clickOutside||e._clickOutside.setEnable(i),this},disableClickOutside:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._clickOutside||e._clickOutside.setEnable(!1),this}},Ps=function(t){s(r,t);var i=h(r);function r(){var t;return e(this,r),(t=i.call(this,{eventEmitter:!1})).goto("IDLE"),t}return n(r,[{key:"setCooldownTime",value:function(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}},{key:"request",value:function(){return this.runMethod("request")}},{key:"update_IDLE",value:function(){this.compensationTime=0;}},{key:"request_IDLE",value:function(){return this.next(),!0}},{key:"next_IDLE",value:function(){if(this.cooldownMode)return "COOLDOWN"}},{key:"enter_COOLDOWN",value:function(){this.remainderTime=this.cooldownTime+this.compensationTime;}},{key:"update_COOLDOWN",value:function(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"));}},{key:"request_COOLDOWN",value:function(){return !1}}]),r}(_n),Es=Phaser.Utils.Objects.GetValue,_s=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n))._enable=void 0,s.cooldown=new Ps,s.parent.setInteractive(Es(n,"inputConfig",void 0)),s.resetFromJSON(n),s.boot(),s}return n(o,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Es(t,"enable",!0)),this.setCooldown(Es(t,"cooldown",void 0)),this}},{key:"boot",value:function(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(r(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"cooldownTime",get:function(){return this.cooldown.cooldownTime},set:function(t){this.cooldown.setCooldownTime(t);}},{key:"setCooldown",value:function(t){return this.cooldownTime=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1);}},{key:"preupdate",value:function(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching;}}]),o}(si),Ds={isPointerInBounds:function(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&is(t)},onTouching:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _s(t,n)),t._inTouching.on("intouch",e,i),this):this},offTouching:function(t,e,i){return "function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _s(t,n)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd:function(t,e,i){return "function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._inTouching||e._inTouching.setEnable(i),this},disableTouching:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._inTouching||e._inTouching.setEnable(!1),this}},Ms=function(t,e,i){for(var n,s=0,r=t.length;s<r;s++)if(n=t[s],ss(n,e,i))return n.pointToChild(e,i);return null},Rs=function(t,e,i,n,s,r,o){var a;(a=void 0===s?n:Ms(i,n,s))&&t.emit(e,a,r,o);},zs=Phaser.Utils.Objects.GetValue,Ls=function(t){var e=zs(t,"down",void 0);!1!==e&&(!0===e&&(e=void 0),this.on("pointerdown",As,this));},As=function(t,e,i,n){var s=this._childrenInteractive;Rs(s.eventEmitter,"".concat(s.eventNamePrefix,"down"),s.targetSizers,t.worldX,t.worldY,t,n);},Is=Phaser.Utils.Objects.GetValue,js=function(t){var e=Is(t,"up",void 0);!1!==e&&(!0===e&&(e=void 0),this.on("pointerup",Ns,this));},Ns=function(t,e,i,n){var s=this._childrenInteractive;Rs(s.eventEmitter,"".concat(s.eventNamePrefix,"up"),s.targetSizers,t.worldX,t.worldY,t,n);},Xs=Phaser.Utils.Objects.GetValue,Ys=function(t){var e=Xs(t,"over",void 0);!1!==e&&(!0===e&&(e=void 0),this.on("pointermove",Fs,this).on("pointerover",Fs,this).on("pointerout",Us,this));},Fs=function(t,e,i,n){var s=this._childrenInteractive,r=Ms(s.targetSizers,t.worldX,t.worldY),o=s.lastOverChild;r&&o&&r===o||(s.lastOverChild=r,Rs(s.eventEmitter,"".concat(s.eventNamePrefix,"out"),s.targetSizers,o,void 0,t,n),Rs(s.eventEmitter,"".concat(s.eventNamePrefix,"over"),s.targetSizers,r,void 0,t,n));},Us=function(t,e){var i=this._childrenInteractive,n=i.lastOverChild;i.lastOverChild=null,Rs(i.eventEmitter,"".concat(i.eventNamePrefix,"out"),i.targetSizers,n,void 0,t,e);},Vs=Phaser.Utils.Objects.GetValue,Ws=function(t){var e=Vs(t,"click",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("threshold")||(e.threshold=10);var i=this._childrenInteractive;this._click=new gs(this,e),this._click.on("click",(function(t,e,n,s){Rs(i.eventEmitter,"".concat(i.eventNamePrefix,"click"),i.targetSizers,n.worldX,n.worldY,n,s);}),this);}},Gs=Phaser.Utils.Objects.GetValue,Bs=function(t){s(o,t);var i=h(o);function o(t,n){var s;e(this,o);var r=Qe(t);return r===t&&(t=void 0),(s=i.call(this,r,n)).gameObject=t,t&&t.setInteractive(Gs(n,"inputConfig",void 0)),s._enable=void 0,s.resetFromJSON(n),s.boot(),s}return n(o,[{key:"resetFromJSON",value:function(t){return this.setEnable(Gs(t,"enable",!0)),this.setDetectBounds(),void 0===this.gameObject?this.setDetectBounds(Gs(t,"bounds",void 0)):this.setDetectBounds(),this.tracerState=Hs,this.pointer=void 0,this.lastPointer=void 0,this.movedState=!1,this.isTouchingAnyObject=!1,this}},{key:"boot",value:function(){c(r(o.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("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this);}},{key:"shutdown",value:function(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("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.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,c(r(o.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=Js,void 0===this.gameObject&&(this.isTouchingAnyObject=e.length>0),this.onDragStart()));}},{key:"onPointerUp",value:function(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.movedState=!1,this.tracerState=Hs,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===Js&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Hs,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this);}},{key:"onDragEnd",value:function(){this.emit("dragend",this);}},{key:"onDrag",value:function(){this.emit("drag",this);}},{key:"preUpdate",value:function(t,e){}},{key:"postUpdate",value:function(t,e){}},{key:"startTicking",value:function(){c(r(o.prototype),"startTicking",this).call(this),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this);}},{key:"stopTicking",value:function(){c(r(o.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.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=qs,this}}]),o}(ai),Hs=0,Js=1,qs="IDLE",Zs=Phaser.Utils.Objects.GetValue,Ks=Phaser.Math.Distance.Between,$s=function(t){s(o,t);var i=h(o);function o(t,n){var s;e(this,o);var r=a(s=i.call(this,t,n)),h={states:{IDLE:{enter:function(){r.stop(),r.tapsCount=0,r.x=0,r.y=0,r.worldX=0,r.worldY=0;},exit:function(){var t=r.lastPointer;r.x=t.x,r.y=t.y,r.worldX=t.worldX,r.worldY=t.worldY;}},BEGIN:{enter:function(){r.start(),r.tapsCount=0,r.emit("tappingstart",r,r.gameObject,r.lastPointer);}},RECOGNIZED:{enter:function(){r.start(),r.emit("tap",r,r.gameObject,r.lastPointer),r.emit("".concat(r.tapsCount,"tap"),r,r.gameObject,r.lastPointer);}}},init:function(){this.state=Qs;},eventEmitter:!1};return s.setRecongizedStateObject(new _n(h)),s}return n(o,[{key:"resetFromJSON",value:function(t){c(r(o.prototype),"resetFromJSON",this).call(this,t),this.setHoldTime(Zs(t,"time",250)),this.setTapInterval(Zs(t,"tapInterval",200)),this.setDragThreshold(Zs(t,"threshold",9)),this.setTapOffset(Zs(t,"tapOffset",10));var e=Zs(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zs(t,"maxTaps",void 0)),this.setMinTaps(Zs(t,"minTaps",void 0))),this}},{key:"onDragStart",value:function(){switch(this.state){case Qs:this.state=tr;break;case tr:var t=this.lastPointer;Ks(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=er,this.state=tr);break;case er:this.state=tr;}}},{key:"onDragEnd",value:function(){this.state===tr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=er));}},{key:"onDrag",value:function(){this.state!==Qs&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Qs);}},{key:"preUpdate",value:function(t,e){if(this.isRunning&&this.enable&&this.state===tr){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=Qs);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=er:this.state=Qs);}}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===er&&(this.state=Qs);}},{key:"isTapped",get:function(){return this.state===er}},{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}}]),o}(Bs),Qs="IDLE",tr="BEGIN",er="RECOGNIZED",ir=Phaser.Utils.Objects.GetValue,nr=function(t){s(o,t);var i=h(o);function o(t,n){var s;e(this,o);var r=a(s=i.call(this,t,n)),h={states:{IDLE:{enter:function(){r.x=0,r.y=0,r.worldX=0,r.worldY=0;},exit:function(){var t=r.lastPointer;r.x=t.x,r.y=t.y,r.worldX=t.worldX,r.worldY=t.worldY;}},BEGIN:{enter:function(){r.start();},exit:function(){r.stop();}},RECOGNIZED:{enter:function(){r.emit("pressstart",r,r.gameObject,r.lastPointer);},exit:function(){r.emit("pressend",r,r.gameObject,r.lastPointer);}}},init:function(){this.state=sr;},eventEmitter:!1};return s.setRecongizedStateObject(new _n(h)),s}return n(o,[{key:"resetFromJSON",value:function(t){return c(r(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(ir(t,"threshold",9)),this.setHoldTime(ir(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=rr,0===this.holdTime&&(this.state=or);}},{key:"onDragEnd",value:function(){this.state=sr;}},{key:"onDrag",value:function(){this.state!==sr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sr);}},{key:"preUpdate",value:function(t,e){this.isRunning&&this.enable&&(this.state===rr&&t-this.pointer.downTime>=this.holdTime&&(this.state=or));}},{key:"isPressed",get:function(){return this.state===or}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(Bs),sr="IDLE",rr="BEGIN",or="RECOGNIZED";Phaser.Utils.Objects.GetValue;var ar=Phaser.Math.Distance.Between,hr=Phaser.Math.Angle.Between,ur={getDt:function(){var t;return t=this.scene,ii(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ar(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 hr(e.x,e.y,t.x,t.y)}},cr={"up&down":0,"left&right":1,"4dir":2,"8dir":3},lr={},dr=Phaser.Utils.Objects.GetValue,vr=Phaser.Math.RadToDeg,pr=function(t){s(o,t);var i=h(o);function o(t,n){var s;e(this,o);var r=a(s=i.call(this,t,n)),h={states:{IDLE:{enter:function(){r.x=0,r.y=0,r.worldX=0,r.worldY=0;},exit:function(){var t=r.lastPointer;r.x=t.x,r.y=t.y,r.worldX=t.worldX,r.worldY=t.worldY;}},BEGIN:{enter:function(){r.validDrag=!1;}},RECOGNIZED:{enter:function(){r.start(),r.updateDirectionStates(),r.emit("swipe",r,r.gameObject,r.lastPointer);},exit:function(){r.stop(),r.clearDirectionStates();}}},init:function(){this.state=fr;},eventEmitter:!1};return s.setRecongizedStateObject(new _n(h)),s.clearDirectionStates(),s}return n(o,[{key:"resetFromJSON",value:function(t){return c(r(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(dr(t,"threshold",10)),this.setVelocityThreshold(dr(t,"velocityThreshold",1e3)),this.setDirectionMode(dr(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=yr;}},{key:"onDragEnd",value:function(){this.state=fr;}},{key:"onDrag",value:function(){this.state===yr&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gr));}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===gr&&(this.state=fr);}},{key:"isSwiped",get:function(){return this.state===gr}},{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=cr[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=lr),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0;}}(vr(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}]),o}(Bs);Object.assign(pr.prototype,ur);var fr="IDLE",yr="BEGIN",gr="RECOGNIZED",mr=Phaser.Utils.Objects.GetValue,kr=Phaser.Utils.Array.SpliceOne,br=Phaser.Math.Distance.Between,Cr=Phaser.Math.Angle.Between,Sr=function(){function t(i,n){e(this,t);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.setEventEmitter(mr(n,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(n),this.boot();}return n(t,[{key:"resetFromJSON",value:function(t){return this.setEnable(mr(t,"enable",!0)),this.bounds=mr(t,"bounds",void 0),this.tracerState=Tr,this.pointers.length=0,_t(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("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this);}},{key:"shutdown",value:function(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,_t(this.movedState),this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=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 Tr:this.tracerState=xr,this.onDrag1Start();break;case xr:this.tracerState=Or,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],kr(this.pointers,e),this.tracerState){case xr:this.tracerState=Tr,this.onDrag1End();break;case Or:this.tracerState=xr,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);else 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 xr:this.onDrag1();break;case Or:this.onDrag2();}}}},{key:"dragCancel",value:function(){return this.tracerState===Or&&this.onDrag2End(),this.pointers.length=0,_t(this.movedState),this.tracerState=Tr,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!==Or)return 0;var t=this.pointers[0],e=this.pointers[1];return br(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==Or)return 0;var t=this.pointers[0],e=this.pointers[1];return Cr(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;wr.x=e.x-i.x,wr.y=e.y-i.y;}else wr.x=0,wr.y=0;return wr}},{key:"centerX",get:function(){if(this.tracerState!==Or)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!==Or)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!==Or)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!==Or)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=Pr,this}}]),t}();Object.assign(Sr.prototype,Ze);var wr={},Tr=0,xr=1,Or=2,Pr="IDLE";Phaser.Utils.Objects.GetValue;var Er=Phaser.Math.RotateAround,_r=function(t,e,i,n){return Er(t,e,i,n),t.rotation+=n,t},Dr={},Mr=Phaser.Utils.Objects.GetValue,Rr=Phaser.Math.Angle.WrapDegrees,zr=Phaser.Math.Angle.ShortestBetween,Lr=Phaser.Math.RadToDeg,Ar=Phaser.Math.DegToRad,Ir=function(t){s(o,t);var i=h(o);function o(t,n){var s;e(this,o);var r=a(s=i.call(this,t,n)),h={states:{IDLE:{enter:function(){r.prevAngle=void 0,r.angle=0;}},BEGIN:{},RECOGNIZED:{enter:function(){r.emit("rotatestart",r);},exit:function(){r.emit("rotateend",r);}}},init:function(){this.state=Nr;},eventEmitter:!1};return s.setRecongizedStateObject(new _n(h)),s}return n(o,[{key:"resetFromJSON",value:function(t){return c(r(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Mr(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=Rr(Lr(this.angleBetween)),this.state=Xr,0===this.dragThreshold&&(this.state=Yr);}},{key:"onDrag2End",value:function(){this.state=Nr;}},{key:"onDrag2",value:function(){switch(this.state){case Xr:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Rr(Lr(this.angleBetween));this.angle=zr(this.prevAngle,t),this.prevAngle=t,this.state=Yr;}break;case Yr:t=Rr(Lr(this.angleBetween));this.angle=zr(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this);}}},{key:"isRotated",get:function(){return this.state===Yr}},{key:"rotation",get:function(){return Ar(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(Sr),jr={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,n=this.movementCenterY,s=function(t,e,i,n){return void 0===n?n={}:!0===n&&(n=Dr),i.getWorldPoint(t,e,n),n}(this.centerX,this.centerY,e,!0),r=s.x,o=s.y,a=this.rotation;if(Array.isArray(t))for(var h=t,u=0,c=h.length;u<c;u++)(t=h[u]).x+=i,t.y+=n,_r(t,r,o,a);else t.x+=i,t.y+=n,_r(t,r,o,a);return this}};Object.assign(Ir.prototype,jr);var Nr="IDLE",Xr="BEGIN",Yr="RECOGNIZED",Fr=Phaser.Utils.Objects.GetValue,Ur=function(t){var e=Fr(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new $s(this,e),this._tap.on("tap",(function(t,e,n){Rs(i.eventEmitter,"".concat(i.eventNamePrefix).concat(t.tapsCount,"tap"),i.targetSizers,t.worldX,t.worldY,n);}),this);}},Vr=Phaser.Utils.Objects.GetValue,Wr=function(t){var e=Vr(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nr(this,e),this._press.on("pressstart",(function(t,e,n){Rs(i.eventEmitter,"".concat(i.eventNamePrefix,"pressstart"),i.targetSizers,t.worldX,t.worldY,n);}),this).on("pressend",(function(t,e,n){Rs(i.eventEmitter,"".concat(i.eventNamePrefix,"pressend"),i.targetSizers,t.worldX,t.worldY,n);}),this);}},Gr=Phaser.Utils.Objects.GetValue,Br=function(t){var e=Gr(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new pr(this,e),this._swipe.on("swipe",(function(t,e,n){var s=t.left?"left":t.right?"right":t.up?"up":"down";Rs(i.eventEmitter,"".concat(i.eventNamePrefix,"swipe").concat(s),i.targetSizers,t.worldX,t.worldY,n);}),this);}},Hr=Phaser.Utils.Objects.GetValue,Jr=function(t,e){return t.setInteractive(),Hr(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Hr(e,"targets",[t]),eventEmitter:Hr(e,"eventEmitter",t),eventNamePrefix:Hr(e,"inputEventPrefix","child.")},Ls.call(t,e),js.call(t,e),Ys.call(t,e),Ws.call(t,e),Ur.call(t,e),Wr.call(t,e),Br.call(t,e),t},qr={getSizerConfig:function(t){return void 0===t&&(t=this),Gt(t)},getChildPrevState:function(t){var e=Gt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Jt(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,o,a=t.scene;if("number"==typeof e)i=e;else {i=Se(e,"color"),n=Se(e,"lineWidth");var h=Se(e,"name",!1);h&&(s=Se(h,"createTextCallback",Te),r=Se(h,"createTextCallbackScope",void 0),"string"==typeof(o=Se(h,"align","left-top"))&&(o=Kt[o]));}if(void 0===i&&(i=16777215),void 0===n&&(n=1),s&&!t.children){t.children=new we(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0;}));var u=t.clear.bind(t);t.clear=function(){u(),t.children.clear(!1,!0);};}for(var c,l,d=this.getAllShownChildren([this]),v=0,p=d.length;v<p;v++)((c=d[v]).getBounds||void 0!==c.width&&void 0!==c.height)&&(xe=kt(c,xe),null!=i&&t.lineStyle(n,i).strokeRectShape(xe),c.name&&s&&(l=r?s.call(r,a):s(a))&&(l.setText(c.name),t.children.add(l),Ce(l,xe.x,xe.y,xe.width,xe.height,o)));return this},resolveWidth:Be,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:He,postResolveSize:function(t,e){},getChildWidth:function(t){return t.isRexSizer?Math.max(t.minWidth,t.childrenWidth):void 0!==t.minWidth?t.minWidth:pt(t)},getChildHeight:function(t){return t.isRexSizer?Math.max(t.minHeight,t.childrenHeight):void 0!==t.minHeight?t.minHeight:ft(t)},getExpandedChildWidth:function(t,e){return e},getExpandedChildHeight:function(t,e){return e},getChildrenWidth:function(){return 0},getChildrenHeight:function(){return 0},addChildrenMap:Ye,addElement:Ye,removeChildrenMap:function(e){if("object"===t(e)){var i=e;for(var e in this.childrenMap)if(this.childrenMap[e]===i)return delete this.childrenMap[e],this}return delete this.childrenMap[e],this},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(Fe);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}},getChildIndex:function(t){if(Array.isArray(this.sizerChildren)){var e=this.sizerChildren.indexOf(t);return -1===e&&(e=null),e}if(this.getParentSizer(t)!==this)return null;for(var i in this.sizerChildren)if(this.sizerChildre[i]===t)return i;return 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:qe,layout:function(){var t=this.scaleX,e=this.scaleY,i=1===t&&1===e;return i||this.setScale(1),this.runLayout(),this.postLayout(),this._postLayout(),i||this.setScale(t,e),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.postResolveSize(e,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},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,o,a=this.backgroundChildren,h=this.left,u=this.top,c=this.width,l=this.height,d=0,v=a.length;d<v;d++)(e=(t=a[d]).rexSizer).hidden||(i=e.padding,ds.call(this,t),n=h+i.left,s=u+i.top,r=c-i.left-i.right,o=l-i.top-i.bottom,hs(t,r,o),vs.call(this,t,n,s,r,o,ps));},postLayout:function(t,e,i){return this},_postLayout:function(t,e,i){return this._anchor&&this._anchor.updatePosition(),this},setAnchor:function(t){void 0===t&&(t={});var e=t.hasOwnProperty("width"),i=t.hasOwnProperty("height"),n=t.hasOwnProperty("onResizeCallback");return !e&&!i||n||(t.onResizeCallback=function(t,n,s){e&&s.setMinWidth(t),i&&s.setMinHeight(n),s.layout();}),void 0===this._anchor?this._anchor=new ri(this,t):this._anchor.resetFromJSON(t),this},isInTouching:function(t,e){return (Rt(t)||"string"==typeof t)&&(e=t,t=void 0),void 0===e?e=this:"string"==typeof e&&(e=this.getElement(e)),is(e,t)},pointToChild:function(t,e,i,n,s){if(ts(i)||(s=i,i=void 0,n=void 0),void 0===s&&(s=this.sizerChildren?this.sizerChildren:this.children),ns(s)){for(var r,o=0,a=s.length;o<a;o++)if(r=s[o],ss(r,t,e,i,n))return r}else for(var h in s)if(r=s[h],ss(r,t,e,i,n))return r;return null},setDraggable:function(e,i,n){if(fs(e)){var s=e;e=s.sensor,n=s.target,i=s.draggable;}else "boolean"!=typeof i&&(n=i,i=void 0);var r=t(e);if("string"===r){var o=e;if(!(e=this.getElement(o)))return console.error("Can get element '".concat(o,"'")),this}else void 0!==e&&"object"==r||(i=e,e=this);return void 0===i&&(i=!0),e.input&&e.input._rexUIDragSizer?e.input.draggable=i:i&&(e.setInteractive(),e.scene.input.setDraggable(e),e.on("drag",(function(t,i,s){var r=void 0===n?this.getTopmostSizer():n;r.x+=i-e.x,r.y+=s-e.y,r.emit("sizer.drag",t,i,s);}),this).on("dragstart",(function(t,e,i){(void 0===n?this.getTopmostSizer():n).emit("sizer.dragstart",t,e,i);}),this).on("dragend",(function(t,e,i,s){(void 0===n?this.getTopmostSizer():n).emit("sizer.dragend",t,e,i,s);}),this).on("drop",(function(t,e){(void 0===n?this.getTopmostSizer():n).emit("sizer.drop",t,e);})),e.input._rexUIDragSizer=!0),this},setChildrenInteractive:function(t){return Jr(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(qr,Ge,De,Xe,Re,Ii,Hi,sn,ln,gn,ks,Os,Ds,kn,es,Je);var Zr=Phaser.Utils.Objects.GetValue,Kr=function(t){s(o,t);var i=h(o);function o(t,n,s,r,a,h){var u;e(this,o),(u=i.call(this,t,n,s,1,1)).isRexSizer=!0,u.setMinSize(r,a),u.setName(Zr(h,"name","")),u.rexSizer={},u.space={},u.backgroundChildren=void 0,u.sizerChildren=void 0,u.childrenMap={},u.layoutedChildren=void 0,u.enableLayoutWarn();var c=Zr(h,"anchor",void 0);c&&u.setAnchor(c),u.setInnerPadding(Zr(h,"space",0));var l=Zr(h,"draggable",!1);return l&&u.setDraggable(l),u.setSizerEventsEnable(Zr(h,"sizerEvents",!1)),u.setDirty(!0),Zr(h,"enableLayer",!1)&&u.enableLayer(),u}return n(o,[{key:"destroy",value:function(t){if(this.scene&&!this.ignoreDestroy){if(t)for(var e=this.getAllChildrenSizers([this]),i=0,n=e.length;i<n;i++)e[i].sizerEventsEnable=!1;c(r(o.prototype),"destroy",this).call(this,t),_t(this.backgroundChildren),_t(this.sizerChildren),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:"enableLayoutWarn",value:function(t){return void 0===t&&(t=!0),this.layoutWarnEnable=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-pt(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+pt(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+pt(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-ft(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+ft(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+ft(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*this.scaleX}},{key:"innerRight",get:function(){return this.right-this.space.right*this.scaleX}},{key:"innerTop",get:function(){return this.top+this.space.top*this.scaleY}},{key:"innerBottom",get:function(){return this.bottom-this.space.bottom*this.scaleY}},{key:"innerWidth",get:function(){return (this.width-this.space.left-this.space.right)*this.scaleX}},{key:"innerHeight",get:function(){return (this.height-this.space.top-this.space.bottom)*this.scaleY}},{key:"minInnerWidth",get:function(){var t=(this.minWidth-this.space.left-this.space.right)*this.scaleX;return Math.max(t,0)}},{key:"minInnerHeight",get:function(){var t=(this.minHeight-this.space.top-this.space.bottom)*this.scaleY;return Math.max(t,0)}}]),o}(Wt);Object.assign(Kr.prototype,qr);var $r=function(t,e){t.width<t.childrenWidth&&console.warn("Layout width error: Parent=".concat(e.constructor.name,", Child=").concat(t.constructor.name)),t.height<t.childrenHeight&&console.warn("Layout height error: Parent=".concat(e.constructor.name,", Child=").concat(t.constructor.name));},Qr=Phaser.Math.Wrap,to=function(t){s(r,t);var i=h(r);function r(t){var n;return e(this,r),(n=i.call(this,t,0,0,1,1)).isRexSpace=!0,n}return n(r)}(Phaser.GameObjects.Zone),eo=function(t,e){var i=this.sizerChildren;if(0===i.length)return -1;for(var n=-1,s=1/0,r=0,o=i.length;r<o;r++){var a=i[r];s>(h=0===this.orientation?Math.abs(a.left-t):Math.abs(a.top-e))&&(s=h,n=r);}var h;a=i[i.length-1];return s>(h=0===this.orientation?Math.abs(a.right-t):Math.abs(a.bottom-e))&&(s=h,n=r+1),n},io=Phaser.Utils.Objects.IsPlainObject,no=Phaser.Utils.Objects.GetValue,so=Phaser.Display.Align.CENTER,ro={min:0,full:-1},oo=function(e,i,n,s,r,o,a,h,u,c){_e.call(this,e);var l=e.isRexSpace,d=t(i);if(null===i)return this;if("number"===d);else if("string"===d)i=ro[i];else if(io(i)){var v;i=no(v=i,"proportion",void 0),n=no(v,"align",so),s=no(v,"padding",0),r=no(v,"expand",!1),o=no(v,"key",void 0),a=no(v,"index",void 0),e.isRexSizer||(h=no(v,"minWidth",void 0),u=no(v,"minHeight",void 0)),c=no(v,"fitRatio",0);}return "string"==typeof n&&(n=Kt[n]),void 0===i&&(i=l?1:0),void 0===n&&(n=so),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(l?h=0:e.isRexSizer||(h=e._minWidth)),void 0===u&&(l?u=0:e.isRexSizer||(u=e._minHeight)),void 0===c&&(c=0),(v=this.getSizerConfig(e)).proportion=i,v.align=n,v.padding=Pe(s),v.expand=r,v.fitRatio=0===i?c:0,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(e):this.sizerChildren.splice(a,0,e),e.isRexSizer||(i>0&&(0===this.orientation?e.minWidth=void 0===h?pt(e):h:e.minHeight=void 0===u?ft(e):u),r&&(0===this.orientation?e.minHeight=u:e.minWidth=h)),void 0!==o&&this.addChildrenMap(o,e),this},ao={add:oo,addSpace:function(t){return this.insertSpace(void 0,t),this},insertSpace:function(t,e){return void 0===e&&(e=1),oo.call(this,new to(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert:function(t,e,i,n,s,r,o,a){return io(i)&&(i.index=t),oo.call(this,e,i,n,s,r,o,t,a),this},insertAtPosition:function(t,e,i,n,s,r,o,a,h){var u=eo.call(this,t,e);return -1===u&&(u=void 0),this.insert(u,i,n,s,r,o,a,h),this}},ho=Wt.prototype.clear,uo=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ho.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},co=Phaser.Utils.Array.Remove,lo={remove:function(t,e){return this.getParentSizer(t)!==this||(co(this.sizerChildren,t),Ie.call(this,t,e)),this},removeAll:function(t){for(var e=this.sizerChildren.length-1;e>=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,uo.call(this,t),this}},vo={getChildAlign:function(t){return this.getSizerConfig(t).align},setChildAlign:function(t,e){return "string"==typeof e&&(e=Kt[e]),this.getSizerConfig(t).align=e,this}},po={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,s=0,r=this.sizerChildren;if(0===this.orientation)for(var o=this.space.item,a=!0,h=0,u=r.length;h<u;h++)(e=r[h]).rexSizer.hidden||(n=0===e.rexSizer.proportion||t?this.getChildWidth(e):0,n+=(i=e.rexSizer.padding).left+i.right,a?a=!1:n+=o,s+=n);else for(h=0,u=r.length;h<u;h++)(e=r[h]).hasOwnProperty("rexSizer")&&(e.rexSizer.hidden||(i=e.rexSizer.padding,n=this.getChildWidth(e)+i.left+i.right,s=Math.max(n,s)));return s+this.space.left+this.space.right},getChildrenHeight:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,s=0,r=this.sizerChildren;if(0===this.orientation)for(var o=0,a=r.length;o<a;o++)(e=r[o]).rexSizer.hidden||(i=e.rexSizer.padding,n=this.getChildHeight(e)+i.top+i.bottom,s=Math.max(n,s));else {var h=this.space.item,u=!0;for(o=0,a=r.length;o<a;o++)(e=r[o]).hasOwnProperty("rexSizer")&&(e.rexSizer.hidden||(n=0===e.rexSizer.proportion||t?this.getChildHeight(e):0,n+=(i=e.rexSizer.padding).top+i.bottom,u?u=!1:n+=h,s+=n));}return s+this.space.top+this.space.bottom},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width);var n=t.rexSizer,s=n.padding;0===this.orientation?n.proportion>0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength):n.expand&&(i=e-this.space.left-this.space.right-s.left-s.right);return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer,s=n.padding;0===this.orientation?n.expand&&(i=e-this.space.top-this.space.bottom-s.top-s.bottom):n.proportion>0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,s=i.length;n<s;n++)(e=i[n]).isRexSizer&&t.push(e);return t},preLayout:function(){this.hasRatioFitChild=!1;for(var t=this.sizerChildren,e=0,i=t.length;e<i;e++){var n=t[e];n.rexSizer.hidden||n.rexSizer.fitRatio&&(hs(n,1,1),this.hasRatioFitChild=!0);}return this._childrenProportion=void 0,this.proportionLength=void 0,qe.call(this),this},postResolveSize:function(t,e){if(this.hasRatioFitChild){var i;0===this.orientation?i=e-this.getInnerPadding("top")-this.getInnerPadding("bottom"):(this.getInnerPadding("left"),this.getInnerPadding("right"));for(var n,s,r=this.sizerChildren,o=0,a=r.length;o<a;o++){var h=r[o];if(!h.rexSizer.hidden){var u=h.rexSizer.fitRatio;u&&(0===this.orientation?n=(s=i-this.getChildOuterPadding(h,"top")-this.getChildOuterPadding(h,"bottom"))*u:s=(n=i-this.getChildOuterPadding(h,"top")-this.getChildOuterPadding(h,"bottom"))/u,hs(h,n,s),h.isRexSizer&&h.setMinSize(n,s));}}this.proportionLength=void 0,this._childrenWidth=void 0,this.resolveWidth(t,!0);}},layoutChildren:function(){for(var t,e,i,n,s,r,o,a,h,u,c=this.sizerChildren,l=this.innerLeft,d=this.innerTop,v=this.innerWidth,p=this.innerHeight,f=l,y=d,g=this.startChildIndex,m=0,k=c.length;m<k;m++)u=0===g?m:Qr(m+g,0,k),this.rtl&&(u=k-u-1),(t=c[u]).rexSizer.hidden||(i=(e=t.rexSizer).padding,ds.call(this,t),t.isRexSpace?(a=0,h=0):(a=this.getExpandedChildWidth(t),h=this.getExpandedChildHeight(t)),t.isRexSizer?(t.runLayout(this,a,h),$r(t,this)):hs(t,a,h),void 0===a&&(a=pt(t)),void 0===h&&(h=ft(t)),0===this.orientation?(n=f+i.left,r=0===e.proportion||0===this.proportionLength?a:e.proportion*this.proportionLength,s=y+i.top,o=p-i.top-i.bottom):(n=f+i.left,r=v-i.left-i.right,s=y+i.top,o=0===e.proportion||0===this.proportionLength?h:e.proportion*this.proportionLength),vs.call(this,t,n,s,r,o,e.align),0===this.orientation?f+=r+i.left+i.right+this.space.item:y+=o+i.top+i.bottom+this.space.item);},resolveWidth:function(t){t=Be.call(this,t);if(void 0===this.proportionLength&&0===this.orientation){var e=t-this.childrenWidth;e>0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t},resolveHeight:function(t){t=He.call(this,t);if(void 0===this.proportionLength&&1===this.orientation){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t}};Object.assign(po,ao,lo,vo,{getChildProportion:function(t){return this.getSizerConfig(t).proportion},setChildProportion:function(t,e){return this.getSizerConfig(t).proportion=e,this}},{getChildExpand:function(t){return this.getSizerConfig(t).expand},setChildExpand:function(t,e){return this.getSizerConfig(t).expand=e,this}});var fo=function(){for(var t,e,i=0,n=this.sizerChildren,s=0,r=n.length;s<r;s++)(t=n[s]).rexSizer.hidden||(e=t.rexSizer.proportion)>0&&(i+=e);return i},yo={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},go=Phaser.Utils.Objects.IsPlainObject,mo=Phaser.Utils.Objects.GetValue,ko=function(t){s(r,t);var i=h(r);function r(t,n,s,o,a,h,u){var c;return e(this,r),go(n)?(n=mo(u=n,"x",0),s=mo(u,"y",0),o=mo(u,"width",void 0),a=mo(u,"height",void 0),h=mo(u,"orientation",0)):go(o)?(o=mo(u=o,"width",void 0),a=mo(u,"height",void 0),h=mo(u,"orientation",0)):go(h)&&(h=mo(u=h,"orientation",0)),void 0===h&&(h=0),(c=i.call(this,t,n,s,o,a,u)).type="rexSizer",c.sizerChildren=[],c.setOrientation(h),c.setItemSpacing(mo(u,"space.item",0)),c.setStartChildIndex(mo(u,"startChildIndex",0)),c.setRTL(mo(u,"rtl",!1)),c.addChildrenMap("items",c.sizerChildren),c}return n(r,[{key:"setOrientation",value:function(t){return this.orientation=function(t){return "string"==typeof t&&(t=yo[t]),t}(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setStartChildIndex",value:function(t){return this.startChildIndex=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"childrenProportion",get:function(){return void 0===this._childrenProportion&&(this._childrenProportion=fo.call(this)),this._childrenProportion}}]),r}(Kr);Object.assign(ko.prototype,po);var bo=function(t,e,i){if(t){var n=null==e,s=null==i;return n&&s||(n||(t.displayWidth=e),s||(t.displayHeight=i),n&&(t.scaleX=t.scaleY),s&&(t.scaleY=t.scaleX)),t}},Co={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?"".concat(this.text,"\n").concat(t):"".concat(this.text).concat(t))!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var n=t.iconSize;n&&(this.setChildDisplaySize(i,n,n),void 0!==this.iconWidth&&this.setIconSize(n)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame);}var s=this.childrenMap.action;if(s){t.action?this.show(s):this.hide(s);var r=t.actionSize;r&&(this.setChildDisplaySize(s,r,r),void 0!==this.actionWidth&&this.setActionSize(r)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame);}return this}},So=function(t){s(o,t);var i=h(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"text",get:function(){var t=this.childrenMap.text;return t?t.text:""},set:function(t){var e=this.childrenMap.text;e&&e.setText(t);}},{key:"setText",value:function(t){return this.text=t,this}},{key:"setIconTexture",value:function(t,e){var i=this.childrenMap.icon;return i?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(bo(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}},{key:"setTexture",value:function(t,e){return this.setIconTexture(t,e),this}},{key:"setIconSize",value:function(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}},{key:"texture",get:function(){var t=this.childrenMap.icon;if(t)return t.texture}},{key:"frame",get:function(){var t=this.childrenMap.icon;if(t)return t.frame}},{key:"setActionTexture",value:function(t,e){var i=this.childrenMap.action;return void 0===i||(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(bo(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i))),this}},{key:"actionTexture",get:function(){var t=this.childrenMap.action;if(t)return t.texture}},{key:"actionFrame",get:function(){var t=this.childrenMap.action;if(t)return t.frame}},{key:"setActionSize",value:function(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}},{key:"preLayout",value:function(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&bo(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&bo(e,this.actionWidth,this.actionHeight),c(r(o.prototype),"preLayout",this).call(this);}},{key:"postLayout",value:function(t,e,i){var n=this.childrenMap.iconMask;n&&(n.setPosition(),this.resetChildPositionState(n));var s=this.childrenMap.actionMask;return s&&(s.setPosition(),this.resetChildPositionState(s)),this}},{key:"resize",value:function(t,e){c(r(o.prototype),"resize",this).call(this,t,e);var i=this.childrenMap.iconMask;i&&i.resize();var n=this.childrenMap.actionMask;return n&&n.resize(),this}}]),o}(ko);Object.assign(So.prototype,Co);var wo=function(t,e,i,n,s){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var r=Math.min(t,e)/2;this.fillCircle(-t*(n-.5),-e*(s-.5),r+i);}else this.fillRect(-t*n-i.left,-e*s-i.top,t+i.left+i.right,e+i.top+i.bottom);},To=function(t){s(o,t);var i=h(o);function o(t,n,s){var r;return e(this,o),void 0===n&&(n=0),"string"==typeof n&&(n=xo[n]),(r=i.call(this,t.scene)).parent=t,r.shapeType=n,r.padding=Pe(s),r.setPosition().resize().setVisible(!1),r}return n(o,[{key:"destroy",value:function(){return this.parent=void 0,c(r(o.prototype),"destroy",this).call(this),this}},{key:"setPosition",value:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),c(r(o.prototype),"setPosition",this).call(this,t,e),this}},{key:"resize",value:function(t,e,i){var n=this.parent;void 0===t&&(t=n.width),void 0===e&&(e=n.height),void 0===i?i=this.padding:"number"==typeof i&&(i=Pe(i));var s=this.width!==t||this.height!==e,r=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return !1;if(t[i]!==e[i])return !1}for(var i in e)if(!(i in t))return !1;return !0}(this.padding,i);return s||r?(this.width=t,this.height=e,r&&Dt(i,this.padding),this.originX=n.originX,this.originY=n.originY,wo.call(this,t,e,i,n.originX,n.originY),this):this}},{key:"setOrigin",value:function(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,wo.call(this,this.width,this.height,this.padding,t,e)),this}}]),o}(Phaser.GameObjects.Graphics),xo={rectangle:0,circle:1},Oo=function(t,e,i,n){var s=new To(e,i,n);if(t&&!t.isRexSizer){var r=s.createGeometryMask();t.setMask(r),this.once("destroy",(function(){t.setMask(),r.destroy();}));}return this.pin(s),s},Po=Phaser.Utils.Objects.GetValue,Eo=function(t){s(r,t);var i=h(r);function r(t,n){var s;e(this,r),(s=i.call(this,t,n)).type="rexLabel";var o=Po(n,"background",void 0),h=Po(n,"icon",void 0),u=Po(n,"iconMask",void 0),c=Po(n,"text",void 0),l=Po(n,"action",void 0),d=Po(n,"actionMask",void 0),v=Po(n,"align",void 0);if(o&&s.addBackground(o),"right"!==v&&"bottom"!==v&&"center"!==v||s.addSpace(),h){0===s.orientation?(c||l)&&(C={right:Po(n,"space.icon",0),top:Po(n,"space.iconTop",0),bottom:Po(n,"space.iconBottom",0),left:Po(n,"space.iconLeft",0)}):(c||l)&&(C={bottom:Po(n,"space.icon",0),left:Po(n,"space.iconLeft",0),right:Po(n,"space.iconRight",0),top:Po(n,"space.iconTop",0)});var p=Po(n,"squareFitIcon",!1)?1:0;if(s.add(h,{proportion:0,padding:C,fitRatio:p}),u&&(u=Oo.call(a(s),h,h,1)),!p){var f=Po(n,"iconSize",void 0);s.setIconSize(Po(n,"iconWidth",f),Po(n,"iconHeight",f));}}if(c){var y,g,m=Po(n,"space.text",0),k=Po(n,"expandTextWidth",!1),b=Po(n,"expandTextHeight",!1);0===s.orientation?(y=k?1:0,l&&(C={right:m}),g=b):(y=b?1:0,l&&(C={bottom:m}),g=k),s.add(c,{proportion:y,expand:g,padding:C});}if(l){var C;C=0===s.orientation?{top:Po(n,"space.actionTop",0),bottom:Po(n,"space.actionBottom",0),right:Po(n,"space.actionRight",0)}:{left:Po(n,"space.actionLeft",0),right:Po(n,"space.actionRight",0),bottom:Po(n,"space.actionBottom",0)};p=Po(n,"squareFitAction",!1)?1:0;if(s.add(l,{proportion:0,padding:C,fitRatio:p}),d&&(d=Oo.call(a(s),l,l,1)),!p){var S=Po(n,"actionSize");s.setActionSize(Po(n,"actionWidth",S),Po(n,"actionHeight",S));}}return "center"===v&&s.addSpace(),s.addChildrenMap("background",o),s.addChildrenMap("icon",h),s.addChildrenMap("iconMask",u),s.addChildrenMap("text",c),s.addChildrenMap("action",l),s.addChildrenMap("actionMask",d),s}return n(r)}(So),_o=function(t,e){t.popUp(e);},Do=function(t,e){t.scaleDown(e);},Mo=function(t,e){t.fadeIn(e);},Ro=function(t,e){t.fadeOut(e);},zo=Phaser.Utils.Objects.GetValue,Lo=function(t){s(o,t);var i=h(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"startTicking",value:function(){c(r(o.prototype),"startTicking",this).call(this),this.scene.sys.events.on("update",this.update,this);}},{key:"stopTicking",value:function(){c(r(o.prototype),"stopTicking",this).call(this),this.scene&&this.scene.sys.events.off("update",this.update,this);}},{key:"update",value:function(t,e){return this.isRunning&&0!==this.timeScale?(this.tick(e),this):this}}]),o}(function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n)).resetFromJSON(n),s.boot(),s}return n(o,[{key:"resetFromJSON",value:function(t){return this.isRunning=zo(t,"isRunning",!1),this.timeScale=zo(t,"timeScale",1),this.now=zo(t,"now",0),this}},{key:"toJSON",value:function(){return {isRunning:this.isRunning,timeScale:this.timeScale,now:this.now,tickingMode:this.tickingMode}}},{key:"start",value:function(t){return void 0===t&&(t=0),this.delta=0,this.now=t,c(r(o.prototype),"start",this).call(this),this}},{key:"seek",value:function(t){return this.now=t,this}},{key:"setTimeScale",value:function(t){return this.timeScale=t,this}},{key:"tick",value:function(t){return t*=this.timeScale,this.now+=t,this.delta=t,this.emit("update",this.now,this.delta),this}}]),o}(ai)),Ao=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=e.length),t.length=n-i;for(var s=0,r=t.length;s<r;s++)t[s]=e[s+i];return t},Io=/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i,jo=/^0x[0-9A-F]+$/i,No=function(t){if("string"!=typeof t)return t;if(""===t)t=null;else if(Io.test(t))t=parseFloat(t);else if(jo.test(t))t=parseInt(t,16);else switch(t){case"false":t=!1;break;case"true":t=!0;break;case"null":t=null;break;case"undefined":t=void 0;}return t},Xo=function t(e,i,n){var s,r=Tn(n,"reverse",!1);if(ns(e[0]))if(r)for(o=(a=e.length)-1;o>=0;o--)s=t(e[o],i,n);else for(var o=0,a=e.length;o<a;o++)s=t(e[o],i,n);else s=Yo(e,i,n);return s},Yo=function(t,e,i){var n,s=Tn(i,"argsConvert",void 0),r=Tn(i,"argsConvertScope",void 0),o=t[0];if(Fo=Ao(Fo,t,1),s){!0===s&&(s=No,r=void 0);for(var a=0,h=Fo.length;a<h;a++)Fo[a]=r?s.call(r,Fo[a],t):s(Fo[a],t);}return "string"==typeof o?null==(n=e[o])&&(n=Tn(e,o,null)):n=o,n.apply(e,Fo)},Fo=[],Uo=Phaser.Utils.Objects.GetValue,Vo=function(t){s(o,t);var i=h(o);function o(t,n){var s;e(this,o),s=i.call(this,t,n);var r=Uo(n,"clock",void 0);return r||(r=new Lo(t)),s.clock=r,s.clock.on("update",s.update,a(s)),s.resetFromJSON(n),s}return n(o,[{key:"resetFromJSON",value:function(t){return this.clock.resetFromJSON(Uo(t,"clock",void 0)),this.state=Uo(t,"state",0),this.commands=Uo(t,"commands",[]),this.scope=Uo(t,"scope",void 0),this.setTimeUnit(Uo(t,"timeUnit",0)),this.setDtMode(Uo(t,"dtMode",0)),this.index=Uo(t,"index",0),this.nextTime=Uo(t,"nextTime",0),this}},{key:"toJSON",value:function(){return {clock:this.clock.toJSON(),state:this.state,commands:this.commands,scope:this.scope,timeUnit:this.timeUnit,dtMode:this.dtMode,index:this.index,nextTime:this.nextTime}}},{key:"shutdown",value:function(t){this.isShutdown||(this.clock.shutdown(t),this.commands=void 0,c(r(o.prototype),"shutdown",this).call(this,t));}},{key:"load",value:function(t,e,i){this.stop();var n=Uo(i,"timeUnit",void 0);void 0!==n&&this.setTimeUnit(n);var s=Uo(i,"dtMode",void 0);return void 0!==s&&this.setDtMode(s),t=t.filter((function(t){var e=t[0];return !isNaN(e)})).map((function(t){return "string"==typeof t[0]&&(t[0]=parseFloat(t[0])),t})),0===this.dtMode&&t.sort((function(t,e){var i=t[0],n=e[0];return i>n?1:i<n?-1:0})),this.commands=t,this.scope=e,this}},{key:"start",value:function(t){return void 0===t&&(t=0),this.stop(),this.index=0,this.state=1,this.nextTime=this.getNextDt(0),this.clock.start(t),this.update(t),this.emit("start",this.parent,this),this}},{key:"pause",value:function(){return this.clock.pause(),this.emit("pause",this.parent,this),this}},{key:"resume",value:function(){return this.clock.resume(),this.emit("resume",this.parent,this),this}},{key:"stop",value:function(){return this.clock.stop(),this.state=0,this.emit("stop",this.parent,this),this}},{key:"seek",value:function(t){return this.clock.seek(t),this}},{key:"seekToNext",value:function(){return this.seek(this.nextTime),this}},{key:"isPlaying",get:function(){return this.clock.isRunning}},{key:"completed",get:function(){return 2===this.state}},{key:"timeScale",get:function(){return this.clock.timeScale},set:function(t){this.clock.timeScale=t;}},{key:"setTimeScale",value:function(t){return this.timeScale=t,this}},{key:"now",get:function(){return this.clock.now}},{key:"update",value:function(t){if(this.nextTime>t)return this;for(var e=this.commands.length-1;;){var i=this.commands[this.index],n=i[1];if(ns(n)||(n=Ao(Wo,i,1)),Xo(n,this.scope),this.emit("runcommand",n,this.scope),this.index===e)return this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}},{key:"complete",value:function(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this);}},{key:"getNextDt",value:function(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}},{key:"setDtMode",value:function(t){return "string"==typeof t&&(t=Bo[t]),this.dtMode=t,this}},{key:"setTimeUnit",value:function(t){return "string"==typeof t&&(t=Go[t]),this.timeUnit=t,this}}]),o}(si),Wo=[],Go={ms:0,s:1,sec:1},Bo={abs:0,absolute:0,inc:1,increment:1},Ho=Phaser.Utils.Objects.GetValue,Jo=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),void 0===n&&(n={text:createDefaultTextObject(t)}),(s=i.call(this,t,n)).type="rexToast",s.setTransitInTime(Ho(n,"duration.in",200)),s.setDisplayTime(Ho(n,"duration.hold",1200)),s.setTransitOutTime(Ho(n,"duration.out",200)),s.setTransitInCallback(Ho(n,"transitIn",qo.popUp)),s.setTransitOutCallback(Ho(n,"transitOut",qo.scaleDown)),s.player=new Vo(a(s),{dtMode:1}),s.messages=[],s.scaleX0=void 0,s.scaleY0=void 0,s.setVisible(!1),s}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.player.destroy(),this.player=void 0,this.messages=void 0,c(r(o.prototype),"destroy",this).call(this,t));}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitOutTime",value:function(t){return this.transitOutTime=t,this}},{key:"setTransitInTime",value:function(t){return this.transitInTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=qo[t]),t){case qo.popUp:t=_o;break;case qo.fadeIn:t=Mo;}return t||(t=$t),this.transitInCallback=t,this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=qo[t]),t){case qo.scaleDown:t=Do;break;case qo.fadeOut:t=Ro;}return t||(t=$t),this.transitOutCallback=t,this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX0=t,this.scaleY0=e,c(r(o.prototype),"setScale",this).call(this,t,e),this}},{key:"showMessage",value:function(t){if(void 0===this.scaleX0&&(this.scaleX0=this.scaleX),void 0===this.scaleY0&&(this.scaleY0=this.scaleY),void 0===t){if(0===this.messages.length)return this;t=this.messages.shift();}if(this.player.isPlaying)return this.messages.push(t),this;this.setScale(this.scaleX0,this.scaleY0).setVisible(!0),"string"==typeof t?this.setText(t):t(this),this.layout();var e=[[0,[this.transitInCallback,this,this.transitInTime]],[this.transitInTime,[$t]],[this.displayTime,[this.transitOutCallback,this,this.transitOutTime]],[this.transitOutTime,[this.setVisible,!1]],[30,[$t]]];return this.player.load(e,this).once("complete",(function(){this.showMessage();}),this).start(),this}}]),o}(Eo),qo={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};return Jo}));