phaser3-rex-plugins
Version:
1 lines • 142 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).rexsizer=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},T={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)}},x=Phaser.Utils.Objects.GetValue,D=C.prototype.add,R=function(t,e){this.setParent(t);var i=_(t);return M(i,e),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),D.call(this,t),this.addToParentContainer(t),this.addToRenderLayer(t),this},L=function(t,e){this.setParent(t);var i=_(t);return M(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},M=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=x(e,"syncPosition",!0),t.syncRotation=x(e,"syncRotation",!0),t.syncScale=x(e,"syncScale",!0),t.syncAlpha=x(e,"syncAlpha",!0),t.syncScrollFactor=x(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):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}},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,Tt=Phaser.Geom.Rectangle.Union,xt=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},Lt=Phaser.Utils.Objects.GetValue,Mt=Phaser.Textures.DynamicTexture,zt=Phaser.Utils.String.UUID,At=function(t){if(t){var e,i,n=t.gameObjects,s=t.renderTexture,r=Lt(t,"x",void 0),o=Lt(t,"y",void 0),a=Lt(t,"width",void 0),h=Lt(t,"height",void 0),u=Lt(t,"originX",0),l=Lt(t,"originY",0),c=Lt(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):Tt(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 Mt(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?[]:{}:xt(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,T,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,Te=function(t){return _e.call(this,t),this.sizerEventsEnable&&(t.emit("sizer.add",t,this),this.emit("add",t,this)),this},xe={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),Te.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)}},Le=Phaser.Utils.Array.Remove,Me=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)&&Le(this.backgroundChildren,t),Me.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:"setEnabl