phaser3-rex-plugins
Version:
8 lines • 381 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexconfirmdialog=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,g(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 r(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 s(t){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},s(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,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)}function l(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=s(t);if(e){var r=s(this).constructor;i=Reflect.construct(n,arguments,r);}else i=n.apply(this,arguments);return h(this,i)}}function u(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=s(t)););return t}function c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,i){var n=u(t,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?t:i):r.value}},c.apply(this,arguments)}function d(t,e,i,n){return d="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,i,n){var r,s=u(t,e);if(s){if((r=Object.getOwnPropertyDescriptor(s,e)).set)return r.set.call(n,i),!0;if(!r.writable)return !1}if(r=Object.getOwnPropertyDescriptor(n,e)){if(!r.writable)return !1;r.value=i,Object.defineProperty(n,e,r);}else !function(t,e,i){(e=g(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i;}(n,e,i);return !0},d(t,e,i,n)}function f(t,e,i,n,r){if(!d(t,e,i,n||t)&&r)throw new TypeError("failed to set property");return i}function p(t){return function(t){if(Array.isArray(t))return v(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 v(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 v(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 v(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 g(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=!1,m=function(t){y||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])<t&&console.error("Minimum supported version : 3.".concat(t)),y=!0);};m();var k=Phaser.GameObjects.Zone,b=Phaser.Utils.Array.Add,x=Phaser.Utils.Array.Remove,w=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a){var h;return e(this,o),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===a&&(a=1),(h=i.call(this,t,n,r,s,a)).children=[],h}return n(o,[{key:"destroy",value:function(t){if(this.scene&&!this.ignoreDestroy){if(t)for(var e,i=this.children.length-1;i>=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),c(s(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 x(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}(k),S=Phaser.GameObjects.Components;Phaser.Class.mixin(w,[S.Alpha,S.Flip]);var C,O=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},_=Phaser.Math.DegToRad,P=Phaser.Math.RadToDeg,T=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 P(this.rotation)},set:function(t){this.rotation=_(t);}}),Object.defineProperty(e,"displayWidth",{get:function(){return t.width*this.scaleX},set:function(e){this.scaleX=e/t.width;}}),Object.defineProperty(e,"displayHeight",{get:function(){return t.height*this.scaleY},set:function(e){this.scaleY=e/t.height;}}),t.rexContainer=e;}return t.rexContainer},E={setParent:function(t,e){void 0===e&&(e=this);var i=T(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),O(t,e)},getTopmostParent:function(t){return void 0===t&&(t=this),function(t){for(var e=O(t);e;)t=e,e=O(e);return t}(t)}},M=Phaser.Utils.Objects.GetValue,R=w.prototype.add,L=function(t,e){this.setParent(t);var i=T(t);return A(i,e),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),R.call(this,t),this.addToParentContainer(t),this.addToRenderLayer(t),this},z=function(t,e){this.setParent(t);var i=T(t);return A(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),R.call(this,t),this.addToRenderLayer(t),this},A=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=M(e,"syncPosition",!0),t.syncRotation=M(e,"syncRotation",!0),t.syncScale=M(e,"syncScale",!0),t.syncAlpha=M(e,"syncAlpha",!0),t.syncScrollFactor=M(e,"syncScrollFactor",!0));},D={add:function(t){return Array.isArray(t)?this.addMultiple(t):L.call(this,t),this},pin:function(t,e){return Array.isArray(t)?this.addMultiple(t,e):L.call(this,t,e),this},addMultiple:function(t){for(var e=0,i=t.length;e<i;e++)L.call(this,t[e]);return this},addLocal:function(t){return Array.isArray(t)?this.addMultiple(t):z.call(this,t),this},pinLocal:function(t,e){return Array.isArray(t)?this.addMultiple(t,e):z.call(this,t,e),this},addLocalMultiple:function(t){for(var e=0,i=t.length;e<i;e++)z.call(this,t[e]);return this}},B=w.prototype.remove,j=w.prototype.clear,W={remove:function(t,e){return O(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),B.call(this,t,e)),this},unpin:function(t,e){return O(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),B.call(this,t,e)),this},clear:function(t){for(var e=this.children,i=0,n=e.length;i<n;i++){var r=e[i];this.setParent(r,null),t||this.removeFromRenderLayer(r);}return j.call(this,t),this}},Y={getLocalState:function(t){return T(t)},resetChildState:function(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState:function(t){for(var e=0,i=t.length;e<i;e++)this.resetChildState(t[e]);return this},syncProperties:function(){return this.syncPosition().syncVisible().syncAlpha().syncActive().syncScrollFactor().syncMask(),this}},X=Phaser.Math.RotateAround,I={worldToLocal:function(t){return t.x-=this.x,t.y-=this.y,X(t,0,0,-this.rotation),t.x/=this.scaleX,t.y/=this.scaleY,t},localToWorld:function(t){return t.x*=this.scaleX,t.y*=this.scaleY,X(t,0,0,this.rotation),t.x+=this.x,t.y+=this.y,t}},H=function(t,e){return t===e?1:t/e},F={updateChildPosition:function(t){t.isRexContainerLite&&(t.syncChildrenEnable=!1);var e=T(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=T(t),i=e.parent;return e.x=t.x,e.y=t.y,i.worldToLocal(e),e.scaleX=H(t.scaleX,i.scaleX),e.scaleY=H(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=T(t);return n.x=e,n.y=i,this.updateChildPosition(t),this},resetLocalPositionState:function(){var t=T(this).parent;return t&&t.resetChildPositionState(this),this}},N=Phaser.Math.DegToRad,G={updateChildRotation:function(t){var e=T(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=T(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 T(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle:function(t,e){return T(t).rotation=N(e),this.updateChildRotation(t),this},resetLocalRotationState:function(){var t=T(this).parent;return t&&t.resetChildRotationState(this),this}},V={updateChildScale:function(t){var e=T(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=T(t),i=e.parent;return e.scaleX=H(t.scaleX,i.scaleX),e.scaleY=H(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=T(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=T(this).parent;return t&&t.resetChildScaleState(this),this}},U={updateChildVisible:function(t){var e=T(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=T(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),T(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible:function(t,e){return void 0===e&&(e=!0),T(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState:function(){var t=T(this).parent;return t&&t.resetChildVisibleState(this),this}},J={updateChildAlpha:function(t){var e=T(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=T(t),i=e.parent;return e.alpha=H(t.alpha,i.alpha),this},setChildAlpha:function(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha:function(t,e){return T(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState:function(){var t=T(this).parent;return t&&t.resetChildAlphaState(this),this}},K={updateChildActive:function(t){var e=T(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 T(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),T(t).active=e,this.updateChildActive(t),this},resetLocalActiveState:function(){var t=T(this).parent;return t&&t.resetChildActiveState(this),this}},q={updateChildScrollFactor:function(t){var e=T(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Z={updateChildMask:function(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask:function(t){return this.mask=t,this},clearMask:function(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t);})),t&&this.mask&&this.mask.destroy(),this}},$=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},Q={setDepth:function(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),n=0,r=i.length;n<r;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]);$(e,!1);for(var i=0,n=e.length;i<n;i++){var r=e[i];t.exists(r)&&t.bringToTop(r);}return this},moveDepthBelow:function(t){var e=this.displayList;if(t.displayList!==e)return this;var i=this.getAllChildren([this]);$(i,!1);for(var n=0,r=i.length;n<r;n++){var s=i[n];if(e.exists(s)){e.moveBelow(t,s);break}}return this},moveDepthAbove:function(t){var e=this.displayList;if(t.displayList!==e)return this;var i=this.getAllChildren([this]);$(i,!0);for(var n=0,r=i.length;n<r;n++){var s=i[n];if(e.exists(s)){e.moveAbove(t,s);break}}return this},bringChildToTop:function(t){var e=this.getAllChildren([this]);$(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]);$(e,!1);var i=e[0];return i===t||i.displayList!==t.displayList||i.displayList.moveBelow(t,i),this}},tt=function t(e,i){if(!i(e)&&e.isRexContainerLite)for(var n=e.children,r=0,s=n.length;r<s;r++)t(n[r],i);},et=function(t,e){for(var i=[t];i.length>0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,p(n.children));}},it=Phaser.Utils.Array,nt={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 et(e,(function(i){i!==e&&t.push(i);})),t},getAllVisibleChildren:function(t){void 0===t&&(t=[]);var e=this;return et(e,(function(i){if(i!==e)return !i.visible||void t.push(i)})),t},bfs:function(t,e){return void 0===e&&(e=this),et(e,t),this},dfs:function(t,e){return void 0===e&&(e=this),tt(e,t),this},contains:function(t){var e=O(t);return !!e&&(e===this||this.contains(e))},getByName:function(t,e){if(e){for(var i,n,r=[this];r.length;)for(var s=0,o=(i=r.shift()).children.length;s<o;s++){if((n=i.children[s]).name===t)return n;n.isRexContainerLite&&r.push(n);}return null}return it.GetFirst(this.children,"name",t)},getRandom:function(t,e){return it.GetRandom(this.children,t,e)},getFirst:function(t,e,i,n){return it.GetFirstElement(this.children,t,e,i,n)},getAll:function(t,e,i,n){return it.GetAll(this.children,t,e,i,n)},count:function(t,e,i,n){return it.CountAllMatching(this.children,t,e,i,n)},swap:function(t,e){return it.Swap(this.children,t,e),this},setAll:function(t,e,i,n){return it.SetAll(this.children,t,e,i,n),this}},rt=function(t){for(var e=[],i=0,n=t.length;i<n;i++){var r=t[i];r.hasOwnProperty("rexContainer")&&e.push(r.rexContainer);}return e},st=function(t,e,i){if(i.parent){var n=i.parent,r=i.self;switch(e){case"x":case"y":n.updateChildPosition(r);break;case"angle":case"rotation":n.updateChildRotation(r);break;case"scaleX":case"scaleY":case"displayWidth":case"displayHeight":n.updateChildScale(r);break;case"alpha":n.updateChildAlpha(r);break;default:n.updateChildPosition(r),n.updateChildRotation(r),n.updateChildScale(r),n.updateChildAlpha(r);}}else t.remove();},ot={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=rt(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=rt(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)}},at=Phaser.GameObjects.Container,ht=Phaser.GameObjects.Layer,lt=function(t){return t instanceof ht},ut=function(t){var e=t.getAllChildren([t]);return e=e.filter((function(t){return !!t.displayList||!!t.parentContainer}))},ct=function(t){var e=ut(this);return $(e),t.add(e),this},dt=function(t,e,i){var n=ut(this);return $(n,e),t.remove(n),i&&n.forEach((function(t){t.addToDisplayList();})),this},ft={addToContainer:function(t){return function(t){return t instanceof at}(t)?(this._setParentContainerFlag=!0,ct.call(this,t),this._setParentContainerFlag=!1,this):this},addToLayer:function(t){return lt(t)?(ct.call(this,t),this):this},removeFromContainer:function(){return this.parentContainer?(this._setParentContainerFlag=!0,dt.call(this,this.parentContainer,!0,!1),this._setParentContainerFlag=!1,this):this},removeFromLayer:function(t){return void 0===t&&(t=!0),lt(this.displayList)?(dt.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}},pt={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),T(t).layer=e,this):this},removeFromRenderLayer:function(t){var e=T(t),i=e.layer;return i?(t.isRexContainerLite?t.removeFromLayer(!0):i.remove(t),e.layer=null,this):this}},vt=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},gt=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height},yt=Phaser.Geom.Rectangle,mt=Phaser.Math.Vector2,kt=Phaser.Math.RotateAround,bt=function(t,e){if(void 0===e?e=new yt:!0===e&&(void 0===xt&&(xt=new yt),e=xt),t.getBounds)return t.getBounds(e);var i,n,r,s,o,a,h,l;if(t.parentContainer){var u=t.parentContainer.getBoundsTransformMatrix();wt(t,e),u.transformPoint(e.x,e.y,e),i=e.x,n=e.y,St(t,e),u.transformPoint(e.x,e.y,e),r=e.x,s=e.y,Ct(t,e),u.transformPoint(e.x,e.y,e),o=e.x,a=e.y,Ot(t,e),u.transformPoint(e.x,e.y,e),h=e.x,l=e.y;}else wt(t,e),i=e.x,n=e.y,St(t,e),r=e.x,s=e.y,Ct(t,e),o=e.x,a=e.y,Ot(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,o,h),e.y=Math.min(n,s,a,l),e.width=Math.max(i,r,o,h)-e.x,e.height=Math.max(n,s,a,l)-e.y,e},xt=void 0,wt=function(t,e,i){return void 0===e?e=new mt:!0===e&&(void 0===_t&&(_t=new mt),e=_t),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-vt(t)*t.originX,e.y=t.y-gt(t)*t.originY,Pt(t,e,i))},St=function(t,e,i){return void 0===e?e=new mt:!0===e&&(void 0===_t&&(_t=new mt),e=_t),t.getTopRight?t.getTopRight(e):(e.x=t.x-vt(t)*t.originX+vt(t),e.y=t.y-gt(t)*t.originY,Pt(t,e,i))},Ct=function(t,e,i){return void 0===e?e=new mt:!0===e&&(void 0===_t&&(_t=new mt),e=_t),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-vt(t)*t.originX,e.y=t.y-gt(t)*t.originY+gt(t),Pt(t,e,i))},Ot=function(t,e,i){return void 0===e?e=new mt:!0===e&&(void 0===_t&&(_t=new mt),e=_t),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-vt(t)*t.originX+vt(t),e.y=t.y-gt(t)*t.originY+gt(t),Pt(t,e,i))},_t=void 0,Pt=function(t,e,i){(void 0===i&&(i=!1),0!==t.rotation&&kt(e,t.x,t.y,t.rotation),i&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e},Tt=Phaser.Geom.Rectangle,Et=Phaser.Geom.Rectangle.Union,Mt=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},Rt=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:Mt(e),i){e.length=t.length;for(var n=0,r=t.length;n<r;n++)e[n]=t[n];}else for(var s in t)e[s]=t[s];return e},Lt=Phaser.GameObjects.GameObject,zt=function(t){return t instanceof Lt},At=Phaser.Utils.Objects.GetValue,Dt=Phaser.Textures.DynamicTexture,Bt=Phaser.Utils.String.UUID,jt=function(t){if(t){var e,i,n=t.gameObjects,r=t.renderTexture,s=At(t,"x",void 0),o=At(t,"y",void 0),a=At(t,"width",void 0),h=At(t,"height",void 0),l=At(t,"originX",0),u=At(t,"originY",0),c=At(t,"padding",0);if(void 0===a||void 0===h||void 0===s||void 0===o){var d=function(t,e){var i;void 0===e?e=new Tt:!0===e&&(void 0===C&&(C=new Tt),e=C),e.setTo(0,0,0,0);for(var n=!0,r=0,s=t.length;r<s;r++)if((i=t[r]).getBounds){var o=bt(i,!0);n?(e.setTo(o.x,o.y,o.width,o.height),n=!1):Et(o,e,e);}return e}(n,!0);void 0!==s&&void 0!==o?(a=2*Math.max(s-d.left,d.right-s),h=2*Math.max(o-d.top,d.bottom-o),l=.5,u=.5):(s=d.x,o=d.y,a=d.width,h=d.height,l=0,u=0),e=d.x,i=d.y;}else e=s+(0-l)*a,i=o+(0-u)*h;e-=c,i-=c,a+=2*c,h+=2*c;var f=n[0].scene;p&&!r&&(r=new Dt(f.sys.textures,Bt(),a,h)),r||(r=f.add.renderTexture(0,0,a,h)),r.setPosition&&r.setPosition(s,o),r.width===a&&r.height===h||r.setSize(a,h),r.setOrigin&&r.setOrigin(l,u),r.camera.setScroll(e,i),n=$(Rt(n)),r.draw(n);var p=t.saveTexture;if(p)if(zt(r))r.saveTexture(p);else {var v=r,g=v.manager;g.exists(v.key)?g.renameTexture(v.key,key):(v.key=key,g.list[key]=v,g.emit("addtexture",key,v),g.emit("addtexture-".concat(key),v));}return r}},Wt={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 r=jt(t),s=!!r.scene;return n||(this.setScale(e,i),s&&r.setScale(e,i)),s?r:this}},Yt=Phaser.Utils.Objects.GetValue,Xt=function(t,e,i,n,r,s,o){if(t.getBounds||void 0!==t.width&&void 0!==t.height){void 0===i&&(i=16777215),void 0===n&&(n=1),void 0===r&&(r=null),void 0===s&&(s=1),void 0===o&&(o=0);var a=wt(t,It[0]);a.x-=o,a.y-=o;var h=St(t,It[1]);h.x+=o,h.y-=o;var l=Ot(t,It[2]);l.x+=o,l.y+=o;var u=Ct(t,It[3]);u.x-=o,u.y+=o,null!==r&&e.fillStyle(r,s).fillPoints(It,!0,!0),null!==i&&e.lineStyle(n,i).strokePoints(It,!0,!0);}},It=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Ht=Phaser.Utils.Objects.GetValue,Ft=Phaser.Math.RotateAround,Nt={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};Ft(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,r=i.length;n<r;n++)this.resetChildPositionState(i[n]);return this},drawBounds:function(t,e){var i=Ht(e,"drawContainer",!0),n=Ht(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,r,s,o,a;if("number"==typeof i?n=i:(n=Yt(i,"color"),r=Yt(i,"lineWidth"),s=Yt(i,"fillColor"),o=Yt(i,"fillAlpha",1),a=Yt(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h<l;h++)Xt(t[h],e,n,r,s,o,a);else Xt(t,e,n,r,s,o,a);}(n,t,e),this}};Object.assign(Nt,E,D,W,Y,I,F,G,V,U,J,K,q,Z,Q,nt,ot,ft,pt,Wt);var Gt=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a,h){var l;return e(this,o),Array.isArray(s)&&(h=s,s=void 0,a=void 0),(l=i.call(this,t,n,r,s,a)).type="rexContainerLite",l.isRexContainerLite=!0,l.syncChildrenEnable=!0,l._active=!0,l._mask=null,l._scrollFactorX=1,l._scrollFactorY=1,l.privateRenderLayer=void 0,h&&l.add(h),l}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.syncChildrenEnable=!1,c(s(o.prototype),"destroy",this).call(this,t),this.privateRenderLayer&&(this.privateRenderLayer.list.length=0,this.privateRenderLayer.destroy()));}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"x",get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this.syncPosition());}},{key:"y",get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.syncPosition());}},{key:"rotation",get:function(){return c(s(o.prototype),"rotation",this)},set:function(t){this.rotation!==t&&(f(s(o.prototype),"rotation",t,this,!0),this.syncPosition());}},{key:"scaleX",get:function(){return c(s(o.prototype),"scaleX",this)},set:function(t){this.scaleX!==t&&(f(s(o.prototype),"scaleX",t,this,!0),this.syncPosition());}},{key:"scaleY",get:function(){return c(s(o.prototype),"scaleY",this)},set:function(t){this.scaleY!==t&&(f(s(o.prototype),"scaleY",t,this,!0),this.syncPosition());}},{key:"scale",get:function(){return c(s(o.prototype),"scale",this)},set:function(t){this.scale!==t&&(f(s(o.prototype),"scale",t,this,!0),this.syncPosition());}},{key:"visible",get:function(){return c(s(o.prototype),"visible",this)},set:function(t){c(s(o.prototype),"visible",this)!==t&&(f(s(o.prototype),"visible",t,this,!0),this.syncVisible());}},{key:"alpha",get:function(){return c(s(o.prototype),"alpha",this)},set:function(t){c(s(o.prototype),"alpha",this)!==t&&(f(s(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=O(this);return !!t&&t.setParentContainerFlag}}],[{key:"GetParent",value:function(t){return O(t)}}]),o}(w);Object.assign(Gt.prototype,Nt);var Vt=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};var Ut=Phaser.Cameras.Scene2D.BaseCamera,Jt=Phaser.Geom.Rectangle,Kt=function(t,e,i){return e instanceof Ut||(i=e,e=void 0),void 0===i?i=new Jt:!0===i&&(i=qt),e?t.scale.getViewPort(e,i):t.scale.getViewPort(i)},qt=new Jt,Zt=Phaser.Display.Align,$t={center:Zt.CENTER,left:Zt.LEFT_CENTER,right:Zt.RIGHT_CENTER,top:Zt.TOP_CENTER,bottom:Zt.BOTTOM_CENTER,"left-top":Zt.TOP_LEFT,"top-left":Zt.TOP_LEFT,"left-center":Zt.LEFT_CENTER,"center-left":Zt.LEFT_CENTER,"left-bottom":Zt.BOTTOM_LEFT,"bottom-left":Zt.BOTTOM_LEFT,"center-top":Zt.TOP_CENTER,"top-center":Zt.TOP_CENTER,"center-center":Zt.CENTER,"center-bottom":Zt.BOTTOM_CENTER,"bottom-center":Zt.BOTTOM_CENTER,"right-top":Zt.TOP_RIGHT,"top-right":Zt.TOP_RIGHT,"right-center":Zt.RIGHT_CENTER,"center-right":Zt.RIGHT_CENTER,"right-bottom":Zt.BOTTOM_RIGHT,"bottom-right":Zt.BOTTOM_RIGHT},Qt=function(){},te=new Phaser.GameObjects.Zone({sys:{queueDepthSort:Qt,events:{once:Qt}}},0,0,1,1);te.setOrigin(0);var ee=0,ie=1,ne=2,re=4,se=6,oe=8,ae=10,he=12,le=function(t){var e=gt(t);return t.y+e-e*t.originY},ue=function(t){var e=vt(t);return t.x-e*t.originX+.5*e},ce=function(t,e){var i=gt(t);return t.y=e-i+i*t.originY,t},de=function(t,e){var i=vt(t),n=i*t.originX;return t.x=e+n-.5*i,t},fe=function(t){var e=vt(t);return t.x-e*t.originX},pe=function(t,e){var i=vt(t);return t.x=e+i*t.originX,t},ve=function(t){var e=vt(t);return t.x+e-e*t.originX},ge=function(t,e){var i=vt(t);return t.x=e-i+i*t.originX,t},ye=function(t,e){var i=gt(t),n=i*t.originY;return t.y=e+n-.5*i,t},me=function(t){var e=gt(t);return t.y-e*t.originY+.5*e},ke=function(t){var e=gt(t);return t.y-e*t.originY},be=function(t,e){var i=gt(t);return t.y=e+i*t.originY,t},xe=[];xe[11]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),de(t,ue(e)+i),ce(t,le(e)+n),t},xe[ae]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),pe(t,fe(e)-i),ce(t,le(e)+n),t},xe[he]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ge(t,ve(e)+i),ce(t,le(e)+n),t},xe[se]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),function(t,e,i){de(t,e),ye(t,i);}(t,ue(e)+i,me(e)+n),t},xe[re]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),pe(t,fe(e)-i),ye(t,me(e)+n),t},xe[oe]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ge(t,ve(e)+i),ye(t,me(e)+n),t},xe[ie]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),de(t,ue(e)+i),be(t,ke(e)-n),t},xe[ee]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),pe(t,fe(e)-i),be(t,ke(e)-n),t},xe[ne]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ge(t,ve(e)+i),be(t,ke(e)-n),t};var we=function(t,e,i,n,r){return xe[i](t,e,n,r)},Se=function(t,e,i,n,r,s){te.setPosition(e,i).setSize(n,r),we(t,te,s);},Ce=Phaser.Utils.Objects.GetValue,Oe=Phaser.GameObjects.Group,_e=function(t,e,i){return t.add.text(0,0,"")},Pe=void 0,Te=Phaser.Utils.Objects.GetValue,Ee=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=Te(t,"left",0),e.right=Te(t,"right",0),e.top=Te(t,"top",0),e.bottom=Te(t,"bottom",0)),e},Me=Gt.prototype.add,Re=function(t){return Me.call(this,t),this.sizerEventsEnable&&(t.emit("sizer.add",t,this),this.emit("add",t,this)),this},Le={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),Re.call(this,t),this.backgroundChildren.push(t),this.getSizerConfig(t).padding=Ee(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},Ae={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)}},De=Phaser.Utils.Array.Remove,Be=Gt.prototype.remove,je=Ae.getParentSizer,We=function(t,e){for(var i=je(t);i;)i.removeChildCallback&&i.removeChildCallback(t,e),i=je(i);return this.isBackground(t)&&De(this.backgroundChildren,t),Be.call(this,t,e),!e&&this.sizerEventsEnable&&(t.emit("sizer.remove",t,this),this.emit("remove",t,this)),this},Ye=Phaser.Utils.Array.Remove,Xe=Ae.getParentSizer,Ie={removeFromParentSizer:function(){var t=Xe(gameObject);return t&&t.remove(this),this},removeBackground:function(t,e){return void 0===this.backgroundChildren||this.getParentSizer(t)!==this||(Ye(this.backgroundChildren,t),We.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}},He=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else {var i=t;for(t in i)this.childrenMap[t]=i[t];}return this},Fe=/(\S+)\[(\d+)\]/i,Ne=Phaser.Utils.Objects.GetValue,Ge=function(t,e){return void 0===e?t:t[e]},Ve=function(e,i,n){void 0===e&&(e={}),void 0===i&&(i=0);var r=t(i);return "string"===r?e[i]=n:"number"===r?(e.left=i,e.right=i,e.top=i,e.bottom=i):(e.left=Ne(i,"left",0),e.right=Ne(i,"right",0),e.top=Ne(i,"top",0),e.bottom=Ne(i,"bottom",0)),e},Ue={getInnerPadding:function(t){return Ge(this.space,t)},setInnerPadding:function(t,e){return Ve(this.space,t,e),this},getOuterPadding:function(t){return Ge(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return Ve(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)),Ve(this.getSizerConfig(t).padding,e,i),this}},Je=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},Ke=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},qe={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,r=i.length;n<r;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,p(i.children)));}return t}},Ze=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();},$e=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):[]}},ti=Phaser.Scene,ei=function(t){return t instanceof ti},ii=function(e){return null==e||"object"!==t(e)?null:ei(e)?e:e.scene&&ei(e.scene)?e.scene:e.parent&&e.parent.scene&&ei(e.parent.scene)?e.parent.scene:null},ni=Phaser.Game,ri=function(t){return t instanceof ni},si=function(e){return null==e||"object"!==t(e)?null:ri(e)?e:ri(e.game)?e.game:ei(e)?e.sys.game:ei(e.scene)?e.scene.sys.game:void 0},oi=Phaser.Utils.Objects.GetValue,ai=function(){function t(i,n){e(this,t),this.setParent(i),this.isShutdown=!1,this.setEventEmitter(oi(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=ii(t),this.game=si(t),this}}]),t}();Object.assign(ai.prototype,Qe);var hi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,{eventEmitter:!1})).viewport=void 0,r.resetFromJSON(n),r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.autoAnchor(!1),this.viewport=void 0,this.onUpdateViewportCallback=void 0,this.onUpdateViewportCallbackScope=void 0,this.onResizeCallback=void 0,this.onResizeCallbackScope=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"resetFromJSON",value:function(t){var e,i,n,r,s,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,r=t.y):void 0!==t.top?(n=0,r=t.top):void 0!==t.bottom?(n=1,r=t.bottom):void 0!==t.centerY&&(n=.5,r=t.centerY),void 0!==i&&(i=i.replace("left","0%").replace("right","100%").replace("center","50%").split("%"),s=parseFloat(i[0])/100,o=""===i[1]?0:parseFloat(i[1])),void 0!==r&&(r=r.replace("top","0%").replace("bottom","100%").replace("center","50%").split("%"),a=parseFloat(r[0])/100,h=""===r[1]?0:parseFloat(r[1]));var l,u,c=t.width;void 0!==c&&(c=c.split("%"),l=parseFloat(c[0])/100,u=""===c[1]?0:parseFloat(c[1]));var d,f,p=t.height;void 0!==p&&(p=p.split("%"),d=parseFloat(p[0])/100,f=""===p[1]?0:parseFloat(p[1])),this.setAlign(e,n),this.setPercentage(s,a),this.setOffset(o,h),this.setSizePercentage(l,d),this.setSizePadding(u,f);var v=t.onResizeCallback,g=t.onResizeCallbackScope;void 0!==v&&this.setResizeCallback(v,g);var y=t.onUpdateViewportCallback,m=t.onUpdateViewportCallbackScope;return void 0!==y&&this.setUpdateViewportCallback(y,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 r=this.parent;void 0===i&&(i=r.width),void 0===n&&(n=r.height),e?t.call(e,i,n,r,this):t(i,n,r,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=Kt(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}(ai),li=Phaser.Utils.Objects.GetValue,ui=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._isRunning=!1,r.isPaused=!1,r.tickingState=!1,r.setTickingMode(li(n,"tickingMode",1)),r}return n(o,[{key:"boot",value:function(){2!==this.tickingMode||this.tickingState||this.startTicking();}},{key:"shutdown",value:function(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"setTickingMode",value:function(t){"string"==typeof t&&(t=ci[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}(ai),ci={no:0,lazy:1,always:2},di=Phaser.Utils.Objects.GetValue,fi=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=(r=i.call(this,t,n)).scene?"update":"step";return r.tickEventName=di(n,"tickEventName",s),r.isSceneTicker=!pi(r.tickEventName),r}return n(o,[{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this);}},{key:"stopTicking",value:function(){c(s(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}(ui),pi=function(t){return "step"===t||"poststep"===t},vi=Phaser.Utils.Objects.GetValue,gi=Phaser.Math.Clamp,yi=function(){function t(i){e(this,t),this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){this.state=vi(t,"state",mi),this.timeScale=vi(t,"timeScale",1),this.delay=vi(t,"delay",0),this.repeat=vi(t,"repeat",0),this.repeatCounter=vi(t,"repeatCounter",0),this.repeatDelay=vi(t,"repeatDelay",0),this.duration=vi(t,"duration",0),this.nowTime=vi(t,"nowTime",0),this.justRestart=vi(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?bi:ki,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=mi,this}},{key:"update",value:function(t,e){this.state!==mi&&this.state!==wi&&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=xi)):(this.nowTime=this.duration,this.state=wi):this.nowTime>=0&&(this.state=bi));}},{key:"t",get:function(){var t;switch(this.state){case mi:case ki:case xi:t=0;break;case bi:t=this.nowTime/this.duration;break;case wi:t=1;}return gi(t,0,1)},set:function(t){(t=gi(t,-1,1))<0?(this.state=ki,this.nowTime=-this.delay*t):(this.state=bi,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===mi}},{key:"isDelay",get:function(){return this.state===ki}},{key:"isCountDown",get:function(){return this.state===bi}},{key:"isRunning",get:function(){return this.state===ki||this.state===bi}},{key:"isDone",get:function(){return this.state===wi}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),mi=0,ki=1,bi=2,xi=3,wi=-1,Si=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new yi,r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),c(s(o.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),c(s(o.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),c(s(o.prototype),"complete",this).call(this),this}}]),o}(fi),Ci=Phaser.Utils.Objects.GetValue,Oi=Phaser.Utils.Objects.GetAdvancedValue,_i=Phaser.Tweens.Builders.GetEaseFunction,Pi=function(t){r(o,t);var i=l(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(Oi(t,"delay",0)),this.setDuration(Oi(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=_i(t),this}},{key:"start",value:function(){return this.timer.isRunning||c(s(o.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),c(s(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}(Si),Ti=Phaser.Utils.Objects.GetValue,Ei=Phaser.Utils.Objects.GetAdvancedValue,Mi=Phaser.Math.Linear,Ri=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).scaleStart={},r.scaleEnd={},r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Ti(t,"mode",0)),this.setScaleRange(Ei(t,"start",void 0),Ei(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Li[t]),this.mode=t,this}},{key:"setScaleRange",value:function(t,e){return "number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ei(t,"x",this.parent.scaleX),this.startY=Ei(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ei(e,"x",void 0),this.endY=Ei(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}},{key:"start",value:function(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),c(s(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=Mi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Mi(this.startY,this.endY,i));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Pi),Li={stop:0,destroy:1,yoyo:2},zi=function(t,e,i,n,r){var s,o;switch(void 0===n&&(n="Cubic"),i){case 0:case"x":s={x:0},o={x:t.scaleX};break;case 1:case"y":s={y:0},o={y:t.scaleY};break;default:s=0,o=t.scale;}var a={mode:0,start:s,end:o,duration:e,ease:n};return void 0===r?r=new Ri(t,a):r.resetFromJSON(a),r.restart(),r},Ai=function(t,e,i,n,r,s){void 0===n&&(n="Linear"),r instanceof Ri&&(s=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?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===s?s=new Ri(t,o):s.resetFromJSON(o),s.restart(),s},Di=function(t,e){return new Promise((function(i,n){t.once(e,(function(){i();}));}))},Bi=function(t){return Di(t,"complete")},ji=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=Ae.getParentSizer(t);e&&e.resetChildPositionState(t);}));},Yi={popUp:function(t,e,i){if(ji(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease;}var r=void 0===this._scaleBehavior;return this._scaleBehavior=zi(this,t,e,i,this._scaleBehavior),r&&Wi(this,this._scaleBehavior),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),Bi(this._scaleBehavior)},scaleDownDestroy:function(t,e,i,n){if(ji(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,n=r.destroy;}var s=void 0===this._scaleBehavior;return this._scaleBehavior=Ai(this,t,e,i,n,this._scaleBehavior),s&&Wi(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),Bi(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),Bi(this._scaleBehavior)},scaleYoyo:function(t,e,i,n,r){if(ji(t)){var s=t;t=s.duration,e=s.peakValue,i=s.repeat,n=s.orientation,r=s.ease;}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,n,r,s,o){var a,h;switch(void 0===i&&(i=1.2),void 0===n&&(n=0),void 0===s&&(s="Cubic"),r){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 l={mode:2,start:a,end:h,duration:e/2,ease:s,repeat:n};return void 0===o?o=new Ri(t,l):o.resetFromJSON(l),o.restart(),o}(this,t,e,i,n,r,this._scaleBehavior),o&&Wi(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise:function(t,e,i,n,r){return this.scaleYoyo(t,e,i,n,r),Bi(this._scaleBehavior)}},Xi=Phaser.Utils.Objects.GetValue,Ii=Phaser.Utils.Objects.GetAdvancedValue,Hi=Phaser.Math.Linear,Fi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Ii(t,"start",this.parent.alpha),Ii(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Ni[t]),this.mode=t,this}},{key:"setAlphaRange",value:function(t,e){return this.alphaStart=t,this.alphaEnd=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),c(s(o.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Hi(this.alphaStart,this.alphaEnd,i);}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Pi),Ni={stop:0,destroy:1,yoyo:2},Gi=Phaser.Utils.Objects.IsPlainObject,Vi=function(t,e,i,n){var r,s;Gi(i)?(r=i.start,s=i.end):s=i,void 0===r&&(r=0),void 0===s&&(s=1);var o={mode:0,start:r,end:s,duration:e};return void 0===n?n=new Fi(t,o):n.resetFromJSON(o),n.restart(),n},Ui=function(t,e,i,n){i instanceof Fi&&(n=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===n?n=new Fi(t,r):n.resetFromJSON(r),n.restart(),n},Ji=Phaser.Utils.Objects.IsPlainObject,Ki=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=Ae.getParentSizer(t);e&&e.resetChildAlphaState(t);}));},qi={fadeIn:function(t,e){if(Ji(t)){var i=t;t=i.duration,e=i.alpha;}var n=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),n&&Ki(this,this._fade),this._fade.completeEventName="fadein.complete",this},fadeInPromise:function(t,e){return this.fadeIn(t,e),Bi(this._fade)},fadeOutDestroy:function(t,e){if(Ji(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&&Ki(this,this._fade),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),Bi(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),Bi(this._fade)}},Zi=Phaser.Utils.Objects.GetValue,$i=Phaser.Utils.Objects.GetAdvancedValue,Qi=Phaser.Math.Linear,tn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){if(c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Zi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=$i(t,"x",void 0),i=$i(t,"y",void 0);this.setTargetPosition(e,i);}else this.setTargetPosition(t);return this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=en[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=$i(i,"startX",void 0),this.startY=$i(i,"startY",void 0),this.endX=$i(i,"endX",void 0),this.endY=$i(i,"endY",void 0);}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}},{key:"start",value:function(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),c(s(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 c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Pi),en={stop:0,destroy:1,yoyo:2},nn=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}},rn=Phaser.Utils.Objects.IsPlainObject,sn=Phaser.Math.Distance.Between,on=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=Ae.getParentSizer(t);e&&e.resetChildPositionState(t);}));},an={moveFrom:function(t,e,i,n,r){if(rn(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*sn(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof tn&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=nn(i,t.x),a.endX=t.x),void 0!==n&&(a.startY=nn(n,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new tn(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&on(this,this._easeMove),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise:function(t,e,i,n,r){return this.moveFrom(t,e,i,n,r),Bi(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),Bi(this._easeMove)},moveTo:function(t,e,i,n,r){if(rn(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*sn(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof tn&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=t.x,a.endX=nn(i,t.x)),void 0!==n&&(a.startY=t.y,a.endY=nn(n,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new tn(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&on(this,this._easeMove),this._easeMove.completeEventName="moveto.complete",this},moveToPromise:function(t,e,i,n,r){return this.moveTo(t,e,i,n,r),Bi(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),Bi(this._easeMove)},moveStop:function(t){return this._easeMove?(this._easeMove.stop(t),this):this}},hn=Phaser.Utils.Objects.GetValue,ln=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new yi,r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(hn(t,"timer")),this.setEnable(hn(t,"enable",!0)),this.setMode(hn(t,"mode",1)),this.isRunning=hn(t,"isRunning",!1),this.setMagnitudeMode(hn(t,"magnitudeMode",1)),this.setAxisMode(hn(t,"axis",0)),this.setDuration(hn(t,"duration",500)),this.setMagnitude(hn(t,"magnitude",10)),this.ox=hn(t,"ox",void 0),this.oy=hn(t,"oy",void 0),this}},{key:"toJSON",value:function(){return {timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}},{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this);}},{key:"stopTicking",value:function(){c(s(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=un[t]),this.mode=t,this}},{key:"setMagnitudeMode",value:function(t){return "string"==typeof t&&(t=dn[t]),this.magnitudeMode=t,this}},{key:"setAxisMode",value:function(t){return "string"==typeof t&&(t=cn[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=hn(i,"magnitude",void 0),t=hn(i,"duration",void 0);}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),c(s(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 r=Math.random()*Math.PI*2,s=this.ox+Math.cos(r)*n,o=this.oy+Math.sin(r)*n;switch(this.axisMode){case 1:i.x=s;break;case 2:i.y=o;break;default:i.x=s,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}(ui),un={effect:0,behavior:1},cn={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},dn={constant:0,decay:1},fn=Phaser.Utils.Objects.IsPlainObject,pn={shake:function(t,e,i){if(fn(t)){var n=t;t=n.duration,e=n.magnitude,i=n.magnitudeMode;}return void 0===this._shake&&(this._shake=new ln(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),Bi(this._shake)}},vn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.Linear,yn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(),r.boot(),r}return n(o,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=vn(t,"key","value");var i=e[this.propertyKey];return this.fromValue=vn(t,"from",i),this.toValue=vn(t,"to",i),this.setEase(vn(t,"ease",this.ease)),this.setDuration(vn(t,"duration",this.duration)),this.setRepeat(vn(t,"repeat",0)),this.setDelay(vn(t,"delay",0)),this.setRepeatDelay(vn(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=gn(this.fromValue,this.toValue,i);}}]),o}(Pi),mn=Phaser.Utils.Objects.IsPlainObject,kn=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).parent.setDataEnabled(),r.easeTasks={},r}return n(s,[{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 yn(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(mn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*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(mn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*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}}]),s}(ai),bn={easeDataTo:function(t,e,i,n){return this._easeData||(this._easeData=new kn(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),Di(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}},xn=function(t){Cn(t,!1);},wn=function(t){Cn(t,!0);},Sn=function(t){return !!t&&!Vt(t).hidden},Cn=function(t,e){if(t){Vt(t).hidden=e;var i=O(t);i?i.setChildVisible(t,!e):t.setVisible(!e);}},On={show:function(t){return void 0===t&&(t=this),xn(t),this},hide:function(t){return void 0===t&&(t=this),wn(t),this},isShow:function(t){return void 0===t&&(t=this),Sn(t)}};function _n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Pn={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1;}function s(t,e,n,s,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,s||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,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},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 r=0,s=n.length,o=new Array(s);r<s;r++)o[r]=n[r].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,r,s,o){var a=i?i+t:t;if(!this._events[a])return !1;var h,l,u=this._events[a],c=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),c){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,n),!0;case 4:return u.fn.call(u.context,e,n,r),!0;case 5:return u.fn.call(u.context,e,n,r,s),!0;case 6:return u.fn.call(u.context,e,n,r,s,o),!0}for(l=1,h=new Array(c-1);l<c;l++)h[l-1]=arguments[l];u.fn.apply(u.context,h);}else {var d,f=u.length;for(l=0;l<f;l++)switch(u[l].once&&this.removeListener(t,u[l].fn,void 0,!0),c){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,e);break;case 3:u[l].fn.call(u[l].context,e,n);break;case 4:u[l].fn.call(u[l].context,e,n,r);break;default:if(!h)for(d=1,h=new Array(c-1);d<c;d++)h[d-1]=arguments[d];u[l].fn.apply(u[l].context,h);}}return !0},a.prototype.on=function(t,e,i){return s(this,t,e,i,!1)},a.prototype.once=function(t,e,i){return s(this,t,e,i,!0)},a.prototype.removeListener=function(t,e,n,r){var s=i?i+t:t;if(!this._events[s])return this;if(!e)return o(this,s),this;var a=this._events[s];if(a.fn)a.fn!==e||r&&!a.once||n&&a.context!==n||o(this,s);else {for(var h=0,l=[],u=a.length;h<u;h++)(a[h].fn!==e||r&&!a[h].once||n&&a[h].context!==n)&&l.push(a[h]);l.length?this._events[s]=1===l.length?l[0]:l:o(this,s);}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;}(Pn);var Tn=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s,[{key:"shutdown",value:function(){this.removeAllListeners();}},{key:"destroy",value:function(){this.removeAllListeners();}}]),s}(_n(Pn.exports)),En={setEventEmitter:function(t,e){return void 0===e&&(e=Tn),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):[]}},Mn=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("."),r=t,s=i,o=0;o<n.length;o++){if(!r.hasOwnProperty(n[o])){s=i;break}s=r[n[o]],r=r[n[o]];}return s}return i}return i},Rn=["next","exit","enter"],Ln=function(){function t(i){e(this,t);var n=Mn(i,"states",void 0);n&&this.addStates(n);var r=Mn(i,"extend",void 0);if(r)for(var s in r)this.hasOwnProperty(s)&&void 0!==this[s]||(this[s]=r[s]);var o=Mn(i,"eventEmitter",void 0),a=Mn(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(Mn(t,"enable",!0)),this.start(Mn(t,"start",void 0));var e=Mn(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,r=this[n];r&&r.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 Rn}},{key:"addState",value:function(t,e){"string"!=typeof t&&(t=(e=t).name);for(var i=this.stateProperties,n=0,r=i.length;n<r;n++){var s=i[n],o=e[s];o&&(this["".concat(s,"_").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,r,s){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,r);case 6:return o.call(this,e,i,n,r,s)}for(var h=new Array(a-1),l=1;l<a;l++)h[l-1]=arguments[l];return o.apply(this,h)}}}]),t}();Object.assign(Ln.prototype,En);var zn=function(t,e,i,n,r){void 0===r&&(r=!1);var s=t._events[e];if(!s)return !1;for(var o=0,a=s.length;o<a;o++){var h=s[o];if(h.fn===i&&h.context===n&&h.once===r)return !0}return !1},An=["next","exit","enter","update","preupdate","postupdate"],Dn=function(t){r(o,t);var i=l(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"shutdown",value:function(){this.stopUpdate(),this.stopPreUpdate(),this.stopPostUpdate(),this._scene=void 0,c(s(o.prototype),"shutdown",this).call(this);}},{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this._scene=Mn(t,"scene",void 0),this}},{key:"stateProperties",get:function(){return An}},{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}(Ln),Bn=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),(r=i.call(this,n)).parent=t;var o=n.initState||"IDLE";return r.start(o),r}return n(s,[{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}}]),s}(Dn),jn={delayCall:function(t,e,i){return this.delayCallTimer=function(t,e,i,n,r){var s=ii(t);return s.time.delayedCall(e,(function(){s.game.events.once("poststep",(function(){i.call(n,r);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Wn={setTransitInTime:function(t){return this.transitInTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInCallback:function(t){return t||(t=Qt),this.transitInCallback=t,this},setTransitOutCallback:function(t){return t||(t=Qt),this.transitOutCallback=t,this}},Yn={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}},Xn={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}},In={};Object.assign(In,jn,Wn,Yn,Xn);var Hn=Phaser.Utils.Objects.GetValue,Fn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).setTransitInTime(Hn(n,"duration.in",200)),r.setTransitOutTime(Hn(n,"duration.out",200)),r.setTransitInCallback(Hn(n,"transitIn")),r.setTransitOutCallback(Hn(n,"transitOut")),r.oneShotMode=Hn(n,"destroy",!1),r.delayCallTimer=void 0,r._state=new Bn(a(r),{eventEmitter:!1,initState:Hn(n,"initState","IDLE")}),r.openEventData=void 0,r.closeEventData=void 0,r}return n(o,[{key:"state",get:function(){return this._state.state}},{key:"shutdown",value:function(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),c(s(o.prototype),"shutdown",this).call(this,t));}}]),o}(ai);Object.assign(Fn.prototype,In);var Nn=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,0,0,2,2,n,1)).setAlpha(r),s.setScrollFactor(0),s.boot(),s}return n(o,[{key:"boot",value:function(){this.scene.sys.events.on("prerender",this.resize,this);}},{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.scene.sys.events.off("prerender",this.resize,this),c(s(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,r=e.height,s=1/i.zoom,o=n/2,a=r/2,h=n*s,l=r*s;this.x===o&&this.y===a||this.setPosition(o,a),this.width===h&&this.height===l||this.setSize(h,l).setOrigin(.5);}}]),o}(Phaser.GameObjects.Rectangle),Gn=Phaser.Utils.Objects.GetValue,Vn=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,{eventEmitter:!1})).resetFromJSON(n),r.boot(),r}return n(s,[{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}}]),s}(ai),Un={default:0,fullWindow:1},Jn=Phaser.Utils.Objects.GetValue,Kn=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s);var o=Jn(n,"color",0),h=Jn(n,"alpha",.8);return (r=i.call(this,t,o,h)).touchEventStop=new Vn(a(r),{hitAreaMode:1}),r}return n(s)}(Nn),qn=function(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,zi(t,e);},Zn=function(t,e){Ai(t,e,void 0,void 0,!1);},$n=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e);},Qn=function(t,e){Ui(t,e,!1);},tr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e,t.alpha);},er=function(t,e){Ui(t,e,!1);},ir=function(t,e,i,n,r){return !!t&&(!(n&&!n(t,e,i))&&(!!bt(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))},nr=Phaser.Utils.Objects.GetValue,rr=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={}),null==n.transitIn&&(n.transitIn=sr.popUp),null==n.transitOut&&(n.transitOut=sr.scaleDown),n.destroy=nr(n,"destroy",!0),r=i.call(this,t,n);var s=nr(n,"cover");r.cover=!1!==s?function(t,e){var i=t.scene,n=new Kn(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,s):void 0,r.cover&&(r.setCoverTransitInCallback(nr(s,"transitIn",tr)),r.setCoverTransitOutCallback(nr(s,"transitOut",er)));var h=nr(n,"touchOutsideClose",!1),l=nr(n,"duration.hold",-1),u=nr(n,"timeOutClose",l>=0),c=nr(n,"anyTouchClose",!1);return nr(n,"manualClose",!1)&&(h=!1,c=!1,u=!1),c&&(h=!1),u?r.setDisplayTime(l):r.setDisplayTime(-1),c?r.once("open",r.anyTouchClose,a(r)):h&&r.once("open",r.touchOutsideClose,a(r)),nr(n,"openOnStart",!0)&&r.delayCall(0,r.requestOpen,a(r)),r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),c(s(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&&ir(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"runTransitionInCallback",value:function(){var t=c(s(o.prototype),"runTransitionInCallback",this).call(this),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}},{key:"runTransitionOutCallback",value:function(){var t=c(s(o.prototype),"runTransitionOutCallback",this).call(this),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}},{key:"onOpen",value:function(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),c(s(o.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.closeEventData),c(s(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=sr[t]),t){case sr.popUp:t=qn;break;case sr.fadeIn:t=$n;}return c(s(o.prototype),"setTransitInCallback",this).call(this,t),this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=sr[t]),t){case sr.scaleDown:t=Zn;break;case sr.fadeOut:t=Qn;}return c(s(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}(Fn),sr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},or=function(t){return t&&"function"==typeof t},ar={modal:function(t,e){return or(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new rr(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}},hr=function(t,e,i,n){if(e)return ir(t,e.worldX,e.worldY,i,n);for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a<s;a++)if(e=o[a],ir(t,e.worldX,e.worldY,i,n))return !0;return !1},lr=function(t){return "[object Array]"===Object.prototype.toString.call(t)},ur=function(t,e,i,n,r){return ir(t,e,i,dr(n),fr(r))},cr=function(t){return !(t.rexSizer&&t.rexSizer.hidden)},dr=function(t){return t?function(e,i,n){return !!cr(e)&&(t(e,i,n),!0)}:cr},fr=function(t){return t},pr=function(t,e,i){!t||void 0===e&&void 0===i||(gr(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)));},vr=[Phaser.GameObjects.Image,Phaser.GameObjects.Sprite,Phaser.GameObjects.Mesh,Phaser.GameObjects.Shader,Phaser.GameObjects.Video],gr=function(t){if(t.resize)return !0;if(!t.setSize)return !1;for(var e=0,i=vr.length;e<i;e++){var n=vr[e];if(n&&t instanceof n)return !1}return !0},yr={},mr=function(t){var e,i;this.sizerEventsEnable&&(e=t,void 0===(i=this.getChildPrevState(t))?i={}:!0===i&&(i=yr),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));},kr=function(t,e,i,n,r,s,o,a){Se(t,e,i,n,r,s),void 0!==o&&(t.x+=o),void 0!==a&&(t.y+=a),this.resetChildPositionState(t),this.sizerEventsEnable&&t.emit("sizer.postlayout",t,this);},br=Phaser.Display.Align.CENTER,xr=Phaser.Utils.Objects.IsPlainObject,wr=Phaser.Utils.Objects.GetValue,Sr=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,t.setInteractive(wr(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(wr(t,"enable",!0)),this.setMode(wr(t,"mode",1)),this.setClickInterval(wr(t,"clickInterval",100)),this.setDragThreshold(wr(t,"threshold",void 0)),this}},{key:"boot",value:function(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this);}},{key:"shutdown",value:function(t){this.isShutdown||(this.pointer=null,c(s(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=Cr[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}(ai),Cr={press:0,pointerdown:0,release:1,pointerup:1},Or={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 Sr(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}},_r=function(t,e,i,n){if(e)return !(i&&!i(t,e))&&(!!Pr(t,e)&&!(n&&!n(t,e)));for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a<s;a++)if(e=o[a],(!i||i(t,e))&&Pr(t,e)&&(!n||n(t,e)))return !0;return !1},Pr=function(t,e){for(var i=t.scene,n=i.input.cameras.getCamerasBelowPointer(e),r=i.input.manager,s=[t],o=0,a=n.length;o<a;o++)if(r.hitTest(e,s,n[o],Tr),Tr.length>0)return Tr.length=0,!0;return Tr.length=0,!1},Tr=[],Er=Phaser.Utils.Objects.GetValue,Mr=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),(r=i.call(this,t,n))._enable=void 0;var s=Er(n,"inputConfig",void 0);return s&&t.setInteractive(s),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Er(t,"enable",!0)),this.setMode(Er(t,"mode",1)),this.setClickInterval(Er(t,"clickInterval",100)),this.setDragThreshold(Er(t,"threshold",void 0)),this}},{key:"boot",value:function(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this);}},{key:"shutdown",value:function(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,c(s(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=Rr[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?_r:hr)(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}(ai),Rr={press:0,pointerdown:0,release:1,pointerup:1},Lr={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 Mr(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}},zr=function(t){r(s,t);var i=l(s);function s(){var t;return e(this,s),(t=i.call(this,{eventEmitter:!1})).goto("IDLE"),t}return n(s,[{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}}]),s}(Dn),Ar=Phaser.Utils.Objects.GetValue,Dr=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,r.cooldown=new zr,r.parent.setInteractive(Ar(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Ar(t,"enable",!0)),this.setCooldown(Ar(t,"cooldown",void 0)),this}},{key:"boot",value:function(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(s(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}(ai),Br={isPointerInBounds:function(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&hr(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 Dr(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 Dr(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}},jr=function(t,e,i){for(var n,r=0,s=t.length;r<s;r++)if(n=t[r],ur(n,e,i))return n.pointToChild(e,i);return null},Wr=function(t,e,i,n,r,s,o){var a;(a=void 0===r?n:jr(i,n,r))&&t.emit(e,a,s,o);},Yr=Phaser.Utils.Objects.GetValue,Xr=function(t){var e=Yr(t,"down",void 0);!1!==e&&(!0===e&&(e=void 0),this.on("pointerdown",Ir,this));},Ir=function(t,e,i,n){var r=this._childrenInteractive;Wr(r.eventEmitter,"".concat(r.eventNamePrefix,"down"),r.targetSizers,t.worldX,t.worldY,t,n);},Hr=Phaser.Utils.Objects.GetValue,Fr=function(t){var e=Hr(t,"up",void 0);!1!==e&&(!0===e&&(e=void 0),this.on("pointerup",Nr,this));},Nr=function(t,e,i,n){var r=this._childrenInteractive;Wr(r.eventEmitter,"".concat(r.eventNamePrefix,"up"),r.targetSizers,t.worldX,t.worldY,t,n);},Gr=Phaser.Utils.Objects.GetValue,Vr=function(t){var e=Gr(t,"over",void 0);!1!==e&&(!0===e&&(e=void 0),this.on("pointermove",Ur,this).on("pointerover",Ur,this).on("pointerout",Jr,this));},Ur=function(t,e,i,n){var r=this._childrenInteractive,s=jr(r.targetSizers,t.worldX,t.worldY),o=r.lastOverChild;s&&o&&s===o||(r.lastOverChild=s,Wr(r.eventEmitter,"".concat(r.eventNamePrefix,"out"),r.targetSizers,o,void 0,t,n),Wr(r.eventEmitter,"".concat(r.eventNamePrefix,"over"),r.targetSizers,s,void 0,t,n));},Jr=function(t,e){var i=this._childrenInteractive,n=i.lastOverChild;i.lastOverChild=null,Wr(i.eventEmitter,"".concat(i.eventNamePrefix,"out"),i.targetSizers,n,void 0,t,e);},Kr=Phaser.Utils.Objects.GetValue,qr=function(t){var e=Kr(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 Sr(this,e),this._click.on("click",(function(t,e,n,r){Wr(i.eventEmitter,"".concat(i.eventNamePrefix,"click"),i.targetSizers,n.worldX,n.worldY,n,r);}),this);}},Zr=Phaser.Utils.Objects.GetValue,$r=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=ii(t);return s===t&&(t=void 0),(r=i.call(this,s,n)).gameObject=t,t&&t.setInteractive(Zr(n,"inputConfig",void 0)),r._enable=void 0,r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.setEnable(Zr(t,"enable",!0)),this.setDetectBounds(),void 0===this.gameObject?this.setDetectBounds(Zr(t,"bounds",void 0)):this.setDetectBounds(),this.tracerState=Qr,this.pointer=void 0,this.lastPointer=void 0,this.movedState=!1,this.isTouchingAnyObject=!1,this}},{key:"boot",value:function(){c(s(o.prototype),"boot",this).call(this),this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this);}},{key:"shutdown",value:function(t){this.scene&&(this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.gameObject=void 0,this.bounds=void 0,this.pointer=void 0,this.lastPointer=void 0,this.movedState=!1,c(s(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=ts,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=Qr,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===ts&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Qr,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this);}},{key:"onDragEnd",value:function(){this.emit("dragend",this);}},{key:"onDrag",value:function(){this.emit("drag",this);}},{key:"preUpdate",value:function(t,e){}},{key:"postUpdate",value:function(t,e){}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this);}},{key:"stopTicking",value:function(){c(s(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=es,this}}]),o}(ui),Qr=0,ts=1,es="IDLE",is=Phaser.Utils.Objects.GetValue,ns=Phaser.Math.Distance.Between,rs=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.stop(),s.tapsCount=0,s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start(),s.tapsCount=0,s.emit("tappingstart",s,s.gameObject,s.lastPointer);}},RECOGNIZED:{enter:function(){s.start(),s.emit("tap",s,s.gameObject,s.lastPointer),s.emit("".concat(s.tapsCount,"tap"),s,s.gameObject,s.lastPointer);}}},init:function(){this.state=ss;},eventEmitter:!1};return r.setRecongizedStateObject(new Dn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setHoldTime(is(t,"time",250)),this.setTapInterval(is(t,"tapInterval",200)),this.setDragThreshold(is(t,"threshold",9)),this.setTapOffset(is(t,"tapOffset",10));var e=is(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(is(t,"maxTaps",void 0)),this.setMinTaps(is(t,"minTaps",void 0))),this}},{key:"onDragStart",value:function(){switch(this.state){case ss:this.state=os;break;case os:var t=this.lastPointer;ns(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=as,this.state=os);break;case as:this.state=os;}}},{key:"onDragEnd",value:function(){this.state===os&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=as));}},{key:"onDrag",value:function(){this.state!==ss&&this.pointer.getDistance()>this.dragThreshold&&(this.state=ss);}},{key:"preUpdate",value:function(t,e){if(this.isRunning&&this.enable&&this.state===os){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=ss);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=as:this.state=ss);}}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===as&&(this.state=ss);}},{key:"isTapped",get:function(){return this.state===as}},{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}($r),ss="IDLE",os="BEGIN",as="RECOGNIZED",hs=Phaser.Utils.Objects.GetValue,ls=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start();},exit:function(){s.stop();}},RECOGNIZED:{enter:function(){s.emit("pressstart",s,s.gameObject,s.lastPointer);},exit:function(){s.emit("pressend",s,s.gameObject,s.lastPointer);}}},init:function(){this.state=us;},eventEmitter:!1};return r.setRecongizedStateObject(new Dn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(hs(t,"threshold",9)),this.setHoldTime(hs(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=cs,0===this.holdTime&&(this.state=ds);}},{key:"onDragEnd",value:function(){this.state=us;}},{key:"onDrag",value:function(){this.state!==us&&this.pointer.getDistance()>this.dragThreshold&&(this.state=us);}},{key:"preUpdate",value:function(t,e){this.isRunning&&this.enable&&(this.state===cs&&t-this.pointer.downTime>=this.holdTime&&(this.state=ds));}},{key:"isPressed",get:function(){return this.state===ds}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}($r),us="IDLE",cs="BEGIN",ds="RECOGNIZED";Phaser.Utils.Objects.GetValue;var fs=function(t){return si(t).loop.delta},ps=Phaser.Math.Distance.Between,vs=Phaser.Math.Angle.Between,gs={getDt:function(){return fs(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ps(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 vs(e.x,e.y,t.x,t.y)}},ys={"up&down":0,"left&right":1,"4dir":2,"8dir":3},ms={},ks=Phaser.Utils.Objects.GetValue,bs=Phaser.Math.RadToDeg,xs=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.validDrag=!1;}},RECOGNIZED:{enter:function(){s.start(),s.updateDirectionStates(),s.emit("swipe",s,s.gameObject,s.lastPointer);},exit:function(){s.stop(),s.clearDirectionStates();}}},init:function(){this.state=ws;},eventEmitter:!1};return r.setRecongizedStateObject(new Dn(h)),r.clearDirectionStates(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(ks(t,"threshold",10)),this.setVelocityThreshold(ks(t,"velocityThreshold",1e3)),this.setDirectionMode(ks(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=Ss;}},{key:"onDragEnd",value:function(){this.state=ws;}},{key:"onDrag",value:function(){this.state===Ss&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Cs));}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===Cs&&(this.state=ws);}},{key:"isSwiped",get:function(){return this.state===Cs}},{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=ys[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=ms),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;}}(bs(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}($r);Object.assign(xs.prototype,gs);var ws="IDLE",Ss="BEGIN",Cs="RECOGNIZED",Os=Phaser.Utils.Objects.GetValue,_s=Phaser.Utils.Array.SpliceOne,Ps=Phaser.Math.Distance.Between,Ts=Phaser.Math.Angle.Between,Es=function(){function t(i,n){e(this,t);var r=i.input.manager.pointersTotal-1;r<2&&i.input.addPointer(2-r),this.scene=i,this.setEventEmitter(Os(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(Os(t,"enable",!0)),this.bounds=Os(t,"bounds",void 0),this.tracerState=Rs,this.pointers.length=0,Mt(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,Mt(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 Rs:this.tracerState=Ls,this.onDrag1Start();break;case Ls:this.tracerState=zs,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],_s(this.pointers,e),this.tracerState){case Ls:this.tracerState=Rs,this.onDrag1End();break;case zs:this.tracerState=Ls,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 Ls:this.onDrag1();break;case zs:this.onDrag2();}}}},{key:"dragCancel",value:function(){return this.tracerState===zs&&this.onDrag2End(),this.pointers.length=0,Mt(this.movedState),this.tracerState=Rs,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!==zs)return 0;var t=this.pointers[0],e=this.pointers[1];return Ps(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==zs)return 0;var t=this.pointers[0],e=this.pointers[1];return Ts(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;Ms.x=e.x-i.x,Ms.y=e.y-i.y;}else Ms.x=0,Ms.y=0;return Ms}},{key:"centerX",get:function(){if(this.tracerState!==zs)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!==zs)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!==zs)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!==zs)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=As,this}}]),t}();Object.assign(Es.prototype,Qe);var Ms={},Rs=0,Ls=1,zs=2,As="IDLE";Phaser.Utils.Objects.GetValue;var Ds=Phaser.Math.RotateAround,Bs=function(t,e,i,n){return Ds(t,e,i,n),t.rotation+=n,t},js={},Ws=Phaser.Utils.Objects.GetValue,Ys=Phaser.Math.Angle.WrapDegrees,Xs=Phaser.Math.Angle.ShortestBetween,Is=Phaser.Math.RadToDeg,Hs=Phaser.Math.DegToRad,Fs=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.prevAngle=void 0,s.angle=0;}},BEGIN:{},RECOGNIZED:{enter:function(){s.emit("rotatestart",s);},exit:function(){s.emit("rotateend",s);}}},init:function(){this.state=Gs;},eventEmitter:!1};return r.setRecongizedStateObject(new Dn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Ws(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=Ys(Is(this.angleBetween)),this.state=Vs,0===this.dragThreshold&&(this.state=Us);}},{key:"onDrag2End",value:function(){this.state=Gs;}},{key:"onDrag2",value:function(){switch(this.state){case Vs:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Ys(Is(this.angleBetween));this.angle=Xs(this.prevAngle,t),this.prevAngle=t,this.state=Us;}break;case Us:t=Ys(Is(this.angleBetween));this.angle=Xs(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this);}}},{key:"isRotated",get:function(){return this.state===Us}},{key:"rotation",get:function(){return Hs(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(Es),Ns={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,n=this.movementCenterY,r=function(t,e,i,n){return void 0===n?n={}:!0===n&&(n=js),i.getWorldPoint(t,e,n),n}(this.centerX,this.centerY,e,!0),s=r.x,o=r.y,a=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l<u;l++)(t=h[l]).x+=i,t.y+=n,Bs(t,s,o,a);else t.x+=i,t.y+=n,Bs(t,s,o,a);return this}};Object.assign(Fs.prototype,Ns);var Gs="IDLE",Vs="BEGIN",Us="RECOGNIZED",Js=Phaser.Utils.Objects.GetValue,Ks=function(t){var e=Js(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new rs(this,e),this._tap.on("tap",(function(t,e,n){Wr(i.eventEmitter,"".concat(i.eventNamePrefix).concat(t.tapsCount,"tap"),i.targetSizers,t.worldX,t.worldY,n);}),this);}},qs=Phaser.Utils.Objects.GetValue,Zs=function(t){var e=qs(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new ls(this,e),this._press.on("pressstart",(function(t,e,n){Wr(i.eventEmitter,"".concat(i.eventNamePrefix,"pressstart"),i.targetSizers,t.worldX,t.worldY,n);}),this).on("pressend",(function(t,e,n){Wr(i.eventEmitter,"".concat(i.eventNamePrefix,"pressend"),i.targetSizers,t.worldX,t.worldY,n);}),this);}},$s=Phaser.Utils.Objects.GetValue,Qs=function(t){var e=$s(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 xs(this,e),this._swipe.on("swipe",(function(t,e,n){var r=t.left?"left":t.right?"right":t.up?"up":"down";Wr(i.eventEmitter,"".concat(i.eventNamePrefix,"swipe").concat(r),i.targetSizers,t.worldX,t.worldY,n);}),this);}},to=Phaser.Utils.Objects.GetValue,eo=function(t,e){return t.setInteractive(),to(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:to(e,"targets",[t]),eventEmitter:to(e,"eventEmitter",t),eventNamePrefix:to(e,"inputEventPrefix","child.")},Xr.call(t,e),Fr.call(t,e),Vr.call(t,e),qr.call(t,e),Ks.call(t,e),Zs.call(t,e),Qs.call(t,e),t},io={getSizerConfig:function(t){return void 0===t&&(t=this),Vt(t)},getChildPrevState:function(t){var e=Vt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Kt(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,r,s,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&&(r=Ce(h,"createTextCallback",_e),s=Ce(h,"createTextCallbackScope",void 0),"string"==typeof(o=Ce(h,"align","left-top"))&&(o=$t[o]));}if(void 0===i&&(i=16777215),void 0===n&&(n=1),r&&!t.children){t.children=new Oe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0;}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0);};}for(var u,c,d=this.getAllShownChildren([this]),f=0,p=d.length;f<p;f++)((u=d[f]).getBounds||void 0!==u.width&&void 0!==u.height)&&(Pe=bt(u,Pe),null!=i&&t.lineStyle(n,i).strokeRectShape(Pe),u.name&&r&&(c=s?r.call(s,a):r(a))&&(c.setText(u.name),t.children.add(c),Se(c,Pe.x,Pe.y,Pe.width,Pe.height,o)));return this},resolveWidth:Je,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:Ke,postResolveSize:function(t,e){},getChildWidth:function(t){return t.isRexSizer?Math.max(t.minWidth,t.childrenWidth):void 0!==t.minWidth?t.minWidth:vt(t)},getChildHeight:function(t){return t.isRexSizer?Math.max(t.minHeight,t.childrenHeight):void 0!==t.minHeight?t.minHeight:gt(t)},getExpandedChildWidth:function(t,e){return e},getExpandedChildHeight:function(t,e){return e},getChildrenWidth:function(){return 0},getChildrenHeight:function(){return 0},addChildrenMap:He,addElement:He,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 r=i.match(Fe);if(null!=r&&this.childrenMap){var s=this.childrenMap[r[1]];s&&(n=s[r[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,r=e;r<n;r++)i[r].getAllChildrenSizers(t);return t},getChildrenSizers:function(t){return void 0===t&&(t=[]),t},preLayout:Ze,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:$e,layoutBackgrounds:function(){if(void 0!==this.backgroundChildren)for(var t,e,i,n,r,s,o,a=this.backgroundChildren,h=this.left,l=this.top,u=this.width,c=this.height,d=0,f=a.length;d<f;d++)(e=(t=a[d]).rexSizer).hidden||(i=e.padding,mr.call(this,t),n=h+i.left,r=l+i.top,s=u-i.left-i.right,o=c-i.top-i.bottom,pr(t,s,o),kr.call(this,t,n,r,s,o,br));},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,r){e&&r.setMinWidth(t),i&&r.setMinHeight(n),r.layout();}),void 0===this._anchor?this._anchor=new hi(this,t):this._anchor.resetFromJSON(t),this},isInTouching:function(t,e){return (zt(t)||"string"==typeof t)&&(e=t,t=void 0),void 0===e?e=this:"string"==typeof e&&(e=this.getElement(e)),hr(e,t)},pointToChild:function(t,e,i,n,r){if(or(i)||(r=i,i=void 0,n=void 0),void 0===r&&(r=this.sizerChildren?this.sizerChildren:this.children),lr(r)){for(var s,o=0,a=r.length;o<a;o++)if(s=r[o],ur(s,t,e,i,n))return s}else for(var h in r)if(s=r[h],ur(s,t,e,i,n))return s;return null},setDraggable:function(e,i,n){if(xr(e)){var r=e;e=r.sensor,n=r.target,i=r.draggable;}else "boolean"!=typeof i&&(n=i,i=void 0);var s=t(e);if("string"===s){var o=e;if(!(e=this.getElement(o)))return console.error("Can get element '".concat(o,"'")),this}else void 0!==e&&"object"==s||(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,r){var s=void 0===n?this.getTopmostSizer():n;s.x+=i-e.x,s.y+=r-e.y,s.emit("sizer.drag",t,i,r);}),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,r){(void 0===n?this.getTopmostSizer():n).emit("sizer.dragend",t,e,i,r);}),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 eo(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(io,Ue,Le,Ie,Ae,Yi,qi,an,pn,bn,Or,Lr,Br,On,ar,qe);var no=Phaser.Utils.Objects.GetValue,ro=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a,h){var l;e(this,o),(l=i.call(this,t,n,r,1,1)).isRexSizer=!0,l.setMinSize(s,a),l.setName(no(h,"name","")),l.rexSizer={},l.space={},l.backgroundChildren=void 0,l.sizerChildren=void 0,l.childrenMap={},l.layoutedChildren=void 0,l.enableLayoutWarn();var u=no(h,"anchor",void 0);u&&l.setAnchor(u),l.setInnerPadding(no(h,"space",0));var c=no(h,"draggable",!1);return c&&l.setDraggable(c),l.setSizerEventsEnable(no(h,"sizerEvents",!1)),l.setDirty(!0),no(h,"enableLayer",!1)&&l.enableLayer(),l}return n(o,[{key:"destroy",value:function(t){if(this.scene&&!this.ignoreDestroy){if(t)for(var e=this.getAllChildrenSizers([this]),i=0,n=e.length;i<n;i++)e[i].sizerEventsEnable=!1;c(s(o.prototype),"destroy",this).call(this,t),Mt(this.backgroundChildren),Mt(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-vt(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+vt(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+vt(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-gt(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+gt(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+gt(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}(Gt);Object.assign(ro.prototype,io);var so=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));},oo=Phaser.Math.Wrap,ao=function(t){r(s,t);var i=l(s);function s(t){var n;return e(this,s),(n=i.call(this,t,0,0,1,1)).isRexSpace=!0,n}return n(s)}(Phaser.GameObjects.Zone),ho=function(t,e){var i=this.sizerChildren;if(0===i.length)return -1;for(var n=-1,r=1/0,s=0,o=i.length;s<o;s++){var a=i[s];r>(h=0===this.orientation?Math.abs(a.left-t):Math.abs(a.top-e))&&(r=h,n=s);}var h;a=i[i.length-1];return r>(h=0===this.orientation?Math.abs(a.right-t):Math.abs(a.bottom-e))&&(r=h,n=s+1),n},lo=Phaser.Utils.Objects.IsPlainObject,uo=Phaser.Utils.Objects.GetValue,co=Phaser.Display.Align.CENTER,fo={min:0,full:-1},po=function(e,i,n,r,s,o,a,h,l,u){Re.call(this,e);var c=e.isRexSpace,d=t(i);if(null===i)return this;if("number"===d);else if("string"===d)i=fo[i];else if(lo(i)){var f;i=uo(f=i,"proportion",void 0),n=uo(f,"align",co),r=uo(f,"padding",0),s=uo(f,"expand",!1),o=uo(f,"key",void 0),a=uo(f,"index",void 0),e.isRexSizer||(h=uo(f,"minWidth",void 0),l=uo(f,"minHeight",void 0)),u=uo(f,"fitRatio",0);}return "string"==typeof n&&(n=$t[n]),void 0===i&&(i=c?1:0),void 0===n&&(n=co),void 0===r&&(r=0),void 0===s&&(s=!1),void 0===h&&(c?h=0:e.isRexSizer||(h=e._minWidth)),void 0===l&&(c?l=0:e.isRexSizer||(l=e._minHeight)),void 0===u&&(u=0),(f=this.getSizerConfig(e)).proportion=i,f.align=n,f.padding=Ee(r),f.expand=s,f.fitRatio=0===i?u: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?vt(e):h:e.minHeight=void 0===l?gt(e):l),s&&(0===this.orientation?e.minHeight=l:e.minWidth=h)),void 0!==o&&this.addChildrenMap(o,e),this},vo={add:po,addSpace:function(t){return this.insertSpace(void 0,t),this},insertSpace:function(t,e){return void 0===e&&(e=1),po.call(this,new ao(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert:function(t,e,i,n,r,s,o,a){return lo(i)&&(i.index=t),po.call(this,e,i,n,r,s,o,t,a),this},insertAtPosition:function(t,e,i,n,r,s,o,a,h){var l=ho.call(this,t,e);return -1===l&&(l=void 0),this.insert(l,i,n,r,s,o,a,h),this}},go=Gt.prototype.clear,yo=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),go.call(this,t),i)for(var n,r=0,s=e.length;r<s;r++)(n=e[r]).emit("sizer.remove",n,this),this.emit("remove",n,this);return this},mo=Phaser.Utils.Array.Remove,ko={remove:function(t,e){return this.getParentSizer(t)!==this||(mo(this.sizerChildren,t),We.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,yo.call(this,t),this}},bo={getChildAlign:function(t){return this.getSizerConfig(t).align},setChildAlign:function(t,e){return "string"==typeof e&&(e=$t[e]),this.getSizerConfig(t).align=e,this}},xo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,r=0,s=this.sizerChildren;if(0===this.orientation)for(var o=this.space.item,a=!0,h=0,l=s.length;h<l;h++)(e=s[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,r+=n);else for(h=0,l=s.length;h<l;h++)(e=s[h]).hasOwnProperty("rexSizer")&&(e.rexSizer.hidden||(i=e.rexSizer.padding,n=this.getChildWidth(e)+i.left+i.right,r=Math.max(n,r)));return r+this.space.left+this.space.right},getChildrenHeight:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,r=0,s=this.sizerChildren;if(0===this.orientation)for(var o=0,a=s.length;o<a;o++)(e=s[o]).rexSizer.hidden||(i=e.rexSizer.padding,n=this.getChildHeight(e)+i.top+i.bottom,r=Math.max(n,r));else {var h=this.space.item,l=!0;for(o=0,a=s.length;o<a;o++)(e=s[o]).hasOwnProperty("rexSizer")&&(e.rexSizer.hidden||(n=0===e.rexSizer.proportion||t?this.getChildHeight(e):0,n+=(i=e.rexSizer.padding).top+i.bottom,l?l=!1:n+=h,r+=n));}return r+this.space.top+this.space.bottom},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width);var n=t.rexSizer,r=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-r.left-r.right);return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer,r=n.padding;0===this.orientation?n.expand&&(i=e-this.space.top-this.space.bottom-r.top-r.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,r=i.length;n<r;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&&(pr(n,1,1),this.hasRatioFitChild=!0);}return this._childrenProportion=void 0,this.proportionLength=void 0,Ze.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,r,s=this.sizerChildren,o=0,a=s.length;o<a;o++){var h=s[o];if(!h.rexSizer.hidden){var l=h.rexSizer.fitRatio;l&&(0===this.orientation?n=(r=i-this.getChildOuterPadding(h,"top")-this.getChildOuterPadding(h,"bottom"))*l:r=(n=i-this.getChildOuterPadding(h,"top")-this.getChildOuterPadding(h,"bottom"))/l,pr(h,n,r),h.isRexSizer&&h.setMinSize(n,r));}}this.proportionLength=void 0,this._childrenWidth=void 0,this.resolveWidth(t,!0);}},layoutChildren:function(){for(var t,e,i,n,r,s,o,a,h,l,u=this.sizerChildren,c=this.innerLeft,d=this.innerTop,f=this.innerWidth,p=this.innerHeight,v=c,g=d,y=this.startChildIndex,m=0,k=u.length;m<k;m++)l=0===y?m:oo(m+y,0,k),this.rtl&&(l=k-l-1),(t=u[l]).rexSizer.hidden||(i=(e=t.rexSizer).padding,mr.call(this,t),t.isRexSpace?(a=0,h=0):(a=this.getExpandedChildWidth(t),h=this.getExpandedChildHeight(t)),t.isRexSizer?(t.runLayout(this,a,h),so(t,this)):pr(t,a,h),void 0===a&&(a=vt(t)),void 0===h&&(h=gt(t)),0===this.orientation?(n=v+i.left,s=0===e.proportion||0===this.proportionLength?a:e.proportion*this.proportionLength,r=g+i.top,o=p-i.top-i.bottom):(n=v+i.left,s=f-i.left-i.right,r=g+i.top,o=0===e.proportion||0===this.proportionLength?h:e.proportion*this.proportionLength),kr.call(this,t,n,r,s,o,e.align),0===this.orientation?v+=s+i.left+i.right+this.space.item:g+=o+i.top+i.bottom+this.space.item);},resolveWidth:function(t){t=Je.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=Ke.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(xo,vo,ko,bo,{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 wo=function(){for(var t,e,i=0,n=this.sizerChildren,r=0,s=n.length;r<s;r++)(t=n[r]).rexSizer.hidden||(e=t.rexSizer.proportion)>0&&(i+=e);return i},So={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Co=function(t){return "string"==typeof t&&(t=So[t]),t},Oo=Phaser.Utils.Objects.IsPlainObject,_o=Phaser.Utils.Objects.GetValue,Po=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l){var u;return e(this,s),Oo(n)?(n=_o(l=n,"x",0),r=_o(l,"y",0),o=_o(l,"width",void 0),a=_o(l,"height",void 0),h=_o(l,"orientation",0)):Oo(o)?(o=_o(l=o,"width",void 0),a=_o(l,"height",void 0),h=_o(l,"orientation",0)):Oo(h)&&(h=_o(l=h,"orientation",0)),void 0===h&&(h=0),(u=i.call(this,t,n,r,o,a,l)).type="rexSizer",u.sizerChildren=[],u.setOrientation(h),u.setItemSpacing(_o(l,"space.item",0)),u.setStartChildIndex(_o(l,"startChildIndex",0)),u.setRTL(_o(l,"rtl",!1)),u.addChildrenMap("items",u.sizerChildren),u}return n(s,[{key:"setOrientation",value:function(t){return this.orientation=Co(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=wo.call(this)),this._childrenProportion}}]),s}(ro);Object.assign(Po.prototype,xo);var To=Phaser.Utils.Objects.IsPlainObject,Eo=Phaser.Utils.Objects.GetValue,Mo=Phaser.Display.Align.CENTER,Ro=Phaser.Utils.String.UUID,Lo={add:function(t,e,i,n,r,s,o,a,h){(Re.call(this,t),To(e))&&(e=Eo(l=e,"key",void 0),i=Eo(l,"align",Mo),a=Eo(l,"offsetX",0),h=Eo(l,"offsetY",0),n=Eo(l,"padding",0),r=Eo(l,"expand",!0),t.isRexSizer||(s=Eo(l,"minWidth",t._minWidth),o=Eo(l,"minHeight",t._minHeighted)));var l,u=void 0!==e;return u||(e=Ro()),"string"==typeof i&&(i=$t[i]),void 0===i&&(i=Mo),void 0===a&&(a=0),void 0===h&&(h=0),void 0===n&&(n=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===s&&(s=t._minWidth),void 0===o&&(o=t._minHeight)),(l=this.getSizerConfig(t)).align=i,l.alignOffsetX=a,l.alignOffsetY=h,l.padding=Ee(n),To(r)?(l.expandWidth=Eo(r,"width",!1),l.expandHeight=Eo(r,"height",!1)):(l.expandWidth=r,l.expandHeight=r),t.isRexSizer||(l.expandWidth&&(t.minWidth=void 0===s?vt(t):s),l.expandHeight&&(t.minHeight=void 0===o?gt(t):o)),this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,u&&this.addChildrenMap(e,t),this}},zo={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]),We.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 yo.call(this,t),this}},Ao={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,r=this.sizerChildren;for(var s in r)e=(t=r[s]).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,r=this.sizerChildren;for(var s in r)i=(t=r[s]).isRexSizer?Math.max(t.minHeight,t.childrenHeight):void 0!==t.minHeight?t.minHeight:gt(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 r=e-this.space.left-this.space.right,s=n.padding;i=r-s.left-s.right;}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer;if(n.expandHeight){var r=e-this.space.top-this.space.bottom,s=n.padding;i=r-s.top-s.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,r,s,o,a,h,l=this.innerLeft,u=this.innerTop,c=this.innerWidth,d=this.innerHeight,f=this.sizerChildren;for(var p in f)(t=f[p]).rexSizer.hidden||(i=(e=t.rexSizer).padding,mr.call(this,t),t.isRexSizer?(t.runLayout(this,this.getExpandedChildWidth(t),this.getExpandedChildHeight(t)),so(t,this)):(a=void 0,h=void 0,e.expandWidth&&(a=c-i.left-i.right),e.expandHeight&&(h=d-i.top-i.bottom),pr(t,a,h)),n=l+i.left,s=c-i.left-i.right,r=u+i.top,o=d-i.top-i.bottom,kr.call(this,t,n,r,s,o,e.align,e.alignOffsetX,e.alignOffsetY));}};Object.assign(Ao,Lo,zo);var Do=Phaser.Utils.Objects.IsPlainObject,Bo=Phaser.Utils.Objects.GetValue,jo=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h){var l;return e(this,s),Do(n)?(n=Bo(h=n,"x",0),r=Bo(h,"y",0),o=Bo(h,"width",void 0),a=Bo(h,"height",void 0)):Do(o)&&(o=Bo(h=o,"width",void 0),a=Bo(h,"height",void 0)),(l=i.call(this,t,n,r,o,a,h)).type="rexOverlapSizer",l.sizerChildren={},l.addChildrenMap("items",l.sizerChildren),l}return n(s,[{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}}]),s}(ro);Object.assign(jo.prototype,Ao);var Wo=Po.prototype.add,Yo=Po.prototype.addSpace,Xo=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)&&Yo.call(this),Wo.call(this,t,{proportion:i,expand:!0});var n=!this.buttonsExpand&&"center"===this.buttonsAlign;n&&Yo.call(this),this.hasTailSpace=n;}else Wo.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Wo.call(this,t,{index:r,proportion:i,expand:!0});}else Wo.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Io={addButton:function(t){if(lr(t))for(var e=t,i=0,n=e.length;i<n;i++)Xo.call(this,e[i]);else Xo.call(this,t);return this},addButtons:function(t){for(var e=0,i=t.length;e<i;e++)Xo.call(this,t[e]);return this}},Ho=Po.prototype.remove,Fo=Po.prototype.clear,No=function(t,e){return this.getParentSizer(t)!==this||(this.buttonGroup.remove(t),Ho.call(this,t,e)),this},Go={remove:function(t,e){if(lr(t))for(var i=t,n=0,r=i.length;n<r;n++)No.call(this,i[n],e);else No.call(this,t,e);return this},clear:function(t){return this.buttonGroup.buttons.length=0,Fo.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--)No.call(this,e[i],t);return this}},Vo=function(t,e,i){if(t){var n=this.setValueCallback,r=this.setValueCallbackScope;n&&(r?n.call(r,t,e,i):n(t,e,i)),this.fireEvent("button.statechange",t,e,i);}},Uo=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,Vo.call(e,t,i,n);}},enumerable:!0,configurable:!0}),t.selected=!1;},Jo={add:function(t){return this.buttons.push(t),t._click||(t._click=new Sr(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,r){this.fireEvent("button.over",t,e,r);}),this).on("pointerout",(function(e,i){this.fireEvent("button.out",t,e,i);}),this).on("pointerdown",(function(e,i,n,r){this.fireEvent("button.down",t,e,r);}),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")),Uo.call(this,t)),this},addMultiple:function(t){for(var e=0,i=t.length;e<i;e++)this.add(t[e]);return this}},Ko=Phaser.Utils.Array.Remove,qo={remove:function(t){return this.buttonsType&&delete t.selected,Ko(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}},Zo=Phaser.Utils.Objects.GetValue,$o={setButtonsType:function(t){void 0===t&&(t={});var e,i,n=Zo(t,"buttonsType",t.type);if(this.buttonsType=n,!this.buttonsType)return this;switch(e=Zo(t,"setValueCallback",void 0),i=Zo(t,"setValueCallbackScope",void 0),void 0===e&&(e=Zo(t,"setButtonStateCallback",void 0),i=Zo(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 r=0,s=e.length;r<s;r++){var o=e[r];o.rexSizer.hidden||(void 0===i?o.name===n?o.selected=!0:o.selected=!1:o.selected=i===r);}}},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 r=e[i];r.rexSizer.hidden||(t[r.name]=r.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,r=i.length;n<r;n++){var s=i[n];if(!s.rexSizer.hidden&&s.name===t){s.selected=e;break}}return this},getButtonState:function(t){for(var e=this.buttons,i=0,n=e.length;i<n;i++){var r=e[i];if(!r.rexSizer.hidden&&r.name===t)return r.selected}}},Qo=function(t,e){return t?t.hasOwnProperty("name")?t.name===e?t:null:GetElementByName(t,e):null},ta={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(lr(t)){for(var i,n=0,r=t.length;n<r;n++)if(i=Qo(t[n],e))return i}else for(var s in t)if(i=Qo(t[s],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,r=i.length;n<r;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 xn(this.getButton(t)),this},hideButton:function(t){return wn(this.getButton(t)),this},isButtonShown:function(t){return Sn(this.getButton(t)),this},forEachButtton:function(t,e){for(var i=this.buttons,n=0,r=i.length;n<r;n++)e?t.call(e,i[n],n,i):t(i[n],n,i);return this}},ea=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}(),ia={fireEvent:function(t,e){if(this.buttons){var i,n,r,s;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)(r=this.eventEmitter).emit.apply(r,[t,e,this.groupName,i].concat(a));else (s=this.eventEmitter).emit.apply(s,[t,e,i].concat(a));}}};Object.assign(ea.prototype,Jo,qo,$o,ta,ia);var na={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)}},ra=Phaser.Utils.Objects.GetValue,sa=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={});var s=n.space;"number"==typeof s&&(n.space={item:s}),(r=i.call(this,t,n)).type="rexButtons",r.buttonGroup=new ea({parent:a(r),eventEmitter:ra(n,"eventEmitter",a(r)),groupName:ra(n,"groupName",void 0),clickConfig:ra(n,"click",void 0)}).setButtonsType(n);var h=ra(n,"background",void 0),l=ra(n,"buttons",void 0);return r.buttonsExpand=ra(n,"expand",!1),r.buttonsAlign=ra(n,"align",void 0),h&&r.addBackground(h),l&&r.addButtons(l),r.addChildrenMap("background",h),r.addChildrenMap("buttons",r.buttonGroup.buttons),r}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(c(s(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(sa.prototype,Io,Go,ta,na);var oa=function(t,e,i,n){return e/t<=i?e/(n-1):0},aa=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,r,s,o=this.sizerChildren,a=this.space.item,h=this.space.line,l=this.space.indentLeftOdd,u=this.space.indentLeftEven,c=this.space.indentTopOdd,d=this.space.indentTopEven,f=0,p=e.lines,v=void 0,g=0,y=o.length;g<y;g++){if("\n"===(i=o[g]))i=void 0,n=0,s=!0;else {if(i.rexSizer.hidden)continue;i.isRexSizer&&i.layout(),s=f<(n=ha(i))||void 0===v;}if(s)v&&(v.width=t-(f+a),e.width=Math.max(e.width,v.width),e.height+=v.height+h),v={children:[],height:0},p.push(v),f=t-(p.length%2?l:u);f-=n+a,i&&(v.children.push(i),r=la(i),v.height=Math.max(v.height,r));}return v&&(v.width=t-(f+a),e.width=Math.max(e.width,v.width),e.height+=v.height),e.height+=Math.max(c,d),e},ha=function(t){var e=t.rexSizer.padding;return vt(t)+e.left+e.right},la=function(t){var e=t.rexSizer.padding;return gt(t)+e.top+e.bottom},ua=Phaser.Math.Distance.Between,ca=function(t,e){var i=this.sizerChildren;if(0===i.length)return -1;for(var n=-1,r=1/0,s=0,o=i.length;s<o;s++){var a=i[s];if(!(Math.abs(a.centerY-e)>a.height/2)){r>(h=ua(a.left,a.centerY,t,e))&&(r=h,n=s);var h,l=i[s+1];if(!l||l.y!==a.y)r>(h=ua(a.right,a.centerY,t,e))&&(r=h,n=s+1);}}return n},da=Phaser.Utils.Objects.IsPlainObject,fa=Phaser.Utils.Objects.GetValue,pa=Phaser.Display.Align.CENTER,va=function(t,e,i,n){if("\n"===t)return this.addNewLine(),this;var r;(Re.call(this,t),da(e))&&(e=fa(r=e,"padding",0),i=fa(r,"key",void 0),n=fa(r,"index",void 0));return void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=pa,r.padding=Ee(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},ga={add:function(t,e,i){if(lr(t))for(var n=t,r=0,s=n.length;r<s;r++)va.call(this,n[r],e);else va.call(this,t,e,i);return this},addNewLine:function(){return this.sizerChildren.push("\n"),this},insert:function(t,e,i,n){return va.call(this,e,i,n,t),this},insertAtPosition:function(t,e,i,n,r){var s=ca.call(this,t,e);return -1===s&&(s=void 0),this.insert(s,i,n,r),this}},ya=Phaser.Utils.Array.Remove,ma={remove:function(t,e){return this.getParentSizer(t)!==this||(ya(this.sizerChildren,t),We.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,yo.call(this,t),this}},ka={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,r=i.length;n<r;n++)"\n"!==(e=i[n])&&e.isRexSizer&&t.push(e);return t},preLayout:function(){return this._maxChildWidth=void 0,this._maxChildHeight=void 0,Ze.call(this),this},layoutChildren:function(){for(var t,e,i,n,r,s,o,a,h,l,u,c=this.innerWidth,d=this.justifyPercentage,f=this.space.item,p=this.space.line,v=this.space.indentLeftOdd,g=this.space.indentLeftEven,y=this.space.indentTopOdd,m=this.space.indentTopEven,k=0,b=this.innerLeft,x=this.innerTop,w=this.widthWrapResult.lines,S=x,C=0,O=w.length;C<O;C++){switch(h=(a=w[C]).children,this.rtl&&h.reverse(),u=b+(C%2?g:v),l=c-a.width,this.align){case 0:break;case 1:u+=l;break;case 2:u+=l/2;break;case 3:k=oa(c,l,d,h.length);break;case 4:0===(k=oa(c,l,d,h.length))&&(u+=l);break;case 5:0===(k=oa(c,l,d,h.length))&&(u+=l/2);}for(var _=!0,P=0,T=h.length;P<T;P++)(t=h[P]).rexSizer.hidden||(i=(e=t.rexSizer).padding,mr.call(this,t),n=u+i.left,_?_=!1:n+=f,r=S+(P%2?m:y)+i.top,s=vt(t),o=gt(t),u=n+s+i.right+k,kr.call(this,t,n,r,s,o,e.align));S+=a.height+p;}},runWidthWrap:function(t){var e=t-this.space.left-this.space.right;this.widthWrapResult=aa.call(this,e,this.widthWrapResult),$e.call(this,t);}};Object.assign(ka,ga,ma);var ba=function(t){void 0===t&&(t=this.sizerChildren);for(var e,i,n=0,r=0,s=t.length;r<s;r++)"\n"!==(e=t[r])&&(i=this.getChildWidth(e),n=Math.max(i,n));return n},xa=function(t){void 0===t&&(t=this.sizerChildren);for(var e,i,n=0,r=0,s=t.length;r<s;r++)"\n"!==(e=t[r])&&(i=e.isRexSizer?Math.max(e.minHeight,e.childrenHeight):e.hasOwnProperty("minHeight")?e.minHeight:gt(e),n=Math.max(i,n));return n},wa=Phaser.Utils.Objects.IsPlainObject,Sa=Phaser.Utils.Objects.GetValue,Ca=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h){var l;return e(this,s),wa(n)?(n=Sa(h=n,"x",0),r=Sa(h,"y",0),o=Sa(h,"width",void 0),a=Sa(h,"height",void 0)):wa(o)&&(o=Sa(h=o,"width",void 0),a=Sa(h,"height",void 0)),(l=i.call(this,t,n,r,o,a,h)).type="rexFixWidthSizer",l.sizerChildren=[],l.setOrientation(Sa(h,"orientation",0)),l.setItemSpacing(Sa(h,"space.item",0)),l.setLineSpacing(Sa(h,"space.line",0)),l.setIntentLeft(Sa(h,"space.indentLeftOdd",0),Sa(h,"space.indentLeftEven",0)),l.setIntentTop(Sa(h,"space.indentTopOdd",0),Sa(h,"space.indentTopEven",0)),l.setAlign(Sa(h,"align",0)),l.setJustifyPercentage(Sa(h,"justifyPercentage",.25)),l.setRTL(Sa(h,"rtl",!1)),l.addChildrenMap("items",l.sizerChildren),l}return n(s,[{key:"setOrientation",value:function(t){return this.orientation=Co(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=Oa[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=ba.call(this)),this._maxChildWidth}},{key:"maxChildHeight",get:function(){return void 0===this._maxChildHeight&&(this._maxChildHeight=xa.call(this)),this._maxChildHeight}}]),s}(ro),Oa={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(Ca.prototype,ka);var _a=Ca.prototype.add,Pa=function(t){return _a.call(this,t),this.buttonGroup.add(t),this},Ta={addButton:function(t){if(lr(t))for(var e=t,i=0,n=e.length;i<n;i++)Pa.call(this,e[i]);else Pa.call(this,t);return this},addButtons:function(t){if(lr(t[0]))for(var e,i=t,n=0,r=i.length-1;n<=r;n++){for(var s=0,o=(e=i[n]).length;s<o;s++)Pa.call(this,e[s]);n>r&&_a.addNewLine(this);}else for(s=0,o=t.length;s<o;s++)Pa.call(this,t[s]);return this}},Ea=Ca.prototype.remove,Ma=Ca.prototype.clear,Ra=function(t,e){return (t=this.getButton(t))?(this.buttonGroup.remove(t),Ea.call(this,t,e),this):this},La={remove:function(t,e){if(lr(t))for(var i=t,n=0,r=i.length;n<r;n++)Ra.call(this,i[n],e);else Ra.call(this,t,e);return this},clear:function(t){return this.buttonGroup.buttons.length=0,Ma.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--)Ra.call(this,e[i],t);return this}},za=Phaser.Utils.Objects.GetValue,Aa=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={});var s=n.space;"number"==typeof s&&(n.space={item:s,line:s}),(r=i.call(this,t,n)).type="rexFixWidthButtons",r.buttonGroup=new ea({parent:a(r),eventEmitter:za(n,"eventEmitter",a(r)),groupName:za(n,"groupName",void 0),clickConfig:za(n,"click",void 0)}).setButtonsType(n);var h=za(n,"background",void 0),l=za(n,"buttons",void 0);return r.buttonsAlign=za(n,"align",void 0),h&&r.addBackground(h),l&&r.addButtons(l),r.addChildrenMap("background",h),r.addChildrenMap("buttons",r.buttonGroup.buttons),r}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(c(s(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}(Ca);Object.assign(Aa.prototype,Ta,La,ta,na);var Da=function(){return Array.prototype.reduce.call(arguments,Ba,0)},Ba=function(t,e){return t+e},ja=Phaser.Utils.Objects.IsPlainObject,Wa=Phaser.Utils.Objects.GetValue,Ya=Phaser.Display.Align.CENTER,Xa=function(t,e,i,n,r){if("number"==typeof t||"number"==typeof e)if(void 0===t){for(var s=0;s<n;s++)if(!i[o=e*n+s])return o}else if(void 0===e){for(s=0;s<r;s++)if(!i[o=s*n+t])return o}else {if(!i[o=e*n+t])return o}else if(!0===e){var o;for(s=0;s<n;s++)for(var a=0;a<r;a++)if(!i[o=a*n+s])return o}else {s=0;for(var h=i.length;s<h;s++)if(!i[s])return s}return null},Ia={add:function(t,e,i,n,r,s,o){(Re.call(this,t),ja(e))&&(e=Wa(a=e,"column",void 0),i=Wa(a,"row",void 0),n=Wa(a,"align",Ya),r=Wa(a,"padding",0),s=Wa(a,"expand",!1),o=Wa(a,"key",void 0));var a,h=Xa(e,i,this.sizerChildren,this.columnCount,this.rowCount);if(null===h){if("number"==typeof e&&"number"==typeof i)return this;!0===i||"number"==typeof i?this.addEmptyColumn():this.addEmptyRow(),h=Xa(e,i,this.sizerChildren,this.columnCount,this.rowCount);}return "string"==typeof n&&(n=$t[n]),void 0===n&&(n=Ya),void 0===r&&(r=0),void 0===s&&(s=!0),(a=this.getSizerConfig(t)).align=n,a.padding=Ee(r),ja(s)?(a.expandWidth=Wa(s,"width",!1),a.expandHeight=Wa(s,"height",!1)):(a.expandWidth=s,a.expandHeight=s),this.sizerChildren[h]=t,void 0!==o&&this.addChildrenMap(o,t),this}},Ha=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=t.length-1);for(var r=i;r<=n;r++)t[r]=e;return t},Fa={remove:function(t,e){if(this.getParentSizer(t)!==this)return this;var i=this.sizerChildren.indexOf(t);return -1!==i&&(this.sizerChildren[i]=null),We.call(this,t,e),this},removeAt:function(t,e,i){var n=this.getChildAt(t,e);return n&&this.remove(n,i),this},removeAll:function(t){for(var e=this.sizerChildren.length-1;e>=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t);}return this},clear:function(t){return Ha(this.sizerChildren,null),yo.call(this,t),this}},Na={setColumnSpace:function(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ha(this.space.column,t);else for(var e=0,i=this.columnCount-1;e<i;e++)this.space.column[e]=t[e]||0;return this},setRowSpace:function(t){if(this.space.row||(this.space.row=[]),this.space.row.length=this.rowCount-1,"number"==typeof t)Ha(this.space.row,t);else for(var e=0,i=this.rowCount-1;e<i;e++)this.space.row[e]=t[e]||0;return this},setIndentLeft:function(t,e){return this.space.indentLeftOdd=t,this.space.indentLeftEven=e,this},setIndentTop:function(t,e){return this.space.indentTopOdd=t,this.space.indentTopEven=e,this}},Ga=Phaser.Utils.Objects.GetValue,Va=function(t,e,i){void 0===e&&(e=this.rowProportions[0]||0),void 0===i&&(i=this.space.row[0]||0),this.rowCount+=1,this.gridCount+=this.columnCount;for(var n=[t*this.columnCount,0],r=0;r<this.columnCount;r++)n.push(null);return this.sizerChildren.splice.apply(this.sizerChildren,n),this.rowProportions.push(e),this.rowHeight.length+=1,this.space.row.splice(t,0,i),this},Ua=function(t,e,i){void 0===e&&(e=this.columnProportions[0]||0),void 0===i&&(i=this.space.column[0]||0),this.columnCount+=1,this.gridCount+=this.rowCount;for(var n=this.rowCount-1;n>=0;n--){var r=n*this.columnCount+t;this.sizerChildren.splice(r,0,null);}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Ja={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);for(var e,i,n,r,s=0,o=this.sizerChildren,a=0;a<this.columnCount;a++){if(e=0,0===this.columnProportions[a]||t){for(var h=0;h<this.rowCount;h++)(i=o[h*this.columnCount+a])&&(i.rexSizer.hidden||(n=i.rexSizer.padding,r=this.getChildWidth(i)+n.left+n.right,e=Math.max(e,r)));s+=e;}this.columnWidth[a]=e;}var l=this.space,u=Math.max(l.indentLeftOdd,l.indentLeftEven);return s+Da.apply(void 0,[l.left,u].concat(p(l.column),[l.right]))},getChildrenHeight:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);for(var e,i,n,r,s=0,o=this.sizerChildren,a=0;a<this.rowCount;a++){if(e=0,0===this.rowProportions[a]||t){for(var h=0;h<this.columnCount;h++)(i=o[a*this.columnCount+h])&&(i.rexSizer.hidden||(r=i.isRexSizer?Math.max(i.minHeight,i.childrenHeight):i.hasOwnProperty("minHeight")?i.minHeight:gt(i),r+=(n=i.rexSizer.padding).top+n.bottom,e=Math.max(e,r)));s+=e;}this.rowHeight[a]=e;}var l=this.space,u=Math.max(l.indentTopOdd,l.indentTopEven);return s+Da.apply(void 0,[l.top,u].concat(p(l.row),[l.bottom]))},getExpandedChildWidth:function(t,e){var i,n=t.rexSizer;if(n.expandWidth){var r=n.padding;i=e-r.left-r.right;}return i},getExpandedChildHeight:function(t,e){var i,n=t.rexSizer;if(n.expandHeight){var r=n.padding;i=e-r.top-r.bottom;}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,r=i.length;n<r;n++)(e=i[n])&&e.isRexSizer&&t.push(e);return t},preLayout:function(){return this._totalColumnProportions=void 0,this._totalRowProportions=void 0,this.proportionWidthLength=void 0,this.proportionHeightLength=void 0,Ze.call(this),this},layoutChildren:function(){for(var t,e,i,n,r,s,o,a,h,l,u,c,d=this.innerLeft,f=this.innerTop,p=this.space.column,v=this.space.row,g=this.space.indentLeftOdd,y=this.space.indentLeftEven,m=this.space.indentTopOdd,k=this.space.indentTopEven,b=0;b<this.rowCount;b++){c=this.getRowHeight(b),n=d+(b%2?y:g);for(var x=0;x<this.columnCount;x++)u=this.getColumnWidth(x),(t=this.getChildAt(x,b))&&!t.rexSizer.hidden?(mr.call(this,t),h=this.getExpandedChildWidth(t,u),l=this.getExpandedChildHeight(t,c),t.isRexSizer?(t.runLayout(this,h,l),so(t,this)):pr(t,h,l),r=n+(i=(e=t.rexSizer).padding).left,o=u-i.left-i.right,s=f+(x%2?k:m)+i.top,a=c-i.top-i.bottom,kr.call(this,t,r,s,o,a,e.align),n+=u+p[x]):n+=u+p[x];f+=c+v[b];}},resolveWidth:function(t){t=Je.call(this,t);if(void 0===this.proportionWidthLength){var e=this.totalColumnProportions;if(e>0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e);}else this.proportionWidthLength=0;}return t},resolveHeight:function(t){t=Ke.call(this,t);if(void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e);}else this.proportionHeightLength=0;}return t},resolveChildrenWidth:function(t){var e,i,n;for(var r in this.sizerChildren)(e=this.sizerChildren[r])&&e.isRexSizer&&!e.ignoreLayout&&(n=this.getColumnWidth(parseInt(r)%this.columnCount),i=this.getExpandedChildWidth(e,n),i=e.resolveWidth(i),e.resolveChildrenWidth(i));},runWidthWrap:function(t){var e,i,n;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(n=this.getColumnWidth(parseInt(r)%this.columnCount),i=this.getExpandedChildWidth(e,n),e.isRexSizer&&(i=e.resolveWidth(i)),e.runWidthWrap(i));return this},resetGrid:function(t,e,i,n,r){if(void 0===i&&(i=0),void 0===n&&(n=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ha(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ha(this.columnProportions,i);else for(var s=0;s<t;s++)this.columnProportions[s]=i[s]||0;if(this.rowProportions=[],this.rowProportions.length=e,"number"==typeof n)Ha(this.rowProportions,n);else for(s=0;s<e;s++)this.rowProportions[s]=n[s]||0;this.columnWidth=[],this.columnWidth.length=t,this.rowHeight=[],this.rowHeight.length=e,this.setColumnSpace(Ga(r,"column",0)),this.setRowSpace(Ga(r,"row",0));var o=this.scene,a=this.createCellContainerCallback;if(a)for(var h=0,l=this.rowCount;h<l;h++)for(var u=0,c=this.columnCount;u<c;u++){var d={column:u,row:h},f=a(o,u,h,d);f&&this.add(f,d);}return this},inseryEmptyRow:Va,addEmptyRow:function(t,e){return Va.call(this,this.rowCount,t,e),this},insertEmptyColumn:Ua,addEmptyColumn:function(t,e){return Ua.call(this,this.columnCount,t,e),this}};Object.assign(Ja,Ia,Fa,Na);var Ka=function(){for(var t,e=0,i=0;i<this.columnCount;i++)(t=this.columnProportions[i])>0&&(e+=t);return e},qa=function(){for(var t,e=0,i=0;i<this.rowCount;i++)(t=this.rowProportions[i])>0&&(e+=t);return e},Za=Phaser.Utils.Objects.IsPlainObject,$a=Phaser.Utils.Objects.GetValue,Qa=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a,h,l,u,c,d){var f;return e(this,o),Za(n)?(n=$a(d=n,"x",0),r=$a(d,"y",0),s=$a(d,"width",void 0),a=$a(d,"height",void 0),h=$a(d,"column",d.col||0),l=$a(d,"row",0),u=$a(d,"columnProportions",0),c=$a(d,"rowProportions",0)):Za(s)?(s=$a(d=s,"width",void 0),a=$a(d,"height",void 0),h=$a(d,"column",d.col||0),l=$a(d,"row",0),u=$a(d,"columnProportions",0),c=$a(d,"rowProportions",0)):Za(h)?(h=$a(d=h,"column",d.col||0),l=$a(d,"row",0),u=$a(d,"columnProportions",0),c=$a(d,"rowProportions",0)):Za(u)&&(u=$a(d=u,"columnProportions",0),c=$a(d,"rowProportions",0)),(f=i.call(this,t,n,r,s,a,d)).type="rexGridSizer",f.sizerChildren=[],f.addChildrenMap("items",f.sizerChildren),f.setCreateCellContainerCallback($a(d,"createCellContainerCallback")),f.setIndentLeft($a(d,"space.indentLeftOdd",0),$a(d,"space.indentLeftEven",0)),f.setIndentTop($a(d,"space.indentTopOdd",0),$a(d,"space.indentTopEven",0)),f.resetGrid(h,l,u,c,$a(d,"space",void 0)),f}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(c(s(o.prototype),"destroy",this).call(this,t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0);}},{key:"setColumnProportion",value:function(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}},{key:"setRowProportion",value:function(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}},{key:"totalColumnProportions",get:function(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Ka.call(this)),this._totalColumnProportions}},{key:"totalRowProportions",get:function(){return void 0===this._totalRowProportions&&(this._totalRowProportions=qa.call(this)),this._totalRowProportions}},{key:"getChildAt",value:function(t,e){return this.sizerChildren[e*this.columnCount+t]}},{key:"childToGridIndex",value:function(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return -1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}},{key:"getColumnWidth",value:function(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}},{key:"getRowHeight",value:function(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}},{key:"setCreateCellContainerCallback",value:function(t){return this.createCellContainerCallback=t,this}}]),o}(ro);Object.assign(Qa.prototype,Ja);var th=Qa.prototype.add,eh={addButton:function(t,e,i){return th.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons:function(t,e){for(var i=0,n=t;i<n;i++)this.addButton(t[i],void 0,e);return this}},ih=Qa.prototype.remove,nh=Qa.prototype.clear,rh=function(t,e){return (t=this.getButton(t))?(this.buttonGroup.remove(t),ih.call(this,t,e),this):this},sh={remove:function(t,e){if(lr(t))for(var i=t,n=0,r=i.length;n<r;n++)rh.call(this,i[n],e);else rh.call(this,t,e);return this},clear:function(t){return this.buttonGroup.buttons.length=0,nh.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--)rh.call(this,e[i],t);return this}},oh=Phaser.Utils.Objects.GetValue,ah=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={});var s=oh(n,"row",0),h=oh(n,"column",n.col||0),l=oh(n,"createCellContainerCallback"),u=oh(n,"buttons",void 0),c=oh(n,"expand",!0),d=c?1:0;if(l&&(n.createCellContainerCallback=void 0),void 0!==u){s=Math.max(s,u.length);for(var f=0,p=u.length;f<p;f++)h=Math.max(h,u[f].length);}n.row=s,n.column=h,n.columnProportions=d,n.rowProportions=d,(r=i.call(this,t,n)).type="rexGridButtons",r.buttonGroup=new ea({parent:a(r),eventEmitter:oh(n,"eventEmitter",a(r)),groupName:oh(n,"groupName",void 0),clickConfig:oh(n,"click",void 0)}).setButtonsType(n);var v=oh(n,"background",void 0);if(r.buttonsExpand=c,oh(n,"space",void 0),v&&r.addBackground(v),u)for(var g,y=0,m=u.length;y<m;y++)for(var k=0,b=(g=u[y]).length;k<b;k++)(S=g[k])&&r.addButton(S,k,y);else if(l)for(var x=0;x<s;x++)for(var w=0;w<h;w++){var S;(S=l(t,w,x))&&r.addButton(S,w,x);}return r.addChildrenMap("background",v),r.addChildrenMap("buttons",r.buttonGroup.buttons),r}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(c(s(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}(Qa);Object.assign(ah.prototype,eh,sh,ta,na);var hh={getChoice:function(t){var e=this.childrenMap.choicesSizer;return e?e.getButton(t):void 0},getAction:function(t){return this.childrenMap.actionsSizer.getButton(t)},getToolbar:function(t){return this.childrenMap.toolbarSizer.getButton(t)},getLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.getButton(t)},setChoiceEnable:function(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonEnable(t,e),this},setActionEnable:function(t,e){return this.childrenMap.actionsSizer.setButtonEnable(t,e),this},setToolbarEnable:function(t,e){return this.childrenMap.toolbarSizer.setButtonEnable(t,e),this},setLeftToolbarEnable:function(t,e){return this.childrenMap.leftToolbarSizer.setButtonEnable(t,e),this},toggleChoiceEnable:function(t){var e=this.childrenMap.choicesSizer;return e&&e.toggleButtonEnable(t),this},toggleActionEnable:function(t){return this.childrenMap.actionsSizer.toggleButtonEnable(t),this},toggleToolbarEnable:function(t){return this.childrenMap.toolbarSizer.toggleButtonEnable(t),this},toggleLeftToolbarEnable:function(t){return this.childrenMap.leftToolbarSizer.toggleButtonEnable(t),this},getChoiceEnable:function(t){var e=this.childrenMap.choicesSizer;return !!e&&e.getButtonEnable(t)},getActionEnable:function(t){return this.childrenMap.actionsSizer.getButtonEnable(t)},getToolbarEnable:function(t){return this.childrenMap.toolbarSizer.getButtonEnable(t)},getLeftToolbarEnable:function(t){return this.childrenMap.leftToolbarSizer.getButtonEnable(t)},emitChoiceClick:function(t){var e=this.childrenMap.choicesSizer;return e&&e.emitButtonClick(t),this},emitActionClick:function(t){return this.childrenMap.actionsSizer.emitButtonClick(t),this},emitToolbarClick:function(t){return this.childrenMap.toolbarSizer.emitButtonClick(t),this},emitLeftToolbarClick:function(t){return this.childrenMap.leftToolbarSizer.emitButtonClick(t),this},showChoice:function(t){var e=this.childrenMap.choicesSizer;return e&&e.showButton(t),this},showAction:function(t){return this.childrenMap.actionsSizer.showButton(t),this},showToolbar:function(t){return this.childrenMap.toolbarSizer.showButton(t),this},showLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.showButton(t),this},hideChoice:function(t){var e=this.childrenMap.choicesSizer;return e&&e.hideButton(t),this},hideAction:function(t){return this.childrenMap.actionsSizer.hideButton(t),this},hideToolbar:function(t){return this.childrenMap.toolbarSizer.hideButton(t),this},hideLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.hideButton(t),this},addChoice:function(t){var e=this.childrenMap.choicesSizer;return e&&e.addButton(t),this},addAction:function(t){return this.childrenMap.actionsSizer.addButton(t),this},addToolbar:function(t){return this.childrenMap.toolbarSizer.addButton(t),this},addLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.addButton(t),this},removeChoice:function(t,e){var i=this.childrenMap.choicesSizer;return i&&i.removeButton(t,e),this},removeAction:function(t,e){return this.childrenMap.actionsSizer.removeButton(t,e),this},removeToolbar:function(t,e){return this.childrenMap.toolbarSizer.removeButton(t,e),this},removeLeftToolbar:function(t,e){return this.childrenMap.leftToolbarSizer.removeButton(t,e),this},clearChoices:function(t){var e=this.childrenMap.choicesSizer;return e&&e.clearButtons(t),this},clearActions:function(t){return this.childrenMap.actionsSizer.clearButtons(t),this},clearToolbar:function(t){return this.childrenMap.toolbarSizer.clearButtons(t),this},clearLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.clearButtons(t),this},forEachChoice:function(t,e){var i=this.childrenMap.choicesSizer;return i&&i.forEachButtton(t,e),this},forEachAction:function(t,e){return this.childrenMap.actionsSizer.forEachButtton(t,e),this},forEachToolbar:function(t,e){return this.childrenMap.toolbarSizer.forEachButtton(t,e),this},forEachLeftToolbar:function(t,e){return this.childrenMap.leftToolbarSizer.forEachButtton(t,e),this},setAllButtonsEnable:function(t){return void 0===t&&(t=!0),this.childrenMap.toolbarSizer&&this.setToolbarEnable(t),this.childrenMap.leftToolbarSizer&&this.setLeftToolbarEnable(t),this.childrenMap.actionsSizer&&this.setActionEnable(t),this.childrenMap.choicesSizer&&this.setChoiceEnable(t),this},getChoicesButtonStates:function(){var t=this.childrenMap.choicesSizer;return t?t.getAllButtonsState():{}},getChoicesButtonState:function(t){var e=this.childrenMap.choicesSizer;return void 0===t?e?e.getAllButtonsState():{}:!!e&&e.getButtonState(t)},setChoicesButtonState:function(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonState(t,e),this},clearChoicesButtonStates:function(){var t=this.childrenMap.choicesSizer;return t&&t.clearAllButtonsState(),this},getChoicesSelectedButtonName:function(){var t=this.childrenMap.choicesSizer;return t?t.getSelectedButtonName():""},setChoicesSelectedButtonName:function(t){var e=this.childrenMap.choicesSizer;return e&&e.setSelectedButtonName(t),this}},lh={onCreateModalBehavior:function(t){t.on("button.click",(function(e,i,n,r,s){if("actions"===i){var o={index:n,text:e.text,button:e,dialog:t};switch(t.buttonsType){case"radio":o.value=t.getChoicesSelectedButtonName();break;case"checkboxes":o.value=t.getChoicesButtonStates();break;default:o.value=void 0;}t.modalClose(o);}}));},modal:function(t,e){return t&&!1===t.defaultBehavior?this.onCreateModalBehavior=!1:delete this.onCreateModalBehavior,ar.modal.call(this,t,e),this}},uh={};Object.assign(uh,hh,lh);var ch=Phaser.Utils.Objects.GetValue,dh=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={}),n.orientation=1,(r=i.call(this,t,n)).type="rexDialog",r.eventEmitter=ch(n,"eventEmitter",a(r));var o,h,l,u,c=ch(n,"background",void 0),d=ch(n,"title",void 0),f=ch(n,"toolbar",void 0),p=ch(n,"toolbarBackground",void 0),v=ch(n,"leftToolbar",void 0),g=ch(n,"leftToolbarBackground",void 0),y=ch(n,"content",void 0),m=ch(n,"description",void 0),k=ch(n,"choices",void 0),b=ch(n,"choicesBackground",void 0),x=ch(n,"actions",void 0),w=ch(n,"actionsBackground",void 0),S=ch(n,"click",void 0);if(c&&r.addBackground(c),f&&(l=new sa(t,{groupName:"toolbar",background:p,buttons:f,orientation:0,space:{item:ch(n,"space.toolbarItem",0)},click:S,eventEmitter:r.eventEmitter})),v&&(u=new sa(t,{groupName:"leftToolbar",background:g,buttons:v,orientation:0,space:{item:ch(n,"space.leftToolbarItem",0)},click:S,eventEmitter:r.eventEmitter})),d||f||v){var C,O=!!d&&ch(n,"expand.title",!0),_=ch(n,"align.title","center"),P=!(d&&!O&&"center"===_||!d&&(f||v));C=P?new Po(t,{orientation:0}):new jo(t);var T=!!P||{height:!0};if(u&&C.add(u,{align:"left",expand:T}),d){P&&!O&&"right"===_&&C.addSpace();var E={left:ch(n,"space.titleLeft",0),right:ch(n,"space.titleRight",0)},M=O?1:0;C.add(d,{align:_,proportion:M,expand:T,padding:E}),P&&!O&&"left"===_&&C.addSpace();}l&&(P&&!d&&C.addSpace(),C.add(l,{align:"right",expand:T})),(y||m||k||x)&&(E={bottom:ch(n,"space.title",0),top:ch(n,"space.titleTop",0)});M=ch(n,"proportion.title",0);r.add(C,{padding:E,proportion:M,expand:!0});}if(y){var R=ch(n,"align.content","center"),L=ch(n,"space.content",0),z=(E={left:ch(n,"space.contentLeft",0),right:ch(n,"space.contentRight",0),bottom:m||k||x?L:0},M=ch(n,"proportion.content",0),ch(n,"expand.content",!0));r.add(y,{align:R,padding:E,proportion:M,expand:z});}if(m){R=ch(n,"align.description","center");var A=ch(n,"space.description",0);E={left:ch(n,"space.descriptionLeft",0),right:ch(n,"space.descriptionRight",0),bottom:k||x?A:0},M=ch(n,"proportion.description",0),z=ch(n,"expand.description",!0);r.add(m,{align:R,padding:E,proportion:M,expand:z});}if(k){var D=ch(n,"choicesType","").split("-"),B=fh(D,"wrap")?Aa:fh(D,"grid")?ah:sa,j=fh(D,"radio")?"radio":fh(D,"checkboxes")?"checkboxes":void 0,W={left:ch(n,"space.choicesBackgroundLeft",0),right:ch(n,"space.choicesBackgroundRight",0),top:ch(n,"space.choicesBackgroundTop",0),bottom:ch(n,"space.choicesBackgroundBottom",0)},Y=ch(n,"space.choice",0);B===sa?W.item=Y:B===Aa?(W.item=Y,W.line=ch(n,"space.choiceLine",Y)):(W.column=ch(n,"space.choiceColumn",Y),W.row=ch(n,"space.choiceRow",Y));var X={width:ch(n,"choicesWidth",void 0),height:ch(n,"choicesHeight",void 0),groupName:"choices",buttonsType:j,background:b,buttons:k,space:W,click:S,eventEmitter:r.eventEmitter,setValueCallback:ch(n,"choicesSetValueCallback",void 0),setValueCallbackScope:ch(n,"choicesSetValueCallbackScope",void 0)};B===sa&&(X.orientation=fh(D,"x")?0:1),o=new B(t,X);var I=ch(n,"space.choices",0);E={left:ch(n,"space.choicesLeft",0),right:ch(n,"space.choicesRight",0),bottom:x?I:0},R=ch(n,"align.choices","center"),M=ch(n,"proportion.choices",0),z=ch(n,"expand.choices",!0);r.add(o,{align:R,padding:E,proportion:M,expand:z}),r.buttonsType=j;}if(x){h=new sa(t,{groupName:"actions",background:w,buttons:x,orientation:0,space:{item:ch(n,"space.action",0)},expand:ch(n,"expand.actions",!1),align:ch(n,"align.actions","center"),click:S,eventEmitter:r.eventEmitter});E={left:ch(n,"space.actionsLeft",0),right:ch(n,"space.actionsRight",0),bottom:ch(n,"space.actionsBottom",0)},M=ch(n,"proportion.action",0);r.add(h,{align:"center",padding:E,proportion:M,expand:!0});}return vh(a(r),"click"),vh(a(r),"over"),vh(a(r),"out"),vh(a(r),"enable"),vh(a(r),"disable"),r.addChildrenMap("background",c),r.addChildrenMap("title",d),r.addChildrenMap("toolbar",f),r.addChildrenMap("leftToolbar",v),r.addChildrenMap("content",y),r.addChildrenMap("description",m),r.addChildrenMap("choices",o?o.buttons:void 0),r.addChildrenMap("actions",h?h.buttons:void 0),r.addChildrenMap("choicesSizer",o),r.addChildrenMap("actionsSizer",h),r.addChildrenMap("toolbarSizer",l),r.addChildrenMap("leftToolbarSizer",u),r}return n(s)}(Po),fh=function(t,e){return -1!==t.indexOf(e)},ph={actions:"action",choices:"choice",toolbar:"toolbar",leftToolbar:"leftToolbar"},vh=function(t,e){t.on("button.".concat(e),(function(i,n,r,s,o){ph.hasOwnProperty(n)&&t.emit("".concat(ph[n],".").concat(e),i,r,s,o);}));};Object.assign(dh.prototype,uh);var gh=function(t,e,i){if(t){var n=null==e,r=null==i;return n&&r||(n||(t.displayWidth=e),r||(t.displayHeight=i),n&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},yh=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?"".concat(this.text,"\n").concat(t):"".concat(this.text).concat(t))!=this.text&&this.setText(i),this},mh={appendText:yh,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var n=t.iconSize;n&&(this.setChildDisplaySize(i,n,n),void 0!==this.iconWidth&&this.setIconSize(n)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame);}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var s=t.actionSize;s&&(this.setChildDisplaySize(r,s,s),void 0!==this.actionWidth&&this.setActionSize(s)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame);}return this}},kh=function(t){r(o,t);var i=l(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"text",get:function(){var t=this.childrenMap.text;return t?t.text:""},set:function(t){var e=this.childrenMap.text;e&&e.setText(t);}},{key:"setText",value:function(t){return this.text=t,this}},{key:"setIconTexture",value:function(t,e){var i=this.childrenMap.icon;return i?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(gh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}},{key:"setTexture",value:function(t,e){return this.setIconTexture(t,e),this}},{key:"setIconSize",value:function(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}},{key:"texture",get:function(){var t=this.childrenMap.icon;if(t)return t.texture}},{key:"frame",get:function(){var t=this.childrenMap.icon;if(t)return t.frame}},{key:"setActionTexture",value:function(t,e){var i=this.childrenMap.action;return void 0===i||(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(gh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i))),this}},{key:"actionTexture",get:function(){var t=this.childrenMap.action;if(t)return t.texture}},{key:"actionFrame",get:function(){var t=this.childrenMap.action;if(t)return t.frame}},{key:"setActionSize",value:function(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}},{key:"preLayout",value:function(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&gh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&gh(e,this.actionWidth,this.actionHeight),c(s(o.prototype),"preLayout",this).call(this);}},{key:"postLayout",value:function(t,e,i){var n=this.childrenMap.iconMask;n&&(n.setPosition(),this.resetChildPositionState(n));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),this}},{key:"resize",value:function(t,e){c(s(o.prototype),"resize",this).call(this,t,e);var i=this.childrenMap.iconMask;i&&i.resize();var n=this.childrenMap.actionMask;return n&&n.resize(),this}}]),o}(Po);Object.assign(kh.prototype,mh);var bh=function(t,e,i,n,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var s=Math.min(t,e)/2;this.fillCircle(-t*(n-.5),-e*(r-.5),s+i);}else this.fillRect(-t*n-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom);},xh=function(t,e){for(var i in t){if(!(i in e))return !1;if(t[i]!==e[i])return !1}for(var i in e)if(!(i in t))return !1;return !0},wh=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),void 0===n&&(n=0),"string"==typeof n&&(n=Sh[n]),(s=i.call(this,t.scene)).parent=t,s.shapeType=n,s.padding=Ee(r),s.setPosition().resize().setVisible(!1),s}return n(o,[{key:"destroy",value:function(){return this.parent=void 0,c(s(o.prototype),"destroy",this).call(this),this}},{key:"setPosition",value:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),c(s(o.prototype),"setPosition",this).call(this,t,e),this}},{key:"resize",value:function(t,e,i){var n=this.parent;void 0===t&&(t=n.width),void 0===e&&(e=n.height),void 0===i?i=this.padding:"number"==typeof i&&(i=Ee(i));var r=this.width!==t||this.height!==e,s=this.padding!==i&&!xh(this.padding,i);return r||s?(this.width=t,this.height=e,s&&Rt(i,this.padding),this.originX=n.originX,this.originY=n.originY,bh.call(this,t,e,i,n.originX,n.originY),this):this}},{key:"setOrigin",value:function(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,bh.call(this,this.width,this.height,this.padding,t,e)),this}}]),o}(Phaser.GameObjects.Graphics),Sh={rectangle:0,circle:1},Ch=function(t,e,i,n){var r=new wh(e,i,n);if(t&&!t.isRexSizer){var s=r.createGeometryMask();t.setMask(s),this.once("destroy",(function(){t.setMask(),s.destroy();}));}return this.pin(r),r},Oh=Phaser.Utils.Objects.GetValue,_h=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),(r=i.call(this,t,n)).type="rexLabel";var o=Oh(n,"background",void 0),h=Oh(n,"icon",void 0),l=Oh(n,"iconMask",void 0),u=Oh(n,"text",void 0),c=Oh(n,"action",void 0),d=Oh(n,"actionMask",void 0),f=Oh(n,"align",void 0);if(o&&r.addBackground(o),"right"!==f&&"bottom"!==f&&"center"!==f||r.addSpace(),h){0===r.orientation?(u||c)&&(x={right:Oh(n,"space.icon",0),top:Oh(n,"space.iconTop",0),bottom:Oh(n,"space.iconBottom",0),left:Oh(n,"space.iconLeft",0)}):(u||c)&&(x={bottom:Oh(n,"space.icon",0),left:Oh(n,"space.iconLeft",0),right:Oh(n,"space.iconRight",0),top:Oh(n,"space.iconTop",0)});var p=Oh(n,"squareFitIcon",!1)?1:0;if(r.add(h,{proportion:0,padding:x,fitRatio:p}),l&&(l=Ch.call(a(r),h,h,1)),!p){var v=Oh(n,"iconSize",void 0);r.setIconSize(Oh(n,"iconWidth",v),Oh(n,"iconHeight",v));}}if(u){var g,y,m=Oh(n,"space.text",0),k=Oh(n,"expandTextWidth",!1),b=Oh(n,"expandTextHeight",!1);0===r.orientation?(g=k?1:0,c&&(x={right:m}),y=b):(g=b?1:0,c&&(x={bottom:m}),y=k),r.add(u,{proportion:g,expand:y,padding:x});}if(c){var x;x=0===r.orientation?{top:Oh(n,"space.actionTop",0),bottom:Oh(n,"space.actionBottom",0),right:Oh(n,"space.actionRight",0)}:{left:Oh(n,"space.actionLeft",0),right:Oh(n,"space.actionRight",0),bottom:Oh(n,"space.actionBottom",0)};p=Oh(n,"squareFitAction",!1)?1:0;if(r.add(c,{proportion:0,padding:x,fitRatio:p}),d&&(d=Ch.call(a(r),c,c,1)),!p){var w=Oh(n,"actionSize");r.setActionSize(Oh(n,"actionWidth",w),Oh(n,"actionHeight",w));}}return "center"===f&&r.addSpace(),r.addChildrenMap("background",o),r.addChildrenMap("icon",h),r.addChildrenMap("iconMask",l),r.addChildrenMap("text",u),r.addChildrenMap("action",c),r.addChildrenMap("actionMask",d),r}return n(s)}(kh),Ph=function e(i){var n,r,s;if(null==i||"object"!==t(i))return i;if(n=Array.isArray(i)?[]:{},function(e){if("object"!==t(e)||e.nodeType||e===e.window)return !1;try{if(e.constructor&&!{}.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return !1}catch(t){return !1}return !0}(i))for(s in i)r=i[s],n[s]=e(r);else n=i;return n},Th=function(t){return null==t||""===t||0===t.length},Eh=function(e,i,n,r){if(void 0===r&&(r="."),"object"===t(e)){if(Th(i)){if(null==n)return;"object"===t(n)&&(e=n);}else {"string"==typeof i&&(i=i.split(r));var s=i.pop(),o=function(e,i,n){var r=e;if(Th(i));else {var s;"string"==typeof i&&(i=i.split("."));for(var o=0,a=i.length;o<a;o++){var h;null!=r[s=i[o]]&&"object"===t(r[s])||(h=o===a-1?void 0===n?{}:n:{},r[s]=h),r=r[s];}}return r}(e,i);o[s]=n;}return e}},Mh=Phaser.Utils.Objects.GetValue,Rh=function(){function t(i,n,r,s,o){e(this,t),void 0===i&&(i=0),void 0===n&&(n=i),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(i,n,r,s,o);}return n(t,[{key:"setTo",value:function(t,e,i,n,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,n),this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"minWidth",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}},{key:"minHeight",get:function(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}},{key:"width",get:function(){return this._width},set:function(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth);}},{key:"height",get:function(){return this._height},set:function(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight);}},{key:"radius",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)},set:function(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Mh(t,"x",0),i=Mh(t,"y",0));var n=this.cornerRadius;n.tl=Lh(Mh(t,"tl",void 0),e,i),n.tr=Lh(Mh(t,"tr",void 0),e,i),n.bl=Lh(Mh(t,"bl",void 0),e,i),n.br=Lh(Mh(t,"br",void 0),e,i);}},{key:"radiusTL",get:function(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)},set:function(t){zh(this.cornerRadius.tl,t);}},{key:"radiusTR",get:function(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)},set:function(t){zh(this.cornerRadius.tr,t);}},{key:"radiusBL",get:function(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)},set:function(t){zh(this.cornerRadius.bl,t);}},{key:"radiusBR",get:function(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)},set:function(t){zh(this.cornerRadius.br,t);}}]),t}(),Lh=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ah(t),t},zh=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Mh(e,"x",0),t.y=Mh(e,"y",0)),Ah(t);},Ah=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},Dh=function(t,e,i){var n=i.length;if(n>=2){var r=i[n-2],s=i[n-1];if(t===r&&e===s)return i}return i.push(t,e),i},Bh=Phaser.Math.DegToRad,jh=function(t,e,i,n,r,s,o,a,h){o&&s>r?s-=360:!o&&s<r&&(s+=360);var l=Bh(s-r)/a;r=Bh(r);for(var u=0;u<=a;u++){var c=r+l*u,d=t+i*Math.cos(c),f=e+n*Math.sin(c);Dh(d,f,h);}return h},Wh=Phaser.Renderer.WebGL.Utils,Yh=Phaser.Renderer.WebGL.Utils,Xh=Phaser.GameObjects.GetCalcMatrix,Ih=Phaser.Renderer.Canvas.SetTransform,Hh={renderWebGL:function(t,e,i,n){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),s=Xh(e,i,n),o=r.calcMatrix.copyFrom(s.calc),a=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&function(t,e,i,n,r,s){for(var o=Wh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*n),a=i.pathData,h=i.pathIndexes,l=0;l<h.length;l+=3){var u=2*h[l],c=2*h[l+1],d=2*h[l+2],f=a[u+0]-r,p=a[u+1]-s,v=a[c+0]-r,g=a[c+1]-s,y=a[d+0]-r,m=a[d+1]-s,k=e.getX(f,p),b=e.getY(f,p),x=e.getX(v,g),w=e.getY(v,g),S=e.getX(y,m),C=e.getY(y,m);t.batchTri(i,k,b,x,w,S,C,0,0,1,1,o,o,o,2);}}(r,o,e,l,a,h),e.isStroked&&function(t,e,i,n,r){var s=t.strokeTint,o=Yh.getTintAppendFloatAlpha(e.strokeColor,e.strokeAlpha*i);s.TL=o,s.TR=o,s.BL=o,s.BR=o;var a=e.pathData,h=a.length-1,l=e.lineWidth,u=l/2,c=a[0]-n,d=a[1]-r;e.closePath||(h-=2);for(var f=2;f<h;f+=2){var p=a[f]-n,v=a[f+1]-r;t.batchLine(c,d,p,v,u,u,l,f-2,!!e.closePath&&f===h-1),c=p,d=v;}}(r,e,l,a,h),t.pipelines.postBatch(e);},renderCanvas:function(t,e,i,n){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Ih(t,r,e,i,n)){var s=e._displayOriginX,o=e._displayOriginY,a=e.pathData,h=a.length-1,l=a[0]-s,u=a[1]-o;r.beginPath(),r.moveTo(l,u),e.closePath||(h-=2);for(var c=2;c<h;c+=2){var d=a[c]-s,f=a[c+1]-o;r.lineTo(d,f);}r.closePath(),e.isFilled&&(!function(t,e,i,n){var r=i||e.fillColor,s=n||e.fillAlpha,o=(16711680&r)>>>16,a=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+o+","+a+","+h+","+s+")";}(r,e),r.fill()),e.isStroked&&(!function(t,e,i,n){var r=i||e.strokeColor,s=n||e.strokeAlpha,o=(16711680&r)>>>16,a=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+o+","+a+","+h+","+s+")",t.lineWidth=e.lineWidth;}(r,e),r.stroke()),r.restore();}}},Fh=Phaser.GameObjects.Shape,Nh=Phaser.Utils.Objects.IsPlainObject,Gh=Phaser.Utils.Objects.GetValue,Vh=Phaser.Geom.Polygon.Earcut,Uh=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l,u){var c,d,f,p,v;if(e(this,s),Nh(n)){var g=n;n=g.x,r=g.y,o=g.width,a=g.height,h=g.radius,l=g.color,u=g.alpha,d=g.strokeColor,f=g.strokeAlpha,p=g.strokeWidth,v=g.shape;}void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===a&&(a=o),void 0===h&&(h=0),void 0===v&&(v=0);var y=new Rh;if((c=i.call(this,t,"rexRoundRectangleShape",y)).setShapeType(v),0===c.shapeType){var m=Gh(h,"radius",h);y.setTo(0,0,o,a,m);}else {m={x:o/2,y:a/2};y.setTo(0,0,o,a,m);}var k=Gh(h,"iteration",void 0);return c.setIteration(k),c.setPosition(n,r),c.setFillStyle(l,u),void 0!==d&&void 0===p&&(p=2),c.setStrokeStyle(p,d,f),c.updateDisplayOrigin(),c.dirty=!0,c}return n(s,[{key:"fillColor",get:function(){return this._fillColor},set:function(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0;}},{key:"fillAlpha",get:function(){return this._fillAlpha},set:function(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor;}},{key:"setFillStyle",value:function(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0;}},{key:"strokeAlpha",get:function(){return this._strokeAlpha},set:function(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0;}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor;}},{key:"setStrokeStyle",value:function(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}},{key:"updateData",value:function(){var t=this.geom,e=this.pathData;e.length=0;var i,n=t.width,r=t.height,s=t.cornerRadius,o=this.iteration+1;if(i=s.tl,Jh(i))if(i.convex){var a=i.x,h=i.y;jh(a,h,i.x,i.y,180,270,!1,o,e);}else {jh(a=0,h=0,i.x,i.y,90,0,!0,o,e);}else Dh(0,0,e);if(i=s.tr,Jh(i))if(i.convex){a=n-i.x,h=i.y;jh(a,h,i.x,i.y,270,360,!1,o,e);}else {jh(a=n,h=0,i.x,i.y,180,90,!0,o,e);}else Dh(n,0,e);if(i=s.br,Jh(i))if(i.convex){a=n-i.x,h=r-i.y;jh(a,h,i.x,i.y,0,90,!1,o,e);}else {jh(a=n,h=r,i.x,i.y,270,180,!0,o,e);}else Dh(n,r,e);if(i=s.bl,Jh(i))if(i.convex){a=i.x,h=r-i.y;jh(a,h,i.x,i.y,90,180,!1,o,e);}else {jh(a=0,h=r,i.x,i.y,360,270,!0,o,e);}else Dh(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=Vh(e),this}},{key:"setShapeType",value:function(t){return "string"==typeof t&&(t=Kh[t]),this.shapeType=t,this}},{key:"width",get:function(){return this.geom.width},set:function(t){this.resize(t,this.height);}},{key:"height",get:function(){return this.geom.height},set:function(t){this.resize(this.width,t);}},{key:"setSize",value:function(t,e){if(void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e)return this;this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"radius",get:function(){return this.geom.radius},set:function(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0;}},{key:"radiusTL",get:function(){return this.geom.radiusTL},set:function(t){this.geom.radiusTL=t,this.dirty=!0;}},{key:"radiusTR",get:function(){return this.geom.radiusTR},set:function(t){this.geom.radiusTR=t,this.dirty=!0;}},{key:"radiusBL",get:function(){return this.geom.radiusBL},set:function(t){this.geom.radiusBL=t,this.dirty=!0;}},{key:"radiusBR",get:function(){return this.geom.radiusBR},set:function(t){this.geom.radiusBR=t,this.dirty=!0;}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setRadiusTL",value:function(t){return void 0===t&&(t=0),this.radiusTL=t,this}},{key:"setRadiusTR",value:function(t){return void 0===t&&(t=0),this.radiusTR=t,this}},{key:"setRadiusBL",value:function(t){return void 0===t&&(t=0),this.radiusBL=t,this}},{key:"setRadiusBR",value:function(t){return void 0===t&&(t=0),this.radiusBR=t,this}},{key:"cornerRadius",get:function(){return this.geom.cornerRadius},set:function(t){this.radius=t;}},{key:"setCornerRadius",value:function(t){return this.setRadius(t)}},{key:"iteration",get:function(){return this._iteration},set:function(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t;}},{key:"setIteration",value:function(t){return void 0===t&&(t=6),this.iteration=t,this}}]),s}(Fh),Jh=function(t){return t.x>0&&t.y>0},Kh={rectangle:0,circle:1};Object.assign(Uh.prototype,Hh);var qh=Phaser.Utils.Objects.GetValue,Zh=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),(r=i.call(this,t,n)).style=qh(n,"style",a(r));var o=qh(n,"propertiesMap");return r.activeStyle=$h(n,"active",o),r.hoverStyle=$h(n,"hover",o),r.disableStyle=$h(n,"disable",o),r.onModifyStyle=qh(n,"onModifyStyle"),r}return n(s,[{key:"getStyle",value:function(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var n=0,r=e.length;n<r;n++)i[s=e[n]]=t[s];else for(var s in e)i[s]=t[s];return i}(this.style,t)}},{key:"modifyStyle",value:function(t){for(var e in t)this.style[e]=t[e];return this.onModifyStyle&&this.onModifyStyle(this.parent,t),this}},{key:"applyStyle",value:function(t){if(t){var e=this.getStyle(t);return xh(e,t)?void 0:(this.modifyStyle(t),e)}}},{key:"setActiveState",value:function(t){return Qh.call(this,"active",t),this}},{key:"setHoverState",value:function(t){return Qh.call(this,"hover",t),this}},{key:"setDisableState",value:function(t){return Qh.call(this,"disable",t),this}}]),s}(ai),$h=function(t,e,i){var n=function(t,e,i,n){if(void 0===i&&(i="."),void 0===n&&(n={}),!t)return n;if(e in t)return Object.assign(n,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(n[r.replace(e,"")]=t[r]);return n}(t,e);if(i)for(var r in n)i.hasOwnProperty(r)&&(n[i[r]]=n[r],delete n[r]);return n},Qh=function(t,e){void 0===e&&(e=!0);var i="".concat(t,"State"),n="".concat(t,"Style"),r="".concat(t,"StyleSave");this[i]!==e&&(this[i]=e,e?this[r]=this.applyStyle(this[n]):(this.applyStyle(this[r]),this[r]=void 0));},tl={addStyleManager:function(t){return this.styleManager=new Zh(this,t),this},setActiveState:function(t){return this.styleManager.setActiveState(t),this},setHoverState:function(t){return this.styleManager.setHoverState(t),this},setDisableState:function(t){return this.styleManager.setDisableState(t),this}},el=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),void 0===n&&(n={}),(r=i.call(this,t,n)).type="rexStatesRoundRectangleShape",n.style=a(r),n.propertiesMap=il,r.addStyleManager(n),delete n.style,delete n.propertiesMap,r}return n(s)}(Uh),il={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(el.prototype,tl);var nl=function(t,e){if(!t)return !1;if(t.hasOwnProperty(e))return !0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return !0;t=t.__proto__;}return !1},rl=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},sl=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,n=e.length;i<n;i++)t[e[i]]=null;return t},t.on("destroy",t.clearAllEffects,t)),t._effectSwitchNames.push(e);},ol=function(t,e,i){if(nl(t,e))return t;var n=rl(t);if(!n)return t;var r,s="_".concat(e,"Effect");return Object.defineProperty(t,e,{get:function(){return r},set:function(o){r!==o&&(null===(r=o)||!1===r?t[s]&&(n.remove(t[s]),t[s]=void 0):(t[s]||(t[s]=n.addColorMatrix()),t[s][e](1===i?o:void 0)));}}),t[e]=null,sl(t,e),t},al={barrel:function(t){if(nl(t,"barrel"))return t;var e,i=rl(t);return i?(Object.defineProperty(t,"barrel",{get:function(){return e},set:function(n){e!==n&&(null===(e=n)||!1===e?t._barrelEffect&&(i.remove(t._barrelEffect),t._barrelEffect=void 0):(t._barrelEffect||(t._barrelEffect=i.addBarrel()),t._barrelEffect.amount=e));}}),t.barrel=null,sl(t,"barrel"),t):t},blackWhite:function(t){return ol(t,"blackWhite"),t},bloom:function(t){if(nl(t,"bloomColor"))return t;var e=rl(t);if(!e)return t;var i,n=1,r=1,s=1,o=1,a=4;return Object.defineProperty(t,"bloomColor",{get:function(){return i},set:function(h){i!==h&&(null===(i=h)||!1===i?t._bloom&&(e.remove(t._bloom),t._bloom=void 0,e.setPadding(0)):(t._bloom||(t._bloom=e.addBloom(i,n,r,s,o,a),e.setPadding(Math.max(n,r)+1)),t._bloom.color=i));}}),Object.defineProperty(t,"bloomOffsetX",{get:function(){return n},set:function(i){if(n!==i&&(n=i,t._bloom)){var s=Math.max(n,r);e.setPadding(s+1),t._bloom.offsetX=n;}}}),Object.defineProperty(t,"bloomOffsetY",{get:function(){return r},set:function(i){if(r!==i&&(r=i,t._bloom)){var s=Math.max(n,r);e.setPadding(s+1),t._bloom.offsetY=r;}}}),Object.defineProperty(t,"bloomBlurStrength",{get:function(){return s},set:function(e){s!==e&&(s=e,t._bloom&&(t._bloom.blurStrength=s));}}),Object.defineProperty(t,"bloomStrength",{get:function(){return o},set:function(e){o!==e&&(o=e,t._bloom&&(t._bloom.strength=o));}}),Object.defineProperty(t,"bloomSteps",{get:function(){return a},set:function(e){a!==e&&(a=e,t._bloom&&(t._bloom.steps=a));}}),t.bloomColor=null,sl(t,"bloomColor"),t},blur:function(t){if(nl(t,"blurColor"))return t;var e=rl(t);if(!e)return t;var i,n=0,r=1,s=1,o=1,a=4;return Object.defineProperty(t,"blurColor",{get:function(){return i},set:function(h){i!==h&&(null===(i=h)||!1===i?t._blur&&(e.remove(t._blur),t._blur=void 0,e.setPadding(0)):(t._blur||(t._blur=e.addBlur(n,r,s,o,i,a),e.setPadding(Math.max(r,s)+1)),t._blur.color=i));}}),Object.defineProperty(t,"blurQuality",{get:function(){return n},set:function(e){n!==e&&(n=e,t._blur&&(t._blur.quality=n));}}),Object.defineProperty(t,"blurX",{get:function(){return r},set:function(i){if(r!==i&&(r=i,t._blur)){var n=Math.max(r,s);e.setPadding(n+1),t._blur.x=r;}}}),Object.defineProperty(t,"blurY",{get:function(){return s},set:function(i){if(s!==i&&(s=i,t._blur)){var n=Math.max(r,s);e.setPadding(n+1),t._blur.y=s;}}}),Object.defineProperty(t,"blurStrength",{get:function(){return o},set:function(e){o!==e&&(o=e,t._blur&&(t._blur.strength=o));}}),Object.defineProperty(t,"blurSteps",{get:function(){return a},set:function(e){a!==e&&(a=e,t._blur&&(t._blur.steps=a));}}),t.blurColor=null,sl(t,"blurColor"),t},bokeh:function(t){if(nl(t,"bokehRadius"))return t;var e=rl(t);if(!e)return t;var i,n=1,r=.2;return Object.defineProperty(t,"bokehRadius",{get:function(){return i},set:function(s){i!==s&&(null===(i=s)||!1===i?t._bokeh&&(e.remove(t._bokeh),t._bokeh=void 0):(t._bokeh||(t._bokeh=e.addBokeh(i,n,r)),t._bokeh.radius=i));}}),Object.defineProperty(t,"bokehAmount",{get:function(){return n},set:function(e){n!==e&&(n=e,t._bokeh&&(t._bokeh.amount=n));}}),Object.defineProperty(t,"bokehContrast",{get:function(){return r},set:function(e){r!==e&&(r=e,t._bokeh&&(t._bokeh.contrast=r));}}),t.bokehRadius=null,sl(t,"bokehRadius"),t},brightness:function(t){return ol(t,"brightness",1),t},brown:function(t){return ol(t,"brown"),t},circle:function(t){if(nl(t,"circleColor"))return t;var e=rl(t);if(!e)return t;var i,n=8,r=0,s=.4,o=1,a=.005;return Object.defineProperty(t,"circleColor",{get:function(){return i},set:function(h){i!==h&&(null===(i=h)||!1===i?t._circle&&(e.remove(t._circle),t._circle=void 0):(t._circle||(t._circle=e.addCircle(n,i,r,o,a),t.circleBackgroundAlpha=s),t._circle.color=i));}}),Object.defineProperty(t,"circleThickness",{get:function(){return n},set:function(e){n!==e&&(n=e,t._circle&&(t._circle.thickness=n));}}),Object.defineProperty(t,"circleBackgroundColor",{get:function(){return r},set:function(e){r!==e&&(r=e,t._circle&&(t._circle.backgroundColor=r));}}),Object.defineProperty(t,"circleBackgroundAlpha",{get:function(){return s},set:function(e){s!==e&&(s=e,t._circle&&(t._circle.glcolor2[3]=s));}}),Object.defineProperty(t,"circleScale",{get:function(){return o},set:function(e){o!==e&&(o=e,t._circle&&(t._circle.scale=o));}}),Object.defineProperty(t,"circleFeather",{get:function(){return a},set:function(e){a!==e&&(a=e,t._circle&&(t._circle.feather=a));}}),t.circleColor=null,sl(t,"circleColor"),t},contrast:function(t){return ol(t,"contrast",1),t},desaturate:function(t){return ol(t,"desaturate",1),t},desaturateLuminance:function(t){return ol(t,"desaturateLuminance"),t},displacement:function(t){if(nl(t,"displacementKey"))return t;var e=rl(t);if(!e)return t;var i,n=.005,r=.005;return Object.defineProperty(t,"displacementKey",{get:function(){return i},set:function(s){i!==s&&(null===(i=s)||!1===i?t._displacement&&(e.remove(t._displacement),t._displacement=void 0):(t._displacement||(t._displacement=e.addDisplacement(i,n,r)),t._displacement.setTexture(i)));}}),Object.defineProperty(t,"displacementX",{get:function(){return n},set:function(e){n!==e&&(n=e,t._displacement&&(t._displacement.x=n));}}),Object.defineProperty(t,"displacementY",{get:function(){return r},set:function(e){r!==e&&(r=e,t._displacement&&(t._displacement.y=r));}}),t.displacementKey=null,sl(t,"displacementKey"),t},glow:function(t){if(nl(t,"glowColor"))return t;var e=rl(t);if(!e)return t;var i,n=4,r=0;return Object.defineProperty(t,"glowColor",{get:function(){return i},set:function(s){i!==s&&(null===(i=s)||!1===i?t._glow&&(e.remove(t._glow),t._glow=void 0,e.setPadding(0)):(t._glow||(t._glow=e.addGlow(i,n,r),e.setPadding(n+1)),t._glow.color=i));}}),Object.defineProperty(t,"glowOuterStrength",{get:function(){return n},set:function(i){n!==i&&(n=i,t._glow&&(e.setPadding(n+1),t._glow.outerStrength=n));}}),Object.defineProperty(t,"glowInnerStrength",{get:function(){return r},set:function(e){r!==e&&(r=e,t._glow&&(t._glow.innerStrength=r));}}),t.glowColor=null,sl(t,"glowColor"),t},gradient:function(t){if(nl(t,"gradientColor"))return t;var e=rl(t);if(!e)return t;var i,n,r=.5,s=0,o=0,a=0,h=1,l=0;return Object.defineProperty(t,"gradientColor",{get:function(){return [i,n]},set:function(u){var c,d;null===u||!1===u?(c=null,d=null):(c=u[0],d=u[1]),i===c&&n===d||(n=d,null===(i=c)||!1===i?t._gradient&&(e.remove(t._gradient),t._gradient=void 0):(t._gradient||(t._gradient=e.addGradient(i,n,r,s,o,a,h,l)),t._gradient.color1=i,t._gradient.color2=n));}}),Object.defineProperty(t,"gradientColor1",{get:function(){return i},set:function(e){null!==e&&!1!==e?i!==e&&(i=e,t._gradient&&(t._gradient.color1=i)):t.gradientColor=e;}}),Object.defineProperty(t,"gradientColor2",{get:function(){return n},set:function(e){null!==e&&!1!==e?n!==e&&(n=e,t._gradient&&(t._gradient.color2=n)):t.gradientColor=e;}}),Object.defineProperty(t,"gradientAlpha",{get:function(){return r},set:function(e){r!==e&&(r=e,t._gradient&&(t._gradient.alpha=r));}}),Object.defineProperty(t,"gradientFromX",{get:function(){return s},set:function(e){s!==e&&(s=e,t._gradient&&(t._gradient.fromX=s));}}),Object.defineProperty(t,"gradientFromY",{get:function(){return o},set:function(e){o!==e&&(o=e,t._gradient&&(t._gradient.fromY=o));}}),Object.defineProperty(t,"gradientToX",{get:function(){return a},set:function(e){a!==e&&(a=e,t._gradient&&(t._gradient.toX=a));}}),Object.defineProperty(t,"gradientToY",{get:function(){return h},set:function(e){h!==e&&(h=e,t._gradient&&(t._gradient.toY=h));}}),Object.defineProperty(t,"gradientSize",{get:function(){return l},set:function(e){l!==e&&(l=e,t._gradient&&(t._gradient.size=l));}}),t.gradientColor=null,sl(t,"gradientColor"),t},grayscale:function(t){return ol(t,"grayscale",1),t},hue:function(t){return ol(t,"hue",1),t},kodachrome:function(t){return ol(t,"kodachrome"),t},lsd:function(t){return ol(t,"lsd"),t},negative:function(t){return ol(t,"negative"),t},pixelate:function(t){if(nl(t,"pixelate"))return t;var e,i=rl(t);return i?(Object.defineProperty(t,"pixelate",{get:function(){return e},set:function(n){e!==n&&(null===(e=n)||!1===e?t._pixelateEffect&&(i.remove(t._pixelateEffect),t._pixelateEffect=void 0):(t._pixelateEffect||(t._pixelateEffect=i.addPixelate()),t._pixelateEffect.amount=e));}}),t.pixelate=null,sl(t,"pixelate"),t):t},polaroid:function(t){return ol(t,"polaroid"),t},reveal:function(t){if(nl(t,"revealLeft"))return t;var e=rl(t);if(!e)return t;var i,n,r,s,o=.1,a=function(){i=null,n=null,r=null,s=null;},h=function(t){t._revealEffect&&(e.remove(t._revealEffect),t._revealEffect=void 0);};return Object.defineProperty(t,"revealLeft",{get:function(){return i},set:function(n){i!==n&&(a(),null===(i=n)||!1===i?h(t):(t._revealEffect||(t._revealEffect=e.addReveal(o,0,0)),t._revealEffect.direction=1,t._revealEffect.axis=0,t._revealEffect.progress=i));}}),Object.defineProperty(t,"revealRight",{get:function(){return n},set:function(i){n!==i&&(a(),null===(n=i)||!1===n?h(t):(t._revealEffect||(t._revealEffect=e.addReveal(o,0,0)),t._revealEffect.direction=0,t._revealEffect.axis=0,t._revealEffect.progress=n));}}),Object.defineProperty(t,"revealUp",{get:function(){return r},set:function(i){r!==i&&(a(),null===(r=i)||!1===r?h(t):(t._revealEffect||(t._revealEffect=e.addReveal(o,0,0)),t._revealEffect.direction=1,t._revealEffect.axis=1,t._revealEffect.progress=r));}}),Object.defineProperty(t,"revealDown",{get:function(){return s},set:function(i){s!==i&&(a(),null===(s=i)||!1===s?h(t):(t._revealEffect||(t._revealEffect=e.addReveal(o,0,0)),t._revealEffect.direction=0,t._revealEffect.axis=1,t._revealEffect.progress=s));}}),Object.defineProperty(t,"revealWidth",{get:function(){return o},set:function(e){o!==e&&(o=e,t._revealEffect&&(t._revealEffect.wipeWidth=o));}}),t.revealLeft=null,sl(t,"revealLeft"),sl(t,"revealRight"),sl(t,"revealUp"),sl(t,"revealDown"),t},saturate:function(t){return ol(t,"saturate",1),t},sepia:function(t){return ol(t,"sepia"),t},shadow:function(t){if(nl(t,"shadowColor"))return t;var e=rl(t);if(!e)return t;var i,n=0,r=0,s=.1,o=1,a=6,h=1;return Object.defineProperty(t,"shadowColor",{get:function(){return i},set:function(l){i!==l&&(null===(i=l)||!1===i?t._shadow&&(e.remove(t._shadow),t._shadow=void 0):(t._shadow||(t._shadow=e.addShadow(n,r,s,o,i,a,h)),t._shadow.color=i));}}),Object.defineProperty(t,"shadowX",{get:function(){return n},set:function(e){n!==e&&(n=e,t._shadow&&(t._shadow.x=n));}}),Object.defineProperty(t,"shadowY",{get:function(){return r},set:function(e){r!==e&&(r=e,t._shadow&&(t._shadow.y=r));}}),Object.defineProperty(t,"decay",{get:function(){return s},set:function(e){s!==e&&(s=e,t._shadow&&(t._shadow.decay=s));}}),Object.defineProperty(t,"shadowPower",{get:function(){return o},set:function(e){o!==e&&(o=e,t._shadow&&(t._shadow.power=o));}}),Object.defineProperty(t,"shadowSamples",{get:function(){return a},set:function(e){a!==e&&(a=e,t._shadow&&(t._shadow.samples=a));}}),Object.defineProperty(t,"shadowIntensity",{get:function(){return h},set:function(e){h!==e&&(h=e,t._shadow&&(t._shadow.intensity=h));}}),t.shadowColor=null,sl(t,"shadowColor"),t},shiftToBGR:function(t){return ol(t,"shiftToBGR"),t},shine:function(t){if(nl(t,"shineSpeed"))return t;var e=rl(t);if(!e)return t;var i,n=.5,r=3;return Object.defineProperty(t,"shineSpeed",{get:function(){return i},set:function(s){i!==s&&(null===(i=s)||!1===i?t._shine&&(e.remove(t._shine),t._shine=void 0):(t._shine||(t._shine=e.addShine(i,n,r)),t._shine.speed=i));}}),Object.defineProperty(t,"shineLineWidth",{get:function(){return n},set:function(e){n!==e&&(n=e,t._shine&&(t._shine.lineWidth=n));}}),Object.defineProperty(t,"shineGradient",{get:function(){return r},set:function(e){r!==e&&(r=e,t._shine&&(t._shine.gradient=r));}}),t.shineSpeed=null,sl(t,"shineSpeed"),t},technicolor:function(t){return ol(t,"technicolor"),t},tiltShift:function(t){if(nl(t,"tiltShiftRadius"))return t;var e=rl(t);if(!e)return t;var i,n=1,r=.2,s=1,o=1,a=1;return Object.defineProperty(t,"tiltShiftRadius",{get:function(){return i},set:function(h){i!==h&&(null===(i=h)||!1===i?t._tiltShift&&(e.remove(t._tiltShift),t._tiltShift=void 0):(t._tiltShift||(t._tiltShift=e.addTiltShift(i,n,r,s,o,a)),t._tiltShift.radius=i));}}),Object.defineProperty(t,"tiltShiftAmount",{get:function(){return n},set:function(e){n!==e&&(n=e,t._tiltShift&&(t._tiltShift.amount=n));}}),Object.defineProperty(t,"tiltShiftContrast",{get:function(){return r},set:function(e){r!==e&&(r=e,t._tiltShift&&(t._tiltShift.contrast=r));}}),Object.defineProperty(t,"tiltShiftBlurX",{get:function(){return s},set:function(e){s!==e&&(s=e,t._tiltShift&&(t._tiltShift.blurX=s));}}),Object.defineProperty(t,"tiltShiftBlurY",{get:function(){return o},set:function(e){o!==e&&(o=e,t._tiltShift&&(t._tiltShift.blurY=o));}}),Object.defineProperty(t,"tiltShiftStrength",{get:function(){return a},set:function(e){a!==e&&(a=e,t._tiltShift&&(t._tiltShift.strength=a));}}),t.tiltShiftRadius=null,sl(t,"tiltShiftRadius"),t},vignette:function(t){if(nl(t,"vignetteColor"))return t;var e=rl(t);if(!e)return t;var i,n=.5,r=.5,s=.5;return Object.defineProperty(t,"vignetteRadius",{get:function(){return i},set:function(o){i!==o&&(null===(i=o)||!1===i?t._vignette&&(e.remove(t._vignette),t._vignette=void 0):(t._vignette||(t._vignette=e.addVignette(n,r,i,s)),t._vignette.radius=i));}}),Object.defineProperty(t,"vignetteX",{get:function(){return n},set:function(e){n!==e&&(n=e,t._vignette&&(t._vignette.x=n));}}),Object.defineProperty(t,"vignetteY",{get:function(){return r},set:function(e){r!==e&&(r=e,t._vignette&&(t._vignette.y=r));}}),Object.defineProperty(t,"vignetteStrength",{get:function(){return s},set:function(e){s!==e&&(s=e,t._vignette&&(t._vignette.strength=s));}}),t.vignetteRadius=null,sl(t,"vignetteRadius"),t},vintagePinhole:function(t){return ol(t,"vintagePinhole"),t},wipe:function(t){if(nl(t,"wipeLeft"))return t;var e=rl(t);if(!e)return t;var i,n,r,s,o=.1,a=function(){i=null,n=null,r=null,s=null;},h=function(t){t._wipeEffect&&(e.remove(t._wipeEffect),t._wipeEffect=void 0);};return Object.defineProperty(t,"wipeLeft",{get:function(){return i},set:function(n){i!==n&&(a(),null===(i=n)||!1===i?h(t):(t._wipeEffect||(t._wipeEffect=e.addWipe(o,0,0)),t._wipeEffect.direction=1,t._wipeEffect.axis=0,t._wipeEffect.progress=i));}}),Object.defineProperty(t,"wipeRight",{get:function(){return n},set:function(i){n!==i&&(a(),null===(n=i)||!1===n?h(t):(t._wipeEffect||(t._wipeEffect=e.addWipe(o,0,0)),t._wipeEffect.direction=0,t._wipeEffect.axis=0,t._wipeEffect.progress=n));}}),Object.defineProperty(t,"wipeUp",{get:function(){return r},set:function(i){r!==i&&(a(),null===(r=i)||!1===r?h(t):(t._wipeEffect||(t._wipeEffect=e.addWipe(o,0,0)),t._wipeEffect.direction=1,t._wipeEffect.axis=1,t._wipeEffect.progress=r));}}),Object.defineProperty(t,"wipeDown",{get:function(){return s},set:function(i){s!==i&&(a(),null===(s=i)||!1===s?h(t):(t._wipeEffect||(t._wipeEffect=e.addWipe(o,0,0)),t._wipeEffect.direction=0,t._wipeEffect.axis=1,t._wipeEffect.progress=s));}}),Object.defineProperty(t,"wipeWidth",{get:function(){return o},set:function(e){o!==e&&(o=e,t._wipeEffect&&(t._wipeEffect.wipeWidth=o));}}),t.wipeLeft=null,sl(t,"wipeLeft"),sl(t,"wipeRight"),sl(t,"wipeUp"),sl(t,"wipeDown"),t}},hl=function(t,e){if(void 0===e)e=!0;else if("string"==typeof e)e={config:!0};else if(Array.isArray(e))for(var i=e,n=(e={},0),r=i.length;n<r;n++)e[i[n]]=!0;if(!0===e)for(var s in al)al[s](t);else for(var s in e)e[s]&&al[s]&&al[s](t);return t},ll=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),h(r=i.call(this,t),new Proxy(a(r),a(r)))}return n(s,[{key:"get",value:function(t,e){if(nl(t,e))return t[e];var i=t.parent;return nl(i,e)?i[e]:void 0}},{key:"set",value:function(t,e,i){return nl(t,e)?t[e]=i:nl(t.parent,e)&&(t.parent[e]=i),!0}},{key:"key",get:function(){return this.parent.texture.key},set:function(t){this.parent.setTexture(t,this.frame);}},{key:"frame",get:function(){return this.parent.frame.name},set:function(t){this.parent.setFrame(t);}},{key:"leftWidth",get:function(){return this.parent.leftWidth},set:function(t){var e=this.parent;parent.setSlices(e.width,e.height,t,e.rightWidth,e.topHeight,e.bottomHeight);}},{key:"rightWidth",get:function(){return this.parent.rightWidth},set:function(t){var e=this.parent;parent.setSlices(e.width,e.height,e.leftWidth,t,e.topHeight,e.bottomHeight);}},{key:"topHeight",get:function(){return this.parent.topHeight},set:function(t){var e=this.parent;parent.setSlices(e.width,e.height,e.leftWidth,e.rightWidth,t,e.bottomHeight);}},{key:"bottomHeight",get:function(){return this.parent.bottomHeight},set:function(t){var e=this.parent;parent.setSlices(e.width,e.height,e.leftWidth,e.rightWidth,e.topHeight,t);}}]),s}(ai),ul=Phaser.GameObjects.NineSlice,cl=Phaser.Utils.Objects.GetValue,dl=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={});var o=cl(n,"x",0),h=cl(n,"y",0),l=cl(n,"key",null),u=cl(n,"frame",null),c=cl(n,"width",0),d=cl(n,"height",0),f=cl(n,"leftWidth",0),p=cl(n,"rightWidth",0),v=cl(n,"topHeight",0),g=cl(n,"bottomHeight",0);(r=i.call(this,t,o,h,l,u,c,d,f,p,v,g)).type="rexStatesNineSlice";var y=cl(n,"effects",!0);return y&&hl(a(r),y),r.style=new ll(a(r),n),n.style=r.style,r.addStyleManager(n),delete n.style,r}return n(s)}(ul);Object.assign(dl.prototype,tl);var fl=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),h(r=i.call(this,t),new Proxy(a(r),a(r)))}return n(s,[{key:"get",value:function(t,e){if(nl(t,e))return t[e];var i=t.parent;return nl(i,e)?i[e]:void 0}},{key:"set",value:function(t,e,i){return nl(t,e)?t[e]=i:nl(t.parent,e)&&(t.parent[e]=i),!0}},{key:"key",get:function(){return this.parent.texture.key},set:function(t){this.parent.setTexture(t,this.frame);}},{key:"frame",get:function(){return this.parent.frame.name},set:function(t){this.parent.setFrame(t);}},{key:"scale",get:function(){return this.parent.scaleX},set:function(t){this.parent.setScale(t);}}]),s}(ai),pl=Phaser.GameObjects.Image,vl=Phaser.Utils.Objects.GetValue,gl=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={});var o=vl(n,"x",0),h=vl(n,"y",0),l=vl(n,"key",""),u=vl(n,"frame",void 0);(r=i.call(this,t,o,h,l,u)).type="rexStatesImage";var c=vl(n,"effects",!0);return c&&hl(a(r),c),r.style=new fl(a(r),n),n.style=r.style,r.addStyleManager(n),delete n.style,r}return n(s)}(pl);Object.assign(gl.prototype,tl);var yl=function(t,e,i){return "__BASE"===i?"".concat(t,",").concat(e):"".concat(i,"_").concat(t,",").concat(e)},ml=Phaser.Utils.Objects.IsPlainObject,kl=Phaser.Utils.Objects.GetValue,bl=function(t){return "string"==typeof t&&(t=xl[t]),t},xl={scale:0,repeat:1},wl=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Sl={_beginDraw:Qt,_drawImage:Qt,_drawTileSprite:Qt,_endDraw:Qt,setGetFrameNameCallback:function(t){return void 0===t&&(t=yl),this.getFrameNameCallback=t,this},setBaseTexture:function(e,i,n,r){Array.isArray(i)&&(r=n,n=i,i=void 0),null==i&&(i="__BASE"),"number"==typeof n&&arguments.length>=6?(n=[arguments[2],void 0,arguments[3]],r=[arguments[4],void 0,arguments[5]]):(n=Ph(n),r=Ph(r)),this.textureKey=e,this.baseFrameName=i,this.columns.data=n,this.columns.count=n?n.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=r,this.rows.count=r?r.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var s=this.scene.sys.textures.get(e);if(!s)return this.clear(),this;if(!n||!r)return this.clear(),this;for(var o=s.get(i),a=o.width,h=0,l=0,u=n.length;l<u;l++)void 0===n[l]?h++:"number"==typeof n[l]?a-=n[l]:a-=n[l].width;var c=a/h,d=o.height,f=0;for(l=0,u=r.length;l<u;l++)void 0===r[l]?f++:"number"==typeof r[l]?d-=r[l]:d-=r[l].width;for(var p,v,g,y,m,k=d/f,b=0,x=0,w=0,S=r.length;w<S;w++){void 0===r[w]&&(r[w]=k),"number"==typeof r[w]&&(r[w]={height:r[w],stretch:w%2}),g=(p=r[w]).height,this.rows.stretch+=0|p.stretch,this.rows.minHeight+=p.stretch>0?0:g,b=0;l=0;for(var C=n.length;l<C;l++){if(void 0===n[l]&&(n[l]=c),"number"==typeof n[l]&&(n[l]={width:n[l],stretch:l%2}),y=(v=n[l]).width,0===w&&(this.columns.stretch+=0|v.stretch,this.columns.minWidth+=v.stretch>0?0:y),y>=1&&g>=1){var O=t(m=this.getFrameNameCallback(l,w,i));"string"!==O&&"number"!==O||s.add(m,0,b+o.cutX,x+o.cutY,y,g);}b+=y;}x+=g;}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,n,r,s,o,a,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,u=this.width-h,c=this.height-l,d=u>=0?this.maxFixedPartScaleX:this.width/h,f=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var p=Math.min(d,f);if(d>p){var v=(d-p)*h;u>=0?u+=v:u=v,d=p;}if(f>p){var g=(f-p)*l;c>=0?c+=g:c=g,f=p;}}this.columns.scale=d,this.rows.scale=f,e=u>0&&this.columns.stretch>0?u/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var y=0,m=0;this._beginDraw();for(var k=0,b=this.rows.count;k<b;k++){a=0===(s=this.rows.data[k]).stretch?s.height*f:i*s.stretch,y=0;for(var x=0,w=this.columns.count;x<w;x++)o=0===(r=this.columns.data[x]).stretch?r.width*d:e*r.stretch,n=this.getFrameNameCallback(x,k,this.baseFrameName),t.has(n)&&o>0&&a>0&&(0===(0===s.stretch&&0===r.stretch||0===this.getStretchMode(x,k)?0:1)?this._drawImage(this.textureKey,n,y,m,o,a):this._drawTileSprite(this.textureKey,n,y,m,o,a)),y+=o;m+=a;}this._endDraw();},setStretchMode:function(t){return ml(t)?(this.stretchMode.edge=bl(kl(t,"edge",0)),this.stretchMode.internal=bl(kl(t,"internal",0))):(t=bl(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return wl.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}},Cl=Phaser.Utils.Objects.IsPlainObject,Ol=Phaser.Utils.Objects.GetValue,_l=Phaser.GameObjects,Pl=void 0,Tl=function(t,e){if(Pl||(Pl={},si(t).events.once("destroy",(function(){for(var t in Pl)Pl[t].destroy();Pl=void 0;}))),!Pl.hasOwnProperty(e)){var i=si(t).scene.systemScene;(t=new _l[e](i)).setOrigin(0),Pl[e]=t;}return Pl[e]},El=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s)}(function(t,i){var o=function(t){r(a,t);var o=l(a);function a(t,n,r,s,h,l,u,c,d,f){var p;if(e(this,a),Cl(n)?(n=Ol(f=n,"x",0),r=Ol(f,"y",0),s=Ol(f,"width",1),h=Ol(f,"height",1),l=Ol(f,"key",void 0),u=Ol(f,"baseFrame",void 0),c=Ol(f,"columns",void 0),d=Ol(f,"rows",void 0)):Cl(s)?(s=Ol(f=s,"width",1),h=Ol(f,"height",1),l=Ol(f,"key",void 0),u=Ol(f,"baseFrame",void 0),c=Ol(f,"columns",void 0),d=Ol(f,"rows",void 0)):Cl(l)?(l=Ol(f=l,"key",void 0),u=Ol(f,"baseFrame",void 0),c=Ol(f,"columns",void 0),d=Ol(f,"rows",void 0)):Cl(u)?(u=Ol(f=u,"baseFrame",void 0),c=Ol(f,"columns",void 0),d=Ol(f,"rows",void 0)):Array.isArray(u)?(f=d,d=c,c=u,u=Ol(f,"baseFrame",void 0)):Cl(c)&&(c=Ol(f=c,"columns",void 0),d=Ol(f,"rows",void 0)),void 0===c){var v=Ol(f,"leftWidth",void 0),g=Ol(f,"rightWidth",void 0);void 0!==v&&void 0!==g&&(c=[v,void 0,g]);}if(void 0===d){var y=Ol(f,"topHeight",void 0),m=Ol(f,"bottomHeight",void 0);void 0!==y&&void 0!==m&&(d=[y,void 0,m]);}(p=o.call(this,t)).type=i,p.setPosition(n,r).setSize(s,h).setOrigin(.5,.5),p.columns={},p.rows={},p.stretchMode={},p._tileSprite=void 0,p._image=void 0,p.setGetFrameNameCallback(Ol(f,"getFrameNameCallback",void 0)),p.setStretchMode(Ol(f,"stretchMode",0)),p.setPreserveRatio(Ol(f,"preserveRatio",!0));var k=Ol(f,"maxFixedPartScale",1),b=Ol(f,"maxFixedPartScaleX",k),x=Ol(f,"maxFixedPartScaleY",void 0);return p.setMaxFixedPartScale(b,x),p.setBaseTexture(l,u,c,d),p}return n(a,[{key:"minWidth",get:function(){return this.columns.minWidth}},{key:"minHeight",get:function(){return this.rows.minHeight}},{key:"fixedPartScaleX",get:function(){return this.columns.scale}},{key:"fixedPartScaleY",get:function(){return this.rows.scale}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(c(s(a.prototype),"resize",this)?c(s(a.prototype),"resize",this).call(this,t,e):c(s(a.prototype),"setSize",this).call(this,t,e),this.updateTexture()),this}}]),a}(t);return Object.assign(o.prototype,Sl),o}(Phaser.GameObjects.RenderTexture,"rexNinePatch")),Ml={_drawImage:function(t,e,i,n,r,s){var o=Tl(this,"Image").setTexture(t,e).setDisplaySize(r,s);this.draw(o,i,n);},_drawTileSprite:function(t,e,i,n,r,s){var o=Tl(this,"TileSprite").setTexture(t,e).setSize(r,s);this.draw(o,i,n);}};Object.assign(El.prototype,Ml);var Rl=function(t,e){var i,n;switch(e&&(e.hasOwnProperty("type")?i=e.type:e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"image":n=new gl(t,e);break;case"nineSlice":n=e.hasOwnProperty("stretchMode")?new El(t,e):new dl(t,e);break;default:n=new el(t,e);}return t.add.existing(n),n},Ll=Phaser.GameObjects.Text,zl=Phaser.Utils.Objects.GetValue,Al=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={});var o=zl(n,"x",0),a=zl(n,"y",0),h=zl(n,"text","");return (r=i.call(this,t,o,a,h,n)).type="rexStatesText",n.style=r.style,n.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i);},r.addStyleManager(n),delete n.style,r}return n(s)}(Ll);Object.assign(Al.prototype,tl);
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
var Dl=Phaser.Renderer.WebGL.Utils,Bl={renderWebGL:function(t,e,i,n){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,s=r.width,o=r.height,a=Dl.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,s,o,e.x,e.y,s/e.style.resolution,o/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,s,o,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,n,!1,l),t.pipelines.postBatch(e);}},renderCanvas:function(t,e,i,n){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,n));}},jl=Phaser.Display.Canvas.CanvasPool;m();var Wl=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s,[{key:"setStyle",value:function(t){return this.style.setStyle(t)}},{key:"setFont",value:function(t){return this.style.setFont(t)}},{key:"setFontFamily",value:function(t){return this.style.setFontFamily(t)}},{key:"setFontSize",value:function(t){return this.style.setFontSize(t)}},{key:"setFontStyle",value:function(t){return this.style.setFontStyle(t)}},{key:"setTestString",value:function(t){return this.style.setTestString(t)}},{key:"setFixedSize",value:function(t,e){return this.style.setFixedSize(t,e)}},{key:"setBackgroundColor",value:function(t,e,i){return this.style.setBackgroundColor(t,e,i)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.style.setBackgroundStrokeColor(t,e)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.style.setBackgroundCornerRadius(t,e)}},{key:"setFill",value:function(t){return this.style.setFill(t)}},{key:"setColor",value:function(t){return this.style.setColor(t)}},{key:"setStroke",value:function(t,e){return this.style.setStroke(t,e)}},{key:"setShadow",value:function(t,e,i,n,r,s){return this.style.setShadow(t,e,i,n,r,s)}},{key:"setShadowOffset",value:function(t,e){return this.style.setShadowOffset(t,e)}},{key:"setShadowColor",value:function(t){return this.style.setShadowColor(t)}},{key:"setShadowBlur",value:function(t){return this.style.setShadowBlur(t)}},{key:"setShadowStroke",value:function(t){return this.style.setShadowStroke(t)}},{key:"setShadowFill",value:function(t){return this.style.setShadowFill(t)}},{key:"setWrapMode",value:function(t){return this.style.setWrapMode(t)}},{key:"setWrapWidth",value:function(t){return this.style.setWrapWidth(t)}},{key:"setWordWrapWidth",value:function(t){return this.style.setWrapWidth(t)}},{key:"setAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setHAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setVAlign",value:function(t){return this.style.setVAlign(t)}},{key:"setLineSpacing",value:function(t){return this.style.setLineSpacing(t)}},{key:"lineSpacing",get:function(){return this.style.lineSpacing},set:function(t){this.setLineSpacing(t);}},{key:"setXOffset",value:function(t){return this.style.setXOffset(t)}},{key:"setMaxLines",value:function(t){return this.style.setMaxLines(t)}},{key:"setResolution",value:function(t){return this.style.setResolution(t)}},{key:"getTextMetrics",value:function(){return this.style.getTextMetrics()}},{key:"setTextMetrics",value:function(t,e){return this.style.setTextMetrics(t,e)}},{key:"measureTextMargins",value:function(t,e){return function(t,e,i){void 0===i&&(i={});var n=jl.create(this),r=n.getContext("2d",{willReadFrequently:!0});t.syncFont(n,r);var s=r.measureText(e),o=Math.ceil(s.width*t.baselineX),a=o,h=2*a;if(a=a*t.baselineY|0,n.width=o,n.height=h,r.fillStyle="#f00",r.fillRect(0,0,o,h),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,a),i.left=0,0===o||0===h||!r.getImageData(0,0,o,h))return jl.remove(n),i;for(var l=r.getImageData(0,0,o,h).data,u=!1,c=0;c<o;c++){for(var d=0;d<h;d++)if(255!==l[4*(d*o+c)]){i.left=c,u=!0;break}if(u)break}return jl.remove(n),i}(this.style,t,e)}}]),s}(Phaser.GameObjects.GameObject),Yl=Phaser.GameObjects.Components;Phaser.Class.mixin(Wl,[Yl.Alpha,Yl.BlendMode,Yl.ComputedSize,Yl.Crop,Yl.Depth,Yl.Flip,Yl.GetBounds,Yl.Mask,Yl.Origin,Yl.Pipeline,Yl.PostPipeline,Yl.ScrollFactor,Yl.Tint,Yl.Transform,Yl.Visible,Bl]);var Xl=Phaser.Utils.String.Pad,Il=function(e,i,n){if(null==e)return e;switch(t(e)){case"string":default:return e;case"number":return "#".concat(Xl(Math.floor(e).toString(16),6,"0",1));case"function":return e(i,n);case"object":return e.hasOwnProperty("r")?e.hasOwnProperty("a")?"rgba(".concat(e.r,",").concat(e.g,",").concat(e.b,",").concat(e.a,")"):"rgb(".concat(e.r,",").concat(e.g,",").concat(e.b,")"):e.hasOwnProperty("h")?e.hasOwnProperty("a")?"hsla(".concat(e.h,",").concat(e.s,",").concat(e.l,",").concat(e.a,")"):"hsl(".concat(e.h,",").concat(e.s,",").concat(e.l,")"):e}},Hl={backgroundColor:["backgroundColor",null,Il],backgroundColor2:["backgroundColor2",null,Il],backgroundHorizontalGradient:["backgroundHorizontalGradient",!0,null],backgroundStrokeColor:["backgroundStrokeColor",null,Il],backgroundStrokeLineWidth:["backgroundStrokeLineWidth",2,null],backgroundCornerRadius:["backgroundCornerRadius",0,null],backgroundCornerIteration:["backgroundCornerIteration",null,null],fontFamily:["fontFamily","Courier",null],fontSize:["fontSize","16px",null],fontStyle:["fontStyle","",null],color:["color","#fff",Il],stroke:["stroke","#fff",Il],strokeThickness:["strokeThickness",0,null],shadowOffsetX:["shadow.offsetX",0,null],shadowOffsetY:["shadow.offsetY",0,null],shadowColor:["shadow.color","#000",Il],shadowBlur:["shadow.blur",0,null],shadowStroke:["shadow.stroke",!1,null],shadowFill:["shadow.fill",!1,null],underlineColor:["underline.color","#000",Il],underlineThickness:["underline.thickness",0,null],underlineOffset:["underline.offset",0,null],strikethroughColor:["strikethrough.color","#000",Il],strikethroughThickness:["strikethrough.thickness",0,null],strikethroughOffset:["strikethrough.offset",0,null],halign:["halign","left",null],valign:["valign","top",null],maxLines:["maxLines",0,null],fixedWidth:["fixedWidth",0,null],fixedHeight:["fixedHeight",0,null],resolution:["resolution",0,null],lineSpacing:["lineSpacing",0,null],xOffset:["xOffset",0,null],rtl:["rtl",!1,null],testString:["testString","|MÉqgy",null],baselineX:["baselineX",1.2,null],baselineY:["baselineY",1.4,null],wrapMode:["wrap.mode",0,null],wrapWidth:["wrap.width",0,null],wrapCallback:["wrap.callback",null],wrapCallbackScope:["wrap.callbackScope",null]},Fl=Phaser.Display.Canvas.CanvasPool,Nl=function(t){var e=Fl.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var n=i.measureText(t.testString);if("actualBoundingBoxAscent"in n){var r=n.actualBoundingBoxAscent,s=n.actualBoundingBoxDescent,o={ascent:r,descent:s,fontSize:r+s};return Fl.remove(e),o}var a=Math.ceil(n.width*t.baselineX),h=a,l=2*h;h=h*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,h);o={ascent:0,descent:0,fontSize:0};if(!i.getImageData(0,0,a,l))return o.ascent=h,o.descent=h+6,o.fontSize=o.ascent+o.descent,Fl.remove(e),o;var u,c,d=i.getImageData(0,0,a,l).data,f=d.length,p=4*a,v=0,g=!1;for(u=0;u<h;u++){for(c=0;c<p;c+=4)if(255!==d[v+c]){g=!0;break}if(g)break;v+=p;}for(o.ascent=h-u,v=f-p,g=!1,u=l;u>h;u--){for(c=0;c<p;c+=4)if(255!==d[v+c]){g=!0;break}if(g)break;v-=p;}return o.descent=u-h,o.fontSize=o.ascent+o.descent,Fl.remove(e),o},Gl=0,Vl=1,Ul=2,Jl=0,Kl=1,ql=2,Zl=/(?:\r\n|\r|\n)/,$l=Phaser.Utils.Objects.GetAdvancedValue,Ql=Phaser.Utils.Objects.GetValue,tu=function(){function t(i,n,r){e(this,t),this.parent=i,void 0===r&&(r=Hl),this.propertyMap=r,this.backgroundColor,this.backgroundColor2,this.backgroundHorizontalGradient,this.backgroundStrokeColor,this.backgroundStrokeLineWidth,this.backgroundCornerRadius,this.backgroundCornerIteration,this.fontFamily,this.fontSize,this.fontStyle,this.color,this.stroke,this.strokeThickness,this.shadowOffsetX,this.shadowOffsetY,this.shadowColor,this.shadowBlur,this.shadowStroke,this.shadowFill,this.underlineColor,this.underlineThickness,this.underlineOffset,this.strikethroughColor,this.strikethroughThickness,this.strikethroughOffset,this.halign,this.valign,this.maxLines,this.fixedWidth,this.fixedHeight,this.resolution,this.lineSpacing,this.xOffset,this.rtl,this.testString,this.baselineX,this.baselineY,this.wrapMode,this.wrapWidth,this.wrapCallback,this.wrapCallbackScope,this._font,this.setStyle(n,!1,!0);}return n(t,[{key:"isWrapFitMode",get:function(){return this.fixedWidth>0&&this.wrapMode!==Jl&&0===this.wrapWidth}},{key:"setStyle",value:function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wrap")){var n=t.wrap;if(n.hasOwnProperty("mode")){var r=n.mode;"string"==typeof r&&(n.mode=eu[r]);}else n.hasOwnProperty("width")&&(n.mode=1);}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var s=this.propertyMap;for(var o in s){var a=s[o],h=a[0],l=i?a[1]:this[o],u=a[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=Ql(t,h,l);else {var c=$l(t,h,l);u&&(c=u(c)),this[o]=c;}}var d=Ql(t,"font",null);this._font=null===d?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:d;var f=Ql(t,"fill",null);null!==f&&(this.color=Il(f));var p=Ql(t,"metrics",!1);return p?this.metrics={ascent:Ql(p,"ascent",0),descent:Ql(p,"descent",0),fontSize:Ql(p,"fontSize",0)}:!e&&this.metrics||(this.metrics=Nl(this)),e?this.parent.updateText():this.parent}},{key:"syncFont",value:function(t,e){e.font=this._font;}},{key:"syncStyle",value:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round";}},{key:"syncShadow",value:function(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0);}},{key:"update",value:function(t){return t&&(this._font="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim(),this.metrics=Nl(this)),this.parent.updateText(t)}},{key:"buildFont",value:function(){var t="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim();return t!==this._font&&(this._font=t),this}},{key:"setFont",value:function(t){return "string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Ql(t,"fontFamily","Courier"),this.fontSize=Ql(t,"fontSize","16px"),this.fontStyle=Ql(t,"fontStyle","")),this.update(!0)}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.update(!0)}},{key:"setFontStyle",value:function(t){return this.fontStyle=t,this.update(!0)}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}},{key:"setTestString",value:function(t){return this.testString=t,this.update(!0)}},{key:"setFixedSize",value:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}},{key:"setResolution",value:function(t){return this.resolution=t,this.update(!1)}},{key:"setLineSpacing",value:function(t){return this.lineSpacing=t,this.update(!1)}},{key:"setXOffset",value:function(t){return this.xOffset=t,this.update(!1)}},{key:"setBackgroundColor",value:function(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Il(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Il(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.backgroundStrokeColor=Il(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}},{key:"setFill",value:function(t){return this.color=Il(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setColor",value:function(t){return this.color=Il(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStroke",value:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Il(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}},{key:"setShadow",value:function(t,e,i,n,r,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===r&&(r=!1),void 0===s&&(s=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Il(i,this.parent.canvas,this.parent.context),this.shadowBlur=n,this.shadowStroke=r,this.shadowFill=s,this.update(!1)}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}},{key:"setShadowColor",value:function(t){return void 0===t&&(t="#000"),this.shadowColor=Il(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}},{key:"setShadowStroke",value:function(t){return this.shadowStroke=t,this.update(!1)}},{key:"setShadowFill",value:function(t){return this.shadowFill=t,this.update(!1)}},{key:"setUnderline",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Il(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}},{key:"setUnderlineColor",value:function(t){return void 0===t&&(t="#000"),this.underlineColor=Il(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setUnderlineThickness",value:function(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}},{key:"setUnderlineOffset",value:function(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}},{key:"setStrikethrough",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Il(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}},{key:"setStrikethroughColor",value:function(t){return void 0===t&&(t="#000"),this.strikethroughColor=Il(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStrikethroughThickness",value:function(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}},{key:"setStrikethroughOffset",value:function(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}},{key:"setWrapMode",value:function(t){return "string"==typeof t&&(t=eu[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}},{key:"setWrapWidth",value:function(t){return this.wrapWidth=t,this.update(!1)}},{key:"setAlign",value:function(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}},{key:"setHAlign",value:function(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}},{key:"setVAlign",value:function(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}},{key:"setMaxLines",value:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}},{key:"getTextMetrics",value:function(){var t=this.metrics;return {ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}},{key:"setTextMetrics",value:function(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Ql(e,"fontFamily",this.fontFamily),this.fontSize=Ql(e,"fontSize",this.fontSize),this.fontStyle=Ql(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}},{key:"lineHeight",get:function(){return this.metrics.fontSize+this.strokeThickness+this.lineSpacing}},{key:"toJSON",value:function(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}},{key:"destroy",value:function(){this.parent=void 0;}}]),t}(),eu={none:Jl,word:Kl,char:ql,character:ql},iu=Phaser.Math.DegToRad,nu=function(t){return !t.hasOwnProperty("convex")||t.convex},ru=function(t){return t.x>0&&t.y>0},su=function(t,e,i,n,r,s,o,a,h){if(a&&o>s?o-=360:!a&&o<s&&(o+=360),s=iu(s),o=iu(o),null==h)t.ellipse(e,i,n,r,0,s,o,a);else for(var l,u,c,d=(o-s)/(h+=1),f=0;f<=h;f++)c=s+d*f,l=e+n*Math.cos(c),u=i+r*Math.sin(c),t.lineTo(l,u);},ou=function(t,e,i,n,r,s,o,a,h,l,u,c,d){if(function(t,e,i,n,r,s,o){var a,h,l,u,c,d=new Rh(e,i,n,r,s),f=d.minWidth,p=d.minHeight,v=n>=f?1:n/f,g=r>=p?1:r/p,y=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=y.tl,ru(a)?(h=a.x*v,l=a.y*g,nu(a)?su(t,h,l,h,l,180,270,!1,o):su(t,0,0,h,l,90,0,!0,o),u=0,c=l):(t.lineTo(0,0),u=0,c=0),a=y.tr,ru(a)?(h=a.x*v,l=a.y*g,nu(a)?su(t,n-h,l,h,l,270,360,!1,o):su(t,n,0,h,l,180,90,!0,o)):t.lineTo(n,0),a=y.br,ru(a)?(h=a.x*v,l=a.y*g,nu(a)?su(t,n-h,r-l,h,l,0,90,!1,o):su(t,n,r,h,l,270,180,!0,o)):t.lineTo(n,r),a=y.bl,ru(a)?(h=a.x*v,l=a.y*g,nu(a)?su(t,h,r-l,h,l,90,180,!1,o):su(t,0,r,h,l,360,270,!0,o)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore();}(e,i,n,r,s,o,d),null!=a){var f;if(null!=u)(f=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,a),f.addColorStop(1,u),a=f;e.fillStyle=a,e.fill();}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke());},au=function(t,e,i,n,r,s,o,a){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(n=0);var u=n/2;h=Math.max(1,h-n),l=Math.max(1,l-n),ou(t.canvas,t.context,u,u,h,l,r,e,i,n,s,o,a);}},hu={draw:function(t,e,i,n){var r=this.penManager;this.hitAreaManager.clear();var s=this.context;s.save();var o=this.defaultStyle;this.clear(),au(this,o.backgroundColor,o.backgroundStrokeColor,o.backgroundStrokeLineWidth,o.backgroundCornerRadius,o.backgroundColor2,o.backgroundHorizontalGradient,o.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,h,l,u,c,d,f=o.halign,p=o.valign,v=o.lineHeight,g=r.lines,y=g.length,m=o.maxLines;m>0&&y>m?(h=m,l="center"===p?Math.floor((y-h)/2):"bottom"===p?y-h:0):(h=y,l=0),u=l+h;var k=this.rtl,b=k?this.parent.width:void 0;d="center"===p?Math.max((n-h*v)/2,0):"bottom"===p?Math.max(n-h*v-2,0):0,d+=e;for(var x=l;x<u;x++)if(0!==(a=r.getLineWidth(x))){for(var w=g[x],S=w.length,C=f,O=0;O<S;O++){var _=w[O].prop.align;if(void 0!==_){C=_;break}}c="center"===C?(i-a)/2:"right"===C?k?0:i-a:k?i-a:0,c+=t;for(O=0;O<S;O++)this.drawPen(w[O],c,d,b);}s.restore();},drawPen:function(t,e,i,n){e+=t.x,i+=t.y+(t.prop.y||0),void 0!==n&&(e=n-e);var r=this.canvas,s=this.context;s.save();var o=this.parser.propToContextStyle(this.defaultStyle,t.prop);if(o.buildFont(),o.syncFont(r,s),o.syncStyle(r,s),o.underlineThickness>0&&t.width>0){var a=i+o.underlineOffset-o.underlineThickness/2;this.drawLine(e,a,t.width,o.underlineThickness,o.underlineColor,o);}if(t.isTextPen&&this.drawText(e,i,t.text,o),t.isImagePen&&this.drawImage(e,i,t.prop.img,o),o.strikethroughThickness>0&&t.width>0){a=i+o.strikethroughOffset-o.strikethroughThickness/2;this.drawLine(e,a,t.width,o.strikethroughThickness,o.strikethroughColor,o);}if(s.restore(),t.hasAreaMarker&&t.width>0){var h,l=t.prop.area;if(l)h={key:l};else {var u=t.prop.url;h={key:"url:".concat(u),url:u};}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,h);}},clear:function(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height);},drawLine:function(t,e,i,n,r,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var o=this.context;s.syncShadow(o,s.shadowStroke);var a=o.lineCap;o.lineCap="butt",o.strokeStyle=r,o.lineWidth=n,o.beginPath(),o.moveTo(t,e),o.lineTo(t+i,e),o.stroke(),o.lineCap=a;},drawText:function(t,e,i,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;n.stroke&&"none"!==n.stroke&&n.strokeThickness>0&&(n.syncShadow(r,n.shadowStroke),r.strokeText(i,t,e)),n.color&&"none"!==n.color&&(n.syncShadow(r,n.shadowFill),r.fillText(i,t,e));},drawImage:function(t,e,i,n){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,this.autoRound);}},lu=Phaser.Utils.Objects.GetValue,uu=Gl,cu=Vl,du=function(){function t(i){e(this,t),this.prop={},this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){this.text=lu(t,"text",""),this.x=lu(t,"x",0),this.y=lu(t,"y",0),this.width=lu(t,"width",0);var e=lu(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=lu(t,"newLineMode",0),this.startIndex=lu(t,"startIndex",0);}},{key:"plainText",get:function(){var t=this.text;return this.newLineMode===cu&&(t+="\n"),t}},{key:"wrapText",get:function(){var t=this.text;return this.newLineMode!==uu&&(t+="\n"),t}},{key:"rawTextLength",get:function(){var t=this.text.length;return this.newLineMode===cu&&(t+=1),t}},{key:"endIndex",get:function(){return this.startIndex+this.rawTextLength}},{key:"lastX",get:function(){return this.x+this.width}},{key:"isTextPen",get:function(){return ""!==this.text}},{key:"isImagePen",get:function(){return !!this.prop.img}},{key:"hasAreaMarker",get:function(){return !!this.prop.area||!!this.prop.url}}]),t}(),fu=Phaser.Utils.Objects.GetFastValue,pu=Gl,vu=Ul,gu=function(){function t(i){e(this,t),this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.tagToText=fu(i,"tagToText",Qt),this.tagToTextScope=fu(i,"tagToTextScope",void 0);}return n(t,[{key:"destroy",value:function(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0;}},{key:"clear",value:function(){for(var t=0,e=this.lines.length;t<e;t++)this.lines[t].length=0;this.pensPool.pushMultiple(this.pens),this.linesPool.pushMultiple(this.lines),this.maxLinesWidth=void 0;}},{key:"addTextPen",value:function(t,e,i,n,r,s){var o=this.pensPool.pop();return null==o&&(o=new du),yu.text=t,yu.x=e,yu.y=i,yu.width=n,yu.prop=r,yu.newLineMode=s,o.resetFromJSON(yu),this.addPen(o),this}},{key:"addImagePen",value:function(t,e,i,n){return this.addTextPen("",t,e,i,n,pu),this}},{key:"addNewLinePen",value:function(){var t=this.lastPen,e=t?t.lastX:0,i=t?t.y:0,n=t?Rt(t.prop):null;return this.addTextPen("",e,i,0,n,vu),this}},{key:"addPen",value:function(t){var e=this.lastPen;t.startIndex=null==e?0:e.endIndex,this.pens.push(t);var i=this.lastLine;null==i&&(i=this.linesPool.pop()||[],this.lines.push(i)),i.push(t),t.newLineMode!==pu&&(i=this.linesPool.pop()||[],this.lines.push(i)),this.maxLinesWidth=void 0;}},{key:"clone",value:function(e){null==e&&(e=new t),e.clear();for(var i=0,n=this.lines.length;i<n;i++)for(var r=this.lines[i],s=0,o=r.length;s<o;s++){var a=r[s];e.addPen(a.text,a.x,a.y,a.width,Rt(a.prop),a.newLineMode);}return e}},{key:"lastPen",get:function(){return this.pens[this.pens.length-1]}},{key:"lastLine",get:function(){return this.lines[this.lines.length-1]}},{key:"getLineStartIndex",value:function(t){if(t>=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}},{key:"getLineEndIndex",value:function(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,n=!1;for(e=t;e>=0&&!(n=null!=(i=this.lines[e])&&i.length>0);e--);return n?i[i.length-1].endIndex:0}},{key:"getLineWidth",value:function(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}},{key:"getMaxLineWidth",value:function(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,n=this.lines.length;i<n;i++)(t=this.getLineWidth(i))>e&&(e=t);return this.maxLinesWidth=e,e}},{key:"getLineWidths",value:function(){for(var t=[],e=0,i=this.lines.length;e<i;e++)t.push(this.getLineWidth(e));return t}},{key:"linesCount",get:function(){return this.lines.length}},{key:"plainText",get:function(){for(var t="",e=this.pens,i=0,n=e.length;i<n;i++)t+=e[i].plainText;return t}},{key:"rawTextLength",get:function(){for(var t=0,e=this.pens,i=0,n=this.pens.length;i<n;i++)t+=e[i].rawTextLength;return t}},{key:"getSliceTagText",value:function(t,e,i){var n=this.lastPen;if(null==n)return "";var r=n.endIndex;void 0!==t&&0!==t||(t=-1),void 0!==e&&e!==r||(e=r+1),void 0===i&&(i=!1);for(var s,o,a,h,l,u,c="",d=0,f=this.pens.length;d<f&&((h=(s=this.pens[d]).endIndex)<=t||(s=this.pens[d],o=i?s.wrapText:s.plainText,l=s.prop,(a=s.startIndex)>=t&&h<=e||(o=o.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,o,l,u):c+=this.tagToText(o,l,u),u=l,!(h>=e)));d++);return c}},{key:"length",get:function(){return this.lines.length},set:function(t){this.clear();}}]),t}(),yu={},mu=function(){function t(){e(this,t),this.items=[];}return n(t,[{key:"destroy",value:function(){this.clear(),this.items=void 0;}},{key:"pop",value:function(){return this.items.length>0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),ku=Phaser.Geom.Rectangle,bu=new mu,xu=function(){function t(){e(this,t),this.hitAreas=[];}return n(t,[{key:"destroy",value:function(){this.clear();}},{key:"clear",value:function(){for(var t=0,e=this.hitAreas.length;t<e;t++)Mt(this.hitAreas[t].data);return bu.pushMultiple(this.hitAreas),this}},{key:"add",value:function(t,e,i,n,r){var s=bu.pop();return null===s?s=new ku(t,e,i,n):s.setTo(t,e,i,n),s.data=r,this.hitAreas.push(s),this}},{key:"getFirst",value:function(t,e){for(var i=0,n=this.hitAreas.length;i<n;i++){var r=this.hitAreas[i];if(r.contains(t,e))return r}return null}},{key:"getByKey",value:function(t){for(var e=0,i=this.hitAreas.length;e<i;e++){var n=this.hitAreas[e];if(n.data.key===t)return n}return null}},{key:"drawBounds",value:function(t,e,i){void 0===e&&(e=16777215),i&&t.save().scaleCanvas(i.scaleX,i.scaleY).rotateCanvas(i.rotation).translateCanvas(i.x,i.y);for(var n=0,r=this.hitAreas.length;n<r;n++){var s=this.hitAreas[n];t.lineStyle(1,e).strokeRect(s.x,s.y,s.width,s.height);}return i&&t.restore(),this}}]),t}(),wu=function(t,e,i,n){var r=this.hitAreaManager.getFirst(e,i);if(null!==r){var s=r.data.key;Ou.call(this,"areadown",s,t,e,i,n),r.data.isDown=!0;}},Su=function(t,e,i,n){var r=this.hitAreaManager.getFirst(e,i);if(null!==r){var s=r.data,o=s.key;if(Ou.call(this,"areaup",o,t,e,i,n),s.isDown){Ou.call(this,"areaclick",o,t,e,i,n);var a=s.url;a&&window.open(a,"_blank");}s.isDown=!1;}},Cu=function(t,e,i,n){if(null!==e){var r=this.hitAreaManager.getFirst(e,i),s=r?r.data.key:null;if(this.lastHitAreaKey!==s){if(null!==this.lastHitAreaKey){Ou.call(this,"areaout",this.lastHitAreaKey,t,e,i,n);var o=this.hitAreaManager.getByKey(this.lastHitAreaKey);this.urlTagCursorStyle&&o.data.url&&(this.scene.input.manager.canvas.style.cursor=""),o.isDown=!1;}null!==s&&(Ou.call(this,"areaover",s,t,e,i,n),this.urlTagCursorStyle&&r.data.url&&(this.scene.input.manager.canvas.style.cursor=this.urlTagCursorStyle)),this.lastHitAreaKey=s;}}else null!==this.lastHitAreaKey&&(Ou.call(this,"areaout",this.lastHitAreaKey,t,e,i,n),this.hitAreaManager.getByKey(this.lastHitAreaKey).isDown=!1,this.lastHitAreaKey=null);},Ou=function(t,e,i,n,r,s){this.parent.emit("".concat(t,"-").concat(e),i,n,r,s),this.parent.emit(t,e,i,n,r,s);},_u=Gl,Pu=Vl,Tu=Ul,Eu=Jl,Mu=Kl,Ru=ql,Lu=Zl,zu=function t(e,i,n,r,s,o){r<=0&&(n=Eu);var a=[];if(!e||!e.length)return a;for(var h,l,u,c=n===Eu,d=n===Mu,f=e.split(Lu),v=0,g=f.length;v<g;v++)if(h=f[v],u=v===g-1?_u:Pu,c){var y=i(h);a.push(o.getLine(h,y,u));}else {var m,k,b,x,w;if(l=0===v?r-s:r,h.length<=100)if((y=i(h))<=l){a.push(o.getLine(h,y,u));continue}d?(k=""===(m=h.split(" "))[m.length-1])&&(m.length-=1):m=h;for(var S,C="",O=0,_=d?i(" "):void 0,P=0,T=m.length;P<T;P++)if(x=i(b=m[P]),w=P===T-1,!d||w&&!k||(b+=" ",x+=_),d&&x>r){""!==C?a.push(o.getLine(C,O,Tu)):0===P&&s>0&&a.push(o.getLine("",0,Tu)),a.push.apply(a,p(t(b,i,Ru,r,0,o)));var E=a.pop();C=E.text,O=E.width,o.freeLine(E)," "===C&&(C="",O=0);}else (S=O+x)>l?(a.push(o.getLine(C,O,Tu)),C=b,O=x,l=r):(C+=b,O=S),w&&a.push(o.getLine(C,O,u));}return a},Au=Phaser.Utils.Objects.GetValue,Du=Jl,Bu=Gl,ju=function(){function t(i){e(this,t),this.parent=i.parent,this.scene=this.parent.scene,this.context=Au(i,"context",null),this.canvas=this.context.canvas,this.parser=Au(i,"parser",null),this.defaultStyle=Au(i,"style",null),this.autoRound=!0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.wrapTextLinesPool=i.wrapTextLinesPool,this.penManager=this.newPenManager(),this._tmpPenManager=null,this.hitAreaManager=new xu,this.lastHitAreaKey=null,this.urlTagCursorStyle=null;var n=this.context;this.getTextWidth=function(t){return n.measureText(t).width};}return n(t,[{key:"destroy",value:function(){this.parent=void 0,this.scene=void 0,this.context=void 0,this.canvas=void 0,this.parser=void 0,this.defaultStyle=void 0,this.penManager&&(this.penManager.destroy(),this.penManager=void 0),this._tmpPenManager&&(this._tmpPenManager.destroy(),this._tmpPenManager=void 0),this.hitAreaManager&&(this.hitAreaManager.destroy(),this.hitAreaManager=void 0),this.pensPool=void 0,this.linesPool=void 0,this.wrapTextLinesPool=void 0;}},{key:"updatePenManager",value:function(t,e,i,n,r){if(void 0===r&&(r=this.penManager),r.clear(),""===t)return r;var s=this.parent.style;if(s.isWrapFitMode){var o=this.parent.padding;i=s.fixedWidth-o.left-o.right;}for(var a,h,l,u,c,d=this.canvas,f=this.context,p=function(t){return f.measureText(t).width},v=0,g=0,y=s.wrapCallback,m=s.wrapCallbackScope,k=!0,b=this.parser.splitText(t),x=this.wrapTextLinesPool,w=0,S=b.length;w<S;w++)if(a=(u=this.parser.tagTextToProp(b[w],h)).plainText,(h=u.prop).img){var C=this.imageManager.getOuterWidth(h.img);i>0&&e!==Du&&i<v+C&&(r.addNewLinePen(),g+=n,v=0),r.addImagePen(v,g,C,Rt(h)),v+=C;}else if(""!==a){if(f.save(),(l=this.parser.propToContextStyle(this.defaultStyle,h)).buildFont(),l.syncFont(d,f),l.syncStyle(d,f),y){"string"==typeof(c=y.call(m,a,p,i,v))&&(c=c.split("\n"));for(var O=0,_=c.length;O<_;O++)"string"==typeof(P=c[O])?c[O]=x.getLine(P,p(P),O<_-1?2:0):k=!1;}else c=zu(a,p,e,i,v,x);var P;for(O=0,_=c.length;O<_;O++)P=c[O],r.addTextPen(P.text,v,g,P.width,Rt(h),P.newLineMode),P.newLineMode!==Bu?(v=0,g+=n):v+=P.width;k&&x.freeLines(c),c=null,f.restore();}for(w=0,S=this.lines.length;w<S;w++){var T=this.lines[w],E=T[T.length-1];E&&(E.width+=this.parser.getStrokeThinkness(this.defaultStyle,E.prop));}return r}},{key:"startXOffset",get:function(){var t=this.defaultStyle;return t.strokeThickness/2+t.xOffset}},{key:"startYOffset",get:function(){var t=this.defaultStyle;return t.strokeThickness/2+t.metrics.ascent}},{key:"lines",get:function(){return this.penManager.lines}},{key:"desplayLinesCount",get:function(){var t=this.penManager.linesCount,e=this.defaultStyle.maxLines;return e>0&&t>e&&(t=e),t}},{key:"linesWidth",get:function(){return Math.ceil(this.penManager.getMaxLineWidth())}},{key:"linesHeight",get:function(){var t=this.desplayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}},{key:"imageManager",get:function(){return this.parent.imageManager}},{key:"rtl",get:function(){return this.parent.style.rtl}},{key:"newPenManager",value:function(){return new gu({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}},{key:"tmpPenManager",get:function(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}},{key:"getPlainText",value:function(t,e,i){var n;if(null==t)n=this.penManager.plainText;else {var r=this.parser.splitText(t,1);n="";for(var s=0,o=r.length;s<o;s++)n+=r[s];}return null==e&&null==i||(null==e&&(e=0),null==i&&(i=n.length),n=n.substring(e,i)),n}},{key:"getPenManager",value:function(t,e){if(void 0===t)return this.copyPenManager(e,this.penManager);void 0===e&&(e=this.newPenManager());var i=this.defaultStyle;return this.updatePenManager(t,i.wrapMode,i.wrapWidth,i.lineHeight,e),e}},{key:"getText",value:function(t,e,i,n){if(null==t)return this.penManager.getSliceTagText(e,i,n);var r=this.tmpPenManager,s=this.defaultStyle;return this.updatePenManager(t,s.wrapMode,s.wrapWidth,s.lineHeight,r),r.getSliceTagText(e,i,n)}},{key:"copyPenManager",value:function(t,e){return void 0===e&&(e=this.penManager),e.copy(t)}},{key:"getTextWidth",value:function(t){return void 0===t&&(t=this.penManager),t.getMaxLineWidth()}},{key:"getLastPen",value:function(t){return void 0===t&&(t=this.penManager),t.lastPen}}]),t}(),Wu={setInteractive:function(){this.parent.on("pointerdown",wu,this).on("pointerup",Su,this).on("pointermove",Cu,this).on("pointerover",Cu,this).on("pointerout",(function(t,e){Cu.call(this,t,null,null,e);}),this);}};Object.assign(ju.prototype,hu,Wu);var Yu=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s,[{key:"freeLine",value:function(t){if(t)return this.push(t),this}},{key:"freeLines",value:function(t){if(t)return this.pushMultiple(t),this}},{key:"getLine",value:function(t,e,i){var n=this.pop();return null===n&&(n={}),n.text=t,n.width=e,n.newLineMode=i,n}}]),s}(mu),Xu=Phaser.Utils.Objects.IsPlainObject,Iu=Phaser.Utils.Objects.GetValue,Hu=function(t,e){Xu(t)?t=(e=t).key:void 0===e&&(e={key:t}),e.hasOwnProperty("key")||(e.key=t);var i=e.key,n=e.frame,r=e.width,s=e.height;if(void 0===r||void 0===s){var o=this.textureManager.getFrame(i,n),a=o?o.cutWidth:0,h=o?o.cutHeight:0;void 0===r&&void 0===s?(r=a,s=h):void 0===r?r=a*(s/h):void 0===s&&(s=h*(r/a));}this.images[t]={key:i,frame:n,width:r,height:s,y:Iu(e,"y",0),left:Iu(e,"left",0),right:Iu(e,"right",0),originX:Iu(e,"originX",0),originY:Iu(e,"originY",0)};},Fu=function(){function t(i){e(this,t),this.textureManager=i.sys.textures,this.images={};}return n(t,[{key:"destroy",value:function(){this.textureManager=void 0,this.images=void 0;}},{key:"add",value:function(t,e){if("string"==typeof t)Hu.call(this,t,e);else if(Array.isArray(t))for(var i=0,n=(r=t).length;i<n;i++)Hu.call(this,r[i]);else {var r=t;for(var t in r)Hu.call(this,t,r[t]);}return this}},{key:"has",value:function(t){return this.images.hasOwnProperty(t)}},{key:"remove",value:function(t){return this.has(t)&&delete this.images[t],this}},{key:"get",value:function(t){return this.has(t)||this.textureManager.exists(t)&&this.add(t),this.images[t]}},{key:"getOuterWidth",value:function(t){var e=this.get(t);return e?e.width+e.left+e.right:0}},{key:"getFrame",value:function(t){var e=this.get(t);return e?this.textureManager.getFrame(e.key,e.frame):void 0}},{key:"hasTexture",value:function(t){return !!this.getFrame(t)}}]),t}(),Nu={draw:function(t,e,i,n,r){var s=this.get(t),o=this.textureManager.getFrame(s.key,s.frame),a=s.width,h=s.height;i+=s.left-s.originX*a,n+=s.y-s.originY*h,r&&(i=Math.round(i),n=Math.round(n)),e.drawImage(o.source.image,o.cutX,o.cutY,o.cutWidth,o.cutHeight,i,n,a,h);}};Object.assign(Fu.prototype,Nu);var Gu=function(t,e,i,n,r,s,o){var a,h=t.sys.textures,l=t.renderer;void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=e.width),void 0===o&&(o=e.height);var u=(a=h.exists(i)?h.get(i):h.createCanvas(i,s,o)).getSourceImage();u.width!==s&&(u.width=s),u.height!==o&&(u.height=o);var c=u.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,s,o),c.drawImage(e,n,r,s,o),l.gl&&a&&l.canvasToTexture(u,a.source[0].glTexture,!0,0);},Vu=Phaser.Utils.Objects.IsPlainObject,Uu=Phaser.DOM.AddToDOM,Ju=Phaser.Display.Canvas.CanvasPool,Ku=Phaser.GameObjects.GameObject,qu=Phaser.Utils.Objects.GetValue,Zu=Phaser.DOM.RemoveFromDOM,$u=Zl,Qu=null,tc=null,ec=null,ic=function(i){r(o,i);var s=l(o);function o(t,i,n,r,h,l,u){var c;if(e(this,o),Vu(i)){var d=i;i=qu(d,"x",0),n=qu(d,"y",0),r=qu(d,"text",""),h=qu(d,"style");}if(void 0===i&&(i=0),void 0===n&&(n=0),(c=s.call(this,t,l)).renderer=t.sys.game.renderer,c.setPosition(i,n),c.setOrigin(0,0),c.initPipeline(),c.initPostPipeline(!0),c.canvas=Ju.create(a(c)),c.context=c.canvas.getContext("2d",{willReadFrequently:!0}),c._imageManager=void 0,h){if(h.hasOwnProperty("align")){var f=h.align;delete h.align,h.halign=f;}h.hasOwnProperty("stroke")&&!h.hasOwnProperty("strokeThickness")&&(h.strokeThickness=1);}c.style=new tu(a(c),h);var p,v,g,y=qu(h,"images",void 0);return y&&c.addImage(y),c.autoRound=!0,c._text=void 0,c.padding={left:0,right:0,top:0,bottom:0},c.width=1,c.height=1,c.dirty=!1,0===c.style.resolution&&(c.style.resolution=1),c._crop=c.resetCropObject(),c.texture=t.sys.textures.addCanvas(null,c.canvas,!0),c.frame=c.texture.get(),c.frame.source.resolution=c.style.resolution,c.renderer&&c.renderer.gl&&(c.renderer.deleteTexture(c.frame.source.glTexture),c.frame.source.glTexture=null),qu(h,"sharedPool",!0)?(Qu||(Qu={},tc=new mu,ec=new Yu,c.scene.game.events.once("destroy",(function(){Qu=null,tc=null,ec=null;}))),Qu.hasOwnProperty(l)||(Qu[l]=new mu),p=Qu[l],v=tc,g=ec):(p=new mu,v=new mu,g=new Yu),c.canvasText=new ju({parent:a(c),context:c.context,parser:u,style:c.style,pensPool:p,linesPool:v,wrapTextLinesPool:g}),c.parser=u,c.initRTL(),h&&h.padding&&c.setPadding(h.padding),c.setText(r),c.setUrlTagCursorStyle(qu(h,"urlTagCursorStyle","pointer")),qu(h,"interactive",!1)&&c.setInteractive(),c}return n(o,[{key:"preDestroy",value:function(){Zu(this.canvas),this.canvasText.destroy(),this.canvasText=void 0,this._imageManager&&(this._imageManager.destroy(),this._imageManager=void 0),Ju.remove(this.canvas),this.texture.destroy();}},{key:"text",get:function(){return this._text},set:function(t){this.setText(t);}},{key:"initRTL",value:function(){this.style.rtl&&(this.canvas.dir="rtl",this.context.direction="rtl",this.canvas.style.display="none",Uu(this.canvas,this.scene.sys.canvas),this.originX=1);}},{key:"setRTL",value:function(t){void 0===t&&(t=!0);var e=this.style;if(e.rtl===t)return this;if(e.rtl=t,t?(this.canvas.dir="rtl",this.context.direction="rtl",this.canvas.style.display="none",Uu(this.canvas,this.scene.sys.canvas)):(this.canvas.dir="ltr",this.context.direction="ltr"),"left"===e.halign?e.halign="right":"right"===e.halign&&(e.halign="left"),this._imageManager){var i=this._imageManager.images;for(var n in i)i[n].originX=1-i[n].originX;}return this}},{key:"setText",value:function(t){return (t=null==t?"":Array.isArray(t)?t.join("\n"):t.toString())===this._text||(this._text=t,this.updateText()),this}},{key:"setPadding",value:function(e,i,n,r){if("object"===t(e)){var s=e,o=qu(s,"x",null);null!==o?(e=o,n=o):(e=qu(s,"left",0),n=qu(s,"right",e));var a=qu(s,"y",null);null!==a?(i=a,r=a):(i=qu(s,"top",0),r=qu(s,"bottom",i));}else void 0===e&&(e=0),void 0===i&&(i=e),void 0===n&&(n=e),void 0===r&&(r=i);return this.padding.left=e,this.padding.top=i,this.padding.right=n,this.padding.bottom=r,this.updateText(!1)}},{key:"updateText",value:function(t){void 0===t&&(t=!0);var e=this.canvasText,i=this.style;t&&e.updatePenManager(this._text,i.wrapMode,i.wrapWidth,i.lineHeight);var n,r,s=this.padding,o=Math.ceil(e.linesWidth);0===i.fixedWidth?(this.width=o+s.left+s.right,n=o):(this.width=i.fixedWidth,(n=this.width-s.left-s.right)<o&&(n=o)),0===i.fixedHeight?(this.height=e.linesHeight+s.top+s.bottom,r=e.linesHeight):(this.height=i.fixedHeight,(r=this.height-s.top-s.bottom)<e.linesHeight&&(r=e.linesHeight));var a=this.width,h=this.height;this.updateDisplayOrigin();var l=i.resolution;a*=l,h*=l,a=Math.max(Math.ceil(a),1),h=Math.max(Math.ceil(h),1);var u=this.canvas,c=this.context;u.width!==a||u.height!==h?(u.width=a,u.height=h,this.frame.setSize(a,h)):c.clearRect(0,0,a,h),c.save(),c.scale(l,l);var d=this.style.rtl?s.right:s.left,f=s.top;e.draw(d,f,n,r),c.restore(),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(u,this.frame.source.glTexture,!0),this.frame.glTexture=this.frame.source.glTexture),this.dirty=!0;var p=this.input;return p&&!p.customHitArea&&(p.hitArea.width=this.width,p.hitArea.height=this.height),this}},{key:"toJSON",value:function(){var t=Components.ToJSON(this),e={autoRound:this.autoRound,text:this._text,style:this.style.toJSON(),resolution:this.resolution,padding:{left:this.padding.left,right:this.padding.right,top:this.padding.top,bottom:this.padding.bottom}};return t.data=e,t}},{key:"setInteractive",value:function(t,e,i){var n=!!this.input;return Ku.prototype.setInteractive.call(this,t,e,i),n||this.canvasText.setInteractive(),this}},{key:"setUrlTagCursorStyle",value:function(t){return this.urlTagCursorStyle=t,this}},{key:"urlTagCursorStyle",get:function(){return this.canvasText.urlTagCursorStyle},set:function(t){this.canvasText.urlTagCursorStyle=t;}},{key:"getWrappedText",value:function(t,e,i){return "number"==typeof t&&(i=e,e=t,t=void 0),(t=this.canvasText.getText(t,e,i,!0)).split($u)}},{key:"getPlainText",value:function(t,e,i){return "number"==typeof t&&(i=e,e=t,t=void 0),this.canvasText.getPlainText(t,e,i)}},{key:"getText",value:function(t,e,i,n){return "number"==typeof t&&(n=i,i=e,e=t,t=void 0),void 0===n&&(n=!1),this.canvasText.getText(t,e,i,n)}},{key:"getSubString",value:function(t,e,i){return "number"==typeof t&&(i=e,e=t,t=void 0),this.getText(t,e,i)}},{key:"copyPenManager",value:function(t){return this.canvasText.copyPenManager(t)}},{key:"getPenManager",value:function(t,e){return this.canvasText.getPenManager(t,e)}},{key:"setSize",value:function(t,e){return this.setFixedSize(t,e)}},{key:"resize",value:function(t,e){return this.setFixedSize(t,e)}},{key:"imageManager",get:function(){return this._imageManager||(this._imageManager=new Fu(this.scene)),this._imageManager}},{key:"addImage",value:function(t,e){return this.imageManager.add(t,e),this}},{key:"drawAreaBounds",value:function(t,e){return this.canvasText.hitAreaManager.drawBounds(t,e,this),this}},{key:"generateTexture",value:function(t,e,i,n,r){var s=this.canvas;return void 0===n?n=s.width:n*=this.resolution,void 0===r?r=s.height:r*=this.resolution,Gu(this.scene,s,t,e,i,n,r),this}}]),o}(Wl),nc={appendText:yh};Object.assign(ic.prototype,nc);var rc,sc,oc=!1,ac=!0,hc={plainText:null,prevProp:null},lc=function(t,e,i,n){return e===ac?t[i]=n:t.hasOwnProperty(i)&&delete t[i],t},uc=function(t){var e=t.b,i=t.weight,n=t.i;return e||i||n?n?e?"bold italic":i?"".concat(i," italic"):"italic":e?"bold":i.toString():""},cc=new tu,dc={},fc=function(t){return t.replace(pc,"\\$&").replace(vc,"\\x2d")},pc=/[|\\{}()[\]^$+*?.]/g,vc=/-/g,gc={},yc=function(t,e,i,n){return void 0===n?"".concat(t).concat(i).concat(e):"".concat(t).concat(i,"=(").concat(n,")").concat(e)},mc=function(t,e,i){return "".concat(t,"/").concat(i).concat(e)},kc="[-.0-9]+",bc="[a-z]+|#[0-9abcdef]+",xc="[^\\]]+",wc=function(t,e){if(void 0===e){var i=t;t=i[0],e=i[1];}if(rc===t&&sc===e)return !1;rc=t,sc=e,t=fc(t),e=fc(e);var n=yc(t,e,"esc"),r=mc(t,e,"esc"),s=yc(t,e,"raw"),o=mc(t,e,"raw"),a=yc(t,e,"b"),h=mc(t,e,"b"),l=yc(t,e,"i"),u=mc(t,e,"i"),c="weight",d=yc(t,e,c,kc),f=mc(t,e,c),p="size",v=yc(t,e,p,kc),g=mc(t,e,p),y="color",m=yc(t,e,y,bc),k=mc(t,e,y),b=yc(t,e,"u"),x=yc(t,e,"u",bc),w=mc(t,e,"u"),S=yc(t,e,"s"),C=yc(t,e,"s",bc),O=mc(t,e,"s"),_="shadow",P=yc(t,e,_),T=mc(t,e,_),E="stroke",M=yc(t,e,E),R=yc(t,e,E,bc),L=mc(t,e,E),z=yc(t,e,"y",kc),A=mc(t,e,"y"),D=yc(t,e,"img",xc),B=mc(t,e,"img"),j="area",W=yc(t,e,j,xc),Y=mc(t,e,j),X=yc(t,e,"url",xc),I=mc(t,e,"url"),H="align",F=yc(t,e,H,xc),N=mc(t,e,H);return gc.RE_ESC_OPEN=new RegExp(n,"i"),gc.RE_ESC_CLOSE=new RegExp(r,"i"),gc.RE_RAW_OPEN=new RegExp(s,"i"),gc.RE_RAW_CLOSE=new RegExp(o,"i"),gc.RE_BLOD_OPEN=new RegExp(a,"i"),gc.RE_BLOD_CLOSE=new RegExp(h,"i"),gc.RE_ITALICS_OPEN=new RegExp(l,"i"),gc.RE_ITALICS_CLOSE=new RegExp(u,"i"),gc.RE_WEIGHT_OPEN=new RegExp(d,"i"),gc.RE_WEIGHT_CLOSE=new RegExp(f,"i"),gc.RE_SIZE_OPEN=new RegExp(v,"i"),gc.RE_SIZE_CLOSE=new RegExp(g,"i"),gc.RE_COLOR_OPEN=new RegExp(m,"i"),gc.RE_COLOR_CLOSE=new RegExp(k,"i"),gc.RE_UNDERLINE_OPEN=new RegExp(b,"i"),gc.RE_UNDERLINE_OPENC=new RegExp(x,"i"),gc.RE_UNDERLINE_CLOSE=new RegExp(w,"i"),gc.RE_STRIKETHROUGH_OPEN=new RegExp(S,"i"),gc.RE_STRIKETHROUGH_OPENC=new RegExp(C,"i"),gc.RE_STRIKETHROUGH_CLOSE=new RegExp(O,"i"),gc.RE_SHADOW_OPEN=new RegExp(P,"i"),gc.RE_SHADOW_CLOSE=new RegExp(T,"i"),gc.RE_STROKE_OPEN=new RegExp(M,"i"),gc.RE_STROKE_OPENC=new RegExp(R,"i"),gc.RE_STROKE_CLOSE=new RegExp(L,"i"),gc.RE_OFFSETY_OPEN=new RegExp(z,"i"),gc.RE_OFFSETY_CLOSE=new RegExp(A,"i"),gc.RE_IMAGE_OPEN=new RegExp(D,"i"),gc.RE_IMAGE_CLOSE=new RegExp(B,"i"),gc.RE_AREA_OPEN=new RegExp(W,"i"),gc.RE_AREA_CLOSE=new RegExp(Y,"i"),gc.RE_URL_OPEN=new RegExp(X,"i"),gc.RE_URL_CLOSE=new RegExp(I,"i"),gc.RE_ALIGN_OPEN=new RegExp(F,"i"),gc.RE_ALIGN_CLOSE=new RegExp(N,"i"),gc.RE_SPLITTEXT=new RegExp([s,o,n,r,a,h,l,u,d,f,v,g,m,k,b,x,w,S,C,O,P,T,M,R,L,z,A,D,B,W,Y,X,I,F,N].join("|"),"ig"),!0},Sc=function(t,e){return void 0!==t&&wc(t,e),Object.assign({},gc)},Cc=Phaser.Utils.Objects.GetValue,Oc=function(){function t(i){e(this,t);var n=Cc(i,"delimiters","[]");this.tagRegex=Sc(n),this.delimiters=n;}return n(t,[{key:"getStrokeThinkness",value:function(t,e){return e.hasOwnProperty("stroke")?t.strokeThickness:0}},{key:"setDelimiters",value:function(t,e){return wc(t,e)&&(this.tagRegex=Sc()),this}}]),t}(),_c={splitText:function(t,e){for(var i=this.tagRegex,n=[],r=0,s=!1,o=!1;;){var a=i.RE_SPLITTEXT.exec(t);if(!a)break;var h=a[0];if(o){if(!i.RE_ESC_CLOSE.test(h))continue;o=!1;}else if(s){if(!i.RE_RAW_CLOSE.test(h))continue;s=!1;}else i.RE_ESC_OPEN.test(h)?o=!0:i.RE_RAW_OPEN.test(h)&&(s=!0);var l=i.RE_SPLITTEXT.lastIndex,u=l-h.length;if(r<u){var c=t.substring(r,u);n.push(c);}void 0===e&&n.push(h),r=l;}var d=t.length;return r<d&&n.push(t.substring(r,d)),n},tagTextToProp:function(t,e){var i=this.tagRegex;null==e&&(e={});var n="";if(e.img&&lc(e,oc,"img"),e.esc)i.RE_ESC_CLOSE.test(t)?lc(e,oc,"esc"):n=t;else if(e.raw)i.RE_RAW_CLOSE.test(t)?lc(e,oc,"raw"):n=t;else if(i.RE_ESC_OPEN.test(t))lc(e,ac,"esc",!0);else if(i.RE_ESC_CLOSE.test(t))lc(e,oc,"esc");else if(i.RE_RAW_OPEN.test(t))lc(e,ac,"raw",!0);else if(i.RE_RAW_CLOSE.test(t))lc(e,oc,"raw");else if(i.RE_BLOD_OPEN.test(t))lc(e,ac,"b",!0);else if(i.RE_BLOD_CLOSE.test(t))lc(e,oc,"b");else if(i.RE_ITALICS_OPEN.test(t))lc(e,ac,"i",!0);else if(i.RE_ITALICS_CLOSE.test(t))lc(e,oc,"i");else if(i.RE_WEIGHT_OPEN.test(t)){var r=t.match(i.RE_WEIGHT_OPEN);lc(e,ac,"weight",r[1]);}else if(i.RE_WEIGHT_CLOSE.test(t))lc(e,oc,"weight");else if(i.RE_SIZE_OPEN.test(t)){r=t.match(i.RE_SIZE_OPEN);lc(e,ac,"size","".concat(r[1],"px"));}else if(i.RE_SIZE_CLOSE.test(t))lc(e,oc,"size");else if(i.RE_COLOR_OPEN.test(t)){r=t.match(i.RE_COLOR_OPEN);lc(e,ac,"color",r[1]);}else if(i.RE_COLOR_CLOSE.test(t))lc(e,oc,"color");else if(i.RE_UNDERLINE_OPEN.test(t))lc(e,ac,"u",!0);else if(i.RE_UNDERLINE_OPENC.test(t)){r=t.match(i.RE_UNDERLINE_OPENC);lc(e,ac,"u",r[1]);}else if(i.RE_UNDERLINE_CLOSE.test(t))lc(e,oc,"u");else if(i.RE_STRIKETHROUGH_OPEN.test(t))lc(e,ac,"s",!0);else if(i.RE_STRIKETHROUGH_OPENC.test(t)){r=t.match(i.RE_STRIKETHROUGH_OPENC);lc(e,ac,"s",r[1]);}else if(i.RE_STRIKETHROUGH_CLOSE.test(t))lc(e,oc,"s");else if(i.RE_SHADOW_OPEN.test(t))lc(e,ac,"shadow",!0);else if(i.RE_SHADOW_CLOSE.test(t))lc(e,oc,"shadow");else if(i.RE_STROKE_OPEN.test(t))lc(e,ac,"stroke",!0);else if(i.RE_STROKE_OPENC.test(t)){r=t.match(i.RE_STROKE_OPENC);lc(e,ac,"stroke",r[1]);}else if(i.RE_STROKE_CLOSE.test(t))lc(e,oc,"stroke");else if(i.RE_OFFSETY_OPEN.test(t)){r=t.match(i.RE_OFFSETY_OPEN);lc(e,ac,"y",parseFloat(r[1]));}else if(i.RE_OFFSETY_CLOSE.test(t))lc(e,oc,"y");else if(i.RE_IMAGE_OPEN.test(t)){r=t.match(i.RE_IMAGE_OPEN);lc(e,ac,"img",r[1]);}else if(i.RE_IMAGE_CLOSE.test(t))lc(e,oc,"img");else if(i.RE_AREA_OPEN.test(t)){r=t.match(i.RE_AREA_OPEN);lc(e,ac,"area",r[1]);}else if(i.RE_AREA_CLOSE.test(t))lc(e,oc,"area");else if(i.RE_URL_OPEN.test(t)){r=t.match(i.RE_URL_OPEN);lc(e,ac,"url",r[1]);}else if(i.RE_URL_CLOSE.test(t))lc(e,oc,"url");else if(i.RE_ALIGN_OPEN.test(t)){r=t.match(i.RE_ALIGN_OPEN);lc(e,ac,"align",r[1]);}else i.RE_ALIGN_CLOSE.test(t)?lc(e,oc,"align"):n=t;var s=hc;return s.plainText=n,s.prop=e,s},propToContextStyle:function(t,e){var i=cc;if(e.hasOwnProperty("img"))i.image=e.img;else {if(i.image=null,e.hasOwnProperty("family")?i.fontFamily=e.family:i.fontFamily=t.fontFamily,e.hasOwnProperty("size")){var n=e.size;"number"==typeof n&&(n="".concat(n,"px")),i.fontSize=n;}else i.fontSize=t.fontSize;i.fontStyle=uc(e),e.hasOwnProperty("color")?i.color=e.color:i.color=t.color,e.hasOwnProperty("stroke")?!0===e.stroke?(i.stroke=t.stroke,i.strokeThickness=t.strokeThickness):(i.stroke=e.stroke,i.strokeThickness=t.strokeThickness):(i.stroke=t.stroke,i.strokeThickness=0);}return e.hasOwnProperty("shadow")?!0===e.shadow?(i.shadowColor=t.shadowColor,i.shadowOffsetX=t.shadowOffsetX,i.shadowOffsetY=t.shadowOffsetY,i.shadowBlur=t.shadowBlur,i.shadowStroke=!0,i.shadowFill=!0):(i.shadowColor=e.shadow,i.shadowOffsetX=t.shadowOffsetX,i.shadowOffsetY=t.shadowOffsetY,i.shadowBlur=t.shadowBlur,i.shadowStroke=!0,i.shadowFill=!0):(i.shadowColor="#000",i.shadowOffsetX=0,i.shadowOffsetY=0,i.shadowBlur=0,i.shadowStroke=!1,i.shadowFill=!1),e.hasOwnProperty("u")?!0===e.u?(i.underlineColor=t.underlineColor,i.underlineThickness=t.underlineThickness,i.underlineOffset=t.underlineOffset):(i.underlineColor=e.u,i.underlineThickness=t.underlineThickness,i.underlineOffset=t.underlineOffset):(i.underlineColor="#000",i.underlineThickness=0,i.underlineOffset=0),e.hasOwnProperty("s")?!0===e.s?(i.strikethroughColor=t.strikethroughColor,i.strikethroughThickness=t.strikethroughThickness,i.strikethroughOffset=t.strikethroughOffset):(i.strikethroughColor=e.s,i.strikethroughThickness=t.strikethroughThickness,i.strikethroughOffset=t.strikethroughOffset):(i.strikethroughColor="#000",i.strikethroughThickness=0,i.strikethroughOffset=0),i},propToTagText:function(t,e,i){null==i&&(i=dc);var n=this.delimiters[0],r=this.delimiters[1],s=[];for(var o in i)e.hasOwnProperty(o)||s.push("".concat(n,"/").concat(o).concat(r));for(var o in e){var a=e[o];if(i[o]!==a)switch(o){case"size":s.push("".concat(n,"size=").concat(a.replace("px","")).concat(r));break;case"color":case"weight":case"stroke":case"y":case"img":case"area":case"url":case"align":s.push("".concat(n).concat(o,"=").concat(a).concat(r));break;case"u":case"s":!0===a?s.push("".concat(n).concat(o).concat(r)):s.push("".concat(n).concat(o,"=").concat(a).concat(r));break;default:s.push("".concat(n).concat(o).concat(r));}}return s.push(t),s.join("")}};Object.assign(Oc.prototype,_c);var Pc=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a){e(this,s);var h=new Oc(a);return i.call(this,t,n,r,o,a,"rexBBCodeText",h)}return n(s,[{key:"setDelimiters",value:function(t,e){return this.parse.setDelimiters(t,e),this}}]),s}(ic),Tc=Phaser.Utils.Objects.GetValue,Ec=Phaser.GameObjects.BitmapText,Mc=function(t,e){var i,n=Tc(e,"$type");switch(void 0===n&&Tc(e,"key")&&(n="bitmaptext"),n){case"bitmaptext":case"bitmap":var r=Tc(e,"key"),s=Tc(e,"size");void 0===s&&(s=Tc(e,"fontSize")),i=new Ec(t,0,0,r,"",s);var o=Tc(e,"color");void 0!==o&&i.setTint(o);break;case"bbcodetext":case"bbcode":i=new Pc(t,0,0,"",e);break;default:i=new Al(t,e);}return t.add.existing(i),i},Rc=Phaser.Renderer.WebGL.Utils,Lc={renderWebGL:function(t,e,i,n){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,s=r.width,o=r.height,a=Rc.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,s,o,e.x,e.y,s/e.resolution,o/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,s,o,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,n,!1,l),t.pipelines.postBatch(e);}},renderCanvas:function(t,e,i,n){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,n));}},zc=Phaser.Display.Color,Ac={clear:function(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill:function(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame:function(t,e,i,n,r,s,o,a,h,l){var u=this.scene.sys.textures.getFrame(t,e);if(!u)return this;var c=u.cutWidth,d=u.cutHeight;void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=c),void 0===s&&(s=d),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=c),void 0===l&&(l=d);var f=u.cutX+o,p=u.cutY+a;return this.context.drawImage(u.source.image,f,p,h,l,i,n,r,s),this.dirty=!0,this},getDataURL:function(t,e){return this.canvas.toDataURL(t,e)},getPixel:function(t,e,i){void 0===i&&(i=new zc);var n=this.context.getImageData(t,e,1,1);return i.setTo(n.data[0],n.data[1],n.data[2],n.data[3]),i},setPixel:function(t,e,i,n,r,s){if("number"!=typeof i){var o=i;i=o.red,n=o.green,r=o.blue,s=o.alpha;}void 0===s&&(s=0!==i||0!==n||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=n,a.data[2]=r,a.data[3]=s,this.context.putImageData(a,t,e),this.dirty=!0,this}},Dc={updateTexture:function(t,e){t&&(e?t.call(e,this.canvas,this.context):t(this.canvas,this.context)),this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture=this.frame.source.glTexture),this.dirty=!1;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=this.width,i.hitArea.height=this.height),this},generateTexture:function(t,e,i,n,r){var s=this.canvas;return void 0===n?n=s.width:n*=this.resolution,void 0===r?r=s.height:r*=this.resolution,Gu(this.scene,s,t,e,i,n,r),this},loadTexture:function(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};m();var Bc=Phaser.Display.Canvas.CanvasPool,jc=function(t){r(s,t);var i=l(s);function s(t,n,r,o,h){var l;return e(this,s),void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===h&&(h=1),(l=i.call(this,t,"rexCanvas")).renderer=t.sys.game.renderer,l.resolution=1,l._width=o,l._height=h,o=Math.max(Math.ceil(o*l.resolution),1),h=Math.max(Math.ceil(h*l.resolution),1),l.canvas=Bc.create(a(l),o,h),l.context=l.canvas.getContext("2d",{willReadFrequently:!0}),l.dirty=!1,l.setPosition(n,r),l.setOrigin(.5,.5),l.initPipeline(),l.initPostPipeline(!0),l._crop=l.resetCropObject(),l.texture=t.sys.textures.addCanvas(null,l.canvas,!0),l.frame=l.texture.get(),l.frame.source.resolution=l.resolution,l.renderer&&l.renderer.gl&&(l.renderer.deleteTexture(l.frame.source.glTexture),l.frame.source.glTexture=null),l.dirty=!0,l}return n(s,[{key:"preDestroy",value:function(){Bc.remove(this.canvas),this.texture.destroy(),this.canvas=null,this.context=null;}},{key:"width",get:function(){return this._width},set:function(t){this.setSize(t,this._height);}},{key:"height",get:function(){return this._height},set:function(t){this.setSize(this._width,t);}},{key:"setCanvasSize",value:function(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}},{key:"setSize",value:function(t,e){return this.setCanvasSize(t,e),this}},{key:"displayWidth",get:function(){return this.scaleX*this._width},set:function(t){this.scaleX=t/this._width;}},{key:"displayHeight",get:function(){return this.scaleY*this._height},set:function(t){this.scaleY=t/this._height;}},{key:"setDisplaySize",value:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}},{key:"getCanvas",value:function(t){return t||(this.dirty=!0),this.canvas}},{key:"getContext",value:function(t){return t||(this.dirty=!0),this.context}},{key:"needRedraw",value:function(){return this.dirty=!0,this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}}]),s}(Phaser.GameObjects.GameObject),Wc=Phaser.GameObjects.Components;Phaser.Class.mixin(jc,[Wc.Alpha,Wc.BlendMode,Wc.Crop,Wc.Depth,Wc.Flip,Wc.GetBounds,Wc.Mask,Wc.Origin,Wc.Pipeline,Wc.PostPipeline,Wc.ScrollFactor,Wc.Tint,Wc.Transform,Wc.Visible,Lc,Ac,Dc]);var Yc={enableData:function(){return void 0===this.data&&(this.data={}),this},setData:function(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t];}else this.data[t]=e;return this},getData:function(t,e){return this.enableData(),void 0===t?this.data:Mn(this.data,t,e)},incData:function(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData:function(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData:function(){return this.data&&Mt(this.data),this}},Xc=function(){function t(i,n){e(this,t),this.setParent(i),this.type=n,this.renderable=!1,this.reset().setActive();}return n(t,[{key:"destroy",value:function(){this.parent.removeChild(this);}},{key:"setParent",value:function(t){return this.parent=t,this}},{key:"scene",get:function(){return this.parent.scene}},{key:"canvas",get:function(){return this.parent?this.parent.canvas:null}},{key:"context",get:function(){return this.parent?this.parent.context:null}},{key:"setDirty",value:function(t){return t&&this.parent&&(this.parent.dirty=!0),this}},{key:"active",get:function(){return this._active},set:function(t){this.setDirty(this._active!=t),this._active=t;}},{key:"setActive",value:function(t){return void 0===t&&(t=!0),this.active=t,this}},{key:"modifyPorperties",value:function(t){return this}},{key:"onFree",value:function(){this.reset().setParent();}},{key:"reset",value:function(){return this}},{key:"render",value:function(){}},{key:"contains",value:function(t,e){return !1}}]),t}();Object.assign(Xc.prototype,Yc);var Ic,Hc,Fc,Nc,Gc,Vc={renderContent:function(){},render:function(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation);}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}},Uc=Phaser.Math.RotateAround,Jc=Phaser.Geom.Rectangle,Kc=function(t){void 0===Hc&&(Hc=new Jc);var e=t.drawTLX,i=t.drawTLY;return Hc.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Hc},qc=Phaser.Math.RotateAround,Zc=function(t,e,i,n){return void 0===n?n={}:!0===n&&(void 0===Fc&&(Fc={}),n=Fc),n.x=e,n.y=i,0!==t.rotation&&qc(n,0,0,t.rotation),n.x=n.x*t.scaleX+t.drawX,n.y=n.y*t.scaleY+t.drawY,n},$c=Phaser.GameObjects.Components.TransformMatrix,Qc={},td=function(t,e,i,n,r){var s=Zc(e,i,n,!0),o=function(t,e,i,n){void 0===n?n={}:!0===n&&(n=Qc);var r=e-t.width*t.originX,s=i-t.height*t.originY;return void 0===Nc&&(Nc=new $c,Gc=new $c),t.parentContainer?t.getWorldTransformMatrix(Nc,Gc):Nc.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Nc.transformPoint(r,s,n),n}(t,s.x,s.y,r);return o},ed=function(t,e,i,n,r){"number"!=typeof i&&(r=i,i=0,n=0);var s=e.drawCenterX+i,o=e.drawCenterY+n;return td(t,e,s,o,r)},id={contains:function(t,e){if(0===this.width||0===this.height)return !1;var i=function(t,e,i,n){return void 0===n?n={}:!0===n&&(void 0===Ic&&(Ic={}),n=Ic),n.x=(t-i.drawX)/i.scaleX,n.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Uc(n,0,0,-i.rotation),n}(t,e,this,!0);return Kc(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ed(this.parent,this,t,e,i)}};Object.assign(id,Vc);var nd=Phaser.Math.DegToRad,rd=Phaser.Math.RadToDeg,sd=Phaser.Utils.Objects.GetValue,od=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).renderable=!0,r.scrollFactorX=1,r.scrollFactorY=1,r.toLocalPosition=!0,r.originX=0,r.offsetX=0,r.offsetY=0,r}return n(s,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDirty(this._alpha!=t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"x",get:function(){return this._x},set:function(t){this.setDirty(this._x!=t),this._x=t;}},{key:"setX",value:function(t){return this.x=t,this}},{key:"y",get:function(){return this._y},set:function(t){this.setDirty(this._y!=t),this._y=t;}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setInitialPosition",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"setScrollFactorX",value:function(t){return this.scrollFactorX=t,this}},{key:"setScrollFactorY",value:function(t){return this.scrollFactorY=t,this}},{key:"setScrollFactor",value:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}},{key:"rotation",get:function(){return this._rotation},set:function(t){this.setDirty(this._rotation!=t),this._rotation=t;}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return rd(this._rotation)},set:function(t){this.rotation=nd(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"scaleX",get:function(){return this._scaleX},set:function(t){this.setDirty(this._scaleX!==t),this._scaleX=t;}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return 0},set:function(t){}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"leftSpace",get:function(){return this._leftSpace},set:function(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t;}},{key:"setLeftSpace",value:function(t){return this.leftSpace=t,this}},{key:"rightSpace",get:function(){return this._rightSpace},set:function(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t;}},{key:"setRightSpace",value:function(t){return this.rightSpace=t,this}},{key:"outerWidth",get:function(){return this.width+this.leftSpace+this.rightSpace}},{key:"scaleY",get:function(){return this._scaleY},set:function(t){this.setDirty(this._scaleY!==t),this._scaleY=t;}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"height",get:function(){return 0},set:function(t){}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"setOrigin",value:function(t){return this.originX=t,this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"modifyPorperties",value:function(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=sd(t,"width",void 0),i=sd(t,"height",void 0),n=sd(t,"scaleX",void 0),r=sd(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==n&&this.setScaleX(n),void 0!==i?void 0===e&&void 0===n?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}},{key:"setDrawBelowCallback",value:function(t){return this.drawBelowCallback=t,this}},{key:"setDrawAboveCallback",value:function(t){return this.drawAboveCallback=t,this}},{key:"reset",value:function(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}},{key:"willRender",get:function(){return this.visible&&this.alpha>0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(Xc);Object.assign(od.prototype,id);var ad=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},hd=Phaser.Utils.Objects.GetValue,ld=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"background")).setScrollFactor(0),r.setColor(hd(n,"color",null),hd(n,"color2",null),hd(n,"horizontalGradient",!0)),r.setStroke(hd(n,"stroke",null),hd(n,"strokeThickness",2)),r.setCornerRadius(hd(n,"cornerRadius",0),hd(n,"cornerIteration",null)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=Il(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=Il(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=Il(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ad("color2",t,this),ad("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ad("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ad("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return c(s(o.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){au(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),o}(od),ud=Phaser.Utils.Objects.GetValue,cd=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"innerbounds")).setScrollFactor(0),r.setColor(ud(n,"color",null),ud(n,"color2",null),ud(n,"horizontalGradient",!0)),r.setStroke(ud(n,"stroke",null),ud(n,"strokeThickness",2)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=Il(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=Il(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=Il(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){c(s(o.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,ud(t,"color2",null),ud(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ud(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var o,a;if(null!=this.color2)(a=this.horizontalGradient?s.createLinearGradient(0,0,n,0):s.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),a.addColorStop(1,this.color2),o=a;else o=this.color;s.fillStyle=o,s.fillRect(e,i,n,r);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,n,r));}}]),o}(od),dd=Phaser.Utils.Objects.GetValue,fd=function(){function t(i,n){e(this,t),this.parent=i,this.set(n);}return n(t,[{key:"toJSON",value:function(){return {bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}},{key:"set",value:function(t){return this.setBold(dd(t,"bold",!1)),this.setItalic(dd(t,"italic",!1)),this.setFontSize(dd(t,"fontSize","16px")),this.setFontFamily(dd(t,"fontFamily","Courier")),this.setColor(dd(t,"color","#fff")),this.setStrokeStyle(dd(t,"stroke",null),dd(t,"strokeThickness",0)),this.setShadow(dd(t,"shadowColor",null),dd(t,"shadowOffsetX",0),dd(t,"shadowOffsetY",0),dd(t,"shadowBlur",0)),this.setOffset(dd(t,"offsetX",0),dd(t,"offsetY",0)),this.setSpace(dd(t,"leftSpace",0),dd(t,"rightSpace",0)),this.setAlign(dd(t,"align",void 0)),this.setBackgroundColor(dd(t,"backgroundColor",null)),this.setBackgroundHeight(dd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(dd(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(ad("stroke",t,this),ad("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ad("shadowOffsetX",t,this),ad("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),this}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=Il(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=Il(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=Il(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=Il(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}},{key:"syncShadow",value:function(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),pd=Phaser.Utils.Array.Remove,vd=Phaser.Utils.Array.Remove,gd="text",yd="image",md="drawer",kd="space",bd="command",xd=function(t){return t.type===gd&&"\n"===t.text},wd=function(t){return t.type===gd&&"\f"===t.text},Sd=function(t){return t.type===gd},Cd=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,gd)).updateTextFlag=!1,s.style=new fd(a(s),r),s.setText(n),s}return n(o,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),f(s(o.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),f(s(o.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),c(s(o.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&c(s(o.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=r-this.drawTLY);var o=r-s;t.fillRect(i,o,n,s);}var a=e.hasFill,h=e.hasStroke;(a||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),o}(od),Od=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},_d=function(t){r(s,t);var i=l(s);function s(t,n,r){var o;return e(this,s),(o=i.call(this,t,yd)).setTexture(n,r),o}return n(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(od),Pd=function(t){r(o,t);var i=l(o);function o(t,n,r,s){var a;return e(this,o),(a=i.call(this,t,md)).setRenderCallback(n),a.setDrawerSize(r,s),a}return n(o,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(t,e){return !0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),o}(od),Td=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,kd)).setSpaceWidth(n),r}return n(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(od),Ed=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a){var h;return e(this,o),(h=i.call(this,t,bd)).setName(n).setParameter(s).setCallback(r,a),h}return n(o,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),o}(Xc),Md=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)},Rd=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var r=t.length,s=e,o=n.word,a=0;s<r;){var h=t[s];if(h.renderable){var l=h.type===gd?h.text:null;if(null===l||" "===l||"\n"===l||"\f"===l){s===e&&(o.push(h),a+=h.outerWidth);break}if(o.push(h),a+=h.outerWidth,s++,i)break}else o.push(h),s++;}return n.width=a,n},Ld=function(t){for(var e=0,i=t.length;e<i;e++){var n=t[e];if(void 0!==n.align)return n.align}},zd=function(t,e,i){if(0!==e||0!==i)for(var n=0,r=t.length;n<r;n++){var s=t[n];s.renderable&&(s.x+=e,s.y+=i);}},Ad=function(){var t,e,i=this.defaultTextStyle.getTextMetrics(this.context,this.testString);return "actualBoundingBoxAscent"in i?(t=i.actualBoundingBoxAscent,e=i.actualBoundingBoxDescent):(t=0,e=0),Dd.ascent=t,Dd.descent=e,Dd.height=t+e,Dd},Dd={},Bd=Phaser.Utils.Objects.GetValue,jd=function(t){var e=Bd(t,"start",0);Ve(this.wrapPadding,Bd(t,"padding",0));var i,n=this.padding.top+this.padding.bottom+this.wrapPadding.top+this.wrapPadding.bottom,r=this.padding.left+this.padding.right+this.wrapPadding.left+this.wrapPadding.right,s=Bd(t,"lineHeight"),o=Bd(t,"ascent",s);if(void 0===s){var a=Bd(t,"useDefaultTextHeight",!1);if(i=Bd(t,"maxLines",0),this.fixedHeight>0&&!a){var h=this.fixedHeight-n;if(i>0)s=h/i;else s=(l=Ad.call(this)).height,o=l.ascent,i=Math.floor((h-o)/s);}else {var l;s=(l=Ad.call(this)).height,o=l.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=Bd(t,"maxLines"))){h=this.fixedHeight-n;i=Math.floor(h/s);}}else i=Bd(t,"maxLines",0);void 0===o&&(o=s);var u=0===i,c=Bd(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-r:1/0);for(var d=Bd(t,"letterSpacing",0),f=Bd(t,"hAlign",0),p=Bd(t,"vAlign",0),v=Bd(t,"charWrap",!1),g=Md({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:d,maxLines:i,hAlign:f,vAlign:p,ascent:o,lineHeight:s,wrapWidth:c,charWrap:v}),y=this.children,m=0,k=y.length;m<k;m++)y[m].setActive(!1);c+=d;for(var b,x=this.padding.left+this.wrapPadding.left,w=x,S=this.padding.top+this.wrapPadding.top+o,C=c,O=e,_=y.length,P=g.children,T=g.lines,E=[],M=0,R=0,L=!1;O<_;){var z=(b=Rd(y,O,v,b)).word,A=z.length,D=b.width+A*d;O+=A;var B=xd(z[0]);L=wd(z[0]);var j=B||L;if(C<D||j){if(j){var W=z[0];W.setActive().setPosition(w,S),P.push(W),E.push(W);}if(w=x,S+=s,C=c,T.push({children:E,width:M}),R=Math.max(R,M),M=0,E=[],L||!u&&T.length===i)break;if(j)continue}C-=D,M+=D;for(m=0,k=z.length;m<k;m++){(I=z[m]).setActive(),P.push(I),E.push(I),I.renderable&&(I.setPosition(w,S),w+=I.outerWidth+d);}}E.length>0&&(T.push({children:E,width:M}),R=Math.max(R,M)),g.start+=P.length,g.isLastPage=!L&&g.start===_,g.maxLineWidth=R,g.linesHeight=T.length*s;var Y=this.fixedWidth>0?this.fixedWidth:g.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:g.linesHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.linesHeight;switch(o){case 1:case"center":r=(i-a)/2;break;case 2:case"bottom":r=i-a;break;default:r=0;}for(var h=t.lines,l=0,u=h.length;l<u;l++){var c=h[l],d=c.width,f=c.children,p=Ld(f);switch(void 0===p&&(p=s),p){case 1:case"center":n=(e-d)/2;break;case 2:case"right":n=e-d;break;default:n=0;}zd(f,n,r);}}(g,Y-r,h=X-n),this.setCanvasSize(Y,X);for(m=0,k=P.length;m<k;m++){var I;(I=P[m]).renderable&&(I.x0=I.x,I.y0=I.y);}return g},Wd=Phaser.Utils.Objects.Merge,Yd=Phaser.Utils.Objects.GetValue,Xd=function(t){var e=Yd(t,"start",0);Ve(this.wrapPadding,Yd(t,"padding",0));var i,n=this.padding.top+this.padding.bottom+this.wrapPadding.top+this.wrapPadding.bottom,r=this.padding.left+this.padding.right+this.wrapPadding.left+this.wrapPadding.right,s=Yd(t,"lineWidth",void 0);if(void 0===s)i=Yd(t,"maxLines",0),s=this.fixedWidth>0?(o=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Yd(t,"maxLines",void 0))){var o=this.fixedWidth-r;i=Math.floor(o/s)+1;}}else i=Yd(t,"maxLines",0);var a=0===i,h=Yd(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=Yd(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-n;h=Math.floor(u/l);}}var c=Yd(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var d=Yd(t,"letterSpacing",0),f=Yd(t,"rtl",!0),p=Yd(t,"hAlign",f?2:0),v=Yd(t,"vAlign",0),g=Md({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:d,maxLines:i,hAlign:p,vAlign:v,lineWidth:s,fixedCharacterHeight:h,wrapHeight:c,rtl:f}),y=this.children,m=0,k=y.length;m<k;m++)y[m].setActive(!1);c+=d;for(var b=this.padding.left+this.wrapPadding.left,x=this.padding.top+this.wrapPadding.top,w=b,S=x,C=c,O=e,_=y.length,P=g.children,T=g.lines,E=[],M=0,R=0;O<_;){var L=y[O];if(O++,L.renderable){var z=(void 0!==h?h:L.height)+d,A=xd(L),D=wd(L),B=A||D;if(C<z||B){if(A&&(L.setActive().setPosition(w,S).setOrigin(.5),P.push(L),E.push(L)),w=b,S=x,C=c,T.push({children:E,height:M}),R=Math.max(R,M),M=0,E=[],D||!a&&T.length===i)break;if(B)continue}C-=z,M+=z,L.setActive().setPosition(w,S).setOrigin(.5),P.push(L),E.push(L),S+=z;}else L.setActive(),P.push(L),E.push(L);}E.length>0&&(T.push({children:E,height:M}),R=Math.max(R,M)),g.start+=P.length,g.isLastPage=g.start===_,g.maxLineHeight=R,g.linesWidth=T.length*s;var j=this.fixedWidth>0?this.fixedWidth:g.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:g.maxLineHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(s){case 1:case"center":n=(e-u)/2;break;case 2:case"right":n=e-u;break;default:n=0;}a&&(n+=l);for(var c=0,d=h.length;c<d;c++){var f=h[a?d-c-1:c],p=f.children,v=f.height,g=Ld(p);switch(void 0===g&&(g=o),g){case 1:case"center":r=(i-v)/2;break;case 2:case"bottom":r=i-v;break;default:r=0;}zd(p,n,r),n+=l;}}(g,o=j-r,u=W-n),this.setCanvasSize(j,W);for(m=0,k=P.length;m<k;m++){(L=P[m]).renderable&&(L.x0=L.x,L.y0=L.y);}return g},Id=Phaser.Utils.Objects.Merge,Hd=Phaser.Utils.Objects.GetValue,Fd=Phaser.Utils.Array.GetAll,Nd=Phaser.Math.Distance.BetweenPointsSquared,Gd=function(t,e,i){for(var n=0,r=(t=t).length;n<r;n++){var s=t[n];if(s.active&&s.renderable&&s.contains(e,i))return s}return null},Vd=function(){return this.on("pointerdown",Ud,this).on("pointerdown",Jd,this).on("pointermove",Kd,this).on("pointerover",Kd,this).on("pointerout",(function(t,e){Kd.call(this,t,null,null,e);}),this),this},Ud=function(t,e,i,n){if(this.childrenInteractiveEnable){var r=Gd(this.children,e,i);r&&this.emit("child.pointerdown",r,t,e,i,n);}},Jd=function(t,e,i,n){if(this.childrenInteractiveEnable){var r=Gd(this.children,e,i);r&&this.emit("child.pointerup",r,t,e,i,n);}},Kd=function(t,e,i,n){if(this.childrenInteractiveEnable)if(null!==e){var r=Gd(this.children,e,i);r!==this.lastOverChild&&(null!==this.lastOverChild&&this.emit("child.pointerout",this.lastOverChild,t,e,i,n),null!==r&&this.emit("child.pointerover",r,t,e,i,n),this.lastOverChild=r);}else null!==this.lastOverChild&&(this.emit("child.pointerout",this.lastOverChild,t,e,i,n),this.lastOverChild=null);},qd=Phaser.GameObjects.GameObject,Zd=Phaser.Utils.Array.BringToTop,$d=Phaser.Utils.Array.SendToBack,Qd=Phaser.Utils.Array.MoveUp,tf=Phaser.Utils.Array.MoveDown,ef=Phaser.Utils.Array.MoveAbove,nf=Phaser.Utils.Array.MoveBelow,rf={moveChildToFist:function(t){return $d(this.children,t),this},moveChildToLast:function(t){return Zd(this.children,t),this},movechildUp:function(t){return Qd(this.children,t),this},movechildDown:function(t){return tf(this.children,t),this},movechildAbove:function(t,e){return ef(this.children,t,e),this},movechildBelow:function(t,e){return nf(this.children,t,e),this}},sf={setFixedSize:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.fixedWidth===t&&this.fixedHeight===e||(this.fixedWidth=t,this.fixedHeight=e,this.dirty=!0,this.setCanvasSize(t>0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,n=i.left,r=i.right,s=i.top,o=i.bottom;return Ve(i,t,e),this.dirty=this.dirty||n!=i.left||r!=i.right||s!=i.top||o!=i.bottom,this},getPadding:function(t){return Ge(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),pd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return vd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i,n,r,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,p(t)):this.children.push(t):s?(n=this.children).splice.apply(n,[e,0].concat(p(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(r=this.lastAppendedChildren).push.apply(r,p(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(gd);return null===i?i=new Cd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],n=0,r=t.length;n<r;n++){var s=t.charAt(n),o=this.poolManager.allocate(gd);null===o?o=new Cd(this,s,this.textStyle):o.setParent(this).setActive().modifyStyle(this.textStyle).setText(s),i.push(o);}return i},setText:function(t,e){return void 0===t&&(t=""),this.removeChildren(),Od.call(this,t,e),this.dirty=!0,this},appendText:Od,insertText:function(t,e,i){var n=this.createCharChildren(e,i);return t=this.getCharChildIndex(t,!0),this.addChild(n,t),this},removeText:function(t,e){void 0===e&&(e=1);for(var i=0;i<e;i++){var n=this.getCharChildIndex(t,!0);if(void 0===n)break;this.removeChild(this.children[n]);}return this},getText:function(t){var e="";return this.forEachCharChild((function(t){e+=t.text;}),void 0,t),e},createImageChild:function(t,e,i){var n=this.poolManager.allocate(yd);return null===n?n=new _d(this,t,e):n.setParent(this).setActive().setTexture(t,e),n.modifyPorperties(i),n},appendImage:function(t,e,i){var n=this.createImageChild(t,e,i);return this.addChild(n),this},createDrawerChild:function(t,e,i){var n=this.poolManager.allocate(md);return null===n?n=new Pd(this,t,e,i):n.setParent(this).setActive().setRenderCallback(t).setDrawerSize(e,i),n},appendDrawer:function(t,e,i){var n=this.createDrawerChild(t,e,i);return this.addChild(n),this},createSpaceChild:function(t){var e=this.poolManager.allocate(kd);return null===e?e=new Td(this,t):e.setParent(this).setActive().setSpaceWidth(t),e},appendSpace:function(t){var e=this.createSpaceChild(t);return this.addChild(e),this},createCommandChild:function(t,e,i,n){var r=this.poolManager.allocate(bd);return null===r?r=new Ed(this,t,e,i,n):r.setParent(this).setActive().setName(t).setCallback(e,n).setParameter(i),r},appendCommand:function(t,e,i,n){var r=this.createCommandChild(t,e,i,n);return this.addChild(r),this},setWrapConfig:function(e){return void 0===e?e={}:"object"===t(e)&&(e=Ph(e)),this.wrapConfig=e,this},runWordWrap:function(t){return void 0===t&&(t={}),jd.call(this,Wd(t,this.wrapConfig))},runVerticalWrap:function(t){return void 0===t&&(t={}),Xd.call(this,Id(t,this.wrapConfig))},runWrap:function(t){var e=Hd(this.wrapConfig,"callback");return e||(e=Hd(t,"callback",this.runWordWrap)),"string"==typeof e&&(e=this[e]),e.call(this,t)},renderContent:function(){var t;this.clear(),this.setCanvasSize(this.width,this.height),this.background.active&&this.background.render();for(var e=0,i=this.children.length;e<i;e++)(t=this.children[e]).active&&t.render();this.innerBounds.active&&this.innerBounds.render();},forEachChild:function(t,e,i){void 0===i&&(i=!0);for(var n=this.children,r=0,s=0,o=n.length;s<o;s++){var a,h=n[s];if(!i||h.active)if(a=e?t.call(this,h,r,n):t(h,r,n),r++,a)break}return this},forEachRenderableChild:function(t,e,i){void 0===i&&(i=!0);for(var n=this.children,r=0,s=0,o=n.length;s<o;s++){var a,h=n[s];if(!i||h.active)if(h.renderable&&!h.removed)if(a=e?t.call(this,h,r,n):t(h,r,n),r++,a)break}return this},forEachCharChild:function(t,e,i){void 0===i&&(i=!0);for(var n=this.children,r=0,s=0,o=n.length;s<o;s++){var a,h=n[s];if(!i||h.active)if(Sd(h)&&!h.removed)if(a=e?t.call(this,h,r,n):t(h,r,n),r++,a)break}return this},getChildren:function(){return this.children},getActiveChildren:function(){return Fd(this.children,"active",!0)},getCharChildren:function(t,e){return void 0===e&&(e=[]),this.forEachCharChild((function(t){e.push(t);}),void 0,t),e},getLastAppendedChildren:function(){return this.lastAppendedChildren},getNearestChild:function(t,e){var i={x:t,y:e},n=1/0,r=null;return this.forEachRenderableChild((function(t){var e=Nd(i,function(t,e,i,n){"number"!=typeof e&&(n=e,e=0,i=0);var r=t.drawCenterX+e,s=t.drawCenterY+i;return Zc(t,r,s,n)}(t,!0));n>e&&(n=e,r=t);})),r},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),ed(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,r=t.length;n<r;n++){var s=t[n];if(s.renderable&&s.active&&s.visible){var o=void 0!==s.x0?s.x0:s.x,a=void 0!==s.y0?s.y0:s.y;e=Math.max(e,o),i=Math.max(i,a);}}var h=e+this.padding.left+this.padding.right+this.wrapPadding.left+this.wrapPadding.right,l=i+this.padding.top+this.padding.bottom+this.wrapPadding.top+this.wrapPadding.bottom;return this.width===h&&this.height===l||(this.dirty=!0,this.setCanvasSize(h,l)),this},getCharChildIndex:function(t,e){void 0===e&&(e=!0);for(var i=this.children,n=0,r=i.length;n<r;n++){var s=i[n];if((!e||s.active)&&(Sd(s)&&!s.removed)){if(0===t)return n;t--;}}},getCharChild:function(t,e){void 0===e&&(e=!0);for(var i=this.children,n=0,r=i.length;n<r;n++){var s=i[n];if((!e||s.active)&&(Sd(s)&&!s.removed)){if(0===t)return s;t--;}}},getCharIndex:function(t,e){if("number"!=typeof t&&(t=this.children.indexOf(t))<0)return null;void 0===e&&(e=!0);var i=this.children;t>=i.length&&(t=i.length);for(var n=0,r=0;r<t;r++){var s=i[r];e&&!s.active||Sd(s)&&!s.removed&&n++;}return n},setChildrenInteractiveEnable:function(t){return void 0===t&&(t=!0),this.childrenInteractiveEnable!==t&&(this.lastOverChild=null),this.childrenInteractiveEnable=t,this},setInteractive:function(t,e,i){var n=!!this.input;return qd.prototype.setInteractive.call(this,t,e,i),n||Vd.call(this),this}};Object.assign(sf,rf,{setBackgroundColor:function(t,e,i){return this.background.setColor(t,e,i),this},setBackgroundStroke:function(t,e){return this.background.setStroke(t,e),this},setBackgroundCornerRadius:function(t,e){return this.background.setCornerRadius(t,e),this}},{setInnerBoundsColor:function(t,e,i){return this.innerBounds.setColor(t,e,i),this},setInnerBoundsStroke:function(t,e){return this.innerBounds.setStroke(t,e),this}},{setVAlign:function(t){return this.wrapConfig.vAlign=t,this},setHAlign:function(t){return this.wrapConfig.hAlign=t,this}},{setTextOX:function(t){return t===this._textOX||(this._textOX=t),this},setTextOY:function(t){return t===this._textOY||(this._textOY=t),this},setTextOXY:function(t,e){if(t!==this._textOX||e!==this._textOY)return this._textOX=t,this._textOY=e,this},addTextOX:function(t){return this.setTextOX(this._textOX+t),this},addTextOY:function(t){return this.setTextOY(this._textOY+t),this},addTextOXY:function(t,e){return this.setTextOXY(this._textOX+t,this._textOY+e),this}});var of=Phaser.Utils.Objects.GetFastValue,af={},hf=function(){function t(i){e(this,t),this.pools=of(i,"pools",af);}return n(t,[{key:"free",value:function(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new mu),this.pools[e].push(t),t.onFree(),this}},{key:"freeMultiple",value:function(t){if(!this.pools)return this;for(var e=0,i=t.length;e<i;e++)this.free(t[e]);return this}},{key:"allocate",value:function(t){return this.pools&&this.pools.hasOwnProperty(t)?this.pools[t].pop():null}}]),t}(),lf=Phaser.Utils.Objects.IsPlainObject,uf=Phaser.Utils.Objects.GetValue,cf=function(t){r(o,t);var i=l(o);function o(t,n,r,s,h,l){var u;e(this,o),lf(n)?(n=uf(l=n,"x",0),r=uf(l,"y",0),s=uf(l,"width",0),h=uf(l,"height",0)):lf(s)&&(s=uf(l=s,"width",0),h=uf(l,"height",0));var c=0===s?1:s,d=0===h?1:h;(u=i.call(this,t,n,r,c,d)).type="rexDynamicText",u.autoRound=!0,u.padding=Ve(),u.wrapPadding=Ve();var f=uf(l,"style",void 0);u.defaultTextStyle=new fd(null,f),u.textStyle=u.defaultTextStyle.clone(),u.setTestString(uf(l,"testString","|MÉqgy")),u._textOX=0,u._textOY=0,u.background=new ld(a(u),uf(l,"background",void 0)),u.innerBounds=new cd(a(u),uf(l,"innerBounds",void 0)),u.children=[],u.lastAppendedChildren=[],u.lastOverChild=null,u.poolManager=new hf(l),u.setFixedSize(s,h),u.setPadding(uf(l,"padding",0)),u.setWrapConfig(uf(l,"wrap",void 0)),u.setChildrenInteractiveEnable(uf(l,"childrenInteractive",!1));var p=uf(l,"text",void 0);return p&&u.setText(p),u}return n(o,[{key:"updateTexture",value:function(){return this.renderContent(),c(s(o.prototype),"updateTexture",this).call(this),this}},{key:"text",get:function(){return this.getText(!0)},set:function(t){this.setText(t);}},{key:"setSize",value:function(t,e){return this.setFixedSize(t,e),this}},{key:"textOX",get:function(){return this._textOX},set:function(t){this.setTextOX(t);}},{key:"textOY",get:function(){return this._textOY},set:function(t){this.setTextOY(t);}}]),o}(jc);Object.assign(cf.prototype,sf);var df=Phaser.GameObjects.BitmapText,ff=function(t){return t instanceof df},pf=Phaser.GameObjects.Text,vf=function(t){return t instanceof pf},gf=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof cf}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):ff(t)?function(t){return function(e){return t.setMaxWidth(e),t.minHeight=t.height,t}}(t):function(t){return function(e){var i=t.padding,n=e-i.left-i.right,r=t.style;return vf(t)?(r.wordWrapWidth=n,r.maxLines=0):(0===r.wrapMode&&(r.wrapMode=1),r.wrapWidth=n,r.maxLines=0),r.fixedWidth=e,r.fixedHeight=0,t.updateText(),t.minHeight=t.height,t}}(t),t},yf=function(t,e){var i=new gl(t,e);return t.add.existing(i),i},mf=Phaser.Utils.Objects.GetValue,kf=function(t){r(s,t);var i=l(s);function s(t,n,r){var o;return e(this,s),n=function(t,e,i){e=e?Ph(e):{};var n=mf(i,"background",Rl),r=mf(i,"text",Mc),s=mf(i,"icon",yf),o=mf(i,"action",yf);if(n?e.background=n(t,e.background):delete e.background,r){var a=mf(e,"wrapText",!1);a&&(!0===a&&(a="word"),Eh(e,"text.wrap.mode",a),e.expandTextWidth=!0),e.text=r(t,e.text),a&&(e.text=gf(e.text));}else delete e.text;return s&&null!==e.icon?e.icon=s(t,e.icon):delete e.icon,o&&null!==e.action?e.action=o(t,e.action):delete e.action,e}(t,n,r),(o=i.call(this,t,n)).type="rexSimpleLabel",o}return n(s,[{key:"setActiveState",value:function(t){return bf(this.getChildren(),"setActiveState",t),this}},{key:"setHoverState",value:function(t){return bf(this.getChildren(),"setHoverState",t),this}},{key:"setDisableState",value:function(t){return bf(this.getChildren(),"setDisableState",t),this}}]),s}(_h),bf=function(t,e,i){for(var n=0,r=t.length;n<r;n++){var s=t[n];s&&s[e]&&s[e](i);}},xf=function(t,e,i){var n=new kf(t,e,i);return t.add.existing(n),n},wf=function(t){this.childrenMap.title.resetDisplayContent(t.title);},Sf=function(t){var e=this.childrenMap.content;if(e.resetDisplayContent)e.resetDisplayContent(t.content);else {var i=t.content||"";e.setText(i);}},Cf=function(t){var e=this.childrenMap.actions;if(e){var i=t.buttons;if(i){for(var n=this.scene,r=this.defaultActionConfig,s=this.defaultActionButtonCreator,o=0,a=i.length;o<a;o++){var h=i[o],l=e[o];l||(l=xf(n,r,s),this.addAction(l)),l.show().resetDisplayContent(h);}this.buttonMode=i.length;for(o=i.length,a=e.length;o<a;o++)e[o].hide();}else {var u=e[0];u&&u.resetDisplayContent(t.buttonA);var c=e[1];c&&c.resetDisplayContent(t.buttonB);}}},Of=function(t){var e=this.childrenMap.choices;if(e){var i=t.choices;i||(i=[]);for(var n=this.scene,r=this.defaultChoiceConfig,s=this.defaultActionButtonCreator,o=0,a=i.length;o<a;o++){var h=i[o];"string"==typeof h&&(h={text:h});var l,u=e[o];u||(u=xf(n,r,s),this.addChoice(u)),u.show().resetDisplayContent(h),l=h.hasOwnProperty("value")?h.value:h.text,u.setName(l);}for(o=i.length,a=e.length;o<a;o++)e[o].hide();}},_f={resetDisplayContent:function(t){return void 0===t&&(t={}),wf.call(this,t),Sf.call(this,t),Cf.call(this,t),Of.call(this,t),this},modal:function(t,e){or(t)&&(e=t,t=void 0),void 0===t&&(t={});var i=0===this.buttonMode;return t.hasOwnProperty("anyTouchClose")||(t.anyTouchClose=i),t.hasOwnProperty("manualClose")||(t.manualClose=!i),ar.modal.call(this,t,e),this}},Pf=function(t){t.setHoverState&&t.setHoverState(!0);},Tf=function(t){t.setHoverState&&t.setHoverState(!1);},Ef=function(t,e,i,n){t.setActiveState&&t.setActiveState(n);},Mf=function(t){t.setDisableState&&t.setDisableState(!1);},Rf=function(t){t.setDisableState&&t.setDisableState(!0);},Lf=function(){this.on("button.over",Pf).on("button.out",Tf).on("button.enable",Mf).on("button.disable",Rf).on("button.statechange",Ef);},zf={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Af=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Df=Phaser.Utils.Objects.GetValue,Bf=Phaser.Math.Linear,jf=Phaser.Math.Percent,Wf={setValue:function(t,e,i){return null==t||(void 0!==e&&(t=jf(t,e,i)),this.value=t),this},addValue:function(t,e,i){return void 0!==e&&(t=jf(t,e,i)),this.value+=t,this},getValue:function(t,e){var i=this.value;return void 0!==t&&(i=Bf(t,e,i)),i}},Yf=Phaser.Math.Percent,Xf={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=Yf(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new yn(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,n){return void 0===i&&(i=-1),void 0===n&&(n=0),void 0===this.easeValueTask&&(this.easeValueTask=new yn(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:n}),this}},If=Phaser.Utils.Objects.GetValue,Hf=Phaser.Math.Clamp;var Ff=Phaser.Math.Percent,Nf=function(t,e,i){var n;return t.y===e.y?n=Ff(i.x,t.x,e.x):t.x===e.x&&(n=Ff(i.y,t.y,e.y)),n},Gf=function(t,e,i){var n,r;this.enable&&(Vf.x=e,Vf.y=i,this.reverseAxis?(n=this.getEndPoint(),r=this.getStartPoint()):(n=this.getStartPoint(),r=this.getEndPoint()),this.value=Nf(n,r,Vf));},Vf={},Uf=function(t,e,i){if(this.enable&&t.isDown){var n,r;Jf.x=t.worldX,Jf.y=t.worldY,this.reverseAxis?(n=this.getEndPoint(),r=this.getStartPoint()):(n=this.getStartPoint(),r=this.getEndPoint());var s=Nf(n,r,Jf);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-s)<.1?this.value=s:this.easeValueTo(s);}},Jf={},Kf=function(t,e){void 0===e&&(e=qf);var i=this.childrenMap.thumb,n=i.x,r=i.y;return Se(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=n,i.y=r,e},qf={},Zf=Phaser.Display.Align.LEFT_CENTER,$f=Phaser.Display.Align.TOP_CENTER,Qf={},tp=Phaser.Display.Align.RIGHT_CENTER,ep=Phaser.Display.Align.BOTTOM_CENTER,ip={},np=Phaser.Math.Linear,rp={},sp=Phaser.Display.Align.LEFT_CENTER,op=Phaser.Display.Align.TOP_CENTER,ap=Phaser.Display.Align.RIGHT_CENTER,hp=Phaser.Display.Align.BOTTOM_CENTER,lp=Phaser.Utils.Objects.GetValue,up=Phaser.Utils.Objects.IsPlainObject,cp=Phaser.Math.Clamp,dp=Phaser.Math.Snap.To,fp=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),(r=i.call(this,t,n)).type="rexSlider",r.bootProgressBase(n),r.reverseAxis=lp(n,"reverseAxis",!1);var o=lp(n,"background",void 0),h=lp(n,"track",void 0),l=lp(n,"indicator",void 0),u=lp(n,"thumb",void 0);o&&(up(o)&&(o=Rl(t,o)),r.addBackground(o)),h&&(up(h)&&(h=Rl(t,h)),r.add(h,{proportion:1,expand:!0,minWidth:0===r.orientation?0:void 0,minHeight:1===r.orientation?0:void 0})),l&&(up(l)&&(l=Rl(t,l)),r.pin(l)),u&&(up(u)&&(u=Rl(t,u)),r.pin(u));var c=lp(n,"input",0);switch("string"==typeof c&&(c=pp[c]),c){case 0:u&&(u.setInteractive(),r.scene.input.setDraggable(u),u.on("drag",Gf,a(r)).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t);}),a(r)).on("dragend",(function(t){this.eventEmitter.emit("inputend",t);}),a(r)));break;case 1:r.on("pointerdown",Uf,a(r)).on("pointermove",Uf,a(r)).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t);}),a(r)).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t);}),a(r)).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t);}),a(r)).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t);}),a(r)).setInteractive();}return r.addChildrenMap("background",o),r.addChildrenMap("track",h),r.addChildrenMap("indicator",l),r.addChildrenMap("thumb",u),r.setEnable(lp(n,"enable",void 0)),r.setGap(lp(n,"gap",void 0)),r.setValue(lp(n,"value",0),lp(n,"min",void 0),lp(n,"max",void 0)),r}return n(s,[{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setGap",value:function(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}},{key:"value",get:function(){return this._value},set:function(t){void 0!==this.gap&&(t=dp(t,this.gap));var e=this._value;this._value=cp(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter));}},{key:"postLayout",value:function(t,e,i){return this.updateThumb(),this.updateIndicator(),this}}]),s}(function(t){var i=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s,[{key:"bootProgressBase",value:function(t){this.eventEmitter=If(t,"eventEmitter",this);var e=If(t,"valuechangeCallback",null);if(null!==e){var i=If(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i);}return this.setEaseValuePropName("value").setEaseValueDuration(If(t,"easeValue.duration",0)).setEaseValueFunction(If(t,"easeValue.ease","Linear")),this}},{key:"value",get:function(){return this._value},set:function(t){t=Hf(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter);}}]),s}(t);return Object.assign(i.prototype,Wf,Xf),i}(Po)),pp={pan:0,drag:0,click:1,none:-1},vp={getStartPoint:function(t){if(void 0===t&&(t=Qf),this.childrenMap.thumb){var e=0===this.orientation?Zf:$f;Kf.call(this,e,t);}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=ip),this.childrenMap.thumb){var e=0===this.orientation?tp:ep;Kf.call(this,e,t);}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,n=this.childrenMap.thumb;return void 0===n||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,n){void 0===n&&(n=rp),n.x=np(e.x,i.x,t),n.y=np(e.y,i.y,t);}(t,e,i,n),this.resetChildPositionState(n)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,n,r,s=this.reverseAxis,o=this.childrenMap.thumb;if(o)if(0===this.orientation){var a=vt(o);if(s){h=o.x-a*o.originX;i=this.right-h;}else {var h;i=(h=o.x-a*o.originX)+a-this.left;}}else {var l=gt(o);if(s){u=o.y-l*o.originY;n=this.bottom-u;}else {var u;n=(u=o.y-l*o.originY)+l-this.top;}}else 0===this.orientation?i=this.width*t:n=this.height*t;pr(e,i,n),r=s?0===this.orientation?ap:hp:0===this.orientation?sp:op,we(e,this,r),this.resetChildPositionState(e);}};Object.assign(fp.prototype,vp);var gp=Phaser.Utils.Objects.GetValue,yp=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),(r=i.call(this,t,n)).type="rexScrollBar";var o,h=gp(n,"background",void 0),l=gp(n,"buttons",void 0),u=gp(l,"top",gp(l,"left",void 0)),c=gp(l,"bottom",gp(l,"right",void 0)),d=gp(n,"slider",void 0);(h&&r.addBackground(h),u)&&(r.add(u),new Dr(u).on("intouch",(function(){if(this.enable){var t=o.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t;}}),a(r)));if(d){var f;if(d.orientation=r.orientation,d.eventEmitter=a(r),d.value=null,0===r.orientation)f=void 0===gp(d,"width",void 0)?1:0;else f=void 0===gp(d,"height",void 0)?1:0;o=new fp(t,d),t.add.existing(o),r.add(o,{proportion:f});}c&&(r.add(c),new Dr(c).on("intouch",(function(){if(this.enable){var t=o.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t;}}),a(r)));var p=[u,c];r.addChildrenMap("background",h),r.addChildrenMap("slider",o),r.addChildrenMap("buttons",p);var v=gp(n,"valuechangeCallback",null);if(null!==v){var g=gp(n,"valuechangeCallbackScope",void 0);r.on("valuechange",v,g);}return r.setEnable(gp(n,"enable",void 0)),r.setValue(gp(n,"value",0)),r.setScrollStep(gp(l,"step",.01)),r}return n(s,[{key:"setScrollStep",value:function(t){return this.scrollStep=t,this}},{key:"enable",get:function(){return !!this.childrenMap.slider&&this.childrenMap.slider.enable},set:function(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"value",get:function(){return this.childrenMap.slider?this.childrenMap.slider.value:0},set:function(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t);}},{key:"setValue",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}},{key:"addValue",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}},{key:"getValue",value:function(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}},{key:"easeValueTo",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}},{key:"stopEaseValue",value:function(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}},{key:"setEaseValueDuration",value:function(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}},{key:"setEaseValueFunction",value:function(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}}]),s}(Po),mp=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,n)).parent=t,r.init(),r}return n(s,[{key:"init",value:function(){this.start("IDLE");}},{key:"next_IDLE",value:function(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}},{key:"update_IDLE",value:function(t,e){this.next();}},{key:"next_DRAGBEGIN",value:function(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}},{key:"update_DRAGBEGIN",value:function(t,e){this.next();}},{key:"next_DRAG",value:function(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}},{key:"update_DRAG",value:function(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next();}},{key:"enter_DRAG",value:function(){this.parent.onDragStart();}},{key:"exit_DRAG",value:function(){this.parent.onDragEnd();}},{key:"next_SLIDE",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}},{key:"enter_SLIDE",value:function(){this.parent.onSliding();}},{key:"exit_SLIDE",value:function(){this.parent.stop();}},{key:"update_SLIDE",value:function(t,e){this.parent.sliding(t,e),this.next();}},{key:"next_BACK",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}},{key:"enter_BACK",value:function(){this.parent.onPullBack();}},{key:"exit_BACK",value:function(){this.parent.stop();}},{key:"update_BACK",value:function(t,e){this.parent.pullBack(t,e),this.next();}}]),s}(Dn),kp=Phaser.Utils.Objects.GetValue,bp=Phaser.Math.Distance.Between,xp=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,t.setInteractive(kp(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(kp(t,"enable",!0)),this.holdThreshold=kp(t,"holdThreshold",50),this.pointerOutReleaseEnable=kp(t,"pointerOutRelease",!0),this}},{key:"boot",value:function(){this.parent.on("pointerdown",this.onPointIn,this),this.parent.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&this.parent.on("pointerout",this.onPointOut,this),this.parent.on("pointermove",this.onPointerMove,this),this.scene.sys.events.on("preupdate",this.preupdate,this);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t);}},{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:"setPointerOutReleaseEnable",value:function(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}},{key:"isDown",get:function(){return this.pointer&&this.pointer.isDown}},{key:"isUp",get:function(){return !this.isDown}},{key:"dx",get:function(){return this.x-this.preX}},{key:"dy",get:function(){return this.y-this.preY}},{key:"dt",get:function(){return fs(this.scene)}},{key:"speed",get:function(){return this.x===this.preX&&this.y===this.preY?0:bp(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}},{key:"speedX",get:function(){return this.dx/(.001*this.dt)}},{key:"speedY",get:function(){return this.dy/(.001*this.dt)}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.localX=e,this.localY=i);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0);}},{key:"onPointerMove",value:function(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.localX=e,this.localY=i);}},{key:"preupdate",value:function(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i));}}}]),o}(ai),wp=Phaser.Utils.Objects.GetValue,Sp=function(){function t(i){e(this,t),this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){return this.setValue(wp(t,"value",0)),this.setSpeed(wp(t,"speed",0)),this.setAcceleration(wp(t,"acceleration",0)),this}},{key:"reset",value:function(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0);}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"setAcceleration",value:function(t){return this.acceleration=t,this}},{key:"updateSpeed",value:function(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}},{key:"getDeltaValue",value:function(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}},{key:"update",value:function(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}},{key:"isMoving",get:function(){return this.speed>0}}]),t}(),Cp=function(){function t(){e(this,t),this.value,this.dir,this.movement=new Sp;}return n(t,[{key:"init",value:function(t,e,i,n,r){return this.value=t,this.end=r,this.dir=void 0!==r?t<r:e,this.movement.setSpeed(i).setAcceleration(-n),this}},{key:"stop",value:function(){this.movement.reset();}},{key:"update",value:function(t){var e=this.movement.getDeltaValue(t);return this.dir||(e=-e),void 0===this.end?this.value+=e:0===e?this.value=this.end:(this.value+=e,this.dir?this.value>this.end&&(this.value=this.end):this.value<this.end&&(this.value=this.end)),this}},{key:"isMoving",get:function(){return this.movement.isMoving}}]),t}(),Op=Phaser.Utils.Objects.GetValue,_p=Phaser.Math.Clamp,Pp=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),r=i.call(this,t,n);var s=Op(n,"enable",!0);r._state=new mp(a(r),{enable:s,eventEmitter:!1});var h={inputConfig:Op(n,"inputConfig",void 0),enable:s,pointerOutRelease:Op(n,"pointerOutRelease",!0),eventEmitter:!1};r.dragState=new xp(t,h),r._enable=void 0,r._value=void 0,r._slowDown=new Cp;var l=Op(n,"valuechangeCallback",null);if(null!==l){var u=Op(n,"valuechangeCallbackScope",void 0);r.on("valuechange",l,u);}if(null!==(l=Op(n,"overmaxCallback",null))){u=Op(n,"overmaxCallbackScope",void 0);r.on("overmax",l,u);}if(null!==(l=Op(n,"overminCallback",null))){u=Op(n,"overminCallbackScope",void 0);r.on("overmin",l,u);}return r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){this.setOrientationMode(Op(t,"orientation",0)),this.setDragThreshold(Op(t,"threshold",10)),this.setSlidingDeceleration(Op(t,"slidingDeceleration",5e3)),this.setBackDeceleration(Op(t,"backDeceleration",2e3));var e=Op(t,"dragRate",1);e*=Op(t,"dragReverse",!1)?-1:1,this.setDragRate(e);var i=Op(t,"bounds",void 0);return i?this.setBounds(i):this.setBounds(Op(t,"max",0),Op(t,"min",0)),this.setValue(Op(t,"value",this.maxValue||0)),this.setEnable(Op(t,"enable",!0)),this}},{key:"boot",value:function(){this.scene.sys.events.on("preupdate",this._state.update,this._state);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this._state.update,this._state),this._state.destroy(t),this.dragState.destroy(t),this._state=void 0,this.dragState=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return this._enable=t,this._state.setEnable(t),this.dragState.setEnable(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:"setOrientationMode",value:function(t){return "string"==typeof t&&(t=Tp[t]),this.orientationMode=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setSlidingDeceleration",value:function(t){return this.slidingDeceleration=t,this}},{key:"setBackDeceleration",value:function(t){return this.backDeceleration=t,this}},{key:"setDragRate",value:function(t){return this.dragRate=t,this}},{key:"setBounds",value:function(t,e){if(Array.isArray(t)){var i=t;t=i[0],e=i[1];}return t<e?(this.minValue=t,this.maxValue=e):(this.minValue=e,this.maxValue=t),this}},{key:"value",get:function(){return this._value},set:function(t){if(t!==this._value){var e=this._value,i=this.overMax(t),n=this.overMin(t);i&&this.emit("overmax",t,e),n&&this.emit("overmin",t,e),this.backEnable||(i&&(t=this.maxValue),n&&(t=this.minValue)),this._value=t,this.emit("valuechange",t,e);}}},{key:"setValue",value:function(t,e){return void 0===e&&(e=!1),e&&(t=_p(t,this.minValue,this.maxValue)),this.value=t,this}},{key:"addValue",value:function(t,e){return this.setValue(this.value+t,e),this}},{key:"state",get:function(){return this._state.state}},{key:"isDragging",get:function(){return this.dragState.isInTouched}},{key:"outOfMaxBound",get:function(){return this.overMax(this.value)}},{key:"outOfMinBound",get:function(){return this.overMin(this.value)}},{key:"outOfBounds",get:function(){return this.outOfMinBound||this.outOfMaxBound}},{key:"overMax",value:function(t){return null!=this.maxValue&&t>this.maxValue}},{key:"overMin",value:function(t){return null!=this.minValue&&t<this.minValue}},{key:"backEnable",get:function(){return "number"==typeof this.backDeceleration}},{key:"isPullBack",get:function(){return this._slowDown.isMoving}},{key:"slidingEnable",get:function(){return "number"==typeof this.slidingDeceleration}},{key:"isSliding",get:function(){return this._slowDown.isMoving}},{key:"dragDelta",get:function(){var t;return t=0===this.orientationMode?this.dragState.dy:1===this.orientationMode?this.dragState.dx:0,t*=this.dragRate}},{key:"dragSpeed",get:function(){var t;return t=0===this.orientationMode?this.dragState.speedY:1===this.orientationMode?this.dragState.speedX:0,t*=this.dragRate}},{key:"onDragStart",value:function(){this.emit("dragstart");}},{key:"onDragEnd",value:function(){this.emit("dragend");}},{key:"dragging",value:function(){this.value+=this.dragDelta;}},{key:"onSliding",value:function(){var t=this.value,e=this.dragSpeed;if(0===e)return this._slowDown.stop(),void this._state.next();var i=this.slidingDeceleration;this._slowDown.init(t,e>0,Math.abs(e),i);}},{key:"sliding",value:function(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i;}},{key:"onPullBack",value:function(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),n=this.backDeceleration,r=Math.sqrt(2*n*i);this._slowDown.init(t,void 0,r,n,e);}},{key:"pullBack",value:function(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next();}},{key:"stop",value:function(){this._slowDown.stop();}}]),o}(ai),Tp={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Ep=Phaser.Utils.Objects.GetValue,Mp=function(t){r(s,t);var i=l(s);function s(t,n){var r;(e(this,s),(r=i.call(this,t,n)).parent!==r.scene?r.focusMode=Ep(n,"focus",!0):r.focusMode=!1,r.setSpeed(Ep(n,"speed",.1)),r.setEnable(Ep(n,"enable",!0)),r.focusMode)?(t=r.parent).setInteractive(Ep(n,"inputConfig",void 0)).on("wheel",(function(t,e,i,n,r){this.enable&&this.scroll(i);}),a(r)):r.scene.input.on("wheel",r.onSceneScroll,a(r));return r}return n(s,[{key:"destroy",value:function(){this.focusMode||this.scene.input.off("wheel",this.onSceneScroll,this);}},{key:"onSceneScroll",value:function(t,e,i,n,r,s){this.enable&&this.scroll(n);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"scroll",value:function(t){t*=this.speed,this.emit("scroll",t,this.parent,this);}}]),s}(ai),Rp=Phaser.Utils.Objects.GetValue,Lp=function(t,e,i,n){var r,s,o,a,h="Y"===(i=i.toUpperCase()),l=2===t.scrollMode,u=t.childrenMap.child,c="slider".concat(i);if(r=l||n.hasOwnProperty(c)?Rp(n,c,void 0):Rp(n,"slider",void 0)){var d,f,p;!0===r&&(r={}),r.orientation=h?1:0,s=function(t,e){void 0===e&&(e={});var i=Rt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons;var n=new yp(t,e);t.add.existing(n);var r=n.childrenMap.slider;return n.addChildrenMap("track",r.childrenMap.track),n.addChildrenMap("indicator",r.childrenMap.indicator),n.addChildrenMap("thumb",r.childrenMap.thumb),n}(t.scene,r);var v=Rp(r,"position",0);"string"==typeof v&&(v=zp[v]);var g=Rp(n,"space.slider".concat(i),void 0);void 0===g&&void 0===(g=Rp(n,"space.slider",void 0))&&(g=l?0:Rp(n,"space.child",0));var y="number"==typeof g;h?0===v?(d=2,f=1,p=y?{left:g}:g):(d=0,f=1,p=y?{right:g}:g):0===v?(d=1,f=2,p=y?{top:g}:g):(d=1,f=0,p=y?{bottom:g}:g),e.add(s,{column:d,row:f,align:"center",padding:p,expand:!0}),t["hideUnscrollableSlider".concat(i)]=Rp(r,"hideUnscrollableSlider",!1),t["adaptThumb".concat(i,"SizeMode")]=Rp(r,"adaptThumbSize",!1),t["minThumb".concat(i,"Size")]=Rp(r,"minThumbSize",void 0);}else t["hideUnscrollableSlider".concat(i)]=!1,t["adaptThumb".concat(i,"SizeMode")]=!1,t["minThumb".concat(i,"Size")]=void 0;var m="scroller".concat(i);(o=l||n.hasOwnProperty(m)?Rp(n,m,!0):Rp(n,"scroller",!0))&&u&&(!0===o&&(o={}),o.orientation=h?0:1,a=new Pp(u,o));var k,b,x,w,S=Rp(n,l?"mouseWheelScroller".concat(i):"mouseWheelScroller",!1);(S&&u&&(k=new Mp(u,S)),t.addChildrenMap("slider".concat(i),s),t.addChildrenMap("scroller".concat(i),a),t.addChildrenMap("mouseWheelScroller".concat(i),k),l&&!h||(t.hideUnscrollableSlider=t["hideUnscrollableSlider".concat(i)],t.adaptThumbSizeMode=t["adaptThumb".concat(i,"SizeMode")],t.minThumbSize=t["minThumb".concat(i,"Size")],t.addChildrenMap("slider",s),t.addChildrenMap("scroller",a),t.addChildrenMap("mouseWheelScroller",k)),s)&&(l?(b=h?"t":"s",w="scroll".concat(i)):(b="t",w="scroll"),s.on("valuechange",(function(e){t[b]=e,t.emit(w,t);})));a&&(l?(x="childO".concat(i),w="scroll".concat(i)):(x="childOY",w="scroll"),a.on("valuechange",(function(e){t[x]=e,t.emit(w,t);})));if(k){var C="addChildO".concat(i);k.on("scroll",(function(e){t[C](-e,!0);}));}},zp={right:0,left:1,bottom:0,top:1},Ap=Phaser.Utils.Objects.GetValue,Dp=function(t,e){var i=t.scene,n=[0,1,0],r=[0,1,0],s=Ap(e,"width"),o=Ap(e,"height");s||(Ap(e,"child.expandWidth",!0)||(n[1]=0));o||(Ap(e,"child.expandHeight",!0)||(r[1]=0));var a=new Qa(i,{column:3,row:3,columnProportions:n,rowProportions:r});switch(function(t,e,i){var n=Df(i,"child"),r=Df(n,"gameObject",void 0);if(r){var s=Df(i,"space.child",0);t.childMargin={};var o=t.childMargin,a={};if("number"==typeof s)switch(t.scrollMode){case 0:case 1:o.top=0,o.bottom=0,o.left=0,o.right=0;break;default:o.top=s,o.bottom=s,o.left=s,o.right=s;}else switch(t.scrollMode){case 0:o.top=Df(s,"top",0),o.bottom=Df(s,"bottom",0),a.left=Df(s,"left",0),a.right=Df(s,"right",0);break;case 1:o.top=Df(s,"left",0),o.bottom=Df(s,"right",0),a.top=Df(s,"top",0),a.bottom=Df(s,"bottom",0);break;default:o.top=Df(s,"top",0),o.bottom=Df(s,"bottom",0),o.left=Df(s,"left",0),o.right=Df(s,"right",0);}e.add(r,{column:1,row:1,align:Df(n,"align","center"),padding:a,expand:{width:Df(n,"expandWidth",!0),height:Df(n,"expandHeight",!0)}});}t.addChildrenMap("child",r);}(t,a,e),t.scrollMode){case 0:Lp(t,a,"y",e);break;case 1:Lp(t,a,"x",e);break;default:Lp(t,a,"y",e),Lp(t,a,"x",e);}return a},Bp=function(t){var e,i,n,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,n=this.childrenMap.scroller,r=this.childrenMap.slider;break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),n=this.childrenMap["scroller".concat(t)],r=this.childrenMap["slider".concat(t)];}n&&n.setBounds(e,i),r&&r.setEnable(e!==i);},jp=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap["slider".concat(t)],i=this["hideUnscrollableSlider".concat(t)],n=this["isOverflow".concat(t)];e&&i&&this.setChildVisible(e,n);}},Wp=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,n=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var s=i.displayHeight*e;void 0!==r&&s<r&&(s=r),pr(n,void 0,s);}else {var o=i.displayWidth*e;void 0!==r&&o<r&&(o=r),pr(n,o,void 0);}Yp(a);break;default:var a;if(t=t.toUpperCase(),!this["adaptThumb".concat(t,"SizeMode")])return;if(!(a=this.childrenMap["slider".concat(t)]))return;i=a.childrenMap.track,n=a.childrenMap.thumb,r=this["minThumb".concat(t,"Size")];if("Y"===t){e=Math.min(this.childVisibleHeight/this.childHeight,1),s=i.displayHeight*e;void 0!==r&&s<r&&(s=r),pr(n,void 0,s);}else {e=Math.min(this.childVisibleWidth/this.childWidth,1),o=i.displayWidth*e;void 0!==r&&o<r&&(o=r),pr(n,o,void 0);}Yp(a);}},Yp=function(t){var e=t.minWidth,i=t.minHeight;t.minWidth=t.width,t.minHeight=t.height,t.layout(),t.minWidth=e,t.minHeight=i;},Xp=Phaser.Utils.Objects.GetValue,Ip=Phaser.Math.Clamp,Hp=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={});var o=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=Af(t));var i=t[e];return "string"==typeof i&&(i=zf[i]),i}(n),h=1===o;n.orientation=h?0:1,(r=i.call(this,t,n)).type=Xp(n,"type","rexScrollable"),r.scrollMode=o;var l=Xp(n,"background",void 0);l&&r.addBackground(l);var u=Xp(n,"header",void 0);if(u){var c=Xp(n,"align.header","center"),d=Xp(n,"space.header",0);v=h?{right:d}:{bottom:d},r.add(u,{proportion:0,align:c,padding:v,expand:Xp(n,"expand.header",!0)});}var f=Dp(a(r),n);f&&r.add(f,{proportion:1,align:"center",padding:0,expand:!0});var p=Xp(n,"footer",void 0);if(p){c=Xp(n,"align.footer","center");var v,g=Xp(n,"space.footer",0);v=h?{left:g}:{top:g},r.add(p,{proportion:0,align:c,padding:v,expand:Xp(n,"expand.footer",!0)});}return r.addChildrenMap("background",l),r.addChildrenMap("header",u),r.addChildrenMap("footer",p),r.runLayoutFlag=!1,r}return n(s,[{key:"postLayout",value:function(t,e,i){return this.resizeController(),this.runLayoutFlag||(this.runLayoutFlag=!0,this.setT(0),2===this.scrollMode&&this.setS(0)),this}},{key:"t",get:function(){var t=this.childrenMap.child.t,e=this.childMargin;if(0!==e.top||0!==e.bottom){var i=this.childrenMap.child,n=i.topChildOY-i.bottomChildOY,r=n+e.top+e.bottom,s=n*t+e.top;t=0!==r?s/r:0;}return t},set:function(t){var e=this.childMargin;if(0!==e.top||0!==e.bottom){var i=this.childrenMap.child,n=i.topChildOY-i.bottomChildOY,r=(n+e.top+e.bottom)*t-e.top;t=0!==n?r/n:0;}this.childrenMap.child.t=t,this.updateController();}},{key:"s",get:function(){var t=this.childrenMap.child.s,e=this.childMargin;if(0!==e.left||0!==e.right){var i=this.childrenMap.child,n=i.leftChildOX-i.rightChildOX,r=n+e.left+e.right,s=n*t+e.left;t=0!==r?s/r:0;}return t},set:function(t){var e=this.childMargin;if(0!==e.left||0!==e.right){var i=this.childrenMap.child,n=i.leftChildOX-i.rightChildOX,r=(n+e.left+e.right)*t-e.left;t=0!==n?r/n:0;}this.childrenMap.child.s=t,this.updateController();}},{key:"childOY",get:function(){return this.childrenMap.child.childOY},set:function(t){this.childrenMap.child.childOY=t,this.updateController();}},{key:"childOX",get:function(){return this.childrenMap.child.childOX},set:function(t){this.childrenMap.child.childOX=t,this.updateController();}},{key:"topChildOY",get:function(){return this.childrenMap.child.topChildOY+this.childMargin.top}},{key:"bottomChildOY",get:function(){return this.childrenMap.child.bottomChildOY-this.childMargin.bottom}},{key:"leftChildOX",get:function(){return this.childrenMap.child.leftChildOX+this.childMargin.left}},{key:"rightChildOX",get:function(){return this.childrenMap.child.rightChildOX-this.childMargin.right}},{key:"childVisibleHeight",get:function(){return this.childrenMap.child.childVisibleHeight}},{key:"childHeight",get:function(){return this.childrenMap.child.childHeight}},{key:"childVisibleWidth",get:function(){return this.childrenMap.child.childVisibleWidth}},{key:"childWidth",get:function(){return this.childrenMap.child.childWidth}},{key:"isOverflow",get:function(){var t=this.childrenMap.child;return t.topChildOY!==t.bottomChildOY}},{key:"isOverflowY",get:function(){return this.isOverflow}},{key:"isOverflowX",get:function(){var t=this.childrenMap.child;return t.leftChildOX!==t.rightChildOX}},{key:"setChildOY",value:function(t,e){return void 0===e&&(e=!1),e&&(t=Ip(t,this.bottomChildOY,this.topChildOY)),this.childOY=t,this}},{key:"addChildOY",value:function(t,e){return this.setChildOY(this.childOY+t,e),this}},{key:"setT",value:function(t,e){return void 0===e&&(e=!1),e&&(t=Ip(t,0,1)),this.t=t,this}},{key:"addT",value:function(t,e){return this.setT(this.t+t,e),this}},{key:"scrollToTop",value:function(){return this.t=0,this}},{key:"scrollToBottom",value:function(){if(this.t=1,0===this.t)return this;do{this.t=1;}while(1!==this.t);return this}},{key:"setChildOX",value:function(t,e){return void 0===e&&(e=!1),e&&(t=Ip(t,this.leftChildOX,this.rightChildOX)),this.childOX=t,this}},{key:"addChildOX",value:function(t,e){return this.setChildOX(this.childOX+t,e),this}},{key:"setS",value:function(t,e){return void 0===e&&(e=!1),e&&(t=Ip(t,0,1)),this.s=t,this}},{key:"addS",value:function(t,e){return this.setS(this.s+t,e),this}},{key:"scrollToLeft",value:function(){return this.s=0,this}},{key:"scrollToRight",value:function(){if(this.s=1,0===this.s)return this;do{this.s=1;}while(1!==this.s);return this}},{key:"sliderEnable",get:function(){var t=this.childrenMap.slider;return !!t&&t.enable},set:function(t){var e=this.childrenMap.slider;e&&e.setEnable(t);}},{key:"setSliderEnable",value:function(t){return void 0===t&&(t=!0),this.sliderEnable=t,this}},{key:"sliderYEnable",get:function(){return this.sliderEnable},set:function(t){this.sliderEnable=t;}},{key:"setSliderYEnable",value:function(t){return this.setSliderEnable(t),this}},{key:"sliderXEnable",get:function(){var t=this.childrenMap.sliderX;return !!t&&t.enable},set:function(t){var e=this.childrenMap.sliderX;e&&e.setEnable(t);}},{key:"setSliderXEnable",value:function(t){return void 0===t&&(t=!0),this.sliderXEnable=t,this}},{key:"scrollerEnable",get:function(){var t=this.childrenMap.scroller;return !!t&&t.enable},set:function(t){var e=this.childrenMap.scroller;e&&e.setEnable(t);}},{key:"setScrollerEnable",value:function(t){return void 0===t&&(t=!0),this.scrollerEnable=t,this}},{key:"scrollerYEnable",get:function(){return this.scrollerEnable},set:function(t){this.scrollerEnable=t;}},{key:"setScrollerYEnable",value:function(t){return this.setScrollerEnable(t),this}},{key:"scrollerXEnable",get:function(){var t=this.childrenMap.scrollerX;return !!t&&t.enable},set:function(t){var e=this.childrenMap.scrollerX;e&&e.setEnable(t);}},{key:"setScrollerXEnable",value:function(t){return void 0===t&&(t=!0),this.scrollerXEnable=t,this}},{key:"mouseWheelScrollerEnable",get:function(){var t=this.childrenMap.mouseWheelScroller;return !!t&&t.enable},set:function(t){var e=this.childrenMap.mouseWheelScroller;e&&e.setEnable(t);}},{key:"setMouseWheelScrollerEnable",value:function(t){return void 0===t&&(t=!0),this.mouseWheelScrollerEnable=t,this}},{key:"mouseWheelScrollerYEnable",get:function(){return this.mouseWheelScrollerEnable},set:function(t){this.mouseWheelScrollerEnable=t;}},{key:"setMouseWheelScrollerYEnable",value:function(t){return this.setMouseWheelScrollerEnable(t),this}},{key:"mouseWheelScrollerXEnable",get:function(){var t=this.childrenMap.mouseWheelScrollerX;return !!t&&t.enable},set:function(t){var e=this.childrenMap.mouseWheelScrollerX;e&&e.setEnable(t);}},{key:"setMouseWheelScrollerXEnable",value:function(t){return void 0===t&&(t=!0),this.mouseWheelScrollerXEnable=t,this}},{key:"setDropZoneEnable",value:function(t){void 0===t&&(t=!0);var e=this.childrenMap.child;return e.setInteractive(),e.input.dropZone=t,this}}]),s}(Po),Fp={resizeController:function(){switch(this.scrollMode){case 0:case 1:Bp.call(this),this.updateController(),jp.call(this),Wp.call(this);break;default:Bp.call(this,"y"),Bp.call(this,"x"),this.updateController(),jp.call(this,"y"),jp.call(this,"x"),Wp.call(this,"y"),Wp.call(this,"x");}return this},updateController:function(){switch(this.scrollMode){case 0:case 1:var t=this.childrenMap.scroller,e=this.childrenMap.slider;t&&t.setValue(this.childOY),e&&e.setValue(this.t);break;default:var i=this.childrenMap.scrollerY,n=this.childrenMap.sliderY,r=this.childrenMap.scrollerX,s=this.childrenMap.sliderX;i&&i.setValue(this.childOY),n&&n.setValue(this.t),r&&r.setValue(this.childOX),s&&s.setValue(this.s);}}};Object.assign(Hp.prototype,Fp);var Np=function(t){return ff(t)?2:vf(t)?0:1},Gp=function(t){return (t-this.textLineSpacing)/(this.textLineHeight+this.textLineSpacing)},Vp=function(t){return t*(this.textLineHeight+this.textLineSpacing)-this.textLineSpacing},Up=function(t){var e,i=t+this.visibleLinesCount+1;switch(this.textObjectType){case 0:case 2:e=this.lines.slice(t,i).join("\n");break;case 1:var n=this.lines.getLineStartIndex(t),r=this.lines.getLineEndIndex(i-1);e=this.lines.getSliceTagText(n,r,!0);}return e},Jp=function(){var t=this.textObject.rexSizer;this.textObject.y+=t.offsetY-t.preOffsetY,t.preOffsetY=t.offsetY,this.resetChildPositionState(this.textObject),this.textCropEnable&&Kp.call(this);},Kp=function(){if(this.textObject.setCrop){var t,e,i=this.textObject.rexSizer.offsetY;i<=0?(t=-i,e=this.height):(t=0,e=this.height-i),this.textObject.setCrop(0,t,this.width,e);}},qp=function(t,e,i){if(i+=this.textLineHeight+this.textLineSpacing,this.textObjectWidth!==e||this._textObjectRealHeight!==i){switch(this.textObjectWidth=e,this._textObjectRealHeight=i,this.textObjectType){case 0:case 1:t.setFixedSize(e,i);var n=t.style,r=Math.max(e,0);0===this.textObjectType?n.wordWrapWidth=r:(0===n.wrapMode&&(n.wrapMode=1),n.wrapWidth=r);break;case 2:t.setMaxWidth(e);}this.setText();}},Zp={setText:function(t){return void 0!==t&&(this.text=t),this.lines=function(t,e,i){switch(Np(t)){case 0:i=t.getWrappedText(e);break;case 1:i=t.getPenManager(e,i);break;case 2:i=t.maxWidth>0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n");}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Gp.call(this,-this.textOY)),0),e=Vp.call(this,t)+this.textOY,i=Up.call(this,t);return function(t,e){switch(Np(t)){case 0:var i=(r=t.style).wordWrapWidth,n=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=n;break;case 1:var r,s=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=s;break;case 2:var o=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=o;}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Jp.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ze.call(this),this},layoutChildren:function(){var t,e,i,n,r,s,o,a=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(n=a+(i=(e=t.rexSizer).padding).left,r=h+i.top,s=this.width-i.left-i.right,o=this.height-i.top-i.bottom,qp.call(this,t,s,o),Se(t,n,r,s,o,e.align),e.preOffsetY=0,Jp.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)));}},$p=Phaser.Utils.Objects.IsPlainObject,Qp=Phaser.Utils.Objects.GetValue,tv=Phaser.Display.Align.TOP_LEFT,ev=function(t){r(o,t);var i=l(o);function o(t,n,r,s,h,l){var u;e(this,o),$p(n)?(n=Qp(l=n,"x",0),r=Qp(l,"y",0),s=Qp(l,"width",void 0),h=Qp(l,"height",void 0)):$p(s)&&(s=Qp(l=s,"width",void 0),h=Qp(l,"height",void 0)),(u=i.call(this,t,n,r,s,h,l)).type="rexTextBlock",u.textObject=void 0,u.linesCount=0,u.textMask=void 0,u.textObjectType=void 0,u._textLineHeight=void 0,u._textLineSpacing=void 0,u._visibleLinesCount=void 0,u._textHeight=void 0,u._textVisibleHeight=void 0,u._textObjectRealHeight=0,u.lines=void 0,u.text=Qp(l,"content",""),u._textOY=0,u.execeedTopState=!1,u.execeedBottomState=!1,u.setClampMode(Qp(l,"clamplTextOY",!0)),u.alwaysScrollable=Qp(l,"alwaysScrollable",!1);var c=Qp(l,"background",void 0),d=Qp(l,"text",void 0);void 0===d&&(d=iv(t)),u.textCropEnable=Qp(l,"textCrop",!!d.setCrop);var f=Qp(l,"textMask",!u.textCropEnable);c&&u.addBackground(c),u.add(d),u.sizerChildren=[d];var p=u.getSizerConfig(d);return p.align=tv,p.padding=Ee(0),p.expand=!0,u.textObject=d,u.textObjectType=Np(d),p.preOffsetY=0,p.offsetY=0,f&&(u.textMask=Ch.call(a(u),u.textObject,a(u))),u.addChildrenMap("background",c),u.addChildrenMap("text",d),u}return n(o,[{key:"destroy",value:function(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy();}this.lines=void 0;}c(s(o.prototype),"destroy",this).call(this,t);}}},{key:"setClampMode",value:function(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}},{key:"textLineHeight",get:function(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i;}this._textLineHeight=t;}return this._textLineHeight}},{key:"textLineSpacing",get:function(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0;}this._textLineSpacing=t;}return this._textLineSpacing}},{key:"visibleLinesCount",get:function(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Gp.call(this,this._textObjectRealHeight))),this._visibleLinesCount}},{key:"topTextOY",get:function(){return 0}},{key:"bottomTextOY",get:function(){return -this.textVisibleHeight}},{key:"textHeight",get:function(){return void 0===this._textHeight&&(this._textHeight=Vp.call(this,this.linesCount)),this._textHeight}},{key:"textObjectHeight",get:function(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}},{key:"textVisibleHeight",get:function(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t;}return this._textVisibleHeight}},{key:"textOYExceedTop",value:function(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}},{key:"textOYExeceedBottom",value:function(t){return void 0===t&&(t=this.textOY),t<this.bottomTextOY}},{key:"textOY",get:function(){return this._textOY},set:function(t){var e=this.topTextOY,i=this.bottomTextOY,n=this.textOYExceedTop(t),r=this.textOYExeceedBottom(t);this.clampTextOY&&(this.visibleLinesCount>this.linesCount?t=0:n?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),n&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=n,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r;}},{key:"setTextOY",value:function(t){return this.textOY=t,this}},{key:"t",get:function(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t},set:function(t){this.textOY=-this.textVisibleHeight*t;}},{key:"setTextOYByPercentage",value:function(t){return this.t=t,this}}]),o}(ro),iv=function(t){return t.add.text(0,0,"")};Object.assign(ev.prototype,Zp);var nv={scrollToLine:function(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine:function(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}},rv=Phaser.Utils.Objects.GetValue,sv=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={});var o=rv(n,"text",void 0),a=rv(n,"textWidth",void 0),h=rv(n,"textHeight",void 0),l=rv(n,"textCrop",!!o.setCrop),u=rv(n,"textMask",!l),c=rv(n,"content",""),d=new ev(t,{width:a,height:h,text:o,textMask:u,textCrop:l&&!u,content:c,clamplTextOY:rv(n,"clamplChildOY",!1),alwaysScrollable:rv(n,"alwaysScrollable",!1)});t.add.existing(d),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e;}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}});}(d),n.scrollMode=0,n.type="rexTextArea",n.child={gameObject:d,expandWidth:void 0===a,expandHeight:void 0===h};var f=rv(n,"space",void 0);return f&&(f.child=rv(f,"text",0)),(r=i.call(this,t,n)).addChildrenMap("text",o),r}return n(s,[{key:"text",get:function(){return this.childrenMap.child.text}},{key:"lineHeight",get:function(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}},{key:"lineIndex",get:function(){return Math.floor(-this.childOY/this.lineHeight)}},{key:"linesCount",get:function(){return this.childrenMap.child.linesCount}},{key:"contentHeight",get:function(){return this.childrenMap.child.textHeight}}]),s}(Hp);Object.assign(sv.prototype,{setText:function(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText:function(t){return this.setText(this.text+t),this}},nv);var ov=Phaser.Utils.Objects.GetValue,av=function(t,e,i){e=e?Ph(e):{};var n=ov(i,"background",Rl),r=ov(i,"text",Mc),s=ov(i,"track",Rl),o=ov(i,"thumb",Rl);n?e.background=n(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&(void 0===a&&(a={}),s?a.track=s(t,a.track):delete a.track,o?a.thumb=o(t,a.thumb):delete a.thumb,e.slider=a);var h=new sv(t,e);return t.add.existing(h),h},hv=Phaser.Utils.Objects.GetValue,lv=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return !0;if(-1!==e.indexOf(".")){for(var i=e.split("."),n=t,r=0;r<i.length;r++){if(!n.hasOwnProperty(i[r]))return !1;n=n[i[r]];}return !0}return !1}return !1},uv=Phaser.Utils.Objects.GetValue,cv=function(t){r(s,t);var i=l(s);function s(t,n,r){var o;e(this,s),n=n?Ph(n):{},void 0===r&&(r={});var h=uv(r,"background",Rl);h?n.background=h(t,n.background):delete n.background,n.title=xf(t,n.title,r.title),n.content=function(t,e,i){var n,r=hv(e,"$type");void 0===r&&e&&(e.hasOwnProperty("slider")||e.hasOwnProperty("scroller"))&&(r="textarea"),n="textarea"===r?new av(t,e,i):new xf(t,e,i);return t.add.existing(n),n}(t,n.content,r.content),n.content instanceof sv&&lv(n,"height")&&!lv(n,"proportion.content")&&Eh(n,"proportion.content",1);var l=n.button,u=n.buttonA||l,c=n.buttonB||l,d=n.buttonMode;void 0===d&&(d=u&&c?2:u?1:0);var f=r.button,p=r.buttonA||f,v=r.buttonB||f;switch(d){case 2:n.actions=[xf(t,u,p),xf(t,c,v)];break;case 1:n.actions=[xf(t,u,p)];break;case 0:break;default:n.actions=[];}var g=n.choice;g&&(n.choices=[]),(o=i.call(this,t,n)).type="rexConfirmDialog",o.buttonMode=d,o.defaultActionConfig=l,o.defaultActionButtonCreator=f,o.defaultChoiceConfig=g,o.defaultChoiceCreator=r.choice;var y=o.childrenMap.actions;return o.addChildrenMap("buttonA",y?y[0]:null),o.addChildrenMap("buttonB",y?y[1]:null),Lf.call(a(o)),o}return n(s)}(dh);return Object.assign(cv.prototype,_f),cv}));