UNPKG

phaser3-rex-plugins

Version:
1 lines 164 kB
!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).rextextbox=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 c(){return c="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}},c.apply(this,arguments)}function l(t,e,i,n){return l="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},l(t,e,i,n)}function d(t,e,i,n,s){if(!l(t,e,i,n||t)&&s)throw new TypeError("failed to set property");return i}function p(t){return function(t){if(Array.isArray(t))return v(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return v(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return v(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function 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={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):[]}},g=Phaser.Scene,m=function(t){return t instanceof g},k=function(e){return null==e||"object"!==t(e)?null:m(e)?e:e.scene&&m(e.scene)?e.scene:e.parent&&e.parent.scene&&m(e.parent.scene)?e.parent.scene:null},b=Phaser.Game,C=function(t){return t instanceof b},x=function(e){return null==e||"object"!==t(e)?null:C(e)?e:C(e.game)?e.game:m(e)?e.sys.game:m(e.scene)?e.scene.sys.game:void 0},S=Phaser.Utils.Objects.GetValue,T=function(){function t(i,n){e(this,t),this.setParent(i),this.isShutdown=!1,this.setEventEmitter(S(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=k(t),this.game=x(t),this}}]),t}();Object.assign(T.prototype,y);var P=Phaser.GameObjects.Text,w=Phaser.GameObjects.BitmapText,O=function(t){return function(t){return t instanceof w}(t)?2:function(t){return t instanceof P}(t)?0:1},E=function(t,e,i){switch(O(t)){case 0:i=t.getWrappedText(e);break;case 1:i=t.getPenManager(e,i);break;case 2:i=t.maxWidth>0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n");}return i},_=function(t){return Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},L={clearText:function(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage:function(t){var e=this.totalLinesCount;this.sections.push(_(t));t=this.sections.join("\n");this.lines=E(this.parent,t,this.lines);for(var i=this.totalLinesCount-e,n=Math.ceil(i/this.pageLinesCount),s=0;s<n;s++)this.pageStartIndexes.push(e+s*this.pageLinesCount);return this},setText:function(t,e){void 0===e&&(e=!0),e&&this.resetPageIdx(),this.clearText();for(var i=_(t).split(this.pageBreak),n=0,s=i.length;n<s;n++)this.appendPage(i[n]);return this},appendText:function(t){var e=this.content+_(t);return this.setText(e,!1),this}},M=Phaser.Math.Clamp,D={getPage:function(t){return void 0===t&&(t=this.pageIndex),this.setPageIndex(t).getLines(this.startLineIndex,this.endLineIndex)},getNextPage:function(){return this.getPage(this.pageIndex+1)},getPreviousPage:function(){return this.getPage(this.pageIndex-1)},getFirstPage:function(){return this.getPage(0)},getLastPage:function(){return this.getPage(this.lastPageIndex)},resetPageIdx:function(){return this.pageIndex=-1,this},setPageIndex:function(t){return t=M(t,0,this.lastPageIndex),this.pageIndex=t,this.startLineIndex=this.pageStartIndexes[t],this.endLineIndex=this.pageStartIndexes[t+1],this}},R=function(t,e){switch(O(t)){case 0:var i=(s=t.style).wordWrapWidth,n=s.wordWrapCallback;s.wordWrapWidth=0,s.wordWrapCallback=void 0,t.setText(e),s.wordWrapWidth=i,s.wordWrapCallback=n;break;case 1:var s,r=(s=t.style).wrapMode;s.wrapMode=0,t.setText(e),s.wrapMode=r;break;case 2:var o=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=o;}},I={showPage:function(t){return this.displayText(this.getPage(t)),this},showNextPage:function(){return this.displayText(this.getNextPage()),this},showPreviousPage:function(){return this.displayText(this.getPreviousPage()),this},showFirstPage:function(){return this.displayText(this.getFirstPage()),this},showLastPage:function(){return this.displayText(this.getLastPage()),this},show:function(){return this.displayText(this.getLines()),this},showNextLine:function(){return this.displayText(this.setStartLineIndex(this.startLineIndex+1).getLines()),this},showPreviousLine:function(){return this.displayText(this.setStartLineIndex(this.startLineIndex-1).getLines()),this},displayText:function(t){R(this.parent,t);}},z={getLines:function(t,e){var i;switch(void 0===t&&(t=this.startLineIndex),void 0===e&&(e=t+this.pageLinesCount),this.textObjectType){case 0:case 2:i=this.lines.slice(t,e).join("\n");break;case 1:var n=this.lines.getLineStartIndex(t),s=this.lines.getLineEndIndex(e-1);i=this.lines.getSliceTagText(n,s,!0);}return i}};Object.assign(z,L,D,I);var A=Phaser.Utils.Objects.GetValue,j=Phaser.Math.Clamp,N=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})).textObjectType=O(s.parent),s.pageStartIndexes=[],s.lines=E(s.parent,""),s.sections=[],s.resetFromJSON(n),s}return n(o,[{key:"resetFromJSON",value:function(t){return this.setMaxLines(A(t,"maxLines",void 0)),this.setPageBreak(A(t,"pageBreak","\f\n")),this.setText(A(t,"text","")),this.setStartLineIndex(A(t,"start",0)),this.setPageIndex(A(t,"page",-1)),this}},{key:"toJSON",value:function(){return {maxLines:this.maxLines,text:this.content,start:this.startLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}},{key:"shutdown",value:function(t){if(!this.isShutdown){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy();}this.pageStartIndexes.length=0,this.sections.length=0,this.lines=void 0,this.pageStartIndexes=void 0,this.sections=void 0,c(r(o.prototype),"shutdown",this).call(this,t);}}},{key:"setMaxLines",value:function(t){return this.maxLines=t,this}},{key:"setPageBreak",value:function(t){return this.pageBreak=t,this}},{key:"pageCount",get:function(){return this.pageStartIndexes.length}},{key:"lastPageIndex",get:function(){return this.pageCount-1}},{key:"isFirstPage",get:function(){return this.pageIndex<=0}},{key:"isLastPage",get:function(){return this.pageIndex>=this.pageCount-1}},{key:"totalLinesCount",get:function(){return this.lines?this.lines.length:0}},{key:"startLineIndex",get:function(){return this._startLineIndex},set:function(t){t=j(t,0,this.totalLinesCount-1),this._startLineIndex=t;}},{key:"setStartLineIndex",value:function(t){return this.startLineIndex=t,this}},{key:"pageLinesCount",get:function(){if(void 0!==this.maxLines)return this.maxLines;var t;switch(this.textObjectType){case 0:case 1:var e=this.parent.style.maxLines;t=e>0?e:Math.floor(function(t){var e,i,n;switch(O(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,n=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var s=t.fontSize/t.fontData.size;n=t.fontData.lineHeight*s;}return (e-i)/(n+i)}(this.parent));break;case 2:t=this.totalLinesCount;}return t}},{key:"content",get:function(){return this.sections.join(this.pageBreak)}}]),o}(T);Object.assign(N.prototype,z);var X,Y=Phaser.Utils.Objects.GetFastValue,F=Phaser.Utils.Objects.GetValue,W=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=null,s.resetFromJSON(n),s}return n(o,[{key:"resetFromJSON",value:function(t){this.setTextWrapEnable(F(t,"wrap",!1)),this.setTypeMode(F(t,"typeMode",0)),this.setTypingSpeed(F(t,"speed",333)),this.setTextCallback=Y(t,"setTextCallback",null),this.setTextCallbackScope=Y(t,"setTextCallbackScope",null),this.setTypingContent(Y(t,"text","")),this.typingIdx=Y(t,"typingIdx",0),this.insertIdx=null,this.insertChar=null;var e=Y(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIdx,e),this}},{key:"shutdown",value:function(t){this.isShutdown||(this.freeTimer(),c(r(o.prototype),"shutdown",this).call(this,t));}},{key:"setTypeMode",value:function(t){return "string"==typeof t&&(t=B[t]),this.typeMode=t,this}},{key:"setTypeSpeed",value:function(t){return this.speed=t,this}},{key:"setTypingSpeed",value:function(t){return this.speed=t,this}},{key:"setTextWrapEnable",value:function(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}},{key:"text",get:function(){return this._text},set:function(t){var e=U(t);this.textWrapEnable&&(e=function(t,e){switch(O(t)){case 0:t.style.syncFont(t.canvas,t.context),e=t.runWordWrap(e);break;case 1:e=t.getText(e,void 0,void 0,!0);break;case 2:e=t.setText(e).getTextBounds().wrappedText;}return e}(this.parent,e)),this._text=e;}},{key:"isTyping",get:function(){return null!==this.getTimer()}},{key:"isLastChar",get:function(){return this.typingIdx===this.textLen}},{key:"start",value:function(t,e,i,n){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIdx=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(n)),this}},{key:"appendText",value:function(t){var e=this.text.concat(U(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLen),this}},{key:"stop",value:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)this.getTypingString(this.text,this.typingIdx,this.textLen,this.typeMode),this.emit("typechar",this.insertChar),this.typingIdx++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent);}return this}},{key:"pause",value:function(){var t=this.getTimer();return t&&(t.paused=!0),this}},{key:"resume",value:function(){var t=this.getTimer();return t&&(t.paused=!1),this}},{key:"setTypingContent",value:function(t){return this.text=t,this.textLen=this.getTextLength(this.text),this}},{key:"onTyping",value:function(){var t=this.getTypingString(this.text,this.typingIdx,this.textLen,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.emit("complete",this,this.parent)):(this.timer.delay=this.speed,this.typingIdx++);}},{key:"getTypingString",value:function(t,e,i,n){var s;if(0===n){var r=0,o=e;this.insertIdx=o,s=this.getSubString(t,r,o);}else if(1===n){r=(o=i)-e;this.insertIdx=0,s=this.getSubString(t,r,o);}else if(2===n){var a=i/2;o=(r=Math.floor(a-e/2))+e;this.insertIdx=e%2?e:0,s=this.getSubString(t,r,o);}else if(3===n){var h,u=Math.floor(e/2);if(u>0){r=(o=i)-u;h=this.getSubString(t,r,o);}else h="";var c,l=e-u;if(l>0){o=(r=0)+l;this.insertIdx=o,c=this.getSubString(t,r,o);}else c="",this.insertIdx=0;s=c+h;}return this.insertChar=s.charAt(this.insertIdx-1),s}},{key:"startTimer",value:function(t){var e;return this.timer&&this.freeTimer(),void 0===t?e=0:(this.speed,e=t),this.timer=this.scene.time.addEvent({delay:1e-4,startAt:e,loop:!0,callback:this.onTyping,callbackScope:this}),this}},{key:"getTimer",value:function(){return this.timer}},{key:"freeTimer",value:function(){return this.timer&&(this.timer.remove(),this.timer=null),this}},{key:"setText",value:function(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIdx):this.setTextCallback(t,this.isLastChar,this.insertIdx)),this.textWrapEnable?R(this.parent,t):this.parent.setText(t);}},{key:"getTextLength",value:function(t){var e=this.parent;return e.getPlainText?e.getPlainText(t).length:t.length}},{key:"getSubString",value:function(t,e,i){var n=this.parent;return n.getSubString?n.getSubString(t,e,i):t.slice(e,i)}}]),o}(T),U=function(t){return Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},B={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3},V=Phaser.Utils.Objects.GetValue,G=!1;G||(void 0===X&&(X=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])<X&&console.error("Minimum supported version : 3.".concat(X)),G=!0);var H=Phaser.GameObjects.Zone,J=Phaser.Utils.Array.Add,q=Phaser.Utils.Array.Remove,Z=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),c(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 J(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return q(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}(H),K=Phaser.GameObjects.Components;Phaser.Class.mixin(Z,[K.Alpha,K.Flip]);var $,Q=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},tt=Phaser.Math.DegToRad,et=Phaser.Math.RadToDeg,it=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 et(this.rotation)},set:function(t){this.rotation=tt(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},nt={setParent:function(t,e){void 0===e&&(e=this);var i=it(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),Q(t,e)},getTopmostParent:function(t){return void 0===t&&(t=this),function(t){for(var e=Q(t);e;)t=e,e=Q(e);return t}(t)}},st=Phaser.Utils.Objects.GetValue,rt=Z.prototype.add,ot=function(t,e){this.setParent(t);var i=it(t);return ht(i,e),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),rt.call(this,t),this.addToParentContainer(t),this.addToRenderLayer(t),this},at=function(t,e){this.setParent(t);var i=it(t);return ht(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),rt.call(this,t),this.addToRenderLayer(t),this},ht=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=st(e,"syncPosition",!0),t.syncRotation=st(e,"syncRotation",!0),t.syncScale=st(e,"syncScale",!0),t.syncAlpha=st(e,"syncAlpha",!0),t.syncScrollFactor=st(e,"syncScrollFactor",!0));},ut={add:function(t){return Array.isArray(t)?this.addMultiple(t):ot.call(this,t),this},pin:function(t,e){return Array.isArray(t)?this.addMultiple(t,e):ot.call(this,t,e),this},addMultiple:function(t){for(var e=0,i=t.length;e<i;e++)ot.call(this,t[e]);return this},addLocal:function(t){return Array.isArray(t)?this.addMultiple(t):at.call(this,t),this},pinLocal:function(t,e){return Array.isArray(t)?this.addMultiple(t,e):at.call(this,t,e),this},addLocalMultiple:function(t){for(var e=0,i=t.length;e<i;e++)at.call(this,t[e]);return this}},ct=Z.prototype.remove,lt=Z.prototype.clear,dt={remove:function(t,e){return Q(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),ct.call(this,t,e)),this},unpin:function(t,e){return Q(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),ct.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 lt.call(this,t),this}},pt={getLocalState:function(t){return it(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}},vt=Phaser.Math.RotateAround,ft={worldToLocal:function(t){return t.x-=this.x,t.y-=this.y,vt(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,vt(t,0,0,this.rotation),t.x+=this.x,t.y+=this.y,t}},yt=function(t,e){return t===e?1:t/e},gt={updateChildPosition:function(t){t.isRexContainerLite&&(t.syncChildrenEnable=!1);var e=it(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=it(t),i=e.parent;return e.x=t.x,e.y=t.y,i.worldToLocal(e),e.scaleX=yt(t.scaleX,i.scaleX),e.scaleY=yt(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=it(t);return n.x=e,n.y=i,this.updateChildPosition(t),this},resetLocalPositionState:function(){var t=it(this).parent;return t&&t.resetChildPositionState(this),this}},mt=Phaser.Math.DegToRad,kt={updateChildRotation:function(t){var e=it(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=it(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 it(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle:function(t,e){return it(t).rotation=mt(e),this.updateChildRotation(t),this},resetLocalRotationState:function(){var t=it(this).parent;return t&&t.resetChildRotationState(this),this}},bt={updateChildScale:function(t){var e=it(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=it(t),i=e.parent;return e.scaleX=yt(t.scaleX,i.scaleX),e.scaleY=yt(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=it(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=it(this).parent;return t&&t.resetChildScaleState(this),this}},Ct={updateChildVisible:function(t){var e=it(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=it(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),it(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible:function(t,e){return void 0===e&&(e=!0),it(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState:function(){var t=it(this).parent;return t&&t.resetChildVisibleState(this),this}},xt={updateChildAlpha:function(t){var e=it(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=it(t),i=e.parent;return e.alpha=yt(t.alpha,i.alpha),this},setChildAlpha:function(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha:function(t,e){return it(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState:function(){var t=it(this).parent;return t&&t.resetChildAlphaState(this),this}},St={updateChildActive:function(t){var e=it(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 it(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),it(t).active=e,this.updateChildActive(t),this},resetLocalActiveState:function(){var t=it(this).parent;return t&&t.resetChildActiveState(this),this}},Tt={updateChildScrollFactor:function(t){var e=it(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}},Pt={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}},wt=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},Ot={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]);wt(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]);wt(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]);wt(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]);wt(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]);wt(e,!1);var i=e[0];return i===t||i.displayList!==t.displayList||i.displayList.moveBelow(t,i),this}},Et=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);},_t=function(t,e){for(var i=[t];i.length>0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,p(n.children));}},Lt=Phaser.Utils.Array,Mt={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 _t(e,(function(i){i!==e&&t.push(i);})),t},getAllVisibleChildren:function(t){void 0===t&&(t=[]);var e=this;return _t(e,(function(i){if(i!==e)return !i.visible||void t.push(i)})),t},bfs:function(t,e){return void 0===e&&(e=this),_t(e,t),this},dfs:function(t,e){return void 0===e&&(e=this),Et(e,t),this},contains:function(t){var e=Q(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 Lt.GetFirst(this.children,"name",t)},getRandom:function(t,e){return Lt.GetRandom(this.children,t,e)},getFirst:function(t,e,i,n){return Lt.GetFirstElement(this.children,t,e,i,n)},getAll:function(t,e,i,n){return Lt.GetAll(this.children,t,e,i,n)},count:function(t,e,i,n){return Lt.CountAllMatching(this.children,t,e,i,n)},swap:function(t,e){return Lt.Swap(this.children,t,e),this},setAll:function(t,e,i,n){return Lt.SetAll(this.children,t,e,i,n),this}},Dt=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},Rt=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();},It={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=Dt(e);var n=i.tweens.add(t);return n.on("update",Rt),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=Dt(e));var i=t.onUpdate;return t.onUpdate=function(t,e){i&&i(t,e),Rt(t,void 0,e);},t},tween:function(t){var e=this.scene;return t.targets||(t.targets=this),e.tweens.add(t)}},zt=Phaser.GameObjects.Container,At=Phaser.GameObjects.Layer,jt=function(t){return t instanceof At},Nt=function(t){var e=t.getAllChildren([t]);return e=e.filter((function(t){return !!t.displayList||!!t.parentContainer}))},Xt=function(t){var e=Nt(this);return wt(e),t.add(e),this},Yt=function(t,e,i){var n=Nt(this);return wt(n,e),t.remove(n),i&&n.forEach((function(t){t.addToDisplayList();})),this},Ft={addToContainer:function(t){return function(t){return t instanceof zt}(t)?(this._setParentContainerFlag=!0,Xt.call(this,t),this._setParentContainerFlag=!1,this):this},addToLayer:function(t){return jt(t)?(Xt.call(this,t),this):this},removeFromContainer:function(){return this.parentContainer?(this._setParentContainerFlag=!0,Yt.call(this,this.parentContainer,!0,!1),this._setParentContainerFlag=!1,this):this},removeFromLayer:function(t){return void 0===t&&(t=!0),jt(this.displayList)?(Yt.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}},Wt={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),it(t).layer=e,this):this},removeFromRenderLayer:function(t){var e=it(t),i=e.layer;return i?(t.isRexContainerLite?t.removeFromLayer(!0):i.remove(t),e.layer=null,this):this}},Ut=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},Bt=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height},Vt=Phaser.Geom.Rectangle,Gt=Phaser.Math.Vector2,Ht=Phaser.Math.RotateAround,Jt=function(t,e){if(void 0===e?e=new Vt:!0===e&&(void 0===qt&&(qt=new Vt),e=qt),t.getBounds)return t.getBounds(e);var i,n,s,r,o,a,h,u;if(t.parentContainer){var c=t.parentContainer.getBoundsTransformMatrix();Zt(t,e),c.transformPoint(e.x,e.y,e),i=e.x,n=e.y,Kt(t,e),c.transformPoint(e.x,e.y,e),s=e.x,r=e.y,$t(t,e),c.transformPoint(e.x,e.y,e),o=e.x,a=e.y,Qt(t,e),c.transformPoint(e.x,e.y,e),h=e.x,u=e.y;}else Zt(t,e),i=e.x,n=e.y,Kt(t,e),s=e.x,r=e.y,$t(t,e),o=e.x,a=e.y,Qt(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},qt=void 0,Zt=function(t,e,i){return void 0===e?e=new Gt:!0===e&&(void 0===te&&(te=new Gt),e=te),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-Ut(t)*t.originX,e.y=t.y-Bt(t)*t.originY,ee(t,e,i))},Kt=function(t,e,i){return void 0===e?e=new Gt:!0===e&&(void 0===te&&(te=new Gt),e=te),t.getTopRight?t.getTopRight(e):(e.x=t.x-Ut(t)*t.originX+Ut(t),e.y=t.y-Bt(t)*t.originY,ee(t,e,i))},$t=function(t,e,i){return void 0===e?e=new Gt:!0===e&&(void 0===te&&(te=new Gt),e=te),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-Ut(t)*t.originX,e.y=t.y-Bt(t)*t.originY+Bt(t),ee(t,e,i))},Qt=function(t,e,i){return void 0===e?e=new Gt:!0===e&&(void 0===te&&(te=new Gt),e=te),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-Ut(t)*t.originX+Ut(t),e.y=t.y-Bt(t)*t.originY+Bt(t),ee(t,e,i))},te=void 0,ee=function(t,e,i){(void 0===i&&(i=!1),0!==t.rotation&&Ht(e,t.x,t.y,t.rotation),i&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e},ie=Phaser.Geom.Rectangle,ne=Phaser.Geom.Rectangle.Union,se=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},re=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:se(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},oe=Phaser.GameObjects.GameObject,ae=function(t){return t instanceof oe},he=Phaser.Utils.Objects.GetValue,ue=Phaser.Textures.DynamicTexture,ce=Phaser.Utils.String.UUID,le=function(t){if(t){var e,i,n=t.gameObjects,s=t.renderTexture,r=he(t,"x",void 0),o=he(t,"y",void 0),a=he(t,"width",void 0),h=he(t,"height",void 0),u=he(t,"originX",0),c=he(t,"originY",0),l=he(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 ie:!0===e&&(void 0===$&&($=new ie),e=$),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=Jt(i,!0);n?(e.setTo(o.x,o.y,o.width,o.height),n=!1):ne(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,c=.5):(r=d.x,o=d.y,a=d.width,h=d.height,u=0,c=0),e=d.x,i=d.y;}else e=r+(0-u)*a,i=o+(0-c)*h;e-=l,i-=l,a+=2*l,h+=2*l;var p=n[0].scene;v&&!s&&(s=new ue(p.sys.textures,ce(),a,h)),s||(s=p.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,c),s.camera.setScroll(e,i),n=wt(re(n)),s.draw(n);var v=t.saveTexture;if(v)if(ae(s))s.saveTexture(v);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}},de={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=le(t),r=!!s.scene;return n||(this.setScale(e,i),r&&s.setScale(e,i)),r?s:this}},pe=Phaser.Utils.Objects.GetValue,ve=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=Zt(t,fe[0]);a.x-=o,a.y-=o;var h=Kt(t,fe[1]);h.x+=o,h.y-=o;var u=Qt(t,fe[2]);u.x+=o,u.y+=o;var c=$t(t,fe[3]);c.x-=o,c.y+=o,null!==s&&e.fillStyle(s,r).fillPoints(fe,!0,!0),null!==i&&e.lineStyle(n,i).strokePoints(fe,!0,!0);}},fe=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],ye=Phaser.Utils.Objects.GetValue,ge=Phaser.Math.RotateAround,me={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};ge(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=ye(e,"drawContainer",!0),n=ye(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=pe(i,"color"),s=pe(i,"lineWidth"),r=pe(i,"fillColor"),o=pe(i,"fillAlpha",1),a=pe(i,"padding",0)),Array.isArray(t))for(var h=0,u=t.length;h<u;h++)ve(t[h],e,n,s,r,o,a);else ve(t,e,n,s,r,o,a);}(n,t,e),this}};Object.assign(me,nt,ut,dt,pt,ft,gt,kt,bt,Ct,xt,St,Tt,Pt,Ot,Mt,It,Ft,Wt,de);var ke=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,c(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 c(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 c(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 c(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 c(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 c(r(o.prototype),"visible",this)},set:function(t){c(r(o.prototype),"visible",this)!==t&&(d(r(o.prototype),"visible",t,this,!0),this.syncVisible());}},{key:"alpha",get:function(){return c(r(o.prototype),"alpha",this)},set:function(t){c(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=Q(this);return !!t&&t.setParentContainerFlag}}],[{key:"GetParent",value:function(t){return Q(t)}}]),o}(Z);Object.assign(ke.prototype,me);var be=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};var Ce=Phaser.Cameras.Scene2D.BaseCamera,xe=Phaser.Geom.Rectangle,Se=function(t,e,i){return e instanceof Ce||(i=e,e=void 0),void 0===i?i=new xe:!0===i&&(i=Te),e?t.scale.getViewPort(e,i):t.scale.getViewPort(i)},Te=new xe,Pe=Phaser.Display.Align,we={center:Pe.CENTER,left:Pe.LEFT_CENTER,right:Pe.RIGHT_CENTER,top:Pe.TOP_CENTER,bottom:Pe.BOTTOM_CENTER,"left-top":Pe.TOP_LEFT,"top-left":Pe.TOP_LEFT,"left-center":Pe.LEFT_CENTER,"center-left":Pe.LEFT_CENTER,"left-bottom":Pe.BOTTOM_LEFT,"bottom-left":Pe.BOTTOM_LEFT,"center-top":Pe.TOP_CENTER,"top-center":Pe.TOP_CENTER,"center-center":Pe.CENTER,"center-bottom":Pe.BOTTOM_CENTER,"bottom-center":Pe.BOTTOM_CENTER,"right-top":Pe.TOP_RIGHT,"top-right":Pe.TOP_RIGHT,"right-center":Pe.RIGHT_CENTER,"center-right":Pe.RIGHT_CENTER,"right-bottom":Pe.BOTTOM_RIGHT,"bottom-right":Pe.BOTTOM_RIGHT},Oe=function(){},Ee=new Phaser.GameObjects.Zone({sys:{queueDepthSort:Oe,events:{once:Oe}}},0,0,1,1);Ee.setOrigin(0);var _e=0,Le=1,Me=2,De=4,Re=6,Ie=8,ze=10,Ae=12,je=function(t){var e=Bt(t);return t.y+e-e*t.originY},Ne=function(t){var e=Ut(t);return t.x-e*t.originX+.5*e},Xe=function(t,e){var i=Bt(t);return t.y=e-i+i*t.originY,t},Ye=function(t,e){var i=Ut(t),n=i*t.originX;return t.x=e+n-.5*i,t},Fe=function(t){var e=Ut(t);return t.x-e*t.originX},We=function(t,e){var i=Ut(t);return t.x=e+i*t.originX,t},Ue=function(t){var e=Ut(t);return t.x+e-e*t.originX},Be=function(t,e){var i=Ut(t);return t.x=e-i+i*t.originX,t},Ve=function(t,e){var i=Bt(t),n=i*t.originY;return t.y=e+n-.5*i,t},Ge=function(t){var e=Bt(t);return t.y-e*t.originY+.5*e},He=function(t){var e=Bt(t);return t.y-e*t.originY},Je=function(t,e){var i=Bt(t);return t.y=e+i*t.originY,t},qe=[];qe[11]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),Ye(t,Ne(e)+i),Xe(t,je(e)+n),t},qe[ze]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),We(t,Fe(e)-i),Xe(t,je(e)+n),t},qe[Ae]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),Be(t,Ue(e)+i),Xe(t,je(e)+n),t},qe[Re]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),function(t,e,i){Ye(t,e),Ve(t,i);}(t,Ne(e)+i,Ge(e)+n),t},qe[De]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),We(t,Fe(e)-i),Ve(t,Ge(e)+n),t},qe[Ie]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),Be(t,Ue(e)+i),Ve(t,Ge(e)+n),t},qe[Le]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),Ye(t,Ne(e)+i),Je(t,He(e)-n),t},qe[_e]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),We(t,Fe(e)-i),Je(t,He(e)-n),t},qe[Me]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),Be(t,Ue(e)+i),Je(t,He(e)-n),t};var Ze=function(t,e,i,n,s,r){Ee.setPosition(e,i).setSize(n,s),function(t,e,i,n,s){qe[i](t,e,n,s);}(t,Ee,r);},Ke=Phaser.Utils.Objects.GetValue,$e=Phaser.GameObjects.Group,Qe=function(t,e,i){return t.add.text(0,0,"")},ti=void 0,ei=Phaser.Utils.Objects.GetValue,ii=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=ei(t,"left",0),e.right=ei(t,"right",0),e.top=ei(t,"top",0),e.bottom=ei(t,"bottom",0)),e},ni=ke.prototype.add,si=function(t){return ni.call(this,t),this.sizerEventsEnable&&(t.emit("sizer.add",t,this),this.emit("add",t,this)),this},ri={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),si.call(this,t),this.backgroundChildren.push(t),this.getSizerConfig(t).padding=ii(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground:function(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},oi=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},ai={getParentSizer:function(t,e){return "string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),oi(t,e)},getTopmostSizer:function(t){return void 0===t&&(t=this),function(t){for(var e=oi(t);e;)t=e,e=oi(e);return t}(t)},hasParentSizer:function(t,e){void 0===e&&(e=this);for(var i=oi(e);i;){if(i===t)return !0;i=oi(i);}return !1},hasChild:function(t,e){return void 0===e&&(e=this),this.hasParentSizer(e,t)}},hi=Phaser.Utils.Array.Remove,ui=ke.prototype.remove,ci=ai.getParentSizer,li=function(t,e){for(var i=ci(t);i;)i.removeChildCallback&&i.removeChildCallback(t,e),i=ci(i);return this.isBackground(t)&&hi(this.backgroundChildren,t),ui.call(this,t,e),!e&&this.sizerEventsEnable&&(t.emit("sizer.remove",t,this),this.emit("remove",t,this)),this},di=Phaser.Utils.Array.Remove,pi=ai.getParentSizer,vi={removeFromParentSizer:function(){var t=pi(gameObject);return t&&t.remove(this),this},removeBackground:function(t,e){return void 0===this.backgroundChildren||this.getParentSizer(t)!==this||(di(this.backgroundChildren,t),li.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}},fi=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},yi=/(\S+)\[(\d+)\]/i,gi=Phaser.Utils.Objects.GetValue,mi=function(t,e){return void 0===e?t:t[e]},ki=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=gi(i,"left",0),e.right=gi(i,"right",0),e.top=gi(i,"top",0),e.bottom=gi(i,"bottom",0)),e},bi={getInnerPadding:function(t){return mi(this.space,t)},setInnerPadding:function(t,e){return ki(this.space,t,e),this},getOuterPadding:function(t){return mi(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return ki(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return "string"==typeof t&&(t=this.getElement(t)),mi(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return "string"==typeof t&&(t=this.getElement(t)),ki(this.getSizerConfig(t).padding,e,i),this}},Ci=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},xi=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},Si={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,p(i.children)));}return t}},Ti=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSi