UNPKG

phaser3-rex-plugins

Version:
2 lines 168 kB
!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).rextabpages=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 l(){return l="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}},l.apply(this,arguments)}function c(t,e,i,n){return c="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},c(t,e,i,n)}function d(t,e,i,n,s){if(!c(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,b=Phaser.Utils.Array.Add,k=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),l(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 b(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return k(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 P,x=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},w=Phaser.Math.DegToRad,O=Phaser.Math.RadToDeg,E=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=w(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},_={setParent:function(t,e){void 0===e&&(e=this);var i=E(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),x(t,e)},getTopmostParent:function(t){return void 0===t&&(t=this),function(t){for(var e=x(t);e;)t=e,e=x(e);return t}(t)}},T=Phaser.Utils.Objects.GetValue,z=C.prototype.add,D=function(t,e){this.setParent(t);var i=E(t);return R(i,e),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),z.call(this,t),this.addToParentContainer(t),this.addToRenderLayer(t),this},M=function(t,e){this.setParent(t);var i=E(t);return R(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),z.call(this,t),this.addToRenderLayer(t),this},R=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=T(e,"syncPosition",!0),t.syncRotation=T(e,"syncRotation",!0),t.syncScale=T(e,"syncScale",!0),t.syncAlpha=T(e,"syncAlpha",!0),t.syncScrollFactor=T(e,"syncScrollFactor",!0));},L={add:function(t){return Array.isArray(t)?this.addMultiple(t):D.call(this,t),this},pin:function(t,e){return Array.isArray(t)?this.addMultiple(t,e):D.call(this,t,e),this},addMultiple:function(t){for(var e=0,i=t.length;e<i;e++)D.call(this,t[e]);return this},addLocal:function(t){return Array.isArray(t)?this.addMultiple(t):M.call(this,t),this},pinLocal:function(t,e){return Array.isArray(t)?this.addMultiple(t,e):M.call(this,t,e),this},addLocalMultiple:function(t){for(var e=0,i=t.length;e<i;e++)M.call(this,t[e]);return this}},A=C.prototype.remove,j=C.prototype.clear,I={remove:function(t,e){return x(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),A.call(this,t,e)),this},unpin:function(t,e){return x(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 j.call(this,t),this}},N={getLocalState:function(t){return E(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}},B=Phaser.Math.RotateAround,Y={worldToLocal:function(t){return t.x-=this.x,t.y-=this.y,B(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,B(t,0,0,this.rotation),t.x+=this.x,t.y+=this.y,t}},X=function(t,e){return t===e?1:t/e},G={updateChildPosition:function(t){t.isRexContainerLite&&(t.syncChildrenEnable=!1);var e=E(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=E(t),i=e.parent;return e.x=t.x,e.y=t.y,i.worldToLocal(e),e.scaleX=X(t.scaleX,i.scaleX),e.scaleY=X(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=E(t);return n.x=e,n.y=i,this.updateChildPosition(t),this},resetLocalPositionState:function(){var t=E(this).parent;return t&&t.resetChildPositionState(this),this}},F=Phaser.Math.DegToRad,U={updateChildRotation:function(t){var e=E(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=E(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 E(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle:function(t,e){return E(t).rotation=F(e),this.updateChildRotation(t),this},resetLocalRotationState:function(){var t=E(this).parent;return t&&t.resetChildRotationState(this),this}},V={updateChildScale:function(t){var e=E(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=E(t),i=e.parent;return e.scaleX=X(t.scaleX,i.scaleX),e.scaleY=X(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=E(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=E(this).parent;return t&&t.resetChildScaleState(this),this}},W={updateChildVisible:function(t){var e=E(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=E(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),E(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible:function(t,e){return void 0===e&&(e=!0),E(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState:function(){var t=E(this).parent;return t&&t.resetChildVisibleState(this),this}},H={updateChildAlpha:function(t){var e=E(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=E(t),i=e.parent;return e.alpha=X(t.alpha,i.alpha),this},setChildAlpha:function(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha:function(t,e){return E(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState:function(){var t=E(this).parent;return t&&t.resetChildAlphaState(this),this}},J={updateChildActive:function(t){var e=E(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 E(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),E(t).active=e,this.updateChildActive(t),this},resetLocalActiveState:function(){var t=E(this).parent;return t&&t.resetChildActiveState(this),this}},K={updateChildScrollFactor:function(t){var e=E(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}},q={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}},Z=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]);Z(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]);Z(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]);Z(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]);Z(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]);Z(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=x(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}))},lt=function(t){var e=ut(this);return Z(e),t.add(e),this},ct=function(t,e,i){var n=ut(this);return Z(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,lt.call(this,t),this._setParentContainerFlag=!1,this):this},addToLayer:function(t){return ht(t)?(lt.call(this,t),this):this},removeFromContainer:function(){return this.parentContainer?(this._setParentContainerFlag=!0,ct.call(this,this.parentContainer,!0,!1),this._setParentContainerFlag=!1,this):this},removeFromLayer:function(t){return void 0===t&&(t=!0),ht(this.displayList)?(ct.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),E(t).layer=e,this):this},removeFromRenderLayer:function(t){var e=E(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,bt=function(t,e){if(void 0===e?e=new yt:!0===e&&(void 0===kt&&(kt=new yt),e=kt),t.getBounds)return t.getBounds(e);var i,n,s,r,o,a,h,u;if(t.parentContainer){var l=t.parentContainer.getBoundsTransformMatrix();Ct(t,e),l.transformPoint(e.x,e.y,e),i=e.x,n=e.y,St(t,e),l.transformPoint(e.x,e.y,e),s=e.x,r=e.y,Pt(t,e),l.transformPoint(e.x,e.y,e),o=e.x,a=e.y,xt(t,e),l.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,Pt(t,e),o=e.x,a=e.y,xt(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},kt=void 0,Ct=function(t,e,i){return void 0===e?e=new gt:!0===e&&(void 0===wt&&(wt=new gt),e=wt),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===wt&&(wt=new gt),e=wt),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))},Pt=function(t,e,i){return void 0===e?e=new gt:!0===e&&(void 0===wt&&(wt=new gt),e=wt),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))},xt=function(t,e,i){return void 0===e?e=new gt:!0===e&&(void 0===wt&&(wt=new gt),e=wt),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))},wt=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},Et=Phaser.Geom.Rectangle,_t=Phaser.Geom.Rectangle.Union,Tt=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},zt=Phaser.GameObjects.GameObject,Dt=function(t){return t instanceof zt},Mt=Phaser.Utils.Objects.GetValue,Rt=Phaser.Textures.DynamicTexture,Lt=Phaser.Utils.String.UUID,At=function(t){if(t){var e,i,n=t.gameObjects,s=t.renderTexture,r=Mt(t,"x",void 0),o=Mt(t,"y",void 0),a=Mt(t,"width",void 0),h=Mt(t,"height",void 0),u=Mt(t,"originX",0),l=Mt(t,"originY",0),c=Mt(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 Et:!0===e&&(void 0===P&&(P=new Et),e=P),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=bt(i,!0);n?(e.setTo(o.x,o.y,o.width,o.height),n=!1):_t(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,l=.5):(r=d.x,o=d.y,a=d.width,h=d.height,u=0,l=0),e=d.x,i=d.y;}else e=r+(0-u)*a,i=o+(0-l)*h;e-=c,i-=c,a+=2*c,h+=2*c;var v=n[0].scene;p&&!s&&(s=new Rt(v.sys.textures,Lt(),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,l),s.camera.setScroll(e,i),n=Z(function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:Tt(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}(n)),s.draw(n);var p=t.saveTexture;if(p)if(Dt(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=At(t),r=!!s.scene;return n||(this.setScale(e,i),r&&s.setScale(e,i)),r?s:this}},It=Phaser.Utils.Objects.GetValue,Nt=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,Bt[0]);a.x-=o,a.y-=o;var h=St(t,Bt[1]);h.x+=o,h.y-=o;var u=xt(t,Bt[2]);u.x+=o,u.y+=o;var l=Pt(t,Bt[3]);l.x-=o,l.y+=o,null!==s&&e.fillStyle(s,r).fillPoints(Bt,!0,!0),null!==i&&e.lineStyle(n,i).strokePoints(Bt,!0,!0);}},Bt=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Yt=Phaser.Utils.Objects.GetValue,Xt=Phaser.Math.RotateAround,Gt={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};Xt(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=Yt(e,"drawContainer",!0),n=Yt(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=It(i,"color"),s=It(i,"lineWidth"),r=It(i,"fillColor"),o=It(i,"fillAlpha",1),a=It(i,"padding",0)),Array.isArray(t))for(var h=0,u=t.length;h<u;h++)Nt(t[h],e,n,s,r,o,a);else Nt(t,e,n,s,r,o,a);}(n,t,e),this}};Object.assign(Gt,_,L,I,N,Y,G,U,V,W,H,J,K,q,$,it,rt,dt,vt,jt);var Ft=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,l(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 l(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 l(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 l(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 l(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 l(r(o.prototype),"visible",this)},set:function(t){l(r(o.prototype),"visible",this)!==t&&(d(r(o.prototype),"visible",t,this,!0),this.syncVisible());}},{key:"alpha",get:function(){return l(r(o.prototype),"alpha",this)},set:function(t){l(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=x(this);return !!t&&t.setParentContainerFlag}}],[{key:"GetParent",value:function(t){return x(t)}}]),o}(C);Object.assign(Ft.prototype,Gt);var Ut=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};var Vt=Phaser.Cameras.Scene2D.BaseCamera,Wt=Phaser.Geom.Rectangle,Ht=function(t,e,i){return e instanceof Vt||(i=e,e=void 0),void 0===i?i=new Wt:!0===i&&(i=Jt),e?t.scale.getViewPort(e,i):t.scale.getViewPort(i)},Jt=new Wt,Kt=Phaser.Display.Align,qt={center:Kt.CENTER,left:Kt.LEFT_CENTER,right:Kt.RIGHT_CENTER,top:Kt.TOP_CENTER,bottom:Kt.BOTTOM_CENTER,"left-top":Kt.TOP_LEFT,"top-left":Kt.TOP_LEFT,"left-center":Kt.LEFT_CENTER,"center-left":Kt.LEFT_CENTER,"left-bottom":Kt.BOTTOM_LEFT,"bottom-left":Kt.BOTTOM_LEFT,"center-top":Kt.TOP_CENTER,"top-center":Kt.TOP_CENTER,"center-center":Kt.CENTER,"center-bottom":Kt.BOTTOM_CENTER,"bottom-center":Kt.BOTTOM_CENTER,"right-top":Kt.TOP_RIGHT,"top-right":Kt.TOP_RIGHT,"right-center":Kt.RIGHT_CENTER,"center-right":Kt.RIGHT_CENTER,"right-bottom":Kt.BOTTOM_RIGHT,"bottom-right":Kt.BOTTOM_RIGHT},Zt=function(){},$t=new Phaser.GameObjects.Zone({sys:{queueDepthSort:Zt,events:{once:Zt}}},0,0,1,1);$t.setOrigin(0);var Qt=0,te=1,ee=2,ie=4,ne=6,se=8,re=10,oe=12,ae=function(t){var e=ft(t);return t.y+e-e*t.originY},he=function(t){var e=pt(t);return t.x-e*t.originX+.5*e},ue=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},ce=function(t){var e=pt(t);return t.x-e*t.originX},de=function(t,e){var i=pt(t);return t.x=e+i*t.originX,t},ve=function(t){var e=pt(t);return t.x+e-e*t.originX},pe=function(t,e){var i=pt(t);return t.x=e-i+i*t.originX,t},fe=function(t,e){var i=ft(t),n=i*t.originY;return t.y=e+n-.5*i,t},ye=function(t){var e=ft(t);return t.y-e*t.originY+.5*e},ge=function(t){var e=ft(t);return t.y-e*t.originY},me=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,he(e)+i),ue(t,ae(e)+n),t},be[re]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),de(t,ce(e)-i),ue(t,ae(e)+n),t},be[oe]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),pe(t,ve(e)+i),ue(t,ae(e)+n),t},be[ne]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),function(t,e,i){le(t,e),fe(t,i);}(t,he(e)+i,ye(e)+n),t},be[ie]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),de(t,ce(e)-i),fe(t,ye(e)+n),t},be[se]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),pe(t,ve(e)+i),fe(t,ye(e)+n),t},be[te]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),le(t,he(e)+i),me(t,ge(e)-n),t},be[Qt]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),de(t,ce(e)-i),me(t,ge(e)-n),t},be[ee]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),pe(t,ve(e)+i),me(t,ge(e)-n),t};var ke=function(t,e,i,n,s,r){$t.setPosition(e,i).setSize(n,s),function(t,e,i,n,s){be[i](t,e,n,s);}(t,$t,r);},Ce=Phaser.Utils.Objects.GetValue,Se=Phaser.GameObjects.Group,Pe=function(t,e,i){return t.add.text(0,0,"")},xe=void 0,we=Phaser.Utils.Objects.GetValue,Oe=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=we(t,"left",0),e.right=we(t,"right",0),e.top=we(t,"top",0),e.bottom=we(t,"bottom",0)),e},Ee=Ft.prototype.add,_e=function(t){return Ee.call(this,t),this.sizerEventsEnable&&(t.emit("sizer.add",t,this),this.emit("add",t,this)),this},Te={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=Oe(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground:function(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},ze=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},De={getParentSizer:function(t,e){return "string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),ze(t,e)},getTopmostSizer:function(t){return void 0===t&&(t=this),function(t){for(var e=ze(t);e;)t=e,e=ze(e);return t}(t)},hasParentSizer:function(t,e){void 0===e&&(e=this);for(var i=ze(e);i;){if(i===t)return !0;i=ze(i);}return !1},hasChild:function(t,e){return void 0===e&&(e=this),this.hasParentSizer(e,t)}},Me=Phaser.Utils.Array.Remove,Re=Ft.prototype.remove,Le=De.getParentSizer,Ae=function(t,e){for(var i=Le(t);i;)i.removeChildCallback&&i.removeChildCallback(t,e),i=Le(i);return this.isBackground(t)&&Me(this.backgroundChildren,t),Re.call(this,t,e),!e&&this.sizerEventsEnable&&(t.emit("sizer.remove",t,this),this.emit("remove",t,this)),this},je=Phaser.Utils.Array.Remove,Ie=De.getParentSizer,Ne={removeFromParentSizer:function(){var t=Ie(gameObject);return t&&t.remove(this),this},removeBackground:function(t,e){return void 0===this.backgroundChildren||this.getParentSizer(t)!==this||(je(this.backgroundChildren,t),Ae.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}},Be=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},Ye=/(\S+)\[(\d+)\]/i,Xe=Phaser.Utils.Objects.GetValue,Ge=function(t,e){return void 0===e?t:t[e]},Fe=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=Xe(i,"left",0),e.right=Xe(i,"right",0),e.top=Xe(i,"top",0),e.bottom=Xe(i,"bottom",0)),e},Ue={getInnerPadding:function(t){return Ge(this.space,t)},setInnerPadding:function(t,e){return Fe(this.space,t,e),this},getOuterPadding:function(t){return Ge(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return Fe(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return "string"==typeof t&&(t=this.getElement(t)),Ge(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return "string"==typeof t&&(t=this.getElement(t)),Fe(this.getSizerConfig(t).padding,e,i),this}},Ve=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},We=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},He={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}},Je=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();},Ke=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},qe={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):[]}},Ze=Phaser.Scene,$e=function(t){return t instanceof Ze},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,qe);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,l(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,l,c=t.width;void 0!==c&&(c=c.split("%"),u=parseFloat(c[0])/100,l=""===c[1]?0:parseFloat(c[1]));var d,v,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(l,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=Ht(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(),l(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,li=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=!ci(s.tickEventName),s}return n(o,[{key:"startTicking",value:function(){l(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(){l(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),ci=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!==bi&&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=bi):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 bi: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===bi}},{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,bi=-1,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)).timer=new pi,s}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(l(r(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),l(r(o.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),l(r(o.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),l(r(o.prototype),"complete",this).call(this),this}}]),o}(li),Ci=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Tweens.Builders.GetEaseFunction,xi=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=Pi(t),this}},{key:"start",value:function(){return this.timer.isRunning||l(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),l(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}(ki),wi=Phaser.Utils.Objects.GetValue,Oi=Phaser.Utils.Objects.GetAdvancedValue,Ei=Phaser.Math.Linear,_i=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 l(r(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(wi(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=Ti[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),l(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=Ei(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ei(this.startY,this.endY,i));}},{key:"complete",value:function(){return l(r(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(xi),Ti={stop:0,destroy:1,yoyo:2},zi=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 _i(t,a):s.resetFromJSON(a),s.restart(),s},Di=function(t,e,i,n,s,r){void 0===n&&(n="Linear"),s instanceof _i&&(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 _i(t,o):r.resetFromJSON(o),r.restart(),r},Mi=function(t,e){return new Promise((function(i,n){t.once(e,(function(){i();}));}))},Ri=function(t){return Mi(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=De.getParentSizer(t);e&&e.resetChildPositionState(t);}));},ji={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=zi(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),Ri(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=Di(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),Ri(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),Ri(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 _i(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),Ri(this._scaleBehavior)}},Ii=Phaser.Utils.Objects.GetValue,Ni=Phaser.Utils.Objects.GetAdvancedValue,Bi=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 l(r(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Ii(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=Xi[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),l(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=Bi(this.alphaStart,this.alphaEnd,i);}},{key:"complete",value:function(){return l(r(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(xi),Xi={stop:0,destroy:1,yoyo:2},Gi=Phaser.Utils.Objects.IsPlainObject,Fi=function(t,e,i,n){var s,r;Gi(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},Ui=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},Vi=Phaser.Utils.Objects.IsPlainObject,Wi=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=De.getParentSizer(t);e&&e.resetChildAlphaState(t);}));},Hi={fadeIn:function(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.alpha;}var n=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),n&&Wi(this,this._fade),this._fade.completeEventName="fadein.complete",this},fadeInPromise:function(t,e){return this.fadeIn(t,e),Ri(this._fade)},fadeOutDestroy:function(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.destroy;}var n=void 0===this._fade;return this._fade=Ui(this,t,e,this._fade),n&&Wi(this,this._fade),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),Ri(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),Ri(this._fade)}},Ji=Phaser.Utils.Objects.GetValue,Ki=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear,Zi=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(l(r(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Ji(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ki(t,"x",void 0),i=Ki(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=Ki(i,"startX",void 0),this.startY=Ki(i,"startY",void 0),this.endX=Ki(i,"endX",void 0),this.endY=Ki(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),l(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=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i));}},{key:"complete",value:function(){return l(r(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(xi),$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=De.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 Zi&&(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 Zi(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),Ri(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),Ri(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 Zi&&(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 Zi(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),Ri(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),Ri(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||(l(r(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"startTicking",value:function(){l(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(){l(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(),l(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},ln=Phaser.Utils.Objects.IsPlainObject,cn={shake:function(t,e,i){if(ln(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),Ri(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,l(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}(xi),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),Mi(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){Cn(t,!1);},bn=function(t){Cn(t,!0);},kn=function(t){return !!t&&!Ut(t).hidden},Cn=function(t,e){if(t){Ut(t).hidden=e;var i=x(t);i?i.setChildVisible(t,!e):t.setVisible(!e);}},Sn={show:function(t){return void 0===t&&(t=this),mn(t),this},hide:function(t){return void 0===t&&(t=this),bn(t),this},isShow:function(t){return void 0===t&&(t=this),kn(t)}};function Pn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var xn={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,l=this._events[a],c=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,n),!0;case 4:return l.fn.call(l.context,e,n,s),!0;case 5:return l.fn.call(l.context,e,n,s,r),!0;case 6:return l.fn.call(l.context,e,n,s,r,o),!0}for(u=1,h=new Array(c-1);u<c;u++)h[u-1]=arguments[u];l.fn.apply(l.context,h);}else {var d,v=l.length;for(u=0;u<v;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),c){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,n);break;case 4:l[u].fn.call(l[u].context,e,n,s);break;default:if(!h)for(d=1,h=new Array(c-1);d<c;d++)h[d-1]=arguments[d];l[u].fn.apply(l[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=[],l=a.length;h<l;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;}(xn);var wn=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}(Pn(xn.exports)),On={setEventEmitter:function(t,e){return void 0===e&&(e=wn),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):[]}},En=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},_n=["next","exit","enter"],Tn=function(){function t(i){e(this,t);var n=En(i,"states",void 0);n&&this.addStates(n);var s=En(i,"extend",void 0);if(s)for(var r in s)this.hasOwnProperty(r)&&void 0!==this[r]||(this[r]=s[r]);var o=En(i,"eventEmitter",void 0),a=En(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(En(t,"enable",!0)),this.start(En(t,"start",void 0));var e=En(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 _n}},{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(Tn.prototype,On);var zn=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},Dn=["next","exit","enter","update","preupdate","postupdate"],Mn=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,l(r(o.prototype),"shutdown",this).call(this);}},{key:"resetFromJSON",value:function(t){return l(r(o.prototype),"resetFromJSON",this).call(this,t),this._scene=En(t,"scene",void 0),this}},{key:"stateProperties",get:function(){return Dn}},{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 zn(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 zn(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 zn(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}(Tn),Rn=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}(Mn),Ln={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}},An={setTransitInTime:function(t){return this.transitInTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInCallback:function(t){return t||(t=Zt),this.transitInCallback=t,this},setTransitOutCallback:function(t){return t||(t=Zt),this.transitOutCallback=t,this}},jn={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}},In={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}},Nn={};Object.assign(Nn,Ln,An,jn,In);var Bn=Phaser.Utils.Objects.GetValue,Yn=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(Bn(n,"duration.in",200)),s.setTransitOutTime(Bn(n,"duration.out",200)),s.setTransitInCallback(Bn(n,"transitIn")),s.setTransitOutCallback(Bn(n,"transitOut")),s.oneShotMode=Bn(n,"destroy",!1),s.delayCallTimer=void 0,s._state=new Rn(a(s),{eventEmitter:!1,initState:Bn(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(),l(r(o.prototype),"shutdown",this).call(this,t));}}]),o}(si);Object.assign(Yn.prototype,Nn);var Xn=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),l(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),Gn=Phaser.Utils.Objects.GetValue,Fn=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(Gn(t,"hitAreaMode",0)),this.setEnable(Gn(t,"enable",!0)),this.setStopMode(Gn(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=Un[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),Un={default:0,fullWindow:1},Vn=Phaser.Utils.Objects.GetValue,Wn=function(t){s(r,t);var i=h(r);function r(t,n){var s;e(this,r);var o=Vn(n,"color",0),h=Vn(n,"alpha",.8);return (s=i.call(this,t,o,h)).touchEventStop=new Fn(a(s),{hitAreaMode:1}),s}return n(r)}(Xn),Hn=function(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,zi(t,e);},Jn=function(t,e){Di(t,e,void 0,void 0,!1);},Kn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e);},qn=function(t,e){Ui(t,e,!1);},Zn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e,t.alpha);},$n=function(t,e){Ui(t,e,!1);},Qn=function(t,e,i,n,s){return !!t&&(!(n&&!n(t,e,i))&&(!!bt(t,!0).contains(e,i)&&!(s&&!s(t,e,i))))},ts=Phaser.Utils.Objects.GetValue,es=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=is.popUp),null==n.transitOut&&(n.transitOut=is.scaleDown),n.destroy=ts(n,"destroy",!0),s=i.call(this,t,n);var r=ts(n,"cover");s.cover=!1!==r?function(t,e){var i=t.scene,n=new Wn(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(ts(r,"transitIn",Zn)),s.setCoverTransitOutCallback(ts(r,"transitOut",$n)));var h=ts(n,"touchOutsideClose",!1),u=ts(n,"duration.hold",-1),l=ts(n,"timeOutClose",u>=0),c=ts(n,"anyTouchClose",!1);return ts(n,"manualClose",!1)&&(h=!1,c=!1,l=!1),c&&(h=!1),l?s.setDisplayTime(u):s.setDisplayTime(-1),c?s.once("open",s.anyTouchClose,a(s)):h&&s.once("open",s.touchOutsideClose,a(s)),ts(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),l(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&&Qn(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"runTransitionInCallback",value:function(){var t=l(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=l(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),l(r(o.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.closeEventData),l(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=is[t]),t){case is.popUp:t=Hn;break;case is.fadeIn:t=Kn;}return l(r(o.prototype),"setTransitInCallback",this).call(this,t),this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=is[t]),t){case is.scaleDown:t=Jn;break;case is.fadeOut:t=qn;}return l(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}(Yn),is={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},ns=function(t){return t&&"function"==typeof t},ss={modal:function(t,e){return ns(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new es(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}},rs=function(t,e,i,n){if(e)return Qn(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],Qn(t,e.worldX,e.worldY,i,n))return !0;return !1},os=function(t){return "[object Array]"===Object.prototype.toString.call(t)},as=function(t,e,i,n,s){return Qn(t,e,i,us(n),ls(s))},hs=function(t){return !(t.rexSizer&&t.rexSizer.hidden)},us=function(t){return t?function(e,i,n){return !!hs(e)&&(t(e,i,n),!0)}:hs},ls=function(t){return t},cs=function(t,e,i){!t||void 0===e&&void 0===i||(vs(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)));},ds=[Phaser.GameObjects.Image,Phaser.GameObjects.Sprite,Phaser.GameObjects.Mesh,Phaser.GameObjects.Shader,Phaser.GameObjects.Video],vs=function(t){if(t.resize)return !0;if(!t.setSize)return !1;for(var e=0,i=ds.length;e<i;e++){var n=ds[e];if(n&&t instanceof n)return !1}return !0},ps={},fs=function(t){var e,i;this.sizerEventsEnable&&(e=t,void 0===(i=this.getChildPrevState(t))?i={}:!0===i&&(i=ps),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));},ys=function(t,e,i,n,s,r,o,a){ke(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);},gs=Phaser.Display.Align.CENTER,ms=Phaser.Utils.Objects.IsPlainObject,bs=Phaser.Utils.Objects.GetValue,ks=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(bs(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(bs(t,"enable",!0)),this.setMode(bs(t,"mode",1)),this.setClickInterval(bs(t,"clickInterval",100)),this.setDragThreshold(bs(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,l(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=Cs[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),Cs={press:0,pointerdown:0,release:1,pointerup:1},Ss={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 ks(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}},Ps=function(t,e,i,n){if(e)return !(i&&!i(t,e))&&(!!xs(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))&&xs(t,e)&&(!n||n(t,e)))return !0;return !1},xs=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],ws),ws.length>0)return ws.length=0,!0;return ws.length=0,!1},ws=[],Os=Phaser.Utils.Objects.GetValue,Es=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=Os(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(Os(t,"enable",!0)),this.setMode(Os(t,"mode",1)),this.setClickInterval(Os(t,"clickInterval",100)),this.setDragThreshold(Os(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,l(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=_s[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?Ps:rs)(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),_s={press:0,pointerdown:0,release:1,pointerup:1},Ts={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 Es(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}},zs=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}(Mn),Ds=Phaser.Utils.Objects.GetValue,Ms=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 zs,s.parent.setInteractive(Ds(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(Ds(t,"enable",!0)),this.setCooldown(Ds(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,l(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),Rs={isPointerInBounds:function(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rs(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 Ms(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 Ms(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}},Ls=function(t,e,i){for(var n,s=0,r=t.length;s<r;s++)if(n=t[s],as(n,e,i))return n.pointToChild(e,i);return null},As=function(t,e,i,n,s,r,o){var a;(a=void 0===s?n:Ls(i,n,s))&&t.emit(e,a,r,o);},js=Phaser.Utils.Objects.GetValue,Is=function(t){var e=js(t,"down",void 0);!1!==e&&(!0===e&&(e=void 0),this.on("pointerdown",Ns,this));},Ns=function(t,e,i,n){var s=this._childrenInteractive;As(s.eventEmitter,"".concat(s.eventNamePrefix,"down"),s.targetSizers,t.worldX,t.worldY,t,n);},Bs=Phaser.Utils.Objects.GetValue,Ys=function(t){var e=Bs(t,"up",void 0);!1!==e&&(!0===e&&(e=void 0),this.on("pointerup",Xs,this));},Xs=function(t,e,i,n){var s=this._childrenInteractive;As(s.eventEmitter,"".concat(s.eventNamePrefix,"up"),s.targetSizers,t.worldX,t.worldY,t,n);},Gs=Phaser.Utils.Objects.GetValue,Fs=function(t){var e=Gs(t,"over",void 0);!1!==e&&(!0===e&&(e=void 0),this.on("pointermove",Us,this).on("pointerover",Us,this).on("pointerout",Vs,this));},Us=function(t,e,i,n){var s=this._childrenInteractive,r=Ls(s.targetSizers,t.worldX,t.worldY),o=s.lastOverChild;r&&o&&r===o||(s.lastOverChild=r,As(s.eventEmitter,"".concat(s.eventNamePrefix,"out"),s.targetSizers,o,void 0,t,n),As(s.eventEmitter,"".concat(s.eventNamePrefix,"over"),s.targetSizers,r,void 0,t,n));},Vs=function(t,e){var i=this._childrenInteractive,n=i.lastOverChild;i.lastOverChild=null,As(i.eventEmitter,"".concat(i.eventNamePrefix,"out"),i.targetSizers,n,void 0,t,e);},Ws=Phaser.Utils.Objects.GetValue,Hs=function(t){var e=Ws(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 ks(this,e),this._click.on("click",(function(t,e,n,s){As(i.eventEmitter,"".concat(i.eventNamePrefix,"click"),i.targetSizers,n.worldX,n.worldY,n,s);}),this);}},Js=Phaser.Utils.Objects.GetValue,Ks=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(Js(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(Js(t,"enable",!0)),this.setDetectBounds(),void 0===this.gameObject?this.setDetectBounds(Js(t,"bounds",void 0)):this.setDetectBounds(),this.tracerState=qs,this.pointer=void 0,this.lastPointer=void 0,this.movedState=!1,this.isTouchingAnyObject=!1,this}},{key:"boot",value:function(){l(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,l(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=Zs,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=qs,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===Zs&&this.onDragEnd(),this.pointer=void 0,this.tracerState=qs,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(){l(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(){l(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=$s,this}}]),o}(ai),qs=0,Zs=1,$s="IDLE",Qs=Phaser.Utils.Objects.GetValue,tr=Phaser.Math.Distance.Between,er=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=ir;},eventEmitter:!1};return s.setRecongizedStateObject(new Mn(h)),s}return n(o,[{key:"resetFromJSON",value:function(t){l(r(o.prototype),"resetFromJSON",this).call(this,t),this.setHoldTime(Qs(t,"time",250)),this.setTapInterval(Qs(t,"tapInterval",200)),this.setDragThreshold(Qs(t,"threshold",9)),this.setTapOffset(Qs(t,"tapOffset",10));var e=Qs(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Qs(t,"maxTaps",void 0)),this.setMinTaps(Qs(t,"minTaps",void 0))),this}},{key:"onDragStart",value:function(){switch(this.state){case ir:this.state=nr;break;case nr:var t=this.lastPointer;tr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sr,this.state=nr);break;case sr:this.state=nr;}}},{key:"onDragEnd",value:function(){this.state===nr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sr));}},{key:"onDrag",value:function(){this.state!==ir&&this.pointer.getDistance()>this.dragThreshold&&(this.state=ir);}},{key:"preUpdate",value:function(t,e){if(this.isRunning&&this.enable&&this.state===nr){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=ir);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sr:this.state=ir);}}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===sr&&(this.state=ir);}},{key:"isTapped",get:function(){return this.state===sr}},{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}(Ks),ir="IDLE",nr="BEGIN",sr="RECOGNIZED",rr=Phaser.Utils.Objects.GetValue,or=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=ar;},eventEmitter:!1};return s.setRecongizedStateObject(new Mn(h)),s}return n(o,[{key:"resetFromJSON",value:function(t){return l(r(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(rr(t,"threshold",9)),this.setHoldTime(rr(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=hr,0===this.holdTime&&(this.state=ur);}},{key:"onDragEnd",value:function(){this.state=ar;}},{key:"onDrag",value:function(){this.state!==ar&&this.pointer.getDistance()>this.dragThreshold&&(this.state=ar);}},{key:"preUpdate",value:function(t,e){this.isRunning&&this.enable&&(this.state===hr&&t-this.pointer.downTime>=this.holdTime&&(this.state=ur));}},{key:"isPressed",get:function(){return this.state===ur}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(Ks),ar="IDLE",hr="BEGIN",ur="RECOGNIZED";Phaser.Utils.Objects.GetValue;var lr=Phaser.Math.Distance.Between,cr=Phaser.Math.Angle.Between,dr={getDt:function(){var t;return t=this.scene,ii(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return lr(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 cr(e.x,e.y,t.x,t.y)}},vr={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pr={},fr=Phaser.Utils.Objects.GetValue,yr=Phaser.Math.RadToDeg,gr=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=mr;},eventEmitter:!1};return s.setRecongizedStateObject(new Mn(h)),s.clearDirectionStates(),s}return n(o,[{key:"resetFromJSON",value:function(t){return l(r(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(fr(t,"threshold",10)),this.setVelocityThreshold(fr(t,"velocityThreshold",1e3)),this.setDirectionMode(fr(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=br;}},{key:"onDragEnd",value:function(){this.state=mr;}},{key:"onDrag",value:function(){this.state===br&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=kr));}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===kr&&(this.state=mr);}},{key:"isSwiped",get:function(){return this.state===kr}},{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=vr[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pr),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;}}(yr(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}(Ks);Object.assign(gr.prototype,dr);var mr="IDLE",br="BEGIN",kr="RECOGNIZED",Cr=Phaser.Utils.Objects.GetValue,Sr=Phaser.Utils.Array.SpliceOne,Pr=Phaser.Math.Distance.Between,xr=Phaser.Math.Angle.Between,wr=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(Cr(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(Cr(t,"enable",!0)),this.bounds=Cr(t,"bounds",void 0),this.tracerState=Er,this.pointers.length=0,Tt(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,Tt(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 Er:this.tracerState=_r,this.onDrag1Start();break;case _r:this.tracerState=Tr,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],Sr(this.pointers,e),this.tracerState){case _r:this.tracerState=Er,this.onDrag1End();break;case Tr:this.tracerState=_r,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 _r:this.onDrag1();break;case Tr:this.onDrag2();}}}},{key:"dragCancel",value:function(){return this.tracerState===Tr&&this.onDrag2End(),this.pointers.length=0,Tt(this.movedState),this.tracerState=Er,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!==Tr)return 0;var t=this.pointers[0],e=this.pointers[1];return Pr(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==Tr)return 0;var t=this.pointers[0],e=this.pointers[1];return xr(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;Or.x=e.x-i.x,Or.y=e.y-i.y;}else Or.x=0,Or.y=0;return Or}},{key:"centerX",get:function(){if(this.tracerState!==Tr)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!==Tr)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!==Tr)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!==Tr)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=zr,this}}]),t}();Object.assign(wr.prototype,qe);var Or={},Er=0,_r=1,Tr=2,zr="IDLE";Phaser.Utils.Objects.GetValue;var Dr=Phaser.Math.RotateAround,Mr=function(t,e,i,n){return Dr(t,e,i,n),t.rotation+=n,t},Rr={},Lr=Phaser.Utils.Objects.GetValue,Ar=Phaser.Math.Angle.WrapDegrees,jr=Phaser.Math.Angle.ShortestBetween,Ir=Phaser.Math.RadToDeg,Nr=Phaser.Math.DegToRad,Br=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=Xr;},eventEmitter:!1};return s.setRecongizedStateObject(new Mn(h)),s}return n(o,[{key:"resetFromJSON",value:function(t){return l(r(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Lr(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=Ar(Ir(this.angleBetween)),this.state=Gr,0===this.dragThreshold&&(this.state=Fr);}},{key:"onDrag2End",value:function(){this.state=Xr;}},{key:"onDrag2",value:function(){switch(this.state){case Gr:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Ar(Ir(this.angleBetween));this.angle=jr(this.prevAngle,t),this.prevAngle=t,this.state=Fr;}break;case Fr:t=Ar(Ir(this.angleBetween));this.angle=jr(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this);}}},{key:"isRotated",get:function(){return this.state===Fr}},{key:"rotation",get:function(){return Nr(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(wr),Yr={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=Rr),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,l=h.length;u<l;u++)(t=h[u]).x+=i,t.y+=n,Mr(t,r,o,a);else t.x+=i,t.y+=n,Mr(t,r,o,a);return this}};Object.assign(Br.prototype,Yr);var Xr="IDLE",Gr="BEGIN",Fr="RECOGNIZED",Ur=Phaser.Utils.Objects.GetValue,Vr=function(t){var e=Ur(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new er(this,e),this._tap.on("tap",(function(t,e,n){As(i.eventEmitter,"".concat(i.eventNamePrefix).concat(t.tapsCount,"tap"),i.targetSizers,t.worldX,t.worldY,n);}),this);}},Wr=Phaser.Utils.Objects.GetValue,Hr=function(t){var e=Wr(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new or(this,e),this._press.on("pressstart",(function(t,e,n){As(i.eventEmitter,"".concat(i.eventNamePrefix,"pressstart"),i.targetSizers,t.worldX,t.worldY,n);}),this).on("pressend",(function(t,e,n){As(i.eventEmitter,"".concat(i.eventNamePrefix,"pressend"),i.targetSizers,t.worldX,t.worldY,n);}),this);}},Jr=Phaser.Utils.Objects.GetValue,Kr=function(t){var e=Jr(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 gr(this,e),this._swipe.on("swipe",(function(t,e,n){var s=t.left?"left":t.right?"right":t.up?"up":"down";As(i.eventEmitter,"".concat(i.eventNamePrefix,"swipe").concat(s),i.targetSizers,t.worldX,t.worldY,n);}),this);}},qr=Phaser.Utils.Objects.GetValue,Zr=function(t,e){return t.setInteractive(),qr(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:qr(e,"targets",[t]),eventEmitter:qr(e,"eventEmitter",t),eventNamePrefix:qr(e,"inputEventPrefix","child.")},Is.call(t,e),Ys.call(t,e),Fs.call(t,e),Hs.call(t,e),Vr.call(t,e),Hr.call(t,e),Kr.call(t,e),t},$r={getSizerConfig:function(t){return void 0===t&&(t=this),Ut(t)},getChildPrevState:function(t){var e=Ut(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Ht(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=Ce(e,"color"),n=Ce(e,"lineWidth");var h=Ce(e,"name",!1);h&&(s=Ce(h,"createTextCallback",Pe),r=Ce(h,"createTextCallbackScope",void 0),"string"==typeof(o=Ce(h,"align","left-top"))&&(o=qt[o]));}if(void 0===i&&(i=16777215),void 0===n&&(n=1),s&&!t.children){t.children=new Se(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 l,c,d=this.getAllShownChildren([this]),v=0,p=d.length;v<p;v++)((l=d[v]).getBounds||void 0!==l.width&&void 0!==l.height)&&(xe=bt(l,xe),null!=i&&t.lineStyle(n,i).strokeRectShape(xe),l.name&&s&&(c=r?s.call(r,a):s(a))&&(c.setText(l.name),t.children.add(c),ke(c,xe.x,xe.y,xe.width,xe.height,o)));return this},resolveWidth:Ve,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:We,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:Be,addElement:Be,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(Ye);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:Je,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:Ke,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,l=this.width,c=this.height,d=0,v=a.length;d<v;d++)(e=(t=a[d]).rexSizer).hidden||(i=e.padding,fs.call(this,t),n=h+i.left,s=u+i.top,r=l-i.left-i.right,o=c-i.top-i.bottom,cs(t,r,o),ys.call(this,t,n,s,r,o,gs));},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 (Dt(t)||"string"==typeof t)&&(e=t,t=void 0),void 0===e?e=this:"string"==typeof e&&(e=this.getElement(e)),rs(e,t)},pointToChild:function(t,e,i,n,s){if(ns(i)||(s=i,i=void 0,n=void 0),void 0===s&&(s=this.sizerChildren?this.sizerChildren:this.children),os(s)){for(var r,o=0,a=s.length;o<a;o++)if(r=s[o],as(r,t,e,i,n))return r}else for(var h in s)if(r=s[h],as(r,t,e,i,n))return r;return null},setDraggable:function(e,i,n){if(ms(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 Zr(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($r,Ue,Te,Ne,De,ji,Hi,sn,cn,gn,Ss,Ts,Rs,Sn,ss,He);var Qr=Phaser.Utils.Objects.GetValue,to=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(Qr(h,"name","")),u.rexSizer={},u.space={},u.backgroundChildren=void 0,u.sizerChildren=void 0,u.childrenMap={},u.layoutedChildren=void 0,u.enableLayoutWarn();var l=Qr(h,"anchor",void 0);l&&u.setAnchor(l),u.setInnerPadding(Qr(h,"space",0));var c=Qr(h,"draggable",!1);return c&&u.setDraggable(c),u.setSizerEventsEnable(Qr(h,"sizerEvents",!1)),u.setDirty(!0),Qr(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;l(r(o.prototype),"destroy",this).call(this,t),Tt(this.backgroundChildren),Tt(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}(Ft);Object.assign(to.prototype,$r);var eo=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));},io=Phaser.Math.Wrap,no=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),so=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},ro=Phaser.Utils.Objects.IsPlainObject,oo=Phaser.Utils.Objects.GetValue,ao=Phaser.Display.Align.CENTER,ho={min:0,full:-1},uo=function(e,i,n,s,r,o,a,h,u,l){_e.call(this,e);var c=e.isRexSpace,d=t(i);if(null===i)return this;if("number"===d);else if("string"===d)i=ho[i];else if(ro(i)){var v;i=oo(v=i,"proportion",void 0),n=oo(v,"align",ao),s=oo(v,"padding",0),r=oo(v,"expand",!1),o=oo(v,"key",void 0),a=oo(v,"index",void 0),e.isRexSizer||(h=oo(v,"minWidth",void 0),u=oo(v,"minHeight",void 0)),l=oo(v,"fitRatio",0);}return "string"==typeof n&&(n=qt[n]),void 0===i&&(i=c?1:0),void 0===n&&(n=ao),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(c?h=0:e.isRexSizer||(h=e._minWidth)),void 0===u&&(c?u=0:e.isRexSizer||(u=e._minHeight)),void 0===l&&(l=0),(v=this.getSizerConfig(e)).proportion=i,v.align=n,v.padding=Oe(s),v.expand=r,v.fitRatio=0===i?l: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},lo={add:uo,addSpace:function(t){return this.insertSpace(void 0,t),this},insertSpace:function(t,e){return void 0===e&&(e=1),uo.call(this,new no(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert:function(t,e,i,n,s,r,o,a){return ro(i)&&(i.index=t),uo.call(this,e,i,n,s,r,o,t,a),this},insertAtPosition:function(t,e,i,n,s,r,o,a,h){var u=so.call(this,t,e);return -1===u&&(u=void 0),this.insert(u,i,n,s,r,o,a,h),this}},co=Ft.prototype.clear,vo=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),co.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},po=Phaser.Utils.Array.Remove,fo={remove:function(t,e){return this.getParentSizer(t)!==this||(po(this.sizerChildren,t),Ae.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,vo.call(this,t),this}},yo={getChildAlign:function(t){return this.getSizerConfig(t).align},setChildAlign:function(t,e){return "string"==typeof e&&(e=qt[e]),this.getSizerConfig(t).align=e,this}},go={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&&(cs(n,1,1),this.hasRatioFitChild=!0);}return this._childrenProportion=void 0,this.proportionLength=void 0,Je.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,cs(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,l=this.sizerChildren,c=this.innerLeft,d=this.innerTop,v=this.innerWidth,p=this.innerHeight,f=c,y=d,g=this.startChildIndex,m=0,b=l.length;m<b;m++)u=0===g?m:io(m+g,0,b),this.rtl&&(u=b-u-1),(t=l[u]).rexSizer.hidden||(i=(e=t.rexSizer).padding,fs.call(this,t),t.isRexSpace?(a=0,h=0):(a=this.getExpandedChildWidth(t),h=this.getExpandedChildHeight(t)),t.isRexSizer?(t.runLayout(this,a,h),eo(t,this)):cs(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),ys.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=Ve.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=We.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(go,lo,fo,yo,{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 mo=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},bo={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},ko=function(t){return "string"==typeof t&&(t=bo[t]),t},Co=Phaser.Utils.Objects.IsPlainObject,So=Phaser.Utils.Objects.GetValue,Po=function(t){s(r,t);var i=h(r);function r(t,n,s,o,a,h,u){var l;return e(this,r),Co(n)?(n=So(u=n,"x",0),s=So(u,"y",0),o=So(u,"width",void 0),a=So(u,"height",void 0),h=So(u,"orientation",0)):Co(o)?(o=So(u=o,"width",void 0),a=So(u,"height",void 0),h=So(u,"orientation",0)):Co(h)&&(h=So(u=h,"orientation",0)),void 0===h&&(h=0),(l=i.call(this,t,n,s,o,a,u)).type="rexSizer",l.sizerChildren=[],l.setOrientation(h),l.setItemSpacing(So(u,"space.item",0)),l.setStartChildIndex(So(u,"startChildIndex",0)),l.setRTL(So(u,"rtl",!1)),l.addChildrenMap("items",l.sizerChildren),l}return n(r,[{key:"setOrientation",value:function(t){return this.orientation=ko(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=mo.call(this)),this._childrenProportion}}]),r}(to);Object.assign(Po.prototype,go);var xo=Po.prototype.add,wo=Po.prototype.addSpace,Oo=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&wo.call(this),xo.call(this,t,{proportion:i,expand:!0});var n=!this.buttonsExpand&&"center"===this.buttonsAlign;n&&wo.call(this),this.hasTailSpace=n;}else xo.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var s=this.sizerChildren.length-1;xo.call(this,t,{index:s,proportion:i,expand:!0});}else xo.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Eo={addButton:function(t){if(os(t))for(var e=t,i=0,n=e.length;i<n;i++)Oo.call(this,e[i]);else Oo.call(this,t);return this},addButtons:function(t){for(var e=0,i=t.length;e<i;e++)Oo.call(this,t[e]);return this}},_o=Po.prototype.remove,To=Po.prototype.clear,zo=function(t,e){return this.getParentSizer(t)!==this||(this.buttonGroup.remove(t),_o.call(this,t,e)),this},Do={remove:function(t,e){if(os(t))for(var i=t,n=0,s=i.length;n<s;n++)zo.call(this,i[n],e);else zo.call(this,t,e);return this},clear:function(t){return this.buttonGroup.buttons.length=0,To.call(this,t),this},removeButton:function(t,e){return (t=this.getButton(t))?(this.remove(t,e),this):this},clearButtons:function(t){for(var e=this.buttonGroup.buttons,i=e.length-1;i>=0;i--)zo.call(this,e[i],t);return this}},Mo=function(t,e,i){if(t){var n=this.setValueCallback,s=this.setValueCallbackScope;n&&(s?n.call(s,t,e,i):n(t,e,i)),this.fireEvent("button.statechange",t,e,i);}},Ro=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var n=t._selected;t._selected=i,Mo.call(e,t,i,n);}},enumerable:!0,configurable:!0}),t.selected=!1;},Lo={add:function(t){return this.buttons.push(t),t._click||(t._click=new ks(t,this.clickConfig),t._click.on("click",(function(t,e,i,n){this.fireEvent("button.click",e,i,n);}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e);}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e);}),this),t.on("pointerover",(function(e,i,n,s){this.fireEvent("button.over",t,e,s);}),this).on("pointerout",(function(e,i){this.fireEvent("button.out",t,e,i);}),this).on("pointerdown",(function(e,i,n,s){this.fireEvent("button.down",t,e,s);}),this).on("pointerup",(function(e,i){this.fireEvent("button.up",t,e,i);}),this)),this.buttonsType&&(void 0===t.name&&console.error("".concat(this.parent.constructor.name,": Option button miss value")),Ro.call(this,t)),this},addMultiple:function(t){for(var e=0,i=t.length;e<i;e++)this.add(t[e]);return this}},Ao=Phaser.Utils.Array.Remove,jo={remove:function(t){return this.buttonsType&&delete t.selected,Ao(this.buttons,t),this},clear:function(){if(this.buttonsType)for(var t=this.buttons,e=0,i=t.length;e<i;e++)delete t[e].selected;return this.buttons.length=0,this}},Io=Phaser.Utils.Objects.GetValue,No={setButtonsType:function(t){void 0===t&&(t={});var e,i,n=Io(t,"buttonsType",t.type);if(this.buttonsType=n,!this.buttonsType)return this;switch(e=Io(t,"setValueCallback",void 0),i=Io(t,"setValueCallbackScope",void 0),void 0===e&&(e=Io(t,"setButtonStateCallback",void 0),i=Io(t,"setButtonStateCallbackScope",void 0)),this.setValueCallback=e,this.setValueCallbackScope=i,n){case"radio":this.setRadioType();break;case"checkboxes":this.setCheckboxesType();}return this},setRadioType:function(){var t=this.parent,e=this.buttons;t._value=void 0;var i=void 0;return Object.defineProperty(t,"value",{get:function(){return t._value},set:function(n){if(t._value!==n){t._value=n;for(var s=0,r=e.length;s<r;s++){var o=e[s];o.rexSizer.hidden||(void 0===i?o.name===n?o.selected=!0:o.selected=!1:o.selected=i===s);}}},enumerable:!0,configurable:!0}),t.on("button.click",(function(e){i=this.buttons.indexOf(e),t.value=e.name,i=void 0;}),this),this},setCheckboxesType:function(){return this.parent.on("button.click",(function(t){t.selected=!t.selected;})),this},clearAllButtonsState:function(){for(var t=this.buttons,e=0,i=t.length;e<i;e++){t[e].selected=!1;}return this},getAllButtonsState:function(){for(var t={},e=this.buttons,i=0,n=e.length;i<n;i++){var s=e[i];s.rexSizer.hidden||(t[s.name]=s.selected);}return t},setSelectedButtonName:function(t){return this.parent.value=t,this},getSelectedButtonName:function(){return this.parent.value},setButtonState:function(t,e){void 0===e&&(e=!0);for(var i=this.buttons,n=0,s=i.length;n<s;n++){var r=i[n];if(!r.rexSizer.hidden&&r.name===t){r.selected=e;break}}return this},getButtonState:function(t){for(var e=this.buttons,i=0,n=e.length;i<n;i++){var s=e[i];if(!s.rexSizer.hidden&&s.name===t)return s.selected}}},Bo=function(t,e){return t?t.hasOwnProperty("name")?t.name===e?t:null:GetElementByName(t,e):null},Yo={getButton:function(e){var i,n=this.buttons;switch(t(e)){case"number":i=n[e];break;case"string":i=function(t,e){if(!t)return null;if(os(t)){for(var i,n=0,s=t.length;n<s;n++)if(i=Bo(t[n],e))return i}else for(var r in t)if(i=Bo(t[r],e))return i}(n,e);break;default:i=e,-1===n.indexOf(i)&&(i=void 0);}return i},setButtonEnable:function(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var n=0,s=i.length;n<s;n++)i[n]._click.setEnable(e);}else this.getButton(t)._click.setEnable(e);return this},toggleButtonEnable:function(t){var e=this.buttons;if(void 0===t||"boolean"==typeof t)for(var i=0,n=e.length;i<n;i++)e[i]._click.toggleEnable();else this.getButton(t)._click.toggleEnable();return this},getButtonEnable:function(t){return void 0===t&&(t=0),this.getButton(t)._click.enable},emitButtonClick:function(t){return (this.buttonGroup?this.buttonGroup:this).fireEvent("button.click",t),this},showButton:function(t){return mn(this.getButton(t)),this},hideButton:function(t){return bn(this.getButton(t)),this},isButtonShown:function(t){return kn(this.getButton(t)),this},forEachButtton:function(t,e){for(var i=this.buttons,n=0,s=i.length;n<s;n++)e?t.call(e,i[n],n,i):t(i[n],n,i);return this}},Xo=function(){function t(i){e(this,t),this.parent=i.parent,this.eventEmitter=i.eventEmitter,this.groupName=i.groupName,this.clickConfig=i.clickConfig,this.buttonsType=void 0,this.buttons=[];}return n(t,[{key:"destroy",value:function(){this.parent=void 0,this.eventEmitter=void 0,this.clickConfig=void 0,this.buttons=void 0;}}]),t}(),Go={fireEvent:function(t,e){if(this.buttons){var i,n,s,r;if("number"==typeof e){if(i=e,!(e=this.buttons[i]))return}else if(-1===(i=this.buttons.indexOf(e)))return;for(var o=arguments.length,a=new Array(o>2?o-2:0),h=2;h<o;h++)a[h-2]=arguments[h];if(this.eventEmitter!==this.parent)(n=this.parent).emit.apply(n,[t,e,i].concat(a));if(void 0!==this.groupName)(s=this.eventEmitter).emit.apply(s,[t,e,this.groupName,i].concat(a));else (r=this.eventEmitter).emit.apply(r,[t,e,i].concat(a));}}};Object.assign(Xo.prototype,Lo,jo,No,Yo,Go);var Fo={clearAllButtonsState:function(){return this.buttonGroup.clearAllButtonsState(),this},getAllButtonsState:function(){return this.buttonGroup.getAllButtonsState()},setSelectedButtonName:function(t){return this.buttonGroup.setSelectedButtonName(t),this},getSelectedButtonName:function(){return this.buttonGroup.getSelectedButtonName()},setButtonState:function(t,e){return this.buttonGroup.setButtonState(t,e),this},getButtonState:function(t){return this.buttonGroup.getButtonState(t)}},Uo=Phaser.Utils.Objects.GetValue,Vo=function(t){s(o,t);var i=h(o);function o(t,n){var s;e(this,o),void 0===n&&(n={});var r=n.space;"number"==typeof r&&(n.space={item:r}),(s=i.call(this,t,n)).type="rexButtons",s.buttonGroup=new Xo({parent:a(s),eventEmitter:Uo(n,"eventEmitter",a(s)),groupName:Uo(n,"groupName",void 0),clickConfig:Uo(n,"click",void 0)}).setButtonsType(n);var h=Uo(n,"background",void 0),u=Uo(n,"buttons",void 0);return s.buttonsExpand=Uo(n,"expand",!1),s.buttonsAlign=Uo(n,"align",void 0),h&&s.addBackground(h),u&&s.addButtons(u),s.addChildrenMap("background",h),s.addChildrenMap("buttons",s.buttonGroup.buttons),s}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(l(r(o.prototype),"destroy",this).call(this,t),this.buttonGroup.destroy(),this.buttonGroup=void 0);}},{key:"buttons",get:function(){return this.buttonGroup.buttons}},{key:"groupName",get:function(){return this.buttonGroup.groupName},set:function(t){this.buttonGroup.groupName=t;}},{key:"eventEmitter",get:function(){return this.buttonGroup.eventEmitter}}]),o}(Po);Object.assign(Vo.prototype,Eo,Do,Yo,Fo);var Wo=function(t,e,i,n){return e/t<=i?e/(n-1):0},Ho=function(t,e){void 0===e?e={lines:[],width:0,height:0}:(e.lines.length=0,e.width=0,e.height=0);for(var i,n,s,r,o=this.sizerChildren,a=this.space.item,h=this.space.line,u=this.space.indentLeftOdd,l=this.space.indentLeftEven,c=this.space.indentTopOdd,d=this.space.indentTopEven,v=0,p=e.lines,f=void 0,y=0,g=o.length;y<g;y++){if("\n"===(i=o[y]))i=void 0,n=0,r=!0;else {if(i.rexSizer.hidden)continue;i.isRexSizer&&i.layout(),r=v<(n=Jo(i))||void 0===f;}if(r)f&&(f.width=t-(v+a),e.width=Math.max(e.width,f.width),e.height+=f.height+h),f={children:[],height:0},p.push(f),v=t-(p.length%2?u:l);v-=n+a,i&&(f.children.push(i),s=Ko(i),f.height=Math.max(f.height,s));}return f&&(f.width=t-(v+a),e.width=Math.max(e.width,f.width),e.height+=f.height),e.height+=Math.max(c,d),e},Jo=function(t){var e=t.rexSizer.padding;return pt(t)+e.left+e.right},Ko=function(t){var e=t.rexSizer.padding;return ft(t)+e.top+e.bottom},qo=Phaser.Math.Distance.Between,Zo=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];if(!(Math.abs(a.centerY-e)>a.height/2)){s>(h=qo(a.left,a.centerY,t,e))&&(s=h,n=r);var h,u=i[r+1];if(!u||u.y!==a.y)s>(h=qo(a.right,a.centerY,t,e))&&(s=h,n=r+1);}}return n},$o=Phaser.Utils.Objects.IsPlainObject,Qo=Phaser.Utils.Objects.GetValue,ta=Phaser.Display.Align.CENTER,ea=function(t,e,i,n){if("\n"===t)return this.addNewLine(),this;var s;(_e.call(this,t),$o(e))&&(e=Qo(s=e,"padding",0),i=Qo(s,"key",void 0),n=Qo(s,"index",void 0));return void 0===e&&(e=0),(s=this.getSizerConfig(t)).align=ta,s.padding=Oe(e),void 0===n||n>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(n,0,t),void 0!==i&&this.addChildrenMap(i,t),this},ia={add:function(t,e,i){if(os(t))for(var n=t,s=0,r=n.length;s<r;s++)ea.call(this,n[s],e);else ea.call(this,t,e,i);return this},addNewLine:function(){return this.sizerChildren.push("\n"),this},insert:function(t,e,i,n){return ea.call(this,e,i,n,t),this},insertAtPosition:function(t,e,i,n,s){var r=Zo.call(this,t,e);return -1===r&&(r=void 0),this.insert(r,i,n,s),this}},na=Phaser.Utils.Array.Remove,sa={remove:function(t,e){return this.getParentSizer(t)!==this||(na(this.sizerChildren,t),Ae.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,vo.call(this,t),this}},ra={getChildrenWidth:function(){return this.rexSizer.hidden?0:this.maxChildWidth+this.space.left+this.space.right},getChildrenHeight:function(){return this.rexSizer.hidden?0:this.widthWrapResult.height+this.space.top+this.space.bottom},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,s=i.length;n<s;n++)"\n"!==(e=i[n])&&e.isRexSizer&&t.push(e);return t},preLayout:function(){return this._maxChildWidth=void 0,this._maxChildHeight=void 0,Je.call(this),this},layoutChildren:function(){for(var t,e,i,n,s,r,o,a,h,u,l,c=this.innerWidth,d=this.justifyPercentage,v=this.space.item,p=this.space.line,f=this.space.indentLeftOdd,y=this.space.indentLeftEven,g=this.space.indentTopOdd,m=this.space.indentTopEven,b=0,k=this.innerLeft,C=this.innerTop,S=this.widthWrapResult.lines,P=C,x=0,w=S.length;x<w;x++){switch(h=(a=S[x]).children,this.rtl&&h.reverse(),l=k+(x%2?y:f),u=c-a.width,this.align){case 0:break;case 1:l+=u;break;case 2:l+=u/2;break;case 3:b=Wo(c,u,d,h.length);break;case 4:0===(b=Wo(c,u,d,h.length))&&(l+=u);break;case 5:0===(b=Wo(c,u,d,h.length))&&(l+=u/2);}for(var O=!0,E=0,_=h.length;E<_;E++)(t=h[E]).rexSizer.hidden||(i=(e=t.rexSizer).padding,fs.call(this,t),n=l+i.left,O?O=!1:n+=v,s=P+(E%2?m:g)+i.top,r=pt(t),o=ft(t),l=n+r+i.right+b,ys.call(this,t,n,s,r,o,e.align));P+=a.height+p;}},runWidthWrap:function(t){var e=t-this.space.left-this.space.right;this.widthWrapResult=Ho.call(this,e,this.widthWrapResult),Ke.call(this,t);}};Object.assign(ra,ia,sa);var oa=function(t){void 0===t&&(t=this.sizerChildren);for(var e,i,n=0,s=0,r=t.length;s<r;s++)"\n"!==(e=t[s])&&(i=this.getChildWidth(e),n=Math.max(i,n));return n},aa=function(t){void 0===t&&(t=this.sizerChildren);for(var e,i,n=0,s=0,r=t.length;s<r;s++)"\n"!==(e=t[s])&&(i=e.isRexSizer?Math.max(e.minHeight,e.childrenHeight):e.hasOwnProperty("minHeight")?e.minHeight:ft(e),n=Math.max(i,n));return n},ha=Phaser.Utils.Objects.IsPlainObject,ua=Phaser.Utils.Objects.GetValue,la=function(t){s(r,t);var i=h(r);function r(t,n,s,o,a,h){var u;return e(this,r),ha(n)?(n=ua(h=n,"x",0),s=ua(h,"y",0),o=ua(h,"width",void 0),a=ua(h,"height",void 0)):ha(o)&&(o=ua(h=o,"width",void 0),a=ua(h,"height",void 0)),(u=i.call(this,t,n,s,o,a,h)).type="rexFixWidthSizer",u.sizerChildren=[],u.setOrientation(ua(h,"orientation",0)),u.setItemSpacing(ua(h,"space.item",0)),u.setLineSpacing(ua(h,"space.line",0)),u.setIntentLeft(ua(h,"space.indentLeftOdd",0),ua(h,"space.indentLeftEven",0)),u.setIntentTop(ua(h,"space.indentTopOdd",0),ua(h,"space.indentTopEven",0)),u.setAlign(ua(h,"align",0)),u.setJustifyPercentage(ua(h,"justifyPercentage",.25)),u.setRTL(ua(h,"rtl",!1)),u.addChildrenMap("items",u.sizerChildren),u}return n(r,[{key:"setOrientation",value:function(t){return this.orientation=ko(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setLineSpacing",value:function(t){return this.space.line=t,this}},{key:"setIntentLeft",value:function(t,e){return this.space.indentLeftOdd=t,this.space.indentLeftEven=e,this}},{key:"setIntentTop",value:function(t,e){return this.space.indentTopOdd=t,this.space.indentTopEven=e,this}},{key:"setAlign",value:function(t){return "string"==typeof t&&(t=ca[t]),this.align=t,this}},{key:"setJustifyPercentage",value:function(t){return this.justifyPercentage=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"maxChildWidth",get:function(){return void 0===this._maxChildWidth&&(this._maxChildWidth=oa.call(this)),this._maxChildWidth}},{key:"maxChildHeight",get:function(){return void 0===this._maxChildHeight&&(this._maxChildHeight=aa.call(this)),this._maxChildHeight}}]),r}(to),ca={left:0,top:0,right:1,bottom:1,center:2,justify:3,"justify-left":3,"justify-top":3,"justify-right":4,"justify-bottom":4,"justify-center":5};Object.assign(la.prototype,ra);var da=la.prototype.add,va=function(t){return da.call(this,t),this.buttonGroup.add(t),this},pa={addButton:function(t){if(os(t))for(var e=t,i=0,n=e.length;i<n;i++)va.call(this,e[i]);else va.call(this,t);return this},addButtons:function(t){if(os(t[0]))for(var e,i=t,n=0,s=i.length-1;n<=s;n++){for(var r=0,o=(e=i[n]).length;r<o;r++)va.call(this,e[r]);n>s&&da.addNewLine(this);}else for(r=0,o=t.length;r<o;r++)va.call(this,t[r]);return this}},fa=la.prototype.remove,ya=la.prototype.clear,ga=function(t,e){return (t=this.getButton(t))?(this.buttonGroup.remove(t),fa.call(this,t,e),this):this},ma={remove:function(t,e){if(os(t))for(var i=t,n=0,s=i.length;n<s;n++)ga.call(this,i[n],e);else ga.call(this,t,e);return this},clear:function(t){return this.buttonGroup.buttons.length=0,ya.call(this,t),this},removeButton:function(t,e){return this.remove(t,e),this},clearButtons:function(t){for(var e=this.buttonGroup.buttons,i=e.length-1;i>=0;i--)ga.call(this,e[i],t);return this}},ba=Phaser.Utils.Objects.GetValue,ka=function(t){s(o,t);var i=h(o);function o(t,n){var s;e(this,o),void 0===n&&(n={});var r=n.space;"number"==typeof r&&(n.space={item:r,line:r}),(s=i.call(this,t,n)).type="rexFixWidthButtons",s.buttonGroup=new Xo({parent:a(s),eventEmitter:ba(n,"eventEmitter",a(s)),groupName:ba(n,"groupName",void 0),clickConfig:ba(n,"click",void 0)}).setButtonsType(n);var h=ba(n,"background",void 0),u=ba(n,"buttons",void 0);return s.buttonsAlign=ba(n,"align",void 0),h&&s.addBackground(h),u&&s.addButtons(u),s.addChildrenMap("background",h),s.addChildrenMap("buttons",s.buttonGroup.buttons),s}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(l(r(o.prototype),"destroy",this).call(this,t),this.buttonGroup.destroy(),this.buttonGroup=void 0);}},{key:"buttons",get:function(){return this.buttonGroup.buttons}},{key:"groupName",get:function(){return this.buttonGroup.groupName},set:function(t){this.buttonGroup.groupName=t;}},{key:"eventEmitter",get:function(){return this.buttonGroup.eventEmitter}}]),o}(la);Object.assign(ka.prototype,pa,ma,Yo,Fo);var Ca=Phaser.Utils.Objects.IsPlainObject,Sa=Phaser.Utils.Objects.GetValue,Pa=Phaser.Display.Align.CENTER,xa=Phaser.Utils.String.UUID,wa={add:function(t,e,i,n,s,r,o,a,h){(_e.call(this,t),Ca(e))&&(e=Sa(u=e,"key",void 0),i=Sa(u,"align",Pa),a=Sa(u,"offsetX",0),h=Sa(u,"offsetY",0),n=Sa(u,"padding",0),s=Sa(u,"expand",!0),t.isRexSizer||(r=Sa(u,"minWidth",t._minWidth),o=Sa(u,"minHeight",t._minHeighted)));var u,l=void 0!==e;return l||(e=xa()),"string"==typeof i&&(i=qt[i]),void 0===i&&(i=Pa),void 0===a&&(a=0),void 0===h&&(h=0),void 0===n&&(n=0),void 0===s&&(s=!0),t.isRexSizer||(void 0===r&&(r=t._minWidth),void 0===o&&(o=t._minHeight)),(u=this.getSizerConfig(t)).align=i,u.alignOffsetX=a,u.alignOffsetY=h,u.padding=Oe(n),Ca(s)?(u.expandWidth=Sa(s,"width",!1),u.expandHeight=Sa(s,"height",!1)):(u.expandWidth=s,u.expandHeight=s),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===r?pt(t):r),u.expandHeight&&(t.minHeight=void 0===o?ft(t):o)),this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,l&&this.addChildrenMap(e,t),this}},Oa={remove:function(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else {if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t);}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Ae.call(this,t,e),this},removeAll:function(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear:function(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return vo.call(this,t),this}},Ea={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,s=this.sizerChildren;for(var r in s)e=(t=s[r]).rexSizer.padding,i=this.getChildWidth(t)+e.left+e.right,n=Math.max(i,n);return n+this.space.left+this.space.right},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,s=this.sizerChildren;for(var r in s)i=(t=s[r]).isRexSizer?Math.max(t.minHeight,t.childrenHeight):void 0!==t.minHeight?t.minHeight:ft(t),i+=(e=t.rexSizer.padding).top+e.bottom,n=Math.max(i,n);return n+this.space.top+this.space.bottom},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width);var n=t.rexSizer;if(n.expandWidth){var s=e-this.space.left-this.space.right,r=n.padding;i=s-r.left-r.right;}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer;if(n.expandHeight){var s=e-this.space.top-this.space.bottom,r=n.padding;i=s-r.top-r.bottom;}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var n in i)(e=i[n]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,n,s,r,o,a,h,u=this.innerLeft,l=this.innerTop,c=this.innerWidth,d=this.innerHeight,v=this.sizerChildren;for(var p in v)(t=v[p]).rexSizer.hidden||(i=(e=t.rexSizer).padding,fs.call(this,t),t.isRexSizer?(t.runLayout(this,this.getExpandedChildWidth(t),this.getExpandedChildHeight(t)),eo(t,this)):(a=void 0,h=void 0,e.expandWidth&&(a=c-i.left-i.right),e.expandHeight&&(h=d-i.top-i.bottom),cs(t,a,h)),n=u+i.left,r=c-i.left-i.right,s=l+i.top,o=d-i.top-i.bottom,ys.call(this,t,n,s,r,o,e.align,e.alignOffsetX,e.alignOffsetY));}};Object.assign(Ea,wa,Oa);var _a=Phaser.Utils.Objects.IsPlainObject,Ta=Phaser.Utils.Objects.GetValue,za=function(t){s(r,t);var i=h(r);function r(t,n,s,o,a,h){var u;return e(this,r),_a(n)?(n=Ta(h=n,"x",0),s=Ta(h,"y",0),o=Ta(h,"width",void 0),a=Ta(h,"height",void 0)):_a(o)&&(o=Ta(h=o,"width",void 0),a=Ta(h,"height",void 0)),(u=i.call(this,t,n,s,o,a,h)).type="rexOverlapSizer",u.sizerChildren={},u.addChildrenMap("items",u.sizerChildren),u}return n(r,[{key:"childToKey",value:function(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}]),r}(to);Object.assign(za.prototype,Ea);var Da=za.prototype.add,Ma=function(t,e,i,n,s,r,o,a,h){return t.setVisible(!1),Da.call(this,t,e,i,n,s,r,o,a,h),this},Ra={add:Ma,addPage:Ma},La=Ft.prototype.setChildVisible,Aa={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(La.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var n=this.currentPage;return n&&(La.call(this,n,!0),this.emit("pagevisible",n,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&n.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(Aa,Ra);var ja=Phaser.Utils.Objects.GetValue,Ia=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)).type="rexPages",s.childrenMap=s.sizerChildren,s._previousKey=void 0,s._currentKey=void 0,s.setSwapMode(ja(n,"swapMode",0)),s.setFadeInDuration(ja(n,"fadeIn",0)),s}return n(r,[{key:"setSwapMode",value:function(t){return "string"==typeof t&&(t=Na[t]),this.swapMode=t,this}},{key:"setFadeInDuration",value:function(t){return this.fadeInDuration=t,this}},{key:"previousKey",get:function(){return this._previousKey}},{key:"currentKey",get:function(){return this._currentKey},set:function(t){this.swapPage(t);}},{key:"currentPage",get:function(){return this.getPage(this.currentKey)}},{key:"previousPage",get:function(){return this.getPage(this.previousKey)}},{key:"keys",get:function(){return Object.keys(this.sizerChildren)}}]),r}(za);Object.assign(Ia.prototype,Aa);var Na={invisible:0,destroy:1},Ba=Phaser.Utils.Objects.IsPlainObject,Ya=Phaser.Utils.Objects.GetValue,Xa=Phaser.Utils.String.UUID,Ga={swapPage:function(t,e){var i,n;null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(n=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==n&&(this.childrenMap.pages.fadeInDuration=n));return this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},Fa={removePage:function(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,n=i.getByName(t),s=this.childrenMap.pages,r=s.getElement(t);return n&&r?(s.removeChildrenMap(t),i.removeButton(n,e),s.remove(r,e),this):this}},Ua={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,n=e.length;i<n;i++)if(e[i].name===t)return i},addPage:function(t,e,i){if(Ba(t)){var n=t;t=Ya(n,"key"),e=Ya(n,"tab"),i=Ya(n,"page");}return t||(t=Xa()),e.name=t,this.childrenMap.tabs.addButton(e),this.childrenMap.pages.addPage(i,{key:t}),this},getPage:function(t){return "number"==typeof t&&(t=this.getPageKey(t)),this.childrenMap.pages.getPage(t)},getTab:function(t){var e;return e="number"==typeof t?t:this.getPageIndex(t),this.getElement("tabs.buttons")[e]}};Object.assign(Ua,Ga,Fa);var Va=Phaser.Utils.Objects.GetValue,Wa=Po.prototype.add,Ha=function(t){s(r,t);var i=h(r);function r(t,n){var s;e(this,r),void 0===n&&(n={});var o=Va(n,"tabPosition","top"),h="left"===o||"right"===o?"x":"y";n.orientation=h,(s=i.call(this,t,n)).type="rexTabPages";var u=Va(n,"background",void 0);u&&s.addBackground(u);var l=Va(n,"pages"),c=new Ia(t,l);t.add.existing(c);var d="y"===h,v=!!d&&Va(n,"wrapTabs",!1),p=Va(n,"tabs",void 0);void 0===p&&(p={});var f=v?ka:Vo;p.orientation=d?"x":"y",p.buttonsType="radio";var y=new f(t,p);t.add.existing(y);var g=!!v||Va(n,"expand.tabs",!1),m=Va(n,"align.tabs","left");switch(o){case"top":case"left":Wa.call(a(s),y,{proportion:0,expand:g,align:m}),Wa.call(a(s),c,{proportion:1,expand:!0});break;case"bottom":case"right":Wa.call(a(s),c,{proportion:1,expand:!0}),Wa.call(a(s),y,{proportion:0,expand:g,align:m});}return s.addChildrenMap("background",u),s.addChildrenMap("tabs",y),s.addChildrenMap("pages",c),y.on("button.click",(function(t){var e=t.name;c.hasPage(e)&&c.swapPage(e);})),y.on("button.statechange",(function(t,e,i,n){var s=i?"tab.focus":"tab.blur";this.emit(s,t,t.name);}),a(s)),c.on("pagevisible",(function(t,e,i){this.emit("page.focus",t,e);})),c.on("pageinvisible",(function(t,e,i){this.emit("page.blur",t,e);})),s}return n(r,[{key:"currentKey",get:function(){return this.getElement("pages").currentKey},set:function(t){this.showPage(t);}},{key:"keys",get:function(){return this.getElement("pages").keys}},{key:"currentPage",get:function(){return this.getElement("pages").currentPage}},{key:"previousPage",get:function(){return this.getElement("pages").previousPage}}]),r}(Po);return Object.assign(Ha.prototype,Ua),Ha}));