phaser3-rex-plugins
Version:
1 lines • 189 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).rexscrollbar=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,y(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 u(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 l(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=l(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=l(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=y(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 y(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 g,m=!1;m||(void 0===g&&(g=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])<g&&console.error("Minimum supported version : 3.".concat(g)),m=!0);var b=Phaser.GameObjects.Zone,k=Phaser.Utils.Array.Add,_=Phaser.Utils.Array.Remove,C=function(t){r(o,t);var i=u(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 _(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(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},x=Phaser.Math.DegToRad,O=Phaser.Math.RadToDeg,E=function(t){if(!t.hasOwnProperty("rexContainer")){var e={parent:null,self:null,layer:null,x:0,y:0,syncPosition:!0,rotation:0,syncRotation:!0,scaleX:0,scaleY:0,syncScale:!0,alpha:0,syncAlpha:!0,visible:!0,active:!0};Object.defineProperty(e,"angle",{get:function(){return O(this.rotation)},set:function(t){this.rotation=x(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),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)}},R=Phaser.Utils.Objects.GetValue,M=C.prototype.add,D=function(t,e){this.setParent(t);var i=E(t);return A(i,e),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),M.call(this,t),this.addToParentContainer(t),this.addToRenderLayer(t),this},j=function(t,e){this.setParent(t);var i=E(t);return A(i,e),i.x=t.x,i.y=t.y,i.rotation=t.rotation,i.scaleX=t.scaleX,i.scaleY=t.scaleY,i.alpha=t.alpha,i.visible=t.visible,i.active=t.active,this.updateChildPosition(t).updateChildAlpha(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),M.call(this,t),this.addToRenderLayer(t),this},A=function(t,e){void 0===e&&(e=!0),"boolean"==typeof e?(t.syncPosition=e,t.syncRotation=e,t.syncScale=e,t.syncAlpha=e,t.syncScrollFactor=e):(t.syncPosition=R(e,"syncPosition",!0),t.syncRotation=R(e,"syncRotation",!0),t.syncScale=R(e,"syncScale",!0),t.syncAlpha=R(e,"syncAlpha",!0),t.syncScrollFactor=R(e,"syncScrollFactor",!0));},L={add:function(t){return Array.isArray(t)?this.addMultiple(t):D.call(this,t),this},pin:function(t,e){return Array.isArray(t)?this.addMultiple(t,e):D.call(this,t,e),this},addMultiple:function(t){for(var e=0,i=t.length;e<i;e++)D.call(this,t[e]);return this},addLocal:function(t){return Array.isArray(t)?this.addMultiple(t):j.call(this,t),this},pinLocal:function(t,e){return Array.isArray(t)?this.addMultiple(t,e):j.call(this,t,e),this},addLocalMultiple:function(t){for(var e=0,i=t.length;e<i;e++)j.call(this,t[e]);return this}},z=C.prototype.remove,I=C.prototype.clear,N={remove:function(t,e){return w(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),z.call(this,t,e)),this},unpin:function(t,e){return w(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),z.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 I.call(this,t),this}},F={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}},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}},V=function(t,e){return t===e?1:t/e},W={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=V(t.scaleX,i.scaleX),e.scaleY=V(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}},G=Phaser.Math.DegToRad,U={updateChildRotation:function(t){var e=E(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState:function(t){var e=E(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation:function(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle:function(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation:function(t,e){return E(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle:function(t,e){return E(t).rotation=G(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=V(t.scaleX,i.scaleX),e.scaleY=V(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}},H={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=V(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}},q={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}},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}},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=w(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,ut=function(t){return t instanceof ht},lt=function(t){var e=t.getAllChildren([t]);return e=e.filter((function(t){return !!t.displayList||!!t.parentContainer}))},ct=function(t){var e=lt(this);return Q(e),t.add(e),this},dt=function(t,e,i){var n=lt(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 ut(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),ut(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},yt=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height},gt=Phaser.Geom.Rectangle,mt=Phaser.Math.Vector2,bt=Phaser.Math.RotateAround,kt=function(t,e){if(void 0===e?e=new gt:!0===e&&(void 0===_t&&(_t=new gt),e=_t),t.getBounds)return t.getBounds(e);var i,n,r,s,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),r=e.x,s=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),r=e.x,s=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,r,o,h),e.y=Math.min(n,s,a,u),e.width=Math.max(i,r,o,h)-e.x,e.height=Math.max(n,s,a,u)-e.y,e},_t=void 0,Ct=function(t,e,i){return void 0===e?e=new mt:!0===e&&(void 0===xt&&(xt=new mt),e=xt),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-pt(t)*t.originX,e.y=t.y-yt(t)*t.originY,Ot(t,e,i))},St=function(t,e,i){return void 0===e?e=new mt:!0===e&&(void 0===xt&&(xt=new mt),e=xt),t.getTopRight?t.getTopRight(e):(e.x=t.x-pt(t)*t.originX+pt(t),e.y=t.y-yt(t)*t.originY,Ot(t,e,i))},Pt=function(t,e,i){return void 0===e?e=new mt:!0===e&&(void 0===xt&&(xt=new mt),e=xt),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-pt(t)*t.originX,e.y=t.y-yt(t)*t.originY+yt(t),Ot(t,e,i))},wt=function(t,e,i){return void 0===e?e=new mt:!0===e&&(void 0===xt&&(xt=new mt),e=xt),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-pt(t)*t.originX+pt(t),e.y=t.y-yt(t)*t.originY+yt(t),Ot(t,e,i))},xt=void 0,Ot=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,Rt=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},Mt=Phaser.GameObjects.GameObject,Dt=function(t){return t instanceof Mt},jt=Phaser.Utils.Objects.GetValue,At=Phaser.Textures.DynamicTexture,Lt=Phaser.Utils.String.UUID,zt=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),u=jt(t,"originX",0),l=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===P&&(P=new Et),e=P),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),u=.5,l=.5):(s=d.x,o=d.y,a=d.width,h=d.height,u=0,l=0),e=d.x,i=d.y;}else e=s+(0-u)*a,i=o+(0-l)*h;e-=c,i-=c,a+=2*c,h+=2*c;var f=n[0].scene;v&&!r&&(r=new At(f.sys.textures,Lt(),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(u,l),r.camera.setScroll(e,i),n=Q(function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:Rt(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}(n)),r.draw(n);var v=t.saveTexture;if(v)if(Dt(r))r.saveTexture(v);else {var p=r,y=p.manager;y.exists(p.key)?y.renameTexture(p.key,key):(p.key=key,y.list[key]=p,y.emit("addtexture",key,p),y.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=zt(t),s=!!r.scene;return n||(this.setScale(e,i),s&&r.setScale(e,i)),s?r:this}},Nt=Phaser.Utils.Objects.GetValue,Ft=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=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!==r&&e.fillStyle(r,s).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,Vt=Phaser.Math.RotateAround,Wt={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};Vt(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=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,r,s,o,a;if("number"==typeof i?n=i:(n=Nt(i,"color"),r=Nt(i,"lineWidth"),s=Nt(i,"fillColor"),o=Nt(i,"fillAlpha",1),a=Nt(i,"padding",0)),Array.isArray(t))for(var h=0,u=t.length;h<u;h++)Ft(t[h],e,n,r,s,o,a);else Ft(t,e,n,r,s,o,a);}(n,t,e),this}};Object.assign(Wt,T,L,N,F,Y,W,U,B,H,J,q,K,Z,$,nt,ot,ft,vt,It);var Gt=function(t){r(o,t);var i=u(o);function o(t,n,r,s,a,h){var u;return e(this,o),Array.isArray(s)&&(h=s,s=void 0,a=void 0),(u=i.call(this,t,n,r,s,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,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=w(this);return !!t&&t.setParentContainerFlag}}],[{key:"GetParent",value:function(t){return w(t)}}]),o}(C);Object.assign(Gt.prototype,Wt);var Ut=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};var Bt=Phaser.Cameras.Scene2D.BaseCamera,Ht=Phaser.Geom.Rectangle,Jt=function(t,e,i){return e instanceof Bt||(i=e,e=void 0),void 0===i?i=new Ht:!0===i&&(i=qt),e?t.scale.getViewPort(e,i):t.scale.getViewPort(i)},qt=new Ht,Kt=Phaser.Display.Align,Zt={center:Kt.CENTER,left:Kt.LEFT_CENTER,right:Kt.RIGHT_CENTER,top:Kt.TOP_CENTER,bottom:Kt.BOTTOM_CENTER,"left-top":Kt.TOP_LEFT,"top-left":Kt.TOP_LEFT,"left-center":Kt.LEFT_CENTER,"center-left":Kt.LEFT_CENTER,"left-bottom":Kt.BOTTOM_LEFT,"bottom-left":Kt.BOTTOM_LEFT,"center-top":Kt.TOP_CENTER,"top-center":Kt.TOP_CENTER,"center-center":Kt.CENTER,"center-bottom":Kt.BOTTOM_CENTER,"bottom-center":Kt.BOTTOM_CENTER,"right-top":Kt.TOP_RIGHT,"top-right":Kt.TOP_RIGHT,"right-center":Kt.RIGHT_CENTER,"center-right":Kt.RIGHT_CENTER,"right-bottom":Kt.BOTTOM_RIGHT,"bottom-right":Kt.BOTTOM_RIGHT},Qt=function(){},$t=new Phaser.GameObjects.Zone({sys:{queueDepthSort:Qt,events:{once:Qt}}},0,0,1,1);$t.setOrigin(0);var te=0,ee=1,ie=2,ne=4,re=6,se=8,oe=10,ae=12,he=function(t){var e=yt(t);return t.y+e-e*t.originY},ue=function(t){var e=pt(t);return t.x-e*t.originX+.5*e},le=function(t,e){var i=yt(t);return t.y=e-i+i*t.originY,t},ce=function(t,e){var i=pt(t),n=i*t.originX;return t.x=e+n-.5*i,t},de=function(t){var e=pt(t);return t.x-e*t.originX},fe=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},ye=function(t,e){var i=yt(t),n=i*t.originY;return t.y=e+n-.5*i,t},ge=function(t){var e=yt(t);return t.y-e*t.originY+.5*e},me=function(t){var e=yt(t);return t.y-e*t.originY},be=function(t,e){var i=yt(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),ce(t,ue(e)+i),le(t,he(e)+n),t},ke[oe]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),fe(t,de(e)-i),le(t,he(e)+n),t},ke[ae]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),pe(t,ve(e)+i),le(t,he(e)+n),t},ke[re]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),function(t,e,i){ce(t,e),ye(t,i);}(t,ue(e)+i,ge(e)+n),t},ke[ne]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),fe(t,de(e)-i),ye(t,ge(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),ye(t,ge(e)+n),t},ke[ee]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ce(t,ue(e)+i),be(t,me(e)-n),t},ke[te]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),fe(t,de(e)-i),be(t,me(e)-n),t},ke[ie]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),pe(t,ve(e)+i),be(t,me(e)-n),t};var _e=function(t,e,i,n,r){return ke[i](t,e,n,r)},Ce=function(t,e,i,n,r,s){$t.setPosition(e,i).setSize(n,r),_e(t,$t,s);},Se=Phaser.Utils.Objects.GetValue,Pe=Phaser.GameObjects.Group,we=function(t,e,i){return t.add.text(0,0,"")},xe=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},Te=Gt.prototype.add,Re=function(t){return Te.call(this,t),this.sizerEventsEnable&&(t.emit("sizer.add",t,this),this.emit("add",t,this)),this},Me={addBackground:function(t,e,i){return void 0===this.backgroundChildren&&(this.backgroundChildren=[]),"string"==typeof e&&(i=e,e=void 0),void 0===e&&(e=0),Re.call(this,t),this.backgroundChildren.push(t),this.getSizerConfig(t).padding=Ee(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground:function(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},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},je={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)}},Ae=Phaser.Utils.Array.Remove,Le=Gt.prototype.remove,ze=je.getParentSizer,Ie=function(t,e){for(var i=ze(t);i;)i.removeChildCallback&&i.removeChildCallback(t,e),i=ze(i);return this.isBackground(t)&&Ae(this.backgroundChildren,t),Le.call(this,t,e),!e&&this.sizerEventsEnable&&(t.emit("sizer.remove",t,this),this.emit("remove",t,this)),this},Ne=Phaser.Utils.Array.Remove,Fe=je.getParentSizer,Xe={removeFromParentSizer:function(){var t=Fe(gameObject);return t&&t.remove(this),this},removeBackground:function(t,e){return void 0===this.backgroundChildren||this.getParentSizer(t)!==this||(Ne(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}},Ye=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},Ve=/(\S+)\[(\d+)\]/i,We=Phaser.Utils.Objects.GetValue,Ge=function(t,e){return void 0===e?t:t[e]},Ue=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=We(i,"left",0),e.right=We(i,"right",0),e.top=We(i,"top",0),e.bottom=We(i,"bottom",0)),e},Be={getInnerPadding:function(t){return Ge(this.space,t)},setInnerPadding:function(t,e){return Ue(this.space,t,e),this},getOuterPadding:function(t){return Ge(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return Ue(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)),Ue(this.getSizerConfig(t).padding,e,i),this}},He=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},Je=function(t){var e=this.childrenHeight,i=void 0!==this.minHeight?this.minHeight:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") < childrenHeight (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") or childrenHeight (").concat(e,") > targetHeight (").concat(t,")")),t},qe={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,r=i.length;n<r;n++)(e=i[n]).rexSizer&&e.rexSizer.hidden||t.push(e);return t},getAllShownChildren:function(t){void 0===t&&(t=[]);for(var e=[this];e.length>0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push.apply(e,v(i.children)));}return t}},Ke=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();},Ze={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):[]}},Qe=Phaser.Scene,$e=function(t){return t instanceof Qe},ti=function(e){return null==e||"object"!==t(e)?null:$e(e)?e:e.scene&&$e(e.scene)?e.scene:e.parent&&e.parent.scene&&$e(e.parent.scene)?e.parent.scene:null},ei=Phaser.Game,ii=function(t){return t instanceof ei},ni=function(e){return null==e||"object"!==t(e)?null:ii(e)?e:ii(e.game)?e.game:$e(e)?e.sys.game:$e(e.scene)?e.scene.sys.game:void 0},ri=Phaser.Utils.Objects.GetValue,si=function(){function t(i,n){e(this,t),this.setParent(i),this.isShutdown=!1,this.setEventEmitter(ri(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=ti(t),this.game=ni(t),this}}]),t}();Object.assign(si.prototype,Ze);var oi=function(t){r(o,t);var i=u(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 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,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(u,d),this.setSizePadding(l,f);var p=t.onResizeCallback,y=t.onResizeCallbackScope;void 0!==p&&this.setResizeCallback(p,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 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=Jt(this.scene,t,this.viewport);var e=this.viewport,i=this.onUpdateViewportCallback,n=this.onUpdateViewportCallbackScope;i&&(n?i.call(n,e,this.parent,this):i(e,this.parent,this));}}]),o}(si),ai=Phaser.Utils.Objects.GetValue,hi=function(t){r(o,t);var i=u(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(ai(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}(si),ui={no:0,lazy:1,always:2},li=Phaser.Utils.Objects.GetValue,ci=function(t){r(o,t);var i=u(o);function o(t,n){var r;e(this,o);var s=(r=i.call(this,t,n)).scene?"update":"step";return r.tickEventName=li(n,"tickEventName",s),r.isSceneTicker=!di(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}(hi),di=function(t){return "step"===t||"poststep"===t},fi=Phaser.Utils.Objects.GetValue,vi=Phaser.Math.Clamp,pi=function(){function t(i){e(this,t),this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){this.state=fi(t,"state",yi),this.timeScale=fi(t,"timeScale",1),this.delay=fi(t,"delay",0),this.repeat=fi(t,"repeat",0),this.repeatCounter=fi(t,"repeatCounter",0),this.repeatDelay=fi(t,"repeatDelay",0),this.duration=fi(t,"duration",0),this.nowTime=fi(t,"nowTime",0),this.justRestart=fi(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?mi:gi,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=yi,this}},{key:"update",value:function(t,e){this.state!==yi&&this.state!==ki&&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=bi)):(this.nowTime=this.duration,this.state=ki):this.nowTime>=0&&(this.state=mi));}},{key:"t",get:function(){var t;switch(this.state){case yi:case gi:case bi:t=0;break;case mi:t=this.nowTime/this.duration;break;case ki:t=1;}return vi(t,0,1)},set:function(t){(t=vi(t,-1,1))<0?(this.state=gi,this.nowTime=-this.delay*t):(this.state=mi,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===gi}},{key:"isCountDown",get:function(){return this.state===mi}},{key:"isRunning",get:function(){return this.state===gi||this.state===mi}},{key:"isDone",get:function(){return this.state===ki}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),yi=0,gi=1,mi=2,bi=3,ki=-1,_i=function(t){r(o,t);var i=u(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new pi,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}(ci),Ci=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Tweens.Builders.GetEaseFunction,wi=function(t){r(o,t);var i=u(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),