phaser3-rex-plugins
Version:
1 lines • 254 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).rexgridtable=e();}(undefined,(function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,g(n.key),n);}}function n(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e);}function s(t){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},s(t)}function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return a(t)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return !1;if(Reflect.construct.sham)return !1;if("function"==typeof Proxy)return !0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return !1}}();return function(){var i,n=s(t);if(e){var r=s(this).constructor;i=Reflect.construct(n,arguments,r);}else i=n.apply(this,arguments);return h(this,i)}}function u(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=s(t)););return t}function c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,i){var n=u(t,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?t:i):r.value}},c.apply(this,arguments)}function d(t,e,i,n){return d="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,i,n){var r,s=u(t,e);if(s){if((r=Object.getOwnPropertyDescriptor(s,e)).set)return r.set.call(n,i),!0;if(!r.writable)return !1}if(r=Object.getOwnPropertyDescriptor(n,e)){if(!r.writable)return !1;r.value=i,Object.defineProperty(n,e,r);}else !function(t,e,i){(e=g(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i;}(n,e,i);return !0},d(t,e,i,n)}function f(t,e,i,n,r){if(!d(t,e,i,n||t)&&r)throw new TypeError("failed to set property");return i}function 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 g(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return ("string"===e?String:Number)(t)}(t,"string");return "symbol"==typeof e?e:String(e)}var y,m=!1;m||(void 0===y&&(y=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])<y&&console.error("Minimum supported version : 3.".concat(y)),m=!0);var b=Phaser.GameObjects.Zone,k=Phaser.Utils.Array.Add,C=Phaser.Utils.Array.Remove,w=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a){var h;return e(this,o),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===a&&(a=1),(h=i.call(this,t,n,r,s,a)).children=[],h}return n(o,[{key:"destroy",value:function(t){if(this.scene&&!this.ignoreDestroy){if(t)for(var e,i=this.children.length-1;i>=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),c(s(o.prototype),"destroy",this).call(this,t);}}},{key:"contains",value:function(t){return -1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return 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 C(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}(b),S=Phaser.GameObjects.Components;Phaser.Class.mixin(w,[S.Alpha,S.Flip]);var _,O=function t(e,i){var n;if(void 0===i)e.hasOwnProperty("rexContainer")&&(n=e.rexContainer.parent);else for(n=t(e);n&&n.name!==i;)n=t(n);return n},P=Phaser.Math.DegToRad,x=Phaser.Math.RadToDeg,E=function(t){if(!t.hasOwnProperty("rexContainer")){var e={parent:null,self:null,layer:null,x:0,y:0,syncPosition:!0,rotation:0,syncRotation:!0,scaleX:0,scaleY:0,syncScale:!0,alpha:0,syncAlpha:!0,visible:!0,active:!0};Object.defineProperty(e,"angle",{get:function(){return x(this.rotation)},set:function(t){this.rotation=P(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},T={setParent:function(t,e){void 0===e&&(e=this);var i=E(t);return e?(i.parent=e,i.self=t):(i.parent=null,i.self=null),this},getParent:function(t,e){return "string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),O(t,e)},getTopmostParent:function(t){return void 0===t&&(t=this),function(t){for(var e=O(t);e;)t=e,e=O(e);return t}(t)}},M=Phaser.Utils.Objects.GetValue,R=w.prototype.add,D=function(t,e){this.setParent(t);var i=E(t);return j(i,e),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),R.call(this,t),this.addToParentContainer(t),this.addToRenderLayer(t),this},L=function(t,e){this.setParent(t);var i=E(t);return j(i,e),i.x=t.x,i.y=t.y,i.rotation=t.rotation,i.scaleX=t.scaleX,i.scaleY=t.scaleY,i.alpha=t.alpha,i.visible=t.visible,i.active=t.active,this.updateChildPosition(t).updateChildAlpha(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),R.call(this,t),this.addToRenderLayer(t),this},j=function(t,e){void 0===e&&(e=!0),"boolean"==typeof e?(t.syncPosition=e,t.syncRotation=e,t.syncScale=e,t.syncAlpha=e,t.syncScrollFactor=e):(t.syncPosition=M(e,"syncPosition",!0),t.syncRotation=M(e,"syncRotation",!0),t.syncScale=M(e,"syncScale",!0),t.syncAlpha=M(e,"syncAlpha",!0),t.syncScrollFactor=M(e,"syncScrollFactor",!0));},z={add:function(t){return Array.isArray(t)?this.addMultiple(t):D.call(this,t),this},pin:function(t,e){return Array.isArray(t)?this.addMultiple(t,e):D.call(this,t,e),this},addMultiple:function(t){for(var e=0,i=t.length;e<i;e++)D.call(this,t[e]);return this},addLocal:function(t){return Array.isArray(t)?this.addMultiple(t):L.call(this,t),this},pinLocal:function(t,e){return Array.isArray(t)?this.addMultiple(t,e):L.call(this,t,e),this},addLocalMultiple:function(t){for(var e=0,i=t.length;e<i;e++)L.call(this,t[e]);return this}},X=w.prototype.remove,A=w.prototype.clear,I={remove:function(t,e){return O(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),X.call(this,t,e)),this},unpin:function(t,e){return O(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),X.call(this,t,e)),this},clear:function(t){for(var e=this.children,i=0,n=e.length;i<n;i++){var r=e[i];this.setParent(r,null),t||this.removeFromRenderLayer(r);}return A.call(this,t),this}},Y={getLocalState:function(t){return E(t)},resetChildState:function(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState:function(t){for(var e=0,i=t.length;e<i;e++)this.resetChildState(t[e]);return this},syncProperties:function(){return this.syncPosition().syncVisible().syncAlpha().syncActive().syncScrollFactor().syncMask(),this}},V=Phaser.Math.RotateAround,W={worldToLocal:function(t){return t.x-=this.x,t.y-=this.y,V(t,0,0,-this.rotation),t.x/=this.scaleX,t.y/=this.scaleY,t},localToWorld:function(t){return t.x*=this.scaleX,t.y*=this.scaleY,V(t,0,0,this.rotation),t.x+=this.x,t.y+=this.y,t}},H=function(t,e){return t===e?1:t/e},N={updateChildPosition:function(t){t.isRexContainerLite&&(t.syncChildrenEnable=!1);var e=E(t),i=e.parent;return e.syncPosition&&(t.x=e.x,t.y=e.y,i.localToWorld(t)),e.syncRotation&&(t.rotation=e.rotation+i.rotation),e.syncScale&&(t.scaleX=e.scaleX*i.scaleX,t.scaleY=e.scaleY*i.scaleY),t.isRexContainerLite&&(t.syncChildrenEnable=!0,t.syncPosition()),this},syncPosition:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildPosition,this),this},resetChildPositionState:function(t){var e=E(t),i=e.parent;return e.x=t.x,e.y=t.y,i.worldToLocal(e),e.scaleX=H(t.scaleX,i.scaleX),e.scaleY=H(t.scaleY,i.scaleY),e.rotation=t.rotation-i.rotation,this},setChildPosition:function(t,e,i){return t.x=e,t.y=i,this.resetChildPositionState(t),this},setChildLocalPosition:function(t,e,i){var n=E(t);return n.x=e,n.y=i,this.updateChildPosition(t),this},resetLocalPositionState:function(){var t=E(this).parent;return t&&t.resetChildPositionState(this),this}},F=Phaser.Math.DegToRad,G={updateChildRotation:function(t){var e=E(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState:function(t){var e=E(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation:function(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle:function(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation:function(t,e){return E(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle:function(t,e){return E(t).rotation=F(e),this.updateChildRotation(t),this},resetLocalRotationState:function(){var t=E(this).parent;return t&&t.resetChildRotationState(this),this}},B={updateChildScale:function(t){var e=E(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState:function(t){var e=E(t),i=e.parent;return e.scaleX=H(t.scaleX,i.scaleX),e.scaleY=H(t.scaleY,i.scaleY),this},setChildScale:function(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale:function(t,e,i){void 0===i&&(i=e);var n=E(t);return n.scaleX=e,n.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize:function(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState:function(){var t=E(this).parent;return t&&t.resetChildScaleState(this),this}},U={updateChildVisible:function(t){var e=E(t),i=e.parent,n=!e.hasOwnProperty("maskVisible")||e.maskVisible;return t.visible=i.visible&&e.visible&&n,this},syncVisible:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState:function(t){var e=E(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible:function(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible:function(t,e){return void 0===e&&(e=!0),E(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible:function(t,e){return void 0===e&&(e=!0),E(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState:function(){var t=E(this).parent;return t&&t.resetChildVisibleState(this),this}},J={updateChildAlpha:function(t){var e=E(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState:function(t){var e=E(t),i=e.parent;return e.alpha=H(t.alpha,i.alpha),this},setChildAlpha:function(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha:function(t,e){return E(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState:function(){var t=E(this).parent;return t&&t.resetChildAlphaState(this),this}},Z={updateChildActive:function(t){var e=E(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState:function(t){return E(t).active=t.active,this},setChildActive:function(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive:function(t,e){return void 0===e&&(e=!0),E(t).active=e,this.updateChildActive(t),this},resetLocalActiveState:function(){var t=E(this).parent;return t&&t.resetChildActiveState(this),this}},K={updateChildScrollFactor:function(t){var e=E(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},q={updateChildMask:function(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask:function(t){return this.mask=t,this},clearMask:function(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t);})),t&&this.mask&&this.mask.destroy(),this}},Q=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,r=i.length;n<r;n++)i[n].depth=t;return this},swapDepth:function(t){var e=this.depth,i=t.depth;return this.setDepth(i),t.setDepth(e),this},incDepth:function(t){if(this.depth+=t,this.children)for(var e=this.getAllChildren(),i=0,n=e.length;i<n;i++)e[i].depth+=t;return this},bringToTop:function(){var t=this.displayList,e=this.getAllChildren([this]);Q(e,!1);for(var i=0,n=e.length;i<n;i++){var r=e[i];t.exists(r)&&t.bringToTop(r);}return this},moveDepthBelow:function(t){var e=this.displayList;if(t.displayList!==e)return this;var i=this.getAllChildren([this]);Q(i,!1);for(var n=0,r=i.length;n<r;n++){var s=i[n];if(e.exists(s)){e.moveBelow(t,s);break}}return this},moveDepthAbove:function(t){var e=this.displayList;if(t.displayList!==e)return this;var i=this.getAllChildren([this]);Q(i,!0);for(var n=0,r=i.length;n<r;n++){var s=i[n];if(e.exists(s)){e.moveAbove(t,s);break}}return this},bringChildToTop:function(t){var e=this.getAllChildren([this]);Q(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]);Q(e,!1);var i=e[0];return i===t||i.displayList!==t.displayList||i.displayList.moveBelow(t,i),this}},tt=function t(e,i){if(!i(e)&&e.isRexContainerLite)for(var n=e.children,r=0,s=n.length;r<s;r++)t(n[r],i);},et=function(t,e){for(var i=[t];i.length>0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,v(n.children));}},it=Phaser.Utils.Array,nt={getChildren:function(t){if(t)for(var e=0,i=this.children.length;e<i;e++)t.push(this.children[e]);else t=this.children;return t},getAllChildren:function(t){void 0===t&&(t=[]);var e=this;return et(e,(function(i){i!==e&&t.push(i);})),t},getAllVisibleChildren:function(t){void 0===t&&(t=[]);var e=this;return et(e,(function(i){if(i!==e)return !i.visible||void t.push(i)})),t},bfs:function(t,e){return void 0===e&&(e=this),et(e,t),this},dfs:function(t,e){return void 0===e&&(e=this),tt(e,t),this},contains:function(t){var e=O(t);return !!e&&(e===this||this.contains(e))},getByName:function(t,e){if(e){for(var i,n,r=[this];r.length;)for(var s=0,o=(i=r.shift()).children.length;s<o;s++){if((n=i.children[s]).name===t)return n;n.isRexContainerLite&&r.push(n);}return null}return it.GetFirst(this.children,"name",t)},getRandom:function(t,e){return it.GetRandom(this.children,t,e)},getFirst:function(t,e,i,n){return it.GetFirstElement(this.children,t,e,i,n)},getAll:function(t,e,i,n){return it.GetAll(this.children,t,e,i,n)},count:function(t,e,i,n){return it.CountAllMatching(this.children,t,e,i,n)},swap:function(t,e){return it.Swap(this.children,t,e),this},setAll:function(t,e,i,n){return it.SetAll(this.children,t,e,i,n),this}},rt=function(t){for(var e=[],i=0,n=t.length;i<n;i++){var r=t[i];r.hasOwnProperty("rexContainer")&&e.push(r.rexContainer);}return e},st=function(t,e,i){if(i.parent){var n=i.parent,r=i.self;switch(e){case"x":case"y":n.updateChildPosition(r);break;case"angle":case"rotation":n.updateChildRotation(r);break;case"scaleX":case"scaleY":case"displayWidth":case"displayHeight":n.updateChildScale(r);break;case"alpha":n.updateChildAlpha(r);break;default:n.updateChildPosition(r),n.updateChildRotation(r),n.updateChildScale(r),n.updateChildAlpha(r);}}else t.remove();},ot={tweenChild:function(t){var e=t.targets;Array.isArray(e)||(e=[e]);var i=this.scene||function(t){for(var e=0,i=t.length;e<i;e++){var n=t[e].scene;if(n)return n}return null}(e);if(i){t.targets=rt(e);var n=i.tweens.add(t);return n.on("update",st),n}},tweenSelf:function(t){return t.targets=[this],this.tweenChild(t)},createTweenChildConfig:function(t){var e=t.targets;e&&(Array.isArray(e)||(e=[e]),t.targets=rt(e));var i=t.onUpdate;return t.onUpdate=function(t,e){i&&i(t,e),st(t,void 0,e);},t},tween:function(t){var e=this.scene;return t.targets||(t.targets=this),e.tweens.add(t)}},at=Phaser.GameObjects.Container,ht=Phaser.GameObjects.Layer,lt=function(t){return t instanceof ht},ut=function(t){var e=t.getAllChildren([t]);return e=e.filter((function(t){return !!t.displayList||!!t.parentContainer}))},ct=function(t){var e=ut(this);return Q(e),t.add(e),this},dt=function(t,e,i){var n=ut(this);return Q(n,e),t.remove(n),i&&n.forEach((function(t){t.addToDisplayList();})),this},ft={addToContainer:function(t){return function(t){return t instanceof at}(t)?(this._setParentContainerFlag=!0,ct.call(this,t),this._setParentContainerFlag=!1,this):this},addToLayer:function(t){return lt(t)?(ct.call(this,t),this):this},removeFromContainer:function(){return this.parentContainer?(this._setParentContainerFlag=!0,dt.call(this,this.parentContainer,!0,!1),this._setParentContainerFlag=!1,this):this},removeFromLayer:function(t){return void 0===t&&(t=!0),lt(this.displayList)?(dt.call(this,this.displayList,!1,t),this):this},getParentContainer:function(){if(this.parentContainer)return this.parentContainer;for(var t=this.getParent();t;){var e=t.parentContainer;if(e)return e;t=t.getParent();}return null},addToParentContainer:function(t){if(!t.displayList)return this;var e=this.getParentContainer();return e?(t.isRexContainerLite?t.addToContainer(e):e.add(t),this):this}},vt={hasLayer:function(){return !!this.privateRenderLayer},enableLayer:function(){if(this.hasLayer())return this;var t=this.scene.add.layer();return this.moveDepthBelow(t),this.addToLayer(t),this.privateRenderLayer=t,this},getLayer:function(){return this.hasLayer()||this.enableLayer(),this.privateRenderLayer},getRenderLayer:function(){if(this.hasLayer())return this.privateRenderLayer;for(var t=this.getParent();t;){var e=t.privateRenderLayer;if(e)return e;t=t.getParent();}return null},addToRenderLayer:function(t){if(!t.displayList)return this;var e=this.getRenderLayer();return e?(t.isRexContainerLite?t.addToLayer(e):e.add(t),E(t).layer=e,this):this},removeFromRenderLayer:function(t){var e=E(t),i=e.layer;return i?(t.isRexContainerLite?t.removeFromLayer(!0):i.remove(t),e.layer=null,this):this}},pt=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},gt=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height},yt=Phaser.Geom.Rectangle,mt=Phaser.Math.Vector2,bt=Phaser.Math.RotateAround,kt=function(t,e){if(void 0===e?e=new yt:!0===e&&(void 0===Ct&&(Ct=new yt),e=Ct),t.getBounds)return t.getBounds(e);var i,n,r,s,o,a,h,l;if(t.parentContainer){var u=t.parentContainer.getBoundsTransformMatrix();wt(t,e),u.transformPoint(e.x,e.y,e),i=e.x,n=e.y,St(t,e),u.transformPoint(e.x,e.y,e),r=e.x,s=e.y,_t(t,e),u.transformPoint(e.x,e.y,e),o=e.x,a=e.y,Ot(t,e),u.transformPoint(e.x,e.y,e),h=e.x,l=e.y;}else wt(t,e),i=e.x,n=e.y,St(t,e),r=e.x,s=e.y,_t(t,e),o=e.x,a=e.y,Ot(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,o,h),e.y=Math.min(n,s,a,l),e.width=Math.max(i,r,o,h)-e.x,e.height=Math.max(n,s,a,l)-e.y,e},Ct=void 0,wt=function(t,e,i){return void 0===e?e=new mt:!0===e&&(void 0===Pt&&(Pt=new mt),e=Pt),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-pt(t)*t.originX,e.y=t.y-gt(t)*t.originY,xt(t,e,i))},St=function(t,e,i){return void 0===e?e=new mt:!0===e&&(void 0===Pt&&(Pt=new mt),e=Pt),t.getTopRight?t.getTopRight(e):(e.x=t.x-pt(t)*t.originX+pt(t),e.y=t.y-gt(t)*t.originY,xt(t,e,i))},_t=function(t,e,i){return void 0===e?e=new mt:!0===e&&(void 0===Pt&&(Pt=new mt),e=Pt),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-pt(t)*t.originX,e.y=t.y-gt(t)*t.originY+gt(t),xt(t,e,i))},Ot=function(t,e,i){return void 0===e?e=new mt:!0===e&&(void 0===Pt&&(Pt=new mt),e=Pt),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-pt(t)*t.originX+pt(t),e.y=t.y-gt(t)*t.originY+gt(t),xt(t,e,i))},Pt=void 0,xt=function(t,e,i){(void 0===i&&(i=!1),0!==t.rotation&&bt(e,t.x,t.y,t.rotation),i&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e},Et=Phaser.Geom.Rectangle,Tt=Phaser.Geom.Rectangle.Union,Mt=function(e){if("object"!==t(e)||null===e)return e;if(Array.isArray(e))e.length=0;else for(var i in e)delete e[i];return e},Rt=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:Mt(e),i){e.length=t.length;for(var n=0,r=t.length;n<r;n++)e[n]=t[n];}else for(var s in t)e[s]=t[s];return e},Dt=Phaser.GameObjects.GameObject,Lt=function(t){return t instanceof Dt},jt=Phaser.Utils.Objects.GetValue,zt=Phaser.Textures.DynamicTexture,Xt=Phaser.Utils.String.UUID,At=function(t){if(t){var e,i,n=t.gameObjects,r=t.renderTexture,s=jt(t,"x",void 0),o=jt(t,"y",void 0),a=jt(t,"width",void 0),h=jt(t,"height",void 0),l=jt(t,"originX",0),u=jt(t,"originY",0),c=jt(t,"padding",0);if(void 0===a||void 0===h||void 0===s||void 0===o){var d=function(t,e){var i;void 0===e?e=new Et:!0===e&&(void 0===_&&(_=new Et),e=_),e.setTo(0,0,0,0);for(var n=!0,r=0,s=t.length;r<s;r++)if((i=t[r]).getBounds){var o=kt(i,!0);n?(e.setTo(o.x,o.y,o.width,o.height),n=!1):Tt(o,e,e);}return e}(n,!0);void 0!==s&&void 0!==o?(a=2*Math.max(s-d.left,d.right-s),h=2*Math.max(o-d.top,d.bottom-o),l=.5,u=.5):(s=d.x,o=d.y,a=d.width,h=d.height,l=0,u=0),e=d.x,i=d.y;}else e=s+(0-l)*a,i=o+(0-u)*h;e-=c,i-=c,a+=2*c,h+=2*c;var f=n[0].scene;v&&!r&&(r=new zt(f.sys.textures,Xt(),a,h)),r||(r=f.add.renderTexture(0,0,a,h)),r.setPosition&&r.setPosition(s,o),r.width===a&&r.height===h||r.setSize(a,h),r.setOrigin&&r.setOrigin(l,u),r.camera.setScroll(e,i),n=Q(Rt(n)),r.draw(n);var v=t.saveTexture;if(v)if(Lt(r))r.saveTexture(v);else {var p=r,g=p.manager;g.exists(p.key)?g.renameTexture(p.key,key):(p.key=key,g.list[key]=p,g.emit("addtexture",key,p),g.emit("addtexture-".concat(key),p));}return r}},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 r=At(t),s=!!r.scene;return n||(this.setScale(e,i),s&&r.setScale(e,i)),s?r:this}},Yt=Phaser.Utils.Objects.GetValue,Vt=function(t,e,i,n,r,s,o){if(t.getBounds||void 0!==t.width&&void 0!==t.height){void 0===i&&(i=16777215),void 0===n&&(n=1),void 0===r&&(r=null),void 0===s&&(s=1),void 0===o&&(o=0);var a=wt(t,Wt[0]);a.x-=o,a.y-=o;var h=St(t,Wt[1]);h.x+=o,h.y-=o;var l=Ot(t,Wt[2]);l.x+=o,l.y+=o;var u=_t(t,Wt[3]);u.x-=o,u.y+=o,null!==r&&e.fillStyle(r,s).fillPoints(Wt,!0,!0),null!==i&&e.lineStyle(n,i).strokePoints(Wt,!0,!0);}},Wt=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Ht=Phaser.Utils.Objects.GetValue,Nt=Phaser.Math.RotateAround,Ft={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};Nt(n,0,0,t.rotation),t.originX=e,t.originY=i,t.x=t.x+n.x,t.y=t.y+n.y;}(this,t,e),this.syncChildrenEnable=!0;for(var i=this.getAllChildren(),n=0,r=i.length;n<r;n++)this.resetChildPositionState(i[n]);return this},drawBounds:function(t,e){var i=Ht(e,"drawContainer",!0),n=Ht(e,"children");return void 0===n&&(n=this.getAllVisibleChildren([this])),i||(n=n.filter((function(t){return !t.isRexContainerLite}))),function(t,e,i){var n,r,s,o,a;if("number"==typeof i?n=i:(n=Yt(i,"color"),r=Yt(i,"lineWidth"),s=Yt(i,"fillColor"),o=Yt(i,"fillAlpha",1),a=Yt(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h<l;h++)Vt(t[h],e,n,r,s,o,a);else Vt(t,e,n,r,s,o,a);}(n,t,e),this}};Object.assign(Ft,T,z,I,Y,W,N,G,B,U,J,Z,K,q,$,nt,ot,ft,vt,It);var Gt=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a,h){var l;return e(this,o),Array.isArray(s)&&(h=s,s=void 0,a=void 0),(l=i.call(this,t,n,r,s,a)).type="rexContainerLite",l.isRexContainerLite=!0,l.syncChildrenEnable=!0,l._active=!0,l._mask=null,l._scrollFactorX=1,l._scrollFactorY=1,l.privateRenderLayer=void 0,h&&l.add(h),l}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.syncChildrenEnable=!1,c(s(o.prototype),"destroy",this).call(this,t),this.privateRenderLayer&&(this.privateRenderLayer.list.length=0,this.privateRenderLayer.destroy()));}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"x",get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this.syncPosition());}},{key:"y",get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.syncPosition());}},{key:"rotation",get:function(){return c(s(o.prototype),"rotation",this)},set:function(t){this.rotation!==t&&(f(s(o.prototype),"rotation",t,this,!0),this.syncPosition());}},{key:"scaleX",get:function(){return c(s(o.prototype),"scaleX",this)},set:function(t){this.scaleX!==t&&(f(s(o.prototype),"scaleX",t,this,!0),this.syncPosition());}},{key:"scaleY",get:function(){return c(s(o.prototype),"scaleY",this)},set:function(t){this.scaleY!==t&&(f(s(o.prototype),"scaleY",t,this,!0),this.syncPosition());}},{key:"scale",get:function(){return c(s(o.prototype),"scale",this)},set:function(t){this.scale!==t&&(f(s(o.prototype),"scale",t,this,!0),this.syncPosition());}},{key:"visible",get:function(){return c(s(o.prototype),"visible",this)},set:function(t){c(s(o.prototype),"visible",this)!==t&&(f(s(o.prototype),"visible",t,this,!0),this.syncVisible());}},{key:"alpha",get:function(){return c(s(o.prototype),"alpha",this)},set:function(t){c(s(o.prototype),"alpha",this)!==t&&(f(s(o.prototype),"alpha",t,this,!0),this.syncAlpha());}},{key:"active",get:function(){return this._active},set:function(t){this._active!==t&&(this._active=t,this.syncActive());}},{key:"mask",get:function(){return this._mask},set:function(t){this._mask!==t&&(this._mask=t,this.syncMask());}},{key:"scrollFactorX",get:function(){return this._scrollFactorX},set:function(t){this._scrollFactorX!==t&&(this._scrollFactorX=t,this.syncScrollFactor());}},{key:"scrollFactorY",get:function(){return this._scrollFactorY},set:function(t){this._scrollFactorY!==t&&(this._scrollFactorY=t,this.syncScrollFactor());}},{key:"list",get:function(){return this.children}},{key:"parentContainer",get:function(){return this._parentContainer},set:function(t){this._parentContainer||t?this.setParentContainerFlag?this._parentContainer=t:this._parentContainer&&!t?(this.removeFromContainer(),this._parentContainer=t):t?(this._parentContainer=t,this.addToContainer(t)):this._parentContainer=t:this._parentContainer=t;}},{key:"setParentContainerFlag",get:function(){if(this._setParentContainerFlag)return !0;var t=O(this);return !!t&&t.setParentContainerFlag}}],[{key:"GetParent",value:function(t){return O(t)}}]),o}(w);Object.assign(Gt.prototype,Ft);var Bt=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};var Ut=Phaser.Cameras.Scene2D.BaseCamera,Jt=Phaser.Geom.Rectangle,Zt=function(t,e,i){return e instanceof Ut||(i=e,e=void 0),void 0===i?i=new Jt:!0===i&&(i=Kt),e?t.scale.getViewPort(e,i):t.scale.getViewPort(i)},Kt=new Jt,qt=Phaser.Display.Align,Qt={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},$t=function(){},te=new Phaser.GameObjects.Zone({sys:{queueDepthSort:$t,events:{once:$t}}},0,0,1,1);te.setOrigin(0);var ee=0,ie=1,ne=2,re=4,se=6,oe=8,ae=10,he=12,le=function(t){var e=gt(t);return t.y+e-e*t.originY},ue=function(t){var e=pt(t);return t.x-e*t.originX+.5*e},ce=function(t,e){var i=gt(t);return t.y=e-i+i*t.originY,t},de=function(t,e){var i=pt(t),n=i*t.originX;return t.x=e+n-.5*i,t},fe=function(t){var e=pt(t);return t.x-e*t.originX},ve=function(t,e){var i=pt(t);return t.x=e+i*t.originX,t},pe=function(t){var e=pt(t);return t.x+e-e*t.originX},ge=function(t,e){var i=pt(t);return t.x=e-i+i*t.originX,t},ye=function(t,e){var i=gt(t),n=i*t.originY;return t.y=e+n-.5*i,t},me=function(t){var e=gt(t);return t.y-e*t.originY+.5*e},be=function(t){var e=gt(t);return t.y-e*t.originY},ke=function(t,e){var i=gt(t);return t.y=e+i*t.originY,t},Ce=[];Ce[11]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),de(t,ue(e)+i),ce(t,le(e)+n),t},Ce[ae]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ve(t,fe(e)-i),ce(t,le(e)+n),t},Ce[he]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ge(t,pe(e)+i),ce(t,le(e)+n),t},Ce[se]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),function(t,e,i){de(t,e),ye(t,i);}(t,ue(e)+i,me(e)+n),t},Ce[re]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ve(t,fe(e)-i),ye(t,me(e)+n),t},Ce[oe]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ge(t,pe(e)+i),ye(t,me(e)+n),t},Ce[ie]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),de(t,ue(e)+i),ke(t,be(e)-n),t},Ce[ee]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ve(t,fe(e)-i),ke(t,be(e)-n),t},Ce[ne]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ge(t,pe(e)+i),ke(t,be(e)-n),t};var we=function(t,e,i,n,r){return Ce[i](t,e,n,r)},Se=function(t,e,i,n,r,s){te.setPosition(e,i).setSize(n,r),we(t,te,s);},_e=Phaser.Utils.Objects.GetValue,Oe=Phaser.GameObjects.Group,Pe=function(t,e,i){return t.add.text(0,0,"")},xe=void 0,Ee=Phaser.Utils.Objects.GetValue,Te=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=Ee(t,"left",0),e.right=Ee(t,"right",0),e.top=Ee(t,"top",0),e.bottom=Ee(t,"bottom",0)),e},Me=Gt.prototype.add,Re=function(t){return Me.call(this,t),this.sizerEventsEnable&&(t.emit("sizer.add",t,this),this.emit("add",t,this)),this},De={addBackground:function(t,e,i){return void 0===this.backgroundChildren&&(this.backgroundChildren=[]),"string"==typeof e&&(i=e,e=void 0),void 0===e&&(e=0),Re.call(this,t),this.backgroundChildren.push(t),this.getSizerConfig(t).padding=Te(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground:function(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},Le=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},je={getParentSizer:function(t,e){return "string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),Le(t,e)},getTopmostSizer:function(t){return void 0===t&&(t=this),function(t){for(var e=Le(t);e;)t=e,e=Le(e);return t}(t)},hasParentSizer:function(t,e){void 0===e&&(e=this);for(var i=Le(e);i;){if(i===t)return !0;i=Le(i);}return !1},hasChild:function(t,e){return void 0===e&&(e=this),this.hasParentSizer(e,t)}},ze=Phaser.Utils.Array.Remove,Xe=Gt.prototype.remove,Ae=je.getParentSizer,Ie=function(t,e){for(var i=Ae(t);i;)i.removeChildCallback&&i.removeChildCallback(t,e),i=Ae(i);return this.isBackground(t)&&ze(this.backgroundChildren,t),Xe.call(this,t,e),!e&&this.sizerEventsEnable&&(t.emit("sizer.remove",t,this),this.emit("remove",t,this)),this},Ye=Phaser.Utils.Array.Remove,Ve=je.getParentSizer,We={removeFromParentSizer:function(){var t=Ve(gameObject);return t&&t.remove(this),this},removeBackground:function(t,e){return void 0===this.backgroundChildren||this.getParentSizer(t)!==this||(Ye(this.backgroundChildren,t),Ie.call(this,t,e)),this},removeAllBackgrounds:function(t){if(void 0===this.backgroundChildren)return this;for(var e=this.backgroundChildren.length-1;e>=0;e--)this.remove(this.backgroundChildren[e],t);return this}},He=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else {var i=t;for(t in i)this.childrenMap[t]=i[t];}return this},Ne=/(\S+)\[(\d+)\]/i,Fe=Phaser.Utils.Objects.GetValue,Ge=function(t,e){return void 0===e?t:t[e]},Be=function(e,i,n){void 0===e&&(e={}),void 0===i&&(i=0);var r=t(i);return "string"===r?e[i]=n:"number"===r?(e.left=i,e.right=i,e.top=i,e.bottom=i):(e.left=Fe(i,"left",0),e.right=Fe(i,"right",0),e.top=Fe(i,"top",0),e.bottom=Fe(i,"bottom",0)),e},Ue={getInnerPadding:function(t){return Ge(this.space,t)},setInnerPadding:function(t,e){return Be(this.space,t,e),this},getOuterPadding:function(t){return Ge(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return Be(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return "string"==typeof t&&(t=this.getElement(t)),Ge(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return "string"==typeof t&&(t=this.getElement(t)),Be(this.getSizerConfig(t).padding,e,i),this}},Je=function(t){var e=this.childrenWidth,i=void 0!==this.minWidth?this.minWidth:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") < childrenWidth (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") or childrenWidth (").concat(e," > targetWidth ").concat(t,")")),t},Ze=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},Ke={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,r=i.length;n<r;n++)(e=i[n]).rexSizer&&e.rexSizer.hidden||t.push(e);return t},getAllShownChildren:function(t){void 0===t&&(t=[]);for(var e=[this];e.length>0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push.apply(e,v(i.children)));}return t}},qe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,n=e.length;i<n;i++)(t=e[i]).ignoreLayout||t.preLayout();},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):[]}},$e=Phaser.Scene,ti=function(t){return t instanceof $e},ei=function(e){return null==e||"object"!==t(e)?null:ti(e)?e:e.scene&&ti(e.scene)?e.scene:e.parent&&e.parent.scene&&ti(e.parent.scene)?e.parent.scene:null},ii=Phaser.Game,ni=function(t){return t instanceof ii},ri=function(e){return null==e||"object"!==t(e)?null:ni(e)?e:ni(e.game)?e.game:ti(e)?e.sys.game:ti(e.scene)?e.scene.sys.game:void 0},si=Phaser.Utils.Objects.GetValue,oi=function(){function t(i,n){e(this,t),this.setParent(i),this.isShutdown=!1,this.setEventEmitter(si(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=ei(t),this.game=ri(t),this}}]),t}();Object.assign(oi.prototype,Qe);var ai=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,{eventEmitter:!1})).viewport=void 0,r.resetFromJSON(n),r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.autoAnchor(!1),this.viewport=void 0,this.onUpdateViewportCallback=void 0,this.onUpdateViewportCallbackScope=void 0,this.onResizeCallback=void 0,this.onResizeCallbackScope=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"resetFromJSON",value:function(t){var e,i,n,r,s,o,a,h;void 0===t&&(t={}),void 0!==t.x?(e=null,i=t.x):void 0!==t.left?(e=0,i=t.left):void 0!==t.right?(e=1,i=t.right):void 0!==t.centerX&&(e=.5,i=t.centerX),void 0!==t.y?(n=null,r=t.y):void 0!==t.top?(n=0,r=t.top):void 0!==t.bottom?(n=1,r=t.bottom):void 0!==t.centerY&&(n=.5,r=t.centerY),void 0!==i&&(i=i.replace("left","0%").replace("right","100%").replace("center","50%").split("%"),s=parseFloat(i[0])/100,o=""===i[1]?0:parseFloat(i[1])),void 0!==r&&(r=r.replace("top","0%").replace("bottom","100%").replace("center","50%").split("%"),a=parseFloat(r[0])/100,h=""===r[1]?0:parseFloat(r[1]));var l,u,c=t.width;void 0!==c&&(c=c.split("%"),l=parseFloat(c[0])/100,u=""===c[1]?0:parseFloat(c[1]));var d,f,v=t.height;void 0!==v&&(v=v.split("%"),d=parseFloat(v[0])/100,f=""===v[1]?0:parseFloat(v[1])),this.setAlign(e,n),this.setPercentage(s,a),this.setOffset(o,h),this.setSizePercentage(l,d),this.setSizePadding(u,f);var p=t.onResizeCallback,g=t.onResizeCallbackScope;void 0!==p&&this.setResizeCallback(p,g);var y=t.onUpdateViewportCallback,m=t.onUpdateViewportCallbackScope;return void 0!==y&&this.setUpdateViewportCallback(y,m),this.autoAnchor(t.enable),this}},{key:"autoAnchor",value:function(t){return void 0===t&&(t=!0),t=!!t,this.autoAnchorEnable===t||(t?(this.scene.sys.scale.on("resize",this.anchor,this),this.anchor()):this.scene.sys.scale.off("resize",this.anchor,this),this.autoAnchorEnable=t),this}},{key:"setAlign",value:function(t,e){return this.alignX=t,this.alignY=e,this}},{key:"setPercentage",value:function(t,e){return this.percentageX=t,this.percentageY=e,this}},{key:"setOffset",value:function(t,e){return this.offsetX=t,this.offsetY=e,this}},{key:"setSizePercentage",value:function(t,e){return this.percentageWidth=t,this.percentageHeight=e,this}},{key:"setSizePadding",value:function(t,e){return this.paddingWidth=t,this.paddingHeight=e,this}},{key:"setResizeCallback",value:function(t,e){return this.onResizeCallback=t,this.onResizeCallbackScope=e,this}},{key:"setUpdateViewportCallback",value:function(t,e){return this.onUpdateViewportCallback=t,this.onUpdateViewportCallbackScope=e,this}},{key:"anchor",value:function(){return this.updateViewport(),this.updateSize(),this.updatePosition(),this}},{key:"updateSize",value:function(){var t=this.onResizeCallback,e=this.onResizeCallbackScope,i=this.anchorWidth,n=this.anchorHeight;if((void 0!==i||void 0!==n)&&t){var r=this.parent;void 0===i&&(i=r.width),void 0===n&&(n=r.height),e?t.call(e,i,n,r,this):t(i,n,r,this);}}},{key:"updatePosition",value:function(){var t=this.parent;return null===this.alignX?t.x=this.anchorX:void 0!==this.alignX&&(t.x=this.anchorX+t.displayWidth*(t.originX-this.alignX)),null===this.alignY?t.y=this.anchorY:void 0!==this.alignY&&(t.y=this.anchorY+t.displayHeight*(t.originY-this.alignY)),this}},{key:"anchorX",get:function(){return this.viewport.x+this.viewport.width*this.percentageX+this.offsetX}},{key:"anchorY",get:function(){return this.viewport.y+this.viewport.height*this.percentageY+this.offsetY}},{key:"anchorWidth",get:function(){if(void 0!==this.percentageWidth)return this.viewport.width*this.percentageWidth+this.paddingWidth}},{key:"anchorHeight",get:function(){if(void 0!==this.percentageHeight)return this.viewport.height*this.percentageHeight+this.paddingHeight}},{key:"updateViewport",value:function(){var t=this.parent.scene.cameras.main;this.viewport=Zt(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}(oi),hi=Phaser.Utils.Objects.GetValue,li=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._isRunning=!1,r.isPaused=!1,r.tickingState=!1,r.setTickingMode(hi(n,"tickingMode",1)),r}return n(o,[{key:"boot",value:function(){2!==this.tickingMode||this.tickingState||this.startTicking();}},{key:"shutdown",value:function(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"setTickingMode",value:function(t){"string"==typeof t&&(t=ui[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}(oi),ui={no:0,lazy:1,always:2},ci=Phaser.Utils.Objects.GetValue,di=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=(r=i.call(this,t,n)).scene?"update":"step";return r.tickEventName=ci(n,"tickEventName",s),r.isSceneTicker=!fi(r.tickEventName),r}return n(o,[{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),this.isSceneTicker&&this.scene?this.scene.sys.events.off(this.tickEventName,this.update,this):this.game&&this.game.events.off(this.tickEventName,this.update,this);}}]),o}(li),fi=function(t){return "step"===t||"poststep"===t},vi=Phaser.Utils.Objects.GetValue,pi=Phaser.Math.Clamp,gi=function(){function t(i){e(this,t),this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){this.state=vi(t,"state",yi),this.timeScale=vi(t,"timeScale",1),this.delay=vi(t,"delay",0),this.repeat=vi(t,"repeat",0),this.repeatCounter=vi(t,"repeatCounter",0),this.repeatDelay=vi(t,"repeatDelay",0),this.duration=vi(t,"duration",0),this.nowTime=vi(t,"nowTime",0),this.justRestart=vi(t,"justRestart",!1);}},{key:"toJSON",value:function(){return {state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,repeatDelay:this.repeatDelay,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}},{key:"destroy",value:function(){}},{key:"setTimeScale",value:function(t){return this.timeScale=t,this}},{key:"setDelay",value:function(t){return void 0===t&&(t=0),this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatInfinity",value:function(){return this.repeat=-1,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"start",value:function(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?bi:mi,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=yi,this}},{key:"update",value:function(t,e){this.state!==yi&&this.state!==Ci&&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=ki)):(this.nowTime=this.duration,this.state=Ci):this.nowTime>=0&&(this.state=bi));}},{key:"t",get:function(){var t;switch(this.state){case yi:case mi:case ki:t=0;break;case bi:t=this.nowTime/this.duration;break;case Ci:t=1;}return pi(t,0,1)},set:function(t){(t=pi(t,-1,1))<0?(this.state=mi,this.nowTime=-this.delay*t):(this.state=bi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===yi}},{key:"isDelay",get:function(){return this.state===mi}},{key:"isCountDown",get:function(){return this.state===bi}},{key:"isRunning",get:function(){return this.state===mi||this.state===bi}},{key:"isDone",get:function(){return this.state===Ci}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),yi=0,mi=1,bi=2,ki=3,Ci=-1,wi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new gi,r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),c(s(o.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),c(s(o.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),c(s(o.prototype),"complete",this).call(this),this}}]),o}(di),Si=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Tweens.Builders.GetEaseFunction,Pi=function(t){r(o,t);var i=l(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Si(t,"timer")),this.setEnable(Si(t,"enable",!0)),this.setTarget(Si(t,"target",this.parent)),this.setDelay(_i(t,"delay",0)),this.setDuration(_i(t,"duration",1e3)),this.setEase(Si(t,"ease","Linear")),this.setRepeat(Si(t,"repeat