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